Skip to content

Commit 440879b

Browse files
committed
feat(cli): allow user to opt into permissions bypass
When a user starts onboarding by running `npx stash@latest init`, it runs through a series of detection steps, and finishes by handing off to one of Claude Code, Codex, an `AGENTS.md` editor agent, or the CipherStash Wizard, to do the integration of the encryption SDK into their app. When the user picks Claude Code, the CLI spawns the claude binary with a single argument — the launch prompt — and inherits stdio so the user can watch the session. Claude needs to run a lot of read/edit/exec commands to understand the project before it can wire up the encryption SDK. Unless the user has already configured Claude to skip permission prompts, every one of those commands stops to ask for approval. That forces the user to babysit the integration the whole way through. `init` should invoke Claude with `--allow-dangerously-skip-permissions`, so the user can shift to that mode if they decide to let Claude run with the integration.
1 parent e57b53f commit 440879b

3 files changed

Lines changed: 17 additions & 3 deletions

File tree

.changeset/allow-claude-yolo.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"stash": patch
3+
---
4+
5+
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.

packages/cli/src/commands/init/lib/handoff-helpers.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ import {
1616
* prompt as a single argument. `stdio: 'inherit'` so the user sees tool
1717
* calls and approves edits live; the call resolves with the exit code.
1818
*
19+
* Claude is launched with `--allow-dangerously-skip-permissions` so the
20+
* user can opt in to skip-permissions mode for the integration handoff
21+
* without having to relaunch — the flag permits the toggle, it doesn't
22+
* force it on.
23+
*
1924
* Returns -1 if the binary isn't on PATH (the spawn `error` event fires
2025
* before `close` does). Init never aborts on a non-zero code — the
2126
* artifacts are already written, the user can re-run the agent.
@@ -24,8 +29,12 @@ export function spawnAgent(
2429
binary: 'claude' | 'codex',
2530
prompt: string,
2631
): Promise<number> {
32+
const args =
33+
binary === 'claude'
34+
? ['--allow-dangerously-skip-permissions', prompt]
35+
: [prompt]
2736
return new Promise((resolvePromise) => {
28-
const child = spawn(binary, [prompt], { stdio: 'inherit', shell: false })
37+
const child = spawn(binary, args, { stdio: 'inherit', shell: false })
2938
child.on('close', (code) => resolvePromise(code ?? 0))
3039
child.on('error', () => resolvePromise(-1))
3140
})

packages/cli/src/commands/init/steps/handoff-claude.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export const handoffClaudeStep: InitStep = {
4343
`Install: ${CLAUDE_INSTALL_URL}`,
4444
'',
4545
'Once installed, run:',
46-
` claude '${launchPrompt}'`,
46+
` claude --allow-dangerously-skip-permissions '${launchPrompt}'`,
4747
].join('\n'),
4848
'Files written — install Claude Code to run the handoff',
4949
)
@@ -54,7 +54,7 @@ export const handoffClaudeStep: InitStep = {
5454
const exitCode = await spawnAgent('claude', launchPrompt)
5555
if (exitCode !== 0) {
5656
p.log.warn(
57-
`Claude Code exited with code ${exitCode}. Re-run \`claude '${launchPrompt}'\` to resume.`,
57+
`Claude Code exited with code ${exitCode}. Re-run \`claude --allow-dangerously-skip-permissions '${launchPrompt}'\` to resume.`,
5858
)
5959
}
6060

0 commit comments

Comments
 (0)