Skip to content

refactor(commands): move the mode-opening commands onto StatefulCommand - #2114

Merged
will-lamerton merged 1 commit into
mainfrom
refactor/command-dispatcher-modes
Nov 11, 2026
Merged

will-lamerton merged 1 commit into
mainfrom
refactor/command-dispatcher-modes

Conversation

@will-lamerton

Copy link
Copy Markdown
Member

PR 2 of the command-dispatcher sequence (PR 1: #2098).

What changed

  • /model (including /model browse), /settings, /explorer, /ide and /tune are now StatefulCommands. Each module holds its own logic and calls the setter it needs from CommandContext. They were empty stubs before, with the real work in handleSpecialCommand.
  • CommandContext gains enterModelSelectionMode, enterModelDatabaseMode, enterSettingsMode(tab?), enterExplorerMode, enterIdeSelectionMode and enterTune, wired in createCommandContext.
  • Retired /setup-providers and /setup-mcp move to a RETIRED_COMMANDS table in aliases.ts. The dispatcher checks it after custom commands and MCP prompts, as the old handler did. It queues the same "has moved to /settings" notice and runs /settings <tab>. The table is kept apart from COMMAND_ALIASES so retired names still don't complete in the slash menu and /help doesn't resolve them, as before.
  • handleSpecialCommand is gone. Its file kept only handleCheckpointLoad, so it is renamed checkpoint-load-handler.ts; that handler moves in the next PR.
  • CLAUDE.md lists the commands still on the old route.

Behaviour

No change intended:

  • Mode commands complete at once.
  • An unknown /settings tab errors and completes after the render delay.
  • /model-database still expands to /model browse.
  • A project command named like a built-in or a retired name still wins.

Tests

  • command-dispatcher.spec.ts:
    • each mode command (including /model browse, the /model-database alias and a mixed-case /settings MCP) opens the right mode and then completes
    • an unknown settings tab errors and completes after the render delay
    • a retired name queues its notice and ignores its own args
    • a project command still beats a retired name
  • ide.spec.tsx used to assert that the stub returned a Fragment. It now checks the same behaviour through run: the IDE picker opens and the prompt is handed back.
  • All existing app-util.spec.ts tests pass unchanged: settings tabs, retired setup commands, /model and /model browse.
  • Ran tsc --noEmit, biome check ., knip and knip --production --include files. AVA passes over source/app/utils, source/commands, commands.spec.ts, source/hooks, source/app/sections and source/plain.

🤖 Generated with Claude Code

/model (and /model browse), /settings, /explorer, /ide and /tune now hold
their own logic and get what they need from CommandContext instead of
being stubs handled by handleSpecialCommand. The retired /setup-providers
and /setup-mcp names move to a small table in aliases.ts that the
dispatcher forwards with the same notice as before. handleSpecialCommand
is gone; only checkpoint load is left in its file, renamed to match.

No behaviour change.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

No changeset found

This PR does not add a changeset, so it will not appear in the changelog or trigger a release.

If the change is user-facing, add one:

pnpm changeset

Pick a bump (patch / minor / major) and write the changelog entry in our usual voice ("Added X... Thanks to @you. Closes #123."), then commit the generated .changeset/*.md file.

If this PR is docs-only or a chore that needs no release note, you can ignore this — or run pnpm changeset --empty to record that intentionally.

@github-actions github-actions Bot added the area:tui Terminal UI label Nov 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

nc-review could not produce a verdict this run (agent exit 1). This is a problem with the review agent, not with your pull request. A maintainer can retry with /re-review.

@will-lamerton
will-lamerton merged commit 8743529 into main Nov 11, 2026
19 checks passed
@will-lamerton
will-lamerton deleted the refactor/command-dispatcher-modes branch November 11, 2026 18:45
jay23606 added a commit to jay23606/nanocoder that referenced this pull request Nov 12, 2026
…nd (Nano-Collective#2114)

/model (and /model browse), /settings, /explorer, /ide and /tune now hold
their own logic and get what they need from CommandContext instead of
being stubs handled by handleSpecialCommand. The retired /setup-providers
and /setup-mcp names move to a small table in aliases.ts that the
dispatcher forwards with the same notice as before. handleSpecialCommand
is gone; only checkpoint load is left in its file, renamed to match.

No behaviour change.

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:tui Terminal UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant