@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.
- package/README.md +181 -282
- package/dist/cli.js +21 -13
- package/dist/core/project-analyzer.d.ts +3 -12
- package/dist/core/project-analyzer.js +3 -12
- package/dist/index.d.ts +122 -6
- package/dist/index.js +49 -5
- package/dist/mcp-watcher.d.ts +32 -7
- package/dist/mcp-watcher.js +16 -15
- package/dist/scan-host/scan-host.d.ts +119 -0
- package/dist/scan-host/scan-host.js +376 -0
- package/dist/scan-host/scan-protocol.d.ts +35 -0
- package/dist/scan-host/scan-protocol.js +6 -0
- package/dist/scan-host/scan-worker.d.ts +14 -0
- package/dist/scan-host/scan-worker.js +48 -0
- package/dist/server/limited-stdio-transport.d.ts +75 -0
- package/dist/server/limited-stdio-transport.js +115 -0
- package/dist/server/mcp-server.d.ts +20 -18
- package/dist/server/mcp-server.js +42 -79
- package/dist/server/package-version.d.ts +16 -0
- package/dist/server/package-version.js +37 -0
- package/dist/server/sdk-server.d.ts +71 -0
- package/dist/server/sdk-server.js +113 -0
- package/dist/server/tool-registry.d.ts +6 -9
- package/dist/server/tool-registry.js +6 -12
- package/dist/streaming/progress-store.d.ts +22 -5
- package/dist/streaming/progress-store.js +9 -5
- package/dist/tools/analyze-build-impact.d.ts +276 -35
- package/dist/tools/analyze-build-impact.js +175 -28
- package/dist/tools/analyze-core-to-shared.d.ts +176 -16
- package/dist/tools/analyze-core-to-shared.js +124 -19
- package/dist/tools/analyze-parser-performance.d.ts +209 -15
- package/dist/tools/analyze-parser-performance.js +119 -56
- package/dist/tools/analyze-project.d.ts +349 -17
- package/dist/tools/analyze-project.js +282 -97
- package/dist/tools/check-incremental-compatibility.d.ts +74 -12
- package/dist/tools/check-incremental-compatibility.js +69 -10
- package/dist/tools/collect-feedback.d.ts +225 -21
- package/dist/tools/collect-feedback.js +199 -118
- package/dist/tools/compare-health.d.ts +413 -0
- package/dist/tools/compare-health.js +479 -0
- package/dist/tools/extract-libraries.d.ts +200 -24
- package/dist/tools/extract-libraries.js +131 -27
- package/dist/tools/find-angular-symbol.d.ts +92 -24
- package/dist/tools/find-angular-symbol.js +70 -20
- package/dist/tools/find-component-hosts.d.ts +603 -27
- package/dist/tools/find-component-hosts.js +223 -19
- package/dist/tools/find-usages.d.ts +102 -22
- package/dist/tools/find-usages.js +81 -21
- package/dist/tools/get-bootstrap-execution.d.ts +183 -25
- package/dist/tools/get-bootstrap-execution.js +109 -25
- package/dist/tools/get-call-graph.d.ts +127 -12
- package/dist/tools/get-call-graph.js +84 -19
- package/dist/tools/get-operation-progress-tool.d.ts +126 -8
- package/dist/tools/get-operation-progress-tool.js +124 -12
- package/dist/tools/get-operation-progress.d.ts +27 -1
- package/dist/tools/get-operation-progress.js +5 -5
- package/dist/tools/helpers/analysis-output.d.ts +182 -0
- package/dist/tools/helpers/analysis-output.js +165 -0
- package/dist/tools/helpers/batch-kernel.d.ts +14 -0
- package/dist/tools/helpers/batch-kernel.js +12 -0
- package/dist/tools/helpers/build-schemas.d.ts +36 -0
- package/dist/tools/helpers/build-schemas.js +23 -0
- package/dist/tools/helpers/citation-file-source.d.ts +10 -0
- package/dist/tools/helpers/citation-file-source.js +82 -0
- package/dist/tools/helpers/compact-output.d.ts +2 -1
- package/dist/tools/helpers/compact-output.js +2 -1
- package/dist/tools/helpers/finding-window.d.ts +43 -0
- package/dist/tools/helpers/finding-window.js +64 -0
- package/dist/tools/helpers/health-delta.d.ts +99 -0
- package/dist/tools/helpers/health-delta.js +236 -0
- package/dist/tools/helpers/investigation-schemas.d.ts +93 -0
- package/dist/tools/helpers/investigation-schemas.js +48 -0
- package/dist/tools/helpers/library-imports.d.ts +57 -0
- package/dist/tools/helpers/library-imports.js +151 -0
- package/dist/tools/helpers/load-source-files.d.ts +30 -0
- package/dist/tools/helpers/load-source-files.js +34 -0
- package/dist/tools/helpers/output-contract.d.ts +32 -0
- package/dist/tools/helpers/output-contract.js +32 -0
- package/dist/tools/helpers/platform-root-resolver.d.ts +55 -25
- package/dist/tools/helpers/platform-root-resolver.js +75 -48
- package/dist/tools/helpers/process-output.d.ts +19 -0
- package/dist/tools/helpers/process-output.js +31 -0
- package/dist/tools/helpers/project-cache.d.ts +60 -37
- package/dist/tools/helpers/project-cache.js +54 -37
- package/dist/tools/helpers/project-decorators.d.ts +14 -0
- package/dist/tools/helpers/project-decorators.js +22 -0
- package/dist/tools/helpers/rule-matcher.js +5 -0
- package/dist/tools/helpers/rule-runner.d.ts +25 -13
- package/dist/tools/helpers/rule-runner.js +45 -24
- package/dist/tools/helpers/scan-cache.d.ts +22 -0
- package/dist/tools/helpers/scan-cache.js +34 -0
- package/dist/tools/helpers/scan-engine.d.ts +107 -0
- package/dist/tools/helpers/scan-engine.js +197 -0
- package/dist/tools/helpers/scan-plan.d.ts +5 -2
- package/dist/tools/helpers/scan-plan.js +18 -3
- package/dist/tools/helpers/scope-paths.d.ts +17 -0
- package/dist/tools/helpers/scope-paths.js +32 -0
- package/dist/tools/helpers/suggestion-generator.d.ts +9 -13
- package/dist/tools/helpers/suggestion-generator.js +0 -12
- package/dist/tools/helpers/tool-cache.d.ts +11 -0
- package/dist/tools/helpers/tool-cache.js +15 -0
- package/dist/tools/helpers/tool-context.d.ts +63 -0
- package/dist/tools/helpers/tool-context.js +79 -0
- package/dist/tools/helpers/transform-safety.d.ts +40 -0
- package/dist/tools/helpers/transform-safety.js +87 -0
- package/dist/tools/helpers/validation-output.d.ts +53 -0
- package/dist/tools/helpers/validation-output.js +48 -0
- package/dist/tools/inspect-form-group.d.ts +262 -24
- package/dist/tools/inspect-form-group.js +134 -13
- package/dist/tools/inspect-i18n.d.ts +410 -23
- package/dist/tools/inspect-i18n.js +213 -13
- package/dist/tools/inspect-template.d.ts +260 -22
- package/dist/tools/inspect-template.js +174 -13
- package/dist/tools/learn-patterns.d.ts +210 -13
- package/dist/tools/learn-patterns.js +113 -12
- package/dist/tools/list-imports.d.ts +152 -34
- package/dist/tools/list-imports.js +124 -18
- package/dist/tools/orchestrate-migration.d.ts +159 -14
- package/dist/tools/orchestrate-migration.js +147 -20
- package/dist/tools/parse-stack-trace.d.ts +78 -21
- package/dist/tools/parse-stack-trace.js +44 -7
- package/dist/tools/plan-migration.d.ts +395 -26
- package/dist/tools/plan-migration.js +173 -22
- package/dist/tools/resolve-type.d.ts +57 -9
- package/dist/tools/resolve-type.js +49 -12
- package/dist/tools/review-feedback.d.ts +214 -16
- package/dist/tools/review-feedback.js +142 -57
- package/dist/tools/rollback-changes.d.ts +88 -7
- package/dist/tools/rollback-changes.js +74 -19
- package/dist/tools/run-angular-cli.d.ts +57 -12
- package/dist/tools/run-angular-cli.js +76 -13
- package/dist/tools/run-build.d.ts +127 -13
- package/dist/tools/run-build.js +128 -16
- package/dist/tools/run-schematic.d.ts +82 -12
- package/dist/tools/run-schematic.js +115 -18
- package/dist/tools/scan-all.d.ts +88 -23
- package/dist/tools/scan-all.js +161 -220
- package/dist/tools/scan-angular.d.ts +60 -19
- package/dist/tools/scan-angular.js +100 -141
- package/dist/tools/scan-architecture.d.ts +92 -24
- package/dist/tools/scan-architecture.js +268 -211
- package/dist/tools/scan-solid.d.ts +59 -19
- package/dist/tools/scan-solid.js +98 -139
- package/dist/tools/search-codebase.d.ts +110 -23
- package/dist/tools/search-codebase.js +67 -11
- package/dist/tools/server-status.d.ts +392 -26
- package/dist/tools/server-status.js +260 -27
- package/dist/tools/suggest-improvements.d.ts +105 -10
- package/dist/tools/suggest-improvements.js +91 -51
- package/dist/tools/trace-output-flow.d.ts +713 -26
- package/dist/tools/trace-output-flow.js +396 -33
- package/dist/tools/transform-code-batch.d.ts +3 -0
- package/dist/tools/transform-code-batch.js +10 -5
- package/dist/tools/transform-code.d.ts +402 -18
- package/dist/tools/transform-code.js +708 -649
- package/dist/tools/validate-before-transform.d.ts +136 -7
- package/dist/tools/validate-before-transform.js +65 -9
- package/dist/tools/validate-project-compatibility.d.ts +82 -15
- package/dist/tools/validate-project-compatibility.js +84 -15
- package/dist/tools/validate-transformation.d.ts +243 -8
- package/dist/tools/validate-transformation.js +127 -23
- package/dist/tools/verify-citations.d.ts +202 -0
- package/dist/tools/verify-citations.js +221 -0
- package/dist/types.d.ts +78 -11
- package/dist/types.js +0 -5
- package/dist/utils/format-tool-response.d.ts +22 -59
- package/dist/utils/format-tool-response.js +25 -134
- package/package.json +31 -20
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/core/project-analyzer.d.ts.map +0 -1
- package/dist/core/project-analyzer.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/mcp-watcher.d.ts.map +0 -1
- package/dist/mcp-watcher.js.map +0 -1
- package/dist/server/json-rpc-handler.d.ts +0 -98
- package/dist/server/json-rpc-handler.d.ts.map +0 -1
- package/dist/server/json-rpc-handler.js +0 -301
- package/dist/server/json-rpc-handler.js.map +0 -1
- package/dist/server/mcp-server.d.ts.map +0 -1
- package/dist/server/mcp-server.js.map +0 -1
- package/dist/server/stdio-guard.d.ts.map +0 -1
- package/dist/server/stdio-guard.js.map +0 -1
- package/dist/server/tool-registry.d.ts.map +0 -1
- package/dist/server/tool-registry.js.map +0 -1
- package/dist/streaming/progress-store.d.ts.map +0 -1
- package/dist/streaming/progress-store.js.map +0 -1
- package/dist/tools/analyze-build-impact.d.ts.map +0 -1
- package/dist/tools/analyze-build-impact.js.map +0 -1
- package/dist/tools/analyze-core-to-shared.d.ts.map +0 -1
- package/dist/tools/analyze-core-to-shared.js.map +0 -1
- package/dist/tools/analyze-parser-performance.d.ts.map +0 -1
- package/dist/tools/analyze-parser-performance.js.map +0 -1
- package/dist/tools/analyze-project.d.ts.map +0 -1
- package/dist/tools/analyze-project.js.map +0 -1
- package/dist/tools/check-incremental-compatibility.d.ts.map +0 -1
- package/dist/tools/check-incremental-compatibility.js.map +0 -1
- package/dist/tools/collect-feedback.d.ts.map +0 -1
- package/dist/tools/collect-feedback.js.map +0 -1
- package/dist/tools/extract-libraries.d.ts.map +0 -1
- package/dist/tools/extract-libraries.js.map +0 -1
- package/dist/tools/find-angular-symbol.d.ts.map +0 -1
- package/dist/tools/find-angular-symbol.js.map +0 -1
- package/dist/tools/find-component-hosts.d.ts.map +0 -1
- package/dist/tools/find-component-hosts.js.map +0 -1
- package/dist/tools/find-usages.d.ts.map +0 -1
- package/dist/tools/find-usages.js.map +0 -1
- package/dist/tools/get-bootstrap-execution.d.ts.map +0 -1
- package/dist/tools/get-bootstrap-execution.js.map +0 -1
- package/dist/tools/get-call-graph.d.ts.map +0 -1
- package/dist/tools/get-call-graph.js.map +0 -1
- package/dist/tools/get-operation-progress-tool.d.ts.map +0 -1
- package/dist/tools/get-operation-progress-tool.js.map +0 -1
- package/dist/tools/get-operation-progress.d.ts.map +0 -1
- package/dist/tools/get-operation-progress.js.map +0 -1
- package/dist/tools/helpers/compact-output.d.ts.map +0 -1
- package/dist/tools/helpers/compact-output.js.map +0 -1
- package/dist/tools/helpers/feedback-analyzer.d.ts.map +0 -1
- package/dist/tools/helpers/feedback-analyzer.js.map +0 -1
- package/dist/tools/helpers/find-ts-config.d.ts.map +0 -1
- package/dist/tools/helpers/find-ts-config.js.map +0 -1
- package/dist/tools/helpers/platform-root-resolver.d.ts.map +0 -1
- package/dist/tools/helpers/platform-root-resolver.js.map +0 -1
- package/dist/tools/helpers/project-cache.d.ts.map +0 -1
- package/dist/tools/helpers/project-cache.js.map +0 -1
- package/dist/tools/helpers/rule-matcher.d.ts.map +0 -1
- package/dist/tools/helpers/rule-matcher.js.map +0 -1
- package/dist/tools/helpers/rule-runner.d.ts.map +0 -1
- package/dist/tools/helpers/rule-runner.js.map +0 -1
- package/dist/tools/helpers/scan-plan.d.ts.map +0 -1
- package/dist/tools/helpers/scan-plan.js.map +0 -1
- package/dist/tools/helpers/stack-frame-file-index.d.ts.map +0 -1
- package/dist/tools/helpers/stack-frame-file-index.js.map +0 -1
- package/dist/tools/helpers/suggestion-generator.d.ts.map +0 -1
- package/dist/tools/helpers/suggestion-generator.js.map +0 -1
- package/dist/tools/inspect-form-group.d.ts.map +0 -1
- package/dist/tools/inspect-form-group.js.map +0 -1
- package/dist/tools/inspect-i18n.d.ts.map +0 -1
- package/dist/tools/inspect-i18n.js.map +0 -1
- package/dist/tools/inspect-template.d.ts.map +0 -1
- package/dist/tools/inspect-template.js.map +0 -1
- package/dist/tools/learn-patterns.d.ts.map +0 -1
- package/dist/tools/learn-patterns.js.map +0 -1
- package/dist/tools/list-imports.d.ts.map +0 -1
- package/dist/tools/list-imports.js.map +0 -1
- package/dist/tools/orchestrate-migration.d.ts.map +0 -1
- package/dist/tools/orchestrate-migration.js.map +0 -1
- package/dist/tools/parse-stack-trace.d.ts.map +0 -1
- package/dist/tools/parse-stack-trace.js.map +0 -1
- package/dist/tools/plan-migration.d.ts.map +0 -1
- package/dist/tools/plan-migration.js.map +0 -1
- package/dist/tools/resolve-type.d.ts.map +0 -1
- package/dist/tools/resolve-type.js.map +0 -1
- package/dist/tools/review-feedback.d.ts.map +0 -1
- package/dist/tools/review-feedback.js.map +0 -1
- package/dist/tools/rollback-changes.d.ts.map +0 -1
- package/dist/tools/rollback-changes.js.map +0 -1
- package/dist/tools/run-angular-cli.d.ts.map +0 -1
- package/dist/tools/run-angular-cli.js.map +0 -1
- package/dist/tools/run-build.d.ts.map +0 -1
- package/dist/tools/run-build.js.map +0 -1
- package/dist/tools/run-schematic.d.ts.map +0 -1
- package/dist/tools/run-schematic.js.map +0 -1
- package/dist/tools/scan-all.d.ts.map +0 -1
- package/dist/tools/scan-all.js.map +0 -1
- package/dist/tools/scan-angular.d.ts.map +0 -1
- package/dist/tools/scan-angular.js.map +0 -1
- package/dist/tools/scan-architecture.d.ts.map +0 -1
- package/dist/tools/scan-architecture.js.map +0 -1
- package/dist/tools/scan-solid.d.ts.map +0 -1
- package/dist/tools/scan-solid.js.map +0 -1
- package/dist/tools/search-codebase.d.ts.map +0 -1
- package/dist/tools/search-codebase.js.map +0 -1
- package/dist/tools/server-status.d.ts.map +0 -1
- package/dist/tools/server-status.js.map +0 -1
- package/dist/tools/shared/scan-types.d.ts +0 -200
- package/dist/tools/shared/scan-types.d.ts.map +0 -1
- package/dist/tools/shared/scan-types.js +0 -7
- package/dist/tools/shared/scan-types.js.map +0 -1
- package/dist/tools/suggest-improvements.d.ts.map +0 -1
- package/dist/tools/suggest-improvements.js.map +0 -1
- package/dist/tools/trace-output-flow.d.ts.map +0 -1
- package/dist/tools/trace-output-flow.js.map +0 -1
- package/dist/tools/transform-code-batch.d.ts.map +0 -1
- package/dist/tools/transform-code-batch.js.map +0 -1
- package/dist/tools/transform-code.d.ts.map +0 -1
- package/dist/tools/transform-code.js.map +0 -1
- package/dist/tools/validate-before-transform.d.ts.map +0 -1
- package/dist/tools/validate-before-transform.js.map +0 -1
- package/dist/tools/validate-project-compatibility.d.ts.map +0 -1
- package/dist/tools/validate-project-compatibility.js.map +0 -1
- package/dist/tools/validate-transformation.d.ts.map +0 -1
- package/dist/tools/validate-transformation.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/utils/format-tool-response.d.ts.map +0 -1
- 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
|
-
*
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
*
|
|
51
|
-
*
|
|
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
|
-
*
|
|
58
|
-
* Completes validation in
|
|
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
|
-
*
|
|
14
|
-
*
|
|
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
|
-
*
|
|
21
|
-
* Completes validation in
|
|
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
|
-
|
|
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
|
-
|
|
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 (
|
|
229
|
+
return 'External Decorators (decorators outside the known frameworks)';
|
|
161
230
|
case 'custom':
|
|
162
231
|
return 'Custom (multiple complexity factors)';
|
|
163
232
|
case 'unknown':
|