refactor!: merge fn into query, fold models into embed --models#171
refactor!: merge fn into query, fold models into embed --models#171carlos-alm wants to merge 4 commits intomainfrom
Conversation
execFileSync already receives args as an array, so shell: true is redundant and a minor security anti-pattern. Addresses Greptile review. Impact: 1 functions changed, 0 affected
Reduce CLI surface by consolidating two redundant commands: - `query` now calls fnDeps() with --depth, --file, --kind options (previously just queryName with basic output) - `embed --models` replaces the standalone `models` command - `fn` and `models` commands removed from CLI - MCP tools, programmatic API, and fn-impact unchanged BREAKING CHANGE: `codegraph fn` removed (use `codegraph query`), `codegraph models` removed (use `codegraph embed --models`).
|
Claude finished @carlos-alm's task —— View job PR Review: CLI Command RefactoringTodo List:
Phase 1: Root Cause Analysis ✅Problem Being Solved: Command surface area reduction - the CLI had 2 redundant/overlapping commands:
Why This Approach: The refactoring consolidates functionality logically:
Risk Assessment: LOW - This is genuine UI simplification, not masking underlying problems. Phase 2: Configuration Change Detection ✅No high-risk configuration changes detected:
Phase 3: Test Integrity ✅Test changes are appropriate:
Phase 4: Code Quality Review ✅Implementation Analysis:
Code Quality Issues:
Documentation Updates:
Potential Concerns
Verification of Claims✅ "No breaking changes to MCP tools" - Confirmed, MCP tools call functions directly Final AssessmentMinor Suggestions (Optional)
Bottom Line: This refactoring improves CLI ergonomics without sacrificing functionality. Well-executed consolidation. |
Greptile SummarySuccessfully consolidates two CLI commands (
Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
Start([User runs codegraph command])
Start --> Query[query <name>]
Start --> Embed[embed]
Start --> Legacy1[~~fn <name>~~]
Start --> Legacy2[~~models~~]
Query --> QueryOpts["Options: --depth, --file, --kind"]
QueryOpts --> FnDeps[fnDeps function]
Embed --> EmbedCheck{--models flag?}
EmbedCheck -->|Yes| ShowModels[Display model table]
EmbedCheck -->|No| BuildEmbed[buildEmbeddings function]
Legacy1 -.->|Removed| Error1[Error: unknown command]
Legacy2 -.->|Removed| Error2[Error: unknown command]
style Legacy1 fill:#ffcccc,stroke:#cc0000,stroke-dasharray: 5 5
style Legacy2 fill:#ffcccc,stroke:#cc0000,stroke-dasharray: 5 5
style Error1 fill:#ffcccc
style Error2 fill:#ffcccc
style Query fill:#ccffcc
style Embed fill:#ccffcc
Last reviewed commit: e474497 |
Additional Comments (1)
|
|
Claude finished @carlos-alm's task —— View job PR Review: CLI Command RefactoringTodo List:
Phase 1: Root Cause Analysis ✅Problem Being Solved: Command surface area reduction - the CLI had 2 redundant/overlapping commands:
Why This Approach: The refactoring consolidates functionality logically:
Risk Assessment: LOW - This is genuine UI simplification, not masking underlying problems. Phase 2: Configuration Change Detection ✅No high-risk configuration changes detected:
Phase 3: Test Integrity ✅Test changes are appropriate:
Phase 4: Code Quality Review ✅Implementation Analysis:
Code Quality Issues:
Documentation Updates:
Critical Issue: Greptile's Finding
|
This reverts commit 6bf2d88.
|
Claude finished @carlos-alm's task —— View job Claude Code is reviewing this PR… PR Review: CLI Command RefactoringTodo List:
Phase 1: Root Cause Analysis ✅Problem Being Solved: Command surface area reduction - the CLI had 2 redundant/overlapping commands:
Why This Approach: The refactoring consolidates functionality logically:
Risk Assessment: LOW - This is genuine UI simplification, not masking underlying problems. Phase 2: Configuration Change Detection ✅No high-risk configuration changes detected:
Phase 3: Test Integrity ✅Test changes are appropriate:
Phase 4: Code Quality Review ✅Implementation Analysis:
Code Quality Issues:
Documentation Updates:
Critical Issue: Greptile's Finding
|
|
Closing — content already squash-merged into main via PR #159 and related PRs. Branch is stale. |

Summary
queryabsorbsfn: now callsfnDeps()with--depth,--file,--kindoptions — full function-level call chain instead of basic name lookupembed --modelsreplacesmodels: model table folded into the embed command as a--modelsflagfnandmodelscommands removed from CLI (2 fewer top-level commands)No breaking changes to MCP tools (
query_function,fn_depsstay), programmatic API (queryNameData,fnDepsDataexports stay), orfn-impactcommand.Test plan
codegraph query buildGraph -T— works with default depthcodegraph query buildGraph --depth 5 -T— depth option workscodegraph query buildGraph -f builder.js -T— file scoping workscodegraph query buildGraph -k function -T— kind filter workscodegraph fn buildGraph— errors with "unknown command"codegraph embed --models— prints model tablecodegraph models— errors with "unknown command"