Skip to content

Add slash command menu with /model intercept#15

Open
seamus-mirage wants to merge 1 commit intomainfrom
slash-command-menu
Open

Add slash command menu with /model intercept#15
seamus-mirage wants to merge 1 commit intomainfrom
slash-command-menu

Conversation

@seamus-mirage
Copy link
Copy Markdown
Contributor

Summary

  • Scrollable autocomplete pops above the input when the user types /. Up/Down navigates with auto-scroll, hover previews without hijacking the scroll position, Tab/Return commits, Esc dismisses. Recents persist in UserDefaults; bare / shows recents then the rest of the catalog, typing fuzzy-filters across the full set.
  • /model is intercepted locally and rewires conversation.modelID (the --input-format stream-json path that Flight uses doesn't interpret slash commands, so pass-through would otherwise be sent to the model as plain text). Bare /model resets to the app default; opus/sonnet/haiku aliases plus exact id/label/suffix all resolve via ModelCatalog. Unknown names route through the existing AppState error alert.
  • Added PasteableTextViewController so a click-driven menu commit can replace the field and park the caret at the end without a hover-vs-keyboard race.

Test plan

  • Type /, see recents (8) followed by the rest of the catalog; scroll the menu with the wheel and with Up/Down.
  • Type /he, /sec, /com — fuzzy filter ranks the obvious match first.
  • Tab and Return both commit; Esc dismisses; clicking a row commits with the caret at end of /<cmd> .
  • Hovering does NOT cause the menu to scroll on its own.
  • /model opus switches to Opus 4.7 (verify Model dropdown reflects it). /model alone clears to default. /model bogus raises the error alert and leaves the input intact.
  • Send /help, /init, etc. — the command name appears at the top of recents next time you open the menu.
  • swift build and swift test clean (19 tests passing locally).

🤖 Generated with Claude Code

Pop a scrollable autocomplete above the input when the user types `/`. Up/Down
to navigate (auto-scrolls the highlight into view), hover to preview without
hijacking the scroll, Tab/Return to commit, Esc to dismiss. Recents persist in
UserDefaults and float to the top of the list; bare `/` shows recents then the
rest of the catalog, and typing fuzzy-filters across all commands.

`/model` is handled locally — `claude --input-format stream-json` doesn't
interpret slash commands, so any pass-through `/model …` would just be sent to
the model as text. Bare `/model` resets to the app default; `/model opus`,
`/model claude-opus-4-7`, and `/model "Opus 4.7"` all resolve via the
ModelCatalog (id, label, family alias, suffix). Unknown names surface through
the existing AppState error alert.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

2 participants