refactor(cli): split session command dispatch - #857
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Greptile SummaryThis PR refactors live-session CLI parsing into focused command parsers while preserving the existing command catalog, validation, and result projection.
Confidence Score: 5/5The PR appears safe to merge, with no actionable behavioral or security regressions identified. The extracted parsers preserve the previous token routing, validation sequence, help behavior, and parsed-result projections, while the added tests cover the most sensitive reload and namespace-help boundaries. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
CLI[parseCli] --> Session[parseSessionCommand]
Session --> List[List parser]
Session --> Read[Get or context parser]
Session --> Review[Review parser]
Session --> Navigate[Navigate parser]
Session --> Reload[Reload parser]
Session --> Comment[Comment namespace]
Session --> Highlight[Highlight namespace]
Comment --> CommentActions[Add / apply / list / rm / clear]
Highlight --> HighlightActions[Add / clear]
Reload --> Separator{Nested separator present?}
Separator -->|Yes| Nested[Parse replacement Hunk command]
Separator -->|No| Error[Report separator error]
Reviews (1): Last reviewed commit: "refactor(cli): tighten session command t..." | Re-trigger Greptile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
parseSessionCommandowned top-level dispatch, nested comment/highlight dispatch, Commander setup, validation, and result projection for every live-session command. Its cyclomatic complexity had reached 91, making small command changes difficult to review safely.Approach
--and comment-apply stdin timing;This is a behavior-preserving maintenance refactor.
parseSessionCommandcomplexity drops from 91 to 12.Open PR #845 also changes session navigation. This PR does not implement or depend on that feature, but
src/app/cli.tswill require a manual conflict resolution if #845 lands first.Validation
Tested on Linux:
bun test src/app/cli.test.ts— 130 passed;bun run typecheck;bun run lint;bun run deps:check;bunx oxfmt --check src/app/cli.ts src/app/cli.test.ts;git diff --check main...HEAD.No visual evidence is included because this does not change terminal output or interaction behavior.
This PR description was generated by Pi using OpenAI GPT-5.6 Sol