purecontext-mcp 1.1.8 → 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/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/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/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-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-B60SMPbX.js → DependencyGraph-BSMhzwWV.js} +1 -1
- package/dist/ui/assets/{NotFound-Bsg8Wppk.js → NotFound-CipFP_s1.js} +1 -1
- package/dist/ui/assets/{RepoDetail-Cie0D4_s.js → RepoDetail-Dfp5z5Kq.js} +1 -1
- package/dist/ui/assets/{RepoList-CldNt89M.js → RepoList-BKtST3hB.js} +1 -1
- package/dist/ui/assets/{Search-CgvpHMOi.js → Search-DzhGDViy.js} +1 -1
- package/dist/ui/assets/{SymbolView-B9h0LZTz.js → SymbolView-ryVEwAHG.js} +1 -1
- package/dist/ui/assets/{index-DADf5y_L.css → index-Ny8gn9F0.css} +1 -1
- package/dist/ui/assets/{index-eK0wMkUR.js → index-nX2chMqi.js} +2 -2
- package/dist/ui/assets/{useSearch-KAl3Qyi2.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-RP7vJEyQ.js +0 -1
package/AST-SEARCH.md
ADDED
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
# AST-Level Search
|
|
2
|
+
|
|
3
|
+
The three standard search modes — by name, by meaning, by text — cover most navigation tasks. But some questions can only be answered by looking at the *structure* of the code, not its surface.
|
|
4
|
+
|
|
5
|
+
- How many arrow functions are in this codebase?
|
|
6
|
+
- Find every function that returns `Promise<void>`.
|
|
7
|
+
- Which classes use the `@Injectable` decorator?
|
|
8
|
+
- Show me every function with more than 6 parameters.
|
|
9
|
+
|
|
10
|
+
These are structural questions. PureContext's AST-level search tools answer them by searching the indexed symbol data and — where needed — re-parsing stored file content through tree-sitter grammars.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Searching by AST node type
|
|
15
|
+
|
|
16
|
+
`search_ast` finds every occurrence of a specific tree-sitter node type across all indexed files. If you've ever wanted to run a structural grep across a codebase, this is it.
|
|
17
|
+
|
|
18
|
+
**Scenario:** Your team is trying to eliminate all `try/catch` blocks in favor of `Result` types. Before you start, you want to know how many there are and where.
|
|
19
|
+
|
|
20
|
+
> "Find every try/catch block in the TypeScript source files."
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
search_ast(repoId, nodeType: "try_statement", language: "typescript") →
|
|
24
|
+
|
|
25
|
+
47 matches across 23 files:
|
|
26
|
+
|
|
27
|
+
src/api/routes/auth.ts:34 try { await validateToken(req) } catch (e) { ... }
|
|
28
|
+
src/api/routes/payments.ts:67 try { await chargeCard(amount) } catch (err) { ... }
|
|
29
|
+
src/core/database.ts:123 try { return await db.query(sql) } catch (e) { ... }
|
|
30
|
+
src/workers/sync.ts:45 try { await syncUser(id) } catch (e) {
|
|
31
|
+
...
|
|
32
|
+
(43 more)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
47 places. The migration scope is now concrete.
|
|
36
|
+
|
|
37
|
+
**Finding all await expressions (checking for missing error handling):**
|
|
38
|
+
|
|
39
|
+
> "Find every await expression so I can check which ones lack try/catch."
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
search_ast(repoId, nodeType: "await_expression", filePath: "src/api/") →
|
|
43
|
+
[all awaited calls in the API directory]
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**Common node types by language:**
|
|
47
|
+
|
|
48
|
+
| Language | Node types to try |
|
|
49
|
+
|----------|------------------|
|
|
50
|
+
| 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` |
|
|
51
|
+
| Python | `function_definition`, `class_definition`, `for_statement`, `with_statement`, `decorated_definition`, `lambda` |
|
|
52
|
+
| Go | `function_declaration`, `method_declaration`, `go_statement`, `defer_statement`, `type_declaration`, `interface_type` |
|
|
53
|
+
| Rust | `function_item`, `struct_item`, `impl_item`, `match_expression`, `closure_expression`, `trait_item` |
|
|
54
|
+
| Java / Kotlin | `method_declaration`, `class_declaration`, `try_statement`, `lambda_expression`, `annotation` |
|
|
55
|
+
|
|
56
|
+
Node type names are tree-sitter's internal names and are exact, case-sensitive matches.
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Searching by type signature
|
|
61
|
+
|
|
62
|
+
`search_by_signature` finds symbols by the pattern of their type signature. It operates on the one-line signature stored for every indexed symbol — no re-parsing needed.
|
|
63
|
+
|
|
64
|
+
**Scenario:** You're auditing all functions that accept a `Request` object to make sure they all validate the request before using it.
|
|
65
|
+
|
|
66
|
+
> "Find all functions that accept a Request parameter."
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
search_by_signature(repoId, pattern: "(req: Request", kind: "function") →
|
|
70
|
+
|
|
71
|
+
handleLogin() src/api/routes/auth.ts function
|
|
72
|
+
handleLogout() src/api/routes/auth.ts function
|
|
73
|
+
validateRequestBody() src/api/middleware/validate.ts function
|
|
74
|
+
processWebhook() src/api/routes/webhooks.ts function
|
|
75
|
+
... (14 more)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
All 17 functions that accept a `Request`. Spot-check each one for input validation.
|
|
79
|
+
|
|
80
|
+
**Finding all async functions in a specific directory:**
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
search_by_signature(repoId, pattern: "async", mode: "startsWith", filePath: "src/core/") →
|
|
84
|
+
[all symbols in src/core/ whose signature starts with "async"]
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Finding all exported symbols (to audit the public API surface):**
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
search_by_signature(repoId, pattern: "export", mode: "startsWith") →
|
|
91
|
+
[every symbol with a signature beginning with "export"]
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**Finding functions that return a specific type:**
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
search_by_signature(repoId, pattern: "Promise<void>") →
|
|
98
|
+
[all functions returning Promise<void>]
|
|
99
|
+
|
|
100
|
+
search_by_signature(repoId, pattern: ": string[]") →
|
|
101
|
+
[all functions returning string[]]
|
|
102
|
+
|
|
103
|
+
search_by_signature(repoId, pattern: "AuthResult") →
|
|
104
|
+
[any signature mentioning AuthResult — return types, parameters, or type aliases]
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**Using regex mode for complex patterns:**
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
search_by_signature(repoId, pattern: "\\(.*password.*\\)", mode: "regex") →
|
|
111
|
+
[all functions that have "password" somewhere in their parameter list]
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Searching by decorator
|
|
117
|
+
|
|
118
|
+
`search_by_decorator` finds all symbols annotated with a specific decorator. It re-parses file content to locate decorator nodes — catching decorators that may not appear in the stored signature.
|
|
119
|
+
|
|
120
|
+
**Scenario:** You're auditing all NestJS route handlers decorated with `@Get` to verify they all have proper authentication guards.
|
|
121
|
+
|
|
122
|
+
> "Find all @Get route handlers."
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
search_by_decorator(repoId, decoratorName: "Get") →
|
|
126
|
+
|
|
127
|
+
getUsers() src/users/users.controller.ts:14 method
|
|
128
|
+
getUserById() src/users/users.controller.ts:28 method
|
|
129
|
+
getOrderHistory() src/orders/orders.controller.ts:8 method
|
|
130
|
+
getPaymentMethods() src/billing/billing.controller.ts:19 method
|
|
131
|
+
... (11 more)
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
15 GET handlers. Now cross-reference with those that have an `@UseGuards` decorator:
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
search_by_decorator(repoId, decoratorName: "UseGuards") →
|
|
138
|
+
[12 matches]
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Three handlers don't have a guard. Those are your security gaps.
|
|
142
|
+
|
|
143
|
+
**Prefix match for families of decorators:**
|
|
144
|
+
|
|
145
|
+
```
|
|
146
|
+
search_by_decorator(repoId, decoratorName: "Get", matchMode: "prefix") →
|
|
147
|
+
→ finds @Get, @GetMapping, etc.
|
|
148
|
+
|
|
149
|
+
search_by_decorator(repoId, decoratorName: "Column", matchMode: "prefix") →
|
|
150
|
+
→ finds @Column, @ColumnType, @ColumnDefault, etc.
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
**Finding all ORM entities:**
|
|
154
|
+
|
|
155
|
+
```
|
|
156
|
+
search_by_decorator(repoId, decoratorName: "Entity") →
|
|
157
|
+
[all classes marked as TypeORM entities]
|
|
158
|
+
|
|
159
|
+
search_by_decorator(repoId, decoratorName: "injectable", matchMode: "contains") →
|
|
160
|
+
[all injection-related decorators across frameworks — @Injectable, @Inject, etc.]
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Searching by complexity thresholds
|
|
166
|
+
|
|
167
|
+
`search_by_complexity` finds symbols that match specific numeric criteria across six complexity dimensions. This is different from `get_complexity_hotspots` (which ranks files) — here you set specific thresholds and get back the matching symbols.
|
|
168
|
+
|
|
169
|
+
**Scenario:** A code review checklist says any function with cyclomatic complexity above 8 requires two reviewers. Before the release, find all such functions.
|
|
170
|
+
|
|
171
|
+
> "Find all functions with cyclomatic complexity above 8."
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
search_by_complexity(repoId, minCyclomaticComplexity: 8, kind: "function") →
|
|
175
|
+
|
|
176
|
+
processAuthRequest() src/auth/processor.ts complexity: 18 lines: 120
|
|
177
|
+
generateReport() src/reporting/engine.ts complexity: 14 lines: 89
|
|
178
|
+
validatePaymentForm() src/billing/validator.ts complexity: 11 lines: 67
|
|
179
|
+
migrateUserData() src/workers/migration.ts complexity: 9 lines: 43
|
|
180
|
+
... (7 more)
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
11 functions require dual review.
|
|
184
|
+
|
|
185
|
+
**Finding functions with too many parameters:**
|
|
186
|
+
|
|
187
|
+
> "Find all functions with 5 or more parameters — we're moving to options objects."
|
|
188
|
+
|
|
189
|
+
```
|
|
190
|
+
search_by_complexity(repoId, minParamCount: 5) →
|
|
191
|
+
|
|
192
|
+
createUser(name, email, role, tenantId, options, ...rest) — 6 params
|
|
193
|
+
sendEmail(to, from, subject, body, attachments, headers) — 6 params
|
|
194
|
+
processOrder(items, userId, discount, tax, shipping, note) — 6 params
|
|
195
|
+
... (9 more)
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
**Finding long functions to split:**
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
search_by_complexity(repoId, minLineCount: 100, kind: "function") →
|
|
202
|
+
[all functions longer than 100 lines]
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
**Combining multiple criteria:**
|
|
206
|
+
|
|
207
|
+
> "Find the most dangerous code — high complexity AND deeply nested AND long."
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
search_by_complexity(repoId,
|
|
211
|
+
minCyclomaticComplexity: 8,
|
|
212
|
+
minNestingDepth: 4,
|
|
213
|
+
minLineCount: 50) →
|
|
214
|
+
[intersection of all three filters]
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
**Finding simple utility functions (to understand what's safe to inline):**
|
|
218
|
+
|
|
219
|
+
```
|
|
220
|
+
search_by_complexity(repoId,
|
|
221
|
+
maxCyclomaticComplexity: 2,
|
|
222
|
+
maxLineCount: 10,
|
|
223
|
+
maxParamCount: 2,
|
|
224
|
+
kind: "function") →
|
|
225
|
+
[simple, pure helper functions — candidates for inlining]
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
The six complexity dimensions available:
|
|
229
|
+
|
|
230
|
+
| Dimension | What it measures |
|
|
231
|
+
|-----------|-----------------|
|
|
232
|
+
| `cyclomaticComplexity` | Number of independent code paths (branching) |
|
|
233
|
+
| `cognitiveComplexity` | Mental effort to understand (nested structures) |
|
|
234
|
+
| `lineCount` | Function body size |
|
|
235
|
+
| `nestingDepth` | Maximum level of nested blocks |
|
|
236
|
+
| `paramCount` | Number of parameters |
|
|
237
|
+
| `returnCount` | Number of return statements (exit points) |
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## Combining AST search with other tools
|
|
242
|
+
|
|
243
|
+
AST search tools work best as the starting point for further navigation:
|
|
244
|
+
|
|
245
|
+
```
|
|
246
|
+
1. search_ast(nodeType: "try_statement")
|
|
247
|
+
→ get all try/catch blocks in the codebase
|
|
248
|
+
|
|
249
|
+
2. [review the list, pick the ones you care about]
|
|
250
|
+
|
|
251
|
+
3. get_symbol_source(symbolId)
|
|
252
|
+
→ read the source for specific matches
|
|
253
|
+
|
|
254
|
+
4. find_references(symbolId)
|
|
255
|
+
→ see who calls functions that contain the pattern
|
|
256
|
+
|
|
257
|
+
5. get_context_bundle(symbolId)
|
|
258
|
+
→ understand the full context around a complex function
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
```
|
|
262
|
+
1. search_by_complexity(minCyclomaticComplexity: 10)
|
|
263
|
+
→ find the most complex functions
|
|
264
|
+
|
|
265
|
+
2. get_symbol_history(symbolId)
|
|
266
|
+
→ check how long they've been this complex and who wrote them
|
|
267
|
+
|
|
268
|
+
3. plan_refactoring(goal: "general", filePath)
|
|
269
|
+
→ get a structured plan for the worst files
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
→ Reference: [MCP Tools Reference](docs/06-tools-reference.md) — `search_ast`, `search_by_signature`, `search_by_decorator`, `search_by_complexity`
|
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,68 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
+
## [1.2.0] - 2026-05-13
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
**Advanced relationship analysis (Phase 28)**
|
|
15
|
+
- `find_implementations` — find all concrete implementations of a TypeScript interface or abstract class; returns implementing classes with `implementedMethods` and `missingMethods` arrays compared against the interface contract
|
|
16
|
+
- `get_call_hierarchy` — callers and callees of a function N levels deep as a hierarchical tree; supports `callers`, `callees`, and `both` directions; recursive calls marked `cyclic: true`
|
|
17
|
+
- `get_class_hierarchy` — full inheritance tree rooted at a class, showing both ancestors and descendants; use before refactoring a base class to understand the full polymorphism surface
|
|
18
|
+
- `find_cycles` — detect circular import dependencies across the repo or a subtree; returns strongly-connected components with severity rating
|
|
19
|
+
- `get_coupling_map` — afferent/efferent coupling metrics and instability scores (`I = efferent / (afferent + efferent)`) for every file; highlights highest-risk refactoring candidates
|
|
20
|
+
|
|
21
|
+
**Architectural visualization (Phase 29)**
|
|
22
|
+
- `render_diagram` — general-purpose Mermaid or DOT dependency diagram (module, call graph, class hierarchy); output renders natively in GitHub, VS Code, and Claude
|
|
23
|
+
- `render_call_graph` — specialized call graph diagram rooted at a symbol with call-graph-specific layout options
|
|
24
|
+
- `render_import_graph` — file-level import graph for a directory or whole repo; nodes clustered by directory
|
|
25
|
+
- `render_class_hierarchy` — class inheritance diagram in Mermaid `classDiagram` format; shows fields, methods, and inheritance/implementation relationships
|
|
26
|
+
- `render_dep_matrix` — dependency matrix diagram showing coupling between modules as a grid; surfaces structural hotspots at a glance
|
|
27
|
+
- `get_architecture_snapshot` — captures architectural state (file count, symbol count, module breakdown, coupling summary, health scores); take two snapshots to prove structural improvement objectively
|
|
28
|
+
|
|
29
|
+
**Refactoring safety checks (Phase 30)**
|
|
30
|
+
- `check_rename_safe` — pre-flight check before renaming a symbol; returns `safe` verdict and all `affectedSites` (call, import, type-reference, string-literal, comment) with file, line, column, and context snippet
|
|
31
|
+
- `check_delete_safe` — pre-flight check before deleting a symbol; returns `safe: false` if anything in the repo still imports or references the symbol
|
|
32
|
+
- `check_move_safe` — pre-flight check before moving a symbol to a different file; validates no import conflicts and lists all import statements that need updating
|
|
33
|
+
- `plan_refactoring` — generate a sequenced, dependency-ordered plan for a structural change from a natural-language description; steps ordered so lower-risk changes happen first
|
|
34
|
+
|
|
35
|
+
**Health dashboards & debt reporting (Phase 31)**
|
|
36
|
+
- `health_radar` — five-axis health score (complexity, coupling, maintainability, documentation, stability), each 0–100; returns `overallHealth` score and letter grade (A–F); designed for CI health gates
|
|
37
|
+
- `diff_health_radar` — compare two health radar snapshots (before/after a refactoring) with axis-by-axis deltas and regression/improvement verdicts
|
|
38
|
+
- `get_debt_report` — detailed technical debt report with per-file rankings, priority tiers, worst files by each metric, specific symbols to address, and estimated effort indicators
|
|
39
|
+
|
|
40
|
+
**AST-level search (Phase 32)**
|
|
41
|
+
- `search_ast` — find every occurrence of a specific tree-sitter node type across all indexed files (e.g. `try_statement`, `arrow_function`, `await_expression`); returns file, line, column, and snippet
|
|
42
|
+
- `search_by_signature` — search symbols by type signature pattern (regex or substring); find all functions returning `Promise<void>` or methods accepting a `Request` parameter
|
|
43
|
+
- `search_by_decorator` — find all symbols annotated with a specific decorator; works for TypeScript (`@Injectable`, `@Controller`) and Python (`@app.route`, `@property`) decorators
|
|
44
|
+
- `search_by_complexity` — find symbols above or below a complexity threshold; returns symbols ranked by complexity score; use before refactoring sprints or to enforce complexity budgets
|
|
45
|
+
|
|
46
|
+
**Code intelligence helpers (Phase 33)**
|
|
47
|
+
- `get_entry_points` — identify all runnable entry points: main functions, CLI handlers, HTTP server startups, Lambda handlers, test suites, and scripts; each result includes `kind`, `confidence`, and reason
|
|
48
|
+
- `get_public_api` — all exported symbols grouped by file; use to document a library, audit what is exposed, or check for accidental exports
|
|
49
|
+
- `get_todos` — find all TODO, FIXME, HACK, NOTE, and XXX comments across the repo with file, line, tag type, and comment text
|
|
50
|
+
- `get_complexity_hotspots` — symbols ranked by complexity score, highest first; use to identify the worst functions before a refactoring sprint
|
|
51
|
+
- `get_type_graph` — type dependency graph showing which types reference which other types, rooted at a specific type or across the whole repo; supports `uses`, `usedBy`, and `both` directions
|
|
52
|
+
- `find_untested_symbols` — exported symbols with no corresponding test coverage, ranked by complexity (highest priority first); uses import-based heuristics
|
|
53
|
+
- `get_test_coverage_map` — per-file coverage map showing which symbols are referenced by test files and which are not; produces `coverageRatio` per file and aggregated totals
|
|
54
|
+
|
|
55
|
+
**Documentation guides**
|
|
56
|
+
- `AST-SEARCH.md` — guide to AST-level search tools and tree-sitter node types
|
|
57
|
+
- `CODE-INTELLIGENCE.md` — guide to code intelligence helper tools
|
|
58
|
+
- `HEALTH-DASHBOARDS.md` — guide to health radar, debt reporting, and architecture snapshots
|
|
59
|
+
- `REFACTORING-SAFELY.md` — guide to refactoring safety check tools and pre-flight workflows
|
|
60
|
+
- `UNDERSTANDING-RELATIONSHIPS.md` — guide to relationship analysis tools (call hierarchy, class hierarchy, coupling)
|
|
61
|
+
- `VISUALIZING-CODE.md` — guide to diagram rendering tools and Mermaid output
|
|
62
|
+
- `WORKFLOW-TECH-DEBT.md` — end-to-end tech debt sprint workflow
|
|
63
|
+
|
|
64
|
+
### Fixed
|
|
65
|
+
|
|
66
|
+
- Token savings tracker: corrected cumulative savings calculation and fixed display in web UI
|
|
67
|
+
- Web UI: dependency graph and repo detail pages now render correctly after token tracker refactor
|
|
68
|
+
- Docker: UI workspace panel and repo list routing fixes
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
10
72
|
## [1.1.0] - 2026-05-07
|
|
11
73
|
|
|
12
74
|
### Added
|