feat: add batch-query command and multi-command batch mode#256
feat: add batch-query command and multi-command batch mode#256carlos-alm merged 3 commits intomainfrom
Conversation
Add splitTargets() for comma-separated target expansion, multiBatchData() for mixed-command orchestration, and a new batch-query CLI command that defaults to 'where'. The existing batch command also gains comma splitting and multi-command detection via --from-file/--stdin. Impact: 5 functions changed, 3 affected
|
All contributors have signed the CLA ✍️ ✅ |
|
Claude finished @carlos-alm's task —— View job PR Review CompleteReviewing PR #256: Root Cause AnalysisProblem Being Solved: This PR addresses the need for more ergonomic batch querying in codegraph, particularly for multi-agent systems that need to dispatch 20+ queries in one call. The existing Why This Approach: The approach extends existing batch infrastructure rather than replacing it, maintains backward compatibility, and follows established patterns. It adds:
Risk Assessment: Low risk - purely additive functionality with comprehensive testing. Critical ConcernsNone identified. This is a well-structured addition that: ✅ No configuration relaxation - No linting rules disabled or test expectations lowered Code Quality AssessmentStrengths:
Implementation Details:
Test Coverage:
Minor Notes:
Final Recommendation
The only reason it's not 5/5 is minor - could add try/catch around JSON.parse calls for more robust error handling, but this follows existing patterns in the codebase. |
Greptile SummaryThis PR adds ergonomic multi-symbol lookup capabilities to the batch querying system. The new Key additions:
Test coverage: 14 new tests added covering comma splitting, multi-command orchestration, error isolation, CLI integration, and edge cases (empty inputs, invalid commands, nonexistent DBs). All 1096 tests pass. Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
Start[User invokes batch command] --> CLI{Which command?}
CLI -->|batch cmd targets| B1[batch CLI action]
CLI -->|batch-query targets| B2[batch-query CLI action]
B1 --> Parse1{Parse targets}
B2 --> Parse2{Parse targets}
Parse1 -->|--from-file/--stdin| File1[Read & parse JSON/lines]
Parse1 -->|positional args| Split1[splitTargets: comma split]
Parse2 -->|--from-file/--stdin| File2[Read & parse JSON/lines]
Parse2 -->|positional args| Split2[splitTargets: comma split]
File1 --> Targets1[targets array]
Split1 --> Targets1
File2 --> Targets2[targets array]
Split2 --> Targets2
Targets1 --> Multi1{First item has .command?}
Multi1 -->|Yes| MBD1[multiBatchData: mixed commands]
Multi1 -->|No| BD1[batch → batchData: single command]
Targets2 --> BQ[batchQuery wrapper]
BQ --> Multi2{First item has .command?}
Multi2 -->|Yes| MBD2[multiBatchData: mixed commands]
Multi2 -->|No, use --command or default 'where'| BD2[batchData: single command]
MBD1 --> Results1[JSON output with per-item results]
BD1 --> Results1
MBD2 --> Results2[JSON output with results]
BD2 --> Results2
Results1 --> End[Return to user]
Results2 --> End
Last reviewed commit: 97c6edc |
|
I have read the CLA Document and I hereby sign the CLA |
Wrap --from-file and --stdin JSON parsing with error handling so malformed input produces a clear error message instead of an unhandled exception.
|
Addressed the JSON.parse robustness note from the automated review — both |
|
Claude finished @carlos-alm's task —— View job PR Review CompleteReviewing PR #256: Review Checklist
Root Cause AnalysisProblem Being Solved: This PR addresses the need for more ergonomic batch querying in codegraph, particularly for multi-agent systems that need to dispatch 20+ queries in one call. The existing Why This Approach: The approach extends existing batch infrastructure rather than replacing it, maintains backward compatibility, and follows established patterns. It adds:
Risk Assessment: Low risk - purely additive functionality with comprehensive testing. Critical ConcernsNone identified. This is a well-structured addition that: ✅ No configuration relaxation - No linting rules disabled or test expectations lowered Code Quality AssessmentStrengths:
Implementation Details:
Test Coverage:
Latest Commit Enhancement:
Minor Notes:
Final Recommendation
The only reason it's not 5/5 is the minor nature of the feature - it's an incremental improvement rather than a breakthrough innovation. But for what it accomplishes, the execution is excellent. |
|
Claude finished @carlos-alm's task —— View job PR Review CompleteReviewing PR #256: Root Cause AnalysisProblem Being Solved: This PR addresses the need for more ergonomic batch querying in codegraph, particularly for multi-agent systems that need to dispatch 20+ queries in one call. The existing Why This Approach: The approach extends existing batch infrastructure rather than replacing it, maintains backward compatibility, and follows established patterns. It adds:
Risk Assessment: Low risk - purely additive functionality with comprehensive testing. Critical ConcernsNone identified. This is a well-structured addition that: ✅ No configuration relaxation - No linting rules disabled or test expectations lowered Code Quality AssessmentStrengths:
Implementation Details:
Test Coverage:
Latest Commit Enhancement:
Minor Notes:
Final Recommendation
The only reason it's not 5/5 is the minor nature of the feature - it's an incremental improvement rather than a breakthrough innovation. But for what it accomplishes, the execution is excellent. |
|
Fixed the N+1 query pattern flagged in the review:
|
Summary
batch-queryCLI command for ergonomic multi-symbol lookup (comma-separated targets, defaults towhere)splitTargets()to expand comma-separated positional args into individual entriesmultiBatchData()for mixed-command orchestration (different commands per target in one call)batchcommand with comma splitting and multi-command detection via--from-file/--stdinsrc/index.js)fileHashfield toqueryNameData,whereSymbolImpl, andwhereFileImplresultsloadFileHashes()replaces per-filegetFileHash()callsTest plan
tests/integration/batch.test.js(27 total, all passing)splitTargets: comma splitting, whitespace trimming, empty filtering, object passthroughmultiBatchData: mixed commands, invalid command capture, per-item opts override, error isolationbatch-queryCLI: comma targets with defaultwhere,--commandoverridebatchCLI: comma-separated positional targetsfileHashassertions in queries.test.js (queryNameData, where symbol, where file)