fix(cli): correct ast command import path after src/ reorganization#532
fix(cli): correct ast command import path after src/ reorganization#532carlos-alm merged 5 commits intomainfrom
Conversation
The ast command crashed because it imported from '../../ast.js' which resolved to dist/ast.js (non-existent). The actual module is at dist/features/ast.js after the src/ reorganization in v3.1.5. Closes #529 Impact: 1 functions changed, 0 affected
|
Claude finished @carlos-alm's task —— View job Reviewing PR: fix(cli): correct ast command import pathTodo List:
Root Cause AnalysisProblem Being Solved: The Why This Approach: Direct import path fix is the correct approach. This follows the same pattern as PR #521 which fixed similar import path issues in benchmark scripts after the same reorganization. Risk Assessment: Minimal risk. Single line change to correct a broken import path. The target file exists and exports the required symbols ( Backlog Compliance
Critical ConcernsNone. This is a straightforward import path correction. Code Quality Assessment
Final Recommendation
Minor deduction: While technically correct, this suggests incomplete validation during the original reorganization that allowed this import to break. Future reorganizations should include automated import validation. |
Greptile SummaryThis PR fixes a runtime crash in the The fix is minimal, targeted, and correct — the resolved file exists and exports exactly the named bindings the command requires. Potential related issue worth investigating (out of scope for this PR):
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant CLI as cli.js
participant AstCmd as cli/commands/ast.js
participant FeatAst as features/ast.js (✓ fixed)
CLI->>AstCmd: execute([pattern], opts, ctx)
AstCmd->>FeatAst: dynamic import('../../features/ast.js')
FeatAst-->>AstCmd: { AST_NODE_KINDS, astQuery }
AstCmd->>AstCmd: validate opts.kind against AST_NODE_KINDS
AstCmd->>FeatAst: astQuery(pattern, opts.db, queryOpts)
FeatAst-->>CLI: output results
Last reviewed commit: "fix(cli): correct as..." |
…kill The pre-flight native binary check was only in Phase 4b (benchmarks), but a stale binary affects all phases. Move the check to Phase 0 step 6 so it happens before any testing begins. Simplify the Phase 4b section to reference the earlier check. Learned from v3.3.0 dogfood where the source repo had v3.1.2 binary but all testing had already completed before catching the mismatch.
Summary
The
codegraph astcommand crashed with a missing module error because it imported from../../ast.js(resolving todist/ast.js), but the module lives atdist/features/ast.jsafter the src/ reorganization in v3.1.5.Fixed by updating the dynamic import path to
../../features/ast.js.Found during
Dogfooding v3.3.0 — see #529
Test plan
npx codegraph ast callreturns results instead of crashingnpx vitest run tests/integration/ast.test.js— 19 tests passnpm run lint— clean (1 unrelated warning)