Skip to content

Wire remaining REPL commands into codegraff TUI handle_enter #22

Description

@justrach

Why

The graff REPL (crates/forge_main/) recognises 25+ slash commands via ForgeCommandManager::parse (crates/forge_main/src/model.rs:285). The codegraff TUI dispatcher (handle_enter in crates/codegraff-tui/src/main.rs) currently routes only 8 of them locally (/connect, /image, /login, /logs, /model, /models, /usage, /workflow). Everything else falls through to spawn_chat, which sends the literal slash text to the LLM as a user message — broken UX.

This came up during pre-merge review of #21 (slash command palette). The palette was originally going to expose the full command catalogue, but cross-referencing with handle_enter showed ~30 ghost commands. The palette has since been restricted to the 8 working commands; this issue tracks closing the parity gap.

What

For each command below, add a branch in handle_enter that:

  1. Parses any args from the slash text
  2. Calls the appropriate forge_app / forge_api API
  3. Renders the result in the TUI (transcript, overlay, or status line as appropriate)
  4. Closes the composer

Commands to wire (priority order)

Tier 1 — most-used, smallest dispatch:

  • /new — start a new conversation (preserve history)
  • /info — system information
  • /help — help mode
  • /exit — quit codegraff (today users use Ctrl+C; consider whether /exit should be a slash form too)

Tier 2 — agent switching:

  • /act (forge agent) — implementation mode
  • /plan (muse agent) — planning mode
  • /sage — research mode
  • /agent — interactive agent selection

Tier 3 — conversation management:

  • /conversation (alias /conversations) — list conversations
  • /conversation-rename
  • /clone — clone current/selected
  • /rename
  • /dump — save conversation as JSON/HTML
  • /copy — copy last response to clipboard
  • /compact — compact context

Tier 4 — config:

  • /config — display effective config
  • /config-edit — open config file in editor
  • /config-model, /config-commit-model, /config-suggest-model
  • /config-reasoning-effort, /reasoning-effort
  • /config-reload
  • /fast — toggle Priority Processing

Tier 5 — workspace + tools:

  • /workspace-sync (alias /sync)
  • /workspace-status
  • /workspace-info
  • /workspace-init
  • /index
  • /skill — list skills
  • /tools — list tools
  • /suggest — generate shell command from natural language

Tier 6 — git:

  • /commit-preview
  • /commit

Tier 7 — admin:

  • /logout
  • /update

As each tier lands

For each command wired in handle_enter, also add it to PALETTE_COMMANDS in the same PR. The palette has a sanity test (palette_includes_locally_handled_commands) that will need updating to keep the two in sync.

Acceptance per tier

  • Selecting the command from the / palette executes the documented behaviour locally (no chat-message fallthrough).
  • Adding a per-command unit test in handle_enter's test module where dispatch logic is non-trivial (e.g. agent switch, dump, fast toggle).
  • Updating palette_includes_locally_handled_commands to match.

Out of scope

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    state: inactiveNo current action needed/possible; issue fixed, out of scope, or superseded.type: featureBrand new functionality, features, pages, workflows, endpoints, etc.work: complexThe situation is complex, emergent practices used.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions