@angular-modernizer/adapter-mcp 1.2.0 → 2.1.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.
Files changed (138) hide show
  1. package/CHANGELOG.md +688 -0
  2. package/README.md +84 -445
  3. package/dist/cli.js +9 -1
  4. package/dist/core/project-analyzer.js +2 -2
  5. package/dist/index.d.ts +10 -0
  6. package/dist/index.js +1 -0
  7. package/dist/scan-host/scan-host.d.ts +7 -0
  8. package/dist/scan-host/scan-host.js +73 -10
  9. package/dist/scan-host/scan-protocol.d.ts +2 -0
  10. package/dist/scan-host/scan-worker.js +14 -8
  11. package/dist/server/limited-stdio-transport.d.ts +6 -3
  12. package/dist/server/limited-stdio-transport.js +26 -9
  13. package/dist/server/mcp-server.js +1 -1
  14. package/dist/server/sdk-server.d.ts +14 -3
  15. package/dist/server/sdk-server.js +54 -6
  16. package/dist/server/tool-registry.d.ts +3 -1
  17. package/dist/server/tool-registry.js +8 -3
  18. package/dist/streaming/progress-store.d.ts +19 -7
  19. package/dist/streaming/progress-store.js +19 -8
  20. package/dist/tools/analyze-build-impact.d.ts +7 -4
  21. package/dist/tools/analyze-build-impact.js +8 -3
  22. package/dist/tools/analyze-core-to-shared.d.ts +10 -6
  23. package/dist/tools/analyze-core-to-shared.js +63 -60
  24. package/dist/tools/analyze-parser-performance.d.ts +57 -13
  25. package/dist/tools/analyze-parser-performance.js +67 -6
  26. package/dist/tools/analyze-project.d.ts +55 -4
  27. package/dist/tools/analyze-project.js +104 -15
  28. package/dist/tools/check-incremental-compatibility.d.ts +30 -41
  29. package/dist/tools/check-incremental-compatibility.js +32 -264
  30. package/dist/tools/collect-feedback.js +15 -2
  31. package/dist/tools/compare-health.d.ts +40 -4
  32. package/dist/tools/compare-health.js +22 -5
  33. package/dist/tools/extract-libraries.js +42 -27
  34. package/dist/tools/find-angular-symbol.js +3 -2
  35. package/dist/tools/find-component-hosts.js +3 -2
  36. package/dist/tools/find-usages.js +21 -12
  37. package/dist/tools/get-call-graph.js +15 -2
  38. package/dist/tools/get-operation-progress-tool.d.ts +1 -1
  39. package/dist/tools/get-operation-progress-tool.js +2 -2
  40. package/dist/tools/get-operation-progress.d.ts +4 -1
  41. package/dist/tools/get-operation-progress.js +6 -2
  42. package/dist/tools/helpers/analysis-output.d.ts +32 -1
  43. package/dist/tools/helpers/analysis-output.js +25 -1
  44. package/dist/tools/helpers/build-cache.d.ts +27 -0
  45. package/dist/tools/helpers/build-cache.js +86 -0
  46. package/dist/tools/helpers/class-filter.d.ts +18 -0
  47. package/dist/tools/helpers/class-filter.js +30 -0
  48. package/dist/tools/helpers/cli-arguments.d.ts +23 -0
  49. package/dist/tools/helpers/cli-arguments.js +35 -0
  50. package/dist/tools/helpers/feedback-catalog.d.ts +38 -0
  51. package/dist/tools/helpers/feedback-catalog.js +196 -0
  52. package/dist/tools/helpers/feedback-sidecar.d.ts +201 -0
  53. package/dist/tools/helpers/feedback-sidecar.js +381 -0
  54. package/dist/tools/helpers/file-type-check.d.ts +34 -0
  55. package/dist/tools/helpers/file-type-check.js +56 -0
  56. package/dist/tools/helpers/health-delta.d.ts +6 -0
  57. package/dist/tools/helpers/health-delta.js +4 -1
  58. package/dist/tools/helpers/library-import-warning.d.ts +33 -0
  59. package/dist/tools/helpers/library-import-warning.js +38 -0
  60. package/dist/tools/helpers/library-imports.d.ts +38 -14
  61. package/dist/tools/helpers/library-imports.js +128 -23
  62. package/dist/tools/helpers/output-contract.d.ts +64 -0
  63. package/dist/tools/helpers/output-contract.js +67 -0
  64. package/dist/tools/helpers/pattern-anonymizer.d.ts +27 -0
  65. package/dist/tools/helpers/pattern-anonymizer.js +159 -0
  66. package/dist/tools/helpers/project-cache.d.ts +5 -4
  67. package/dist/tools/helpers/project-cache.js +21 -16
  68. package/dist/tools/helpers/project-decorators.d.ts +11 -4
  69. package/dist/tools/helpers/project-decorators.js +13 -6
  70. package/dist/tools/helpers/refresh-apply.d.ts +94 -0
  71. package/dist/tools/helpers/refresh-apply.js +460 -0
  72. package/dist/tools/helpers/refresh-inventory.d.ts +106 -0
  73. package/dist/tools/helpers/refresh-inventory.js +631 -0
  74. package/dist/tools/helpers/rule-runner.js +3 -1
  75. package/dist/tools/helpers/scan-cache.d.ts +117 -5
  76. package/dist/tools/helpers/scan-cache.js +179 -6
  77. package/dist/tools/helpers/scan-engine.d.ts +43 -6
  78. package/dist/tools/helpers/scan-engine.js +141 -22
  79. package/dist/tools/helpers/scan-plan.js +16 -2
  80. package/dist/tools/helpers/source-map-loader.d.ts +55 -0
  81. package/dist/tools/helpers/source-map-loader.js +226 -0
  82. package/dist/tools/helpers/template-check.d.ts +76 -0
  83. package/dist/tools/helpers/template-check.js +158 -0
  84. package/dist/tools/helpers/tool-cache.d.ts +7 -2
  85. package/dist/tools/helpers/tool-cache.js +9 -3
  86. package/dist/tools/helpers/tool-context.d.ts +18 -0
  87. package/dist/tools/helpers/tool-context.js +29 -0
  88. package/dist/tools/helpers/transform-safety.d.ts +151 -1
  89. package/dist/tools/helpers/transform-safety.js +357 -4
  90. package/dist/tools/inspect-form-group.js +5 -0
  91. package/dist/tools/inspect-i18n.d.ts +1 -1
  92. package/dist/tools/inspect-template.js +8 -2
  93. package/dist/tools/learn-patterns.d.ts +43 -28
  94. package/dist/tools/learn-patterns.js +83 -161
  95. package/dist/tools/list-imports.d.ts +1 -1
  96. package/dist/tools/orchestrate-migration.d.ts +19 -1
  97. package/dist/tools/orchestrate-migration.js +52 -10
  98. package/dist/tools/parse-stack-trace.d.ts +48 -1
  99. package/dist/tools/parse-stack-trace.js +108 -9
  100. package/dist/tools/plan-migration.js +22 -10
  101. package/dist/tools/refresh-state.d.ts +378 -0
  102. package/dist/tools/refresh-state.js +370 -0
  103. package/dist/tools/resolve-type.js +10 -3
  104. package/dist/tools/review-feedback.d.ts +42 -7
  105. package/dist/tools/review-feedback.js +24 -17
  106. package/dist/tools/rollback-changes.d.ts +5 -0
  107. package/dist/tools/rollback-changes.js +7 -2
  108. package/dist/tools/run-angular-cli.js +36 -22
  109. package/dist/tools/run-build.d.ts +33 -28
  110. package/dist/tools/run-build.js +136 -438
  111. package/dist/tools/run-schematic.d.ts +8 -2
  112. package/dist/tools/run-schematic.js +80 -50
  113. package/dist/tools/scan-all.d.ts +37 -15
  114. package/dist/tools/scan-all.js +76 -115
  115. package/dist/tools/scan-angular.d.ts +33 -14
  116. package/dist/tools/scan-angular.js +77 -94
  117. package/dist/tools/scan-architecture.d.ts +37 -12
  118. package/dist/tools/scan-architecture.js +220 -139
  119. package/dist/tools/scan-solid.d.ts +33 -14
  120. package/dist/tools/scan-solid.js +80 -91
  121. package/dist/tools/search-codebase.d.ts +6 -1
  122. package/dist/tools/search-codebase.js +13 -7
  123. package/dist/tools/suggest-improvements.d.ts +34 -3
  124. package/dist/tools/suggest-improvements.js +34 -9
  125. package/dist/tools/trace-output-flow.js +3 -2
  126. package/dist/tools/transform-code-batch.d.ts +9 -9
  127. package/dist/tools/transform-code.d.ts +161 -12
  128. package/dist/tools/transform-code.js +715 -206
  129. package/dist/tools/validate-before-transform.js +2 -1
  130. package/dist/tools/validate-project-compatibility.d.ts +28 -55
  131. package/dist/tools/validate-project-compatibility.js +33 -225
  132. package/dist/tools/validate-transformation.d.ts +40 -26
  133. package/dist/tools/validate-transformation.js +115 -294
  134. package/dist/tools/verify-citations.js +8 -2
  135. package/dist/types.d.ts +9 -9
  136. package/dist/utils/format-tool-response.d.ts +3 -1
  137. package/dist/utils/format-tool-response.js +8 -3
  138. package/package.json +14 -13
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @angular-modernizer/adapter-mcp
2
2
 
3
- MCP server that exposes Angular Modernizer capabilities as 41 structured tools for AI assistants.
3
+ MCP server that exposes Angular Modernizer capabilities as <!-- facts:tools -->42<!-- /facts --> structured tools for AI assistants.
4
4
 
5
5
  ---
6
6
 
@@ -21,7 +21,7 @@ AI Assistant (Claude/Copilot)
21
21
  | protocol eras 2025-06-18 / 2025-11-25 (initialize), 2026-07-28 (server/discover)
22
22
  v
23
23
  MCP Server (adapter-mcp)
24
- - 41 Tools (analysis, planning, transformation,
24
+ - MCP tools (analysis, planning, transformation,
25
25
  build and validation, rollback, feedback, bug investigation)
26
26
  - Input validation against closed JSON schemas
27
27
  - structuredContent validated against each outputSchema, plus a summary text
@@ -29,14 +29,14 @@ MCP Server (adapter-mcp)
29
29
  - Shared ts-morph ProjectCache (investigation tools, build impact, plan-migration)
30
30
  | |
31
31
  | Kernel per call | direct calls
32
- | (scans, transform-code, ...) | (14 investigation tools)
32
+ | (scans, transform-code, ...) | (investigation tools)
33
33
  v |
34
34
  Core Platform (Kernel + Plugins) |
35
35
  - Analysis rules (52) |
36
36
  - Architecture: 17 |
37
37
  - Angular: 28 |
38
38
  - SOLID: 7 |
39
- - Transformations (26 types via transform-code)
39
+ - Transformations (all types via transform-code)
40
40
  - Safety envelope: backup, type check, rollback
41
41
  - Caching, worker parallelism, workflow engine
42
42
  | |
@@ -62,6 +62,8 @@ Arguments are validated against each tool's input schema (JSON Schema 2020-12) b
62
62
 
63
63
  Every tool has an output schema and answers with `structuredContent`: the result object, which always carries a `summary` string. The text content holds only that summary (repeating the JSON there made the answers 1.6 times as large; Claude Code shows the model `structuredContent`). `structuredContent` is validated against the output schema; a result that does not match comes back as an error result. Tools that run a command (run-angular-cli, run-build, run-schematic) keep the full output in the result and repeat only its last lines in the summary on failure. orchestrate-migration reports its step counts in `counts` and `workflowId` at the top level.
64
64
 
65
+ Config warnings: when a call loads a `.angular-modernizer.json` with parts that have no effect, `structuredContent` carries `configWarnings` (`code`: `deprecated-key`, `layers-drift` or `layers-source-failed`; `message`; optional `key`) and the summary gets one line `Config: N warning(s), see configWarnings: <first message>`. The field is part of every output schema and absent when there is nothing to report; it is filled on cache hits and from the scan worker too. A tool that fails after loading the config adds `Config: N warning(s): <first message>` to its error text. Codes and causes: [docs/CONFIGURATION.md](../../docs/CONFIGURATION.md#config-warnings-in-the-tool-answer).
66
+
65
67
  Set `ANGULAR_MODERNIZER_DEBUG=1` in the server environment for diagnostics: a debug log `./mcp-server.log` in the working directory and a health check on `http://localhost:9999/health` and `/status`. Both are off by default.
66
68
 
67
69
  ---
@@ -71,10 +73,10 @@ Set `ANGULAR_MODERNIZER_DEBUG=1` in the server environment for diagnostics: a de
71
73
  ### Installation
72
74
 
73
75
  ```bash
74
- cd packages/adapter-mcp
75
- pnpm install
76
- pnpm build
77
- pnpm start
76
+ # from the repository root: one install for the whole workspace, then build every package
77
+ pnpm install --frozen-lockfile
78
+ pnpm run build
79
+ pnpm run mcp:start
78
80
  ```
79
81
 
80
82
  ### Configuration
@@ -85,8 +87,7 @@ Create `.angular-modernizer.json` in your project root. Only `build` is required
85
87
  ```json
86
88
  {
87
89
  "build": {
88
- "command": "ng build",
89
- "mode": "incremental"
90
+ "command": "ng build"
90
91
  },
91
92
  "tools": {
92
93
  "analyze-project": {
@@ -125,423 +126,64 @@ Or point a client at a local build, e.g. `.mcp.json` / `claude_desktop_config.js
125
126
  ```
126
127
 
127
128
  `--expose-gc` lets the ProjectCache collect garbage after evicting a project. `cli.js` also takes
128
- `--max-projects N` and `--max-heap-mb N` (defaults 3 and 2048; the heap limit also applies to the scan worker) and
129
- `--scan-worker 0` (scans on the main thread instead of a worker thread). A running client keeps the old code in memory
130
- after a rebuild; reconnect, or check `server-status` (`build.rebuiltSinceStart`).
129
+ `--max-projects N` and `--max-heap-mb N` (defaults 3 and 2048; the heap limit also applies to the scan worker, which
130
+ needs at least 16 MB) and `--scan-worker 0` (scans on the main thread instead of a worker thread). A running client
131
+ keeps the old code in memory after a rebuild; reconnect, or check `server-status` (`build.rebuiltSinceStart`).
131
132
 
132
133
  ---
133
134
 
134
135
  ## Available Tools
135
136
 
136
- ### Analysis Tools
137
-
138
- | Tool | Purpose | Rules | Cache | Time |
139
- |-|-|-|-|-|
140
- | analyze-project | Framework/architecture detection | - | yes | 2-5s |
141
- | scan-architecture | Architecture violations incl. import cycles and layer boundaries | 17 | yes | 5-30s |
142
- | scan-solid | SOLID principle violations | 7 | yes | 3-15s |
143
- | scan-angular | Angular best practices | 28 | yes | 5-20s |
144
- | scan-all | Combined analysis (all plugins) | 52 | yes | 10-45s |
145
- | compare-health | Full scan compared with the previous run: new, fixed and unchanged violations per rule and file; answers with `structuredContent` | 52 | yes (scan-all cache) | scan-all time |
146
- | analyze-core-to-shared | Dependency violation analysis | - | yes | 3-10s |
147
- | analyze-parser-performance | Parser metrics from feedback sessions | - | no | varies |
148
- | extract-libraries | Library extraction candidates (shared folders, secondary entry points) | - | no | varies |
149
- | learn-patterns | Pattern discovery with AST heuristics, stored in a knowledge base | - | yes | 10-60s |
150
-
151
- The scans, analyze-project, analyze-core-to-shared and extract-libraries keep their numbers in `counts` (for the scans `totalViolations`, `analyzedFiles`, `bySeverity`, `byCategory`, `byRule`, always over all violations); `summary` is a short text with the totals, the largest rules and categories, the first five entries and the returned page. `violations` holds only the page set by `maxResults` and `resultOffset`, `pagination` says what was cut.
152
-
153
- #### analyze-project
154
-
155
- Detects framework (Angular CLI, Nx), analyzes architecture patterns, identifies layers, and discovers project structure including PWA/offline capabilities.
156
-
157
- Key features:
158
- - Auto-detects tsconfig.json location
159
- - Identifies applications and libraries
160
- - Detects service worker configuration
161
- - Maps architectural layers from path aliases
162
-
163
- #### scan-architecture
164
-
165
- Runs 17 architecture rules detecting import cycles (`solid:circular-dependency`, project-wide value-import graph with NG0919 risk flag), god objects, layer boundary violations, and architectural anti-patterns.
166
-
167
- Key features:
168
- - Batch processing (handles unlimited files)
169
- - Scope filtering (apps, libs, features, folders)
170
- - Up to 39x speedup with caching (202.8s to 5.2s measured)
171
- - Parallel execution with auto-selection
172
- - Time budget `maxDurationMs` (default 300000, `0` = off): checked between files; on overrun the scan returns what it has with `execution.incomplete`, `skippedFiles` and a note. `execution.ruleTimings` lists time per rule, slowest first. Note that `maxFiles` defaults to 100.
173
- - Pagination: `maxResults` (default 1000) and `resultOffset` page the violations; `counts` cover all of them, `pagination.hasMore` says whether to fetch the next page. Pass `rules` (exact rule ids such as `solid:circular-dependency`) for a focused scan.
174
- - Progress (`notifications/progress`, with a `progressToken`) and cancellation between files, see Progress and Cancellation. `streaming` (deprecated) defaults to `false`: the call returns the violations. With `streaming: true` it returns an `operationId` at once and `get-operation-progress` returns the result.
175
-
176
- #### scan-solid
177
-
178
- Runs 7 SOLID principle rules detecting dependency inversion, single responsibility, Liskov substitution, open/closed, and interface segregation violations.
179
-
180
- Key features:
181
- - Pure SOLID principle analysis (DIP, SRP, LSP, OCP, ISP)
182
- - Identifies tightly-coupled dependencies
183
- - Detects god objects and bloated classes
184
- - Independent cache for optimal performance
185
-
186
- #### scan-angular
187
-
188
- Runs 28 Angular-specific rules detecting OnPush violations, RxJS anti-patterns, performance issues, and framework best practice violations.
189
-
190
- Key features:
191
- - Angular-specific best practices
192
- - RxJS optimization opportunities
193
- - Change detection strategy violations
194
- - Bundle size optimization recommendations
195
- - Independent cache for Angular analysis
196
-
197
- #### scan-all
198
-
199
- Runs all 52 analysis rules (17 architecture + 7 SOLID + 28 Angular) with its own cache in `.angular-modernizer-cache/all/`.
200
-
201
- Key features:
202
- - Combines all plugin rules in single scan
203
- - Caches every analyzed file, also without findings, with its template findings and the template as dependency
204
- - Reads and writes only its own cache; the caches of scan-architecture, scan-solid and scan-angular are not read
205
- - Comprehensive analysis in one execution
206
-
207
- #### compare-health
208
-
209
- Runs the scan-all scan over every violation (no result window), compares it with the snapshot of the previous run and stores the current run as the new snapshot.
210
-
211
- Key features:
212
- - Snapshot in `.angular-modernizer-cache/health/last-run.json` (`snapshotPath` overrides), git-ignored with the cache
213
- - Violations match by rule, file and message with digits ignored, so moved lines stay unchanged
214
- - `totals`, `byRule`, `byFile`, `newViolations`, `fixedViolations`, `rulesAdded`; `summaryOnly` and `maxResults` as in the investigation tools
215
- - First run writes the baseline; a snapshot with other `rules` or patterns is reported as `scope-mismatch` and kept unless `updateSnapshot: true`; `updateSnapshot: false` compares without writing
216
-
217
- #### analyze-core-to-shared
218
-
219
- Detects when the core layer imports from the shared layer (architectural anti-pattern) with reverse dependency impact assessment.
220
-
221
- Key features:
222
- - Identifies dependency inversion violations
223
- - Calculates breaking change risk (LOW/MEDIUM/HIGH)
224
- - Traces reverse dependencies
225
- - Provides refactoring recommendations
226
-
227
- #### learn-patterns
228
-
229
- Discovers recurring patterns with self-learning capabilities.
230
-
231
- Key features:
232
- - 5 pattern categories (RxJS, Component, Service, Transformation, Architectural)
233
- - Auto-detects codebase style (RxJS preference, DI style, state management)
234
- - Generates custom analysis rules from patterns
235
- - Tracks pattern evolution across scans
236
-
237
- ### Feedback Tools
238
-
239
- | Tool | Purpose | Cache | Time |
240
- |-|-|-|-|
241
- | collect-feedback | Store the outcome of a transformation or a corrected analysis result | no | <1s |
242
- | review-feedback | Patterns, quality trends and warnings from stored feedback | no | varies |
243
- | suggest-improvements | Rule adjustment suggestions from feedback patterns | no | varies |
244
-
245
- #### collect-feedback
246
-
247
- Manually collect transformation feedback for AI learning with privacy-first design.
248
-
249
- Key features:
250
- - Privacy-first: hashed file paths, no code snippets, bucketed metrics
251
- - Stored in `<projectRoot>/.claude-feedback`; a second, platform-wide store only when `ANGULAR_MODERNIZER_PLATFORM_ROOT` is set
252
- - Automated validation (6 checks) and quality scoring
253
- - Outlier detection (4 types) for anomaly handling
254
- - Learning extraction from transformation outcomes
255
-
256
- Usage:
257
-
258
- ```typescript
259
- {
260
- "transformation": {
261
- "ruleId": "standalone-migration-v1",
262
- "targetFile": "/src/app/user.component.ts",
263
- "approach": "Migrate to standalone component",
264
- "reasoning": "Isolated component, no complex dependencies",
265
- "confidence": 0.95
266
- },
267
- "execution": {
268
- "succeeded": true,
269
- "duration": 1200
270
- },
271
- "validation": {
272
- "buildSuccess": true,
273
- "testsPass": true
274
- },
275
- "storageLocation": "both" // 'project', 'platform', or 'both' (default)
276
- }
277
- ```
278
-
279
- Storage: feedback always goes to `<projectRoot>/.claude-feedback/sessions/`. `both` (default) adds the platform store only when `ANGULAR_MODERNIZER_PLATFORM_ROOT` is set; `platform` requires that variable and fails without it. The server never derives a platform location from its own install path (installed from npm that would be the workspace root or a `node_modules` / npx cache).
280
-
281
- Returns:
282
- - `feedbackId`: unique identifier for this feedback
283
- - `sessionId`: session this feedback belongs to
284
- - `stored`: boolean indicating successful storage
285
- - `storageLocations`: array of paths where feedback was saved
286
- - `validationResult`: quality validation results
287
- - `learnings`: extracted patterns and insights
288
-
289
- Optional on failure: `execution.errorType` (`build`, `type`, `lint`, `test`, `runtime`, `syntax`, `semantic`, `timeout`, `unknown`; inferred from `execution.error` when omitted) and `validation.buildErrors` (string array, used as learning evidence).
290
-
291
- Analysis records (`kind: "analysis"`) report a read-only tool result that had to be corrected by grep, build output, a script or manual reading. No execution or build data is needed; `analysis` takes one record or an array:
292
-
293
- ```typescript
294
- {
295
- "kind": "analysis",
296
- "analysis": {
297
- "tool": "find-usages",
298
- "query": { "symbolName": "OrderListComponent" },
299
- "claimed": "0 usages outside the declaring module",
300
- "actual": "3 template usages in 2 .html files",
301
- "fallbackUsed": "grep", // grep | build | script | manual | none | other
302
- "evidence": ["git grep -n '<app-order-list' -- '*.html'"],
303
- "impact": "high", // optional: low | medium | high
304
- "category": "blind-spot" // optional: blind-spot | false-positive | false-negative | bug | missing-capability | config-drift
305
- }
306
- }
307
- ```
308
-
309
- Returns `kind`, `sessionId`, `stored`, `storageLocations` and per-record `records[]` (`feedbackId`, `stored`, `completenessScore`, `issues`). `review-feedback` reports these records under `analysisInsights`.
310
-
311
- #### review-feedback
312
-
313
- Review collected feedback and extract actionable insights for AI learning.
314
-
315
- Key features:
316
- - Reads `<projectRoot>/.claude-feedback`, plus the platform store when `ANGULAR_MODERNIZER_PLATFORM_ROOT` is set (`sourcesRead` lists the folders)
317
- - Pattern detection: success patterns (>=3 occurrences, >=80% success rate)
318
- - Failure patterns (>=2 occurrences) for early warning
319
- - Quality trend analysis (improved/degraded/unchanged)
320
- - Outlier filtering (<3% outlier rate target)
321
- - Confidence scoring (0.0-1.0) for each insight
322
-
323
- Usage:
324
-
325
- ```typescript
326
- {
327
- "source": "both",
328
- "analysisType": "all",
329
- "minConfidence": 0.7,
330
- "minCompleteness": 70,
331
- "category": "standalone-migration",
332
- "since": "2025-12-01"
333
- }
334
- ```
335
-
336
- Returns:
337
- - `sessions`: number of sessions reviewed
338
- - `transformations`: number of transformations analyzed
339
- - `successRate`: overall success rate (0.0-1.0)
340
- - `insights`: array of detected patterns with confidence scores
341
- - `qualityWarnings`: warnings about low-quality feedback
342
- - `sourcesRead`: locations where feedback was read from
343
- - `analysisRecords`, `analysisInsights`: number of analysis records and the insights drawn from them
137
+ Every tool comes with its full description, input schema and output schema over `tools/list`; the schemas are the
138
+ reference for arguments and results. The table below is generated from that list (`pnpm run docs:facts`); deprecated
139
+ tools say so in their description.
344
140
 
345
- #### suggest-improvements
346
-
347
- Generate suggestions for transformation rules based on feedback patterns.
348
-
349
- Key features:
350
- - 3 suggestion types: parameter-adjustment, prerequisite-check, approach-change
351
- - Confidence scoring (0.0-1.0) for each suggestion
352
- - All suggestions require human approval (`requiresApproval: true`)
353
- - Expected improvement estimates
354
- - Sorted by confidence (highest first)
355
-
356
- Suggestion types:
357
- 1. Parameter adjustment: lower confidence thresholds to reduce false positives (>=3 high-confidence failures)
358
- 2. Prerequisite check: add prerequisite checks for common failure patterns (>=40% failures match pattern)
359
- 3. Approach change: switch to alternative approach with >90% success rate (>=3 successes with new approach)
360
-
361
- Usage:
362
-
363
- ```typescript
364
- {
365
- "ruleId": "standalone-migration-v1",
366
- "source": "both",
367
- "minConfidence": 0.7
368
- }
369
- ```
370
-
371
- Returns:
372
- - `ruleId`: rule these suggestions apply to
373
- - `currentPerformance`: `successRate`, `avgDuration`, `qualityImprovement` of the rule
374
- - `suggestions`: array of suggestions sorted by confidence (descending)
375
- - `feedbackCount`: number of feedback records analyzed
376
- - `analysisFeedbackCount`: number of analysis records for this tool
377
- - `sourcesRead`: locations where feedback was read from
378
-
379
- Example suggestion:
380
-
381
- ```json
382
- {
383
- "type": "parameter-adjustment",
384
- "description": "Lower confidence threshold for this rule",
385
- "reasoning": "3 failures occurred with high confidence (>0.8), suggesting overconfidence in predictions",
386
- "confidence": 0.8,
387
- "expectedImprovement": "Reduce false positives by 21%",
388
- "implementation": "Adjust rule confidence threshold from 0.8 to 0.9. Review decision-making logic to improve accuracy.",
389
- "requiresApproval": true
390
- }
391
- ```
392
-
393
- ### Planning Tools
394
-
395
- | Tool | Purpose | Cache | Time |
396
- |-|-|-|-|
397
- | plan-migration | Style-aware strategy generation; scan-based roadmap from file-level violations | ProjectCache | 1-3s |
398
- | orchestrate-migration | Multi-step workflows with dependency management and checkpoint/resume | no | varies |
399
-
400
- #### plan-migration
401
-
402
- Generates comprehensive migration strategies based on violations, architecture, and codebase style.
403
-
404
- Key features:
405
- - Scan-based roadmap: with `projectRoot` and violations that carry `filePath` (inline or via `scanResultFile`, a
406
- saved scan-architecture result) the phases list concrete files, grouped per file and layer, ordered dependencies
407
- first along the import graph plus template edges (a host after the components, directives and pipes its
408
- template uses), import cycles kept together (`planSource: "scan"`, details in `scanPlan`;
409
- `maxPhases`, `summaryOnly`, `maxResults` caps files per phase and violations per file, default 25)
410
- - Style-aware risk assessment
411
- - Team context integration (velocity, experience, availability)
412
- - Multi-phase roadmap generation (strategy templates when no file paths are given, `planSource: "template"`)
413
- - Identifies style-conflicting steps
414
- - `summary` names strategy, roadmap and scan plan as text; the scan-based plan adds `warnings` when library imports do not resolve
415
- - `scanResultFile` also accepts a saved MCP result (`structuredContent` of scan-architecture or scan-all)
416
-
417
- ### Transformation Tools
418
-
419
- | Tool | Purpose | Cache | Time |
420
- |-|-|-|-|
421
- | transform-code | 26 transformation types | no | varies |
422
- | run-schematic | Angular schematic execution | no | varies |
423
- | run-angular-cli | CLI command execution | no | varies |
424
- | run-build | Multi-build system support | no | varies |
425
-
426
- #### transform-code
427
-
428
- Applies surgical code transformations with pre-validation, backup, build validation, and automatic rollback.
429
-
430
- 26 transformation types:
431
- 1. constructor-to-inject
432
- 2. interface-extraction
433
- 3. standalone-migration
434
- 4. dependency-injection-migration
435
- 5. facade-pattern
436
- 6. form-modernization
437
- 7. constructor-injection-transform
438
- 8. component-inputs-interface-extraction
439
- 9. service-injection-cleanup
440
- 10. container-presentational
441
- 11. core-shared-modules
442
- 12. inheritance-to-composition
443
- 13. promise-service-to-observable
444
- 14. promise-component-to-reactive
445
- 15. promise-cleanup
446
- 16. sequential-await-to-forkjoin
447
- 17. subscription-transform
448
- 18. missing-output-transform
449
- 19. library-extraction
450
- 20. service-bag-transform
451
- 21. any-to-interface
452
- 22. dto-object-literal
453
- 23. interface-duplication
454
- 24. static-class-to-functions
455
- 25. extract-static-from-stateful
456
- 26. type-safety
457
-
458
- plugin-angular transform rules run only for the requested type: transform-code passes `transformationType` and the call's `options` under the `'@angular-modernizer/plugin-angular'` config key.
459
-
460
- Safety features (single file, batch and streaming alike):
461
- - Pre-transformation validation (syntax, types, schema) on the same kernel load as the transformation
462
- - Backup in `<projectRoot>/.angular-modernizer-backups` (`backupDir` overrides): a copy per file with a metadata file next to it, plus a git snapshot (`git stash create`, working tree and stash list untouched) inside a git repository (`backup.gitSnapshot`)
463
- - Type check of the transformed file: only errors the transformation introduced count (`validation.introducedTypeErrors`)
464
- - Build validation (`validateBuild`), project lint only on request (`validateLint`)
465
- - Automatic rollback when validation fails (`autoRollback`)
466
- - Batch mode backs up all files first, type-checks every batch file after the last transformation against its errors before the first one (a file with an introduced error fails, `validation.introducedTypeErrors` lists `<file>: <error>`), and applies `rollbackStrategy` (`all-or-nothing`, `selective`, `none`) to failed files
467
- - `rollback-changes` restores the same backups later (`strategy`: `auto`, `file-backup`, `git-stash`)
468
-
469
- Validation parameters:
470
- - `validateBuild: boolean` - run the project build after transformation (default: false; the transformed file is type-checked either way); `buildValidation` is reported only when it ran
471
- - `validateLint: boolean` - run the project's lint script (default: false; it lints the whole project)
472
- - `buildTimeout: number` - build timeout in ms (default: 300000 = 5 min)
473
- - `projectRoot: string` - project root for backups and build execution
474
-
475
- Build validation (`validateBuild`) runs `build.command` of `.angular-modernizer.json`, else the detected build system (`npx ng build`, `npx nx build`, `npx vite build`), else the `build` script of `package.json`; without one the build is skipped with a warning. A cancelled call restores the backup (see Progress and Cancellation).
476
-
477
- Streaming (deprecated): `streaming` defaults to `false`. With `streaming: true` the call returns an `operationId` at once, runs the same path in the background and `get-operation-progress` returns the result. `diffFormat` has no effect.
478
- - `unified`: traditional git-style diff (human-readable, backward compatible)
479
- - `structured`: machine-first JSON diff with semantic annotations (AI-optimized)
480
- - `both`: include both formats (useful for debugging, higher overhead)
481
-
482
- Structured diff features:
483
- - 13 Angular-specific file type classifications (component, service, module, etc.)
484
- - 14 TypeScript syntax type annotations (decorator, import, class, method, etc.)
485
- - Semantic intent inference with confidence scores (0.0-1.0)
486
- - Angular context extraction (decorators, lifecycle hooks, DI patterns)
487
- - Related change tracking (imports linked to usage)
488
-
489
- Supported build systems: Angular CLI, Nx, Vite, Webpack, npm
490
-
491
- ### Validation and Safety Tools
492
-
493
- | Tool | Purpose | Cache | Time |
494
- |-|-|-|-|
495
- | validate-before-transform | Pre-transformation checks | no | 1-2s |
496
- | validate-transformation | Post-transformation checks | no | 30-300s |
497
- | rollback-changes | Revert transformations | no | <1s |
498
- | check-incremental-compatibility | Whether a project supports incremental build validation | no | varies |
499
- | validate-project-compatibility | Parser compatibility before transformations | no | varies |
500
- | analyze-build-impact | Changed files -> value, type-only and template dependents, affected modules, strategy | ProjectCache | ~1s warm |
501
- | get-operation-progress | Deprecated: progress and result of a streaming operation | no | <1s |
502
-
503
- #### analyze-build-impact
504
-
505
- `filesToChange` is the changed set. Dependents are split into value dependents (JS rebuild), type-only dependents
506
- (type-check only) and template dependents: host components that use a changed component, directive or pipe only in
507
- their template (NgModule declarations), listed with the used classes in `templateHosts`. Barrels only forward the
508
- names they re-export; past the first importer only exports whose type surface (annotations, inferred types, heritage,
509
- `@NgModule` exports) names a changed binding propagate, so using a class inside a method body or a decorator stops
510
- there. `symbols` narrows the impact to consumers of given exports (`symbolImpacts`). `.html` files map
511
- to their component (`mappedFiles`), which counts as changed without its dependents. `summaryOnly` / `maxResults`
512
- shorten the lists; `counts` always describe the full result. `summary` repeats the recommendation and the counts as
513
- text; `warnings` reports library imports that do not resolve, dependents can then be missing.
514
-
515
- ### Bug Investigation Tools
516
-
517
- Read-only tools over the shared ProjectCache: a workspace is parsed once per server and re-read per changed file.
518
- All list-heavy tools take `summaryOnly` and `maxResults`. All answer with `structuredContent` and a `summary` string.
519
- When packages declared in the project's `package.json` do not resolve (no or incomplete `node_modules`), the tools that
520
- load the program add `warnings` with the number of unresolved library imports: library types are then `any` and hosts,
521
- callers and handlers can be missing from the result. The check runs once per loaded project (about 50 ms on 4000 files).
522
-
523
- | Tool | Answers |
524
- |-|-|
525
- | parse-stack-trace | Structured frames from Node.js / Angular / Zone.js / browser stacks, browser URLs and bare file names mapped onto project files |
526
- | find-usages | Every reference to a symbol, classified (declaration, read, write, call, template, unresolved) |
527
- | get-call-graph | Callers and callees of a method or function, incl. template callers (own and inheriting subclass templates); `maxNodes` caps the tree |
528
- | resolve-type | TypeScript type at file:line:col (nullable, async, generics, declaration) |
529
- | find-angular-symbol | Components, directives, pipes, services, ... by selector, pipe name or class, incl. library classes from `.d.ts` |
530
- | search-codebase | Text, regex or declaration search, incl. `.html` and files outside the program |
531
- | list-imports | Imports and re-exports of a file with resolved targets (aliases, barrels); `counts` per kind |
532
- | inspect-template | Template structure: elements, bindings, matched components/directives/pipes, control flow, i18n keys |
533
- | find-component-hosts | Every template host of a component or directive with bound, unbound and missing required inputs/outputs; components created in code (dialogs, `createComponent`, routes) |
534
- | trace-output-flow | Payload of an `@Output` across the template boundary and into subscriptions in code (`ref.instance.x.subscribe`), and dialog data in / results out |
535
- | get-bootstrap-execution | What runs at startup (initializers, bootstrap, interceptors, provider factories) and where a watched expression is touched |
536
- | inspect-form-group | Reactive Forms structure and every enable/disable/validator change per control |
537
- | inspect-i18n | Translation keys: definitions per language and overlay, usages in templates and code, missing and undefined keys |
538
- | verify-citations | Whether the `path:line` citations of Markdown plans still point at the named code: ok, unverified, moved (new lines), anchor-missing, out-of-range, missing-file (similar files), ambiguous |
539
-
540
- ### Server
541
-
542
- | Tool | Purpose |
543
- |-|-|
544
- | server-status | server version, pid, uptime, memory, cached projects, response sizes, and whether the dist was rebuilt since start |
141
+ <!-- facts:tool-table -->
142
+ | Tool | Access | Purpose |
143
+ |-|-|-|
144
+ | `analyze-project` | read-only | Analyze Angular projects to detect framework, architecture, layers, and technologies. |
145
+ | `scan-architecture` | read-only | Scan Angular codebases for architectural issues with the architecture rules: import cycles (solid:circular-dependency, NG0919 risk), import direction, god objects, layer boundaries, content placement, service bags and more. |
146
+ | `scan-solid` | read-only | Scan for SOLID principle violations (DIP, SRP, LSP, OCP, ISP). |
147
+ | `scan-angular` | read-only | Scan for Angular best practice violations (OnPush, TrackBy, Performance, RxJS, etc.). |
148
+ | `scan-all` | read-only | Comprehensive code quality scan with the rules of all analysis plugins (SOLID, Angular, Architecture). |
149
+ | `compare-health` | writes data | Run the full scan-all scan (all violations, no result window) and compare it with the previous run stored in the project: new, fixed and unchanged violations, per rule (byRule) and per changed file (byFile), plus the lists newViolations and fixedViolations. |
150
+ | `refresh-state` | changes files | Lists the state the platform keeps in a project and what of it is stale, orphaned or duplicated: scan caches (.angular-modernizer-cache: entries of deleted files, entries past the 24 h cache limit, unreadable entries), legacy cache layouts, health snapshot and pattern knowledge (age only), transform backups (.angular-modernizer-backups: groups older than the retention outside the newest groups, backups without metadata), git snapshot refs (refs/angular-modernizer/snapshots), feedback sessions (.claude-feedback: duplicate records, records of unregistered rules, transformation types or tools and of deprecated tools) and the NGM-CACHE block of .claude/CLAUDE.md. |
151
+ | `plan-migration` | read-only | Generate comprehensive, style-aware migration plans for architectural improvements. |
152
+ | `transform-code` | changes files | Apply surgical code transformations to fix architectural issues. |
153
+ | `run-angular-cli` | changes files | Execute Angular CLI commands for project management and code generation. |
154
+ | `run-build` | changes files | Run the project's build to validate code transformations: build.command of .angular-modernizer.json, else the detected build system (Angular CLI, Nx, Vite, Webpack), else the build script of package.json, with the project's node_modules/.bin on PATH and the Angular build cache on. |
155
+ | `analyze-core-to-shared` | read-only | Analyze core-to-shared dependency violations with impact assessment. |
156
+ | `run-schematic` | changes files | Execute Angular schematics for code generation and automated migrations. |
157
+ | `validate-before-transform` | read-only | Validate code before transformation to ensure it is safe to modify. |
158
+ | `validate-transformation` | changes files | Validate code after transformation to ensure changes did not break anything: type-checks the file, runs the project's build command (build.command of .angular-modernizer.json, else the detected build system, else the build script of package.json) with the Angular build cache on, and, when asked, the test and lint scripts of package.json. |
159
+ | `rollback-changes` | changes files | Rollback transformations if validation fails or changes are unsatisfactory. |
160
+ | `learn-patterns` | writes data | Discover recurring architectural patterns, anti-patterns and transformation opportunities in a codebase with AST heuristics (RxJS, components, services, transformations, architecture), count their occurrences and store them in a pattern knowledge base that later runs extend. |
161
+ | `get-operation-progress` | read-only | Deprecated, kept in 2.x: polls an operation started with streaming: true (transform-code, scan-architecture). |
162
+ | `check-incremental-compatibility` | read-only | Deprecated, checks nothing: run-build and validate-transformation always run the full build command of the project. |
163
+ | `analyze-build-impact` | read-only | Analyze build impact before transformations. |
164
+ | `validate-project-compatibility` | read-only | Deprecated, checks nothing: the parser strategy it recommended is not applied anywhere. |
165
+ | `collect-feedback` | writes data | Manually collect transformation feedback for AI learning. |
166
+ | `review-feedback` | read-only | Review collected feedback and extract insights for AI learning. |
167
+ | `suggest-improvements` | read-only | Suggest rule adjustments based on feedback analysis. |
168
+ | `analyze-parser-performance` | read-only | Deprecated, removal in 3.0: no MCP tool records parser metadata (collect-feedback and transform-code do not write it), so feedback collected through MCP gives 0 sessions analyzed; use review-feedback for transformation feedback. |
169
+ | `extract-libraries` | read-only | Detect Angular artifacts in shared folders that qualify for extraction into dedicated libraries with secondary entry points. |
170
+ | `parse-stack-trace` | read-only | Parse a Node.js/Angular/Zone.js/browser stack trace into structured frames. |
171
+ | `find-usages` | read-only | Find all references to a symbol (class, method, function, variable, or constant) across a TypeScript project. |
172
+ | `get-call-graph` | read-only | Build a caller/callee graph for a named method, function, constructor, get/set accessor or arrow-function property. |
173
+ | `resolve-type` | read-only | Resolve the TypeScript type at a given position (file, line, column). |
174
+ | `list-imports` | read-only | List the imports (and export-from re-exports) of a file with resolved targets. |
175
+ | `inspect-template` | read-only | Inspect an Angular component template (.html file, or the component .ts for inline templates). |
176
+ | `find-component-hosts` | read-only | Find every component template that uses a component or directive (by className or selector) and report per host: template file, element occurrences with line, which of the target's inputs and outputs are bound or unbound, required inputs that are missing, and bindings no matched project directive declares (native events, library directives, typos). |
177
+ | `trace-output-flow` | read-only | Follow the payload of a component's or directive's @Output across the template boundary, where get-call-graph stops. |
178
+ | `get-bootstrap-execution` | read-only | List what an Angular app executes at startup and whether it touches a given expression. |
179
+ | `inspect-form-group` | read-only | Inspect the Reactive Forms of a component or service file. |
180
+ | `inspect-i18n` | read-only | Translation keys (ngx-translate, transloco) of a project: where a key is defined per language (file, line, value), where it is used (templates: translate pipe/directive, i18n="@@id"; code: TranslateService instant/get/stream, TranslocoService translate/selectTranslate, keys resolved through constants, ternaries and helpers), and which languages lack it. |
181
+ | `find-angular-symbol` | read-only | Find Angular symbols (components, directives, pipes, services, guards, interceptors, resolvers, modules, tokens) by selector, pipe name, or class name. |
182
+ | `search-codebase` | read-only | Search TypeScript source files in a project. |
183
+ | `verify-citations` | read-only | Check the path:line citations of Markdown plans (bug-fix plans, feature plans, investigation reports) against the current code. |
184
+ | `server-status` | read-only | Report on the running MCP server itself: pid, parent pid, uptime, memory (RSS, heap), the ts-morph projects in the shared cache (tsconfig path, source file count, heap taken at load, load and last-use time, source files re-read after a change on disk), the cache limits (projects, heap MB) and evictions (count, last one with reason and heap/RSS before and after), response sizes (count, last, largest, oversized responses replaced by an error), and whether a package dist/ was rebuilt after the server started. |
185
+ | `orchestrate-migration` | changes files | Execute multi-step migration workflows with dependency management and checkpoint/resume. |
186
+ <!-- /facts -->
545
187
 
546
188
  ---
547
189
 
@@ -566,7 +208,7 @@ Cache statistics example (second run, nothing changed):
566
208
 
567
209
  ### Intelligent Mode Selection
568
210
 
569
- > **Deprecated in 1.1:** `parallel` and `incremental` of analyze-project and scan-architecture select the old WorkerPool path, which will be removed in 2.0. On a large app (371 files) it was no faster than the default path (10.8-12.1 vs 10.3-13.1 s), blocked the server for up to 10.7 s and took about four times the memory; before 1.1 the automatic mode selection could fail with `Not implemented yet`. The default path runs the analysis in a scan worker. Leave these options unset; the text below describes the old path.
211
+ > **Deprecated in 1.1:** `parallel` and `incremental` of analyze-project and scan-architecture select the old WorkerPool path, which will be removed in 3.0. On a large app (371 files) it was no faster than the default path (10.8-12.1 vs 10.3-13.1 s), blocked the server for up to 10.7 s and took about four times the memory; before 1.1 the automatic mode selection could fail with `Not implemented yet`. The default path runs the analysis in a scan worker. Leave these options unset; the text below describes the old path.
570
212
 
571
213
  The orchestration system automatically selects between Promise-based and worker thread parallelism based on project complexity score:
572
214
 
@@ -577,11 +219,6 @@ Score 50-75: Worker mode preferred
577
219
  Score 75-100: Worker mode required
578
220
  ```
579
221
 
580
- Performance results (1,500 files, 13 rules):
581
- - Auto-selection: 251.81s
582
- - Forced worker mode: 279.83s
583
- - Auto-selection was 1.14x faster
584
-
585
222
  Memory management:
586
223
  - RAM-aware worker count (2-8 workers, not CPU-based)
587
224
  - Worker recycling at 80% heap threshold
@@ -624,16 +261,20 @@ Example evolution output:
624
261
 
625
262
  Per-tool defaults go under `tools` in `.angular-modernizer.json`; arguments of a call override them. The schema lists
626
263
  the configurable tools (scan-architecture, scan-all, scan-angular, scan-solid, analyze-project, transform-code,
627
- transform-code-batch, run-build, validate-transformation, collect-feedback, review-feedback, suggest-improvements) and
628
- their keys; `orchestration` takes a different set of keys per tool. Other tools, such as learn-patterns, take their
264
+ run-build, validate-transformation, collect-feedback, review-feedback, suggest-improvements,
265
+ analyze-parser-performance) and their keys; `orchestration` takes a different set of keys per tool. A batch
266
+ (transform-code with `files`) reads `tools.transform-code`; `tools.transform-code-batch` is deprecated and has no effect,
267
+ like `transform-code.diffFormat` and `.streaming`, `includeAutoFixes` of scan-architecture, `scope` of scan-all, scan-angular and scan-solid,
268
+ and `orchestration` of the scan tools and analyze-project (only scan-architecture with apiStyle `imperative` reads its
269
+ `orchestration`). Other tools, such as learn-patterns, take their
629
270
  options per call only. analyze-project reads `tools.analyze-project` except `orchestration`: its `parallel` and
630
- `incremental` select the deprecated WorkerPool path, which only the call argument can choose.
271
+ `incremental` select the deprecated WorkerPool path, which only the call argument can choose. A deprecated key that is
272
+ set comes back in `configWarnings` of each answer (see [Protocol](#protocol)).
631
273
 
632
274
  ```json
633
275
  {
634
276
  "build": {
635
- "command": "ng build",
636
- "mode": "incremental"
277
+ "command": "ng build"
637
278
  },
638
279
  "tools": {
639
280
  "analyze-project": {
@@ -641,8 +282,7 @@ options per call only. analyze-project reads `tools.analyze-project` except `orc
641
282
  "maxResults": 1000
642
283
  },
643
284
  "scan-architecture": {
644
- "maxFiles": 500,
645
- "includeAutoFixes": true
285
+ "maxFiles": 500
646
286
  },
647
287
  "review-feedback": {
648
288
  "source": "both",
@@ -673,9 +313,11 @@ Cache locations:
673
313
  - `all` (scan-all): `.angular-modernizer-cache/all/`
674
314
  - `patterns`: `.angular-modernizer-cache/pattern-knowledge.json`
675
315
 
316
+ scan-all, scan-solid and scan-angular keep one entry per analyzed `.ts` file, also when it has no findings, with every finding of that file including those reported on its template; the template files are dependencies, so editing only the template makes the entry stale. Findings come back in file path order, the same cold or warm. The cache version carries a hash of `.angular-modernizer.json` without its `tools` sections (rule options, `parser`, `layers`, `layersSource` and the contents of the `layersSource` module), so a configuration change makes every entry stale. A scan with its own `rules`, `includePatterns` or `excludePatterns` gets a version of its own: findings of rules that read other files depend on which files the scan covers. The cache holds one entry per file, so such a scan replaces the entries of the files it analyzed, and the next scan of the whole project analyzes those files again. A cancelled scan writes no entries.
317
+
676
318
  When to clear cache:
677
319
  - After major codebase changes (framework upgrade, large refactoring)
678
- - When rules are updated
320
+ - After updating Angular Modernizer (new rule code; configuration changes need no clearing)
679
321
  - If cache corruption is suspected
680
322
 
681
323
  ```bash
@@ -684,9 +326,9 @@ rm -rf .angular-modernizer-cache
684
326
 
685
327
  ### Orchestration Tuning
686
328
 
687
- > **Deprecated in 1.1:** `parallel` and `incremental` of analyze-project and scan-architecture select the old WorkerPool path, which will be removed in 2.0. On a large app (371 files) it was no faster than the default path (10.8-12.1 vs 10.3-13.1 s), blocked the server for up to 10.7 s and took about four times the memory; before 1.1 the automatic mode selection could fail with `Not implemented yet`. The default path runs the analysis in a scan worker. Leave these options unset; the text below describes the old path.
329
+ > **Deprecated in 1.1:** `parallel` and `incremental` of analyze-project and scan-architecture select the old WorkerPool path, which will be removed in 3.0. On a large app (371 files) it was no faster than the default path (10.8-12.1 vs 10.3-13.1 s), blocked the server for up to 10.7 s and took about four times the memory; before 1.1 the automatic mode selection could fail with `Not implemented yet`. The default path runs the analysis in a scan worker. Leave these options unset; the text below describes the old path.
688
330
 
689
- For large projects (500+ files), in `tools.scan-architecture` (or per call as the `orchestration` argument):
331
+ For large projects (500+ files), in `tools.scan-architecture` (or per call as the `orchestration` argument); scan-architecture reads it only with `apiStyle: 'imperative'` and rejects the argument on its default fluent path:
690
332
 
691
333
  ```json
692
334
  {
@@ -767,10 +409,7 @@ scan-angular # Writes: .cache/angular/
767
409
  scan-all # Writes and reads: .cache/all/
768
410
  ```
769
411
 
770
- Second run performance:
771
- - architecture: 202.8s to 5.2s (39x speedup)
772
- - solid: 85.3s to 5.7s (14.9x speedup)
773
- - angular: 65.2s to 43.5s (1.5x speedup)
412
+ A second run over unchanged files reads the tool's cache and is much faster than the first.
774
413
 
775
414
  ### Safety Guidelines
776
415
 
@@ -802,10 +441,10 @@ Long-running tools report progress through MCP `notifications/progress` when the
802
441
 
803
442
  | Tool | Progress | On cancel |
804
443
  |-|-|-|
805
- | scan-architecture, scan-all, scan-solid, scan-angular, analyze-project | files (`n/N files, v violations`); worker paths of analyze-project forward the kernel progress, batched scan-architecture reports per batch | stops between files |
444
+ | scan-architecture, scan-all, scan-solid, scan-angular, analyze-project | files (`n/N files, v violations`), ending with `total/total` (also when files could not be loaded or all came from the scan cache; the message names the files not analyzed); worker paths of analyze-project forward the kernel progress, batched scan-architecture reports per batch | stops between files |
806
445
  | compare-health | through scan-all | no comparison, snapshot not written |
807
446
  | transform-code | single file: 3 steps (loaded, transformed, validated); batch: files | restores the backup (also with `autoRollback: false`); a batch restores every file |
808
- | run-build, run-angular-cli, run-schematic, validate-transformation | none | ends the build with its process tree (SIGTERM, SIGKILL after 5 s) |
447
+ | run-build, run-angular-cli, run-schematic, validate-transformation | none | ends the build with its process tree (POSIX: SIGTERM to the process group, SIGKILL after 5 s; Windows: `taskkill /T /F`) |
809
448
  | orchestrate-migration | steps | passes the cancel to the running step, runs no further step |
810
449
  | find-usages, get-call-graph, resolve-type, find-angular-symbol, search-codebase, list-imports, inspect-template, find-component-hosts, trace-output-flow, get-bootstrap-execution, inspect-form-group, inspect-i18n, analyze-build-impact, plan-migration | first call on a workspace: files loaded (`n/N files loaded`, per batch of 50) | stops the project load at the next batch, nothing is cached; program and checker build and the query are not interrupted |
811
450
 
@@ -813,7 +452,7 @@ A cancelled request gets no response (MCP spec). Scans also stop while they add
813
452
 
814
453
  ### Streaming (deprecated)
815
454
 
816
- `streaming: true` (transform-code, scan-architecture) and `get-operation-progress` stay in 1.x but are deprecated; `streaming` defaults to `false`. With `streaming: true` the call returns an `operationId` at once and runs in the background: transform-code runs its regular path (same backup, validation and rollback) and emits no events, scan-architecture emits phase events (0, 10, 20, 30 %, every 10 files up to 90 %, 100 % on completion). `get-operation-progress` returns `status`, the events and, once completed, the tool result in `result`. Operations expire 5 minutes after they end (10 minutes when stuck running). There is no way to cancel a streaming operation over MCP; call the tools synchronously instead.
455
+ `streaming: true` (transform-code, scan-architecture) and `get-operation-progress` stay in 2.x but are deprecated; `streaming` defaults to `false`. With `streaming: true` the call returns an `operationId` at once and runs in the background: transform-code runs its regular path (same backup, validation and rollback) and emits no events, scan-architecture emits phase events (0, 10, 20, 30 %, every 10 files up to 90 %, 100 % on completion). `get-operation-progress` returns `status`, the events and, once completed, the tool result in `result`. Operations expire 5 minutes after they end; one still running 10 minutes after its start is marked `failed` ("Operation timed out") and expires 5 minutes later. There is no way to cancel a streaming operation over MCP; call the tools synchronously instead. A streaming scan-architecture runs on the server's main thread, not in the scan worker: until it ends the server answers no request, so a get-operation-progress poll waits and on a large scope only sees the operation completed.
817
456
 
818
457
  ---
819
458
 
@@ -898,7 +537,7 @@ Memory calculation:
898
537
 
899
538
  ## Links
900
539
 
901
- - Tools Reference: `src/tools/README.md`
540
+ - Tools: [Available Tools](#available-tools) and the schemas each tool returns over `tools/list`
902
541
  - MCP Protocol: https://modelcontextprotocol.io/
903
542
 
904
543
  ---