Add slash command autocomplete popup

Typing / in the chat composer now shows a filtered popup listing all
available commands with their description. Arrow keys or Tab to select,
Enter/Tab to insert, Esc to close, click also works.

- New module: static/js/slashAutocomplete.js
  Reads the existing COMMANDS registry (and LEGACY_ALIASES) from
  slashCommands.js — no command logic added here, just discovery UI.
  Excludes easter-egg commands (flip, roll, 8ball, fortune, odyssey,
  ascii). Promotes short legacy aliases (/new, /clear, /web, /compact,
  /research, etc.) as first-class rows so users don't have to know the
  full /session new form.

- slashCommands.js: export COMMANDS and LEGACY_ALIASES so the new
  module can read the registry.

- chat.js: lazy-import slashAutocomplete on init, wire to #message
  textarea.

- style.css: popup + row styles using existing CSS variables.
This commit is contained in:
Sirsyorrz
2026-06-01 21:33:46 +10:00
parent 5c390d6b3e
commit 6a2f0d5904
4 changed files with 339 additions and 2 deletions
+2 -2
View File
@@ -5650,7 +5650,7 @@ const COMMANDS = {
// ── Legacy aliases ────────────────────────────────────────────────
// Maps old flat command names to { parent, sub } so `/new` still works.
const LEGACY_ALIASES = {
export const LEGACY_ALIASES = {
'new': { parent: 'session', sub: 'new' },
'create': { parent: 'session', sub: 'new' },
'delete': { parent: 'session', sub: 'delete' },
@@ -5950,7 +5950,7 @@ export function clearSetupMode(preservePendingState = false) {
}
}
export { handleSlashCommand, handleSetupInput, handleSetupWizard, slashReply, typewriterReply };
export { handleSlashCommand, handleSetupInput, handleSetupWizard, slashReply, typewriterReply, COMMANDS };
const slashCommands = {
initSlashCommands,