Skip to content

Commit e95cfe0

Browse files
juhgiyoclaude
andauthored
Add --dangerously-skip-permissions as default flag (#8)
## Summary - Adds `--dangerously-skip-permissions` flag to the generated Claude CLI command by default - Flag can be disabled by setting `dangerously_skip_permissions: false` in the config JSON - Documents the new parameter in AGENT.md ## Test plan - [x] Default behavior: flag is included when config is empty - [x] Explicit true: flag is included when `dangerously_skip_permissions: true` - [x] Explicit false: flag is excluded when `dangerously_skip_permissions: false` - [x] All existing tests continue to pass 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8296141 commit e95cfe0

3 files changed

Lines changed: 66 additions & 0 deletions

File tree

claude_code/wrapper/main.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,11 @@ func cmdBuild(args []string) {
226226
cmd = append(cmd, "--permission-mode", pm)
227227
}
228228

229+
// Default: enable --dangerously-skip-permissions unless explicitly disabled.
230+
if skip, ok := config["dangerously_skip_permissions"].(bool); !ok || skip {
231+
cmd = append(cmd, "--dangerously-skip-permissions")
232+
}
233+
229234
// Single --add-dir pointing to the agent workspace.
230235
// Claude Code discovers .claude/skills/ within it natively.
231236
cmd = append(cmd, "--add-dir", ba.AgentWorkspaceDir)

claude_code/wrapper/main_test.go

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,63 @@ func TestCmdBuild_PermissionMode(t *testing.T) {
252252
assertSequence(t, cmd, "--permission-mode", "auto")
253253
}
254254

255+
func TestCmdBuild_DangerouslySkipPermissions_Default(t *testing.T) {
256+
tmpDir := t.TempDir()
257+
wsDir := filepath.Join(tmpDir, "workspace")
258+
259+
args := []string{
260+
"--agent-workspace-dir", wsDir,
261+
}
262+
263+
output := captureBuildOutput(t, args)
264+
265+
var result map[string]interface{}
266+
json.Unmarshal(output, &result)
267+
268+
cmd := result["cmd"].([]interface{})
269+
assertContains(t, cmd, "--dangerously-skip-permissions")
270+
}
271+
272+
func TestCmdBuild_DangerouslySkipPermissions_ExplicitTrue(t *testing.T) {
273+
tmpDir := t.TempDir()
274+
wsDir := filepath.Join(tmpDir, "workspace")
275+
276+
args := []string{
277+
"--agent-workspace-dir", wsDir,
278+
"--config", `{"dangerously_skip_permissions":true}`,
279+
}
280+
281+
output := captureBuildOutput(t, args)
282+
283+
var result map[string]interface{}
284+
json.Unmarshal(output, &result)
285+
286+
cmd := result["cmd"].([]interface{})
287+
assertContains(t, cmd, "--dangerously-skip-permissions")
288+
}
289+
290+
func TestCmdBuild_DangerouslySkipPermissions_Disabled(t *testing.T) {
291+
tmpDir := t.TempDir()
292+
wsDir := filepath.Join(tmpDir, "workspace")
293+
294+
args := []string{
295+
"--agent-workspace-dir", wsDir,
296+
"--config", `{"dangerously_skip_permissions":false}`,
297+
}
298+
299+
output := captureBuildOutput(t, args)
300+
301+
var result map[string]interface{}
302+
json.Unmarshal(output, &result)
303+
304+
cmd := result["cmd"].([]interface{})
305+
for _, v := range cmd {
306+
if v == "--dangerously-skip-permissions" {
307+
t.Error("cmd should NOT contain --dangerously-skip-permissions when disabled")
308+
}
309+
}
310+
}
311+
255312
// --- helpers ---
256313

257314
// captureBuildOutput runs cmdBuild and captures its stdout JSON output.

strawpot_claude_code/AGENT.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ metadata:
2121
type: string
2222
default: claude-sonnet-4-6
2323
description: Model to use for Claude Code
24+
dangerously_skip_permissions:
25+
type: boolean
26+
default: true
27+
description: Skip permission prompts (enabled by default, set to false to require approval)
2428
env:
2529
ANTHROPIC_API_KEY:
2630
required: false

0 commit comments

Comments
 (0)