1jehuang / 1jehuang/jcode

feat: expose bash risk gate as configurable /settings toggle (persisted in config.toml)

Open
#897 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

autonomous: no enhancement triage: needs-decision ux
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_enabled field to ProviderConfig in jcode-config-types (defaults to true)
  • Persist to config.toml so it survives new sessions
  • Add /settings TUI command: /settings (show), /settings risk-gate on, /settings risk-gate off
  • Support env override JCODE_RISK_GATE_ENABLED=false for per-launch control
  • Show status in /config output as Risk gate: enabled/disabled
  • When disabled, bash_destructive_gate.rs skips the gate entirely (returns None)

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.