Patch Changes
-
d3d2126: feat(mcp): refactor dev_inspect and optimize pattern analysis
API Simplification:
dev_inspectsimplified to single-purpose tool (action parameter streamlined)- Previously:
dev_inspect({ action: "compare", query: "file.ts" }) - Now:
dev_inspect({ query: "file.ts" }) - Existing usage continues to work with dynamic MCP schema discovery
Major Features:
- Created
PatternAnalysisServicewith 5 pattern extractors:- Import style (ESM, CJS, mixed, unknown)
- Error handling (throw, result, callback, unknown)
- Type coverage (full, partial, none)
- Testing (co-located test files)
- File size (lines vs similar files)
- Batch scanning optimization (5-10x faster: 500-1000ms vs 2-3 seconds)
- Embedding-based similarity search (no more false matches)
- Extension filtering (
.tsonly compares with.ts) - Comprehensive pattern analysis (finds similar files + analyzes patterns)
Performance:
- One ts-morph initialization vs 6 separate scans
- Batch scan all files in one pass
searchByDocumentId()for embedding-based similarity- Pattern analysis: 500-1000ms (down from 2-3 seconds)
Bug Fixes:
- Fixed
findSimilarto use document embeddings instead of file paths - Fixed
--forceflag to properly clear old vector data - Fixed race condition in LanceDB table creation
- Removed
outputSchemafrom all 9 MCP adapters (Cursor/Claude compatibility)
New Features:
- Test utilities in
@lytics/dev-agent-core/utils:isTestFile()— Check if file is a test filefindTestFile()— Find co-located test files
- Vector store
clear()method - Vector store
searchByDocumentId()method - Comprehensive pattern comparison with statistical analysis
Migration Guide:
// Before (v0.8.4) dev_inspect({ action: "compare", query: "src/auth.ts" }); dev_inspect({ action: "validate", query: "src/auth.ts" }); // After (v0.8.5) - Streamlined! dev_inspect({ query: "src/auth.ts" });
The tool now automatically finds similar files AND performs pattern analysis. No migration needed - MCP tools discover the new schema dynamically.
Re-index Recommended:
dev index . --forceThis clears old data and rebuilds with improved embedding-based search.
Documentation:
- Complete rewrite of dev-inspect.mdx
- Updated README.md with pattern categories
- Updated CLAUDE.md with new descriptions
- Added v0.8.5 changelog entry to website
- Migration guide from dev_explore
Tests:
- All 1100+ tests passing
- Added 10 new test-utils tests
- Pattern analysis service fully tested
- Integration tests for InspectAdapter