feat(mcp): refactor dev_inspect and optimize pattern analysis#171
Merged
feat(mcp): refactor dev_inspect and optimize pattern analysis#171
Conversation
- Renamed dev_explore to dev_inspect for clarity - Changed actions to specific verbs: compare, validate - Removed redundant pattern and relationships actions - Updated all documentation and tests - Added comprehensive migration guide BREAKING CHANGE: dev_explore tool has been replaced with dev_inspect. Use action 'compare' instead of 'similar', and 'validate' for pattern checks. The 'pattern' action is replaced by dev_search, and 'relationships' by dev_refs.
- Created PatternAnalysisService in @lytics/dev-agent-core - 5 core patterns: file size, testing, imports, error handling, types - Pattern comparison against similar files - 31/31 tests passing with comprehensive fixtures - Integrated PatternAnalysisService into InspectAdapter - Removed action parameter (single-purpose tool) - Added patternsAnalyzed field to output schema - Real pattern analysis in compact & verbose formats - 18/18 tests passing with dedicated fixtures - Clean architecture - Barrel exports for types - Fixtures excluded from compilation, linting, and type-checking - Separate fixture sets for unit (core) and integration (adapter) tests Test coverage: - PatternAnalysisService: 31 tests ✅ - InspectAdapter: 18 tests ✅ - Build: successful ✅
BREAKING CHANGE: dev_inspect no longer requires 'action' parameter Major Changes: - Refactored dev_inspect to single-purpose tool (finds similar files + pattern analysis) - Created PatternAnalysisService with 5 pattern extractors (imports, error handling, types, testing, size) - Optimized pattern analysis with batch scanning (5-10x faster) - Fixed semantic search to use document embeddings instead of path strings - Fixed --force flag to properly clear vector store - Removed outputSchema from all 9 MCP adapters to fix Cursor/Claude compatibility - Added extension filtering for relevant file comparisons Performance Improvements: - Batch scan all files in one pass (1 ts-morph initialization vs 6) - Added searchByDocumentId for embedding-based similarity - Pattern analysis now 500-1000ms (down from 2-3 seconds) Bug Fixes: - Fixed findSimilar to search by embeddings, not file paths - Fixed force re-index to actually clear old data - Fixed race condition in LanceDB table creation - Fixed all MCP protocol compliance issues New Features: - Test utilities in core/utils (reusable isTestFile, findTestFile) - Vector store clear() method - searchByDocumentId() for similarity search - Comprehensive pattern analysis (5 categories) Documentation: - Updated README.md with pattern categories - Updated CLAUDE.md with new dev_inspect description - Complete rewrite of dev-inspect.mdx website docs - Added migration guide from dev_explore Tests: - All 1100+ tests passing - Added 10 new test-utils tests - Pattern analysis service fully tested
- Add v0.8.5 changelog entry to website - Update latest-version.ts with new release info - Update tools index with v0.8.5 marker - Update changeset to use patch bumps for all packages - Fix all v0.9.0 references to v0.8.5 - Document pattern analysis features and performance improvements
56f1ac8 to
cabbb68
Compare
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.
Summary
Refactored
dev_inspectwith comprehensive pattern analysis and 5-10x performance improvements.Changes
Pattern Analysis
PatternAnalysisServicewith 5 pattern extractors:Performance Improvements
.tsonly compares with.ts)Bug Fixes
findSimilarto use document embeddings (not file paths)--forceflag to properly clear vector storeoutputSchemafrom all 9 MCP adapters (Cursor/Claude compatibility)New Features
@lytics/dev-agent-core/utilsclear()andsearchByDocumentId()methodsAPI Changes
Simplified
dev_inspectinterface:The tool now automatically finds similar files AND performs pattern analysis.
Documentation
Testing
Version Bumps (patch releases)
@lytics/dev-agent: 0.8.4 → 0.8.5@lytics/dev-agent-mcp: 0.5.3 → 0.5.4@lytics/dev-agent-core: 0.9.2 → 0.9.3@lytics/dev-agent-cli: 0.6.0 → 0.6.1