Skip to content

Respect Claude permission-mode flags and Auto Mode settings#62

Merged
nikvdp merged 4 commits into
masterfrom
claude-auto-mode-permission
Apr 30, 2026
Merged

Respect Claude permission-mode flags and Auto Mode settings#62
nikvdp merged 4 commits into
masterfrom
claude-auto-mode-permission

Conversation

@nikvdp
Copy link
Copy Markdown
Owner

@nikvdp nikvdp commented Apr 30, 2026

Summary

This PR respects Claude's explicit --permission-mode flags and trusted Auto Mode settings instead of unconditionally appending a bypass flag.

Changes

  • Detect explicit permission modes: When Claude is launched with an explicit --permission-mode argument, cco no longer adds its default bypass flag — the user's choice is respected.
  • Read Claude's trusted settings: Reads ~/.claude/settings.json for defaultMode: "auto" and disableAutoMode to preserve user Auto Mode preferences when no explicit mode is passed.
  • Shared permission-argument builder: Unified the permission argument construction logic across native and Docker launch paths for consistency.
  • Documentation: Added guidance on --permission-mode auto passthrough and how it relates to cco's bypass default.
  • Tests: New tests covering explicit mode suppression and trusted Auto Mode behavior.

Notes

  • Existing behavior is preserved when no explicit mode is given — cco still adds the bypass flag by default.
  • The Docker launch path shares the same argument builder as native, so both are covered by the same logic.

nikvdp added 4 commits April 30, 2026 21:40
- Detect explicit Claude permission-mode arguments and avoid adding duplicate bypass flags
- Read trusted Claude settings for defaultMode auto and disableAutoMode
- Reuse one permission-argument builder across native and Docker Claude launches

This lets Auto Mode run through cco when the user has selected it while keeping the existing bypass default otherwise.
- Assert explicit Claude permission modes suppress cco's default bypass flag
- Cover trusted default Auto Mode settings
- Verify disabled Auto Mode falls back to the existing bypass default

This protects the Auto Mode launch decision without starting real Claude sessions.
- Show --permission-mode auto in the Claude pass-through examples
- Explain that explicit permission modes prevent cco from adding its bypass default
- Note that trusted default Auto Mode settings are preserved when not disabled

This makes the Auto Mode behavior discoverable without changing the command surface.
- Return early when the Claude argument array is declared but empty
- Avoid iterating an empty array under nounset on older Bash versions
- Keep explicit permission-mode detection unchanged for populated argument lists

This prevents Auto Mode default settings from failing during startup preflight checks on macOS runners.
@nikvdp nikvdp merged commit a4e41e7 into master Apr 30, 2026
5 checks passed
@nikvdp nikvdp deleted the claude-auto-mode-permission branch April 30, 2026 15:03
@nikvdp nikvdp mentioned this pull request Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant