@angular-modernizer/adapter-mcp 1.1.0 → 2.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.
- package/CHANGELOG.md +662 -0
- package/README.md +86 -445
- package/dist/cli.js +9 -1
- package/dist/core/project-analyzer.js +2 -2
- package/dist/index.d.ts +10 -1
- package/dist/index.js +1 -0
- package/dist/scan-host/scan-host.d.ts +7 -0
- package/dist/scan-host/scan-host.js +73 -10
- package/dist/scan-host/scan-protocol.d.ts +2 -0
- package/dist/scan-host/scan-worker.js +14 -8
- package/dist/server/limited-stdio-transport.d.ts +6 -3
- package/dist/server/limited-stdio-transport.js +26 -9
- package/dist/server/mcp-server.js +1 -1
- package/dist/server/sdk-server.d.ts +14 -3
- package/dist/server/sdk-server.js +54 -6
- package/dist/server/tool-registry.d.ts +3 -1
- package/dist/server/tool-registry.js +8 -3
- package/dist/streaming/progress-store.d.ts +19 -7
- package/dist/streaming/progress-store.js +19 -8
- package/dist/tools/analyze-build-impact.d.ts +9 -6
- package/dist/tools/analyze-build-impact.js +14 -7
- package/dist/tools/analyze-core-to-shared.d.ts +10 -6
- package/dist/tools/analyze-core-to-shared.js +63 -60
- package/dist/tools/analyze-parser-performance.d.ts +57 -13
- package/dist/tools/analyze-parser-performance.js +67 -6
- package/dist/tools/analyze-project.d.ts +35 -6
- package/dist/tools/analyze-project.js +141 -36
- package/dist/tools/check-incremental-compatibility.d.ts +30 -41
- package/dist/tools/check-incremental-compatibility.js +32 -264
- package/dist/tools/collect-feedback.js +15 -2
- package/dist/tools/extract-libraries.js +42 -27
- package/dist/tools/find-angular-symbol.d.ts +2 -2
- package/dist/tools/find-angular-symbol.js +6 -5
- package/dist/tools/find-component-hosts.d.ts +2 -2
- package/dist/tools/find-component-hosts.js +6 -5
- package/dist/tools/find-usages.d.ts +2 -2
- package/dist/tools/find-usages.js +24 -15
- package/dist/tools/get-bootstrap-execution.d.ts +2 -2
- package/dist/tools/get-bootstrap-execution.js +3 -3
- package/dist/tools/get-call-graph.d.ts +2 -2
- package/dist/tools/get-call-graph.js +18 -5
- package/dist/tools/get-operation-progress-tool.d.ts +1 -1
- package/dist/tools/get-operation-progress-tool.js +2 -2
- package/dist/tools/get-operation-progress.d.ts +4 -1
- package/dist/tools/get-operation-progress.js +6 -2
- package/dist/tools/helpers/analysis-output.d.ts +32 -1
- package/dist/tools/helpers/analysis-output.js +22 -1
- package/dist/tools/helpers/build-cache.d.ts +27 -0
- package/dist/tools/helpers/build-cache.js +86 -0
- package/dist/tools/helpers/class-filter.d.ts +18 -0
- package/dist/tools/helpers/class-filter.js +30 -0
- package/dist/tools/helpers/cli-arguments.d.ts +23 -0
- package/dist/tools/helpers/cli-arguments.js +35 -0
- package/dist/tools/helpers/feedback-catalog.d.ts +38 -0
- package/dist/tools/helpers/feedback-catalog.js +196 -0
- package/dist/tools/helpers/feedback-sidecar.d.ts +201 -0
- package/dist/tools/helpers/feedback-sidecar.js +381 -0
- package/dist/tools/helpers/file-type-check.d.ts +34 -0
- package/dist/tools/helpers/file-type-check.js +56 -0
- package/dist/tools/helpers/output-contract.d.ts +42 -0
- package/dist/tools/helpers/output-contract.js +54 -0
- package/dist/tools/helpers/pattern-anonymizer.d.ts +27 -0
- package/dist/tools/helpers/pattern-anonymizer.js +159 -0
- package/dist/tools/helpers/project-cache.d.ts +78 -6
- package/dist/tools/helpers/project-cache.js +205 -15
- package/dist/tools/helpers/project-decorators.d.ts +11 -4
- package/dist/tools/helpers/project-decorators.js +13 -6
- package/dist/tools/helpers/refresh-apply.d.ts +94 -0
- package/dist/tools/helpers/refresh-apply.js +460 -0
- package/dist/tools/helpers/refresh-inventory.d.ts +106 -0
- package/dist/tools/helpers/refresh-inventory.js +610 -0
- package/dist/tools/helpers/rule-runner.js +3 -1
- package/dist/tools/helpers/scan-cache.d.ts +74 -5
- package/dist/tools/helpers/scan-cache.js +134 -6
- package/dist/tools/helpers/scan-engine.d.ts +30 -6
- package/dist/tools/helpers/scan-engine.js +131 -22
- package/dist/tools/helpers/scan-plan.d.ts +1 -1
- package/dist/tools/helpers/scan-plan.js +16 -2
- package/dist/tools/helpers/source-map-loader.d.ts +55 -0
- package/dist/tools/helpers/source-map-loader.js +226 -0
- package/dist/tools/helpers/template-check.d.ts +76 -0
- package/dist/tools/helpers/template-check.js +158 -0
- package/dist/tools/helpers/tool-cache.d.ts +7 -2
- package/dist/tools/helpers/tool-cache.js +9 -3
- package/dist/tools/helpers/tool-context.d.ts +18 -0
- package/dist/tools/helpers/tool-context.js +29 -0
- package/dist/tools/helpers/transform-safety.d.ts +151 -1
- package/dist/tools/helpers/transform-safety.js +357 -4
- package/dist/tools/inspect-form-group.d.ts +2 -2
- package/dist/tools/inspect-form-group.js +8 -3
- package/dist/tools/inspect-i18n.d.ts +2 -2
- package/dist/tools/inspect-i18n.js +3 -3
- package/dist/tools/inspect-template.d.ts +2 -2
- package/dist/tools/inspect-template.js +11 -5
- package/dist/tools/learn-patterns.d.ts +43 -28
- package/dist/tools/learn-patterns.js +83 -161
- package/dist/tools/list-imports.d.ts +2 -2
- package/dist/tools/list-imports.js +3 -3
- package/dist/tools/orchestrate-migration.d.ts +19 -1
- package/dist/tools/orchestrate-migration.js +52 -10
- package/dist/tools/parse-stack-trace.d.ts +48 -1
- package/dist/tools/parse-stack-trace.js +108 -9
- package/dist/tools/plan-migration.d.ts +2 -2
- package/dist/tools/plan-migration.js +25 -12
- package/dist/tools/refresh-state.d.ts +378 -0
- package/dist/tools/refresh-state.js +370 -0
- package/dist/tools/resolve-type.d.ts +2 -2
- package/dist/tools/resolve-type.js +13 -6
- package/dist/tools/review-feedback.d.ts +42 -7
- package/dist/tools/review-feedback.js +24 -17
- package/dist/tools/rollback-changes.d.ts +5 -0
- package/dist/tools/rollback-changes.js +7 -2
- package/dist/tools/run-angular-cli.js +36 -22
- package/dist/tools/run-build.d.ts +33 -28
- package/dist/tools/run-build.js +136 -438
- package/dist/tools/run-schematic.d.ts +8 -2
- package/dist/tools/run-schematic.js +80 -50
- package/dist/tools/scan-all.d.ts +31 -15
- package/dist/tools/scan-all.js +75 -109
- package/dist/tools/scan-angular.d.ts +27 -14
- package/dist/tools/scan-angular.js +70 -92
- package/dist/tools/scan-architecture.d.ts +29 -12
- package/dist/tools/scan-architecture.js +205 -135
- package/dist/tools/scan-solid.d.ts +27 -14
- package/dist/tools/scan-solid.js +73 -89
- package/dist/tools/search-codebase.d.ts +8 -3
- package/dist/tools/search-codebase.js +16 -10
- package/dist/tools/suggest-improvements.d.ts +34 -3
- package/dist/tools/suggest-improvements.js +34 -9
- package/dist/tools/trace-output-flow.d.ts +2 -2
- package/dist/tools/trace-output-flow.js +6 -5
- package/dist/tools/transform-code-batch.d.ts +9 -9
- package/dist/tools/transform-code.d.ts +161 -12
- package/dist/tools/transform-code.js +782 -197
- package/dist/tools/validate-before-transform.js +2 -1
- package/dist/tools/validate-project-compatibility.d.ts +28 -55
- package/dist/tools/validate-project-compatibility.js +33 -225
- package/dist/tools/validate-transformation.d.ts +40 -26
- package/dist/tools/validate-transformation.js +115 -294
- package/dist/tools/verify-citations.js +8 -2
- package/dist/types.d.ts +9 -9
- package/dist/utils/format-tool-response.d.ts +3 -1
- package/dist/utils/format-tool-response.js +8 -3
- package/package.json +14 -13
|
@@ -108,6 +108,8 @@ export class ValidateBeforeTransformTool {
|
|
|
108
108
|
async execute(args) {
|
|
109
109
|
const typedArgs = args;
|
|
110
110
|
const { filePath, validateSyntax, validateDependencies, validateTypes, validateSchema, schema, } = typedArgs;
|
|
111
|
+
// The whole call: loading the project takes most of it
|
|
112
|
+
const startTime = Date.now();
|
|
111
113
|
// Find project root and tsconfig
|
|
112
114
|
const projectRoot = this.findProjectRoot(filePath);
|
|
113
115
|
const tsConfigPath = findTsConfig(projectRoot);
|
|
@@ -138,7 +140,6 @@ export class ValidateBeforeTransformTool {
|
|
|
138
140
|
validateSchema: validateSchema ?? false,
|
|
139
141
|
schema: schema ?? undefined,
|
|
140
142
|
};
|
|
141
|
-
const startTime = Date.now();
|
|
142
143
|
const result = await validator.validate(sourceFile, project, config);
|
|
143
144
|
const duration = Date.now() - startTime;
|
|
144
145
|
// Transform ValidationResult from core to MCP format
|
|
@@ -2,62 +2,60 @@ import { type MCPTool, type ToolAnnotations } from '../types.js';
|
|
|
2
2
|
import { type CompatibilityCheck, type ProjectType, type OverallCompatibility, type RecommendedParser } from '@angular-modernizer/core';
|
|
3
3
|
/**
|
|
4
4
|
* Output result of project compatibility validation.
|
|
5
|
+
*
|
|
6
|
+
* @deprecated validate-project-compatibility is deprecated: its fields keep
|
|
7
|
+
* their 1.x shape with neutral values (`overallCompatibility` `compatible`,
|
|
8
|
+
* `checks` empty, `filesSampled` 0).
|
|
5
9
|
*/
|
|
6
10
|
export interface ValidateProjectCompatibilityOutput {
|
|
7
11
|
/**
|
|
8
|
-
*
|
|
12
|
+
* Always `unknown`.
|
|
9
13
|
*/
|
|
10
14
|
projectType: ProjectType;
|
|
11
15
|
/**
|
|
12
|
-
*
|
|
16
|
+
* Always `compatible`, so a caller that stops on `incompatible` goes on.
|
|
13
17
|
*/
|
|
14
18
|
overallCompatibility: OverallCompatibility;
|
|
15
19
|
/**
|
|
16
|
-
*
|
|
20
|
+
* Always `standard`; no code path applies a parser recommendation.
|
|
17
21
|
*/
|
|
18
22
|
recommendedParser: RecommendedParser;
|
|
19
23
|
/**
|
|
20
|
-
*
|
|
24
|
+
* Always `1`.
|
|
21
25
|
*/
|
|
22
26
|
estimatedSuccessRate: number;
|
|
23
27
|
/**
|
|
24
|
-
*
|
|
28
|
+
* Always `0`: no file is read.
|
|
25
29
|
*/
|
|
26
30
|
filesSampled: number;
|
|
27
31
|
/**
|
|
28
|
-
*
|
|
32
|
+
* Always `0`.
|
|
29
33
|
*/
|
|
30
34
|
validationDuration: number;
|
|
31
35
|
/**
|
|
32
|
-
*
|
|
36
|
+
* Always empty.
|
|
33
37
|
*/
|
|
34
38
|
checks: CompatibilityCheck[];
|
|
35
39
|
/**
|
|
36
|
-
*
|
|
40
|
+
* Always `true`.
|
|
41
|
+
*/
|
|
42
|
+
deprecated: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* The deprecation notice and where to go instead.
|
|
37
45
|
*/
|
|
38
46
|
message: string;
|
|
39
47
|
/**
|
|
40
|
-
* Short text:
|
|
48
|
+
* Short text: the deprecation notice.
|
|
41
49
|
*/
|
|
42
50
|
summary: string;
|
|
43
51
|
}
|
|
44
52
|
/**
|
|
45
|
-
* MCP tool
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
53
|
+
* Deprecated MCP tool that used to rate a project's compatibility with the
|
|
54
|
+
* parser. No code path reads such a rating, so the tool stays registered in
|
|
55
|
+
* 2.x and answers at once with a deprecation notice and neutral fields,
|
|
56
|
+
* without reading the project.
|
|
49
57
|
*
|
|
50
|
-
* @
|
|
51
|
-
* Checks:
|
|
52
|
-
* - Detects custom decorators (any decorator outside the known frameworks)
|
|
53
|
-
* - Detects path aliases (@shared/, @domain/, @features/, @core/, @lib/)
|
|
54
|
-
* - Detects complex constructor patterns (importService variables, public params)
|
|
55
|
-
* - Runs sample transformation test to verify actual compatibility
|
|
56
|
-
* - Classifies project type and recommends parser strategy
|
|
57
|
-
*
|
|
58
|
-
* Avoids running transformations that would fail due to parser
|
|
59
|
-
* incompatibilities. Completes validation in under 5 seconds for typical
|
|
60
|
-
* projects.
|
|
58
|
+
* @deprecated Removal planned for 3.0.
|
|
61
59
|
*/
|
|
62
60
|
export declare class ValidateProjectCompatibilityTool implements MCPTool {
|
|
63
61
|
name: string;
|
|
@@ -79,21 +77,17 @@ export declare class ValidateProjectCompatibilityTool implements MCPTool {
|
|
|
79
77
|
maxSampleSize: {
|
|
80
78
|
type: string;
|
|
81
79
|
description: string;
|
|
82
|
-
|
|
83
|
-
minimum: number;
|
|
84
|
-
maximum: number;
|
|
80
|
+
deprecated: boolean;
|
|
85
81
|
};
|
|
86
82
|
runSampleTest: {
|
|
87
83
|
type: string;
|
|
88
84
|
description: string;
|
|
89
|
-
|
|
85
|
+
deprecated: boolean;
|
|
90
86
|
};
|
|
91
87
|
sampleTestTimeout: {
|
|
92
88
|
type: string;
|
|
93
89
|
description: string;
|
|
94
|
-
|
|
95
|
-
minimum: number;
|
|
96
|
-
maximum: number;
|
|
90
|
+
deprecated: boolean;
|
|
97
91
|
};
|
|
98
92
|
};
|
|
99
93
|
required: string[];
|
|
@@ -148,6 +142,9 @@ export declare class ValidateProjectCompatibilityTool implements MCPTool {
|
|
|
148
142
|
required: string[];
|
|
149
143
|
};
|
|
150
144
|
};
|
|
145
|
+
deprecated: {
|
|
146
|
+
type: string;
|
|
147
|
+
};
|
|
151
148
|
message: {
|
|
152
149
|
type: string;
|
|
153
150
|
};
|
|
@@ -158,29 +155,5 @@ export declare class ValidateProjectCompatibilityTool implements MCPTool {
|
|
|
158
155
|
required: string[];
|
|
159
156
|
};
|
|
160
157
|
execute(args: Record<string, unknown>): Promise<ValidateProjectCompatibilityOutput>;
|
|
161
|
-
/**
|
|
162
|
-
* Formats user-facing message with compatibility status, issues, and recommendations.
|
|
163
|
-
*/
|
|
164
|
-
private formatMessage;
|
|
165
|
-
/**
|
|
166
|
-
* Gets status header based on compatibility level.
|
|
167
|
-
*/
|
|
168
|
-
private getStatusHeader;
|
|
169
|
-
/**
|
|
170
|
-
* Formats project type for display.
|
|
171
|
-
*/
|
|
172
|
-
private formatProjectType;
|
|
173
|
-
/**
|
|
174
|
-
* Formats recommended parser for display.
|
|
175
|
-
*/
|
|
176
|
-
private formatRecommendedParser;
|
|
177
|
-
/**
|
|
178
|
-
* Formats success rate for display.
|
|
179
|
-
*/
|
|
180
|
-
private formatSuccessRate;
|
|
181
|
-
/**
|
|
182
|
-
* Gets overall recommendation based on compatibility report.
|
|
183
|
-
*/
|
|
184
|
-
private getOverallRecommendation;
|
|
185
158
|
}
|
|
186
159
|
//# sourceMappingURL=validate-project-compatibility.d.ts.map
|
|
@@ -1,49 +1,27 @@
|
|
|
1
|
-
import { ProjectCompatibilityValidator, } from '@angular-modernizer/core';
|
|
2
1
|
import { existsSync } from 'node:fs';
|
|
3
|
-
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
}
|
|
2
|
+
/** What the tool answers on every call. */
|
|
3
|
+
const DEPRECATION_MESSAGE = 'validate-project-compatibility is deprecated and checks nothing: the parser strategy it recommended is not applied anywhere, and its verdict and success rate were a fixed mapping of the warning count. ' +
|
|
4
|
+
'Imports resolve through the tsconfig paths of the project; configure project component decorators in parser.componentDecorators. ' +
|
|
5
|
+
'For facts use find-angular-symbol (decorated classes), list-imports (aliases a file uses) and validate-before-transform (one file before a transformation).';
|
|
18
6
|
/**
|
|
19
|
-
* MCP tool
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
7
|
+
* Deprecated MCP tool that used to rate a project's compatibility with the
|
|
8
|
+
* parser. No code path reads such a rating, so the tool stays registered in
|
|
9
|
+
* 2.x and answers at once with a deprecation notice and neutral fields,
|
|
10
|
+
* without reading the project.
|
|
23
11
|
*
|
|
24
|
-
* @
|
|
25
|
-
* Checks:
|
|
26
|
-
* - Detects custom decorators (any decorator outside the known frameworks)
|
|
27
|
-
* - Detects path aliases (@shared/, @domain/, @features/, @core/, @lib/)
|
|
28
|
-
* - Detects complex constructor patterns (importService variables, public params)
|
|
29
|
-
* - Runs sample transformation test to verify actual compatibility
|
|
30
|
-
* - Classifies project type and recommends parser strategy
|
|
31
|
-
*
|
|
32
|
-
* Avoids running transformations that would fail due to parser
|
|
33
|
-
* incompatibilities. Completes validation in under 5 seconds for typical
|
|
34
|
-
* projects.
|
|
12
|
+
* @deprecated Removal planned for 3.0.
|
|
35
13
|
*/
|
|
36
14
|
export class ValidateProjectCompatibilityTool {
|
|
37
15
|
name = 'validate-project-compatibility';
|
|
38
|
-
title = 'Validate Project Compatibility';
|
|
16
|
+
title = 'Validate Project Compatibility (deprecated)';
|
|
39
17
|
annotations = {
|
|
40
18
|
readOnlyHint: true,
|
|
41
19
|
destructiveHint: false,
|
|
42
20
|
idempotentHint: true,
|
|
43
21
|
openWorldHint: false,
|
|
44
22
|
};
|
|
45
|
-
description = '
|
|
46
|
-
'
|
|
23
|
+
description = 'Deprecated, checks nothing: the parser strategy it recommended is not applied anywhere. Answers overallCompatibility compatible, recommendedParser standard and no checks. ' +
|
|
24
|
+
'Use find-angular-symbol for decorated classes, list-imports for the aliases a file uses and validate-before-transform before a transformation.';
|
|
47
25
|
/**
|
|
48
26
|
* JSON Schema of the tool arguments.
|
|
49
27
|
* @hidden
|
|
@@ -54,26 +32,22 @@ export class ValidateProjectCompatibilityTool {
|
|
|
54
32
|
properties: {
|
|
55
33
|
projectPath: {
|
|
56
34
|
type: 'string',
|
|
57
|
-
description: 'Project root path
|
|
35
|
+
description: 'Project root path',
|
|
58
36
|
},
|
|
59
37
|
maxSampleSize: {
|
|
60
38
|
type: 'number',
|
|
61
|
-
description: '
|
|
62
|
-
|
|
63
|
-
minimum: 1,
|
|
64
|
-
maximum: 200,
|
|
39
|
+
description: 'Deprecated, no effect',
|
|
40
|
+
deprecated: true,
|
|
65
41
|
},
|
|
66
42
|
runSampleTest: {
|
|
67
43
|
type: 'boolean',
|
|
68
|
-
description: '
|
|
69
|
-
|
|
44
|
+
description: 'Deprecated, no effect',
|
|
45
|
+
deprecated: true,
|
|
70
46
|
},
|
|
71
47
|
sampleTestTimeout: {
|
|
72
48
|
type: 'number',
|
|
73
|
-
description: '
|
|
74
|
-
|
|
75
|
-
minimum: 1000,
|
|
76
|
-
maximum: 30000,
|
|
49
|
+
description: 'Deprecated, no effect',
|
|
50
|
+
deprecated: true,
|
|
77
51
|
},
|
|
78
52
|
},
|
|
79
53
|
required: ['projectPath'],
|
|
@@ -105,6 +79,7 @@ export class ValidateProjectCompatibilityTool {
|
|
|
105
79
|
required: ['check', 'passed', 'severity', 'message'],
|
|
106
80
|
},
|
|
107
81
|
},
|
|
82
|
+
deprecated: { type: 'boolean' },
|
|
108
83
|
message: { type: 'string' },
|
|
109
84
|
summary: { type: 'string' },
|
|
110
85
|
},
|
|
@@ -125,188 +100,21 @@ export class ValidateProjectCompatibilityTool {
|
|
|
125
100
|
if (!params.projectPath) {
|
|
126
101
|
throw new Error('projectPath is required');
|
|
127
102
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
if (!existsSync(projectPath)) {
|
|
131
|
-
throw new Error(`Project path does not exist: ${projectPath}`);
|
|
103
|
+
if (!existsSync(params.projectPath)) {
|
|
104
|
+
throw new Error(`Project path does not exist: ${params.projectPath}`);
|
|
132
105
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
projectType: report.projectType,
|
|
145
|
-
overallCompatibility: report.overallCompatibility,
|
|
146
|
-
recommendedParser: report.recommendedParser,
|
|
147
|
-
estimatedSuccessRate: report.estimatedSuccessRate,
|
|
148
|
-
filesSampled: report.filesSampled,
|
|
149
|
-
validationDuration: report.validationDuration,
|
|
150
|
-
checks: report.checks,
|
|
151
|
-
message,
|
|
106
|
+
return {
|
|
107
|
+
projectType: 'unknown',
|
|
108
|
+
overallCompatibility: 'compatible',
|
|
109
|
+
recommendedParser: 'standard',
|
|
110
|
+
estimatedSuccessRate: 1,
|
|
111
|
+
filesSampled: 0,
|
|
112
|
+
validationDuration: 0,
|
|
113
|
+
checks: [],
|
|
114
|
+
deprecated: true,
|
|
115
|
+
message: DEPRECATION_MESSAGE,
|
|
116
|
+
summary: DEPRECATION_MESSAGE,
|
|
152
117
|
};
|
|
153
|
-
return { ...output, summary: describeProjectCompatibility(output) };
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Formats user-facing message with compatibility status, issues, and recommendations.
|
|
157
|
-
*/
|
|
158
|
-
formatMessage(report) {
|
|
159
|
-
const lines = [];
|
|
160
|
-
// Status header
|
|
161
|
-
lines.push(this.getStatusHeader(report.overallCompatibility, report.projectType));
|
|
162
|
-
lines.push('');
|
|
163
|
-
// Project type and parser recommendation
|
|
164
|
-
lines.push(`Project Type: ${this.formatProjectType(report.projectType)}`);
|
|
165
|
-
lines.push(`Recommended Parser: ${this.formatRecommendedParser(report.recommendedParser)}`);
|
|
166
|
-
lines.push(`Estimated Success Rate: ${this.formatSuccessRate(report.estimatedSuccessRate)}`);
|
|
167
|
-
lines.push('');
|
|
168
|
-
// Validation metrics
|
|
169
|
-
lines.push(`Validation Duration: ${report.validationDuration}ms`);
|
|
170
|
-
lines.push(`Files Sampled: ${report.filesSampled}`);
|
|
171
|
-
lines.push('');
|
|
172
|
-
// Checks section
|
|
173
|
-
const blockers = report.checks.filter((c) => c.severity === 'blocker' && !c.passed);
|
|
174
|
-
const warnings = report.checks.filter((c) => c.severity === 'warning' && !c.passed);
|
|
175
|
-
const passed = report.checks.filter((c) => c.passed);
|
|
176
|
-
if (blockers.length > 0 || warnings.length > 0) {
|
|
177
|
-
lines.push('Issues Detected:');
|
|
178
|
-
lines.push('');
|
|
179
|
-
blockers.forEach((check) => {
|
|
180
|
-
lines.push(` ❌ [BLOCKER] ${check.message}`);
|
|
181
|
-
if (check.recommendation) {
|
|
182
|
-
lines.push(` → ${check.recommendation}`);
|
|
183
|
-
}
|
|
184
|
-
lines.push('');
|
|
185
|
-
});
|
|
186
|
-
warnings.forEach((check) => {
|
|
187
|
-
lines.push(` ⚠️ [WARNING] ${check.message}`);
|
|
188
|
-
if (check.recommendation) {
|
|
189
|
-
lines.push(` → ${check.recommendation}`);
|
|
190
|
-
}
|
|
191
|
-
lines.push('');
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
if (passed.length > 0) {
|
|
195
|
-
lines.push('Checks Passed:');
|
|
196
|
-
passed.forEach((check) => {
|
|
197
|
-
lines.push(` ✅ ${check.message}`);
|
|
198
|
-
});
|
|
199
|
-
lines.push('');
|
|
200
|
-
}
|
|
201
|
-
// Overall recommendation
|
|
202
|
-
lines.push('Recommendation:');
|
|
203
|
-
lines.push(this.getOverallRecommendation(report));
|
|
204
|
-
return lines.join('\n');
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Gets status header based on compatibility level.
|
|
208
|
-
*/
|
|
209
|
-
getStatusHeader(compatibility, projectType) {
|
|
210
|
-
switch (compatibility) {
|
|
211
|
-
case 'compatible':
|
|
212
|
-
return '✅ Project is fully compatible with the parser';
|
|
213
|
-
case 'partially-compatible':
|
|
214
|
-
return `⚠️ Project is partially compatible (${projectType})`;
|
|
215
|
-
case 'incompatible':
|
|
216
|
-
return `❌ Project is incompatible with the parser (${projectType})`;
|
|
217
|
-
default:
|
|
218
|
-
return `⚠️ Project compatibility unknown`;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* Formats project type for display.
|
|
223
|
-
*/
|
|
224
|
-
formatProjectType(projectType) {
|
|
225
|
-
switch (projectType) {
|
|
226
|
-
case 'standard-angular':
|
|
227
|
-
return 'Standard Angular (no custom patterns)';
|
|
228
|
-
case 'external-decorators':
|
|
229
|
-
return 'External Decorators (decorators outside the known frameworks)';
|
|
230
|
-
case 'custom':
|
|
231
|
-
return 'Custom (multiple complexity factors)';
|
|
232
|
-
case 'unknown':
|
|
233
|
-
return 'Unknown (could not determine)';
|
|
234
|
-
default:
|
|
235
|
-
return projectType;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* Formats recommended parser for display.
|
|
240
|
-
*/
|
|
241
|
-
formatRecommendedParser(parser) {
|
|
242
|
-
switch (parser) {
|
|
243
|
-
case 'standard':
|
|
244
|
-
return 'Standard Parser (ts-morph, no preprocessing)';
|
|
245
|
-
case 'enhanced':
|
|
246
|
-
return 'Enhanced Parser (ts-morph + false positive detection + path alias resolution)';
|
|
247
|
-
case 'custom':
|
|
248
|
-
return 'Custom Parser (future implementation required)';
|
|
249
|
-
default:
|
|
250
|
-
return parser;
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* Formats success rate for display.
|
|
255
|
-
*/
|
|
256
|
-
formatSuccessRate(rate) {
|
|
257
|
-
const percentage = Math.round(rate * 100);
|
|
258
|
-
if (percentage >= 80) {
|
|
259
|
-
return `${percentage}% (High)`;
|
|
260
|
-
}
|
|
261
|
-
else if (percentage >= 50) {
|
|
262
|
-
return `${percentage}% (Medium)`;
|
|
263
|
-
}
|
|
264
|
-
else if (percentage > 0) {
|
|
265
|
-
return `${percentage}% (Low)`;
|
|
266
|
-
}
|
|
267
|
-
else {
|
|
268
|
-
return `0% (Incompatible)`;
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* Gets overall recommendation based on compatibility report.
|
|
273
|
-
*/
|
|
274
|
-
getOverallRecommendation(report) {
|
|
275
|
-
const lines = [];
|
|
276
|
-
switch (report.overallCompatibility) {
|
|
277
|
-
case 'compatible':
|
|
278
|
-
lines.push(' ✅ Safe to proceed with transformations using standard parser');
|
|
279
|
-
lines.push(' Expected transformation success rate: High');
|
|
280
|
-
break;
|
|
281
|
-
case 'partially-compatible':
|
|
282
|
-
lines.push(' ⚠️ Proceed with caution - use enhanced parser for better results');
|
|
283
|
-
lines.push(` Expected transformation success rate: ${Math.round(report.estimatedSuccessRate * 100)}%`);
|
|
284
|
-
lines.push('');
|
|
285
|
-
lines.push(' Actions to improve compatibility:');
|
|
286
|
-
report.checks
|
|
287
|
-
.filter((c) => !c.passed && c.recommendation)
|
|
288
|
-
.forEach((c) => {
|
|
289
|
-
lines.push(` - ${c.recommendation}`);
|
|
290
|
-
});
|
|
291
|
-
break;
|
|
292
|
-
case 'incompatible':
|
|
293
|
-
lines.push(' ❌ Not recommended to proceed with current parser');
|
|
294
|
-
lines.push(' Expected transformation success rate: 0%');
|
|
295
|
-
lines.push('');
|
|
296
|
-
lines.push(' Required actions before transformations:');
|
|
297
|
-
report.checks
|
|
298
|
-
.filter((c) => c.severity === 'blocker' && !c.passed && c.recommendation)
|
|
299
|
-
.forEach((c) => {
|
|
300
|
-
lines.push(` - ${c.recommendation}`);
|
|
301
|
-
});
|
|
302
|
-
lines.push('');
|
|
303
|
-
lines.push(' Alternative approaches:');
|
|
304
|
-
lines.push(' - Use enhanced parser when available');
|
|
305
|
-
lines.push(' - Perform manual migration for affected files');
|
|
306
|
-
lines.push(' - Wait for custom parser implementation');
|
|
307
|
-
break;
|
|
308
|
-
}
|
|
309
|
-
return lines.join('\n');
|
|
310
118
|
}
|
|
311
119
|
}
|
|
312
120
|
//# sourceMappingURL=validate-project-compatibility.js.map
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { type MCPTool, type ToolAnnotations, type ToolContext } from '../types.js';
|
|
2
2
|
import { type IncompatibilityCheck } from '@angular-modernizer/core';
|
|
3
3
|
/**
|
|
4
|
-
* Incremental build metadata
|
|
4
|
+
* Incremental build metadata.
|
|
5
|
+
*
|
|
6
|
+
* @deprecated validate-transformation has no incremental mode any more and no
|
|
7
|
+
* longer sets this field; kept for 1.x consumers of the type.
|
|
5
8
|
*/
|
|
6
9
|
export interface IncrementalMetadata {
|
|
7
10
|
/**
|
|
@@ -50,7 +53,7 @@ export interface ValidationResult {
|
|
|
50
53
|
*/
|
|
51
54
|
issues: {
|
|
52
55
|
/** Check that reported the issue. */
|
|
53
|
-
type: 'syntax' | 'build' | 'test' | 'lint';
|
|
56
|
+
type: 'syntax' | 'type' | 'build' | 'test' | 'lint';
|
|
54
57
|
/** Severity; only errors make the file not valid. */
|
|
55
58
|
severity: 'error' | 'warning' | 'info';
|
|
56
59
|
/** Issue description. */
|
|
@@ -74,35 +77,41 @@ export interface ValidationResult {
|
|
|
74
77
|
metadata: {
|
|
75
78
|
/** Validated file. */
|
|
76
79
|
filePath: string;
|
|
77
|
-
/** Whether
|
|
80
|
+
/** Whether the file was type-checked. */
|
|
81
|
+
typeValidation?: boolean;
|
|
82
|
+
/** Whether a build command ran. */
|
|
78
83
|
buildValidation: boolean;
|
|
79
|
-
/** Whether test
|
|
84
|
+
/** Whether a test command ran. */
|
|
80
85
|
testValidation: boolean;
|
|
81
|
-
/** Whether lint
|
|
86
|
+
/** Whether a lint command ran. */
|
|
82
87
|
lintValidation: boolean;
|
|
83
88
|
/** Project root the validation ran in. */
|
|
84
89
|
cwd?: string;
|
|
85
|
-
/** Build command that ran
|
|
90
|
+
/** Build command that ran, with its arguments. */
|
|
86
91
|
buildCommand?: string;
|
|
87
|
-
/** Where it came from: config, angular-cli, nx, vite, package-script or custom. */
|
|
92
|
+
/** Where it came from: config, angular-cli, nx, vite, webpack, package-script or custom. */
|
|
88
93
|
buildCommandSource?: string;
|
|
89
94
|
};
|
|
90
95
|
/**
|
|
91
|
-
*
|
|
96
|
+
* Deprecation notices of parameters without effect.
|
|
97
|
+
*/
|
|
98
|
+
warnings?: string[];
|
|
99
|
+
/**
|
|
100
|
+
* @deprecated No longer set; validate-transformation has no incremental mode.
|
|
92
101
|
*/
|
|
93
102
|
incremental?: IncrementalMetadata;
|
|
94
103
|
/**
|
|
95
|
-
* Short text: verdict, checks
|
|
104
|
+
* Short text: verdict, checks that ran, issue counts and the first issues.
|
|
96
105
|
*/
|
|
97
106
|
summary: string;
|
|
98
107
|
}
|
|
99
108
|
/**
|
|
100
109
|
* MCP tool for validating code after a transformation to make sure the
|
|
101
|
-
* changes did not break anything
|
|
110
|
+
* changes did not break anything.
|
|
102
111
|
*
|
|
103
112
|
* @remarks
|
|
104
|
-
*
|
|
105
|
-
*
|
|
113
|
+
* Runs build, tests and lint through `PostTransformValidator`; the build is
|
|
114
|
+
* the project's build command (core `resolveBuildCommand`).
|
|
106
115
|
*/
|
|
107
116
|
export declare class ValidateTransformationTool implements MCPTool {
|
|
108
117
|
name: string;
|
|
@@ -121,6 +130,11 @@ export declare class ValidateTransformationTool implements MCPTool {
|
|
|
121
130
|
type: string;
|
|
122
131
|
description: string;
|
|
123
132
|
};
|
|
133
|
+
validateTypes: {
|
|
134
|
+
type: string;
|
|
135
|
+
description: string;
|
|
136
|
+
default: boolean;
|
|
137
|
+
};
|
|
124
138
|
validateBuild: {
|
|
125
139
|
type: string;
|
|
126
140
|
description: string;
|
|
@@ -158,6 +172,7 @@ export declare class ValidateTransformationTool implements MCPTool {
|
|
|
158
172
|
incrementalMode: {
|
|
159
173
|
type: string;
|
|
160
174
|
description: string;
|
|
175
|
+
deprecated: boolean;
|
|
161
176
|
};
|
|
162
177
|
transformedFiles: {
|
|
163
178
|
type: string;
|
|
@@ -165,11 +180,12 @@ export declare class ValidateTransformationTool implements MCPTool {
|
|
|
165
180
|
type: string;
|
|
166
181
|
};
|
|
167
182
|
description: string;
|
|
183
|
+
deprecated: boolean;
|
|
168
184
|
};
|
|
169
185
|
forceFullBuild: {
|
|
170
186
|
type: string;
|
|
171
187
|
description: string;
|
|
172
|
-
|
|
188
|
+
deprecated: boolean;
|
|
173
189
|
};
|
|
174
190
|
cacheStrategy: {
|
|
175
191
|
type: string;
|
|
@@ -181,7 +197,6 @@ export declare class ValidateTransformationTool implements MCPTool {
|
|
|
181
197
|
type: string;
|
|
182
198
|
description: string;
|
|
183
199
|
enum: string[];
|
|
184
|
-
default: string;
|
|
185
200
|
};
|
|
186
201
|
};
|
|
187
202
|
required: string[];
|
|
@@ -236,6 +251,9 @@ export declare class ValidateTransformationTool implements MCPTool {
|
|
|
236
251
|
filePath: {
|
|
237
252
|
type: string;
|
|
238
253
|
};
|
|
254
|
+
typeValidation: {
|
|
255
|
+
type: string;
|
|
256
|
+
};
|
|
239
257
|
buildValidation: {
|
|
240
258
|
type: string;
|
|
241
259
|
};
|
|
@@ -257,8 +275,16 @@ export declare class ValidateTransformationTool implements MCPTool {
|
|
|
257
275
|
};
|
|
258
276
|
required: string[];
|
|
259
277
|
};
|
|
278
|
+
warnings: {
|
|
279
|
+
type: string;
|
|
280
|
+
items: {
|
|
281
|
+
type: string;
|
|
282
|
+
};
|
|
283
|
+
description: string;
|
|
284
|
+
};
|
|
260
285
|
incremental: {
|
|
261
286
|
type: string;
|
|
287
|
+
description: string;
|
|
262
288
|
properties: {
|
|
263
289
|
enabled: {
|
|
264
290
|
type: string;
|
|
@@ -320,21 +346,9 @@ export declare class ValidateTransformationTool implements MCPTool {
|
|
|
320
346
|
};
|
|
321
347
|
execute(args: Record<string, unknown>, ctx?: ToolContext): Promise<ValidationResult>;
|
|
322
348
|
private runValidation;
|
|
323
|
-
/**
|
|
324
|
-
* Executes incremental build validation using IncrementalBuildValidator
|
|
325
|
-
*/
|
|
326
|
-
private executeIncrementalValidation;
|
|
327
|
-
/**
|
|
328
|
-
* Executes legacy validation using PostTransformValidator
|
|
329
|
-
*/
|
|
330
|
-
private executeLegacyValidation;
|
|
331
349
|
/**
|
|
332
350
|
* Detects project root from file path
|
|
333
351
|
*/
|
|
334
352
|
private detectProjectRoot;
|
|
335
|
-
/**
|
|
336
|
-
* Detects transformed files using git status
|
|
337
|
-
*/
|
|
338
|
-
private detectTransformedFiles;
|
|
339
353
|
}
|
|
340
354
|
//# sourceMappingURL=validate-transformation.d.ts.map
|