@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,18 +1,73 @@
1
+ import { type MCPTool, type ToolAnnotations } from '../types.js';
1
2
  /**
2
- * @angular-modernizer/adapter-mcp - Validate Before Transform Tool
3
- *
4
- * MCP tool for validating code BEFORE transformation to ensure it's safe
5
- * to modify. Performs syntax, dependency, type, and schema validation.
3
+ * Validation result.
6
4
  */
7
- import { type MCPTool } from '../types.js';
5
+ export interface ValidationResult {
6
+ /**
7
+ * Whether validation passed (no errors).
8
+ */
9
+ valid: boolean;
10
+ /**
11
+ * Validation issues found.
12
+ */
13
+ issues: {
14
+ /** Check that reported the issue. */
15
+ type: 'syntax' | 'dependency' | 'type' | 'schema';
16
+ /** Severity; only errors make the file not valid. */
17
+ severity: 'error' | 'warning' | 'info';
18
+ /** Issue description. */
19
+ message: string;
20
+ /** File the issue was found in. */
21
+ filePath?: string;
22
+ /** Line of the issue (1-based). */
23
+ line?: number;
24
+ /** Column of the issue. */
25
+ column?: number;
26
+ /** Additional details of the issue. */
27
+ details?: string;
28
+ }[];
29
+ /**
30
+ * Validation duration in milliseconds.
31
+ */
32
+ duration: number;
33
+ /**
34
+ * Metadata about validation.
35
+ */
36
+ metadata: {
37
+ /** Validated file. */
38
+ filePath: string;
39
+ /** Whether syntax validation ran. */
40
+ syntaxValidation: boolean;
41
+ /** Whether dependency validation ran. */
42
+ dependencyValidation: boolean;
43
+ /** Whether type validation ran. */
44
+ typeValidation: boolean;
45
+ /** Whether schema validation ran. */
46
+ schemaValidation: boolean;
47
+ /** Schema used for schema validation. */
48
+ schema?: Record<string, unknown>;
49
+ };
50
+ /**
51
+ * Short text: verdict, issue counts per severity, and the first issues.
52
+ */
53
+ summary: string;
54
+ }
8
55
  /**
9
- * MCP tool for pre-transformation validation.
56
+ * MCP tool for validating code before a transformation to make sure it is
57
+ * safe to modify. Performs syntax, dependency, type, and schema validation.
10
58
  */
11
59
  export declare class ValidateBeforeTransformTool implements MCPTool {
12
60
  name: string;
61
+ title: string;
62
+ annotations: ToolAnnotations;
13
63
  description: string;
64
+ /**
65
+ * JSON Schema of the tool arguments.
66
+ * @hidden
67
+ */
14
68
  inputSchema: {
15
69
  type: string;
70
+ additionalProperties: boolean;
16
71
  properties: {
17
72
  filePath: {
18
73
  type: string;
@@ -45,7 +100,81 @@ export declare class ValidateBeforeTransformTool implements MCPTool {
45
100
  };
46
101
  required: string[];
47
102
  };
48
- execute(args: Record<string, unknown>): Promise<unknown>;
103
+ /**
104
+ * JSON Schema of the tool result (`structuredContent`).
105
+ * @hidden
106
+ */
107
+ outputSchema: {
108
+ type: string;
109
+ properties: {
110
+ valid: {
111
+ type: string;
112
+ };
113
+ issues: {
114
+ readonly type: "array";
115
+ readonly items: {
116
+ readonly type: "object";
117
+ readonly properties: {
118
+ readonly type: {
119
+ readonly type: "string";
120
+ };
121
+ readonly severity: {
122
+ readonly type: "string";
123
+ readonly enum: readonly ["error", "warning", "info"];
124
+ };
125
+ readonly message: {
126
+ readonly type: "string";
127
+ };
128
+ readonly filePath: {
129
+ readonly type: "string";
130
+ };
131
+ readonly line: {
132
+ readonly type: "integer";
133
+ };
134
+ readonly column: {
135
+ readonly type: "integer";
136
+ };
137
+ readonly details: {
138
+ readonly type: "string";
139
+ };
140
+ };
141
+ readonly required: readonly ["type", "severity", "message"];
142
+ };
143
+ };
144
+ duration: {
145
+ type: string;
146
+ };
147
+ metadata: {
148
+ type: string;
149
+ properties: {
150
+ filePath: {
151
+ type: string;
152
+ };
153
+ syntaxValidation: {
154
+ type: string;
155
+ };
156
+ dependencyValidation: {
157
+ type: string;
158
+ };
159
+ typeValidation: {
160
+ type: string;
161
+ };
162
+ schemaValidation: {
163
+ type: string;
164
+ };
165
+ schema: {
166
+ type: string;
167
+ };
168
+ };
169
+ required: string[];
170
+ };
171
+ summary: {
172
+ type: string;
173
+ };
174
+ };
175
+ required: string[];
176
+ };
177
+ execute(args: Record<string, unknown>): Promise<ValidationResult>;
49
178
  /**
50
179
  * Find the project root from a file path.
51
180
  */
@@ -1,22 +1,46 @@
1
- /**
2
- * @angular-modernizer/adapter-mcp - Validate Before Transform Tool
3
- *
4
- * MCP tool for validating code BEFORE transformation to ensure it's safe
5
- * to modify. Performs syntax, dependency, type, and schema validation.
6
- */
7
1
  import { findTsConfig } from './helpers/find-ts-config.js';
8
2
  import { PreTransformValidator, Kernel, } from '@angular-modernizer/core';
9
3
  import { AngularPlugin } from '@angular-modernizer/plugin-angular';
10
4
  import { readFileSync } from 'node:fs';
11
5
  import { resolve } from 'node:path';
6
+ import { VALIDATION_ISSUES_SCHEMA, issueCount, issueLines, } from './helpers/validation-output.js';
7
+ /** Text summary: verdict, checks, counts per severity and the first issues, errors first. */
8
+ function describeValidation(result) {
9
+ const checks = [
10
+ result.metadata.syntaxValidation ? 'syntax' : undefined,
11
+ result.metadata.dependencyValidation ? 'dependencies' : undefined,
12
+ result.metadata.typeValidation ? 'types' : undefined,
13
+ result.metadata.schemaValidation ? 'schema' : undefined,
14
+ ].filter((c) => c !== undefined);
15
+ return [
16
+ `${result.valid ? 'Valid' : 'Not valid'}: ${result.metadata.filePath} ` +
17
+ `(${checks.length > 0 ? checks.join(', ') : 'no checks'}; ${result.duration} ms); ` +
18
+ `${issueCount(result.issues)}.`,
19
+ ...issueLines(result.issues),
20
+ ].join('\n');
21
+ }
12
22
  /**
13
- * MCP tool for pre-transformation validation.
23
+ * MCP tool for validating code before a transformation to make sure it is
24
+ * safe to modify. Performs syntax, dependency, type, and schema validation.
14
25
  */
15
26
  export class ValidateBeforeTransformTool {
16
27
  name = 'validate-before-transform';
17
- description = 'Validate code before transformation to ensure it is safe to modify. Performs syntax, dependency, type, and schema validation.';
28
+ title = 'Validate Before Transform';
29
+ annotations = {
30
+ readOnlyHint: true,
31
+ destructiveHint: false,
32
+ idempotentHint: true,
33
+ openWorldHint: false,
34
+ };
35
+ description = 'Validate code before transformation to ensure it is safe to modify. Performs syntax, dependency, type, and schema validation. ' +
36
+ 'summary is a short text with the verdict, the issue counts and the first issues.';
37
+ /**
38
+ * JSON Schema of the tool arguments.
39
+ * @hidden
40
+ */
18
41
  inputSchema = {
19
42
  type: 'object',
43
+ additionalProperties: false,
20
44
  properties: {
21
45
  filePath: {
22
46
  type: 'string',
@@ -49,6 +73,38 @@ export class ValidateBeforeTransformTool {
49
73
  },
50
74
  required: ['filePath'],
51
75
  };
76
+ /**
77
+ * JSON Schema of the tool result (`structuredContent`).
78
+ * @hidden
79
+ */
80
+ outputSchema = {
81
+ type: 'object',
82
+ properties: {
83
+ valid: { type: 'boolean' },
84
+ issues: VALIDATION_ISSUES_SCHEMA,
85
+ duration: { type: 'number' },
86
+ metadata: {
87
+ type: 'object',
88
+ properties: {
89
+ filePath: { type: 'string' },
90
+ syntaxValidation: { type: 'boolean' },
91
+ dependencyValidation: { type: 'boolean' },
92
+ typeValidation: { type: 'boolean' },
93
+ schemaValidation: { type: 'boolean' },
94
+ schema: { type: 'object' },
95
+ },
96
+ required: [
97
+ 'filePath',
98
+ 'syntaxValidation',
99
+ 'dependencyValidation',
100
+ 'typeValidation',
101
+ 'schemaValidation',
102
+ ],
103
+ },
104
+ summary: { type: 'string' },
105
+ },
106
+ required: ['valid', 'issues', 'duration', 'metadata', 'summary'],
107
+ };
52
108
  async execute(args) {
53
109
  const typedArgs = args;
54
110
  const { filePath, validateSyntax, validateDependencies, validateTypes, validateSchema, schema, } = typedArgs;
@@ -107,7 +163,7 @@ export class ValidateBeforeTransformTool {
107
163
  schema,
108
164
  },
109
165
  };
110
- return response;
166
+ return { ...response, summary: describeValidation(response) };
111
167
  }
112
168
  /**
113
169
  * Find the project root from a file path.
@@ -1,16 +1,9 @@
1
- /**
2
- * @angular-modernizer/adapter-mcp - Validate Project Compatibility Tool
3
- *
4
- * MCP tool for validating project compatibility with the parser before running transformations.
5
- * Detects incompatibility patterns such as external decorators, path aliases, and complex constructor
6
- * patterns that may cause parsing issues. Provides actionable recommendations for parser selection.
7
- */
8
- import { type MCPTool } from '../types.js';
1
+ import { type MCPTool, type ToolAnnotations } from '../types.js';
9
2
  import { type CompatibilityCheck, type ProjectType, type OverallCompatibility, type RecommendedParser } from '@angular-modernizer/core';
10
3
  /**
11
4
  * Output result of project compatibility validation.
12
5
  */
13
- interface ValidateProjectCompatibilityOutput {
6
+ export interface ValidateProjectCompatibilityOutput {
14
7
  /**
15
8
  * Project type classification.
16
9
  */
@@ -43,25 +36,41 @@ interface ValidateProjectCompatibilityOutput {
43
36
  * User-facing formatted message with summary and recommendations.
44
37
  */
45
38
  message: string;
39
+ /**
40
+ * Short text: verdict, project type, parser, success rate and the failed checks.
41
+ */
42
+ summary: string;
46
43
  }
47
44
  /**
48
- * MCP tool for validating project compatibility with the parser.
45
+ * MCP tool for validating project compatibility with the parser before
46
+ * running transformations. Detects incompatibility patterns such as external
47
+ * decorators, path aliases and complex constructor patterns that may cause
48
+ * parsing issues, and recommends a parser strategy.
49
49
  *
50
- * Performs Phase 0 validation to detect incompatibility patterns before running transformations:
51
- * - Detects custom decorators (@Export*, @AppPermissionRequired, etc.)
50
+ * @remarks
51
+ * Checks:
52
+ * - Detects custom decorators (any decorator outside the known frameworks)
52
53
  * - Detects path aliases (@shared/, @domain/, @features/, @core/, @lib/)
53
54
  * - Detects complex constructor patterns (importService variables, public params)
54
55
  * - Runs sample transformation test to verify actual compatibility
55
56
  * - Classifies project type and recommends parser strategy
56
57
  *
57
- * Prevents wasted effort on 35-transformation tests that will fail due to parser incompatibilities.
58
- * Completes validation in <5 seconds for typical projects.
58
+ * Avoids running transformations that would fail due to parser
59
+ * incompatibilities. Completes validation in under 5 seconds for typical
60
+ * projects.
59
61
  */
60
62
  export declare class ValidateProjectCompatibilityTool implements MCPTool {
61
63
  name: string;
64
+ title: string;
65
+ annotations: ToolAnnotations;
62
66
  description: string;
67
+ /**
68
+ * JSON Schema of the tool arguments.
69
+ * @hidden
70
+ */
63
71
  inputSchema: {
64
72
  type: string;
73
+ additionalProperties: boolean;
65
74
  properties: {
66
75
  projectPath: {
67
76
  type: string;
@@ -89,6 +98,65 @@ export declare class ValidateProjectCompatibilityTool implements MCPTool {
89
98
  };
90
99
  required: string[];
91
100
  };
101
+ /**
102
+ * JSON Schema of the tool result (`structuredContent`).
103
+ * @hidden
104
+ */
105
+ outputSchema: {
106
+ type: string;
107
+ properties: {
108
+ projectType: {
109
+ type: string;
110
+ };
111
+ overallCompatibility: {
112
+ type: string;
113
+ };
114
+ recommendedParser: {
115
+ type: string;
116
+ };
117
+ estimatedSuccessRate: {
118
+ type: string;
119
+ };
120
+ filesSampled: {
121
+ type: string;
122
+ };
123
+ validationDuration: {
124
+ type: string;
125
+ };
126
+ checks: {
127
+ type: string;
128
+ items: {
129
+ type: string;
130
+ properties: {
131
+ check: {
132
+ type: string;
133
+ };
134
+ passed: {
135
+ type: string;
136
+ };
137
+ severity: {
138
+ type: string;
139
+ enum: string[];
140
+ };
141
+ message: {
142
+ type: string;
143
+ };
144
+ recommendation: {
145
+ type: string;
146
+ };
147
+ };
148
+ required: string[];
149
+ };
150
+ };
151
+ message: {
152
+ type: string;
153
+ };
154
+ summary: {
155
+ type: string;
156
+ };
157
+ };
158
+ required: string[];
159
+ };
92
160
  execute(args: Record<string, unknown>): Promise<ValidateProjectCompatibilityOutput>;
93
161
  /**
94
162
  * Formats user-facing message with compatibility status, issues, and recommendations.
@@ -115,5 +183,4 @@ export declare class ValidateProjectCompatibilityTool implements MCPTool {
115
183
  */
116
184
  private getOverallRecommendation;
117
185
  }
118
- export {};
119
186
  //# sourceMappingURL=validate-project-compatibility.d.ts.map
@@ -1,30 +1,56 @@
1
- /**
2
- * @angular-modernizer/adapter-mcp - Validate Project Compatibility Tool
3
- *
4
- * MCP tool for validating project compatibility with the parser before running transformations.
5
- * Detects incompatibility patterns such as external decorators, path aliases, and complex constructor
6
- * patterns that may cause parsing issues. Provides actionable recommendations for parser selection.
7
- */
8
1
  import { ProjectCompatibilityValidator, } from '@angular-modernizer/core';
9
2
  import { existsSync } from 'node:fs';
3
+ /** Text summary: verdict, parser, success rate, sample size and one line per failed check. */
4
+ function describeProjectCompatibility(output) {
5
+ const failed = output.checks.filter((c) => !c.passed);
6
+ const lines = [
7
+ `${output.overallCompatibility} (${output.projectType}); recommended parser ${output.recommendedParser}; ` +
8
+ `estimated success rate ${Math.round(output.estimatedSuccessRate * 100)}%; ` +
9
+ `${output.filesSampled} file(s) sampled in ${output.validationDuration} ms; ` +
10
+ `${failed.length} of ${output.checks.length} check(s) failed${failed.length > 0 ? ':' : '.'}`,
11
+ ];
12
+ for (const check of failed) {
13
+ const advice = check.recommendation === undefined ? '' : ` ${check.recommendation}`;
14
+ lines.push(`- ${check.severity} ${check.check}: ${check.message}${advice}`);
15
+ }
16
+ return lines.join('\n');
17
+ }
10
18
  /**
11
- * MCP tool for validating project compatibility with the parser.
19
+ * MCP tool for validating project compatibility with the parser before
20
+ * running transformations. Detects incompatibility patterns such as external
21
+ * decorators, path aliases and complex constructor patterns that may cause
22
+ * parsing issues, and recommends a parser strategy.
12
23
  *
13
- * Performs Phase 0 validation to detect incompatibility patterns before running transformations:
14
- * - Detects custom decorators (@Export*, @AppPermissionRequired, etc.)
24
+ * @remarks
25
+ * Checks:
26
+ * - Detects custom decorators (any decorator outside the known frameworks)
15
27
  * - Detects path aliases (@shared/, @domain/, @features/, @core/, @lib/)
16
28
  * - Detects complex constructor patterns (importService variables, public params)
17
29
  * - Runs sample transformation test to verify actual compatibility
18
30
  * - Classifies project type and recommends parser strategy
19
31
  *
20
- * Prevents wasted effort on 35-transformation tests that will fail due to parser incompatibilities.
21
- * Completes validation in <5 seconds for typical projects.
32
+ * Avoids running transformations that would fail due to parser
33
+ * incompatibilities. Completes validation in under 5 seconds for typical
34
+ * projects.
22
35
  */
23
36
  export class ValidateProjectCompatibilityTool {
24
37
  name = 'validate-project-compatibility';
25
- description = 'Validate project compatibility with the parser before running transformations. Detects incompatibility patterns such as external decorators, path aliases, and complex constructor patterns. Returns project type, compatibility status, recommended parser, estimated success rate, and actionable recommendations. Prevents wasted effort on transformation tests that will fail. Completes in <5 seconds.';
38
+ title = 'Validate Project Compatibility';
39
+ annotations = {
40
+ readOnlyHint: true,
41
+ destructiveHint: false,
42
+ idempotentHint: true,
43
+ openWorldHint: false,
44
+ };
45
+ description = 'Validate project compatibility with the parser before running transformations. Detects incompatibility patterns such as external decorators, path aliases, and complex constructor patterns. Returns project type, compatibility status, recommended parser, estimated success rate, and actionable recommendations. Prevents wasted effort on transformation tests that will fail. Completes in <5 seconds. ' +
46
+ 'summary is a short text with the verdict, the parser and the failed checks.';
47
+ /**
48
+ * JSON Schema of the tool arguments.
49
+ * @hidden
50
+ */
26
51
  inputSchema = {
27
52
  type: 'object',
53
+ additionalProperties: false,
28
54
  properties: {
29
55
  projectPath: {
30
56
  type: 'string',
@@ -52,6 +78,48 @@ export class ValidateProjectCompatibilityTool {
52
78
  },
53
79
  required: ['projectPath'],
54
80
  };
81
+ /**
82
+ * JSON Schema of the tool result (`structuredContent`).
83
+ * @hidden
84
+ */
85
+ outputSchema = {
86
+ type: 'object',
87
+ properties: {
88
+ projectType: { type: 'string' },
89
+ overallCompatibility: { type: 'string' },
90
+ recommendedParser: { type: 'string' },
91
+ estimatedSuccessRate: { type: 'number' },
92
+ filesSampled: { type: 'integer' },
93
+ validationDuration: { type: 'number' },
94
+ checks: {
95
+ type: 'array',
96
+ items: {
97
+ type: 'object',
98
+ properties: {
99
+ check: { type: 'string' },
100
+ passed: { type: 'boolean' },
101
+ severity: { type: 'string', enum: ['blocker', 'warning', 'info'] },
102
+ message: { type: 'string' },
103
+ recommendation: { type: 'string' },
104
+ },
105
+ required: ['check', 'passed', 'severity', 'message'],
106
+ },
107
+ },
108
+ message: { type: 'string' },
109
+ summary: { type: 'string' },
110
+ },
111
+ required: [
112
+ 'projectType',
113
+ 'overallCompatibility',
114
+ 'recommendedParser',
115
+ 'estimatedSuccessRate',
116
+ 'filesSampled',
117
+ 'validationDuration',
118
+ 'checks',
119
+ 'message',
120
+ 'summary',
121
+ ],
122
+ };
55
123
  async execute(args) {
56
124
  const params = args;
57
125
  if (!params.projectPath) {
@@ -72,7 +140,7 @@ export class ValidateProjectCompatibilityTool {
72
140
  const report = await validator.validateProject(projectPath);
73
141
  // Format user-facing message
74
142
  const message = this.formatMessage(report);
75
- return {
143
+ const output = {
76
144
  projectType: report.projectType,
77
145
  overallCompatibility: report.overallCompatibility,
78
146
  recommendedParser: report.recommendedParser,
@@ -82,6 +150,7 @@ export class ValidateProjectCompatibilityTool {
82
150
  checks: report.checks,
83
151
  message,
84
152
  };
153
+ return { ...output, summary: describeProjectCompatibility(output) };
85
154
  }
86
155
  /**
87
156
  * Formats user-facing message with compatibility status, issues, and recommendations.
@@ -157,7 +226,7 @@ export class ValidateProjectCompatibilityTool {
157
226
  case 'standard-angular':
158
227
  return 'Standard Angular (no custom patterns)';
159
228
  case 'external-decorators':
160
- return 'External Decorators (@Export*, @AppPermissionRequired, etc.)';
229
+ return 'External Decorators (decorators outside the known frameworks)';
161
230
  case 'custom':
162
231
  return 'Custom (multiple complexity factors)';
163
232
  case 'unknown':