@angular-modernizer/adapter-mcp 1.2.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 +84 -445
- package/dist/cli.js +9 -1
- package/dist/core/project-analyzer.js +2 -2
- package/dist/index.d.ts +9 -0
- 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 +7 -4
- package/dist/tools/analyze-build-impact.js +8 -3
- 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 +30 -4
- package/dist/tools/analyze-project.js +99 -15
- 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.js +3 -2
- package/dist/tools/find-component-hosts.js +3 -2
- package/dist/tools/find-usages.js +21 -12
- package/dist/tools/get-call-graph.js +15 -2
- 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 +5 -4
- package/dist/tools/helpers/project-cache.js +21 -16
- 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.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.js +5 -0
- package/dist/tools/inspect-i18n.d.ts +1 -1
- package/dist/tools/inspect-template.js +8 -2
- package/dist/tools/learn-patterns.d.ts +43 -28
- package/dist/tools/learn-patterns.js +83 -161
- package/dist/tools/list-imports.d.ts +1 -1
- 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.js +22 -10
- package/dist/tools/refresh-state.d.ts +378 -0
- package/dist/tools/refresh-state.js +370 -0
- package/dist/tools/resolve-type.js +10 -3
- 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 +6 -1
- package/dist/tools/search-codebase.js +13 -7
- package/dist/tools/suggest-improvements.d.ts +34 -3
- package/dist/tools/suggest-improvements.js +34 -9
- package/dist/tools/trace-output-flow.js +3 -2
- 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 +715 -206
- 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
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { type MCPTool, type ToolAnnotations, type ToolContext } from '../types.js';
|
|
2
|
+
import { type Project } from 'ts-morph';
|
|
3
|
+
import { type TemplateChecker } from './helpers/template-check.js';
|
|
2
4
|
/**
|
|
3
5
|
* Plugin config of a transformation: the plugins read `transformationType`
|
|
4
6
|
* and the transformation options under their own package name.
|
|
5
7
|
*/
|
|
6
8
|
export declare function pluginConfigFor(transformation: string | undefined, options: Record<string, unknown> | undefined): Record<string, Record<string, unknown>>;
|
|
9
|
+
/**
|
|
10
|
+
* The transformation options with the options of its analysis rule from the
|
|
11
|
+
* `rules` section as defaults: the rule and the transform then use the same
|
|
12
|
+
* thresholds. The call `options` win, key by key.
|
|
13
|
+
*/
|
|
14
|
+
export declare function withRuleOptionDefaults(transformation: string, rules: Readonly<Record<string, unknown>> | undefined, options: Record<string, unknown> | undefined): Record<string, unknown> | undefined;
|
|
7
15
|
/**
|
|
8
16
|
* Transformation result.
|
|
9
17
|
*/
|
|
@@ -13,9 +21,34 @@ export interface TransformationResult {
|
|
|
13
21
|
*/
|
|
14
22
|
operationId?: string;
|
|
15
23
|
/**
|
|
16
|
-
*
|
|
24
|
+
* `'running'` only in the immediate answer of a streaming call: the
|
|
25
|
+
* transformation has not run yet, so `success`, `modified`,
|
|
26
|
+
* `validation.syntaxValid` and `validation.typeCheckPassed` are `false`
|
|
27
|
+
* and mean "not yet"; get-operation-progress returns the real result.
|
|
28
|
+
* Unset in every other result.
|
|
29
|
+
*/
|
|
30
|
+
status?: 'running';
|
|
31
|
+
/**
|
|
32
|
+
* Whether the transformation was successful (`false` in the immediate
|
|
33
|
+
* answer of a streaming call, see `status`).
|
|
17
34
|
*/
|
|
18
35
|
success: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Whether the call left a file changed on disk (`false` for a run that had
|
|
38
|
+
* nothing to do, or whose changes were rolled back).
|
|
39
|
+
*/
|
|
40
|
+
modified?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Messages of the rules that handled the requested transformation, e.g.
|
|
43
|
+
* why nothing changed.
|
|
44
|
+
*/
|
|
45
|
+
ruleMessages?: string[];
|
|
46
|
+
/**
|
|
47
|
+
* Every file the call left changed or created, the requested one first;
|
|
48
|
+
* all of them were backed up, saved and checked. Files a rollback restored
|
|
49
|
+
* are not listed (they are in `rollback.files`).
|
|
50
|
+
*/
|
|
51
|
+
changedFiles?: string[];
|
|
19
52
|
/**
|
|
20
53
|
* The transformed file path (single file mode).
|
|
21
54
|
*/
|
|
@@ -30,16 +63,21 @@ export interface TransformationResult {
|
|
|
30
63
|
success: boolean;
|
|
31
64
|
/** Error message of a failed file. */
|
|
32
65
|
error?: string;
|
|
66
|
+
/** Lines the transformation left changed in this file. */
|
|
67
|
+
changes?: TransformationResult['changes'];
|
|
68
|
+
/** Whether the file was left changed on disk. */
|
|
69
|
+
modified?: boolean;
|
|
33
70
|
}[];
|
|
34
71
|
/**
|
|
35
72
|
* Type of transformation applied.
|
|
36
73
|
*/
|
|
37
74
|
transformation: string;
|
|
38
75
|
/**
|
|
39
|
-
*
|
|
76
|
+
* Lines the call left changed on disk, counted like `git diff --numstat`
|
|
77
|
+
* (a batch sums its files; a restored file counts 0).
|
|
40
78
|
*/
|
|
41
79
|
changes: {
|
|
42
|
-
/**
|
|
80
|
+
/** Added plus removed lines. */
|
|
43
81
|
linesChanged: number;
|
|
44
82
|
/** Added lines. */
|
|
45
83
|
additions: number;
|
|
@@ -74,14 +112,33 @@ export interface TransformationResult {
|
|
|
74
112
|
validation: {
|
|
75
113
|
/** `true` when the transformation introduced no syntax error. */
|
|
76
114
|
syntaxValid: boolean;
|
|
77
|
-
/**
|
|
115
|
+
/**
|
|
116
|
+
* `true` when the type check ran and found no new error; `false` when it
|
|
117
|
+
* failed or was skipped (`typeCheck` says which).
|
|
118
|
+
*/
|
|
78
119
|
typeCheckPassed: boolean;
|
|
120
|
+
/** Outcome of the type check; `skipped` with `validateTransformation: false`. */
|
|
121
|
+
typeCheck?: 'passed' | 'failed' | 'skipped';
|
|
79
122
|
/** Test outcome, when tests ran. */
|
|
80
123
|
testsPass?: boolean;
|
|
81
124
|
/**
|
|
82
125
|
* Type errors the transformation introduced into the file.
|
|
83
126
|
*/
|
|
84
127
|
introducedTypeErrors?: string[];
|
|
128
|
+
/**
|
|
129
|
+
* Type errors it caused in test files that import a changed file (`<file>: <error>`);
|
|
130
|
+
* they fail the transformation only with `failOnTestErrors`.
|
|
131
|
+
*/
|
|
132
|
+
testTypeErrors?: string[];
|
|
133
|
+
/**
|
|
134
|
+
* Outcome of the Angular template check, set when the call changed a
|
|
135
|
+
* template (a `templateUrl` file or an inline `template` text);
|
|
136
|
+
* `skipped` without `@angular/compiler-cli` in the project or with
|
|
137
|
+
* `validateTransformation: false`.
|
|
138
|
+
*/
|
|
139
|
+
templateCheck?: 'passed' | 'failed' | 'skipped';
|
|
140
|
+
/** Template errors the call introduced (`<file>: NG<code>: <message>`). */
|
|
141
|
+
introducedTemplateErrors?: string[];
|
|
85
142
|
};
|
|
86
143
|
/**
|
|
87
144
|
* Backup information (if backup was created).
|
|
@@ -108,6 +165,8 @@ export interface TransformationResult {
|
|
|
108
165
|
reason?: string;
|
|
109
166
|
/** `true` when the restore succeeded. */
|
|
110
167
|
success?: boolean;
|
|
168
|
+
/** Files the rollback restored (or removed, when the call created them). */
|
|
169
|
+
files?: string[];
|
|
111
170
|
};
|
|
112
171
|
/**
|
|
113
172
|
* Any warnings or issues.
|
|
@@ -207,6 +266,17 @@ export interface TransformationResult {
|
|
|
207
266
|
*/
|
|
208
267
|
summary: string;
|
|
209
268
|
}
|
|
269
|
+
/**
|
|
270
|
+
* Context file for a library-extraction whose `filePath` no longer exists
|
|
271
|
+
* (an earlier run moved it into the library): the first source file of the
|
|
272
|
+
* project, by path, in the workspace of that path (nearest folder above it
|
|
273
|
+
* with angular.json): a .ts or .tsx file, not a declaration file (ts-morph
|
|
274
|
+
* also keeps imported JSON files as source files). The rule only needs a file of
|
|
275
|
+
* the workspace and checks `options.artifacts`, so a second run with the
|
|
276
|
+
* same arguments reports what is already in the library. `undefined` in
|
|
277
|
+
* every other case, so the file load fails as before.
|
|
278
|
+
*/
|
|
279
|
+
export declare function movedFileContext(project: Project, filePath: string, transformation: string, options: Record<string, unknown>): string | undefined;
|
|
210
280
|
/**
|
|
211
281
|
* MCP tool `transform-code`: applies one of the transformation types to a
|
|
212
282
|
* file (or, with `files`, to a batch) to fix architectural issues, including
|
|
@@ -221,6 +291,15 @@ export interface TransformationResult {
|
|
|
221
291
|
*/
|
|
222
292
|
export declare class TransformCodeTool implements MCPTool {
|
|
223
293
|
name: string;
|
|
294
|
+
/** Compiles changed templates before and after a call. */
|
|
295
|
+
private readonly templateChecker;
|
|
296
|
+
/**
|
|
297
|
+
* @param options - `templateChecker` replaces the Angular compiler of the
|
|
298
|
+
* target project in the template check (tests).
|
|
299
|
+
*/
|
|
300
|
+
constructor(options?: {
|
|
301
|
+
templateChecker?: TemplateChecker;
|
|
302
|
+
});
|
|
224
303
|
title: string;
|
|
225
304
|
annotations: ToolAnnotations;
|
|
226
305
|
description: string;
|
|
@@ -246,7 +325,7 @@ export declare class TransformCodeTool implements MCPTool {
|
|
|
246
325
|
transformation: {
|
|
247
326
|
type: string;
|
|
248
327
|
description: string;
|
|
249
|
-
enum:
|
|
328
|
+
enum: ("constructor-to-inject" | "interface-extraction" | "standalone-migration" | "dependency-injection-migration" | "facade-pattern" | "form-modernization" | "constructor-injection-transform" | "component-inputs-interface-extraction" | "service-injection-cleanup" | "container-presentational" | "core-shared-modules" | "inheritance-to-composition" | "promise-service-to-observable" | "promise-component-to-reactive" | "promise-cleanup" | "sequential-await-to-forkjoin" | "missing-output-transform" | "subscription-transform" | "library-extraction" | "service-bag-transform" | "any-to-interface" | "dto-object-literal" | "interface-duplication" | "static-class-to-functions" | "extract-static-from-stateful" | "type-safety")[];
|
|
250
329
|
};
|
|
251
330
|
options: {
|
|
252
331
|
type: string;
|
|
@@ -368,6 +447,11 @@ export declare class TransformCodeTool implements MCPTool {
|
|
|
368
447
|
description: string;
|
|
369
448
|
default: boolean;
|
|
370
449
|
};
|
|
450
|
+
failOnTestErrors: {
|
|
451
|
+
type: string;
|
|
452
|
+
description: string;
|
|
453
|
+
default: boolean;
|
|
454
|
+
};
|
|
371
455
|
rollbackOnBuildFailure: {
|
|
372
456
|
type: string;
|
|
373
457
|
description: string;
|
|
@@ -395,9 +479,29 @@ export declare class TransformCodeTool implements MCPTool {
|
|
|
395
479
|
operationId: {
|
|
396
480
|
type: string;
|
|
397
481
|
};
|
|
482
|
+
status: {
|
|
483
|
+
type: string;
|
|
484
|
+
enum: string[];
|
|
485
|
+
description: string;
|
|
486
|
+
};
|
|
398
487
|
success: {
|
|
399
488
|
type: string;
|
|
400
489
|
};
|
|
490
|
+
modified: {
|
|
491
|
+
type: string;
|
|
492
|
+
};
|
|
493
|
+
ruleMessages: {
|
|
494
|
+
readonly type: "array";
|
|
495
|
+
readonly items: {
|
|
496
|
+
readonly type: "string";
|
|
497
|
+
};
|
|
498
|
+
};
|
|
499
|
+
changedFiles: {
|
|
500
|
+
readonly type: "array";
|
|
501
|
+
readonly items: {
|
|
502
|
+
readonly type: "string";
|
|
503
|
+
};
|
|
504
|
+
};
|
|
401
505
|
filePath: {
|
|
402
506
|
type: string;
|
|
403
507
|
};
|
|
@@ -415,6 +519,23 @@ export declare class TransformCodeTool implements MCPTool {
|
|
|
415
519
|
error: {
|
|
416
520
|
type: string;
|
|
417
521
|
};
|
|
522
|
+
modified: {
|
|
523
|
+
type: string;
|
|
524
|
+
};
|
|
525
|
+
changes: {
|
|
526
|
+
type: string;
|
|
527
|
+
properties: {
|
|
528
|
+
linesChanged: {
|
|
529
|
+
type: string;
|
|
530
|
+
};
|
|
531
|
+
additions: {
|
|
532
|
+
type: string;
|
|
533
|
+
};
|
|
534
|
+
deletions: {
|
|
535
|
+
type: string;
|
|
536
|
+
};
|
|
537
|
+
};
|
|
538
|
+
};
|
|
418
539
|
};
|
|
419
540
|
required: string[];
|
|
420
541
|
};
|
|
@@ -482,6 +603,10 @@ export declare class TransformCodeTool implements MCPTool {
|
|
|
482
603
|
typeCheckPassed: {
|
|
483
604
|
type: string;
|
|
484
605
|
};
|
|
606
|
+
typeCheck: {
|
|
607
|
+
type: string;
|
|
608
|
+
enum: string[];
|
|
609
|
+
};
|
|
485
610
|
testsPass: {
|
|
486
611
|
type: string;
|
|
487
612
|
};
|
|
@@ -491,6 +616,22 @@ export declare class TransformCodeTool implements MCPTool {
|
|
|
491
616
|
readonly type: "string";
|
|
492
617
|
};
|
|
493
618
|
};
|
|
619
|
+
testTypeErrors: {
|
|
620
|
+
readonly type: "array";
|
|
621
|
+
readonly items: {
|
|
622
|
+
readonly type: "string";
|
|
623
|
+
};
|
|
624
|
+
};
|
|
625
|
+
templateCheck: {
|
|
626
|
+
type: string;
|
|
627
|
+
enum: string[];
|
|
628
|
+
};
|
|
629
|
+
introducedTemplateErrors: {
|
|
630
|
+
readonly type: "array";
|
|
631
|
+
readonly items: {
|
|
632
|
+
readonly type: "string";
|
|
633
|
+
};
|
|
634
|
+
};
|
|
494
635
|
};
|
|
495
636
|
required: string[];
|
|
496
637
|
};
|
|
@@ -525,6 +666,12 @@ export declare class TransformCodeTool implements MCPTool {
|
|
|
525
666
|
success: {
|
|
526
667
|
type: string;
|
|
527
668
|
};
|
|
669
|
+
files: {
|
|
670
|
+
readonly type: "array";
|
|
671
|
+
readonly items: {
|
|
672
|
+
readonly type: "string";
|
|
673
|
+
};
|
|
674
|
+
};
|
|
528
675
|
};
|
|
529
676
|
required: string[];
|
|
530
677
|
};
|
|
@@ -697,11 +844,17 @@ export declare class TransformCodeTool implements MCPTool {
|
|
|
697
844
|
* when a build ran.
|
|
698
845
|
*/
|
|
699
846
|
private validateTransformedFile;
|
|
847
|
+
/**
|
|
848
|
+
* Template check of the changed files with the tool's checker;
|
|
849
|
+
* `undefined` when they changed no template.
|
|
850
|
+
*/
|
|
851
|
+
private checkTemplates;
|
|
700
852
|
/**
|
|
701
853
|
* Streaming mode: runs the synchronous path (same safety envelope, batch
|
|
702
|
-
* included) in the background and returns the operationId at once
|
|
703
|
-
*
|
|
704
|
-
* get-operation-progress
|
|
854
|
+
* included) in the background and returns the operationId at once with
|
|
855
|
+
* `status: 'running'` and no success or passed check claimed. The result
|
|
856
|
+
* is stored with setResult before markComplete, so get-operation-progress
|
|
857
|
+
* returns it.
|
|
705
858
|
*/
|
|
706
859
|
private executeStreaming;
|
|
707
860
|
/**
|
|
@@ -716,10 +869,6 @@ export declare class TransformCodeTool implements MCPTool {
|
|
|
716
869
|
* Find the project root from a file path.
|
|
717
870
|
*/
|
|
718
871
|
private findProjectRoot;
|
|
719
|
-
/**
|
|
720
|
-
* Validate the transformation.
|
|
721
|
-
*/
|
|
722
|
-
private validateTransformation;
|
|
723
872
|
/**
|
|
724
873
|
* Get validation schema for a specific transformation type.
|
|
725
874
|
*/
|