@angular-modernizer/adapter-mcp 0.2.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 (255) hide show
  1. package/README.md +188 -235
  2. package/dist/cli.js +77 -27
  3. package/dist/index.d.ts +11 -3
  4. package/dist/index.js +10 -2
  5. package/dist/mcp-watcher.d.ts +6 -1
  6. package/dist/mcp-watcher.js +14 -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 +41 -12
  10. package/dist/server/mcp-server.js +113 -94
  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/stdio-guard.d.ts +20 -0
  16. package/dist/server/stdio-guard.js +48 -0
  17. package/dist/server/tool-registry.d.ts +3 -2
  18. package/dist/server/tool-registry.js +5 -5
  19. package/dist/tools/analyze-build-impact.d.ts +346 -14
  20. package/dist/tools/analyze-build-impact.js +315 -31
  21. package/dist/tools/analyze-core-to-shared.d.ts +134 -4
  22. package/dist/tools/analyze-core-to-shared.js +113 -9
  23. package/dist/tools/analyze-parser-performance.d.ts +200 -7
  24. package/dist/tools/analyze-parser-performance.js +108 -47
  25. package/dist/tools/analyze-project.d.ts +267 -5
  26. package/dist/tools/analyze-project.js +196 -8
  27. package/dist/tools/check-incremental-compatibility.d.ts +61 -1
  28. package/dist/tools/check-incremental-compatibility.js +58 -2
  29. package/dist/tools/collect-feedback.d.ts +199 -10
  30. package/dist/tools/collect-feedback.js +171 -99
  31. package/dist/tools/compare-health.d.ts +356 -0
  32. package/dist/tools/compare-health.js +472 -0
  33. package/dist/tools/extract-libraries.d.ts +156 -4
  34. package/dist/tools/extract-libraries.js +115 -10
  35. package/dist/tools/find-angular-symbol.d.ts +98 -9
  36. package/dist/tools/find-angular-symbol.js +104 -12
  37. package/dist/tools/find-component-hosts.d.ts +684 -0
  38. package/dist/tools/find-component-hosts.js +441 -0
  39. package/dist/tools/find-usages.d.ts +99 -4
  40. package/dist/tools/find-usages.js +131 -11
  41. package/dist/tools/get-bootstrap-execution.d.ts +258 -0
  42. package/dist/tools/get-bootstrap-execution.js +324 -0
  43. package/dist/tools/get-call-graph.d.ts +139 -4
  44. package/dist/tools/get-call-graph.js +123 -13
  45. package/dist/tools/get-operation-progress-tool.d.ts +114 -2
  46. package/dist/tools/get-operation-progress-tool.js +114 -7
  47. package/dist/tools/get-operation-progress.d.ts +1 -1
  48. package/dist/tools/get-operation-progress.js +5 -5
  49. package/dist/tools/helpers/analysis-output.d.ts +177 -0
  50. package/dist/tools/helpers/analysis-output.js +165 -0
  51. package/dist/tools/helpers/build-schemas.d.ts +36 -0
  52. package/dist/tools/helpers/build-schemas.js +23 -0
  53. package/dist/tools/helpers/citation-file-source.d.ts +10 -0
  54. package/dist/tools/helpers/citation-file-source.js +82 -0
  55. package/dist/tools/helpers/compact-output.d.ts +61 -0
  56. package/dist/tools/helpers/compact-output.js +83 -0
  57. package/dist/tools/helpers/finding-window.d.ts +43 -0
  58. package/dist/tools/helpers/finding-window.js +64 -0
  59. package/dist/tools/helpers/health-delta.d.ts +86 -0
  60. package/dist/tools/helpers/health-delta.js +239 -0
  61. package/dist/tools/helpers/investigation-schemas.d.ts +93 -0
  62. package/dist/tools/helpers/investigation-schemas.js +48 -0
  63. package/dist/tools/helpers/library-imports.d.ts +57 -0
  64. package/dist/tools/helpers/library-imports.js +151 -0
  65. package/dist/tools/helpers/load-source-files.d.ts +30 -0
  66. package/dist/tools/helpers/load-source-files.js +34 -0
  67. package/dist/tools/helpers/output-contract.d.ts +32 -0
  68. package/dist/tools/helpers/output-contract.js +32 -0
  69. package/dist/tools/helpers/platform-root-resolver.d.ts +55 -25
  70. package/dist/tools/helpers/platform-root-resolver.js +75 -48
  71. package/dist/tools/helpers/process-output.d.ts +19 -0
  72. package/dist/tools/helpers/process-output.js +31 -0
  73. package/dist/tools/helpers/project-cache.d.ts +184 -0
  74. package/dist/tools/helpers/project-cache.js +331 -0
  75. package/dist/tools/helpers/project-decorators.d.ts +14 -0
  76. package/dist/tools/helpers/project-decorators.js +22 -0
  77. package/dist/tools/helpers/rule-matcher.js +5 -0
  78. package/dist/tools/helpers/rule-runner.d.ts +72 -0
  79. package/dist/tools/helpers/rule-runner.js +131 -0
  80. package/dist/tools/helpers/scan-cache.d.ts +22 -0
  81. package/dist/tools/helpers/scan-cache.js +34 -0
  82. package/dist/tools/helpers/scan-plan.d.ts +48 -0
  83. package/dist/tools/helpers/scan-plan.js +166 -0
  84. package/dist/tools/helpers/scope-paths.d.ts +17 -0
  85. package/dist/tools/helpers/scope-paths.js +32 -0
  86. package/dist/tools/helpers/stack-frame-file-index.d.ts +10 -0
  87. package/dist/tools/helpers/stack-frame-file-index.js +71 -0
  88. package/dist/tools/helpers/tool-context.d.ts +60 -0
  89. package/dist/tools/helpers/tool-context.js +82 -0
  90. package/dist/tools/helpers/transform-safety.d.ts +40 -0
  91. package/dist/tools/helpers/transform-safety.js +87 -0
  92. package/dist/tools/helpers/validation-output.d.ts +53 -0
  93. package/dist/tools/helpers/validation-output.js +48 -0
  94. package/dist/tools/inspect-form-group.d.ts +324 -0
  95. package/dist/tools/inspect-form-group.js +279 -0
  96. package/dist/tools/inspect-i18n.d.ts +466 -0
  97. package/dist/tools/inspect-i18n.js +400 -0
  98. package/dist/tools/inspect-template.d.ts +320 -0
  99. package/dist/tools/inspect-template.js +324 -0
  100. package/dist/tools/learn-patterns.d.ts +122 -1
  101. package/dist/tools/learn-patterns.js +97 -2
  102. package/dist/tools/list-imports.d.ts +128 -11
  103. package/dist/tools/list-imports.js +128 -8
  104. package/dist/tools/orchestrate-migration.d.ts +129 -5
  105. package/dist/tools/orchestrate-migration.js +166 -12
  106. package/dist/tools/parse-stack-trace.d.ts +59 -2
  107. package/dist/tools/parse-stack-trace.js +52 -4
  108. package/dist/tools/plan-migration.d.ts +418 -1
  109. package/dist/tools/plan-migration.js +355 -8
  110. package/dist/tools/resolve-type.d.ts +42 -1
  111. package/dist/tools/resolve-type.js +37 -4
  112. package/dist/tools/review-feedback.d.ts +206 -11
  113. package/dist/tools/review-feedback.js +132 -51
  114. package/dist/tools/rollback-changes.d.ts +79 -2
  115. package/dist/tools/rollback-changes.js +66 -14
  116. package/dist/tools/run-angular-cli.d.ts +45 -2
  117. package/dist/tools/run-angular-cli.js +67 -7
  118. package/dist/tools/run-build.d.ts +114 -2
  119. package/dist/tools/run-build.js +117 -8
  120. package/dist/tools/run-schematic.d.ts +70 -2
  121. package/dist/tools/run-schematic.js +104 -10
  122. package/dist/tools/scan-all.d.ts +24 -16
  123. package/dist/tools/scan-all.js +145 -137
  124. package/dist/tools/scan-angular.d.ts +20 -11
  125. package/dist/tools/scan-angular.js +52 -24
  126. package/dist/tools/scan-architecture.d.ts +42 -14
  127. package/dist/tools/scan-architecture.js +206 -163
  128. package/dist/tools/scan-solid.d.ts +20 -11
  129. package/dist/tools/scan-solid.js +52 -24
  130. package/dist/tools/search-codebase.d.ts +85 -1
  131. package/dist/tools/search-codebase.js +61 -4
  132. package/dist/tools/server-status.d.ts +370 -0
  133. package/dist/tools/server-status.js +369 -0
  134. package/dist/tools/suggest-improvements.d.ts +97 -5
  135. package/dist/tools/suggest-improvements.js +80 -44
  136. package/dist/tools/trace-output-flow.d.ts +791 -0
  137. package/dist/tools/trace-output-flow.js +668 -0
  138. package/dist/tools/transform-code-batch.d.ts +3 -0
  139. package/dist/tools/transform-code-batch.js +10 -5
  140. package/dist/tools/transform-code.d.ts +335 -12
  141. package/dist/tools/transform-code.js +649 -608
  142. package/dist/tools/validate-before-transform.d.ts +116 -2
  143. package/dist/tools/validate-before-transform.js +55 -2
  144. package/dist/tools/validate-project-compatibility.d.ts +64 -2
  145. package/dist/tools/validate-project-compatibility.js +67 -4
  146. package/dist/tools/validate-transformation.d.ts +220 -2
  147. package/dist/tools/validate-transformation.js +113 -15
  148. package/dist/tools/verify-citations.d.ts +181 -0
  149. package/dist/tools/verify-citations.js +218 -0
  150. package/dist/types.d.ts +45 -1
  151. package/dist/utils/format-tool-response.d.ts +22 -59
  152. package/dist/utils/format-tool-response.js +25 -134
  153. package/package.json +30 -13
  154. package/dist/cli.d.ts.map +0 -1
  155. package/dist/cli.js.map +0 -1
  156. package/dist/core/project-analyzer.d.ts.map +0 -1
  157. package/dist/core/project-analyzer.js.map +0 -1
  158. package/dist/index.d.ts.map +0 -1
  159. package/dist/index.js.map +0 -1
  160. package/dist/mcp-watcher.d.ts.map +0 -1
  161. package/dist/mcp-watcher.js.map +0 -1
  162. package/dist/server/json-rpc-handler.d.ts +0 -57
  163. package/dist/server/json-rpc-handler.d.ts.map +0 -1
  164. package/dist/server/json-rpc-handler.js +0 -222
  165. package/dist/server/json-rpc-handler.js.map +0 -1
  166. package/dist/server/mcp-server.d.ts.map +0 -1
  167. package/dist/server/mcp-server.js.map +0 -1
  168. package/dist/server/tool-registry.d.ts.map +0 -1
  169. package/dist/server/tool-registry.js.map +0 -1
  170. package/dist/streaming/progress-store.d.ts.map +0 -1
  171. package/dist/streaming/progress-store.js.map +0 -1
  172. package/dist/tools/analyze-build-impact.d.ts.map +0 -1
  173. package/dist/tools/analyze-build-impact.js.map +0 -1
  174. package/dist/tools/analyze-core-to-shared.d.ts.map +0 -1
  175. package/dist/tools/analyze-core-to-shared.js.map +0 -1
  176. package/dist/tools/analyze-parser-performance.d.ts.map +0 -1
  177. package/dist/tools/analyze-parser-performance.js.map +0 -1
  178. package/dist/tools/analyze-project.d.ts.map +0 -1
  179. package/dist/tools/analyze-project.js.map +0 -1
  180. package/dist/tools/check-incremental-compatibility.d.ts.map +0 -1
  181. package/dist/tools/check-incremental-compatibility.js.map +0 -1
  182. package/dist/tools/collect-feedback.d.ts.map +0 -1
  183. package/dist/tools/collect-feedback.js.map +0 -1
  184. package/dist/tools/extract-libraries.d.ts.map +0 -1
  185. package/dist/tools/extract-libraries.js.map +0 -1
  186. package/dist/tools/find-angular-symbol.d.ts.map +0 -1
  187. package/dist/tools/find-angular-symbol.js.map +0 -1
  188. package/dist/tools/find-usages.d.ts.map +0 -1
  189. package/dist/tools/find-usages.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/feedback-analyzer.d.ts.map +0 -1
  197. package/dist/tools/helpers/feedback-analyzer.js.map +0 -1
  198. package/dist/tools/helpers/find-ts-config.d.ts.map +0 -1
  199. package/dist/tools/helpers/find-ts-config.js.map +0 -1
  200. package/dist/tools/helpers/platform-root-resolver.d.ts.map +0 -1
  201. package/dist/tools/helpers/platform-root-resolver.js.map +0 -1
  202. package/dist/tools/helpers/rule-matcher.d.ts.map +0 -1
  203. package/dist/tools/helpers/rule-matcher.js.map +0 -1
  204. package/dist/tools/helpers/suggestion-generator.d.ts.map +0 -1
  205. package/dist/tools/helpers/suggestion-generator.js.map +0 -1
  206. package/dist/tools/learn-patterns.d.ts.map +0 -1
  207. package/dist/tools/learn-patterns.js.map +0 -1
  208. package/dist/tools/list-imports.d.ts.map +0 -1
  209. package/dist/tools/list-imports.js.map +0 -1
  210. package/dist/tools/orchestrate-migration.d.ts.map +0 -1
  211. package/dist/tools/orchestrate-migration.js.map +0 -1
  212. package/dist/tools/parse-stack-trace.d.ts.map +0 -1
  213. package/dist/tools/parse-stack-trace.js.map +0 -1
  214. package/dist/tools/plan-migration.d.ts.map +0 -1
  215. package/dist/tools/plan-migration.js.map +0 -1
  216. package/dist/tools/resolve-type.d.ts.map +0 -1
  217. package/dist/tools/resolve-type.js.map +0 -1
  218. package/dist/tools/review-feedback.d.ts.map +0 -1
  219. package/dist/tools/review-feedback.js.map +0 -1
  220. package/dist/tools/rollback-changes.d.ts.map +0 -1
  221. package/dist/tools/rollback-changes.js.map +0 -1
  222. package/dist/tools/run-angular-cli.d.ts.map +0 -1
  223. package/dist/tools/run-angular-cli.js.map +0 -1
  224. package/dist/tools/run-build.d.ts.map +0 -1
  225. package/dist/tools/run-build.js.map +0 -1
  226. package/dist/tools/run-schematic.d.ts.map +0 -1
  227. package/dist/tools/run-schematic.js.map +0 -1
  228. package/dist/tools/scan-all.d.ts.map +0 -1
  229. package/dist/tools/scan-all.js.map +0 -1
  230. package/dist/tools/scan-angular.d.ts.map +0 -1
  231. package/dist/tools/scan-angular.js.map +0 -1
  232. package/dist/tools/scan-architecture.d.ts.map +0 -1
  233. package/dist/tools/scan-architecture.js.map +0 -1
  234. package/dist/tools/scan-solid.d.ts.map +0 -1
  235. package/dist/tools/scan-solid.js.map +0 -1
  236. package/dist/tools/search-codebase.d.ts.map +0 -1
  237. package/dist/tools/search-codebase.js.map +0 -1
  238. package/dist/tools/shared/scan-types.d.ts.map +0 -1
  239. package/dist/tools/shared/scan-types.js.map +0 -1
  240. package/dist/tools/suggest-improvements.d.ts.map +0 -1
  241. package/dist/tools/suggest-improvements.js.map +0 -1
  242. package/dist/tools/transform-code-batch.d.ts.map +0 -1
  243. package/dist/tools/transform-code-batch.js.map +0 -1
  244. package/dist/tools/transform-code.d.ts.map +0 -1
  245. package/dist/tools/transform-code.js.map +0 -1
  246. package/dist/tools/validate-before-transform.d.ts.map +0 -1
  247. package/dist/tools/validate-before-transform.js.map +0 -1
  248. package/dist/tools/validate-project-compatibility.d.ts.map +0 -1
  249. package/dist/tools/validate-project-compatibility.js.map +0 -1
  250. package/dist/tools/validate-transformation.d.ts.map +0 -1
  251. package/dist/tools/validate-transformation.js.map +0 -1
  252. package/dist/types.d.ts.map +0 -1
  253. package/dist/types.js.map +0 -1
  254. package/dist/utils/format-tool-response.d.ts.map +0 -1
  255. package/dist/utils/format-tool-response.js.map +0 -1
@@ -4,15 +4,58 @@
4
4
  * MCP tool for validating code BEFORE transformation to ensure it's safe
5
5
  * to modify. Performs syntax, dependency, type, and schema validation.
6
6
  */
7
- import { type MCPTool } from '../types.js';
7
+ import { type MCPTool, type ToolAnnotations } from '../types.js';
8
+ /**
9
+ * Validation result.
10
+ */
11
+ interface ValidationResult {
12
+ /**
13
+ * Whether validation passed (no errors).
14
+ */
15
+ valid: boolean;
16
+ /**
17
+ * Validation issues found.
18
+ */
19
+ issues: {
20
+ type: 'syntax' | 'dependency' | 'type' | 'schema';
21
+ severity: 'error' | 'warning' | 'info';
22
+ message: string;
23
+ filePath?: string;
24
+ line?: number;
25
+ column?: number;
26
+ details?: string;
27
+ }[];
28
+ /**
29
+ * Validation duration in milliseconds.
30
+ */
31
+ duration: number;
32
+ /**
33
+ * Metadata about validation.
34
+ */
35
+ metadata: {
36
+ filePath: string;
37
+ syntaxValidation: boolean;
38
+ dependencyValidation: boolean;
39
+ typeValidation: boolean;
40
+ schemaValidation: boolean;
41
+ schema?: Record<string, unknown>;
42
+ };
43
+ /**
44
+ * Short text: verdict, issue counts per severity, and the first issues.
45
+ */
46
+ summary: string;
47
+ }
8
48
  /**
9
49
  * MCP tool for pre-transformation validation.
10
50
  */
11
51
  export declare class ValidateBeforeTransformTool implements MCPTool {
12
52
  name: string;
53
+ title: string;
54
+ annotations: ToolAnnotations;
13
55
  description: string;
14
56
  inputSchema: {
15
57
  type: string;
58
+ additionalProperties: boolean;
16
59
  properties: {
17
60
  filePath: {
18
61
  type: string;
@@ -45,10 +88,81 @@ export declare class ValidateBeforeTransformTool implements MCPTool {
45
88
  };
46
89
  required: string[];
47
90
  };
48
- execute(args: Record<string, unknown>): Promise<unknown>;
91
+ outputSchema: {
92
+ type: string;
93
+ properties: {
94
+ valid: {
95
+ type: string;
96
+ };
97
+ issues: {
98
+ readonly type: "array";
99
+ readonly items: {
100
+ readonly type: "object";
101
+ readonly properties: {
102
+ readonly type: {
103
+ readonly type: "string";
104
+ };
105
+ readonly severity: {
106
+ readonly type: "string";
107
+ readonly enum: readonly ["error", "warning", "info"];
108
+ };
109
+ readonly message: {
110
+ readonly type: "string";
111
+ };
112
+ readonly filePath: {
113
+ readonly type: "string";
114
+ };
115
+ readonly line: {
116
+ readonly type: "integer";
117
+ };
118
+ readonly column: {
119
+ readonly type: "integer";
120
+ };
121
+ readonly details: {
122
+ readonly type: "string";
123
+ };
124
+ };
125
+ readonly required: readonly ["type", "severity", "message"];
126
+ };
127
+ };
128
+ duration: {
129
+ type: string;
130
+ };
131
+ metadata: {
132
+ type: string;
133
+ properties: {
134
+ filePath: {
135
+ type: string;
136
+ };
137
+ syntaxValidation: {
138
+ type: string;
139
+ };
140
+ dependencyValidation: {
141
+ type: string;
142
+ };
143
+ typeValidation: {
144
+ type: string;
145
+ };
146
+ schemaValidation: {
147
+ type: string;
148
+ };
149
+ schema: {
150
+ type: string;
151
+ };
152
+ };
153
+ required: string[];
154
+ };
155
+ summary: {
156
+ type: string;
157
+ };
158
+ };
159
+ required: string[];
160
+ };
161
+ execute(args: Record<string, unknown>): Promise<ValidationResult>;
49
162
  /**
50
163
  * Find the project root from a file path.
51
164
  */
52
165
  private findProjectRoot;
53
166
  }
167
+ export {};
54
168
  //# sourceMappingURL=validate-before-transform.d.ts.map
@@ -9,14 +9,39 @@ import { PreTransformValidator, Kernel, } from '@angular-modernizer/core';
9
9
  import { AngularPlugin } from '@angular-modernizer/plugin-angular';
10
10
  import { readFileSync } from 'node:fs';
11
11
  import { resolve } from 'node:path';
12
+ import { VALIDATION_ISSUES_SCHEMA, issueCount, issueLines, } from './helpers/validation-output.js';
13
+ /** Text summary: verdict, checks, counts per severity and the first issues, errors first. */
14
+ function describeValidation(result) {
15
+ const checks = [
16
+ result.metadata.syntaxValidation ? 'syntax' : undefined,
17
+ result.metadata.dependencyValidation ? 'dependencies' : undefined,
18
+ result.metadata.typeValidation ? 'types' : undefined,
19
+ result.metadata.schemaValidation ? 'schema' : undefined,
20
+ ].filter((c) => c !== undefined);
21
+ return [
22
+ `${result.valid ? 'Valid' : 'Not valid'}: ${result.metadata.filePath} ` +
23
+ `(${checks.length > 0 ? checks.join(', ') : 'no checks'}; ${result.duration} ms); ` +
24
+ `${issueCount(result.issues)}.`,
25
+ ...issueLines(result.issues),
26
+ ].join('\n');
27
+ }
12
28
  /**
13
29
  * MCP tool for pre-transformation validation.
14
30
  */
15
31
  export class ValidateBeforeTransformTool {
16
32
  name = 'validate-before-transform';
17
- description = 'Validate code before transformation to ensure it is safe to modify. Performs syntax, dependency, type, and schema validation.';
33
+ title = 'Validate Before Transform';
34
+ annotations = {
35
+ readOnlyHint: true,
36
+ destructiveHint: false,
37
+ idempotentHint: true,
38
+ openWorldHint: false,
39
+ };
40
+ description = 'Validate code before transformation to ensure it is safe to modify. Performs syntax, dependency, type, and schema validation. ' +
41
+ 'summary is a short text with the verdict, the issue counts and the first issues.';
18
42
  inputSchema = {
19
43
  type: 'object',
44
+ additionalProperties: false,
20
45
  properties: {
21
46
  filePath: {
22
47
  type: 'string',
@@ -49,6 +74,34 @@ export class ValidateBeforeTransformTool {
49
74
  },
50
75
  required: ['filePath'],
51
76
  };
77
+ outputSchema = {
78
+ type: 'object',
79
+ properties: {
80
+ valid: { type: 'boolean' },
81
+ issues: VALIDATION_ISSUES_SCHEMA,
82
+ duration: { type: 'number' },
83
+ metadata: {
84
+ type: 'object',
85
+ properties: {
86
+ filePath: { type: 'string' },
87
+ syntaxValidation: { type: 'boolean' },
88
+ dependencyValidation: { type: 'boolean' },
89
+ typeValidation: { type: 'boolean' },
90
+ schemaValidation: { type: 'boolean' },
91
+ schema: { type: 'object' },
92
+ },
93
+ required: [
94
+ 'filePath',
95
+ 'syntaxValidation',
96
+ 'dependencyValidation',
97
+ 'typeValidation',
98
+ 'schemaValidation',
99
+ ],
100
+ },
101
+ summary: { type: 'string' },
102
+ },
103
+ required: ['valid', 'issues', 'duration', 'metadata', 'summary'],
104
+ };
52
105
  async execute(args) {
53
106
  const typedArgs = args;
54
107
  const { filePath, validateSyntax, validateDependencies, validateTypes, validateSchema, schema, } = typedArgs;
@@ -107,7 +160,7 @@ export class ValidateBeforeTransformTool {
107
160
  schema,
108
161
  },
109
162
  };
110
- return response;
163
+ return { ...response, summary: describeValidation(response) };
111
164
  }
112
165
  /**
113
166
  * Find the project root from a file path.
@@ -5,7 +5,7 @@
5
5
  * Detects incompatibility patterns such as external decorators, path aliases, and complex constructor
6
6
  * patterns that may cause parsing issues. Provides actionable recommendations for parser selection.
7
7
  */
8
- import { type MCPTool } from '../types.js';
8
+ import { type MCPTool, type ToolAnnotations } from '../types.js';
9
9
  import { type CompatibilityCheck, type ProjectType, type OverallCompatibility, type RecommendedParser } from '@angular-modernizer/core';
10
10
  /**
11
11
  * Output result of project compatibility validation.
@@ -43,12 +43,16 @@ interface ValidateProjectCompatibilityOutput {
43
43
  * User-facing formatted message with summary and recommendations.
44
44
  */
45
45
  message: string;
46
+ /**
47
+ * Short text: verdict, project type, parser, success rate and the failed checks.
48
+ */
49
+ summary: string;
46
50
  }
47
51
  /**
48
52
  * MCP tool for validating project compatibility with the parser.
49
53
  *
50
54
  * Performs Phase 0 validation to detect incompatibility patterns before running transformations:
51
- * - Detects custom decorators (@Export*, @AppPermissionRequired, etc.)
55
+ * - Detects custom decorators (any decorator outside the known frameworks)
52
56
  * - Detects path aliases (@shared/, @domain/, @features/, @core/, @lib/)
53
57
  * - Detects complex constructor patterns (importService variables, public params)
54
58
  * - Runs sample transformation test to verify actual compatibility
@@ -59,9 +63,12 @@ interface ValidateProjectCompatibilityOutput {
59
63
  */
60
64
  export declare class ValidateProjectCompatibilityTool implements MCPTool {
61
65
  name: string;
66
+ title: string;
67
+ annotations: ToolAnnotations;
62
68
  description: string;
63
69
  inputSchema: {
64
70
  type: string;
71
+ additionalProperties: boolean;
65
72
  properties: {
66
73
  projectPath: {
67
74
  type: string;
@@ -89,6 +96,61 @@ export declare class ValidateProjectCompatibilityTool implements MCPTool {
89
96
  };
90
97
  required: string[];
91
98
  };
99
+ outputSchema: {
100
+ type: string;
101
+ properties: {
102
+ projectType: {
103
+ type: string;
104
+ };
105
+ overallCompatibility: {
106
+ type: string;
107
+ };
108
+ recommendedParser: {
109
+ type: string;
110
+ };
111
+ estimatedSuccessRate: {
112
+ type: string;
113
+ };
114
+ filesSampled: {
115
+ type: string;
116
+ };
117
+ validationDuration: {
118
+ type: string;
119
+ };
120
+ checks: {
121
+ type: string;
122
+ items: {
123
+ type: string;
124
+ properties: {
125
+ check: {
126
+ type: string;
127
+ };
128
+ passed: {
129
+ type: string;
130
+ };
131
+ severity: {
132
+ type: string;
133
+ enum: string[];
134
+ };
135
+ message: {
136
+ type: string;
137
+ };
138
+ recommendation: {
139
+ type: string;
140
+ };
141
+ };
142
+ required: string[];
143
+ };
144
+ };
145
+ message: {
146
+ type: string;
147
+ };
148
+ summary: {
149
+ type: string;
150
+ };
151
+ };
152
+ required: string[];
153
+ };
92
154
  execute(args: Record<string, unknown>): Promise<ValidateProjectCompatibilityOutput>;
93
155
  /**
94
156
  * Formats user-facing message with compatibility status, issues, and recommendations.
@@ -7,11 +7,26 @@
7
7
  */
8
8
  import { ProjectCompatibilityValidator, } from '@angular-modernizer/core';
9
9
  import { existsSync } from 'node:fs';
10
+ /** Text summary: verdict, parser, success rate, sample size and one line per failed check. */
11
+ function describeProjectCompatibility(output) {
12
+ const failed = output.checks.filter((c) => !c.passed);
13
+ const lines = [
14
+ `${output.overallCompatibility} (${output.projectType}); recommended parser ${output.recommendedParser}; ` +
15
+ `estimated success rate ${Math.round(output.estimatedSuccessRate * 100)}%; ` +
16
+ `${output.filesSampled} file(s) sampled in ${output.validationDuration} ms; ` +
17
+ `${failed.length} of ${output.checks.length} check(s) failed${failed.length > 0 ? ':' : '.'}`,
18
+ ];
19
+ for (const check of failed) {
20
+ const advice = check.recommendation === undefined ? '' : ` ${check.recommendation}`;
21
+ lines.push(`- ${check.severity} ${check.check}: ${check.message}${advice}`);
22
+ }
23
+ return lines.join('\n');
24
+ }
10
25
  /**
11
26
  * MCP tool for validating project compatibility with the parser.
12
27
  *
13
28
  * Performs Phase 0 validation to detect incompatibility patterns before running transformations:
14
- * - Detects custom decorators (@Export*, @AppPermissionRequired, etc.)
29
+ * - Detects custom decorators (any decorator outside the known frameworks)
15
30
  * - Detects path aliases (@shared/, @domain/, @features/, @core/, @lib/)
16
31
  * - Detects complex constructor patterns (importService variables, public params)
17
32
  * - Runs sample transformation test to verify actual compatibility
@@ -22,9 +37,18 @@ import { existsSync } from 'node:fs';
22
37
  */
23
38
  export class ValidateProjectCompatibilityTool {
24
39
  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.';
40
+ title = 'Validate Project Compatibility';
41
+ annotations = {
42
+ readOnlyHint: true,
43
+ destructiveHint: false,
44
+ idempotentHint: true,
45
+ openWorldHint: false,
46
+ };
47
+ 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. ' +
48
+ 'summary is a short text with the verdict, the parser and the failed checks.';
26
49
  inputSchema = {
27
50
  type: 'object',
51
+ additionalProperties: false,
28
52
  properties: {
29
53
  projectPath: {
30
54
  type: 'string',
@@ -52,6 +76,44 @@ export class ValidateProjectCompatibilityTool {
52
76
  },
53
77
  required: ['projectPath'],
54
78
  };
79
+ outputSchema = {
80
+ type: 'object',
81
+ properties: {
82
+ projectType: { type: 'string' },
83
+ overallCompatibility: { type: 'string' },
84
+ recommendedParser: { type: 'string' },
85
+ estimatedSuccessRate: { type: 'number' },
86
+ filesSampled: { type: 'integer' },
87
+ validationDuration: { type: 'number' },
88
+ checks: {
89
+ type: 'array',
90
+ items: {
91
+ type: 'object',
92
+ properties: {
93
+ check: { type: 'string' },
94
+ passed: { type: 'boolean' },
95
+ severity: { type: 'string', enum: ['blocker', 'warning', 'info'] },
96
+ message: { type: 'string' },
97
+ recommendation: { type: 'string' },
98
+ },
99
+ required: ['check', 'passed', 'severity', 'message'],
100
+ },
101
+ },
102
+ message: { type: 'string' },
103
+ summary: { type: 'string' },
104
+ },
105
+ required: [
106
+ 'projectType',
107
+ 'overallCompatibility',
108
+ 'recommendedParser',
109
+ 'estimatedSuccessRate',
110
+ 'filesSampled',
111
+ 'validationDuration',
112
+ 'checks',
113
+ 'message',
114
+ 'summary',
115
+ ],
116
+ };
55
117
  async execute(args) {
56
118
  const params = args;
57
119
  if (!params.projectPath) {
@@ -72,7 +134,7 @@ export class ValidateProjectCompatibilityTool {
72
134
  const report = await validator.validateProject(projectPath);
73
135
  // Format user-facing message
74
136
  const message = this.formatMessage(report);
75
- return {
137
+ const output = {
76
138
  projectType: report.projectType,
77
139
  overallCompatibility: report.overallCompatibility,
78
140
  recommendedParser: report.recommendedParser,
@@ -82,6 +144,7 @@ export class ValidateProjectCompatibilityTool {
82
144
  checks: report.checks,
83
145
  message,
84
146
  };
147
+ return { ...output, summary: describeProjectCompatibility(output) };
85
148
  }
86
149
  /**
87
150
  * Formats user-facing message with compatibility status, issues, and recommendations.
@@ -157,7 +220,7 @@ export class ValidateProjectCompatibilityTool {
157
220
  case 'standard-angular':
158
221
  return 'Standard Angular (no custom patterns)';
159
222
  case 'external-decorators':
160
- return 'External Decorators (@Export*, @AppPermissionRequired, etc.)';
223
+ return 'External Decorators (decorators outside the known frameworks)';
161
224
  case 'custom':
162
225
  return 'Custom (multiple complexity factors)';
163
226
  case 'unknown':
@@ -5,15 +5,103 @@
5
5
  * didn't break anything. Supports both legacy validation (PostTransformValidator)
6
6
  * and modern incremental build validation (IncrementalBuildValidator) for 2-4x speedup.
7
7
  */
8
- import { type MCPTool } from '../types.js';
8
+ import { type MCPTool, type ToolAnnotations, type ToolContext } from '../types.js';
9
+ import { type IncompatibilityCheck } from '@angular-modernizer/core';
10
+ /**
11
+ * Incremental build metadata
12
+ */
13
+ interface IncrementalMetadata {
14
+ /**
15
+ * Whether incremental mode was enabled
16
+ */
17
+ enabled: boolean;
18
+ /**
19
+ * Build scope strategy used
20
+ */
21
+ scope?: 'affected-only' | 'partial' | 'full';
22
+ /**
23
+ * Number of files validated
24
+ */
25
+ filesValidated?: number;
26
+ /**
27
+ * Number of files skipped
28
+ */
29
+ filesSkipped?: number;
30
+ /**
31
+ * Whether cache was used
32
+ */
33
+ cacheHit?: boolean;
34
+ /**
35
+ * Speedup estimation compared to full validation
36
+ */
37
+ speedup?: string;
38
+ /**
39
+ * Reason for fallback to full validation (if incremental was disabled)
40
+ */
41
+ fallbackReason?: string;
42
+ /**
43
+ * Incompatibility issues detected (if any)
44
+ */
45
+ incompatibilityIssues?: IncompatibilityCheck[];
46
+ }
47
+ /**
48
+ * Validation result.
49
+ */
50
+ interface ValidationResult {
51
+ /**
52
+ * Whether validation passed (no errors).
53
+ */
54
+ valid: boolean;
55
+ /**
56
+ * Validation issues found.
57
+ */
58
+ issues: {
59
+ type: 'syntax' | 'build' | 'test' | 'lint';
60
+ severity: 'error' | 'warning' | 'info';
61
+ message: string;
62
+ filePath?: string;
63
+ line?: number;
64
+ column?: number;
65
+ details?: string;
66
+ }[];
67
+ /**
68
+ * Validation duration in milliseconds.
69
+ */
70
+ duration: number;
71
+ /**
72
+ * Metadata about validation.
73
+ */
74
+ metadata: {
75
+ filePath: string;
76
+ buildValidation: boolean;
77
+ testValidation: boolean;
78
+ lintValidation: boolean;
79
+ cwd?: string;
80
+ /** Build command that ran (legacy validation). */
81
+ buildCommand?: string;
82
+ /** Where it came from: config, angular-cli, nx, vite, package-script or custom. */
83
+ buildCommandSource?: string;
84
+ };
85
+ /**
86
+ * Incremental build metadata (if incremental mode was used)
87
+ */
88
+ incremental?: IncrementalMetadata;
89
+ /**
90
+ * Short text: verdict, checks, validation mode, issue counts and the first issues.
91
+ */
92
+ summary: string;
93
+ }
9
94
  /**
10
95
  * MCP tool for post-transformation validation with incremental build support.
11
96
  */
12
97
  export declare class ValidateTransformationTool implements MCPTool {
13
98
  name: string;
99
+ title: string;
100
+ annotations: ToolAnnotations;
14
101
  description: string;
15
102
  inputSchema: {
16
103
  type: string;
104
+ additionalProperties: boolean;
17
105
  properties: {
18
106
  filePath: {
19
107
  type: string;
@@ -84,7 +172,136 @@ export declare class ValidateTransformationTool implements MCPTool {
84
172
  };
85
173
  required: string[];
86
174
  };
87
- execute(args: Record<string, unknown>): Promise<unknown>;
175
+ outputSchema: {
176
+ type: string;
177
+ properties: {
178
+ valid: {
179
+ type: string;
180
+ };
181
+ issues: {
182
+ readonly type: "array";
183
+ readonly items: {
184
+ readonly type: "object";
185
+ readonly properties: {
186
+ readonly type: {
187
+ readonly type: "string";
188
+ };
189
+ readonly severity: {
190
+ readonly type: "string";
191
+ readonly enum: readonly ["error", "warning", "info"];
192
+ };
193
+ readonly message: {
194
+ readonly type: "string";
195
+ };
196
+ readonly filePath: {
197
+ readonly type: "string";
198
+ };
199
+ readonly line: {
200
+ readonly type: "integer";
201
+ };
202
+ readonly column: {
203
+ readonly type: "integer";
204
+ };
205
+ readonly details: {
206
+ readonly type: "string";
207
+ };
208
+ };
209
+ readonly required: readonly ["type", "severity", "message"];
210
+ };
211
+ };
212
+ duration: {
213
+ type: string;
214
+ };
215
+ metadata: {
216
+ type: string;
217
+ properties: {
218
+ filePath: {
219
+ type: string;
220
+ };
221
+ buildValidation: {
222
+ type: string;
223
+ };
224
+ testValidation: {
225
+ type: string;
226
+ };
227
+ lintValidation: {
228
+ type: string;
229
+ };
230
+ cwd: {
231
+ type: string;
232
+ };
233
+ buildCommand: {
234
+ type: string;
235
+ };
236
+ buildCommandSource: {
237
+ type: string;
238
+ };
239
+ };
240
+ required: string[];
241
+ };
242
+ incremental: {
243
+ type: string;
244
+ properties: {
245
+ enabled: {
246
+ type: string;
247
+ };
248
+ scope: {
249
+ type: string;
250
+ };
251
+ filesValidated: {
252
+ type: string;
253
+ };
254
+ filesSkipped: {
255
+ type: string;
256
+ };
257
+ cacheHit: {
258
+ type: string;
259
+ };
260
+ speedup: {
261
+ type: string;
262
+ };
263
+ fallbackReason: {
264
+ type: string;
265
+ };
266
+ incompatibilityIssues: {
267
+ readonly type: "array";
268
+ readonly items: {
269
+ readonly type: "object";
270
+ readonly properties: {
271
+ readonly type: {
272
+ readonly type: "string";
273
+ };
274
+ readonly detected: {
275
+ readonly type: "boolean";
276
+ };
277
+ readonly severity: {
278
+ readonly type: "string";
279
+ readonly enum: readonly ["blocker", "warning"];
280
+ };
281
+ readonly message: {
282
+ readonly type: "string";
283
+ };
284
+ readonly recommendation: {
285
+ readonly type: "string";
286
+ };
287
+ readonly details: {
288
+ readonly type: "object";
289
+ };
290
+ };
291
+ readonly required: readonly ["type", "detected", "severity", "message", "recommendation"];
292
+ };
293
+ };
294
+ };
295
+ required: string[];
296
+ };
297
+ summary: {
298
+ type: string;
299
+ };
300
+ };
301
+ required: string[];
302
+ };
303
+ execute(args: Record<string, unknown>, ctx?: ToolContext): Promise<ValidationResult>;
304
+ private runValidation;
88
305
  /**
89
306
  * Executes incremental build validation using IncrementalBuildValidator
90
307
  */
@@ -102,4 +319,5 @@ export declare class ValidateTransformationTool implements MCPTool {
102
319
  */
103
320
  private detectTransformedFiles;
104
321
  }
322
+ export {};
105
323
  //# sourceMappingURL=validate-transformation.d.ts.map