feat(init): prompt for harness when --ai is absent (TTY only) (#36)#37
Merged
feat(init): prompt for harness when --ai is absent (TTY only) (#36)#37
Conversation
…#36) `specflow init` no longer silently defaults to Claude when the user hasn't passed --ai. In an interactive terminal it now lists the 8 supported harnesses and asks the user to pick one (Enter = Claude default, invalid input re-prompts). When stdin isn't a TTY (CI, scripts, piped input), the silent Claude default is preserved — zero regression for automated usage. Implementation: - New pure module src/cli/harness_picker.ts encapsulates the list, default, and re-prompt loop with an injectable readLine for testing. - Parser: ai field becomes Harness | null. The handler resolves null to a concrete harness via Deno.stdin.isTerminal() + pickHarness. - TerminalPrompt is left untouched — its select() doesn't support empty-input-as-default and the picker has its own loop semantics, so reusing it would have required a richer signature than this ticket needs. Closes #36 Co-Authored-By: Claude Opus 4.7 (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.
Summary
specflow initno longer silently defaults to Claude when the user hasn't passed--ai. In an interactive terminal it now lists the 8 supported harnesses (Claude Code, Cursor, Codex, Gemini, Windsurf, Copilot, OpenCode, Antigravity) and asks the user to pick one — Enter selects the Claude default, invalid input re-prompts.Implementation notes
src/cli/harness_picker.tsencapsulates the list, default, and re-prompt loop, with an injectablereadLinecallback so the picker logic is fully unit-testable without a real TTY.intent.aibecomesHarness | null. The handler resolvesnullto a concrete harness viaDeno.stdin.isTerminal()+pickHarness().TerminalPromptis left untouched — itsselect()doesn't support "empty-input as default" and the picker has its own loop semantics, so reusing it would have required a richer signature than this ticket needs.Test plan
null(EOF/Ctrl-D) → default.specflow init (no --ai) defaults to Claude in non-TTY environmentsto reflect what it actually exercises (Deno.Commandpipes stdin, soisTerminal()is false).specflow init --herefrom working tree against a fresh Vite project → no prompt shown, lock written withharness: claude, "Open the project in Claude Code" banner appears.deno task test— 339 passed.Closes #36
🤖 Generated with Claude Code