feat: add file limit to structure tool#100
Conversation
Add npm caching to setup-node and switch from bare `npm install` to `npm ci --prefer-offline --no-audit --no-fund` in all 4 benchmark jobs. This prevents transient 403s from the npm registry from failing the workflow.
The MCP structure tool returned all files with full metrics for every directory, easily exceeding 12k tokens. Add a global file limit (default 25) that caps per-file listings across all directories. Directory-level summaries always appear. When files are suppressed, a warning recommends --full or narrowing with --directory. - structureData(): add full and fileLimit options - formatStructure(): append warning when files are omitted - MCP: add full boolean to structure tool schema - CLI: add --full flag to structure command Impact: 3 functions changed, 2 affected
|
Claude finished @carlos-alm's task —— View job Code Review Complete ✅Todo List
Root Cause AnalysisProblem Being Solved: The Why This Approach: Adding a configurable file limit (default 25) with a Risk Assessment: LOW RISK - This is a pure enhancement that doesn't modify existing behavior for users who explicitly want full output. Configuration Changes Review✅ No problematic configuration changes detected
Test Integrity Assessment✅ Test quality maintained
Code Quality ReviewImplementation Quality: EXCELLENTstructure.js:334 - Clean parameterization with
cli.js:505 - Proper CLI integration with Positive Aspects:
Minor Observations:
Security & Performance✅ No security concerns Final Assessment |
Greptile SummaryAdds a configurable file limit to the Key changes:
Confidence Score: 5/5
Important Files Changed
Last reviewed commit: 2c565fa |
Summary
structuretool so per-file listings are capped across all directories, reducing token usage from 12k+ to a manageable size--fullor narrowing with--directoryfullboolean to MCP tool schema and--fullCLI flag to bypass the limitTest plan
npm test -- tests/integration/structure.test.js— 16 tests pass (3 new)npm test— full suite passes (519 tests)npm run lint— cleannode src/cli.js structure— shows max 25 files with warning if exceedednode src/cli.js structure --full— shows all files, no warningnode src/cli.js structure --directory src --depth 1— narrowed scope