feat(cli): front door offers capture install + plugin SessionStart setup nudge - #28
Open
bogatyrjov1 wants to merge 1 commit into
Open
feat(cli): front door offers capture install + plugin SessionStart setup nudge#28bogatyrjov1 wants to merge 1 commit into
bogatyrjov1 wants to merge 1 commit into
Conversation
…tup nudge Two front-door reliability improvements for the published CLI/plugin. Part 1 — bare-terminal capture auto-offer (firstRun.ts step 4a) - Inside Claude Code: unchanged — still RECOMMENDS the plugin (the CLI cannot install a CC plugin and must never hand-write the fragile npx settings hook). - Bare terminal: detect the user's installed agent by config-dir presence (~/.codex / ~/.cursor / ~/.gemini via new pure detectAgents.ts). When exactly ONE is found, OFFER to wire its capture inline (prompted, never silent) and on yes run the same per-agent writer as `install --agent <x>` (no re-auth, no backfill). Zero / multiple / non-interactive (no TTY) fall back to the printed capture guidance — never guesses, never hangs on stdin. - New prompt.ts (promptYesNo) carries the load-bearing TTY guard: no interactive terminal -> resolve the default without reading stdin. - New StartDeps seams (detectAgentsImpl / promptYesNoImpl / installAgentImpl / home) keep it unit-testable with no real fs/stdin. Part 2 — plugin SessionStart "finish setup" nudge - New internal `setup-check` subcommand (not in USAGE, like `capture --from-hook`) + new setupCheck.ts. When the plugin is installed but setup is incomplete (not onboarded OR no device token) it prints a SessionStart additionalContext line so Claude can relay "run /backthread:start to finish setup"; once set up it prints nothing. Non-blocking by construction: additionalContext + exit 0 (never exit 2), two cheap reads, never throws. - Register the SessionStart hook (matcher `startup`, runs the bundled bin) in hooks.json so it nudges at session start and not on resume. Also: version bump 0.4.0 -> 0.4.1 lockstep across the 4 manifests (cli/package.json, cli/.claude-plugin/plugin.json, extensions/gemini, extensions/codex), committed dist-bundle, and focused tests for all of the above (439 pass). No publish / no tag — a maintainer cuts the release. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What
Two front-door reliability improvements to the published
backthreadCLI + its Claude Code plugin. Both reduce the "installed but capture never actually wired" failure mode.Part 1 — CLI front door detects the agent and offers to wire capture inline
In
runStartstep (4a), the bare-terminal door used to just print capture guidance. Now it does detect → offer → install:CLAUDECODE=1): unchanged — still recommends the plugin. The CLI can't install a CC plugin itself, and must never hand-write the fragile npxsettings.jsonhook (the ARP-680 worktree-freeze path), so it never auto-installs here.~/.codex/~/.cursor/~/.gemini, new puredetectAgents.ts). When exactly one is found and the session is interactive, promptDetected <Agent> — wire capture for it now? [Y/n](empty = Yes). On yes, run the same per-agent writer asbackthread install --agent <x>(auth already happened earlier in the wizard, so no re-auth and no backfill — matches the existing per-agent install leg). On no, fall back to the printed capture command.prompt.ts(promptYesNo) carries the load-bearing TTY guard (no interactive terminal → resolve the default without reading stdin). NewStartDepsseams (detectAgentsImpl/promptYesNoImpl/installAgentImpl/home) keep it unit-testable with no real fs/stdin.Part 2 — plugin SessionStart "finish setup" nudge
New internal
setup-checksubcommand (not listed in USAGE, likecapture --from-hook) + newsetupCheck.ts. When the plugin is installed but setup is incomplete (not onboarded OR no device token), it prints a SessionStartadditionalContextline so Claude can relay "run/backthread:startto finish setup". Once set up, it prints nothing (silent forever). Registered as aSessionStarthook (matcherstartup) inhooks.json.Why
additionalContext+ exit 0, not exit 2: a setup nudge must be non-blocking — exit 2 would block/disrupt session startup. Matcherstartup(notresume) so it doesn't nag on every resume. Two cheap file reads, never throws (any error → silence).Notes / deviations
mainhad already advanced to 0.4.0 (withinstallAgent.tschanges from ARP-689/692) since this task was written, so I branched offorigin/mainand patch-bumped from there to avoid a regressive/conflicting PR. Lockstep applied across all 4 manifests (cli/package.json,cli/.claude-plugin/plugin.json,extensions/gemini/gemini-extension.json,extensions/codex/plugins/backthread/plugin.json) so theplugin/gemini/codexlockstep tests stay green.cli/dist-bundle/backthread.js(CI sync-checks it).package-lock.jsonhad a pre-existing unrelated dirty diff; left it out of this commit.Tests
npm run typecheckandnpm testboth pass — 439 tests, 0 fail. New focused tests fordetectAgents,prompt(incl. the TTY guard),setupCheck, the firstRun offer path (single+yes / single+no / zero / multiple / inside-CC / version-warning / writer-throw), the plugin SessionStart hook structure, and thesetup-checkbin dispatch.Release
This needs review before a release is cut — no
npm publishand nov*tag were created.🤖 Generated with Claude Code