Skip to content

Latest commit

 

History

History
87 lines (65 loc) · 2.68 KB

File metadata and controls

87 lines (65 loc) · 2.68 KB
@lytics/dev-agent-core patch
@lytics/dev-agent-mcp patch
@lytics/dev-agent patch
@lytics/dev-agent-cli patch

feat(mcp): refactor dev_inspect and optimize pattern analysis

API Simplification:

  • dev_inspect simplified 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 PatternAnalysisService with 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 (.ts only 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 findSimilar to use document embeddings instead of file paths
  • Fixed --force flag to properly clear old vector data
  • Fixed race condition in LanceDB table creation
  • Removed outputSchema from all 9 MCP adapters (Cursor/Claude compatibility)

New Features:

  • Test utilities in @lytics/dev-agent-core/utils:
    • isTestFile() — Check if file is a test file
    • findTestFile() — 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 . --force

This 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