feat(cli): add dev map command with 224x performance optimization#161
Merged
feat(cli): add dev map command with 224x performance optimization#161
Conversation
Add new 'dev map' command to visualize codebase structure with component counts, exports, and hot paths. Includes major performance optimizations for read-only operations. Features: - Directory structure with component counts at configurable depth - Hot paths showing most referenced files - Exported symbols per directory - Optional git change frequency analysis - Focus on specific directories - Verbose logging with --verbose flag Performance Optimizations: - Add getAll() method to skip semantic search for structural queries - Add skipEmbedder option to initialize() for read-only operations - Add getBasicStats() to avoid expensive git enrichment - Result: 224x speedup (103s → 0.46s) Bug Fixes: - Fix component count propagation causing exponential overflow - Add getAll() to test mocks Examples: $ dev map # Show full structure $ dev map --depth 3 # Deeper nesting $ dev map --focus packages/core # Focus on directory $ dev map --change-frequency # Show git hotspots $ dev map --verbose # Debug logging
Collaborator
Author
✅ Comprehensive Testing CompleteAll features have been tested and verified working correctly: 1. Basic Map Generation ⚡dev map --depth 2
2. Change Frequency Analysis 🔥dev map --depth 2 --change-frequency
3. Verbose Logging 🪵dev map --verbose --change-frequency
4. Focus on Directory 🎯dev map --focus packages/cli --depth 3
5. Hide Exports 👁️dev map --no-exports
6. Error Validation 🛡️dev map --depth 10 # Invalid
7. Help Text 📖dev map --help
🎯 Performance Verified
🧪 Test Coverage
📊 Sample OutputReady for review and merge! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎯 What This Adds
New
dev mapcommand to visualize codebase structure with component counts, exports, and hot paths.🚀 Performance Optimizations
Three Major Bottlenecks Fixed:
Semantic Search → Fast Scan (10-20x faster)
getAll()method to skip embedding generationEmbedder Initialization (100+ seconds saved)
skipEmbedderoption toinitialize()Git Stats Enrichment (103 seconds saved)
getBasicStats()to skip expensive git analysisResults
🐛 Bugs Fixed
getAll()to test mocks✨ Features
--depth- Control directory nesting (1-5)--focus- Zoom into specific directories--exports/--no-exports- Show/hide exported symbols--change-frequency- Show git activity hotspots--token-budget- Control output size--verbose- Enable debug logging📋 Examples
🧪 Testing
📁 Files Changed
packages/core/src/vector/store.ts- AddedgetAll()packages/core/src/vector/index.ts- Added lazy embedder initpackages/core/src/indexer/index.ts- AddedgetBasicStats()packages/core/src/map/index.ts- Fixed count propagation + loggingpackages/cli/src/commands/map.ts- New command with verbose loggingpackages/cli/src/cli.ts- Registered map commandgetAll()mocks