vscode: startup preflight — verify codev CLI installed and version ≥ extension#955
Merged
Conversation
…gh to 'Get started with Codev'
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.
PIR Review: VSCode startup preflight — verify codev CLI installed and version ≥ extension
Fixes #791
Summary
Adds a startup preflight to the VSCode extension that, on
activate(), verifies thecodevCLI is installed and at least as new as the extension's ownpackage.jsonversion. The result is cached per session and bounded to 400ms (fire-and-forget, so activation never blocks). A missing CLI auto-opens theGet started with Codevwalkthrough (once per workspace); an outdated CLI shows an upgrade notification (Update via npm/Open Install Docs); either prompt dismissed leaves Codev commands registered but no-op'ing cleanly with a singleRun Setuptoast. A persistent Codev CLI row in the sidebar Status view plus aCodev: Recheck CLIcommand let the user re-verify after fixing. This replaces the prior cryptic failure mode (a missing CLI surfaced only as a Tower-startup error logged to the OutputChannel) with actionable, state-specific guidance.Preview
Files Changed
packages/vscode/src/preflight/preflight-core.ts(+105 / -0) — new, pure/vscode-free logicpackages/vscode/src/preflight/preflight.ts(+261 / -0) — new, vscode gluepackages/vscode/src/extension.ts(+~90 / -~50) — preflight wiring +reg()/regCli()registrarspackages/vscode/src/views/status.ts(+42 / -0) — Codev CLI status rowpackages/vscode/package.json(+~35 / -~3) —recheckClicommand, status-row inline menu, walkthrough contributionpackages/vscode/walkthroughs/detect.md,install.md,verify.md(+61 / -0) — walkthrough step bodiespackages/vscode/src/__tests__/preflight-core.test.ts(+100 / -0) — new unit testspackages/vscode/src/__tests__/contributes-walkthroughs.test.ts(+61 / -0) — new contribution-invariant testspackages/vscode/src/__tests__/extension-architect-commands.test.ts(+~6 / -~6) — updated source-sentinels for thereg/regCliregistrar renamecodev/resources/arch.md,codev/resources/lessons-learned.md— see sections belowCommits
2b87f216[PIR vscode: startup preflight — verify codev CLI installed and version ≥ extension version; guide install/upgrade otherwise #791] Add CLI preflight core + vscode glue3ec42037[PIR vscode: startup preflight — verify codev CLI installed and version ≥ extension version; guide install/upgrade otherwise #791] Wire preflight into activation; guard CLI-dependent commandsf3b08dbb[PIR vscode: startup preflight — verify codev CLI installed and version ≥ extension version; guide install/upgrade otherwise #791] Add Codev CLI status row with inline recheckb2908122[PIR vscode: startup preflight — verify codev CLI installed and version ≥ extension version; guide install/upgrade otherwise #791] Add recheck command, status-row menu, Getting Started walkthrougha7ee702d[PIR vscode: startup preflight — verify codev CLI installed and version ≥ extension version; guide install/upgrade otherwise #791] Tests for preflight core + walkthrough contribution64c29805[PIR vscode: startup preflight — verify codev CLI installed and version ≥ extension version; guide install/upgrade otherwise #791] Refactor command guarding into reg()/regCli() registrarseea70d29[PIR vscode: startup preflight — verify codev CLI installed and version ≥ extension version; guide install/upgrade otherwise #791] Note Node.js >=20 prerequisite in install walkthroughccb5bb5f[PIR vscode: startup preflight — verify codev CLI installed and version ≥ extension version; guide install/upgrade otherwise #791] Complete Verify step on cliReady context; rename walkthrough to 'Get started with Codev'Test Results
pnpm check-types: ✓ passpnpm lint: ✓ passpnpm test:unit: ✓ pass (155 tests, ~25 new across the two new suites)node esbuild.js: ✓ bundlesbuild+testschecks: ✓ pass (8.6s / 21.3s)dev-approvalgate): ran the Extension Development Host against the worktree; reviewed theGet started with Codevwalkthrough (three steps), confirmed the Verify-step completion now keys offcodev.cliReady, and approved the title/behaviour.Architecture Updates
Updated
codev/resources/arch.md— added a "Startup CLI preflight (#791)" bullet to the VS Code Extension Key Design Decisions list, documenting: the on-activatecodev --versioncheck vs the extension's own version, the fire-and-forget/cached/400ms-bounded probe, the missing/outdated/dismissed UX branches, thereg/regClitwo-registrar guard pattern (registrar name = guard policy, no separate list), thecodev.cliReadycontext key, and thesrc/preflight/core+glue split. This is a genuine new architectural behaviour for the extension (a thin client that now verifies the CLI dependency it relies on), so it belongs in arch.md rather than only in this review.Lessons Learned Updates
Added two entries to
codev/resources/lessons-learned.md(UI/UX), both durable for future VSCode work:completionEventsfall back toonStepSelected(auto-tick on view, which reads as false progress; the first step auto-selects on open). Wire completion to an observable signal (onContext:/onCommand:/onSettingChanged:), and key it on outcome (onContext:codev.cliReady) not attempt (onCommand:recheck) so a failed retry doesn't falsely complete the step.node/npmon the user's PATH (VSCode ships its own bundled Node for the extension host). Install/CLI guidance must state the Node prerequisite (codev needs ≥20) and resolve binaries from workspace/PATH.Things to Look At During PR Review
regCliwraps 15 CLI-dependent commands;regregisters the other 29 unguarded (recovery/recheck/config-toggles/read-only viewers). Confirm nothing critical is mis-classified. The policy is now the registrar name at each call site (grepregCli(), there is no separate list.pending—isCliReady()treats the not-yet-resolved preflight window (~≤400ms) as ready, so a command fired during startup is never falsely blocked. The trade-off (a command in that window won't be guarded even if the CLI is actually missing) is intentional; the command then falls through its existing not-connected path and the walkthrough/notification still fires once preflight resolves.Update via npmauto-runs the install in an integrated terminal (the button click is the confirmation). The terminal-close re-verify is instance-matched and exit-code-gated; a failed/cancelled install does not silently re-cache — it surfaces an explicitRechecktoast.when— intentionally not gated; the walkthrough is always listed and VSCode features it once per install (workbench.welcomePage.walkthroughs.openOnInstall), which is acceptable. Our explicit once-per-workspace auto-open on themissingpath is additive.missing/outdated, notpending(raised by the Codex consultation as a COMMENT — minor plan drift). Deliberate:pendingis the ≤400ms transient startup-probe state (shown as a spinner) with a preflight already in flight — a recheck button there is meaningless and would risk launching a second concurrentcodev --version. The plan's wording listedpendingtoo; this is an intentional narrowing. Verdicts: Gemini APPROVE, Claude APPROVE, Codex COMMENT (no REQUEST_CHANGES). PIR's consultation is single-pass, so this decision is recorded here for thepr-gate reviewer rather than re-reviewed by the models.How to Test Locally
pir-791→ View Diffcodevoff PATH →Get started with Codevwalkthrough opens once per workspace; Status row shows ✗ with inline recheck.codev --versionbelow the extension version → upgrade notification;Open Install Docsopens the browser;Update via npmruns the install in a terminal.Codev: Recheck CLI) → row flips to ✓; the walkthrough's Verify step completes viacodev.cliReady.Run Setuptoast; an unguarded command (Reconnect) still works.