Skip to content

refactor(commands): extract registry and parser helpers#2888

Merged
Hmbown merged 2 commits into
Hmbown:codex/v0.9.0-stewardshipfrom
aboimpinto:feat/2791-command-boundary-layer3
Jun 10, 2026
Merged

refactor(commands): extract registry and parser helpers#2888
Hmbown merged 2 commits into
Hmbown:codex/v0.9.0-stewardshipfrom
aboimpinto:feat/2791-command-boundary-layer3

Conversation

@aboimpinto

@aboimpinto aboimpinto commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Refs #2791.
Refs #2870.
Reference / proof PR: #2851.

Summary

This is Layer 3 of the staged command-boundary refactor. It keeps command dispatch behavior unchanged while moving shared command helper ownership out of commands/mod.rs.

What Changed

  • Moved CommandInfo, COMMANDS, command lookup, and unknown-command suggestion ranking into commands/registry.rs.
  • Added commands/parse.rs for slash command parsing and argument preservation.
  • Kept actual command dispatch in commands/mod.rs; group-owned command files remain a later layer.

Out Of Scope

  • No group-owned command module migration yet.
  • No per-command file split.
  • No user_commands refactor.
  • No behavior changes beyond preserving the existing parser/registry behavior behind the Layer 2 parity harness.

Validation

  • cargo fmt
  • cargo check -p codewhale-tui
  • cargo test -p codewhale-tui commands:: - 415 passed
  • cargo test --workspace
  • git diff --check

Paulo Aboim Pinto

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aboimpinto has reached the 50-review limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@github-actions

github-actions Bot commented Jun 7, 2026

Copy link
Copy Markdown

Thanks @aboimpinto for taking the time to contribute.

This repository is currently observing a maintainer-managed contribution gate in dry-run mode, so this pull request is staying open. When enforcement is enabled, pull requests from contributors who are not listed in .github/APPROVED_CONTRIBUTORS will be closed automatically.

Please read CONTRIBUTING.md for the expected contribution shape. A maintainer can grant PR access by commenting /lgtm on a pull request.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the command system by extracting the command registry metadata and lookup helpers into a new registry module, and the slash command parsing logic into a new parse module. The review feedback highlights opportunities to optimize performance by reducing redundant string allocations: first, by stripping the prefix before converting to lowercase in parse_slash_command, and second, by removing unnecessary to_ascii_lowercase() calls on statically defined lowercase command names and aliases in suggest_command_names.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread crates/tui/src/commands/parse.rs Outdated
Comment thread crates/tui/src/commands/registry.rs Outdated

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aboimpinto has reached the 50-review limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@aboimpinto aboimpinto marked this pull request as ready for review June 7, 2026 23:11

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aboimpinto has reached the 50-review limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@Hmbown Hmbown merged commit 3356fe6 into Hmbown:codex/v0.9.0-stewardship Jun 10, 2026
1 check passed
@Hmbown

Hmbown commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Merged — thank you @aboimpinto. This was a textbook Layer 3: pure code-motion into registry.rs/parse.rs, and the new no-uppercase-alias test assertion is exactly the right guard for dropping the per-candidate lowercasing in suggest_command_names.

Green light for Layer 4 (group-owned command modules) on the same base (codex/v0.9.0-stewardship), same layered approach. The parity harness from Layer 2 continues to be the safety net we rely on, so please keep extending it as command groups move.

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.

2 participants