Skip to content

feat(commands): add named command registry and completion - #177

Merged
owainlewis merged 2 commits into
mainfrom
codex/issue-46-command-registry
Sep 8, 2026
Merged

feat(commands): add named command registry and completion#177
owainlewis merged 2 commits into
mainfrom
codex/issue-46-command-registry

Conversation

@owainlewis

@owainlewis owainlewis commented Sep 8, 2026

Copy link
Copy Markdown
Owner

M-x now accepts stable command names such as save-buffer, find-file, and search-forward, with prefix hints and Tab completion.
A static registry holds names, descriptions, aliases, and typed targets; named commands and keybindings share application dispatch.
Existing slash aliases remain available, and help <command> explains each command.

Closes #46.

Verification:

  • 342 unit tests pass, including every keybound action's registry mapping, aliases, path/search arguments, Unicode whitespace insertion, invalid input, cancellation, and completion cursor placement.
  • Eight terminal integration tests pass locally. The two redirected-input cases fail under the local sandbox and require the unchanged GitHub checks before merge.
  • Formatting, all-target Clippy with warnings denied, and release build pass.
  • Release PTY smoke covers named editing/undo, dirty quit cancel, completion/cursor, save, search, unknown input, prompt cancel, file paths with spaces, buffer switching, help, clean exit, and shell restoration.
  • Independent review: Approve.

@greptile-apps

greptile-apps Bot commented Sep 8, 2026

Copy link
Copy Markdown

Greptile Summary

This PR introduces a static named-command registry and routes named commands and keybindings through shared application dispatch.

  • Adds stable command names, legacy aliases, argument validation, help, prefix hints, and Tab completion.
  • Preserves path and search arguments while supporting editing, movement, buffer, file, search, and quit actions.
  • Updates terminal input and rendering for command completion.
  • Documents the command surface, architecture, implementation plan, and verification.

Confidence Score: 5/5

The PR appears safe to merge, with no outstanding correctness, security, or repository-rule issues identified.

The previously reported leading-whitespace completion problem is fully fixed by consistently normalizing input for lookup, parsing, matching, and completion, and its review thread is resolved. No new actionable failures remain.

Important Files Changed

Filename Overview
src/command_registry.rs Defines the command registry, aliases, typed targets, parsing, validation, help, matching, completion, and focused tests; the previously reported leading-whitespace inconsistency is fixed.
src/app.rs Routes keybindings and named invocations through shared application dispatch and integrates completion into the command prompt.
src/input.rs Adds normalized plain-Tab input for command completion while leaving modified Tab combinations unhandled.
src/renderer.rs Displays command-prefix hints without moving the editable input cursor.
src/commands.rs Extends the typed command surface for registry-backed application actions.
README.md Documents named commands, legacy aliases, completion, help, and current limitations.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    K[Keybinding] --> E[AppState::execute_command]
    M[M-x prompt] --> P[Command registry parse]
    P --> E
    P --> H[Help and validation]
    M --> C[Prefix matching and completion]
    E --> A[Application-owned actions]
    E --> D[commands::dispatch]
    D --> B[Buffer and view changes]
Loading

Reviews (2): Last reviewed commit: "fix(commands): normalize leading spaces ..." | Re-trigger Greptile

Comment thread src/command_registry.rs Outdated
@owainlewis
owainlewis merged commit 0a61dd4 into main Sep 8, 2026
2 checks passed
@owainlewis
owainlewis deleted the codex/issue-46-command-registry branch September 8, 2026 18:13
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.

[v0.3] Add command registry and M-x

1 participant