[PR #9115] refactor(tui): unify command registry and derive slash commands #12988

Closed
opened 2026-02-16 18:17:52 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/9115

State: closed
Merged: Yes


Closes https://github.com/anomalyco/opencode/issues/9114

Video walkthrough: https://x.com/kitlangton/status/2012599783039304187

Previously, slash definitions were hardcoded in autocomplete.tsx, contributing ~130 lines of pure duplication, including duplicated visibility logic (the share command, for example, had conditions in both autocomplete.tsx and session/index.tsx).

Now the slash listing is fully derived from the command registry, using the command's new slash property.

Also

The old disabled field didn't actually disable commands; it simply hid them from the command palette, and they could still be triggered via their key binding. Therefore, I've renamed disabled to hidden.

I've also removed the source?: "prompt" parameter, which was only used by the /editor command and, most importantly, had no perceivable affect on the behavior of said command.

Lastly, I've expurgated the /commands slash-command, as the ctrl-p key binding is prominently featured throughout the UI. Keeping it would have necessitated some logic for hiding commands from the palette whilst retaining them as autocomplete candidates (which would only be applicable in this extraordinary circumstance).

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/9115 **State:** closed **Merged:** Yes --- Closes https://github.com/anomalyco/opencode/issues/9114 Video walkthrough: https://x.com/kitlangton/status/2012599783039304187 Previously, slash definitions were hardcoded in `autocomplete.tsx`, contributing ~130 lines of pure duplication, including duplicated visibility logic (the `share` command, for example, had conditions in both `autocomplete.tsx` and `session/index.tsx`). Now the slash listing is fully derived from the command registry, using the command's new `slash` property. ### Also The old `disabled` field didn't actually disable commands; it simply hid them from the command palette, and they could still be triggered via their key binding. Therefore, I've renamed `disabled` to `hidden`. I've also removed the `source?: "prompt"` parameter, which was only used by the /editor command and, most importantly, had no perceivable affect on the behavior of said command. Lastly, I've expurgated the `/commands` slash-command, as the `ctrl-p` key binding is prominently featured throughout the UI. Keeping it would have necessitated some logic for hiding commands from the palette whilst retaining them as autocomplete candidates (which would only be applicable in this extraordinary circumstance).
yindo added the pull-request label 2026-02-16 18:17:52 -05:00
yindo closed this issue 2026-02-16 18:17:52 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12988