purecontext-mcp 1.1.7 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENT_INSTRUCTIONS.md +393 -0
- package/AGENT_INSTRUCTIONS_SHORT.md +53 -0
- package/AST-SEARCH.md +274 -0
- package/CHANGELOG.md +62 -0
- package/CODE-INTELLIGENCE.md +369 -0
- package/HEALTH-DASHBOARDS.md +241 -0
- package/README.md +7 -0
- package/REFACTORING-SAFELY.md +279 -0
- package/UNDERSTANDING-RELATIONSHIPS.md +240 -0
- package/USER-GUIDE.md +14 -0
- package/VISUALIZING-CODE.md +199 -0
- package/WORKFLOW-TECH-DEBT.md +286 -0
- package/dist/core/db/dep-store.d.ts +75 -0
- package/dist/core/db/dep-store.d.ts.map +1 -1
- package/dist/core/db/dep-store.js +277 -0
- package/dist/core/db/dep-store.js.map +1 -1
- package/dist/core/db/schema.d.ts.map +1 -1
- package/dist/core/db/schema.js +12 -0
- package/dist/core/db/schema.js.map +1 -1
- package/dist/core/index-manager.js +1 -1
- package/dist/core/index-manager.js.map +1 -1
- package/dist/core/token-tracker.d.ts +0 -9
- package/dist/core/token-tracker.d.ts.map +1 -1
- package/dist/core/token-tracker.js +0 -21
- package/dist/core/token-tracker.js.map +1 -1
- package/dist/core/types.d.ts +5 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/graph/diagram-renderer.d.ts +83 -0
- package/dist/graph/diagram-renderer.d.ts.map +1 -0
- package/dist/graph/diagram-renderer.js +294 -0
- package/dist/graph/diagram-renderer.js.map +1 -0
- package/dist/graph/graph-traversal.d.ts +92 -0
- package/dist/graph/graph-traversal.d.ts.map +1 -1
- package/dist/graph/graph-traversal.js +440 -2
- package/dist/graph/graph-traversal.js.map +1 -1
- package/dist/server/http-server.d.ts.map +1 -1
- package/dist/server/http-server.js +30 -1
- package/dist/server/http-server.js.map +1 -1
- package/dist/server/mcp-server.d.ts.map +1 -1
- package/dist/server/mcp-server.js +145 -0
- package/dist/server/mcp-server.js.map +1 -1
- package/dist/server/tools/_meta.d.ts +0 -2
- package/dist/server/tools/_meta.d.ts.map +1 -1
- package/dist/server/tools/_meta.js +1 -4
- package/dist/server/tools/_meta.js.map +1 -1
- package/dist/server/tools/check-delete-safe.d.ts +50 -0
- package/dist/server/tools/check-delete-safe.d.ts.map +1 -0
- package/dist/server/tools/check-delete-safe.js +308 -0
- package/dist/server/tools/check-delete-safe.js.map +1 -0
- package/dist/server/tools/check-move-safe.d.ts +44 -0
- package/dist/server/tools/check-move-safe.d.ts.map +1 -0
- package/dist/server/tools/check-move-safe.js +266 -0
- package/dist/server/tools/check-move-safe.js.map +1 -0
- package/dist/server/tools/check-rename-safe.d.ts +48 -0
- package/dist/server/tools/check-rename-safe.d.ts.map +1 -0
- package/dist/server/tools/check-rename-safe.js +218 -0
- package/dist/server/tools/check-rename-safe.js.map +1 -0
- package/dist/server/tools/diff-health-radar.d.ts +44 -0
- package/dist/server/tools/diff-health-radar.d.ts.map +1 -0
- package/dist/server/tools/diff-health-radar.js +192 -0
- package/dist/server/tools/diff-health-radar.js.map +1 -0
- package/dist/server/tools/find-cycles.d.ts +31 -0
- package/dist/server/tools/find-cycles.d.ts.map +1 -0
- package/dist/server/tools/find-cycles.js +85 -0
- package/dist/server/tools/find-cycles.js.map +1 -0
- package/dist/server/tools/find-implementations.d.ts +47 -0
- package/dist/server/tools/find-implementations.d.ts.map +1 -0
- package/dist/server/tools/find-implementations.js +167 -0
- package/dist/server/tools/find-implementations.js.map +1 -0
- package/dist/server/tools/find-untested-symbols.d.ts +52 -0
- package/dist/server/tools/find-untested-symbols.d.ts.map +1 -0
- package/dist/server/tools/find-untested-symbols.js +308 -0
- package/dist/server/tools/find-untested-symbols.js.map +1 -0
- package/dist/server/tools/get-architecture-snapshot.d.ts +43 -0
- package/dist/server/tools/get-architecture-snapshot.d.ts.map +1 -0
- package/dist/server/tools/get-architecture-snapshot.js +292 -0
- package/dist/server/tools/get-architecture-snapshot.js.map +1 -0
- package/dist/server/tools/get-call-hierarchy.d.ts +43 -0
- package/dist/server/tools/get-call-hierarchy.d.ts.map +1 -0
- package/dist/server/tools/get-call-hierarchy.js +119 -0
- package/dist/server/tools/get-call-hierarchy.js.map +1 -0
- package/dist/server/tools/get-class-hierarchy.d.ts +36 -0
- package/dist/server/tools/get-class-hierarchy.d.ts.map +1 -0
- package/dist/server/tools/get-class-hierarchy.js +125 -0
- package/dist/server/tools/get-class-hierarchy.js.map +1 -0
- package/dist/server/tools/get-complexity-hotspots.d.ts +50 -0
- package/dist/server/tools/get-complexity-hotspots.d.ts.map +1 -0
- package/dist/server/tools/get-complexity-hotspots.js +282 -0
- package/dist/server/tools/get-complexity-hotspots.js.map +1 -0
- package/dist/server/tools/get-coupling-map.d.ts +39 -0
- package/dist/server/tools/get-coupling-map.d.ts.map +1 -0
- package/dist/server/tools/get-coupling-map.js +107 -0
- package/dist/server/tools/get-coupling-map.js.map +1 -0
- package/dist/server/tools/get-debt-report.d.ts +44 -0
- package/dist/server/tools/get-debt-report.d.ts.map +1 -0
- package/dist/server/tools/get-debt-report.js +606 -0
- package/dist/server/tools/get-debt-report.js.map +1 -0
- package/dist/server/tools/get-entry-points.d.ts +79 -0
- package/dist/server/tools/get-entry-points.d.ts.map +1 -0
- package/dist/server/tools/get-entry-points.js +362 -0
- package/dist/server/tools/get-entry-points.js.map +1 -0
- package/dist/server/tools/get-public-api.d.ts +53 -0
- package/dist/server/tools/get-public-api.d.ts.map +1 -0
- package/dist/server/tools/get-public-api.js +218 -0
- package/dist/server/tools/get-public-api.js.map +1 -0
- package/dist/server/tools/get-savings-stats.d.ts.map +1 -1
- package/dist/server/tools/get-savings-stats.js +1 -3
- package/dist/server/tools/get-savings-stats.js.map +1 -1
- package/dist/server/tools/get-test-coverage-map.d.ts +66 -0
- package/dist/server/tools/get-test-coverage-map.d.ts.map +1 -0
- package/dist/server/tools/get-test-coverage-map.js +588 -0
- package/dist/server/tools/get-test-coverage-map.js.map +1 -0
- package/dist/server/tools/get-todos.d.ts +51 -0
- package/dist/server/tools/get-todos.d.ts.map +1 -0
- package/dist/server/tools/get-todos.js +180 -0
- package/dist/server/tools/get-todos.js.map +1 -0
- package/dist/server/tools/get-type-graph.d.ts +73 -0
- package/dist/server/tools/get-type-graph.d.ts.map +1 -0
- package/dist/server/tools/get-type-graph.js +437 -0
- package/dist/server/tools/get-type-graph.js.map +1 -0
- package/dist/server/tools/health-radar.d.ts +50 -0
- package/dist/server/tools/health-radar.d.ts.map +1 -0
- package/dist/server/tools/health-radar.js +426 -0
- package/dist/server/tools/health-radar.js.map +1 -0
- package/dist/server/tools/plan-refactoring.d.ts +74 -0
- package/dist/server/tools/plan-refactoring.d.ts.map +1 -0
- package/dist/server/tools/plan-refactoring.js +644 -0
- package/dist/server/tools/plan-refactoring.js.map +1 -0
- package/dist/server/tools/render-call-graph.d.ts +40 -0
- package/dist/server/tools/render-call-graph.d.ts.map +1 -0
- package/dist/server/tools/render-call-graph.js +215 -0
- package/dist/server/tools/render-call-graph.js.map +1 -0
- package/dist/server/tools/render-class-hierarchy.d.ts +42 -0
- package/dist/server/tools/render-class-hierarchy.d.ts.map +1 -0
- package/dist/server/tools/render-class-hierarchy.js +265 -0
- package/dist/server/tools/render-class-hierarchy.js.map +1 -0
- package/dist/server/tools/render-dep-matrix.d.ts +38 -0
- package/dist/server/tools/render-dep-matrix.d.ts.map +1 -0
- package/dist/server/tools/render-dep-matrix.js +186 -0
- package/dist/server/tools/render-dep-matrix.js.map +1 -0
- package/dist/server/tools/render-diagram.d.ts +47 -0
- package/dist/server/tools/render-diagram.d.ts.map +1 -0
- package/dist/server/tools/render-diagram.js +266 -0
- package/dist/server/tools/render-diagram.js.map +1 -0
- package/dist/server/tools/render-import-graph.d.ts +41 -0
- package/dist/server/tools/render-import-graph.d.ts.map +1 -0
- package/dist/server/tools/render-import-graph.js +158 -0
- package/dist/server/tools/render-import-graph.js.map +1 -0
- package/dist/server/tools/search-ast.d.ts +55 -0
- package/dist/server/tools/search-ast.d.ts.map +1 -0
- package/dist/server/tools/search-ast.js +279 -0
- package/dist/server/tools/search-ast.js.map +1 -0
- package/dist/server/tools/search-by-complexity.d.ts +92 -0
- package/dist/server/tools/search-by-complexity.d.ts.map +1 -0
- package/dist/server/tools/search-by-complexity.js +268 -0
- package/dist/server/tools/search-by-complexity.js.map +1 -0
- package/dist/server/tools/search-by-decorator.d.ts +48 -0
- package/dist/server/tools/search-by-decorator.d.ts.map +1 -0
- package/dist/server/tools/search-by-decorator.js +518 -0
- package/dist/server/tools/search-by-decorator.js.map +1 -0
- package/dist/server/tools/search-by-signature.d.ts +56 -0
- package/dist/server/tools/search-by-signature.d.ts.map +1 -0
- package/dist/server/tools/search-by-signature.js +200 -0
- package/dist/server/tools/search-by-signature.js.map +1 -0
- package/dist/ui/assets/BlastRadius-QdgESOL8.js +1 -0
- package/dist/ui/assets/{DependencyGraph-CDtBHM0U.js → DependencyGraph-BSMhzwWV.js} +6 -6
- package/dist/ui/assets/{NotFound-Cdt6X8pl.js → NotFound-CipFP_s1.js} +1 -1
- package/dist/ui/assets/RepoDetail-Dfp5z5Kq.js +1 -0
- package/dist/ui/assets/{RepoList-B9LaZvob.js → RepoList-BKtST3hB.js} +1 -1
- package/dist/ui/assets/{Search-CLqv2KGV.js → Search-DzhGDViy.js} +1 -1
- package/dist/ui/assets/{SymbolView-BlbDR1DU.js → SymbolView-ryVEwAHG.js} +1 -1
- package/dist/ui/assets/{index-DADf5y_L.css → index-Ny8gn9F0.css} +1 -1
- package/dist/ui/assets/{index-i3Q1XbEh.js → index-nX2chMqi.js} +6 -6
- package/dist/ui/assets/{useSearch-mbMk6-M1.js → useSearch-BnBCRKui.js} +1 -1
- package/dist/ui/index.html +2 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/dev/jcodemunch-gap-analysis.md +198 -0
- package/package.json +9 -1
- package/user-manual.md +2466 -0
- package/dist/ui/assets/BlastRadius-BDZWhEk-.js +0 -1
- package/dist/ui/assets/RepoDetail-M6WaYbZ3.js +0 -1
package/AGENT_INSTRUCTIONS.md
CHANGED
|
@@ -285,6 +285,266 @@ Search column definitions across dbt models. Returns upstream/downstream lineage
|
|
|
285
285
|
|
|
286
286
|
---
|
|
287
287
|
|
|
288
|
+
### Advanced relationship analysis tools
|
|
289
|
+
|
|
290
|
+
#### `find_implementations`
|
|
291
|
+
Find all concrete implementations of a TypeScript interface or abstract class, and all method overrides for a given base method. Returns implementing classes with `implementedMethods` and `missingMethods` arrays compared against the interface contract.
|
|
292
|
+
|
|
293
|
+
- `includeAbstract` (optional) — also include abstract subclasses (default false)
|
|
294
|
+
- `limit` (optional) — max results (default 50)
|
|
295
|
+
|
|
296
|
+
**Use before modifying an interface** to know every class that must be updated.
|
|
297
|
+
|
|
298
|
+
#### `get_call_hierarchy`
|
|
299
|
+
Return callers and callees of a function, N levels deep, as a tree. Unlike `find_references` (flat list) or `get_blast_radius` (file-level), this returns a hierarchical execution-flow view. Recursive calls are marked `cyclic: true`.
|
|
300
|
+
|
|
301
|
+
```json
|
|
302
|
+
{
|
|
303
|
+
"repoId": "...",
|
|
304
|
+
"symbolId": "...",
|
|
305
|
+
"direction": "callees",
|
|
306
|
+
"maxDepth": 3,
|
|
307
|
+
"maxNodes": 50
|
|
308
|
+
}
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
- `direction`: `"callees"` (what it calls), `"callers"` (what calls it), `"both"` (bidirectional)
|
|
312
|
+
- `maxDepth`: 1–6 (default 3); `maxNodes`: stop expanding after N total nodes (default 50)
|
|
313
|
+
- `maxTokens`: soft cap on response size
|
|
314
|
+
|
|
315
|
+
#### `get_class_hierarchy`
|
|
316
|
+
Return the full inheritance tree rooted at a class — both ancestors (what it extends) and descendants (what extends it). Use before refactoring a base class to understand the full polymorphism surface.
|
|
317
|
+
|
|
318
|
+
- `direction`: `"ancestors"`, `"descendants"`, or `"both"` (default)
|
|
319
|
+
- `maxDepth` (optional, default 5)
|
|
320
|
+
|
|
321
|
+
#### `find_cycles`
|
|
322
|
+
Detect circular import dependencies across the repo or a subtree. Returns strongly-connected components with member files and a severity rating. High-severity cycles increase coupling and complicate testing.
|
|
323
|
+
|
|
324
|
+
- `scope` (optional) — directory prefix to restrict analysis
|
|
325
|
+
- `minCycleLength` (optional) — ignore trivial self-referential entries (default 2)
|
|
326
|
+
|
|
327
|
+
#### `get_coupling_map`
|
|
328
|
+
Compute afferent/efferent coupling metrics for every file. Returns instability scores (`I = efferent / (afferent + efferent)`) and highlights files that are both highly coupled and unstable — the highest-risk refactoring candidates.
|
|
329
|
+
|
|
330
|
+
- `scope` (optional) — directory prefix filter
|
|
331
|
+
- `limit` (optional) — max files returned (default 50)
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
### Visualization tools
|
|
336
|
+
|
|
337
|
+
#### `render_diagram`
|
|
338
|
+
Generate a Mermaid or DOT diagram from the dependency graph. The general-purpose visualization entry point — specialized variants below build on this.
|
|
339
|
+
|
|
340
|
+
```json
|
|
341
|
+
{
|
|
342
|
+
"repoId": "...",
|
|
343
|
+
"type": "module",
|
|
344
|
+
"format": "mermaid",
|
|
345
|
+
"maxNodes": 30,
|
|
346
|
+
"maxDepth": 3
|
|
347
|
+
}
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
- `type`: `"module"` / `"import"` (file-level import graph), `"call"` (call graph, requires `rootSymbolId`), `"class"` (class hierarchy, requires `rootSymbolId`)
|
|
351
|
+
- `format`: `"mermaid"` (renders natively in GitHub, VS Code, Claude) or `"dot"` (Graphviz)
|
|
352
|
+
- `maxNodes` (default 30) and `maxDepth` (default 3) prevent oversized diagrams
|
|
353
|
+
|
|
354
|
+
Mermaid output can be pasted directly into GitHub issues, README files, or Claude chat.
|
|
355
|
+
|
|
356
|
+
#### `render_call_graph`
|
|
357
|
+
Specialized call graph diagram rooted at a symbol. Equivalent to `render_diagram` with `type: "call"` but with call-graph-specific layout options.
|
|
358
|
+
|
|
359
|
+
#### `render_import_graph`
|
|
360
|
+
File-level import graph for a directory or the whole repo. Nodes are files, edges are import relationships, nodes are clustered by directory.
|
|
361
|
+
|
|
362
|
+
#### `render_class_hierarchy`
|
|
363
|
+
Class inheritance diagram in Mermaid `classDiagram` format. Shows member fields, methods, and inheritance/implementation relationships.
|
|
364
|
+
|
|
365
|
+
#### `render_dep_matrix`
|
|
366
|
+
Dependency matrix diagram showing coupling between modules as a grid. High value for spotting structural hotspots and tangled layers at a glance.
|
|
367
|
+
|
|
368
|
+
#### `get_architecture_snapshot`
|
|
369
|
+
Capture the current architectural state: file count, symbol count, module breakdown, coupling summary, and health scores. Take two snapshots (before and after a refactoring) to prove structural improvement objectively.
|
|
370
|
+
|
|
371
|
+
---
|
|
372
|
+
|
|
373
|
+
### Refactoring safety tools
|
|
374
|
+
|
|
375
|
+
Always run these **before** executing a structural change. They give a binary `safe` verdict so you never have to manually inspect reference lists.
|
|
376
|
+
|
|
377
|
+
#### `check_rename_safe`
|
|
378
|
+
Pre-flight check before renaming a symbol. Returns `safe`, a plain-English `verdict`, and all `affectedSites` with file, line, column, context snippet, and change type (`call`, `import`, `type-reference`, `string-literal`, `comment`).
|
|
379
|
+
|
|
380
|
+
```json
|
|
381
|
+
{
|
|
382
|
+
"repoId": "...",
|
|
383
|
+
"symbolId": "...",
|
|
384
|
+
"newName": "processOrderV2"
|
|
385
|
+
}
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
`safe: false` when the new name conflicts with an existing symbol in the same file, or when string-literal references exist that won't be fixed by a text rename and require human judgment.
|
|
389
|
+
|
|
390
|
+
#### `check_delete_safe`
|
|
391
|
+
Pre-flight check before deleting a symbol. Returns `safe: false` if anything in the repo still imports or references the symbol. Lists all blocking references so you know exactly what to clean up first.
|
|
392
|
+
|
|
393
|
+
#### `check_move_safe`
|
|
394
|
+
Pre-flight check before moving a symbol to a different file. Validates that the move won't break imports, that the target file doesn't already define the same name, and returns all import statements that will need updating.
|
|
395
|
+
|
|
396
|
+
#### `plan_refactoring`
|
|
397
|
+
Generate a sequenced, dependency-ordered plan for a structural change. Accepts a natural-language description and returns ordered steps with risk annotations, affected file lists, and suggested verification points. Steps are ordered so lower-risk changes happen first.
|
|
398
|
+
|
|
399
|
+
```json
|
|
400
|
+
{
|
|
401
|
+
"repoId": "...",
|
|
402
|
+
"description": "Extract the auth logic from UserService into a standalone AuthService",
|
|
403
|
+
"scope": "src/services/"
|
|
404
|
+
}
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
---
|
|
408
|
+
|
|
409
|
+
### Health & debt tools
|
|
410
|
+
|
|
411
|
+
#### `health_radar`
|
|
412
|
+
Compute a five-axis health radar for the repo. Each axis scores 0–100 (100 = perfectly healthy).
|
|
413
|
+
|
|
414
|
+
| Axis | What it measures |
|
|
415
|
+
|------|-----------------|
|
|
416
|
+
| `complexity` | Inverse of average/peak cyclomatic complexity |
|
|
417
|
+
| `coupling` | Inverse of high-coupling file density |
|
|
418
|
+
| `maintainability` | Inverse of dead-code and god-class density |
|
|
419
|
+
| `documentation` | Percentage of symbols with non-trivial summaries |
|
|
420
|
+
| `stability` | Inverse of churn-hotspot density (requires git metadata) |
|
|
421
|
+
|
|
422
|
+
Returns `overallHealth` (0–100 weighted average) and a letter grade (A–F). Designed for CI health gates and dashboard charts.
|
|
423
|
+
|
|
424
|
+
```json
|
|
425
|
+
{ "repoId": "...", "scope": "src/core/", "includeStability": true }
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
Use `get_debt_report` instead when you need per-file rankings and actionable recommendations.
|
|
429
|
+
|
|
430
|
+
#### `diff_health_radar`
|
|
431
|
+
Compare two health radar snapshots — typically before and after a refactoring — and return axis-by-axis deltas with regression/improvement verdicts. Use with `get_architecture_snapshot` to produce objective before/after evidence of structural improvement.
|
|
432
|
+
|
|
433
|
+
#### `get_debt_report`
|
|
434
|
+
Detailed technical debt report with per-file rankings, priority tiers, and actionable recommendations. Unlike `health_radar` (compact scores), this returns a full breakdown: worst files by each metric, specific symbols to address, and estimated effort indicators.
|
|
435
|
+
|
|
436
|
+
- `scope` (optional) — restrict to a directory
|
|
437
|
+
- `maxFiles` (optional) — top N files per category (default 10)
|
|
438
|
+
- `includeDead` (optional) — include dead code in the debt calculation
|
|
439
|
+
|
|
440
|
+
---
|
|
441
|
+
|
|
442
|
+
### AST-level search tools
|
|
443
|
+
|
|
444
|
+
These tools re-parse stored file content using tree-sitter grammars to find structural patterns that symbol-level search cannot express. Only files backed by a WASM grammar are searched; regex-only handlers are silently skipped.
|
|
445
|
+
|
|
446
|
+
#### `search_ast`
|
|
447
|
+
Find every occurrence of a specific tree-sitter node type across all indexed files.
|
|
448
|
+
|
|
449
|
+
```json
|
|
450
|
+
{
|
|
451
|
+
"repoId": "...",
|
|
452
|
+
"nodeType": "try_statement",
|
|
453
|
+
"filePath": "src/",
|
|
454
|
+
"limit": 50
|
|
455
|
+
}
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
Common node types (case-sensitive, exact tree-sitter names):
|
|
459
|
+
|
|
460
|
+
| Language | Node types |
|
|
461
|
+
|----------|-----------|
|
|
462
|
+
| TypeScript/JS | `arrow_function`, `function_declaration`, `class_declaration`, `interface_declaration`, `try_statement`, `await_expression`, `call_expression`, `import_statement`, `jsx_element`, `template_string`, `throw_statement`, `type_alias_declaration` |
|
|
463
|
+
| Python | `function_definition`, `class_definition`, `for_statement`, `with_statement`, `decorated_definition`, `lambda` |
|
|
464
|
+
| Rust | `function_item`, `struct_item`, `impl_item`, `match_expression`, `closure_expression`, `trait_item` |
|
|
465
|
+
| Go | `function_declaration`, `method_declaration`, `go_statement`, `defer_statement`, `type_declaration` |
|
|
466
|
+
|
|
467
|
+
Returns file, line, column, and a snippet of the matched node for each result.
|
|
468
|
+
|
|
469
|
+
#### `search_by_signature`
|
|
470
|
+
Search symbols by type signature pattern (regex or substring). Use to find all functions returning `Promise<void>`, all methods accepting a `Request` parameter, or all types extending a specific base.
|
|
471
|
+
|
|
472
|
+
```json
|
|
473
|
+
{ "repoId": "...", "pattern": "Promise<.*>", "kind": "function" }
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
#### `search_by_decorator`
|
|
477
|
+
Find all symbols annotated with a specific decorator. Works for TypeScript decorators (`@Injectable`, `@Controller`, `@Entity`) and Python decorators (`@app.route`, `@property`).
|
|
478
|
+
|
|
479
|
+
```json
|
|
480
|
+
{ "repoId": "...", "decorator": "Injectable", "kind": "class" }
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
#### `search_by_complexity`
|
|
484
|
+
Find symbols above or below a complexity threshold. Use to locate the most complex functions before a refactoring sprint, or to verify that new code stays within complexity budgets.
|
|
485
|
+
|
|
486
|
+
```json
|
|
487
|
+
{ "repoId": "...", "minComplexity": 10, "kind": "function", "limit": 20 }
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
Returns symbols ranked by complexity score with file path and signature.
|
|
491
|
+
|
|
492
|
+
---
|
|
493
|
+
|
|
494
|
+
### Code intelligence tools
|
|
495
|
+
|
|
496
|
+
#### `get_entry_points`
|
|
497
|
+
Identify all runnable entry points of a repo: main functions, CLI handlers, HTTP server startups, Lambda/serverless handlers, test suites, and standalone scripts. Each result includes a `kind`, `confidence` level (`high`/`medium`/`low`), and the reason for classification.
|
|
498
|
+
|
|
499
|
+
Use with `get_context_bundle` to trace the full dependency chain from an entry point, or with `find_dead_code` to discover code unreachable from any entry point.
|
|
500
|
+
|
|
501
|
+
- `kind` (optional) — filter: `main_function`, `cli_handler`, `server_startup`, `lambda_handler`, `test_suite`, `script`
|
|
502
|
+
- `minConfidence` (optional) — `"high"`, `"medium"`, or `"low"` (default)
|
|
503
|
+
|
|
504
|
+
#### `get_public_api`
|
|
505
|
+
Return all exported symbols grouped by file — the public API surface of the repo or a module. Use to document a library, audit what is exposed, or check for accidental exports.
|
|
506
|
+
|
|
507
|
+
- `filePath` (optional) — restrict to a file or directory prefix
|
|
508
|
+
- `kind` (optional) — filter by symbol kind
|
|
509
|
+
- `includeMembers` (optional) — include class/interface members
|
|
510
|
+
- `groupByFile` (optional, default true)
|
|
511
|
+
|
|
512
|
+
#### `get_todos`
|
|
513
|
+
Find all TODO, FIXME, HACK, NOTE, and XXX comments across the repo. Returns structured results with file, line, tag type, and comment text. Use to audit tech debt or find forgotten work before a release.
|
|
514
|
+
|
|
515
|
+
- `tags` (optional) — filter to specific tags: `["TODO", "FIXME"]`
|
|
516
|
+
- `filePath` (optional) — restrict to a directory
|
|
517
|
+
- `limit` (optional, default 200)
|
|
518
|
+
|
|
519
|
+
#### `get_complexity_hotspots`
|
|
520
|
+
Return symbols ranked by complexity score, highest first. Use to identify the worst functions before a refactoring sprint, or to track whether complexity is improving over time.
|
|
521
|
+
|
|
522
|
+
- `kind` (optional) — filter by symbol kind
|
|
523
|
+
- `filePath` (optional) — restrict to a directory
|
|
524
|
+
- `limit` (optional, default 20); `minComplexity` (optional)
|
|
525
|
+
|
|
526
|
+
#### `get_type_graph`
|
|
527
|
+
Return the type dependency graph — which types reference which other types — rooted at a specific type or across the whole repo. Use to understand type coupling and find central hub types before a major refactoring.
|
|
528
|
+
|
|
529
|
+
- `symbolId` (optional) — root the graph at a specific type
|
|
530
|
+
- `maxDepth` (optional, default 3)
|
|
531
|
+
- `direction`: `"uses"` (what this type references), `"usedBy"` (what references this type), or `"both"`
|
|
532
|
+
|
|
533
|
+
#### `find_untested_symbols`
|
|
534
|
+
Find exported symbols with no corresponding test coverage — no test file imports or references the symbol. Returns untested symbols ranked by complexity (most complex first, as highest priority).
|
|
535
|
+
|
|
536
|
+
**Note:** uses import-based heuristics, not runtime coverage. A symbol referenced in a test file is "tested" regardless of assertion quality.
|
|
537
|
+
|
|
538
|
+
- `filePath` (optional), `kind` (optional), `limit` (optional, default 50)
|
|
539
|
+
|
|
540
|
+
#### `get_test_coverage_map`
|
|
541
|
+
Return a per-file coverage map showing which symbols are referenced by test files and which are not. Produces a `coverageRatio` per file and aggregated totals.
|
|
542
|
+
|
|
543
|
+
- `filePath` (optional) — restrict to a file or directory
|
|
544
|
+
- `includeSymbols` (optional) — include per-symbol detail (default false for compact output)
|
|
545
|
+
|
|
546
|
+
---
|
|
547
|
+
|
|
288
548
|
## Decision rules — which tool to pick
|
|
289
549
|
|
|
290
550
|
```
|
|
@@ -318,6 +578,71 @@ I need to understand the project layout
|
|
|
318
578
|
|
|
319
579
|
I need a non-symbol section of a file (imports block, config)
|
|
320
580
|
→ get_file_content with startLine/endLine
|
|
581
|
+
|
|
582
|
+
I need all implementations of an interface or abstract class
|
|
583
|
+
→ find_implementations
|
|
584
|
+
|
|
585
|
+
I need to trace execution flow (call stack, callers/callees)
|
|
586
|
+
→ get_call_hierarchy (hierarchical tree)
|
|
587
|
+
→ find_references (flat list of call sites)
|
|
588
|
+
|
|
589
|
+
I need to understand the class inheritance structure
|
|
590
|
+
→ get_class_hierarchy
|
|
591
|
+
|
|
592
|
+
I need to find circular dependencies
|
|
593
|
+
→ find_cycles
|
|
594
|
+
|
|
595
|
+
I need to understand module coupling / instability scores
|
|
596
|
+
→ get_coupling_map
|
|
597
|
+
|
|
598
|
+
I need a visual diagram of the codebase
|
|
599
|
+
→ render_diagram (general: import graph, call graph, class hierarchy)
|
|
600
|
+
→ render_call_graph / render_import_graph / render_class_hierarchy / render_dep_matrix (specialized)
|
|
601
|
+
|
|
602
|
+
I need to check if a rename / delete / move is safe before doing it
|
|
603
|
+
→ check_rename_safe / check_delete_safe / check_move_safe
|
|
604
|
+
|
|
605
|
+
I need a sequenced plan for a structural refactoring
|
|
606
|
+
→ plan_refactoring
|
|
607
|
+
|
|
608
|
+
I need a quick health score for the codebase (CI gate / dashboard)
|
|
609
|
+
→ health_radar
|
|
610
|
+
|
|
611
|
+
I need a detailed debt report with per-file rankings
|
|
612
|
+
→ get_debt_report
|
|
613
|
+
|
|
614
|
+
I need to compare codebase health before and after a change
|
|
615
|
+
→ get_architecture_snapshot (before) → [change] → get_architecture_snapshot (after) → diff_health_radar
|
|
616
|
+
|
|
617
|
+
I need to find all instances of a specific AST node type (try/catch, arrow functions, etc.)
|
|
618
|
+
→ search_ast
|
|
619
|
+
|
|
620
|
+
I need to find functions matching a type signature pattern
|
|
621
|
+
→ search_by_signature
|
|
622
|
+
|
|
623
|
+
I need to find all symbols with a specific decorator
|
|
624
|
+
→ search_by_decorator
|
|
625
|
+
|
|
626
|
+
I need to find the most complex functions
|
|
627
|
+
→ search_by_complexity or get_complexity_hotspots
|
|
628
|
+
|
|
629
|
+
I need to find where an application starts
|
|
630
|
+
→ get_entry_points
|
|
631
|
+
|
|
632
|
+
I need to know what a module exports (public API surface)
|
|
633
|
+
→ get_public_api
|
|
634
|
+
|
|
635
|
+
I need to find all TODOs and FIXMEs
|
|
636
|
+
→ get_todos
|
|
637
|
+
|
|
638
|
+
I need to find untested exported symbols
|
|
639
|
+
→ find_untested_symbols
|
|
640
|
+
|
|
641
|
+
I need a per-file coverage map
|
|
642
|
+
→ get_test_coverage_map
|
|
643
|
+
|
|
644
|
+
I need to understand type dependencies between types
|
|
645
|
+
→ get_type_graph
|
|
321
646
|
```
|
|
322
647
|
|
|
323
648
|
---
|
|
@@ -441,6 +766,65 @@ Every response includes a `_tokenEstimate`. Use it to decide whether to fetch mo
|
|
|
441
766
|
5. detect_antipatterns({ repoId }) → flag new structural issues
|
|
442
767
|
```
|
|
443
768
|
|
|
769
|
+
### Pattern: refactor safely (rename / delete / move)
|
|
770
|
+
|
|
771
|
+
```
|
|
772
|
+
1. search_symbols({ query: "symbolName" })
|
|
773
|
+
2. check_rename_safe / check_delete_safe / check_move_safe → binary verdict + affected sites
|
|
774
|
+
3. If safe: proceed with the change
|
|
775
|
+
If not safe: resolve blockers listed in affectedSites first, then re-check
|
|
776
|
+
4. find_dead_code({ repoId }) → verify no orphaned exports remain
|
|
777
|
+
```
|
|
778
|
+
|
|
779
|
+
### Pattern: modify an interface or base class safely
|
|
780
|
+
|
|
781
|
+
```
|
|
782
|
+
1. search_symbols({ query: "InterfaceName", kind: "interface" })
|
|
783
|
+
2. find_implementations({ symbolId }) → all classes that must be updated
|
|
784
|
+
3. get_class_hierarchy({ symbolId, direction: "descendants" }) → inheritance tree
|
|
785
|
+
4. get_blast_radius({ symbolId }) → file-level impact scope
|
|
786
|
+
5. [make the change]
|
|
787
|
+
6. find_implementations({ symbolId }) → verify missingMethods is empty
|
|
788
|
+
```
|
|
789
|
+
|
|
790
|
+
### Pattern: plan and execute a tech debt sprint
|
|
791
|
+
|
|
792
|
+
```
|
|
793
|
+
1. health_radar({ repoId }) → 5-axis health baseline
|
|
794
|
+
2. get_debt_report({ repoId }) → per-file rankings + recommendations
|
|
795
|
+
3. get_complexity_hotspots({ repoId }) → worst functions to tackle first
|
|
796
|
+
4. find_untested_symbols({ repoId }) → coverage gaps
|
|
797
|
+
5. find_cycles({ repoId }) → circular deps to break
|
|
798
|
+
6. get_architecture_snapshot({ repoId }) → baseline snapshot before changes
|
|
799
|
+
7. [fix highest-priority items]
|
|
800
|
+
8. get_architecture_snapshot({ repoId }) → after snapshot
|
|
801
|
+
9. diff_health_radar({ before, after }) → prove the improvement
|
|
802
|
+
```
|
|
803
|
+
|
|
804
|
+
### Pattern: generate codebase diagrams
|
|
805
|
+
|
|
806
|
+
```
|
|
807
|
+
1. render_diagram({ repoId, type: "module", format: "mermaid" })
|
|
808
|
+
→ whole-repo import graph
|
|
809
|
+
2. search_symbols + render_call_graph({ rootSymbolId })
|
|
810
|
+
→ call flow rooted at a function
|
|
811
|
+
3. search_symbols + render_class_hierarchy({ rootSymbolId })
|
|
812
|
+
→ inheritance tree
|
|
813
|
+
4. render_dep_matrix({ repoId, scope: "src/core/" })
|
|
814
|
+
→ coupling matrix for a module
|
|
815
|
+
```
|
|
816
|
+
|
|
817
|
+
### Pattern: onboard via code intelligence
|
|
818
|
+
|
|
819
|
+
```
|
|
820
|
+
1. get_entry_points({ repoId }) → where does the app start?
|
|
821
|
+
2. get_public_api({ repoId }) → what does it expose?
|
|
822
|
+
3. get_context_bundle({ symbolId: entryPointId }) → trace dependencies from root
|
|
823
|
+
4. get_type_graph({ repoId }) → understand type system structure
|
|
824
|
+
5. get_todos({ repoId }) → known rough edges
|
|
825
|
+
6. get_test_coverage_map({ repoId }) → where tests are thin
|
|
826
|
+
```
|
|
827
|
+
|
|
444
828
|
---
|
|
445
829
|
|
|
446
830
|
## Search tips
|
|
@@ -507,3 +891,12 @@ These are documented gaps — understand them so you can work around them rather
|
|
|
507
891
|
| **Ecosystem** | `search_columns` is dbt-only — does not cover `CREATE TABLE` SQL columns. | Use `get_symbol_source` on the `CREATE TABLE` symbol instead. |
|
|
508
892
|
| **Ecosystem** | dbt indexer does not detect stale `manifest.json`. | Always run `dbt compile` before `index_folder` on dbt projects. |
|
|
509
893
|
| **Ecosystem** | BigQuery STRUCT/ARRAY, Snowflake QUALIFY, and DuckDB LIST/MAP may not parse fully. | Model-level symbols are still extracted even when the body fails to parse. |
|
|
894
|
+
| **Relationship Analysis** | `find_implementations` uses signature LIKE matching + import-graph scan — may miss implementations in files that don't import the interface and use an identical name. | Check `get_blast_radius` for files that transitively depend on the interface file. |
|
|
895
|
+
| **Relationship Analysis** | `get_call_hierarchy` uses import-edge graph, not runtime call data — dynamic dispatch, `eval`, and reflection are invisible. | Complement with runtime profiling for highly dynamic code. |
|
|
896
|
+
| **Visualization** | Mermaid diagrams with >50 nodes become unreadable in most renderers. | Use `maxNodes` to cap output; use `scope`/`filePath` to restrict to a module. |
|
|
897
|
+
| **Visualization** | DOT output requires Graphviz to render — not available natively in Claude or GitHub. | Use `format: "mermaid"` for in-chat and in-PR rendering. |
|
|
898
|
+
| **Refactoring Safety** | `check_rename_safe` flags string-literal references but cannot determine if they are intentional (e.g. serialization keys). | String-literal blockers always require human review — do not automate around them. |
|
|
899
|
+
| **Refactoring Safety** | `plan_refactoring` generates heuristic step ordering — estimated effort is approximate. | Treat as a starting point; validate step order against actual dependency analysis. |
|
|
900
|
+
| **Health & Debt** | `health_radar` stability axis requires git metadata — set `includeStability: false` if the repo has no git history. | The remaining four axes still reflect structural health accurately. |
|
|
901
|
+
| **Code Intelligence** | `find_untested_symbols` uses import heuristics, not runtime coverage — a symbol imported in a test file is "tested" regardless of assertion quality. | Combine with Istanbul/c8 for precise branch-level coverage data. |
|
|
902
|
+
| **AST Search** | `search_ast` only searches files backed by a WASM grammar — regex-only handlers (Terraform, Protobuf, GraphQL, etc.) are silently skipped. | Use `search_text` for content in unsupported file types. |
|
|
@@ -35,6 +35,31 @@ Always call `list_repos` before any code navigation. If the project is not liste
|
|
|
35
35
|
| Get per-file quality scores (complexity, coupling) | `get_quality_metrics` |
|
|
36
36
|
| Find god classes, circular deps, dead code | `detect_antipatterns` |
|
|
37
37
|
| Generate an architecture overview doc | `get_architecture_doc` |
|
|
38
|
+
| Find all implementations of an interface / abstract class | `find_implementations` |
|
|
39
|
+
| Trace execution flow (callers / callees tree) | `get_call_hierarchy` |
|
|
40
|
+
| Understand class inheritance (ancestors / descendants) | `get_class_hierarchy` |
|
|
41
|
+
| Detect circular import dependencies | `find_cycles` |
|
|
42
|
+
| Get per-file coupling and instability scores | `get_coupling_map` |
|
|
43
|
+
| Generate a Mermaid / DOT diagram (import graph, call graph, class hierarchy) | `render_diagram` (or specialized variants) |
|
|
44
|
+
| Capture an architectural snapshot for before/after comparison | `get_architecture_snapshot` |
|
|
45
|
+
| Pre-flight check before renaming a symbol | `check_rename_safe` |
|
|
46
|
+
| Pre-flight check before deleting a symbol | `check_delete_safe` |
|
|
47
|
+
| Pre-flight check before moving a symbol to another file | `check_move_safe` |
|
|
48
|
+
| Get a sequenced, risk-annotated refactoring plan | `plan_refactoring` |
|
|
49
|
+
| 5-axis codebase health score (CI gate / dashboard) | `health_radar` |
|
|
50
|
+
| Compare health before and after a refactoring | `diff_health_radar` |
|
|
51
|
+
| Detailed debt report with per-file rankings | `get_debt_report` |
|
|
52
|
+
| Find every occurrence of an AST node type (try/catch, arrow fn, etc.) | `search_ast` |
|
|
53
|
+
| Find symbols matching a type signature pattern | `search_by_signature` |
|
|
54
|
+
| Find all symbols with a specific decorator | `search_by_decorator` |
|
|
55
|
+
| Find the most complex functions by threshold | `search_by_complexity` |
|
|
56
|
+
| Identify where an application starts (main, CLI, Lambda, server) | `get_entry_points` |
|
|
57
|
+
| Audit a module's exported public API surface | `get_public_api` |
|
|
58
|
+
| Find all TODO / FIXME / HACK comments | `get_todos` |
|
|
59
|
+
| Rank symbols by complexity score | `get_complexity_hotspots` |
|
|
60
|
+
| Understand type dependency relationships | `get_type_graph` |
|
|
61
|
+
| Find exported symbols with no test coverage | `find_untested_symbols` |
|
|
62
|
+
| Get a per-file test coverage map | `get_test_coverage_map` |
|
|
38
63
|
|
|
39
64
|
---
|
|
40
65
|
|
|
@@ -62,6 +87,14 @@ Always call `list_repos` before any code navigation. If the project is not liste
|
|
|
62
87
|
|
|
63
88
|
**11. For dbt projects:** always run `dbt compile` before `index_folder`. Use `search_columns` for column lineage, `get_context_bundle` for model dependencies, and `search_symbols` with `kind: "route"` for API endpoints.
|
|
64
89
|
|
|
90
|
+
**12. Always run a pre-flight check before rename/delete/move.** Call `check_rename_safe`, `check_delete_safe`, or `check_move_safe` first. If `safe: false`, resolve the listed blockers before proceeding — never bypass string-literal conflicts.
|
|
91
|
+
|
|
92
|
+
**13. Before modifying an interface or base class:** call `find_implementations` to get every class that must be updated, and `get_class_hierarchy` to see the full descendant tree.
|
|
93
|
+
|
|
94
|
+
**14. Use `health_radar` for quick health assessment; `get_debt_report` for actionable detail.** `health_radar` is compact (A–F grade + 5 scores); `get_debt_report` has per-file rankings and recommendations.
|
|
95
|
+
|
|
96
|
+
**15. `search_ast` is for structural patterns, not symbol names.** Use it to find all try/catch blocks, all arrow functions, all JSX elements — things `search_symbols` cannot express. Node type names are case-sensitive tree-sitter names.
|
|
97
|
+
|
|
65
98
|
---
|
|
66
99
|
|
|
67
100
|
## Common patterns
|
|
@@ -95,3 +128,23 @@ get_churn_metrics → get_symbol_history for changed symbols → search_symbols
|
|
|
95
128
|
```
|
|
96
129
|
get_quality_metrics → detect_antipatterns → get_architecture_doc (before) → [refactor] → detect_antipatterns (after)
|
|
97
130
|
```
|
|
131
|
+
|
|
132
|
+
**Rename / delete / move a symbol safely**
|
|
133
|
+
```
|
|
134
|
+
check_rename_safe / check_delete_safe / check_move_safe → [resolve blockers if safe:false] → [edit] → find_dead_code
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
**Modify an interface or base class**
|
|
138
|
+
```
|
|
139
|
+
find_implementations → get_class_hierarchy (descendants) → get_blast_radius → [edit] → find_implementations (verify missingMethods=[])
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
**Tech debt sprint**
|
|
143
|
+
```
|
|
144
|
+
health_radar → get_debt_report → get_complexity_hotspots → find_untested_symbols → find_cycles → get_architecture_snapshot (before) → [fix] → get_architecture_snapshot (after) → diff_health_radar
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
**Onboard to a new codebase**
|
|
148
|
+
```
|
|
149
|
+
get_entry_points → get_public_api → get_context_bundle (from entry point) → get_type_graph → get_todos → get_test_coverage_map
|
|
150
|
+
```
|