Repository navigation
feat(cli): REPL commands for permissions/sessions/hooks/trust + --dangerously-skip-permissions - #28
Merged
Merged
Conversation
… 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.
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
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)/permissionsallow|deny [--session] <tool> <pattern>,set <tool> <allow|deny|ask>,reset(confirms). Patterns can be unquoted (/permissions allow shell git log *) or quoted/sessionslist [n],show <id>,delete <id>(refuses the current session, confirms). Resume staysdevorch --resume <id>/hooks/trust,/untrust/exit,/quitLogic lives in
cli/repl_commands.pyand is shared: the CLIsessions list|showandtrust|untrustnow call the same functions, so the two cannot drift.Skipping permission prompts
devorchanddevorch chatgain--mode ask|auto|plan(ask/run/edit already had it)--dangerously-skip-permissionsondevorch,chat,ask,run,edit: selects AUTO mode (no prompts) and prints a warning at REPL start. It conflicts with--mode ask|planand overrides a project'sdefault_modeDeliberate 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)--sessionnot 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 notgit push*(a deny rule) andrm -rf *; flag present on all five entry points/commandoffered in the dropdown must have a handler incli/main.pyruffclean. README and CHANGELOG (0.5.0 is not tagged yet) updatedNot exercised
The interactive paths (
questionaryconfirmations inside the live REPL, restarting after/trust) were not run in a real terminal.