Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .changeset/ast-pattern-analysis.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'@prosdevlab/dev-agent': patch
---

AST-based pattern analysis via tree-sitter queries

- `dev_patterns` now uses tree-sitter AST queries for more accurate detection of error handling (try/catch, promise.catch, error classes), import style (dynamic imports, precise require), and type coverage (arrow function return types)
- Bundles tree-sitter grammars for TypeScript, TSX, JavaScript — covers the full JS/TS ecosystem
- Regex fallback preserved for unsupported file types (.go, .md, etc.)
- 12 verified S-expression queries with 51 tests (exact match counts, negative cases, edge cases)
4 changes: 4 additions & 0 deletions .claude/scratchpad.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
- Vue/Svelte SFC support — `.vue`/`.svelte` files have embedded `<script lang="ts">` blocks. Would need script block extraction before tree-sitter parsing. Lower priority — co-located `.ts` files in those projects already get full analysis.
- Swap `WasmPatternMatcher` to `@ast-grep/napi` if bulk scanning perf becomes an issue (~4x faster native Rust). Interface is ready; implementation is mechanical.

## Flaky Tests

- **`packages/cli/src/commands/commands.test.ts:119` — "should display indexing summary without storage size"** times out at 30s on GitHub CI runners. The test indexes files and the slower CI runner can't finish in time. Needs either a higher timeout, a smaller test fixture, or mocking the indexer. Seen on PR #17 CI run.

## Test Gaps

- **InspectAdapter integration test with PatternMatcher.** The InspectAdapter test constructs without a `patternMatcher` — the AST path is never exercised through the MCP layer. Needs a test that constructs `InspectAdapter` with `createPatternMatcher()`, mocks the search service, calls `execute()`, and verifies AST-enhanced results flow through. Requires mock search service setup — larger integration test scope.
Expand Down
8 changes: 4 additions & 4 deletions website/content/latest-version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
*/

export const latestVersion = {
version: '0.10.4',
title: 'MCP Tools Improvement (Phase 1)',
version: '0.10.5',
title: 'AST-Based Pattern Analysis',
date: 'March 31, 2026',
summary:
'dev_patterns is 10-30x faster, dev_health merged into dev_status, all tools return error recovery suggestions.',
link: '/updates#v0104--mcp-tools-improvement-phase-1',
'dev_patterns uses tree-sitter AST queries for more accurate detection of error handling, imports, and type coverage across .ts, .tsx, .js, .jsx files.',
link: '/updates#v0105--ast-based-pattern-analysis',
} as const;
15 changes: 15 additions & 0 deletions website/content/updates/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,21 @@ What's new in dev-agent. We ship improvements regularly to help AI assistants un

---

## v0.10.5 — AST-Based Pattern Analysis

*March 31, 2026*

**`dev_patterns` now uses tree-sitter AST queries for more accurate code analysis.**

- Detects try/catch, promise.catch, error classes, async/await in try — patterns regex couldn't see
- Arrow function return types now detected accurately (regex was fragile on `(): Type => ...`)
- Dynamic `import()` now counts as ESM, `require()` detection more precise
- Bundles TypeScript, TSX, and JavaScript grammars — covers the full JS/TS ecosystem
- 12 verified S-expression queries, 51 new tests with exact match counts
- Regex fallback preserved for non-JS/TS files

---

## v0.10.4 — MCP Tools Improvement (Phase 1)

*March 31, 2026*
Expand Down
Loading