Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/allow-claude-yolo.md
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 2 additions & 2 deletions packages/cli/src/commands/impl/steps/handoff-claude.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
)
Expand All @@ -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.`,
)
Comment thread
coderabbitai[bot] marked this conversation as resolved.
}

Expand Down
11 changes: 10 additions & 1 deletion packages/cli/src/commands/init/lib/handoff-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -24,8 +29,12 @@ export function spawnAgent(
binary: 'claude' | 'codex',
prompt: string,
): Promise<number> {
const args =
binary === 'claude'
? ['--allow-dangerously-skip-permissions', prompt]
: [prompt]
Comment on lines +32 to +35
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot May 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

Claude CLI --allow-dangerously-skip-permissions flag exact behavior does it immediately activate bypass permissions mode or only add to shift tab cycle

💡 Result:

It only adds bypassPermissions to the Shift+Tab permission-mode cycle; it does not immediately start “bypass permissions mode”. The docs describe --allow-dangerously-skip-permissions as: “Add bypassPermissions to the Shift+Tab mode cycle without starting in it.” It lets you begin in a different mode (e.g., plan) and switch to bypass later via Shift+Tab [1]. By contrast, --dangerously-skip-permissions is what actually skips permission prompts immediately (it’s equivalent to starting in --permission-mode bypassPermissions) [1][2]. There’s also a known bug where combining --permission-mode plan with --dangerously-skip-permissions causes bypassPermissions to override plan at startup, underscoring that bypass takes effect at start only for the “dangerously-skip” flag, not for the “allow dangerously skip” flag [3].

Citations:


Use --dangerously-skip-permissions instead of --allow-dangerously-skip-permissions to achieve immediate bypass activation.

The current flag only adds bypassPermissions to the Shift+Tab permission-mode cycle without activating it immediately. Per Claude CLI documentation, --allow-dangerously-skip-permissions lets users toggle to bypass mode later via Shift+Tab, while --dangerously-skip-permissions is the flag that actually skips permission prompts at startup. For an unattended integration flow, use the latter.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/cli/src/commands/init/lib/handoff-helpers.ts` around lines 32 - 35,
The args construction currently passes the wrong Claude flag: when binary ===
'claude' replace '--allow-dangerously-skip-permissions' with
'--dangerously-skip-permissions' so the CLI immediately skips permission
prompts; update the args ternary that references binary and prompt in
handoff-helpers.ts (the args variable) to use '--dangerously-skip-permissions'
for the claude branch.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it says in the PR description, this is the intended behaviour.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@auxesis, you're right — I misread the intent. The PR deliberately uses --allow-dangerously-skip-permissions to add bypassPermissions to the Shift+Tab cycle as an opt-in, rather than --dangerously-skip-permissions which would force-activate bypass immediately. The doc comment and PR description both make this clear. Apologies for the noise!


✏️ Learnings added
Learnt from: auxesis
Repo: cipherstash/stack PR: 433
File: packages/cli/src/commands/init/lib/handoff-helpers.ts:32-35
Timestamp: 2026-05-06T23:48:55.582Z
Learning: In the CipherStash stack CLI (`packages/cli/src/commands/init/lib/handoff-helpers.ts`), the Claude handoff intentionally uses `--allow-dangerously-skip-permissions` (not `--dangerously-skip-permissions`). This adds `bypassPermissions` to the Shift+Tab mode cycle so users can opt into skip-permissions mode during the session, rather than immediately forcing bypass mode at startup. Do not flag this as a bug.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

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))
})
Expand Down