Skip to content

feat(cli): REPL commands for permissions/sessions/hooks/trust + --dangerously-skip-permissions - #28

Merged
Amanbig merged 3 commits into
mainfrom
feat/repl-parity-and-skip-permissions
Oct 31, 2026
Merged

Amanbig merged 3 commits into
mainfrom
feat/repl-parity-and-skip-permissions

Conversation

@Amanbig

@Amanbig Amanbig commented Oct 31, 2026

Copy link
Copy Markdown
Owner

Summary

The REPL could not do several things the non-interactive CLI can, and there was no way to start without permission prompts.

Parity: new / extended slash commands (all appear in the dropdown and /help)

Command What
/permissions was view-only; now allow|deny [--session] <tool> <pattern>, set <tool> <allow|deny|ask>, reset (confirms). Patterns can be unquoted (/permissions allow shell git log *) or quoted
/sessions list [n], show <id>, delete <id> (refuses the current session, confirms). Resume stays devorch --resume <id>
/hooks active hooks + the untrusted-project notice
/trust, /untrust same as `devorch trust
/exit, /quit explicit exit

Logic lives in cli/repl_commands.py and is shared: the CLI sessions list|show and trust|untrust now call the same functions, so the two cannot drift.

Skipping permission prompts

  • devorch and devorch chat gain --mode ask|auto|plan (ask/run/edit already had it)
  • --dangerously-skip-permissions on devorch, chat, ask, run, edit: selects AUTO mode (no prompts) and prints a warning at REPL start. It conflicts with --mode ask|plan and overrides a project's default_mode

Deliberate design choice - this is not a full bypass. In AUTO the executor still blocks the built-in dangerous patterns (rm -rf *, sudo, ...) and applies your deny rules, and hooks still run. I chose not to add a flag that disables those, since the name already says "dangerously". If a hard bypass is wanted it should be a separate, explicit decision.

Tests (tests/test_repl_commands.py, 23)

  • Every subcommand incl. quoting, --session not persisted, invalid levels, usage errors, reset needing confirmation and resetting the live object, current-session protection, trust declined/accepted/revoked, YAML brackets printed literally, hooks trusted vs not
  • Skip-permissions: forces AUTO, conflicts with other modes, overrides project mode; AUTO never prompts yet still denies git push* (a deny rule) and rm -rf *; flag present on all five entry points
  • A consistency test: every /command offered in the dropdown must have a handler in cli/main.py
  • Mutation-checked in memory (no source edits): ignoring deny rules in AUTO, the flag not selecting AUTO, and a dropdown entry without a handler each fail the suite
  • Full suite 455 passing, ruff clean. README and CHANGELOG (0.5.0 is not tagged yet) updated

Not exercised

The interactive paths (questionary confirmations inside the live REPL, restarting after /trust) were not run in a real terminal.

… skip-permissions flag

Bring the REPL closer to the non-interactive CLI: /permissions can now
allow, deny, set and reset (with --session for session-only rules), and new
/sessions, /hooks, /trust, /untrust and /exit commands. The CLI trust and
sessions commands share the same code. devorch and devorch chat gain --mode,
and every entry point gains --dangerously-skip-permissions, which selects
AUTO mode: no prompts, while dangerous-command blocks and deny rules still
apply.
test_flag_is_available_on_every_entry_point searched the --help output, which is
colourised, wrapped and truncated depending on the terminal, so it failed in CI
(ANSI codes split the option names). Inspect the registered click options
instead. Two JSON output tests used a real agent whose spinner can write to
stdout when colours are forced; give them the same UI redirect ask applies.
The suite now passes with and without FORCE_COLOR, NO_COLOR and narrow
terminals.
The screen-test harness snapshotted after a fixed 0.15s, which is racy on a
slow CI runner: one job snapshotted before the first frame was drawn and
indexed into an empty screen. Wait at least that long, then until the output
has stopped changing, and fail with a clear message if nothing renders.
@Amanbig
Amanbig merged commit 3aed4a9 into main Oct 31, 2026
9 of 13 checks passed
@Amanbig
Amanbig deleted the feat/repl-parity-and-skip-permissions branch October 31, 2026 10:19
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