feat(desktop): slash commands in the composer - #219
Merged
Conversation
The desktop had none. The PlusMenu's "Slash command" item inserted a literal "/" and said "palette lands in v0.2" — we are at 0.2.0. Anything typed with a leading slash went to the model as prose. Finding C in docs/THREE_WAY_REVIEW.md. Typing "/" now opens a filtered palette above the composer: ↑↓ to move, Tab or Enter to complete, Esc to dismiss, click to pick. A complete command runs locally instead of starting a turn. The catalogue is deliberately short. The CLI's 38 commands run against a SessionContext full of node:fs, a provider and a session manager, none of which exist in a WebView, so this ships only what the renderer can genuinely serve: /help /clear /model /mode /effort /cost /context, /diff over the existing workspace/diff protocol method, and the six screens the app already has (/settings /permissions /mcp /plugins /skills /about). /help says plainly that host-side commands are CLI-only rather than listing them as if they work. Effort and AgentMode move next to the commands that validate them, so the palette and the composer dropdowns cannot drift apart. Multi-line system output (/help, /diff, /cost) now renders as a left-aligned monospace block. The existing renderer centred system messages at 11.5px with no whitespace preservation, which turned the help table into a paragraph — caught by looking at it, not by the tests. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
The desktop had zero slash commands.
PlusMenu's "Slash command" item inserted a literal/with the description "palette lands in v0.2" — we are at 0.2.0. Anything typed with a leading slash was sent to the model as prose. Finding C indocs/THREE_WAY_REVIEW.md.What changes
Typing
/opens a filtered palette above the composer — ↑↓ to move, Tab or Enter to complete, Esc to dismiss, click to pick. A complete command runs locally instead of starting a turn.Scope, and why it is not all 38
The CLI's commands run against a
SessionContextfull ofnode:fs, a provider and a session manager — none of which exist in a WebView. Stubbing them would recreate exactly the problem this PR fixes, so the catalogue is only what the renderer can genuinely serve:/help/clear/model/mode/effort/cost/context/diff(workspace/diff)/settings/permissions/mcp/plugins/skills/about/helpends by saying host-side commands (/init,/compact,/rewind,/export,/todos) are CLI-only — rather than listing them as if they work. Carrying them properly needs a protocol method to execute a command host-side; that is the follow-up, not a stub here.EffortandAgentModemove out ofRepl.tsxand next to the commands that validate them, so the palette and the composer dropdowns cannot drift apart.One bug found by looking
Multi-line command output rendered as a wrapped paragraph: the system-message renderer centres text at 11.5px with no whitespace preservation — fine for "Resumed session", wrong for a help table. Multi-line system messages now render as a left-aligned monospace block. The unit tests were green through this; the screenshot was not.
Verification
Driven through the
preview-app.htmlfixture in a real browser: palette opens and filters,/helprenders aligned,/mode planflips the header pill toplan modeand the composer dropdown to◐ Plan mode, and/diffagainst the fixture (which does not declare theworkspaceDiffcapability) surfacesCould not read the working tree: The app-server does not support workspace diff— the honest failure path.21 unit tests over the pure parse/filter/format layer, plus a new Playwright case in the CI journey covering palette filtering, arrow-key completion, local execution, unknown commands, and Escape.
playwright test→ 5 passed.pnpm typecheck·lint·format:checkclean; desktop 83 · core 710/16 skipped · cli 175 · server 41 · protocol 24 · vscode 12 · lsp 13 · scripts 21.🤖 Generated with Claude Code