diff --git a/.changeset/allow-claude-yolo.md b/.changeset/allow-claude-yolo.md new file mode 100644 index 00000000..49c642db --- /dev/null +++ b/.changeset/allow-claude-yolo.md @@ -0,0 +1,5 @@ +--- +"stash": patch +--- + +feat(cli): pass `--allow-dangerously-skip-permissions` when `stash init` launches Claude Code, so the user can opt in to skip-permissions mode mid-session without relaunching. Codex and Wizard handoffs are unchanged. diff --git a/packages/cli/src/commands/impl/steps/handoff-claude.ts b/packages/cli/src/commands/impl/steps/handoff-claude.ts index bfb5f610..41d2c4fb 100644 --- a/packages/cli/src/commands/impl/steps/handoff-claude.ts +++ b/packages/cli/src/commands/impl/steps/handoff-claude.ts @@ -47,7 +47,7 @@ export const handoffClaudeStep: HandoffStep = { `Install: ${CLAUDE_INSTALL_URL}`, '', 'Once installed, run:', - ` claude '${launchPrompt}'`, + ` claude --allow-dangerously-skip-permissions '${launchPrompt}'`, ].join('\n'), 'Files written — install Claude Code to run the handoff', ) @@ -58,7 +58,7 @@ export const handoffClaudeStep: HandoffStep = { const exitCode = await spawnAgent('claude', launchPrompt) if (exitCode !== 0) { p.log.warn( - `Claude Code exited with code ${exitCode}. Re-run \`claude '${launchPrompt}'\` to resume.`, + `Claude Code exited with code ${exitCode}. Re-run \`claude --allow-dangerously-skip-permissions '${launchPrompt}'\` to resume.`, ) } diff --git a/packages/cli/src/commands/init/lib/handoff-helpers.ts b/packages/cli/src/commands/init/lib/handoff-helpers.ts index 45b2e96e..bd4ac2d0 100644 --- a/packages/cli/src/commands/init/lib/handoff-helpers.ts +++ b/packages/cli/src/commands/init/lib/handoff-helpers.ts @@ -16,6 +16,11 @@ import { * prompt as a single argument. `stdio: 'inherit'` so the user sees tool * calls and approves edits live; the call resolves with the exit code. * + * Claude is launched with `--allow-dangerously-skip-permissions` so the + * user can opt in to skip-permissions mode for the integration handoff + * without having to relaunch — the flag permits the toggle, it doesn't + * force it on. + * * Returns -1 if the binary isn't on PATH (the spawn `error` event fires * before `close` does). Init never aborts on a non-zero code — the * artifacts are already written, the user can re-run the agent. @@ -24,8 +29,12 @@ export function spawnAgent( binary: 'claude' | 'codex', prompt: string, ): Promise { + const args = + binary === 'claude' + ? ['--allow-dangerously-skip-permissions', prompt] + : [prompt] return new Promise((resolvePromise) => { - const child = spawn(binary, [prompt], { stdio: 'inherit', shell: false }) + const child = spawn(binary, args, { stdio: 'inherit', shell: false }) child.on('close', (code) => resolvePromise(code ?? 0)) child.on('error', () => resolvePromise(-1)) })