Skip to content

feat(cli): richer "?" help panel with current-session context#197

Merged
emal-avala merged 1 commit intomainfrom
feat/richer-help-panel
Apr 23, 2026
Merged

feat(cli): richer "?" help panel with current-session context#197
emal-avala merged 1 commit intomainfrom
feat/richer-help-panel

Conversation

@emal-avala
Copy link
Copy Markdown
Member

@emal-avala emal-avala commented Apr 23, 2026

Summary

The existing ? help panel was hand-written and showed a curated subset of slash commands. Every new /command required a matching edit in repl.rs, and we routinely forgot (/brief, /rules, /reload, /ctxviz, /editor, /output-style, /copy, /tag, and /keybindings were all missing from the panel).

What changed

  1. Extracted into render_help_panel(&AppState) so it can evolve in one place.
  2. New "Current session" block at the top with 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 description and aliases. New commands land with no help-panel edits needed.
  4. Keyboard/input section unchanged in content but column-aligned so entries don't drift when widths differ.

Example output

  Current session
  ────────────────────────────────────────────────────────────
  model         your-preferred-model  [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
  & prompt           run prompt in background
  /name              slash command — Tab to complete
  \ + Enter          continue on next line
  Tab                auto-complete slash commands
  Ctrl+R             search prompt history
  Esc / Ctrl+C       cancel (Ctrl+C twice to exit)
  Ctrl+D             exit REPL

  Commands (53)
  ────────────────────────────────────────────────────────────
  /add-dir             Add a directory to the working set
  /agents              List available agent types
  /autofix-pr          Check out a PR, fix failures, push back
  /brief               Toggle brief mode (terse responses, ≤3 sentences)
  /copy                Copy the last assistant message to the system clipboard
  /ctxviz              Per-category token breakdown of the current context  (alias: /context-viz)
  /editor              Compose a multi-line prompt in \$EDITOR and submit it  (alias: /ed)
  /install-github-app  Walk through \`gh\` CLI setup ...  (alias: /gh-setup)
  ... (all COMMANDS, auto-generated)

Test plan

  • cargo fmt --all — clean
  • cargo clippy --workspace --all-targets -- -D warnings — clean
  • cargo test -p agent-code --test smoke — 4/4 pass
  • Manual: type ? in REPL → panel renders with live session state and all commands

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)
@emal-avala emal-avala merged commit 1ac7d98 into main Apr 23, 2026
14 checks passed
@emal-avala emal-avala deleted the feat/richer-help-panel branch April 23, 2026 05:22
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