Skip to content

feat(mcp): Phase 1 tools improvement — Parts 1.1–1.4#14

Merged
prosdev merged 5 commits into
mainfrom
feat/mcp-phase1-pure-extractors
Mar 31, 2026
Merged

feat(mcp): Phase 1 tools improvement — Parts 1.1–1.4#14
prosdev merged 5 commits into
mainfrom
feat/mcp-phase1-pure-extractors

Conversation

@prosdev

@prosdev prosdev commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • dev_patterns is 10-30x faster — reads from Antfly index instead of re-scanning with ts-morph
  • dev_health merged into dev_status (section="health") — 6 tools reduced to 5
  • dev_patterns parameter renamed from query to filePath to prevent LLM misuse
  • New format: "json" on dev_patterns for token-efficient agent workflows
  • All tools return suggestion field on errors for agent recovery guidance
  • Comprehensive docs sweep across website, README, CLAUDE.md, CLI help text

Changes by Part

1.1: Extract pure pattern analyzers

  • Export extractImportStyleFromContent, extractErrorHandlingFromContent, extractTypeCoverageFromSignatures
  • Class methods delegate to pure functions — same behavior, testable without I/O
  • 13 new unit tests

1.2: Index-based pattern analysis

  • getDocsByFilePath on VectorStorage (client-side exact path filter, capped at 5k docs)
  • analyzeFileFromIndex on PatternAnalysisService (reads signatures from index, content from disk)
  • comparePatterns has fast path (vectorStorage) and fallback (ts-morph scan)
  • VectorStorage wired through InspectAdapter → MCP entry point
  • 5 new tests (analyzeFileFromIndex + fast path with mock vectorStorage)

1.3: Cleanup

  • Deleted 3 redundant private wrapper methods from PatternAnalysisService
  • Removed stale GitHub code from HealthAdapter (githubStatePath, checkGitHubIndex)
  • Net -217 lines in cleanup alone

1.4: Agent usability overhaul

  • Deleted HealthAdapter entirely (merged into StatusAdapter's health section)
  • Renamed queryfilePath in dev_patterns schema + adapter + tests
  • Added format: "json" enum value to InspectArgsSchema
  • Added suggestion to error responses in search, refs, map, status, inspect adapters
  • Added negative guidance to dev_patterns description
  • Updated regression test: 6 → 5 adapters

Docs sweep

  • Updated CLAUDE.md, README.md, PLAN.md, TROUBLESHOOTING.md, examples/README.md
  • Updated website: homepage, tools index, dev-health (redirect), dev-patterns, troubleshooting
  • Updated CLI help text and CURSOR_SETUP.md
  • Added changeset, release notes for v0.10.4, updated latest-version.ts

Test plan

  • 1577 tests pass, 0 failures
  • Pure extractor tests (13 tests, no I/O)
  • Index-based analysis tests (5 tests, mock vectorStorage)
  • Regression test updated (5 adapters, HealthAdapter in removed list)
  • All existing tests unchanged (pattern analysis, inspect adapter, schemas)
  • Build + typecheck pass

Generated with Claude Code

prosdev and others added 5 commits March 31, 2026 00:21
Extract import style, error handling, and type coverage analysis from
private class methods into exported pure functions. Class methods now
delegate to these, keeping all existing behavior identical.

Adds 13 unit tests for the pure extractors — no file I/O needed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add getDocsByFilePath to VectorStorage and analyzeFileFromIndex to
PatternAnalysisService. When vectorStorage is available, comparePatterns
reads signatures from the Antfly index instead of re-scanning with
ts-morph. Falls back to scanner for tests/offline.

Wire VectorStorage through InspectAdapter so dev_patterns uses the
fast path in production.

Add scratchpad tracking the 5k doc cap as a known limitation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Rewrite analyzeFileWithDocs to use pure extractors directly
- Delete 3 now-redundant private wrapper methods
- Remove githubStatePath, checkGitHubIndex, githubIndex from health adapter
- Clean up health adapter tests (remove 5 GitHub-specific tests)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…d JSON

- Merge dev_health into dev_status (section="health") — 6 tools → 5
- Delete HealthAdapter, its tests, and schema
- Rename dev_patterns `query` → `filePath` to prevent LLM misuse
- Add `format: "json"` to dev_patterns for token-efficient agent workflows
- Add negative guidance to dev_patterns description (NOT for search/refs)
- Add `suggestion` field to all adapter error responses for agent recovery
- Update regression test to expect 5 adapters

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sweep all docs for stale dev_health references and 6-tool counts:
- CLAUDE.md, README.md, PLAN.md, TROUBLESHOOTING.md, examples/README.md
- Website: homepage, tools index, dev-health (→ redirect), dev-patterns
  (query→filePath, add json format), troubleshooting
- CLI help text and CURSOR_SETUP.md
- packages/dev-agent/README.md
- Add changeset for v0.10.4, release notes, update latest-version.ts

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@prosdev prosdev merged commit d9805ed into main Mar 31, 2026
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