Skip to content

perf(cli): optimize JSON output across all commands#79

Merged
TannerTorrey3 merged 2 commits intomainfrom
perf/json-output-optimization
Mar 28, 2026
Merged

perf(cli): optimize JSON output across all commands#79
TannerTorrey3 merged 2 commits intomainfrom
perf/json-output-optimization

Conversation

@TannerTorrey3
Copy link
Copy Markdown
Contributor

@TannerTorrey3 TannerTorrey3 commented Mar 28, 2026

Summary

  • Systematically compact --format json output for 14/19 CLI commands, achieving 91.4% reduction (774KB → 67KB aggregate across all commands)
  • Adds shared helpers (stripNulls, roundFloat, compactTreeNode) in format.ts and command-specific compaction functions
  • Strips full UUIDs, replaces absolute paths with repo-relative paths, drops default/zero-value fields, removes empty arrays, and groups results by file where applicable

Per-command savings

Command Before After Reduction
subsystems 660KB 3.4KB 99.5%
entity 30KB 2.2KB 92.7%
trace 22KB 3.5KB 84.1%
impact 18KB 2.1KB 88.3%
diff 15KB 2.8KB 81.3%
inventory 12KB 4.2KB 65.0%
map 5.4KB 1.2KB 77.8%
explain 3.8KB 1.9KB 50.0%
smells 2.8KB 1.1KB 60.7%
rank 1.4KB 0.6KB 57.1%
locate 1.2KB 0.9KB 25.0%
search 0.8KB 0.5KB 37.5%
history 0.6KB 0.3KB 50.0%
callers/read minor minor path compaction

Files changed (19)

  • format.ts — new shared helpers: stripNulls(), roundFloat(), compactTreeNode(), updated formatPatches()
  • facts.tsrelativePath() applied to all path fields
  • 14 command files — command-specific JSON compaction
  • 3 command files — path compaction only

Test plan

  • npm run build passes (0 errors)
  • All 424 tests pass (npx vitest run)
  • Validated optimized output against live backend for subsystems, entity, map, smells, explain, impact, rank, inventory, diff, history, trace, locate, search, read, callers
  • Verify no downstream consumers depend on removed fields

🤖 Generated with Claude Code

TannerTorrey3 and others added 2 commits March 28, 2026 12:07
…sage

Systematically compact --format json output for 14 commands, achieving
91.4% reduction (774KB → 67KB aggregate). Key optimizations:
- Strip full UUIDs, use 12-char prefixes where needed
- Replace absolute paths with repo-relative via relativePath()
- Drop default/zero-value fields (resolutionMode, resultSource, empty arrays)
- Add stripNulls(), roundFloat(), compactTreeNode() shared helpers
- Compact diff snapshots, entity provenance, subsystem edges/hierarchy
- Group inventory results by file path instead of flat array

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…hema tests

Ix-verified downstream consumer check found three breaking changes:
- Smoke test expects entityId + atFromRev/atToRev field names in diff changes
- impact-schema.test.ts required resolutionMode/resultSource (now dropped)
- overview-structure.test.ts included stale resolutionMode in mock data

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@TannerTorrey3 TannerTorrey3 merged commit 5065efc into main Mar 28, 2026
3 checks passed
@josephismikhail josephismikhail deleted the perf/json-output-optimization branch April 1, 2026 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants