Repository navigation
feat(cli): redesign onboarding wizard around the input field - #1181
Merged
Merged
Conversation
Astro-Han
added a commit
that referenced
this pull request
Jul 18, 2026
Codex + Kimi K3 parallel review of #1181 surfaced three regressions and three polish items; all accepted at their natural owner. P1 — first-run input admission (runner): restore the editor.onSubmit firstRun guard removed in the redesign. After a slash command escapes the key field (/help etc.), a later submit now reopens the wizard instead of handing control to a connection-less driver whose turns only hard-error. P1 — overlay cancel contract (OnboardingWizard): Ctrl+C was dead — the wizard handled only Escape while pi-tui's `tui.select.cancel` is [escape, ctrl+c] and the Editor returns early ("let parent handle"). handleInput now treats Ctrl+C like Esc (search cancels, key returns). P2 — async setup attempt lifecycle (runner): the setup continuation only guarded `!wizard`, so a probe settling after Esc + re-pick clobbered the newer attempt (wrong-provider error, wiped key text, or a close under the user). submitWizardKey now captures the wizard instance + a monotonic attempt id; onPick/onBack/close invalidate it. P3 — verifying locks the key field's input too (not just Enter); the dead `ok` status kind is removed; the no-match row reads "没有匹配的服务商" instead of SelectList's default "No matching commands". Coverage: first-run slash-escape guard, Ctrl+C cancel, and the stale- attempt race each get a regression test; packages/cli is 528 pass / 0 fail.
The onboarding wizard now spans provider search → API key entry in one overlay, driven by the input field itself, instead of a SelectList picker plus a one-shot editor.onSubmit interception. Typing filters the provider list live; the prompt, verifying, and failure states render in a status line beside the key field instead of the transcript entry flow (#1098 UX). - Add OnboardingWizard: editor.onChange filters providers in place; an internal search→key state machine keeps the same overlay throughout. - Runner: showSetupWizard replaces showSetupPicker; pendingKeyEntry and the editor.onSubmit onboarding/first-run branches are gone. Slash commands still route from the key field (/exit escapes the wizard). - In-flight status (verifying/failure) stays in the overlay; only the completed-configuration event reaches the transcript on /setup. First- run success still closes the TUI for the host to rebind.
Codex + Kimi K3 parallel review of #1181 surfaced three regressions and three polish items; all accepted at their natural owner. P1 — first-run input admission (runner): restore the editor.onSubmit firstRun guard removed in the redesign. After a slash command escapes the key field (/help etc.), a later submit now reopens the wizard instead of handing control to a connection-less driver whose turns only hard-error. P1 — overlay cancel contract (OnboardingWizard): Ctrl+C was dead — the wizard handled only Escape while pi-tui's `tui.select.cancel` is [escape, ctrl+c] and the Editor returns early ("let parent handle"). handleInput now treats Ctrl+C like Esc (search cancels, key returns). P2 — async setup attempt lifecycle (runner): the setup continuation only guarded `!wizard`, so a probe settling after Esc + re-pick clobbered the newer attempt (wrong-provider error, wiped key text, or a close under the user). submitWizardKey now captures the wizard instance + a monotonic attempt id; onPick/onBack/close invalidate it. P3 — verifying locks the key field's input too (not just Enter); the dead `ok` status kind is removed; the no-match row reads "没有匹配的服务商" instead of SelectList's default "No matching commands". Coverage: first-run slash-escape guard, Ctrl+C cancel, and the stale- attempt race each get a regression test; packages/cli is 528 pass / 0 fail.
setupApiKeyConnection called setDefault before probing models, so a typo'd first-run key was already the default when the probe failed. Cancelling the wizard then let the host read getDefault() !== null and proceed into a broken default, and the next launch no longer re-triggered onboarding (isFirstRun turned false). Move setDefault after a successful fetchModels so getDefault() stays an accurate success signal; the connection is still saved so retrying rotates the key.
- submitPrompt is now the single first-run choke point: move the guard out of editor.onSubmit and place it after handleSlashCommand so Alt+Enter (and any future idle-submit path) reopens the wizard instead of opening a turn against the stub driver, while /exit still exits. - OnboardingWizard key phase: Ctrl+C cancels the wizard (overlay cancel contract) and Esc returns to search, instead of both going back. - Drop the dead requiresBaseUrl description branch (providers needing a base URL are filtered out before the picker) and add a `closed` guard to the setup continuations so a late settlement after beginClose no longer touches a stopped TUI.
Astro-Han
force-pushed
the
feat/cli-onboarding-input-wizard
branch
from
July 18, 2026 03:49
672202f to
64de2f2
Compare
5 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The first-run /
/setuponboarding wizard pushed its prompt, verifying, and failure notices into the transcript entry flow, and the provider picker had no search — both defeated a focused, input-driven configuration experience (#1098).This redesign makes one overlay span provider search → API key entry, driven by the input field itself:
editor.onChangerebuilds theSelectList, which exposes nosetItems)./setup; first-run success still closes the TUI so the host rebinds the new connection.search → keystate machine replaces the oldSelectListpicker plus a one-shoteditor.onSubmitinterception, so there is no longer a split between "picker UI" and "key UI." Slash commands still route from the key field (/exitescapes the wizard).The wizard replaces
showSetupPicker+pendingKeyEntryin the runner.MakaOnboardingSurface/setupApiKeyConnectionare unchanged, so the upsert-by-slug key rotation, atomic secret-write rollback, and probe-error retry all carry over.A standalone full-screen wizard was considered and rejected: it would reimplement TUI primitives (raw mode, render loop, layout) to delete the ~30-line first-run stub driver — a net complexity increase for no correctness gain. Reusing the existing
runMakaPiTuiframe and rendering the wizard as a bottom overlay keeps the change inside the runner layer.Refs #1098.
Verification
npm run typecheck(all workspaces) — clean.packages/cli:node --test "dist/**/*.test.js"— 525 pass, 0 fail.pi-tui-runner.test.ts:onboarding wizard filters the provider list as you type in the search fieldonboarding wizard keeps verifying/failure status beside the input, out of the transcriptonboarding wizard key Esc returns to the provider search/setup+ first-run journey tests (provider list, key collection, probe-failure retry, slash-command routing, no-surface guard, first-run cancel/auto-open) pass unchanged against the new wizard — the search → key path is interaction-compatible.No screenshot attached; the wizard is exercised through the
FakeTerminalTUI harness that drives the rest of the runner suite. One live visual pass during review is worthwhile.