Skip to content

Conversation

@prosdev
Copy link
Collaborator

@prosdev prosdev commented Dec 15, 2025

Summary

Refactored dev_inspect with comprehensive pattern analysis and 5-10x performance improvements.

Changes

Pattern Analysis

  • 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)

Performance Improvements

  • 5-10x faster: 500-1000ms (down from 2-3 seconds)
  • Batch scanning (1 ts-morph initialization vs 6)
  • Embedding-based similarity search
  • Extension filtering (.ts only compares with .ts)

Bug Fixes

  • Fixed findSimilar to use document embeddings (not file paths)
  • Fixed --force flag to properly clear vector store
  • 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
  • Vector store clear() and searchByDocumentId() methods
  • Comprehensive pattern comparison with statistical analysis

API Changes

Simplified dev_inspect interface:

// Before (v0.8.4)
dev_inspect({ action: "compare", query: "src/auth.ts" })

// After (v0.8.5)
dev_inspect({ query: "src/auth.ts" })

The tool now automatically finds similar files AND performs pattern analysis.

Documentation

  • ✅ Added v0.8.5 changelog to website
  • ✅ Complete rewrite of dev-inspect.mdx
  • ✅ Updated README.md and CLAUDE.md
  • ✅ Migration guide included

Testing

  • ✅ All 1100+ tests passing
  • ✅ Added 10 new test-utils tests
  • ✅ Pattern analysis service fully tested

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

- 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
@prosdev prosdev force-pushed the refactor/dev-explore-to-dev-inspect branch from 56f1ac8 to cabbb68 Compare December 15, 2025 04:02
@prosdev prosdev merged commit 033eca2 into main Dec 15, 2025
1 check passed
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.

1 participant