@angular-modernizer/adapter-mcp 0.3.0 → 1.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 (298) hide show
  1. package/README.md +181 -282
  2. package/dist/cli.js +21 -13
  3. package/dist/core/project-analyzer.d.ts +3 -12
  4. package/dist/core/project-analyzer.js +3 -12
  5. package/dist/index.d.ts +122 -6
  6. package/dist/index.js +49 -5
  7. package/dist/mcp-watcher.d.ts +32 -7
  8. package/dist/mcp-watcher.js +16 -15
  9. package/dist/scan-host/scan-host.d.ts +119 -0
  10. package/dist/scan-host/scan-host.js +376 -0
  11. package/dist/scan-host/scan-protocol.d.ts +35 -0
  12. package/dist/scan-host/scan-protocol.js +6 -0
  13. package/dist/scan-host/scan-worker.d.ts +14 -0
  14. package/dist/scan-host/scan-worker.js +48 -0
  15. package/dist/server/limited-stdio-transport.d.ts +75 -0
  16. package/dist/server/limited-stdio-transport.js +115 -0
  17. package/dist/server/mcp-server.d.ts +20 -18
  18. package/dist/server/mcp-server.js +42 -79
  19. package/dist/server/package-version.d.ts +16 -0
  20. package/dist/server/package-version.js +37 -0
  21. package/dist/server/sdk-server.d.ts +71 -0
  22. package/dist/server/sdk-server.js +113 -0
  23. package/dist/server/tool-registry.d.ts +6 -9
  24. package/dist/server/tool-registry.js +6 -12
  25. package/dist/streaming/progress-store.d.ts +22 -5
  26. package/dist/streaming/progress-store.js +9 -5
  27. package/dist/tools/analyze-build-impact.d.ts +276 -35
  28. package/dist/tools/analyze-build-impact.js +175 -28
  29. package/dist/tools/analyze-core-to-shared.d.ts +176 -16
  30. package/dist/tools/analyze-core-to-shared.js +124 -19
  31. package/dist/tools/analyze-parser-performance.d.ts +209 -15
  32. package/dist/tools/analyze-parser-performance.js +119 -56
  33. package/dist/tools/analyze-project.d.ts +349 -17
  34. package/dist/tools/analyze-project.js +282 -97
  35. package/dist/tools/check-incremental-compatibility.d.ts +74 -12
  36. package/dist/tools/check-incremental-compatibility.js +69 -10
  37. package/dist/tools/collect-feedback.d.ts +225 -21
  38. package/dist/tools/collect-feedback.js +199 -118
  39. package/dist/tools/compare-health.d.ts +413 -0
  40. package/dist/tools/compare-health.js +479 -0
  41. package/dist/tools/extract-libraries.d.ts +200 -24
  42. package/dist/tools/extract-libraries.js +131 -27
  43. package/dist/tools/find-angular-symbol.d.ts +92 -24
  44. package/dist/tools/find-angular-symbol.js +70 -20
  45. package/dist/tools/find-component-hosts.d.ts +603 -27
  46. package/dist/tools/find-component-hosts.js +223 -19
  47. package/dist/tools/find-usages.d.ts +102 -22
  48. package/dist/tools/find-usages.js +81 -21
  49. package/dist/tools/get-bootstrap-execution.d.ts +183 -25
  50. package/dist/tools/get-bootstrap-execution.js +109 -25
  51. package/dist/tools/get-call-graph.d.ts +127 -12
  52. package/dist/tools/get-call-graph.js +84 -19
  53. package/dist/tools/get-operation-progress-tool.d.ts +126 -8
  54. package/dist/tools/get-operation-progress-tool.js +124 -12
  55. package/dist/tools/get-operation-progress.d.ts +27 -1
  56. package/dist/tools/get-operation-progress.js +5 -5
  57. package/dist/tools/helpers/analysis-output.d.ts +182 -0
  58. package/dist/tools/helpers/analysis-output.js +165 -0
  59. package/dist/tools/helpers/batch-kernel.d.ts +14 -0
  60. package/dist/tools/helpers/batch-kernel.js +12 -0
  61. package/dist/tools/helpers/build-schemas.d.ts +36 -0
  62. package/dist/tools/helpers/build-schemas.js +23 -0
  63. package/dist/tools/helpers/citation-file-source.d.ts +10 -0
  64. package/dist/tools/helpers/citation-file-source.js +82 -0
  65. package/dist/tools/helpers/compact-output.d.ts +2 -1
  66. package/dist/tools/helpers/compact-output.js +2 -1
  67. package/dist/tools/helpers/finding-window.d.ts +43 -0
  68. package/dist/tools/helpers/finding-window.js +64 -0
  69. package/dist/tools/helpers/health-delta.d.ts +99 -0
  70. package/dist/tools/helpers/health-delta.js +236 -0
  71. package/dist/tools/helpers/investigation-schemas.d.ts +93 -0
  72. package/dist/tools/helpers/investigation-schemas.js +48 -0
  73. package/dist/tools/helpers/library-imports.d.ts +57 -0
  74. package/dist/tools/helpers/library-imports.js +151 -0
  75. package/dist/tools/helpers/load-source-files.d.ts +30 -0
  76. package/dist/tools/helpers/load-source-files.js +34 -0
  77. package/dist/tools/helpers/output-contract.d.ts +32 -0
  78. package/dist/tools/helpers/output-contract.js +32 -0
  79. package/dist/tools/helpers/platform-root-resolver.d.ts +55 -25
  80. package/dist/tools/helpers/platform-root-resolver.js +75 -48
  81. package/dist/tools/helpers/process-output.d.ts +19 -0
  82. package/dist/tools/helpers/process-output.js +31 -0
  83. package/dist/tools/helpers/project-cache.d.ts +60 -37
  84. package/dist/tools/helpers/project-cache.js +54 -37
  85. package/dist/tools/helpers/project-decorators.d.ts +14 -0
  86. package/dist/tools/helpers/project-decorators.js +22 -0
  87. package/dist/tools/helpers/rule-matcher.js +5 -0
  88. package/dist/tools/helpers/rule-runner.d.ts +25 -13
  89. package/dist/tools/helpers/rule-runner.js +45 -24
  90. package/dist/tools/helpers/scan-cache.d.ts +22 -0
  91. package/dist/tools/helpers/scan-cache.js +34 -0
  92. package/dist/tools/helpers/scan-engine.d.ts +107 -0
  93. package/dist/tools/helpers/scan-engine.js +197 -0
  94. package/dist/tools/helpers/scan-plan.d.ts +5 -2
  95. package/dist/tools/helpers/scan-plan.js +18 -3
  96. package/dist/tools/helpers/scope-paths.d.ts +17 -0
  97. package/dist/tools/helpers/scope-paths.js +32 -0
  98. package/dist/tools/helpers/suggestion-generator.d.ts +9 -13
  99. package/dist/tools/helpers/suggestion-generator.js +0 -12
  100. package/dist/tools/helpers/tool-cache.d.ts +11 -0
  101. package/dist/tools/helpers/tool-cache.js +15 -0
  102. package/dist/tools/helpers/tool-context.d.ts +63 -0
  103. package/dist/tools/helpers/tool-context.js +79 -0
  104. package/dist/tools/helpers/transform-safety.d.ts +40 -0
  105. package/dist/tools/helpers/transform-safety.js +87 -0
  106. package/dist/tools/helpers/validation-output.d.ts +53 -0
  107. package/dist/tools/helpers/validation-output.js +48 -0
  108. package/dist/tools/inspect-form-group.d.ts +262 -24
  109. package/dist/tools/inspect-form-group.js +134 -13
  110. package/dist/tools/inspect-i18n.d.ts +410 -23
  111. package/dist/tools/inspect-i18n.js +213 -13
  112. package/dist/tools/inspect-template.d.ts +260 -22
  113. package/dist/tools/inspect-template.js +174 -13
  114. package/dist/tools/learn-patterns.d.ts +210 -13
  115. package/dist/tools/learn-patterns.js +113 -12
  116. package/dist/tools/list-imports.d.ts +152 -34
  117. package/dist/tools/list-imports.js +124 -18
  118. package/dist/tools/orchestrate-migration.d.ts +159 -14
  119. package/dist/tools/orchestrate-migration.js +147 -20
  120. package/dist/tools/parse-stack-trace.d.ts +78 -21
  121. package/dist/tools/parse-stack-trace.js +44 -7
  122. package/dist/tools/plan-migration.d.ts +395 -26
  123. package/dist/tools/plan-migration.js +173 -22
  124. package/dist/tools/resolve-type.d.ts +57 -9
  125. package/dist/tools/resolve-type.js +49 -12
  126. package/dist/tools/review-feedback.d.ts +214 -16
  127. package/dist/tools/review-feedback.js +142 -57
  128. package/dist/tools/rollback-changes.d.ts +88 -7
  129. package/dist/tools/rollback-changes.js +74 -19
  130. package/dist/tools/run-angular-cli.d.ts +57 -12
  131. package/dist/tools/run-angular-cli.js +76 -13
  132. package/dist/tools/run-build.d.ts +127 -13
  133. package/dist/tools/run-build.js +128 -16
  134. package/dist/tools/run-schematic.d.ts +82 -12
  135. package/dist/tools/run-schematic.js +115 -18
  136. package/dist/tools/scan-all.d.ts +88 -23
  137. package/dist/tools/scan-all.js +161 -220
  138. package/dist/tools/scan-angular.d.ts +60 -19
  139. package/dist/tools/scan-angular.js +100 -141
  140. package/dist/tools/scan-architecture.d.ts +92 -24
  141. package/dist/tools/scan-architecture.js +268 -211
  142. package/dist/tools/scan-solid.d.ts +59 -19
  143. package/dist/tools/scan-solid.js +98 -139
  144. package/dist/tools/search-codebase.d.ts +110 -23
  145. package/dist/tools/search-codebase.js +67 -11
  146. package/dist/tools/server-status.d.ts +392 -26
  147. package/dist/tools/server-status.js +260 -27
  148. package/dist/tools/suggest-improvements.d.ts +105 -10
  149. package/dist/tools/suggest-improvements.js +91 -51
  150. package/dist/tools/trace-output-flow.d.ts +713 -26
  151. package/dist/tools/trace-output-flow.js +396 -33
  152. package/dist/tools/transform-code-batch.d.ts +3 -0
  153. package/dist/tools/transform-code-batch.js +10 -5
  154. package/dist/tools/transform-code.d.ts +402 -18
  155. package/dist/tools/transform-code.js +708 -649
  156. package/dist/tools/validate-before-transform.d.ts +136 -7
  157. package/dist/tools/validate-before-transform.js +65 -9
  158. package/dist/tools/validate-project-compatibility.d.ts +82 -15
  159. package/dist/tools/validate-project-compatibility.js +84 -15
  160. package/dist/tools/validate-transformation.d.ts +243 -8
  161. package/dist/tools/validate-transformation.js +127 -23
  162. package/dist/tools/verify-citations.d.ts +202 -0
  163. package/dist/tools/verify-citations.js +221 -0
  164. package/dist/types.d.ts +78 -11
  165. package/dist/types.js +0 -5
  166. package/dist/utils/format-tool-response.d.ts +22 -59
  167. package/dist/utils/format-tool-response.js +25 -134
  168. package/package.json +31 -20
  169. package/dist/cli.d.ts.map +0 -1
  170. package/dist/cli.js.map +0 -1
  171. package/dist/core/project-analyzer.d.ts.map +0 -1
  172. package/dist/core/project-analyzer.js.map +0 -1
  173. package/dist/index.d.ts.map +0 -1
  174. package/dist/index.js.map +0 -1
  175. package/dist/mcp-watcher.d.ts.map +0 -1
  176. package/dist/mcp-watcher.js.map +0 -1
  177. package/dist/server/json-rpc-handler.d.ts +0 -98
  178. package/dist/server/json-rpc-handler.d.ts.map +0 -1
  179. package/dist/server/json-rpc-handler.js +0 -301
  180. package/dist/server/json-rpc-handler.js.map +0 -1
  181. package/dist/server/mcp-server.d.ts.map +0 -1
  182. package/dist/server/mcp-server.js.map +0 -1
  183. package/dist/server/stdio-guard.d.ts.map +0 -1
  184. package/dist/server/stdio-guard.js.map +0 -1
  185. package/dist/server/tool-registry.d.ts.map +0 -1
  186. package/dist/server/tool-registry.js.map +0 -1
  187. package/dist/streaming/progress-store.d.ts.map +0 -1
  188. package/dist/streaming/progress-store.js.map +0 -1
  189. package/dist/tools/analyze-build-impact.d.ts.map +0 -1
  190. package/dist/tools/analyze-build-impact.js.map +0 -1
  191. package/dist/tools/analyze-core-to-shared.d.ts.map +0 -1
  192. package/dist/tools/analyze-core-to-shared.js.map +0 -1
  193. package/dist/tools/analyze-parser-performance.d.ts.map +0 -1
  194. package/dist/tools/analyze-parser-performance.js.map +0 -1
  195. package/dist/tools/analyze-project.d.ts.map +0 -1
  196. package/dist/tools/analyze-project.js.map +0 -1
  197. package/dist/tools/check-incremental-compatibility.d.ts.map +0 -1
  198. package/dist/tools/check-incremental-compatibility.js.map +0 -1
  199. package/dist/tools/collect-feedback.d.ts.map +0 -1
  200. package/dist/tools/collect-feedback.js.map +0 -1
  201. package/dist/tools/extract-libraries.d.ts.map +0 -1
  202. package/dist/tools/extract-libraries.js.map +0 -1
  203. package/dist/tools/find-angular-symbol.d.ts.map +0 -1
  204. package/dist/tools/find-angular-symbol.js.map +0 -1
  205. package/dist/tools/find-component-hosts.d.ts.map +0 -1
  206. package/dist/tools/find-component-hosts.js.map +0 -1
  207. package/dist/tools/find-usages.d.ts.map +0 -1
  208. package/dist/tools/find-usages.js.map +0 -1
  209. package/dist/tools/get-bootstrap-execution.d.ts.map +0 -1
  210. package/dist/tools/get-bootstrap-execution.js.map +0 -1
  211. package/dist/tools/get-call-graph.d.ts.map +0 -1
  212. package/dist/tools/get-call-graph.js.map +0 -1
  213. package/dist/tools/get-operation-progress-tool.d.ts.map +0 -1
  214. package/dist/tools/get-operation-progress-tool.js.map +0 -1
  215. package/dist/tools/get-operation-progress.d.ts.map +0 -1
  216. package/dist/tools/get-operation-progress.js.map +0 -1
  217. package/dist/tools/helpers/compact-output.d.ts.map +0 -1
  218. package/dist/tools/helpers/compact-output.js.map +0 -1
  219. package/dist/tools/helpers/feedback-analyzer.d.ts.map +0 -1
  220. package/dist/tools/helpers/feedback-analyzer.js.map +0 -1
  221. package/dist/tools/helpers/find-ts-config.d.ts.map +0 -1
  222. package/dist/tools/helpers/find-ts-config.js.map +0 -1
  223. package/dist/tools/helpers/platform-root-resolver.d.ts.map +0 -1
  224. package/dist/tools/helpers/platform-root-resolver.js.map +0 -1
  225. package/dist/tools/helpers/project-cache.d.ts.map +0 -1
  226. package/dist/tools/helpers/project-cache.js.map +0 -1
  227. package/dist/tools/helpers/rule-matcher.d.ts.map +0 -1
  228. package/dist/tools/helpers/rule-matcher.js.map +0 -1
  229. package/dist/tools/helpers/rule-runner.d.ts.map +0 -1
  230. package/dist/tools/helpers/rule-runner.js.map +0 -1
  231. package/dist/tools/helpers/scan-plan.d.ts.map +0 -1
  232. package/dist/tools/helpers/scan-plan.js.map +0 -1
  233. package/dist/tools/helpers/stack-frame-file-index.d.ts.map +0 -1
  234. package/dist/tools/helpers/stack-frame-file-index.js.map +0 -1
  235. package/dist/tools/helpers/suggestion-generator.d.ts.map +0 -1
  236. package/dist/tools/helpers/suggestion-generator.js.map +0 -1
  237. package/dist/tools/inspect-form-group.d.ts.map +0 -1
  238. package/dist/tools/inspect-form-group.js.map +0 -1
  239. package/dist/tools/inspect-i18n.d.ts.map +0 -1
  240. package/dist/tools/inspect-i18n.js.map +0 -1
  241. package/dist/tools/inspect-template.d.ts.map +0 -1
  242. package/dist/tools/inspect-template.js.map +0 -1
  243. package/dist/tools/learn-patterns.d.ts.map +0 -1
  244. package/dist/tools/learn-patterns.js.map +0 -1
  245. package/dist/tools/list-imports.d.ts.map +0 -1
  246. package/dist/tools/list-imports.js.map +0 -1
  247. package/dist/tools/orchestrate-migration.d.ts.map +0 -1
  248. package/dist/tools/orchestrate-migration.js.map +0 -1
  249. package/dist/tools/parse-stack-trace.d.ts.map +0 -1
  250. package/dist/tools/parse-stack-trace.js.map +0 -1
  251. package/dist/tools/plan-migration.d.ts.map +0 -1
  252. package/dist/tools/plan-migration.js.map +0 -1
  253. package/dist/tools/resolve-type.d.ts.map +0 -1
  254. package/dist/tools/resolve-type.js.map +0 -1
  255. package/dist/tools/review-feedback.d.ts.map +0 -1
  256. package/dist/tools/review-feedback.js.map +0 -1
  257. package/dist/tools/rollback-changes.d.ts.map +0 -1
  258. package/dist/tools/rollback-changes.js.map +0 -1
  259. package/dist/tools/run-angular-cli.d.ts.map +0 -1
  260. package/dist/tools/run-angular-cli.js.map +0 -1
  261. package/dist/tools/run-build.d.ts.map +0 -1
  262. package/dist/tools/run-build.js.map +0 -1
  263. package/dist/tools/run-schematic.d.ts.map +0 -1
  264. package/dist/tools/run-schematic.js.map +0 -1
  265. package/dist/tools/scan-all.d.ts.map +0 -1
  266. package/dist/tools/scan-all.js.map +0 -1
  267. package/dist/tools/scan-angular.d.ts.map +0 -1
  268. package/dist/tools/scan-angular.js.map +0 -1
  269. package/dist/tools/scan-architecture.d.ts.map +0 -1
  270. package/dist/tools/scan-architecture.js.map +0 -1
  271. package/dist/tools/scan-solid.d.ts.map +0 -1
  272. package/dist/tools/scan-solid.js.map +0 -1
  273. package/dist/tools/search-codebase.d.ts.map +0 -1
  274. package/dist/tools/search-codebase.js.map +0 -1
  275. package/dist/tools/server-status.d.ts.map +0 -1
  276. package/dist/tools/server-status.js.map +0 -1
  277. package/dist/tools/shared/scan-types.d.ts +0 -200
  278. package/dist/tools/shared/scan-types.d.ts.map +0 -1
  279. package/dist/tools/shared/scan-types.js +0 -7
  280. package/dist/tools/shared/scan-types.js.map +0 -1
  281. package/dist/tools/suggest-improvements.d.ts.map +0 -1
  282. package/dist/tools/suggest-improvements.js.map +0 -1
  283. package/dist/tools/trace-output-flow.d.ts.map +0 -1
  284. package/dist/tools/trace-output-flow.js.map +0 -1
  285. package/dist/tools/transform-code-batch.d.ts.map +0 -1
  286. package/dist/tools/transform-code-batch.js.map +0 -1
  287. package/dist/tools/transform-code.d.ts.map +0 -1
  288. package/dist/tools/transform-code.js.map +0 -1
  289. package/dist/tools/validate-before-transform.d.ts.map +0 -1
  290. package/dist/tools/validate-before-transform.js.map +0 -1
  291. package/dist/tools/validate-project-compatibility.d.ts.map +0 -1
  292. package/dist/tools/validate-project-compatibility.js.map +0 -1
  293. package/dist/tools/validate-transformation.d.ts.map +0 -1
  294. package/dist/tools/validate-transformation.js.map +0 -1
  295. package/dist/types.d.ts.map +0 -1
  296. package/dist/types.js.map +0 -1
  297. package/dist/utils/format-tool-response.d.ts.map +0 -1
  298. package/dist/utils/format-tool-response.js.map +0 -1
@@ -1,75 +1,104 @@
1
- /**
2
- * @angular-modernizer/adapter-mcp - Orchestrate Migration Tool
3
- *
4
- * MCP tool for executing multi-step migration workflows with
5
- * dependency management, checkpoint/resume, and rollback support.
6
- */
7
- import { type MCPTool } from '../types.js';
1
+ import { type MCPTool, type ToolAnnotations, type ToolContext } from '../types.js';
8
2
  /**
9
3
  * Result from orchestrate-migration tool
10
4
  */
11
- interface OrchestrateMigrationResult {
5
+ export interface OrchestrateMigrationResult {
12
6
  /**
13
7
  * Overall workflow status
14
8
  */
15
9
  status: 'completed' | 'failed' | 'partial';
16
10
  /**
17
- * Execution summary
11
+ * Workflow that ran
12
+ */
13
+ workflowId: string;
14
+ /**
15
+ * Step counts and total duration
18
16
  */
19
- summary: {
20
- workflowId: string;
17
+ counts: {
18
+ /** Number of steps in the workflow. */
21
19
  totalSteps: number;
20
+ /** Steps that succeeded. */
22
21
  successfulSteps: number;
22
+ /** Steps that failed. */
23
23
  failedSteps: number;
24
+ /** Steps that were skipped. */
24
25
  skippedSteps: number;
26
+ /** Duration of the whole workflow in milliseconds. */
25
27
  totalDurationMs: number;
26
28
  };
27
29
  /**
28
30
  * Individual step results
29
31
  */
30
32
  stepResults: {
33
+ /** Step id from the workflow definition. */
31
34
  stepId: string;
35
+ /** Step name (the step id). */
32
36
  name: string;
37
+ /** Step status reported by the workflow engine. */
33
38
  status: string;
39
+ /** Duration of the step in milliseconds. */
34
40
  durationMs: number;
41
+ /** Error message of a failed step. */
35
42
  error?: string;
36
43
  }[];
37
44
  /**
38
45
  * Checkpoints created during execution
39
46
  */
40
47
  checkpoints: {
48
+ /** Checkpoint id (the step id). */
41
49
  id: string;
50
+ /** Id of the checkpoint step. */
42
51
  stepId: string;
52
+ /** Start time of the step in milliseconds since the epoch. */
43
53
  timestamp: number;
44
54
  }[];
45
55
  /**
46
56
  * Errors encountered
47
57
  */
48
58
  errors: {
59
+ /** Step that failed; `'workflow'` for errors of the workflow itself. */
49
60
  stepId: string;
61
+ /** Error message. */
50
62
  message: string;
63
+ /** Stack trace of the error. */
51
64
  stack?: string;
52
65
  }[];
53
66
  /**
54
67
  * Final checkpoint for resume
55
68
  */
56
69
  finalCheckpoint?: {
70
+ /** Checkpoint id to pass as `resumeFromCheckpoint`. */
57
71
  id: string;
72
+ /** Always `true` when a final checkpoint exists. */
58
73
  canResume: boolean;
59
74
  };
60
75
  /**
61
76
  * Message for the user
62
77
  */
63
78
  message: string;
79
+ /**
80
+ * Short text: status, step counts, duration, message and the first errors.
81
+ */
82
+ summary: string;
64
83
  }
65
84
  /**
66
- * Orchestrate Migration MCP Tool
85
+ * MCP tool for executing multi-step migration workflows with dependency
86
+ * management, checkpoint/resume, and rollback support. Steps call the other
87
+ * registered tools (`setAvailableTools`); a cancelled request runs no further
88
+ * step.
67
89
  */
68
90
  export declare class OrchestrateMigrationTool implements MCPTool {
69
91
  name: string;
92
+ title: string;
93
+ annotations: ToolAnnotations;
70
94
  description: string;
95
+ /**
96
+ * JSON Schema of the tool arguments.
97
+ * @hidden
98
+ */
71
99
  inputSchema: {
72
100
  type: string;
101
+ additionalProperties: boolean;
73
102
  properties: {
74
103
  workflow: {
75
104
  type: string;
@@ -170,6 +199,122 @@ export declare class OrchestrateMigrationTool implements MCPTool {
170
199
  };
171
200
  required: string[];
172
201
  };
202
+ /**
203
+ * JSON Schema of the tool result (`structuredContent`).
204
+ * @hidden
205
+ */
206
+ outputSchema: {
207
+ type: string;
208
+ properties: {
209
+ status: {
210
+ type: string;
211
+ enum: string[];
212
+ };
213
+ workflowId: {
214
+ type: string;
215
+ };
216
+ counts: {
217
+ type: string;
218
+ properties: {
219
+ totalSteps: {
220
+ type: string;
221
+ };
222
+ successfulSteps: {
223
+ type: string;
224
+ };
225
+ failedSteps: {
226
+ type: string;
227
+ };
228
+ skippedSteps: {
229
+ type: string;
230
+ };
231
+ totalDurationMs: {
232
+ type: string;
233
+ };
234
+ };
235
+ required: string[];
236
+ };
237
+ stepResults: {
238
+ type: string;
239
+ items: {
240
+ type: string;
241
+ properties: {
242
+ stepId: {
243
+ type: string;
244
+ };
245
+ name: {
246
+ type: string;
247
+ };
248
+ status: {
249
+ type: string;
250
+ };
251
+ durationMs: {
252
+ type: string;
253
+ };
254
+ error: {
255
+ type: string;
256
+ };
257
+ };
258
+ required: string[];
259
+ };
260
+ };
261
+ checkpoints: {
262
+ type: string;
263
+ items: {
264
+ type: string;
265
+ properties: {
266
+ id: {
267
+ type: string;
268
+ };
269
+ stepId: {
270
+ type: string;
271
+ };
272
+ timestamp: {
273
+ type: string;
274
+ };
275
+ };
276
+ required: string[];
277
+ };
278
+ };
279
+ errors: {
280
+ type: string;
281
+ items: {
282
+ type: string;
283
+ properties: {
284
+ stepId: {
285
+ type: string;
286
+ };
287
+ message: {
288
+ type: string;
289
+ };
290
+ stack: {
291
+ type: string;
292
+ };
293
+ };
294
+ required: string[];
295
+ };
296
+ };
297
+ finalCheckpoint: {
298
+ type: string;
299
+ properties: {
300
+ id: {
301
+ type: string;
302
+ };
303
+ canResume: {
304
+ type: string;
305
+ };
306
+ };
307
+ required: string[];
308
+ };
309
+ message: {
310
+ type: string;
311
+ };
312
+ summary: {
313
+ type: string;
314
+ };
315
+ };
316
+ required: string[];
317
+ };
173
318
  private availableTools;
174
319
  private readonly checkpointManager;
175
320
  constructor();
@@ -177,12 +322,12 @@ export declare class OrchestrateMigrationTool implements MCPTool {
177
322
  * Set the available tools for workflow execution
178
323
  */
179
324
  setAvailableTools(tools: Map<string, MCPTool>): void;
180
- execute(args: Record<string, unknown>): Promise<OrchestrateMigrationResult>;
325
+ execute(args: Record<string, unknown>, ctx?: ToolContext): Promise<OrchestrateMigrationResult>;
326
+ private runWorkflow;
181
327
  private unknownToolsResult;
182
328
  /**
183
329
  * Build result from workflow execution
184
330
  */
185
331
  private buildResult;
186
332
  }
187
- export {};
188
333
  //# sourceMappingURL=orchestrate-migration.d.ts.map
@@ -1,10 +1,20 @@
1
- /**
2
- * @angular-modernizer/adapter-mcp - Orchestrate Migration Tool
3
- *
4
- * MCP tool for executing multi-step migration workflows with
5
- * dependency management, checkpoint/resume, and rollback support.
6
- */
1
+ import { yieldIfCancellable } from './helpers/tool-context.js';
7
2
  import { WorkflowEngine, } from '@angular-modernizer/orchestration';
3
+ /** Errors spelled out in the summary; the rest is in `errors`. */
4
+ const SUMMARY_ERRORS = 5;
5
+ /** Text summary: status and step counts, the message, the first errors. */
6
+ function describeWorkflow(result) {
7
+ const c = result.counts;
8
+ const lines = [
9
+ `Workflow ${result.workflowId} ${result.status}: ${c.successfulSteps}/${c.totalSteps} step(s) succeeded, ` +
10
+ `${c.failedSteps} failed, ${c.skippedSteps} skipped in ${(c.totalDurationMs / 1000).toFixed(1)} s.`,
11
+ result.message,
12
+ ];
13
+ lines.push(...result.errors
14
+ .slice(0, SUMMARY_ERRORS)
15
+ .map((e) => `- ${e.stepId}: ${e.message}`));
16
+ return lines.join('\n');
17
+ }
8
18
  /**
9
19
  * Simple in-memory checkpoint manager
10
20
  */
@@ -24,8 +34,14 @@ class InMemoryCheckpointManager {
24
34
  * Tool executor that delegates to other MCP tools
25
35
  */
26
36
  class MCPToolExecutor {
37
+ signal;
27
38
  tools;
28
- constructor(tools) {
39
+ /**
40
+ * @param signal - Cancellation of the workflow call: passed to every step,
41
+ * so a running build ends; steps after a cancellation fail at once
42
+ */
43
+ constructor(tools, signal) {
44
+ this.signal = signal;
29
45
  this.tools = tools;
30
46
  }
31
47
  async executeTool(toolName, args) {
@@ -33,17 +49,37 @@ class MCPToolExecutor {
33
49
  if (!tool) {
34
50
  throw new Error(`Tool not found: ${toolName}`);
35
51
  }
36
- return tool.execute(args);
52
+ await yieldIfCancellable(this.signal);
53
+ if (this.signal?.aborted === true) {
54
+ throw new Error('Workflow cancelled by the client');
55
+ }
56
+ return tool.execute(args, this.signal === undefined ? {} : { signal: this.signal });
37
57
  }
38
58
  }
39
59
  /**
40
- * Orchestrate Migration MCP Tool
60
+ * MCP tool for executing multi-step migration workflows with dependency
61
+ * management, checkpoint/resume, and rollback support. Steps call the other
62
+ * registered tools (`setAvailableTools`); a cancelled request runs no further
63
+ * step.
41
64
  */
42
65
  export class OrchestrateMigrationTool {
43
66
  name = 'orchestrate-migration';
44
- description = 'Execute multi-step migration workflows with dependency management and checkpoint/resume';
67
+ title = 'Orchestrate Migration';
68
+ annotations = {
69
+ readOnlyHint: false,
70
+ destructiveHint: true,
71
+ idempotentHint: false,
72
+ openWorldHint: false,
73
+ };
74
+ description = 'Execute multi-step migration workflows with dependency management and checkpoint/resume. ' +
75
+ 'counts has the step counts and the duration; summary is a short text with the status, the counts and the first errors.';
76
+ /**
77
+ * JSON Schema of the tool arguments.
78
+ * @hidden
79
+ */
45
80
  inputSchema = {
46
81
  type: 'object',
82
+ additionalProperties: false,
47
83
  properties: {
48
84
  workflow: {
49
85
  type: 'object',
@@ -110,6 +146,92 @@ export class OrchestrateMigrationTool {
110
146
  },
111
147
  required: ['workflow'],
112
148
  };
149
+ /**
150
+ * JSON Schema of the tool result (`structuredContent`).
151
+ * @hidden
152
+ */
153
+ outputSchema = {
154
+ type: 'object',
155
+ properties: {
156
+ status: { type: 'string', enum: ['completed', 'failed', 'partial'] },
157
+ workflowId: { type: 'string' },
158
+ counts: {
159
+ type: 'object',
160
+ properties: {
161
+ totalSteps: { type: 'integer' },
162
+ successfulSteps: { type: 'integer' },
163
+ failedSteps: { type: 'integer' },
164
+ skippedSteps: { type: 'integer' },
165
+ totalDurationMs: { type: 'number' },
166
+ },
167
+ required: [
168
+ 'totalSteps',
169
+ 'successfulSteps',
170
+ 'failedSteps',
171
+ 'skippedSteps',
172
+ 'totalDurationMs',
173
+ ],
174
+ },
175
+ stepResults: {
176
+ type: 'array',
177
+ items: {
178
+ type: 'object',
179
+ properties: {
180
+ stepId: { type: 'string' },
181
+ name: { type: 'string' },
182
+ status: { type: 'string' },
183
+ durationMs: { type: 'number' },
184
+ error: { type: 'string' },
185
+ },
186
+ required: ['stepId', 'name', 'status', 'durationMs'],
187
+ },
188
+ },
189
+ checkpoints: {
190
+ type: 'array',
191
+ items: {
192
+ type: 'object',
193
+ properties: {
194
+ id: { type: 'string' },
195
+ stepId: { type: 'string' },
196
+ timestamp: { type: 'number' },
197
+ },
198
+ required: ['id', 'stepId', 'timestamp'],
199
+ },
200
+ },
201
+ errors: {
202
+ type: 'array',
203
+ items: {
204
+ type: 'object',
205
+ properties: {
206
+ stepId: { type: 'string' },
207
+ message: { type: 'string' },
208
+ stack: { type: 'string' },
209
+ },
210
+ required: ['stepId', 'message'],
211
+ },
212
+ },
213
+ finalCheckpoint: {
214
+ type: 'object',
215
+ properties: {
216
+ id: { type: 'string' },
217
+ canResume: { type: 'boolean' },
218
+ },
219
+ required: ['id', 'canResume'],
220
+ },
221
+ message: { type: 'string' },
222
+ summary: { type: 'string' },
223
+ },
224
+ required: [
225
+ 'status',
226
+ 'workflowId',
227
+ 'counts',
228
+ 'stepResults',
229
+ 'checkpoints',
230
+ 'errors',
231
+ 'message',
232
+ 'summary',
233
+ ],
234
+ };
113
235
  availableTools;
114
236
  checkpointManager;
115
237
  constructor() {
@@ -122,7 +244,11 @@ export class OrchestrateMigrationTool {
122
244
  setAvailableTools(tools) {
123
245
  this.availableTools = tools;
124
246
  }
125
- async execute(args) {
247
+ async execute(args, ctx = {}) {
248
+ const result = await this.runWorkflow(args, ctx);
249
+ return { ...result, summary: describeWorkflow(result) };
250
+ }
251
+ async runWorkflow(args, ctx) {
126
252
  const typedArgs = args;
127
253
  const { workflow, resumeFromCheckpoint, dryRun = false } = typedArgs;
128
254
  // Unknown tool names fail every run; report them before any step runs,
@@ -133,7 +259,7 @@ export class OrchestrateMigrationTool {
133
259
  }
134
260
  try {
135
261
  // Create tool executor
136
- const toolExecutor = new MCPToolExecutor(this.availableTools);
262
+ const toolExecutor = new MCPToolExecutor(this.availableTools, ctx.signal);
137
263
  // Create workflow engine
138
264
  const engine = new WorkflowEngine(toolExecutor, this.checkpointManager);
139
265
  // Execute workflow
@@ -141,8 +267,9 @@ export class OrchestrateMigrationTool {
141
267
  resumeFromCheckpoint,
142
268
  dryRun,
143
269
  onProgress: (state) => {
144
- // Progress reporting (could be enhanced with streaming)
145
- console.info(`Progress: ${state.progress.completedSteps}/${state.progress.totalSteps} (${state.progress.percentage.toFixed(1)}%)`);
270
+ const { completedSteps, totalSteps } = state.progress;
271
+ console.info(`Progress: ${completedSteps}/${totalSteps} (${state.progress.percentage.toFixed(1)}%)`);
272
+ ctx.progress?.(completedSteps, totalSteps, `${completedSteps}/${totalSteps} steps`);
146
273
  },
147
274
  onStepComplete: (stepResult) => {
148
275
  console.info(`✓ Step completed: ${stepResult.stepId} (${stepResult.status})`);
@@ -157,8 +284,8 @@ export class OrchestrateMigrationTool {
157
284
  catch (error) {
158
285
  return {
159
286
  status: 'failed',
160
- summary: {
161
- workflowId: workflow.id,
287
+ workflowId: workflow.id,
288
+ counts: {
162
289
  // steps may be malformed (that can be exactly why we ended up here)
163
290
  totalSteps: workflow.steps?.length ?? 0,
164
291
  successfulSteps: 0,
@@ -183,8 +310,8 @@ export class OrchestrateMigrationTool {
183
310
  const names = [...new Set(unknownSteps.map((step) => step.tool))];
184
311
  return {
185
312
  status: 'failed',
186
- summary: {
187
- workflowId: workflow.id,
313
+ workflowId: workflow.id,
314
+ counts: {
188
315
  totalSteps: workflow.steps.length,
189
316
  successfulSteps: 0,
190
317
  failedSteps: 0,
@@ -243,8 +370,8 @@ export class OrchestrateMigrationTool {
243
370
  }
244
371
  return {
245
372
  status: result.status,
246
- summary: {
247
- workflowId: result.workflowId,
373
+ workflowId: result.workflowId,
374
+ counts: {
248
375
  totalSteps: result.metrics.totalSteps,
249
376
  successfulSteps: result.metrics.successfulSteps,
250
377
  failedSteps: result.metrics.failedSteps,
@@ -1,6 +1,19 @@
1
+ import { type MCPTool, type ToolAnnotations } from '../types.js';
2
+ import { type StackFrame, type StackFrameFileIndex } from '@angular-modernizer/api';
3
+ /**
4
+ * Output of the parse-stack-trace tool.
5
+ */
6
+ export interface ParseStackTraceOutput {
7
+ /** All parsed frames (or only project frames when `projectFramesOnly` is true). */
8
+ frames: StackFrame[];
9
+ /** Number of frames that belong to the project. */
10
+ projectFrameCount: number;
11
+ /** Total number of frames found before any filtering. */
12
+ totalFrameCount: number;
13
+ /** Human-readable summary for LLM consumption. */
14
+ summary: string;
15
+ }
1
16
  /**
2
- * @angular-modernizer/adapter-mcp - Parse Stack Trace Tool
3
- *
4
17
  * MCP tool for parsing Node.js/Angular/Zone.js/browser stack traces into structured frames.
5
18
  * Maps each frame to its source file and classifies it as a project file or external dependency.
6
19
  *
@@ -16,31 +29,20 @@
16
29
  * // args: { stackTrace: error.stack, projectRoot: '/my/project/src' }
17
30
  * ```
18
31
  */
19
- import { type MCPTool } from '../types.js';
20
- import { type StackFrame, type StackFrameFileIndex } from '@angular-modernizer/api';
21
- /**
22
- * Output of the parse-stack-trace tool.
23
- */
24
- interface ParseStackTraceOutput {
25
- /** All parsed frames (or only project frames when `projectFramesOnly` is true). */
26
- frames: StackFrame[];
27
- /** Number of frames that belong to the project. */
28
- projectFrameCount: number;
29
- /** Total number of frames found before any filtering. */
30
- totalFrameCount: number;
31
- /** Human-readable summary for LLM consumption. */
32
- summary: string;
33
- }
34
- /**
35
- * MCP tool that parses stack traces into structured, LLM-consumable frames.
36
- */
37
32
  export declare class ParseStackTraceTool implements MCPTool {
38
33
  private readonly createFileIndex;
39
34
  readonly name = "parse-stack-trace";
35
+ readonly title = "Parse Stack Trace";
36
+ readonly annotations: ToolAnnotations;
40
37
  constructor(createFileIndex?: (projectRoot: string) => StackFrameFileIndex);
41
38
  readonly description: string;
39
+ /**
40
+ * JSON Schema of the tool arguments.
41
+ * @hidden
42
+ */
42
43
  readonly inputSchema: {
43
44
  type: string;
45
+ additionalProperties: boolean;
44
46
  properties: {
45
47
  stackTrace: {
46
48
  type: string;
@@ -58,8 +60,63 @@ export declare class ParseStackTraceTool implements MCPTool {
58
60
  };
59
61
  required: string[];
60
62
  };
63
+ /**
64
+ * JSON Schema of the tool result (`structuredContent`).
65
+ * @hidden
66
+ */
67
+ readonly outputSchema: {
68
+ type: string;
69
+ properties: {
70
+ frames: {
71
+ type: string;
72
+ items: {
73
+ type: string;
74
+ properties: {
75
+ file: {
76
+ type: string;
77
+ };
78
+ line: {
79
+ type: string;
80
+ };
81
+ col: {
82
+ type: string;
83
+ };
84
+ functionName: {
85
+ type: string;
86
+ };
87
+ isProjectFile: {
88
+ type: string;
89
+ };
90
+ resolvedFile: {
91
+ type: string;
92
+ };
93
+ resolvedFrom: {
94
+ type: string;
95
+ enum: string[];
96
+ };
97
+ candidates: {
98
+ type: string;
99
+ items: {
100
+ type: string;
101
+ };
102
+ };
103
+ };
104
+ required: string[];
105
+ };
106
+ };
107
+ projectFrameCount: {
108
+ type: string;
109
+ };
110
+ totalFrameCount: {
111
+ type: string;
112
+ };
113
+ summary: {
114
+ type: string;
115
+ };
116
+ };
117
+ required: string[];
118
+ };
61
119
  execute(args: Record<string, unknown>): Promise<ParseStackTraceOutput>;
62
120
  private buildSummary;
63
121
  }
64
- export {};
65
122
  //# sourceMappingURL=parse-stack-trace.d.ts.map
@@ -1,6 +1,6 @@
1
+ import { StackTraceParser, } from '@angular-modernizer/api';
2
+ import { createNodeStackFrameFileIndex } from './helpers/stack-frame-file-index.js';
1
3
  /**
2
- * @angular-modernizer/adapter-mcp - Parse Stack Trace Tool
3
- *
4
4
  * MCP tool for parsing Node.js/Angular/Zone.js/browser stack traces into structured frames.
5
5
  * Maps each frame to its source file and classifies it as a project file or external dependency.
6
6
  *
@@ -16,14 +16,16 @@
16
16
  * // args: { stackTrace: error.stack, projectRoot: '/my/project/src' }
17
17
  * ```
18
18
  */
19
- import { StackTraceParser, } from '@angular-modernizer/api';
20
- import { createNodeStackFrameFileIndex } from './helpers/stack-frame-file-index.js';
21
- /**
22
- * MCP tool that parses stack traces into structured, LLM-consumable frames.
23
- */
24
19
  export class ParseStackTraceTool {
25
20
  createFileIndex;
26
21
  name = 'parse-stack-trace';
22
+ title = 'Parse Stack Trace';
23
+ annotations = {
24
+ readOnlyHint: true,
25
+ destructiveHint: false,
26
+ idempotentHint: true,
27
+ openWorldHint: false,
28
+ };
27
29
  constructor(createFileIndex = createNodeStackFrameFileIndex) {
28
30
  this.createFileIndex = createFileIndex;
29
31
  }
@@ -33,8 +35,13 @@ export class ParseStackTraceTool {
33
35
  'Browser frames (http://host/src/..., webpack:///, ng:///, bare file names) are mapped ' +
34
36
  'onto project files via resolvedFile; an ambiguous file name lists candidates. ' +
35
37
  'Use as the first step in bug investigation when a stack trace is available.';
38
+ /**
39
+ * JSON Schema of the tool arguments.
40
+ * @hidden
41
+ */
36
42
  inputSchema = {
37
43
  type: 'object',
44
+ additionalProperties: false,
38
45
  properties: {
39
46
  stackTrace: {
40
47
  type: 'string',
@@ -52,6 +59,36 @@ export class ParseStackTraceTool {
52
59
  },
53
60
  required: ['stackTrace', 'projectRoot'],
54
61
  };
62
+ /**
63
+ * JSON Schema of the tool result (`structuredContent`).
64
+ * @hidden
65
+ */
66
+ outputSchema = {
67
+ type: 'object',
68
+ properties: {
69
+ frames: {
70
+ type: 'array',
71
+ items: {
72
+ type: 'object',
73
+ properties: {
74
+ file: { type: 'string' },
75
+ line: { type: 'integer' },
76
+ col: { type: 'integer' },
77
+ functionName: { type: 'string' },
78
+ isProjectFile: { type: 'boolean' },
79
+ resolvedFile: { type: 'string' },
80
+ resolvedFrom: { type: 'string', enum: ['url', 'basename'] },
81
+ candidates: { type: 'array', items: { type: 'string' } },
82
+ },
83
+ required: ['file', 'line', 'col', 'functionName', 'isProjectFile'],
84
+ },
85
+ },
86
+ projectFrameCount: { type: 'integer' },
87
+ totalFrameCount: { type: 'integer' },
88
+ summary: { type: 'string' },
89
+ },
90
+ required: ['frames', 'projectFrameCount', 'totalFrameCount', 'summary'],
91
+ };
55
92
  async execute(args) {
56
93
  const params = args;
57
94
  if (!params.stackTrace) {