@angular-modernizer/adapter-mcp 0.3.0 → 1.0.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 (275) hide show
  1. package/README.md +103 -218
  2. package/dist/cli.js +13 -13
  3. package/dist/index.d.ts +4 -3
  4. package/dist/index.js +3 -2
  5. package/dist/mcp-watcher.d.ts +6 -1
  6. package/dist/mcp-watcher.js +11 -10
  7. package/dist/server/limited-stdio-transport.d.ts +68 -0
  8. package/dist/server/limited-stdio-transport.js +115 -0
  9. package/dist/server/mcp-server.d.ts +12 -14
  10. package/dist/server/mcp-server.js +41 -75
  11. package/dist/server/package-version.d.ts +16 -0
  12. package/dist/server/package-version.js +37 -0
  13. package/dist/server/sdk-server.d.ts +70 -0
  14. package/dist/server/sdk-server.js +113 -0
  15. package/dist/server/tool-registry.d.ts +3 -2
  16. package/dist/server/tool-registry.js +5 -5
  17. package/dist/tools/analyze-build-impact.d.ts +220 -1
  18. package/dist/tools/analyze-build-impact.js +145 -3
  19. package/dist/tools/analyze-core-to-shared.d.ts +134 -4
  20. package/dist/tools/analyze-core-to-shared.js +113 -9
  21. package/dist/tools/analyze-parser-performance.d.ts +200 -7
  22. package/dist/tools/analyze-parser-performance.js +108 -47
  23. package/dist/tools/analyze-project.d.ts +267 -5
  24. package/dist/tools/analyze-project.js +196 -8
  25. package/dist/tools/check-incremental-compatibility.d.ts +61 -1
  26. package/dist/tools/check-incremental-compatibility.js +58 -2
  27. package/dist/tools/collect-feedback.d.ts +199 -10
  28. package/dist/tools/collect-feedback.js +171 -99
  29. package/dist/tools/compare-health.d.ts +356 -0
  30. package/dist/tools/compare-health.js +472 -0
  31. package/dist/tools/extract-libraries.d.ts +156 -4
  32. package/dist/tools/extract-libraries.js +115 -10
  33. package/dist/tools/find-angular-symbol.d.ts +69 -3
  34. package/dist/tools/find-angular-symbol.js +55 -8
  35. package/dist/tools/find-component-hosts.d.ts +572 -2
  36. package/dist/tools/find-component-hosts.js +207 -6
  37. package/dist/tools/find-usages.d.ts +79 -1
  38. package/dist/tools/find-usages.js +64 -7
  39. package/dist/tools/get-bootstrap-execution.d.ts +151 -1
  40. package/dist/tools/get-bootstrap-execution.js +84 -3
  41. package/dist/tools/get-call-graph.d.ts +111 -1
  42. package/dist/tools/get-call-graph.js +72 -10
  43. package/dist/tools/get-operation-progress-tool.d.ts +114 -2
  44. package/dist/tools/get-operation-progress-tool.js +114 -7
  45. package/dist/tools/get-operation-progress.d.ts +1 -1
  46. package/dist/tools/get-operation-progress.js +5 -5
  47. package/dist/tools/helpers/analysis-output.d.ts +177 -0
  48. package/dist/tools/helpers/analysis-output.js +165 -0
  49. package/dist/tools/helpers/build-schemas.d.ts +36 -0
  50. package/dist/tools/helpers/build-schemas.js +23 -0
  51. package/dist/tools/helpers/citation-file-source.d.ts +10 -0
  52. package/dist/tools/helpers/citation-file-source.js +82 -0
  53. package/dist/tools/helpers/finding-window.d.ts +43 -0
  54. package/dist/tools/helpers/finding-window.js +64 -0
  55. package/dist/tools/helpers/health-delta.d.ts +86 -0
  56. package/dist/tools/helpers/health-delta.js +239 -0
  57. package/dist/tools/helpers/investigation-schemas.d.ts +93 -0
  58. package/dist/tools/helpers/investigation-schemas.js +48 -0
  59. package/dist/tools/helpers/library-imports.d.ts +57 -0
  60. package/dist/tools/helpers/library-imports.js +151 -0
  61. package/dist/tools/helpers/load-source-files.d.ts +30 -0
  62. package/dist/tools/helpers/load-source-files.js +34 -0
  63. package/dist/tools/helpers/output-contract.d.ts +32 -0
  64. package/dist/tools/helpers/output-contract.js +32 -0
  65. package/dist/tools/helpers/platform-root-resolver.d.ts +55 -25
  66. package/dist/tools/helpers/platform-root-resolver.js +75 -48
  67. package/dist/tools/helpers/process-output.d.ts +19 -0
  68. package/dist/tools/helpers/process-output.js +31 -0
  69. package/dist/tools/helpers/project-cache.d.ts +11 -4
  70. package/dist/tools/helpers/project-cache.js +22 -4
  71. package/dist/tools/helpers/project-decorators.d.ts +14 -0
  72. package/dist/tools/helpers/project-decorators.js +22 -0
  73. package/dist/tools/helpers/rule-matcher.js +5 -0
  74. package/dist/tools/helpers/rule-runner.d.ts +9 -4
  75. package/dist/tools/helpers/rule-runner.js +28 -14
  76. package/dist/tools/helpers/scan-cache.d.ts +22 -0
  77. package/dist/tools/helpers/scan-cache.js +34 -0
  78. package/dist/tools/helpers/scan-plan.d.ts +5 -2
  79. package/dist/tools/helpers/scan-plan.js +18 -3
  80. package/dist/tools/helpers/scope-paths.d.ts +17 -0
  81. package/dist/tools/helpers/scope-paths.js +32 -0
  82. package/dist/tools/helpers/tool-context.d.ts +60 -0
  83. package/dist/tools/helpers/tool-context.js +82 -0
  84. package/dist/tools/helpers/transform-safety.d.ts +40 -0
  85. package/dist/tools/helpers/transform-safety.js +87 -0
  86. package/dist/tools/helpers/validation-output.d.ts +53 -0
  87. package/dist/tools/helpers/validation-output.js +48 -0
  88. package/dist/tools/inspect-form-group.d.ts +232 -1
  89. package/dist/tools/inspect-form-group.js +120 -2
  90. package/dist/tools/inspect-i18n.d.ts +382 -1
  91. package/dist/tools/inspect-i18n.js +199 -2
  92. package/dist/tools/inspect-template.d.ts +232 -1
  93. package/dist/tools/inspect-template.js +160 -2
  94. package/dist/tools/learn-patterns.d.ts +122 -1
  95. package/dist/tools/learn-patterns.js +97 -2
  96. package/dist/tools/list-imports.d.ts +111 -10
  97. package/dist/tools/list-imports.js +110 -7
  98. package/dist/tools/orchestrate-migration.d.ts +128 -5
  99. package/dist/tools/orchestrate-migration.js +135 -13
  100. package/dist/tools/parse-stack-trace.d.ts +56 -1
  101. package/dist/tools/parse-stack-trace.js +34 -0
  102. package/dist/tools/plan-migration.d.ts +330 -1
  103. package/dist/tools/plan-migration.js +154 -3
  104. package/dist/tools/resolve-type.d.ts +39 -1
  105. package/dist/tools/resolve-type.js +31 -2
  106. package/dist/tools/review-feedback.d.ts +206 -11
  107. package/dist/tools/review-feedback.js +132 -51
  108. package/dist/tools/rollback-changes.d.ts +79 -2
  109. package/dist/tools/rollback-changes.js +66 -14
  110. package/dist/tools/run-angular-cli.d.ts +45 -2
  111. package/dist/tools/run-angular-cli.js +67 -7
  112. package/dist/tools/run-build.d.ts +114 -2
  113. package/dist/tools/run-build.js +117 -8
  114. package/dist/tools/run-schematic.d.ts +70 -2
  115. package/dist/tools/run-schematic.js +104 -10
  116. package/dist/tools/scan-all.d.ts +19 -11
  117. package/dist/tools/scan-all.js +139 -131
  118. package/dist/tools/scan-angular.d.ts +19 -10
  119. package/dist/tools/scan-angular.js +51 -23
  120. package/dist/tools/scan-architecture.d.ts +17 -10
  121. package/dist/tools/scan-architecture.js +93 -31
  122. package/dist/tools/scan-solid.d.ts +19 -10
  123. package/dist/tools/scan-solid.js +51 -23
  124. package/dist/tools/search-codebase.d.ts +82 -1
  125. package/dist/tools/search-codebase.js +55 -2
  126. package/dist/tools/server-status.d.ts +279 -5
  127. package/dist/tools/server-status.js +179 -5
  128. package/dist/tools/suggest-improvements.d.ts +97 -5
  129. package/dist/tools/suggest-improvements.js +80 -44
  130. package/dist/tools/trace-output-flow.d.ts +682 -2
  131. package/dist/tools/trace-output-flow.js +375 -15
  132. package/dist/tools/transform-code-batch.d.ts +3 -0
  133. package/dist/tools/transform-code-batch.js +10 -5
  134. package/dist/tools/transform-code.d.ts +335 -12
  135. package/dist/tools/transform-code.js +649 -608
  136. package/dist/tools/validate-before-transform.d.ts +116 -2
  137. package/dist/tools/validate-before-transform.js +55 -2
  138. package/dist/tools/validate-project-compatibility.d.ts +64 -2
  139. package/dist/tools/validate-project-compatibility.js +67 -4
  140. package/dist/tools/validate-transformation.d.ts +220 -2
  141. package/dist/tools/validate-transformation.js +113 -15
  142. package/dist/tools/verify-citations.d.ts +181 -0
  143. package/dist/tools/verify-citations.js +218 -0
  144. package/dist/types.d.ts +38 -1
  145. package/dist/utils/format-tool-response.d.ts +22 -59
  146. package/dist/utils/format-tool-response.js +25 -134
  147. package/package.json +30 -13
  148. package/dist/cli.d.ts.map +0 -1
  149. package/dist/cli.js.map +0 -1
  150. package/dist/core/project-analyzer.d.ts.map +0 -1
  151. package/dist/core/project-analyzer.js.map +0 -1
  152. package/dist/index.d.ts.map +0 -1
  153. package/dist/index.js.map +0 -1
  154. package/dist/mcp-watcher.d.ts.map +0 -1
  155. package/dist/mcp-watcher.js.map +0 -1
  156. package/dist/server/json-rpc-handler.d.ts +0 -98
  157. package/dist/server/json-rpc-handler.d.ts.map +0 -1
  158. package/dist/server/json-rpc-handler.js +0 -301
  159. package/dist/server/json-rpc-handler.js.map +0 -1
  160. package/dist/server/mcp-server.d.ts.map +0 -1
  161. package/dist/server/mcp-server.js.map +0 -1
  162. package/dist/server/stdio-guard.d.ts.map +0 -1
  163. package/dist/server/stdio-guard.js.map +0 -1
  164. package/dist/server/tool-registry.d.ts.map +0 -1
  165. package/dist/server/tool-registry.js.map +0 -1
  166. package/dist/streaming/progress-store.d.ts.map +0 -1
  167. package/dist/streaming/progress-store.js.map +0 -1
  168. package/dist/tools/analyze-build-impact.d.ts.map +0 -1
  169. package/dist/tools/analyze-build-impact.js.map +0 -1
  170. package/dist/tools/analyze-core-to-shared.d.ts.map +0 -1
  171. package/dist/tools/analyze-core-to-shared.js.map +0 -1
  172. package/dist/tools/analyze-parser-performance.d.ts.map +0 -1
  173. package/dist/tools/analyze-parser-performance.js.map +0 -1
  174. package/dist/tools/analyze-project.d.ts.map +0 -1
  175. package/dist/tools/analyze-project.js.map +0 -1
  176. package/dist/tools/check-incremental-compatibility.d.ts.map +0 -1
  177. package/dist/tools/check-incremental-compatibility.js.map +0 -1
  178. package/dist/tools/collect-feedback.d.ts.map +0 -1
  179. package/dist/tools/collect-feedback.js.map +0 -1
  180. package/dist/tools/extract-libraries.d.ts.map +0 -1
  181. package/dist/tools/extract-libraries.js.map +0 -1
  182. package/dist/tools/find-angular-symbol.d.ts.map +0 -1
  183. package/dist/tools/find-angular-symbol.js.map +0 -1
  184. package/dist/tools/find-component-hosts.d.ts.map +0 -1
  185. package/dist/tools/find-component-hosts.js.map +0 -1
  186. package/dist/tools/find-usages.d.ts.map +0 -1
  187. package/dist/tools/find-usages.js.map +0 -1
  188. package/dist/tools/get-bootstrap-execution.d.ts.map +0 -1
  189. package/dist/tools/get-bootstrap-execution.js.map +0 -1
  190. package/dist/tools/get-call-graph.d.ts.map +0 -1
  191. package/dist/tools/get-call-graph.js.map +0 -1
  192. package/dist/tools/get-operation-progress-tool.d.ts.map +0 -1
  193. package/dist/tools/get-operation-progress-tool.js.map +0 -1
  194. package/dist/tools/get-operation-progress.d.ts.map +0 -1
  195. package/dist/tools/get-operation-progress.js.map +0 -1
  196. package/dist/tools/helpers/compact-output.d.ts.map +0 -1
  197. package/dist/tools/helpers/compact-output.js.map +0 -1
  198. package/dist/tools/helpers/feedback-analyzer.d.ts.map +0 -1
  199. package/dist/tools/helpers/feedback-analyzer.js.map +0 -1
  200. package/dist/tools/helpers/find-ts-config.d.ts.map +0 -1
  201. package/dist/tools/helpers/find-ts-config.js.map +0 -1
  202. package/dist/tools/helpers/platform-root-resolver.d.ts.map +0 -1
  203. package/dist/tools/helpers/platform-root-resolver.js.map +0 -1
  204. package/dist/tools/helpers/project-cache.d.ts.map +0 -1
  205. package/dist/tools/helpers/project-cache.js.map +0 -1
  206. package/dist/tools/helpers/rule-matcher.d.ts.map +0 -1
  207. package/dist/tools/helpers/rule-matcher.js.map +0 -1
  208. package/dist/tools/helpers/rule-runner.d.ts.map +0 -1
  209. package/dist/tools/helpers/rule-runner.js.map +0 -1
  210. package/dist/tools/helpers/scan-plan.d.ts.map +0 -1
  211. package/dist/tools/helpers/scan-plan.js.map +0 -1
  212. package/dist/tools/helpers/stack-frame-file-index.d.ts.map +0 -1
  213. package/dist/tools/helpers/stack-frame-file-index.js.map +0 -1
  214. package/dist/tools/helpers/suggestion-generator.d.ts.map +0 -1
  215. package/dist/tools/helpers/suggestion-generator.js.map +0 -1
  216. package/dist/tools/inspect-form-group.d.ts.map +0 -1
  217. package/dist/tools/inspect-form-group.js.map +0 -1
  218. package/dist/tools/inspect-i18n.d.ts.map +0 -1
  219. package/dist/tools/inspect-i18n.js.map +0 -1
  220. package/dist/tools/inspect-template.d.ts.map +0 -1
  221. package/dist/tools/inspect-template.js.map +0 -1
  222. package/dist/tools/learn-patterns.d.ts.map +0 -1
  223. package/dist/tools/learn-patterns.js.map +0 -1
  224. package/dist/tools/list-imports.d.ts.map +0 -1
  225. package/dist/tools/list-imports.js.map +0 -1
  226. package/dist/tools/orchestrate-migration.d.ts.map +0 -1
  227. package/dist/tools/orchestrate-migration.js.map +0 -1
  228. package/dist/tools/parse-stack-trace.d.ts.map +0 -1
  229. package/dist/tools/parse-stack-trace.js.map +0 -1
  230. package/dist/tools/plan-migration.d.ts.map +0 -1
  231. package/dist/tools/plan-migration.js.map +0 -1
  232. package/dist/tools/resolve-type.d.ts.map +0 -1
  233. package/dist/tools/resolve-type.js.map +0 -1
  234. package/dist/tools/review-feedback.d.ts.map +0 -1
  235. package/dist/tools/review-feedback.js.map +0 -1
  236. package/dist/tools/rollback-changes.d.ts.map +0 -1
  237. package/dist/tools/rollback-changes.js.map +0 -1
  238. package/dist/tools/run-angular-cli.d.ts.map +0 -1
  239. package/dist/tools/run-angular-cli.js.map +0 -1
  240. package/dist/tools/run-build.d.ts.map +0 -1
  241. package/dist/tools/run-build.js.map +0 -1
  242. package/dist/tools/run-schematic.d.ts.map +0 -1
  243. package/dist/tools/run-schematic.js.map +0 -1
  244. package/dist/tools/scan-all.d.ts.map +0 -1
  245. package/dist/tools/scan-all.js.map +0 -1
  246. package/dist/tools/scan-angular.d.ts.map +0 -1
  247. package/dist/tools/scan-angular.js.map +0 -1
  248. package/dist/tools/scan-architecture.d.ts.map +0 -1
  249. package/dist/tools/scan-architecture.js.map +0 -1
  250. package/dist/tools/scan-solid.d.ts.map +0 -1
  251. package/dist/tools/scan-solid.js.map +0 -1
  252. package/dist/tools/search-codebase.d.ts.map +0 -1
  253. package/dist/tools/search-codebase.js.map +0 -1
  254. package/dist/tools/server-status.d.ts.map +0 -1
  255. package/dist/tools/server-status.js.map +0 -1
  256. package/dist/tools/shared/scan-types.d.ts.map +0 -1
  257. package/dist/tools/shared/scan-types.js.map +0 -1
  258. package/dist/tools/suggest-improvements.d.ts.map +0 -1
  259. package/dist/tools/suggest-improvements.js.map +0 -1
  260. package/dist/tools/trace-output-flow.d.ts.map +0 -1
  261. package/dist/tools/trace-output-flow.js.map +0 -1
  262. package/dist/tools/transform-code-batch.d.ts.map +0 -1
  263. package/dist/tools/transform-code-batch.js.map +0 -1
  264. package/dist/tools/transform-code.d.ts.map +0 -1
  265. package/dist/tools/transform-code.js.map +0 -1
  266. package/dist/tools/validate-before-transform.d.ts.map +0 -1
  267. package/dist/tools/validate-before-transform.js.map +0 -1
  268. package/dist/tools/validate-project-compatibility.d.ts.map +0 -1
  269. package/dist/tools/validate-project-compatibility.js.map +0 -1
  270. package/dist/tools/validate-transformation.d.ts.map +0 -1
  271. package/dist/tools/validate-transformation.js.map +0 -1
  272. package/dist/types.d.ts.map +0 -1
  273. package/dist/types.js.map +0 -1
  274. package/dist/utils/format-tool-response.d.ts.map +0 -1
  275. package/dist/utils/format-tool-response.js.map +0 -1
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 39 structured tools for AI assistants.
3
+ MCP server that exposes Angular Modernizer capabilities as 41 structured tools for AI assistants.
4
4
 
5
5
  ---
6
6
 
@@ -20,7 +20,7 @@ AI Assistant (Claude/Copilot)
20
20
  | JSON-RPC 2.0 (stdio)
21
21
  v
22
22
  MCP Server (adapter-mcp)
23
- - 39 Tools (analysis, planning, transformation,
23
+ - 41 Tools (analysis, planning, transformation,
24
24
  build and validation, feedback, bug investigation)
25
25
  - Shared ts-morph ProjectCache
26
26
  - Real-time Progress Monitoring
@@ -34,7 +34,7 @@ Core Platform (Kernel + Plugins)
34
34
  - Architecture: 17 rules
35
35
  - Angular: 28 rules
36
36
  - SOLID: 7 rules
37
- - Transformations (19 types via transform-code)
37
+ - Transformations (26 types via transform-code)
38
38
  - Caching
39
39
  - Orchestration
40
40
  |
@@ -46,6 +46,16 @@ TypeScript Project
46
46
  - Semantic Analysis
47
47
  ```
48
48
 
49
+ ### Protocol
50
+
51
+ The server runs on the official MCP TypeScript SDK (`@modelcontextprotocol/server`) over stdio and serves both protocol eras on one connection type: clients that open with `initialize` get the revision they ask for (2025-06-18, 2025-11-25), clients that open with `server/discover` get 2026-07-28. Tool results are identical in both eras. Only the `tools` capability is announced. A response above 4 MB is replaced by an error result that names the tool and how to narrow the request.
52
+
53
+ Arguments are validated against each tool's input schema (JSON Schema 2020-12) before the tool runs. Wrong types, missing required arguments and unknown argument names come back as an error result (`isError: true`) naming the offending argument. A tool that reports a failure in its result (`success: false` or `status: "failed"`, e.g. a build that exits with an error) also answers with `isError: true`; the result details stay in `structuredContent`.
54
+
55
+ 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.
56
+
57
+ 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.
58
+
49
59
  ---
50
60
 
51
61
  ## Quick Start
@@ -125,11 +135,14 @@ after a rebuild; reconnect, or check `server-status` (`build.rebuiltSinceStart`)
125
135
  | scan-solid | SOLID principle violations | 7 | yes | 3-15s |
126
136
  | scan-angular | Angular best practices | 28 | yes | 5-20s |
127
137
  | scan-all | Combined analysis (all plugins) | 52 | yes | 10-45s |
138
+ | 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 |
128
139
  | analyze-core-to-shared | Dependency violation analysis | - | yes | 3-10s |
129
140
  | analyze-parser-performance | Parser metrics from feedback sessions | - | no | varies |
130
141
  | extract-libraries | Library extraction candidates (shared folders, secondary entry points) | - | no | varies |
131
142
  | learn-patterns | ML-based pattern discovery | - | yes | 10-60s |
132
143
 
144
+ 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.
145
+
133
146
  #### analyze-project
134
147
 
135
148
  Detects framework (Angular CLI, Nx), analyzes architecture patterns, identifies layers, and discovers project structure including PWA/offline capabilities.
@@ -150,8 +163,8 @@ Key features:
150
163
  - Up to 39x speedup with caching (202.8s to 5.2s measured)
151
164
  - Parallel execution with auto-selection
152
165
  - 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.
153
- - Pagination: `maxResults` (default 1000) and `resultOffset` page the violations; `summary` counts 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.
154
- - `streaming` defaults to `true`: the call returns an `operationId`; poll `get-operation-progress` for the result, or pass `streaming: false`.
166
+ - 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.
167
+ - 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.
155
168
 
156
169
  #### scan-solid
157
170
 
@@ -176,14 +189,24 @@ Key features:
176
189
 
177
190
  #### scan-all
178
191
 
179
- Runs all 52 analysis rules (17 architecture + 7 SOLID + 28 Angular) with cross-cache reading for maximum efficiency.
192
+ Runs all 52 analysis rules (17 architecture + 7 SOLID + 28 Angular) with its own cache in `.angular-modernizer-cache/all/`.
180
193
 
181
194
  Key features:
182
195
  - Combines all plugin rules in single scan
183
- - Reads from fallback caches (architecture/solid/angular)
184
- - Up to 57% faster when individual scans run first
196
+ - Caches every analyzed file, also without findings, with its template findings and the template as dependency
197
+ - Reads and writes only its own cache; the caches of scan-architecture, scan-solid and scan-angular are not read
185
198
  - Comprehensive analysis in one execution
186
199
 
200
+ #### compare-health
201
+
202
+ 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.
203
+
204
+ Key features:
205
+ - Snapshot in `.angular-modernizer-cache/health/last-run.json` (`snapshotPath` overrides), git-ignored with the cache
206
+ - Violations match by rule, file and message with digits ignored, so moved lines stay unchanged
207
+ - `totals`, `byRule`, `byFile`, `newViolations`, `fixedViolations`, `rulesAdded`; `summaryOnly` and `maxResults` as in the investigation tools
208
+ - 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
209
+
187
210
  #### analyze-core-to-shared
188
211
 
189
212
  Detects when the core layer imports from the shared layer (architectural anti-pattern) with reverse dependency impact assessment.
@@ -210,7 +233,7 @@ Manually collect transformation feedback for AI learning with privacy-first desi
210
233
 
211
234
  Key features:
212
235
  - Privacy-first: hashed file paths, no code snippets, bucketed metrics
213
- - Dual-location storage (project + platform root)
236
+ - Stored in `<projectRoot>/.claude-feedback`; a second, platform-wide store only when `ANGULAR_MODERNIZER_PLATFORM_ROOT` is set
214
237
  - Automated validation (6 checks) and quality scoring
215
238
  - Outlier detection (4 types) for anomaly handling
216
239
  - Learning extraction from transformation outcomes
@@ -238,6 +261,8 @@ Usage:
238
261
  }
239
262
  ```
240
263
 
264
+ 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).
265
+
241
266
  Returns:
242
267
  - `feedbackId`: unique identifier for this feedback
243
268
  - `sessionId`: session this feedback belongs to
@@ -273,7 +298,7 @@ Returns `kind`, `sessionId`, `stored`, `storageLocations` and per-record `record
273
298
  Review collected feedback and extract actionable insights for AI learning.
274
299
 
275
300
  Key features:
276
- - Reads from both project and platform locations (dual-source)
301
+ - Reads `<projectRoot>/.claude-feedback`, plus the platform store when `ANGULAR_MODERNIZER_PLATFORM_ROOT` is set (`sourcesRead` lists the folders)
277
302
  - Pattern detection: success patterns (>=3 occurrences, >=80% success rate)
278
303
  - Failure patterns (>=2 occurrences) for early warning
279
304
  - Quality trend analysis (improved/degraded/unchanged)
@@ -367,12 +392,14 @@ Key features:
367
392
  - Team context integration (velocity, experience, availability)
368
393
  - Multi-phase roadmap generation (strategy templates when no file paths are given, `planSource: "template"`)
369
394
  - Identifies style-conflicting steps
395
+ - `summary` names strategy, roadmap and scan plan as text; the scan-based plan adds `warnings` when library imports do not resolve
396
+ - `scanResultFile` also accepts a saved MCP result (`structuredContent` of scan-architecture or scan-all)
370
397
 
371
398
  ### Transformation Tools
372
399
 
373
400
  | Tool | Purpose | Cache | Time |
374
401
  |-|-|-|-|
375
- | transform-code | 19 transformation types | no | varies |
402
+ | transform-code | 26 transformation types | no | varies |
376
403
  | run-schematic | Angular schematic execution | no | varies |
377
404
  | run-angular-cli | CLI command execution | no | varies |
378
405
  | run-build | Multi-build system support | no | varies |
@@ -381,7 +408,7 @@ Key features:
381
408
 
382
409
  Applies surgical code transformations with pre-validation, backup, build validation, and automatic rollback.
383
410
 
384
- 19 transformation types:
411
+ 26 transformation types:
385
412
  1. constructor-to-inject
386
413
  2. interface-extraction
387
414
  3. standalone-migration
@@ -401,23 +428,34 @@ Applies surgical code transformations with pre-validation, backup, build validat
401
428
  17. subscription-transform
402
429
  18. missing-output-transform
403
430
  19. library-extraction
404
-
405
- Safety features:
406
- - Pre-transformation validation (syntax, types, schema)
407
- - Automatic file backup before changes
408
- - Build validation (ensures code compiles)
409
- - Auto-rollback on build failure (prevents broken code)
410
- - Post-transformation validation (lint, tests)
411
- - Batch mode with all-or-nothing strategy
412
-
413
- Build validation parameters:
414
- - `validateBuild: boolean` - run build after transformation (default: true)
415
- - `rollbackOnBuildFailure: boolean` - auto-rollback on build errors (default: true)
431
+ 20. service-bag-transform
432
+ 21. any-to-interface
433
+ 22. dto-object-literal
434
+ 23. interface-duplication
435
+ 24. static-class-to-functions
436
+ 25. extract-static-from-stateful
437
+ 26. type-safety
438
+
439
+ 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.
440
+
441
+ Safety features (single file, batch and streaming alike):
442
+ - Pre-transformation validation (syntax, types, schema) on the same kernel load as the transformation
443
+ - 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`)
444
+ - Type check of the transformed file: only errors the transformation introduced count (`validation.introducedTypeErrors`)
445
+ - Build validation (`validateBuild`), project lint only on request (`validateLint`)
446
+ - Automatic rollback when validation fails (`autoRollback`)
447
+ - Batch mode backs up all files first and applies `rollbackStrategy` (`all-or-nothing`, `selective`, `none`)
448
+ - `rollback-changes` restores the same backups later (`strategy`: `auto`, `file-backup`, `git-stash`)
449
+
450
+ Validation parameters:
451
+ - `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
452
+ - `validateLint: boolean` - run the project's lint script (default: false; it lints the whole project)
416
453
  - `buildTimeout: number` - build timeout in ms (default: 300000 = 5 min)
417
- - `projectRoot: string` - project root for build execution
454
+ - `projectRoot: string` - project root for backups and build execution
418
455
 
419
- Diff format parameters:
420
- - `diffFormat: 'unified' | 'structured' | 'both'` - diff output format in streaming mode (default: 'structured')
456
+ 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).
457
+
458
+ 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.
421
459
  - `unified`: traditional git-style diff (human-readable, backward compatible)
422
460
  - `structured`: machine-first JSON diff with semantic annotations (AI-optimized)
423
461
  - `both`: include both formats (useful for debugging, higher overhead)
@@ -441,7 +479,7 @@ Supported build systems: Angular CLI, Nx, Vite, Webpack, npm
441
479
  | check-incremental-compatibility | Whether a project supports incremental build validation | no | varies |
442
480
  | validate-project-compatibility | Parser compatibility before transformations | no | varies |
443
481
  | analyze-build-impact | Changed files -> value, type-only and template dependents, affected modules, strategy | ProjectCache | ~1s warm |
444
- | get-operation-progress | Progress and result of a streaming operation | no | <1s |
482
+ | get-operation-progress | Deprecated: progress and result of a streaming operation | no | <1s |
445
483
 
446
484
  #### analyze-build-impact
447
485
 
@@ -452,68 +490,60 @@ names they re-export; past the first importer only exports whose type surface (a
452
490
  `@NgModule` exports) names a changed binding propagate, so using a class inside a method body or a decorator stops
453
491
  there. `symbols` narrows the impact to consumers of given exports (`symbolImpacts`). `.html` files map
454
492
  to their component (`mappedFiles`), which counts as changed without its dependents. `summaryOnly` / `maxResults`
455
- shorten the lists; `counts` always describe the full result.
493
+ shorten the lists; `counts` always describe the full result. `summary` repeats the recommendation and the counts as
494
+ text; `warnings` reports library imports that do not resolve, dependents can then be missing.
456
495
 
457
496
  ### Bug Investigation Tools
458
497
 
459
498
  Read-only tools over the shared ProjectCache: a workspace is parsed once per server and re-read per changed file.
460
- All list-heavy tools take `summaryOnly` and `maxResults`.
499
+ All list-heavy tools take `summaryOnly` and `maxResults`. All answer with `structuredContent` and a `summary` string.
500
+ When packages declared in the project's `package.json` do not resolve (no or incomplete `node_modules`), the tools that
501
+ load the program add `warnings` with the number of unresolved library imports: library types are then `any` and hosts,
502
+ callers and handlers can be missing from the result. The check runs once per loaded project (about 50 ms on 4000 files).
461
503
 
462
504
  | Tool | Answers |
463
505
  |-|-|
464
506
  | parse-stack-trace | Structured frames from Node.js / Angular / Zone.js / browser stacks, browser URLs and bare file names mapped onto project files |
465
507
  | find-usages | Every reference to a symbol, classified (declaration, read, write, call, template, unresolved) |
466
- | get-call-graph | Callers and callees of a method or function, incl. template callers; `maxNodes` caps the tree |
508
+ | get-call-graph | Callers and callees of a method or function, incl. template callers (own and inheriting subclass templates); `maxNodes` caps the tree |
467
509
  | resolve-type | TypeScript type at file:line:col (nullable, async, generics, declaration) |
468
510
  | find-angular-symbol | Components, directives, pipes, services, ... by selector, pipe name or class, incl. library classes from `.d.ts` |
469
511
  | search-codebase | Text, regex or declaration search, incl. `.html` and files outside the program |
470
- | list-imports | Imports and re-exports of a file with resolved targets (aliases, barrels) |
512
+ | list-imports | Imports and re-exports of a file with resolved targets (aliases, barrels); `counts` per kind |
471
513
  | inspect-template | Template structure: elements, bindings, matched components/directives/pipes, control flow, i18n keys |
472
514
  | 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) |
473
- | trace-output-flow | Payload of an `@Output` across the template boundary, and dialog data in / results out |
515
+ | 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 |
474
516
  | get-bootstrap-execution | What runs at startup (initializers, bootstrap, interceptors, provider factories) and where a watched expression is touched |
475
517
  | inspect-form-group | Reactive Forms structure and every enable/disable/validator change per control |
476
518
  | inspect-i18n | Translation keys: definitions per language and overlay, usages in templates and code, missing and undefined keys |
519
+ | 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 |
477
520
 
478
521
  ### Server
479
522
 
480
523
  | Tool | Purpose |
481
524
  |-|-|
482
- | server-status | pid, uptime, memory, cached projects, response sizes, and whether the dist was rebuilt since start |
525
+ | server-status | server version, pid, uptime, memory, cached projects, response sizes, and whether the dist was rebuilt since start |
483
526
 
484
527
  ---
485
528
 
486
529
  ## Advanced Features
487
530
 
488
- ### Cross-Cache Reading System
489
-
490
- `scan-all` reads from individual plugin caches written by `scan-architecture`, `scan-solid`, and `scan-angular`. When those tools have run first, `scan-all` avoids re-analyzing files it already has results for.
491
-
492
- Performance impact:
531
+ ### scan-all Cache
493
532
 
494
- ```
495
- Workflow: scan-architecture -> scan-solid -> scan-angular -> scan-all
496
-
497
- Without cross-cache: scan-all analyzes all 450 files
498
- With cross-cache: scan-all reads cached results (up to 57% reduction)
499
- ```
533
+ `scan-all` reads and writes only its own cache, `.angular-modernizer-cache/all/`. It does not read the caches written by `scan-architecture`, `scan-solid` and `scan-angular`. An earlier version did ("cross-cache reading"), but it opened them with its own cache version `scan-all-2`, so their entries never matched and were invalidated (deleted) on every scan-all run; a hit would also have returned only one plugin's findings. The individual scans keep writing and reading their own caches.
500
534
 
501
- Cache statistics example:
535
+ Cache statistics example (second run, nothing changed):
502
536
 
503
537
  ```json
504
538
  {
505
- "hitRate": 0.0,
539
+ "hitRate": 100,
506
540
  "hitsBySource": {
507
- "architecture": 150,
508
- "solid": 150,
509
- "angular": 150
541
+ "all": 450
510
542
  }
511
543
  }
512
544
  ```
513
545
 
514
- A `hitRate` of 0% with non-zero `hitsBySource` is correct: it means the primary cache (scan-all's own) is empty on the first run, but fallback caches from the other tools are being read successfully. The second `scan-all` run will have `hitRate > 0%`.
515
-
516
- Best practice: run individual scans first, then `scan-all` for maximum cache benefit.
546
+ `hitRate` and `hitsBySource` refer to the own cache (`all`) only. `hitRate` is a percentage. The first run has 0%; later runs analyze only changed files.
517
547
 
518
548
  ### Intelligent Mode Selection
519
549
 
@@ -626,6 +656,7 @@ Cache locations:
626
656
  - `architecture`: `.angular-modernizer-cache/architecture/`
627
657
  - `solid`: `.angular-modernizer-cache/solid/`
628
658
  - `angular`: `.angular-modernizer-cache/angular/`
659
+ - `all` (scan-all): `.angular-modernizer-cache/all/`
629
660
  - `patterns`: `.angular-modernizer-cache/pattern-knowledge.json`
630
661
 
631
662
  When to clear cache:
@@ -709,16 +740,16 @@ Weekly: Full scan + pattern evolution check
709
740
 
710
741
  ### Cache Optimization
711
742
 
712
- Run individual scans before `scan-all`:
743
+ Each scan tool keeps its own cache, so repeated runs of the same tool are fast. `scan-all` does not reuse the individual caches; run either the individual scans or `scan-all`, not both, for a full picture:
713
744
 
714
745
  ```bash
715
- # Step 1: Individual scans (write plugin-specific caches)
746
+ # Individual scans (write plugin-specific caches)
716
747
  scan-architecture # Writes: .cache/architecture/
717
748
  scan-solid # Writes: .cache/solid/
718
749
  scan-angular # Writes: .cache/angular/
719
750
 
720
- # Step 2: Combined scan (reads from fallback caches)
721
- scan-all # Reads from all above caches (up to 57% faster)
751
+ # Combined scan: own cache only, does not read the caches above
752
+ scan-all # Writes and reads: .cache/all/
722
753
  ```
723
754
 
724
755
  Second run performance:
@@ -750,169 +781,23 @@ Batch transformations:
750
781
 
751
782
  ---
752
783
 
753
- ## Streaming Progress
754
-
755
- The streaming progress feature provides real-time feedback during long-running transformations through a polling-based architecture. AI assistants can monitor progress, display diffs, and detect errors as they occur.
756
-
757
- Key capabilities:
758
- - Real-time progress (percentage, phase, and ETA updates)
759
- - Unified diffs (git-style diffs for every file transformation)
760
- - Syntax validation (lightweight error detection without compilation)
761
- - Memory tracking (continuous heap usage monitoring)
762
- - Incremental polling (fetch only new events since last poll)
763
- - Zero overhead (only active when explicitly used)
764
-
765
- ### Architecture
766
-
767
- ```
768
- AI Assistant -> Start Operation -> Background Execution
769
- | | |
770
- Poll Progress -> ProgressStore <- Stream Events
771
- | |
772
- Display Updates Transform Files
773
- ```
774
-
775
- Polling pattern:
776
- 1. Start transformation, receive `operationId`
777
- 2. Poll `get-operation-progress` with `operationId`
778
- 3. Display progress, diffs, errors to user
779
- 4. Continue polling until `status: 'completed'`
780
-
781
- ### Quick Start
782
-
783
- Start a streaming operation:
784
-
785
- ```typescript
786
- {
787
- "tool": "transform-code",
788
- "arguments": {
789
- "transformation": "standalone-migration",
790
- "files": ["src/app/home/home.component.ts", "src/app/user/user.component.ts"],
791
- "streaming": true
792
- }
793
- }
794
-
795
- // Response
796
- {
797
- "operationId": "transform-20251209-123456-abc",
798
- "status": "running",
799
- "message": "Transformation started in background"
800
- }
801
- ```
802
-
803
- Poll for progress:
804
-
805
- ```typescript
806
- {
807
- "tool": "get-operation-progress",
808
- "arguments": {
809
- "operationId": "transform-20251209-123456-abc"
810
- }
811
- }
812
-
813
- // Response
814
- {
815
- "operationId": "transform-20251209-123456-abc",
816
- "status": "running",
817
- "events": [
818
- {
819
- "phase": "transforming",
820
- "percentage": 50,
821
- "message": "Transforming home.component.ts",
822
- "timestamp": 1733750401000,
823
- "diff": {
824
- "filePath": "src/app/home/home.component.ts",
825
- "diff": "--- src/app/home/home.component.ts\n+++ ...",
826
- "linesAdded": 4,
827
- "linesRemoved": 1
828
- }
829
- }
830
- ],
831
- "totalEvents": 5,
832
- "elapsedTime": 2500,
833
- "eta": 2500
834
- }
835
- ```
836
-
837
- Incremental polling (recommended):
784
+ ## Progress and Cancellation
838
785
 
839
- ```typescript
840
- // First poll: get all events
841
- const poll1 = await getProgress({ operationId });
842
-
843
- // Subsequent polls: get only new events
844
- const poll2 = await getProgress({
845
- operationId,
846
- sinceTimestamp: poll1.events[poll1.events.length - 1].timestamp,
847
- });
848
- ```
786
+ Long-running tools report progress through MCP `notifications/progress` when the request carries `_meta.progressToken`, and stop when the client sends `notifications/cancelled` (Esc in Claude Code). Without a token no progress notification is sent. Notifications are throttled: the first and the last value, at most one per 250 ms.
849
787
 
850
- ### Event Structure
851
-
852
- ```typescript
853
- interface StreamingProgressEvent {
854
- phase: 'analyzing' | 'transforming' | 'validating' | 'building' | 'complete';
855
- percentage: number; // 0-100
856
- message: string;
857
- timestamp: number; // Unix timestamp (ms)
858
-
859
- currentFile?: string;
860
-
861
- diff?: {
862
- filePath: string;
863
- diff: string; // Unified diff
864
- linesAdded: number;
865
- linesRemoved: number;
866
- };
867
-
868
- syntaxErrors?: Array<{
869
- filePath: string;
870
- line: number;
871
- message: string;
872
- }>;
873
-
874
- memoryUsage?: {
875
- heapUsed: number;
876
- heapTotal: number;
877
- percentage: number; // 0-100
878
- };
879
- }
880
- ```
788
+ | Tool | Progress | On cancel |
789
+ |-|-|-|
790
+ | 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 |
791
+ | compare-health | through scan-all | no comparison, snapshot not written |
792
+ | transform-code | single file: 3 steps (loaded, transformed, validated); batch: files | restores the backup (also with `autoRollback: false`); a batch restores every file |
793
+ | run-build, run-angular-cli, run-schematic, validate-transformation | none | ends the build with its process tree (SIGTERM, SIGKILL after 5 s) |
794
+ | orchestrate-migration | steps | passes the cancel to the running step, runs no further step |
881
795
 
882
- ### Progress Phases
796
+ A cancelled request gets no response (MCP spec). Scans also stop while they add their files to the project (checked per file). Only the kernel's own project load (`kernel.initialize()`) and transform-code's load of its file cannot be interrupted; the cancel takes effect right after them. Direct callers of a scan get the analyzed part with `execution.stopReason: 'cancelled'`.
883
797
 
884
- ```
885
- analyzing (0-10%) : Project setup, file discovery
886
- transforming (10-90%) : Per-file AST transformation
887
- validating (90-95%) : Syntax validation
888
- building (95-98%) : Optional compilation check
889
- complete (100%) : Final summary
890
- ```
891
-
892
- ### Performance Impact
798
+ ### Streaming (deprecated)
893
799
 
894
- | Configuration | Overhead | Use Case |
895
- |-|-|-|
896
- | No streaming | 0% | Automation, CI/CD |
897
- | Minimal streaming | ~2-3% | Progress tracking only |
898
- | Full streaming | ~8-16% | AI assistants (diffs + validation) |
899
-
900
- Overhead breakdown:
901
- - Event generation: ~2-3%
902
- - Diff generation: ~5-10% (only modified files)
903
- - Syntax detection: ~1-2%
904
- - Memory tracking: <1%
905
-
906
- When to use streaming:
907
- - Long-running operations (>10 seconds)
908
- - Large projects (>100 files)
909
- - AI assistants requiring feedback
910
- - User needs diff visibility
911
-
912
- When to use batch (non-streaming):
913
- - Short operations (<10 seconds)
914
- - Automation/CI/CD
915
- - Performance-critical scenarios
800
+ `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.
916
801
 
917
802
  ---
918
803
 
@@ -930,10 +815,10 @@ Solutions:
930
815
 
931
816
  ### "Cache hit rate 0% - is cache working?"
932
817
 
933
- Yes, this is normal for the first run or for `scan-all` using the cross-cache system.
818
+ Yes, this is normal for the first run.
934
819
 
935
- - `hitRate: 0%` means the primary cache (scan-all's own plugin cache) is empty
936
- - `hitsBySource: {...}` with non-zero values means fallback caches are working correctly
820
+ - `hitRate: 0%` means the tool's own cache is empty (for `scan-all`: `.angular-modernizer-cache/all/`)
821
+ - `scan-all` does not read the caches of the individual scans, so running them first does not raise its hit rate
937
822
  - The second run will have `hitRate > 0%`
938
823
 
939
824
  ### "Worker threads not available (offline mode)"
package/dist/cli.js CHANGED
@@ -8,12 +8,14 @@ import { realpathSync, appendFileSync } from 'node:fs';
8
8
  import { dirname, join } from 'node:path';
9
9
  import { fileURLToPath } from 'node:url';
10
10
  import { MCPServer } from './server/mcp-server.js';
11
+ import { isDebugEnabled } from './mcp-watcher.js';
11
12
  import { routeConsoleToStderr } from './server/stdio-guard.js';
12
13
  import { AnalyzeProjectTool } from './tools/analyze-project.js';
13
14
  import { ScanArchitectureTool } from './tools/scan-architecture.js';
14
15
  import { ScanSolidTool } from './tools/scan-solid.js';
15
16
  import { ScanAngularTool } from './tools/scan-angular.js';
16
17
  import { ScanAllTool } from './tools/scan-all.js';
18
+ import { CompareHealthTool } from './tools/compare-health.js';
17
19
  import { PlanMigrationTool } from './tools/plan-migration.js';
18
20
  import { TransformCodeTool } from './tools/transform-code.js';
19
21
  import { RunAngularCliTool } from './tools/run-angular-cli.js';
@@ -48,12 +50,17 @@ import { InspectI18nTool } from './tools/inspect-i18n.js';
48
50
  import { ProjectCache, parseProjectCacheLimits, } from './tools/helpers/project-cache.js';
49
51
  import { FindAngularSymbolTool } from './tools/find-angular-symbol.js';
50
52
  import { SearchCodebaseTool } from './tools/search-codebase.js';
53
+ import { VerifyCitationsTool } from './tools/verify-citations.js';
51
54
  import { ServerStatusTool } from './tools/server-status.js';
52
55
  /**
53
- * Write debug message to MCP log file (mcp-server.log)
54
- * This ensures debug output appears in the same log file that MCP Watcher uses
56
+ * Write debug message to MCP log file (mcp-server.log), the file the MCP
57
+ * Watcher uses. Only with ANGULAR_MODERNIZER_DEBUG set: the file lands in the
58
+ * client's working directory.
55
59
  */
56
60
  function debugLog(message) {
61
+ if (!isDebugEnabled()) {
62
+ return;
63
+ }
57
64
  const timestamp = new Date().toISOString();
58
65
  const line = `[${timestamp}] DEBUG ${message}\n`;
59
66
  appendFileSync('./mcp-server.log', line);
@@ -115,6 +122,7 @@ function main() {
115
122
  server.registerTool(new ScanSolidTool());
116
123
  server.registerTool(new ScanAngularTool());
117
124
  server.registerTool(new ScanAllTool());
125
+ server.registerTool(new CompareHealthTool());
118
126
  server.registerTool(new PlanMigrationTool(projects));
119
127
  server.registerTool(new TransformCodeTool());
120
128
  server.registerTool(new RunAngularCliTool());
@@ -148,6 +156,7 @@ function main() {
148
156
  server.registerTool(new InspectI18nTool(projects));
149
157
  server.registerTool(new FindAngularSymbolTool(projects));
150
158
  server.registerTool(new SearchCodebaseTool(projects));
159
+ server.registerTool(new VerifyCitationsTool());
151
160
  server.registerTool(new ServerStatusTool(projects, () => server.getRuntimeStats(), distDirectories()));
152
161
  debugLog(`CLI ${server.getToolsMap().size} tools registered successfully`);
153
162
  // Register orchestration tool with access to all other tools
@@ -159,17 +168,8 @@ function main() {
159
168
  // Start the server
160
169
  server.start();
161
170
  debugLog('CLI MCP server.start() completed, server should now be listening on stdin');
162
- // Keep the process running
163
- process.on('SIGINT', () => {
164
- console.error('Received SIGINT, shutting down gracefully...');
165
- server.stop();
166
- process.exit(0);
167
- });
168
- process.on('SIGTERM', () => {
169
- console.error('Received SIGTERM, shutting down gracefully...');
170
- server.stop();
171
- process.exit(0);
172
- });
171
+ // Signals, stdin end and a lost parent end the process through the
172
+ // server's shutdown(), which flushes stdout first
173
173
  }
174
174
  catch (error) {
175
175
  console.error('Failed to start MCP server:', error);
package/dist/index.d.ts CHANGED
@@ -6,14 +6,14 @@
6
6
  */
7
7
  export { MCPServer } from './server/mcp-server.js';
8
8
  export { ToolRegistry } from './server/tool-registry.js';
9
- export { JsonRpcHandler } from './server/json-rpc-handler.js';
10
- export { startMCPWatcher, stopMCPWatcher, getMCPWatcher, } from './mcp-watcher.js';
9
+ export { startMCPWatcher, stopMCPWatcher, getMCPWatcher, isDebugEnabled, DEBUG_ENV, } from './mcp-watcher.js';
11
10
  export type { MCPWatcher, WatcherState, OperationInfo } from './mcp-watcher.js';
12
11
  export { AnalyzeProjectTool } from './tools/analyze-project.js';
13
12
  export { ScanArchitectureTool } from './tools/scan-architecture.js';
14
13
  export { ScanSolidTool } from './tools/scan-solid.js';
15
14
  export { ScanAngularTool } from './tools/scan-angular.js';
16
15
  export { ScanAllTool } from './tools/scan-all.js';
16
+ export { CompareHealthTool } from './tools/compare-health.js';
17
17
  export { PlanMigrationTool } from './tools/plan-migration.js';
18
18
  export { TransformCodeTool } from './tools/transform-code.js';
19
19
  export { RunAngularCliTool } from './tools/run-angular-cli.js';
@@ -48,7 +48,8 @@ export { InspectFormGroupTool } from './tools/inspect-form-group.js';
48
48
  export { InspectI18nTool } from './tools/inspect-i18n.js';
49
49
  export { FindAngularSymbolTool } from './tools/find-angular-symbol.js';
50
50
  export { SearchCodebaseTool } from './tools/search-codebase.js';
51
+ export { VerifyCitationsTool } from './tools/verify-citations.js';
51
52
  export { ProgressStore, type OperationMetadata, type OperationState, } from './streaming/progress-store.js';
52
- export type { MCPTool, MCPServerConfig, JsonRpcRequest, JsonRpcResponse, JsonRpcNotification, ToolExecutionContext, } from './types.js';
53
+ export type { MCPTool, ToolAnnotations, MCPServerConfig, JsonRpcRequest, JsonRpcResponse, JsonRpcNotification, ToolExecutionContext, ToolContext, ProgressFn, } from './types.js';
53
54
  export { analyzeProject } from './core/project-analyzer.js';
54
55
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -7,15 +7,15 @@
7
7
  // Export server infrastructure
8
8
  export { MCPServer } from './server/mcp-server.js';
9
9
  export { ToolRegistry } from './server/tool-registry.js';
10
- export { JsonRpcHandler } from './server/json-rpc-handler.js';
11
10
  // Export MCP Watcher for debugging and monitoring
12
- export { startMCPWatcher, stopMCPWatcher, getMCPWatcher, } from './mcp-watcher.js';
11
+ export { startMCPWatcher, stopMCPWatcher, getMCPWatcher, isDebugEnabled, DEBUG_ENV, } from './mcp-watcher.js';
13
12
  // Export MCP tools
14
13
  export { AnalyzeProjectTool } from './tools/analyze-project.js';
15
14
  export { ScanArchitectureTool } from './tools/scan-architecture.js';
16
15
  export { ScanSolidTool } from './tools/scan-solid.js';
17
16
  export { ScanAngularTool } from './tools/scan-angular.js';
18
17
  export { ScanAllTool } from './tools/scan-all.js';
18
+ export { CompareHealthTool } from './tools/compare-health.js';
19
19
  export { PlanMigrationTool } from './tools/plan-migration.js';
20
20
  export { TransformCodeTool } from './tools/transform-code.js';
21
21
  export { RunAngularCliTool } from './tools/run-angular-cli.js';
@@ -52,6 +52,7 @@ export { InspectFormGroupTool } from './tools/inspect-form-group.js';
52
52
  export { InspectI18nTool } from './tools/inspect-i18n.js';
53
53
  export { FindAngularSymbolTool } from './tools/find-angular-symbol.js';
54
54
  export { SearchCodebaseTool } from './tools/search-codebase.js';
55
+ export { VerifyCitationsTool } from './tools/verify-citations.js';
55
56
  // Export streaming utilities
56
57
  export { ProgressStore, } from './streaming/progress-store.js';
57
58
  // Re-export existing project analyzer for compatibility