feat(cli): richer "?" help panel with current-session context#197
Merged
emal-avala merged 1 commit intomainfrom Apr 23, 2026
Merged
feat(cli): richer "?" help panel with current-session context#197emal-avala merged 1 commit intomainfrom
emal-avala merged 1 commit intomainfrom
Conversation
The existing help panel was hand-written and showed a curated subset
of commands — so every new command meant touching repl.rs to keep the
panel in sync (and we often forgot). The fix:
1. Extract into `render_help_panel(&AppState)` so it can be updated
in one place without cluttering the REPL loop.
2. New "Current session" block at the top — live values:
* model
* permission mode
* active modifier badges (plan / brief / +N dirs)
* context usage (tokens, % of window, cost) and turn count
3. Commands list is now auto-generated from the `COMMANDS` array —
every non-hidden entry shows up, sorted alphabetically, with its
description and any aliases. New /commands land without help
panel edits.
4. Keyboard/input section is unchanged in content but column-aligned
so entries don't drift when widths differ.
Example output:
Current session
────────────────────────────────────────────────────────────
model claude-opus-4-7 [plan, brief]
permissions ask
usage 18243 tokens · 9% of 200000 · $0.0421 (turn 6)
Keyboard & input
────────────────────────────────────────────────────────────
! command run shell command directly
@ path/file inline file contents in the prompt
... (etc)
Commands (53)
────────────────────────────────────────────────────────────
/add-dir ...
/agents ...
/brief Toggle brief mode ...
... (auto-generated from COMMANDS, sorted)
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 existing
?help panel was hand-written and showed a curated subset of slash commands. Every new/commandrequired a matching edit in repl.rs, and we routinely forgot (/brief,/rules,/reload,/ctxviz,/editor,/output-style,/copy,/tag, and/keybindingswere all missing from the panel).What changed
render_help_panel(&AppState)so it can evolve in one place.[plan, brief, +N dirs])COMMANDSarray — every non-hidden entry shows up, sorted alphabetically, with description and aliases. New commands land with no help-panel edits needed.Example output
Test plan
cargo fmt --all— cleancargo clippy --workspace --all-targets -- -D warnings— cleancargo test -p agent-code --test smoke— 4/4 pass?in REPL → panel renders with live session state and all commands