Implement dispatch algorithm with exact match, prefix match, and regex fallback #101

Open
opened 2026-03-15 04:13:13 +00:00 by freemo · 0 comments
Owner

Metadata

  • Commit Message: feat(dispatch): implement CommandRouter.dispatch with fallback chain
  • Branch: feature/m1-command-router

Background and Context

The dispatch method is the single entry point for processing player input. It looks up
the command in the trie, falling back to regex matching for pattern-based commands.

Expected Behavior

  • CommandRouter.dispatch(player, input) parses the first word and looks up in trie
  • Exact match takes priority over prefix match
  • If no trie match, iterate registered regex patterns
  • If no match at all, send "Unknown command" to player
  • Matched RouteEntry instantiates the action class and passes to the middleware pipeline

Acceptance Criteria

  • dispatch method with trie lookup, regex fallback, and error handling
  • Player receives appropriate feedback for unknown commands
  • Successfully matched commands are instantiated and executed
  • BDD scenarios for all dispatch paths

Subtasks

  • Implement dispatch with trie lookup
  • Add regex fallback chain
  • Add unknown command feedback
  • Integrate with action instantiation
  • Write Cucumber scenarios for all paths

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • A Git commit is created where the first line of the commit message matches the
    Commit Message in Metadata exactly.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata.
  • The commit is submitted as a pull request to master, reviewed, and merged.
## Metadata - **Commit Message**: `feat(dispatch): implement CommandRouter.dispatch with fallback chain` - **Branch**: `feature/m1-command-router` ## Background and Context The dispatch method is the single entry point for processing player input. It looks up the command in the trie, falling back to regex matching for pattern-based commands. ## Expected Behavior - `CommandRouter.dispatch(player, input)` parses the first word and looks up in trie - Exact match takes priority over prefix match - If no trie match, iterate registered regex patterns - If no match at all, send "Unknown command" to player - Matched `RouteEntry` instantiates the action class and passes to the middleware pipeline ## Acceptance Criteria - `dispatch` method with trie lookup, regex fallback, and error handling - Player receives appropriate feedback for unknown commands - Successfully matched commands are instantiated and executed - BDD scenarios for all dispatch paths ## Subtasks - [ ] Implement dispatch with trie lookup - [ ] Add regex fallback chain - [ ] Add unknown command feedback - [ ] Integrate with action instantiation - [ ] Write Cucumber scenarios for all paths ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged**.
freemo added this to the (deleted) milestone 2026-03-15 04:13:13 +00:00
freemo self-assigned this 2026-03-15 04:25:24 +00:00
freemo modified the milestone from (deleted) to v1.0.0 2026-03-16 00:28:02 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference: aethyr/Aethyr#101
No description provided.