Experimental: integrate dcg-core permission-modes API#317
Open
quangdang46 wants to merge 1 commit into
Open
Conversation
Wire jcode's SafetySystem.classify() through a new dcg_bridge module that
delegates to dcg_core::Engine::evaluate, replacing the legacy
AUTO_ALLOWED hard-coded string table.
Changes:
- Add src/dcg_bridge.rs (355 lines): action-to-ToolCall mapping,
BridgeDecision enum, global Mode/Engine/Session singletons,
6 unit tests.
- Add --permission-mode CLI flag (plan | accept-edits | bypass-permissions |
don-t-ask | auto | default) mirroring Claude Code's API.
- Wire mode from CLI flag + JCODE_PERMISSION_MODE env var at startup.
- Map SafetySystem.classify() → dcg_bridge.classify(), collapsing
BridgeDecision::Allow → ActionTier::AutoAllowed.
- Add dcg-core = { path = "../destructive_command_guard/crates/dcg-core" }
as local path dep (Phase A: Mode + Effect + Engine + Session only;
pack-rule evaluation lands in Phase 2).
All tests pass (6 dcg_bridge, 9 safety, cargo check/fmt clean).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Integrate jcode's
SafetySystem.classify()withdcg-core's permission-modes API via a newdcg_bridgemodule, replacing the legacy hard-codedAUTO_ALLOWEDstring table.Changes
src/dcg_bridge.rs(355 lines): bridges jcode's high-level action vocabulary todcg-core::Engine::evaluate. Includes action-to-ToolCall mapping,BridgeDecisionenum, globalMode/Engine/Sessionsingletons, and 6 unit tests.--permission-modeCLI flag: supportsplan | accept-edits | bypass-permissions | dont-ask | auto | default, mirroring Claude Code's API.JCODE_PERMISSION_MODEenv var.SafetySystem::classify()now delegates todcg_bridge::classify(), collapsingBridgeDecision::Allow → ActionTier::AutoAllowed.dcg-coreas local path dep (../destructive_command_guard/crates/dcg-core).Test plan
cargo test -p jcode --lib— dcg_bridge + safety tests passcargo check -p jcode— compiles cleancargo fmt --check— formatting clean🤖 Generated with Claude Code