-
Notifications
You must be signed in to change notification settings - Fork 3
feat(cli, wizard): support plan mode in wizard #435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| "@cipherstash/wizard": minor | ||
| "stash": minor | ||
| --- | ||
|
|
||
| Add plan-mode support to the wizard so `stash plan` can hand off to the CipherStash Agent. The wizard now accepts `--mode <plan|implement>` (default `implement` for back-compat). In plan mode it skips the column-selection TUI, forwards `mode: 'plan'` to the gateway (which returns a planning prompt whose deliverable is `.cipherstash/plan.md`), and skips the post-agent install/push/migrate and call-site-scan steps. Implement mode is unchanged. | ||
|
|
||
| `stash plan`'s handoff picker now offers all four targets (Claude Code, Codex, AGENTS.md, CipherStash Agent) — the wizard is no longer gated out of plan mode. `stash impl`'s picker is unchanged. | ||
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| import { describe, expect, it } from 'vitest' | ||
| import { parseArgs } from '../bin/parse-args.js' | ||
|
|
||
| // `parseArgs` takes the full process.argv (node + script + args), so the | ||
| // test shapes its inputs the same way: ['node', 'wizard.js', ...flags]. | ||
| function argv(...flags: string[]): string[] { | ||
| return ['node', 'wizard.js', ...flags] | ||
| } | ||
|
|
||
| describe('wizard parseArgs — mode resolution', () => { | ||
| it('defaults to implement when no mode flag is passed', () => { | ||
| expect(parseArgs(argv()).mode).toBe('implement') | ||
| // --debug alone shouldn't change mode | ||
| expect(parseArgs(argv('--debug')).mode).toBe('implement') | ||
| }) | ||
|
|
||
| it('accepts the --plan shortcut', () => { | ||
| expect(parseArgs(argv('--plan')).mode).toBe('plan') | ||
| }) | ||
|
|
||
| it('accepts the --implement shortcut (no-op against the default)', () => { | ||
| expect(parseArgs(argv('--implement')).mode).toBe('implement') | ||
| }) | ||
|
|
||
| it('accepts --mode plan (space-separated long form)', () => { | ||
| expect(parseArgs(argv('--mode', 'plan')).mode).toBe('plan') | ||
| expect(parseArgs(argv('--mode', 'implement')).mode).toBe('implement') | ||
| }) | ||
|
|
||
| it('accepts --mode=plan (equals-separated long form)', () => { | ||
| expect(parseArgs(argv('--mode=plan')).mode).toBe('plan') | ||
| expect(parseArgs(argv('--mode=implement')).mode).toBe('implement') | ||
| }) | ||
|
|
||
| it('rejects unknown --mode values with a clear error', () => { | ||
| const result = parseArgs(argv('--mode', 'yolo')) | ||
| expect(result.modeError).toMatch(/Unknown --mode value/) | ||
| expect(result.modeError).toMatch(/yolo/) | ||
| }) | ||
|
|
||
| it('rejects unknown --mode= values with a clear error', () => { | ||
| const result = parseArgs(argv('--mode=yolo')) | ||
| expect(result.modeError).toMatch(/Unknown --mode value/) | ||
| }) | ||
|
|
||
| it('rejects --mode at the end of argv with a clear error (regression: silent fall-through)', () => { | ||
| // Without the trailing-value guard, `--mode` as the final arg falls | ||
| // through to the default `implement` with no diagnostic — strictly | ||
| // worse than `--mode=` (which already errors). Both forms now surface | ||
| // the same "requires a value" error. | ||
| const result = parseArgs(argv('--mode')) | ||
| expect(result.modeError).toMatch(/--mode requires a value/) | ||
| }) | ||
|
|
||
| it('lets the last mode flag win when multiple are passed', () => { | ||
| // Useful for wrappers that always append a mode flag — they don't have | ||
| // to detect and remove an earlier one. | ||
| expect(parseArgs(argv('--plan', '--implement')).mode).toBe('implement') | ||
| expect(parseArgs(argv('--implement', '--plan')).mode).toBe('plan') | ||
| expect(parseArgs(argv('--mode', 'plan', '--implement')).mode).toBe( | ||
| 'implement', | ||
| ) | ||
| expect(parseArgs(argv('--implement', '--mode=plan')).mode).toBe('plan') | ||
| }) | ||
|
|
||
| it('threads --debug independently of mode flags', () => { | ||
| expect(parseArgs(argv('--plan', '--debug')).debug).toBe(true) | ||
| expect(parseArgs(argv('--debug', '--plan')).mode).toBe('plan') | ||
| }) | ||
|
|
||
| it('exposes --help and --version flags independently', () => { | ||
| expect(parseArgs(argv('--help')).help).toBe(true) | ||
| expect(parseArgs(argv('-h')).help).toBe(true) | ||
| expect(parseArgs(argv('--version')).version).toBe(true) | ||
| expect(parseArgs(argv('-v')).version).toBe(true) | ||
| }) | ||
| }) |
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not convinced backwards compatibility is important here, and would be fine with the default being
plan.