Skip to content

Commit 29d937d

Browse files
quangdang46claude
andcommitted
fix(dcg): switch to git dep + add --dangerously-skip-permissions flag
- Cargo.toml: replace local path dep with git URL https://github.com/quangdang46/destructive_command_guard (branch=main) - cli/args.rs: add --dangerously-skip-permissions bool flag (Claude Code compatibility alias for --permission-mode bypass-permissions) - cli/startup.rs: wire flag so BypassPermissions activates when set; --permission-mode still takes precedence if both are specified - Cargo.lock: bump serde_json 1.0.149 -> 1.0.150 to resolve version conflict with dcg-core git dep Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 8986a4e commit 29d937d

4 files changed

Lines changed: 19 additions & 6 deletions

File tree

Cargo.lock

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@ toml = "0.8"
123123
clap = { version = "4", features = ["derive"] }
124124

125125
# Permission modes (Plan / AcceptEdits / BypassPermissions / DontAsk).
126-
# Local path dep until dcg-core publishes to crates.io. v0.6.0-rc.1 ships
127-
# the Mode + Effect + Engine + Session API; pack-rule evaluation lands in
128-
# Phase 2.
129-
dcg-core = { path = "../destructive_command_guard/crates/dcg-core" }
126+
# Git dep from the DCG repo (not crates.io, not local path).
127+
# v0.6.0-rc.1 ships the Mode + Effect + Engine + Session API;
128+
# pack-rule evaluation lands in Phase 2.
129+
dcg-core = { git = "https://github.com/quangdang46/destructive_command_guard", branch = "main" }
130130

131131
# File operations
132132
glob = "0.3"

src/cli/args.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,12 @@ pub(crate) struct Args {
258258
#[arg(long = "permission-mode", global = true, value_enum)]
259259
pub(crate) permission_mode: Option<PermissionModeArg>,
260260

261+
/// Skip all permission prompts (alias for `--permission-mode bypass-permissions`).
262+
/// This is the Claude Code compatibility flag. When both this flag and
263+
/// `--permission-mode` are set, the explicit `--permission-mode` wins.
264+
#[arg(long = "dangerously-skip-permissions", global = true)]
265+
pub(crate) dangerously_skip_permissions: bool,
266+
261267
#[command(subcommand)]
262268
pub(crate) command: Option<Command>,
263269
}

src/cli/startup.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,14 @@ fn parse_and_prepare_args() -> Result<Args> {
177177
// --permission-mode → dcg_bridge global mode. When unspecified we leave
178178
// the default (`Mode::Default`, set by the bridge's LazyLock) untouched
179179
// so behavior matches the legacy AUTO_ALLOWED-based classify.
180+
//
181+
// `--dangerously-skip-permissions` is the Claude Code compatibility alias
182+
// for `--permission-mode bypass-permissions`. Explicit `--permission-mode`
183+
// wins when both are set.
180184
if let Some(mode) = args.permission_mode {
181185
crate::dcg_bridge::set_mode(mode.into_dcg_mode());
186+
} else if args.dangerously_skip_permissions {
187+
crate::dcg_bridge::set_mode(dcg_core::Mode::BypassPermissions);
182188
} else if let Ok(env_mode) = std::env::var("JCODE_PERMISSION_MODE") {
183189
if let Some(mode) = dcg_core::Mode::parse(env_mode.trim()) {
184190
crate::dcg_bridge::set_mode(mode);

0 commit comments

Comments
 (0)