feat: expose bash risk gate as configurable /settings toggle (persisted in config.toml)
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 19.9k
- Forks
- 2.3k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 30
Description
Problem
The destructive-command risk gate in bash_destructive_gate.rs is hardcoded. There is no way for users to disable it when it over-fires on safe commands, or re-enable it after disabling. This is the user-facing counterpart to #751 (which fixes the classifier itself).
Proposed Solution
Expose the risk gate as a configurable, persisted setting:
- Add
risk_gate_enabledfield toProviderConfiginjcode-config-types(defaults totrue) - Persist to
config.tomlso it survives new sessions - Add
/settingsTUI command:/settings(show),/settings risk-gate on,/settings risk-gate off - Support env override
JCODE_RISK_GATE_ENABLED=falsefor per-launch control - Show status in
/configoutput asRisk gate: enabled/disabled - When disabled,
bash_destructive_gate.rsskips the gate entirely (returnsNone)
Implementation
Working implementation on my fork (single commit, compiles, 7 tests pass):
https://github.com/alecuba16/jcode/tree/feature/risk-gate-toggle
The gate is enabled by default so existing behavior does not change. Users who hit false positives (like #751) can temporarily disable it with /settings risk-gate off or JCODE_RISK_GATE_ENABLED=false until the classifier itself is fixed.
Tests
7 behavioral tests covering: show status, toggle on/off with persistence verification, invalid value handling, bare subcommand usage, unknown subcommand, and non-matching command rejection. All pass.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with bash_destructive_gate.rs and ProviderConfig in jcode-config-types, then trace the existing /settings and /config TUI command paths and config.toml persistence. Check the fork's seven behavioral tests for the intended cases. Done means the setting defaults enabled, persists across sessions, supports the stated command and environment controls, and updates the displayed status.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100