Skip to content

fix: add prefix matching to slash command dispatcher#968

Open
teyrebaz33 wants to merge 1 commit intoNousResearch:mainfrom
teyrebaz33:fix/928-slash-command-prefix-matching
Open

fix: add prefix matching to slash command dispatcher#968
teyrebaz33 wants to merge 1 commit intoNousResearch:mainfrom
teyrebaz33:fix/928-slash-command-prefix-matching

Conversation

@teyrebaz33
Copy link
Contributor

Closes #928

Problem

Slash commands required exact full names. Typing /con returned Unknown command: /con even though /config was the only possible match.

Fix

Add unambiguous prefix matching in process_command() before the Unknown command fallback:

Input Result
/con Dispatches /config (unique match)
/re Shows "Did you mean: /reasoning, /reload-mcp, /reset, /retry, /rollback?"
/xyz Shows "Unknown command" as before

Prefix matching uses COMMANDS from hermes_cli/commands.py — the same source as SlashCommandCompleter — so it automatically stays in sync when new commands are added.

Testing

5 new tests in TestSlashCommandPrefixMatching:

  • Unique prefix dispatches correctly
  • Unique prefix with arguments dispatches correctly
  • Ambiguous prefix shows suggestions
  • Unknown command shows error
  • Exact commands still work

Slash commands previously required exact full names. Typing /con
returned 'Unknown command' even though /config was the only match.

Add unambiguous prefix matching in process_command():
- Unique prefix (e.g. /con -> /config): dispatch immediately
- Ambiguous prefix (e.g. /re -> /reset, /retry, /reasoning...):
  show 'Did you mean' suggestions
- No match: existing 'Unknown command' error

Prefix matching uses the COMMANDS dict from hermes_cli/commands.py
(same source as SlashCommandCompleter) so it stays in sync with
any new commands added there.

Closes NousResearch#928
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.

UX: Slash commands require exact full name — partial matching and Tab completion not surfacing

1 participant