@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
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @angular-modernizer/adapter-mcp - Validation issues in summaries
|
|
3
|
+
*
|
|
4
|
+
* validate-before-transform and validate-transformation return an `issues`
|
|
5
|
+
* list with a severity each; their summaries count the issues per severity
|
|
6
|
+
* and spell out the first ones, errors first.
|
|
7
|
+
*/
|
|
8
|
+
/** Issues spelled out in a summary; the rest is in `issues`. */
|
|
9
|
+
export declare const SUMMARY_ISSUES = 10;
|
|
10
|
+
/** The part of a validation issue a summary shows. */
|
|
11
|
+
export interface SummaryIssue {
|
|
12
|
+
type: string;
|
|
13
|
+
severity: 'error' | 'warning' | 'info';
|
|
14
|
+
message: string;
|
|
15
|
+
line?: number;
|
|
16
|
+
}
|
|
17
|
+
/** `N issue(s) (error 2, warning 1)` */
|
|
18
|
+
export declare function issueCount(issues: readonly SummaryIssue[]): string;
|
|
19
|
+
/** One `- severity type line N: message` line per issue, errors first, at most `max`. */
|
|
20
|
+
export declare function issueLines(issues: readonly SummaryIssue[], max?: number): string[];
|
|
21
|
+
/** Output schema of a validation issue list. */
|
|
22
|
+
export declare const VALIDATION_ISSUES_SCHEMA: {
|
|
23
|
+
readonly type: "array";
|
|
24
|
+
readonly items: {
|
|
25
|
+
readonly type: "object";
|
|
26
|
+
readonly properties: {
|
|
27
|
+
readonly type: {
|
|
28
|
+
readonly type: "string";
|
|
29
|
+
};
|
|
30
|
+
readonly severity: {
|
|
31
|
+
readonly type: "string";
|
|
32
|
+
readonly enum: readonly ["error", "warning", "info"];
|
|
33
|
+
};
|
|
34
|
+
readonly message: {
|
|
35
|
+
readonly type: "string";
|
|
36
|
+
};
|
|
37
|
+
readonly filePath: {
|
|
38
|
+
readonly type: "string";
|
|
39
|
+
};
|
|
40
|
+
readonly line: {
|
|
41
|
+
readonly type: "integer";
|
|
42
|
+
};
|
|
43
|
+
readonly column: {
|
|
44
|
+
readonly type: "integer";
|
|
45
|
+
};
|
|
46
|
+
readonly details: {
|
|
47
|
+
readonly type: "string";
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
readonly required: readonly ["type", "severity", "message"];
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=validation-output.d.ts.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @angular-modernizer/adapter-mcp - Validation issues in summaries
|
|
3
|
+
*
|
|
4
|
+
* validate-before-transform and validate-transformation return an `issues`
|
|
5
|
+
* list with a severity each; their summaries count the issues per severity
|
|
6
|
+
* and spell out the first ones, errors first.
|
|
7
|
+
*/
|
|
8
|
+
import { countList } from './analysis-output.js';
|
|
9
|
+
/** Issues spelled out in a summary; the rest is in `issues`. */
|
|
10
|
+
export const SUMMARY_ISSUES = 10;
|
|
11
|
+
const SEVERITY_RANK = { error: 0, warning: 1, info: 2 };
|
|
12
|
+
/** `N issue(s) (error 2, warning 1)` */
|
|
13
|
+
export function issueCount(issues) {
|
|
14
|
+
const bySeverity = {};
|
|
15
|
+
for (const issue of issues) {
|
|
16
|
+
bySeverity[issue.severity] = (bySeverity[issue.severity] ?? 0) + 1;
|
|
17
|
+
}
|
|
18
|
+
const counts = countList(bySeverity, 3);
|
|
19
|
+
return `${issues.length} issue(s)${counts === undefined ? '' : ` (${counts})`}`;
|
|
20
|
+
}
|
|
21
|
+
/** One `- severity type line N: message` line per issue, errors first, at most `max`. */
|
|
22
|
+
export function issueLines(issues, max = SUMMARY_ISSUES) {
|
|
23
|
+
return [...issues]
|
|
24
|
+
.sort((a, b) => SEVERITY_RANK[a.severity] - SEVERITY_RANK[b.severity])
|
|
25
|
+
.slice(0, max)
|
|
26
|
+
.map((issue) => {
|
|
27
|
+
const where = issue.line === undefined ? '' : ` line ${issue.line}`;
|
|
28
|
+
return `- ${issue.severity} ${issue.type}${where}: ${issue.message}`;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/** Output schema of a validation issue list. */
|
|
32
|
+
export const VALIDATION_ISSUES_SCHEMA = {
|
|
33
|
+
type: 'array',
|
|
34
|
+
items: {
|
|
35
|
+
type: 'object',
|
|
36
|
+
properties: {
|
|
37
|
+
type: { type: 'string' },
|
|
38
|
+
severity: { type: 'string', enum: ['error', 'warning', 'info'] },
|
|
39
|
+
message: { type: 'string' },
|
|
40
|
+
filePath: { type: 'string' },
|
|
41
|
+
line: { type: 'integer' },
|
|
42
|
+
column: { type: 'integer' },
|
|
43
|
+
details: { type: 'string' },
|
|
44
|
+
},
|
|
45
|
+
required: ['type', 'severity', 'message'],
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=validation-output.js.map
|
|
@@ -1,6 +1,29 @@
|
|
|
1
|
+
import { type MCPTool, type ToolAnnotations } from '../types.js';
|
|
2
|
+
import { type InspectedForm, type InspectedFormControl } from '@angular-modernizer/api';
|
|
3
|
+
import { ProjectCache } from './helpers/project-cache.js';
|
|
4
|
+
/** A control with the cascade optionally dropped. */
|
|
5
|
+
export type ControlOutput = Omit<InspectedFormControl, 'cascade'> & Partial<Pick<InspectedFormControl, 'cascade'>>;
|
|
6
|
+
/** A form shaped by the compact options. */
|
|
7
|
+
export type FormOutput = Omit<InspectedForm, 'controls'> & {
|
|
8
|
+
/** Controls, cut to `maxResults`; omitted with `summaryOnly`. */
|
|
9
|
+
controls?: ControlOutput[];
|
|
10
|
+
/** `true` when `maxResults` cut the control list. */
|
|
11
|
+
truncated: boolean;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Output of the inspect-form-group tool.
|
|
15
|
+
*/
|
|
16
|
+
export interface InspectFormGroupOutput {
|
|
17
|
+
/** Reactive forms found in the file. */
|
|
18
|
+
forms: FormOutput[];
|
|
19
|
+
/** Short text summary of the forms and their controls. */
|
|
20
|
+
summary: string;
|
|
21
|
+
/** The tsconfig whose program was used. */
|
|
22
|
+
tsConfigPath: string;
|
|
23
|
+
/** Conditions that can make the result incomplete (unresolved library imports). */
|
|
24
|
+
warnings?: string[];
|
|
25
|
+
}
|
|
1
26
|
/**
|
|
2
|
-
* @angular-modernizer/adapter-mcp - Inspect Form Group Tool
|
|
3
|
-
*
|
|
4
27
|
* MCP tool that returns the Reactive Forms of a component or service file
|
|
5
28
|
* as structure: controls with validators and initial state, and every
|
|
6
29
|
* enable/disable/validator change per control, including what an ancestor
|
|
@@ -18,34 +41,20 @@
|
|
|
18
41
|
* // args: { file: 'src/app/edit/edit.component.ts', projectRoot: '/project' }
|
|
19
42
|
* ```
|
|
20
43
|
*/
|
|
21
|
-
import { type MCPTool } from '../types.js';
|
|
22
|
-
import { type InspectedForm, type InspectedFormControl } from '@angular-modernizer/api';
|
|
23
|
-
import { ProjectCache } from './helpers/project-cache.js';
|
|
24
|
-
/** A control with the cascade optionally dropped. */
|
|
25
|
-
type ControlOutput = Omit<InspectedFormControl, 'cascade'> & Partial<Pick<InspectedFormControl, 'cascade'>>;
|
|
26
|
-
/** A form shaped by the compact options. */
|
|
27
|
-
type FormOutput = Omit<InspectedForm, 'controls'> & {
|
|
28
|
-
controls?: ControlOutput[];
|
|
29
|
-
truncated: boolean;
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Output of the inspect-form-group tool.
|
|
33
|
-
*/
|
|
34
|
-
interface InspectFormGroupOutput {
|
|
35
|
-
forms: FormOutput[];
|
|
36
|
-
summary: string;
|
|
37
|
-
tsConfigPath: string;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* MCP tool that inspects Reactive Forms in a file.
|
|
41
|
-
*/
|
|
42
44
|
export declare class InspectFormGroupTool implements MCPTool {
|
|
43
45
|
private readonly projects;
|
|
44
46
|
readonly name = "inspect-form-group";
|
|
47
|
+
readonly title = "Inspect Form Group";
|
|
48
|
+
readonly annotations: ToolAnnotations;
|
|
45
49
|
constructor(projects?: ProjectCache);
|
|
46
50
|
readonly description: string;
|
|
51
|
+
/**
|
|
52
|
+
* JSON Schema of the tool arguments.
|
|
53
|
+
* @hidden
|
|
54
|
+
*/
|
|
47
55
|
readonly inputSchema: {
|
|
48
56
|
type: string;
|
|
57
|
+
additionalProperties: boolean;
|
|
49
58
|
properties: {
|
|
50
59
|
summaryOnly: {
|
|
51
60
|
readonly type: "boolean";
|
|
@@ -85,9 +94,238 @@ export declare class InspectFormGroupTool implements MCPTool {
|
|
|
85
94
|
};
|
|
86
95
|
required: string[];
|
|
87
96
|
};
|
|
97
|
+
/**
|
|
98
|
+
* JSON Schema of the tool result (`structuredContent`).
|
|
99
|
+
* @hidden
|
|
100
|
+
*/
|
|
101
|
+
readonly outputSchema: {
|
|
102
|
+
type: string;
|
|
103
|
+
properties: {
|
|
104
|
+
warnings: {
|
|
105
|
+
readonly type: "array";
|
|
106
|
+
readonly items: {
|
|
107
|
+
readonly type: "string";
|
|
108
|
+
};
|
|
109
|
+
readonly description: "Conditions that can make the result incomplete, e.g. library imports that do not resolve because node_modules is missing.";
|
|
110
|
+
};
|
|
111
|
+
forms: {
|
|
112
|
+
type: string;
|
|
113
|
+
items: {
|
|
114
|
+
readonly type: "object";
|
|
115
|
+
readonly properties: {
|
|
116
|
+
readonly className: {
|
|
117
|
+
readonly type: "string";
|
|
118
|
+
};
|
|
119
|
+
readonly property: {
|
|
120
|
+
readonly type: "string";
|
|
121
|
+
};
|
|
122
|
+
readonly file: {
|
|
123
|
+
readonly type: "string";
|
|
124
|
+
};
|
|
125
|
+
readonly definedAt: {
|
|
126
|
+
readonly type: "array";
|
|
127
|
+
readonly items: {
|
|
128
|
+
readonly type: "integer";
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
readonly kind: {
|
|
132
|
+
readonly type: "string";
|
|
133
|
+
};
|
|
134
|
+
readonly validators: {
|
|
135
|
+
readonly type: "array";
|
|
136
|
+
readonly items: {
|
|
137
|
+
readonly type: "string";
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
readonly controls: {
|
|
141
|
+
readonly type: "array";
|
|
142
|
+
readonly items: {
|
|
143
|
+
readonly type: "object";
|
|
144
|
+
readonly properties: {
|
|
145
|
+
readonly path: {
|
|
146
|
+
readonly type: "string";
|
|
147
|
+
};
|
|
148
|
+
readonly kind: {
|
|
149
|
+
readonly type: "string";
|
|
150
|
+
};
|
|
151
|
+
readonly line: {
|
|
152
|
+
readonly type: "integer";
|
|
153
|
+
};
|
|
154
|
+
readonly disabledInitially: {
|
|
155
|
+
readonly type: "boolean";
|
|
156
|
+
};
|
|
157
|
+
readonly validators: {
|
|
158
|
+
readonly type: "array";
|
|
159
|
+
readonly items: {
|
|
160
|
+
readonly type: "string";
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
readonly asyncValidators: {
|
|
164
|
+
readonly type: "array";
|
|
165
|
+
readonly items: {
|
|
166
|
+
readonly type: "string";
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
readonly addedAt: {
|
|
170
|
+
readonly type: "integer";
|
|
171
|
+
};
|
|
172
|
+
readonly operations: {
|
|
173
|
+
readonly type: "array";
|
|
174
|
+
readonly items: {
|
|
175
|
+
readonly type: "object";
|
|
176
|
+
readonly properties: {
|
|
177
|
+
readonly op: {
|
|
178
|
+
readonly type: "string";
|
|
179
|
+
};
|
|
180
|
+
readonly line: {
|
|
181
|
+
readonly type: "integer";
|
|
182
|
+
};
|
|
183
|
+
readonly args: {
|
|
184
|
+
readonly type: "string";
|
|
185
|
+
};
|
|
186
|
+
readonly in: {
|
|
187
|
+
readonly type: "string";
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
readonly required: readonly ["op", "line", "in"];
|
|
191
|
+
};
|
|
192
|
+
};
|
|
193
|
+
readonly cascade: {
|
|
194
|
+
readonly type: "array";
|
|
195
|
+
readonly items: {
|
|
196
|
+
readonly type: "object";
|
|
197
|
+
readonly properties: {
|
|
198
|
+
readonly op: {
|
|
199
|
+
readonly type: "string";
|
|
200
|
+
};
|
|
201
|
+
readonly from: {
|
|
202
|
+
readonly type: "string";
|
|
203
|
+
};
|
|
204
|
+
readonly line: {
|
|
205
|
+
readonly type: "integer";
|
|
206
|
+
};
|
|
207
|
+
readonly in: {
|
|
208
|
+
readonly type: "string";
|
|
209
|
+
};
|
|
210
|
+
};
|
|
211
|
+
readonly required: readonly ["op", "from", "line", "in"];
|
|
212
|
+
};
|
|
213
|
+
};
|
|
214
|
+
readonly reEnabledBy: {
|
|
215
|
+
readonly type: "array";
|
|
216
|
+
readonly items: {
|
|
217
|
+
readonly type: "object";
|
|
218
|
+
readonly properties: {
|
|
219
|
+
readonly op: {
|
|
220
|
+
readonly type: "string";
|
|
221
|
+
};
|
|
222
|
+
readonly from: {
|
|
223
|
+
readonly type: "string";
|
|
224
|
+
};
|
|
225
|
+
readonly line: {
|
|
226
|
+
readonly type: "integer";
|
|
227
|
+
};
|
|
228
|
+
readonly in: {
|
|
229
|
+
readonly type: "string";
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
readonly required: readonly ["op", "from", "line", "in"];
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
readonly required: readonly ["path", "kind", "line", "disabledInitially", "validators", "asyncValidators", "operations"];
|
|
237
|
+
};
|
|
238
|
+
};
|
|
239
|
+
readonly operations: {
|
|
240
|
+
readonly type: "array";
|
|
241
|
+
readonly items: {
|
|
242
|
+
readonly type: "object";
|
|
243
|
+
readonly properties: {
|
|
244
|
+
readonly op: {
|
|
245
|
+
readonly type: "string";
|
|
246
|
+
};
|
|
247
|
+
readonly line: {
|
|
248
|
+
readonly type: "integer";
|
|
249
|
+
};
|
|
250
|
+
readonly args: {
|
|
251
|
+
readonly type: "string";
|
|
252
|
+
};
|
|
253
|
+
readonly in: {
|
|
254
|
+
readonly type: "string";
|
|
255
|
+
};
|
|
256
|
+
};
|
|
257
|
+
readonly required: readonly ["op", "line", "in"];
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
readonly unknownPaths: {
|
|
261
|
+
readonly type: "array";
|
|
262
|
+
readonly items: {
|
|
263
|
+
readonly type: "object";
|
|
264
|
+
readonly properties: {
|
|
265
|
+
readonly path: {
|
|
266
|
+
readonly type: "string";
|
|
267
|
+
};
|
|
268
|
+
readonly op: {
|
|
269
|
+
readonly type: "string";
|
|
270
|
+
};
|
|
271
|
+
readonly line: {
|
|
272
|
+
readonly type: "integer";
|
|
273
|
+
};
|
|
274
|
+
};
|
|
275
|
+
readonly required: readonly ["path", "op", "line"];
|
|
276
|
+
};
|
|
277
|
+
};
|
|
278
|
+
readonly dynamicOperations: {
|
|
279
|
+
readonly type: "array";
|
|
280
|
+
readonly items: {
|
|
281
|
+
readonly type: "object";
|
|
282
|
+
readonly properties: {
|
|
283
|
+
readonly path: {
|
|
284
|
+
readonly type: "string";
|
|
285
|
+
};
|
|
286
|
+
readonly op: {
|
|
287
|
+
readonly type: "string";
|
|
288
|
+
};
|
|
289
|
+
readonly line: {
|
|
290
|
+
readonly type: "integer";
|
|
291
|
+
};
|
|
292
|
+
readonly args: {
|
|
293
|
+
readonly type: "string";
|
|
294
|
+
};
|
|
295
|
+
readonly in: {
|
|
296
|
+
readonly type: "string";
|
|
297
|
+
};
|
|
298
|
+
};
|
|
299
|
+
readonly required: readonly ["op", "line", "in", "path"];
|
|
300
|
+
};
|
|
301
|
+
};
|
|
302
|
+
readonly counts: {
|
|
303
|
+
readonly type: "object";
|
|
304
|
+
readonly properties: {
|
|
305
|
+
[k: string]: {
|
|
306
|
+
type: string;
|
|
307
|
+
};
|
|
308
|
+
};
|
|
309
|
+
readonly required: readonly ["controls", "validated", "disabledInitially", "operations", "unknownPaths", "dynamicOperations", "reEnabledByAncestor"];
|
|
310
|
+
};
|
|
311
|
+
readonly truncated: {
|
|
312
|
+
readonly type: "boolean";
|
|
313
|
+
};
|
|
314
|
+
};
|
|
315
|
+
readonly required: readonly ["className", "property", "file", "definedAt", "kind", "validators", "operations", "unknownPaths", "dynamicOperations", "counts", "truncated"];
|
|
316
|
+
};
|
|
317
|
+
};
|
|
318
|
+
summary: {
|
|
319
|
+
type: string;
|
|
320
|
+
};
|
|
321
|
+
tsConfigPath: {
|
|
322
|
+
type: string;
|
|
323
|
+
};
|
|
324
|
+
};
|
|
325
|
+
required: string[];
|
|
326
|
+
};
|
|
88
327
|
execute(args: Record<string, unknown>): Promise<InspectFormGroupOutput>;
|
|
89
328
|
private shape;
|
|
90
329
|
private buildSummary;
|
|
91
330
|
}
|
|
92
|
-
export {};
|
|
93
331
|
//# sourceMappingURL=inspect-form-group.d.ts.map
|
|
@@ -1,6 +1,110 @@
|
|
|
1
|
+
import { FormGroupInspector, } from '@angular-modernizer/api';
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import { isAbsolute, resolve } from 'node:path';
|
|
4
|
+
import { findTsConfig } from './helpers/find-ts-config.js';
|
|
5
|
+
import { ProjectCache } from './helpers/project-cache.js';
|
|
6
|
+
import { COMPACT_OUTPUT_SCHEMA, limitList, parseCompactOptions, } from './helpers/compact-output.js';
|
|
7
|
+
import { WARNINGS_OUTPUT_SCHEMA, withWarnings, } from './helpers/output-contract.js';
|
|
8
|
+
import { STRING_ARRAY } from './helpers/investigation-schemas.js';
|
|
9
|
+
const OPERATION_FIELDS = {
|
|
10
|
+
op: { type: 'string' },
|
|
11
|
+
line: { type: 'integer' },
|
|
12
|
+
args: { type: 'string' },
|
|
13
|
+
in: { type: 'string' },
|
|
14
|
+
};
|
|
15
|
+
const OPERATIONS_SCHEMA = {
|
|
16
|
+
type: 'array',
|
|
17
|
+
items: { type: 'object', properties: OPERATION_FIELDS, required: ['op', 'line', 'in'] },
|
|
18
|
+
};
|
|
19
|
+
const CASCADE_SCHEMA = {
|
|
20
|
+
type: 'array',
|
|
21
|
+
items: {
|
|
22
|
+
type: 'object',
|
|
23
|
+
properties: {
|
|
24
|
+
op: { type: 'string' },
|
|
25
|
+
from: { type: 'string' },
|
|
26
|
+
line: { type: 'integer' },
|
|
27
|
+
in: { type: 'string' },
|
|
28
|
+
},
|
|
29
|
+
required: ['op', 'from', 'line', 'in'],
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
const FORM_COUNT_KEYS = [
|
|
33
|
+
'controls',
|
|
34
|
+
'validated',
|
|
35
|
+
'disabledInitially',
|
|
36
|
+
'operations',
|
|
37
|
+
'unknownPaths',
|
|
38
|
+
'dynamicOperations',
|
|
39
|
+
'reEnabledByAncestor',
|
|
40
|
+
];
|
|
41
|
+
const FORM_SCHEMA = {
|
|
42
|
+
type: 'object',
|
|
43
|
+
properties: {
|
|
44
|
+
className: { type: 'string' },
|
|
45
|
+
property: { type: 'string' },
|
|
46
|
+
file: { type: 'string' },
|
|
47
|
+
definedAt: { type: 'array', items: { type: 'integer' } },
|
|
48
|
+
kind: { type: 'string' },
|
|
49
|
+
validators: STRING_ARRAY,
|
|
50
|
+
controls: {
|
|
51
|
+
type: 'array',
|
|
52
|
+
items: {
|
|
53
|
+
type: 'object',
|
|
54
|
+
properties: {
|
|
55
|
+
path: { type: 'string' },
|
|
56
|
+
kind: { type: 'string' },
|
|
57
|
+
line: { type: 'integer' },
|
|
58
|
+
disabledInitially: { type: 'boolean' },
|
|
59
|
+
validators: STRING_ARRAY,
|
|
60
|
+
asyncValidators: STRING_ARRAY,
|
|
61
|
+
addedAt: { type: 'integer' },
|
|
62
|
+
operations: OPERATIONS_SCHEMA,
|
|
63
|
+
cascade: CASCADE_SCHEMA,
|
|
64
|
+
reEnabledBy: CASCADE_SCHEMA,
|
|
65
|
+
},
|
|
66
|
+
required: ['path', 'kind', 'line', 'disabledInitially', 'validators', 'asyncValidators', 'operations'],
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
operations: OPERATIONS_SCHEMA,
|
|
70
|
+
unknownPaths: {
|
|
71
|
+
type: 'array',
|
|
72
|
+
items: {
|
|
73
|
+
type: 'object',
|
|
74
|
+
properties: { path: { type: 'string' }, op: { type: 'string' }, line: { type: 'integer' } },
|
|
75
|
+
required: ['path', 'op', 'line'],
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
dynamicOperations: {
|
|
79
|
+
type: 'array',
|
|
80
|
+
items: {
|
|
81
|
+
type: 'object',
|
|
82
|
+
properties: { ...OPERATION_FIELDS, path: { type: 'string' } },
|
|
83
|
+
required: ['op', 'line', 'in', 'path'],
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
counts: {
|
|
87
|
+
type: 'object',
|
|
88
|
+
properties: Object.fromEntries(FORM_COUNT_KEYS.map((k) => [k, { type: 'integer' }])),
|
|
89
|
+
required: [...FORM_COUNT_KEYS],
|
|
90
|
+
},
|
|
91
|
+
truncated: { type: 'boolean' },
|
|
92
|
+
},
|
|
93
|
+
required: [
|
|
94
|
+
'className',
|
|
95
|
+
'property',
|
|
96
|
+
'file',
|
|
97
|
+
'definedAt',
|
|
98
|
+
'kind',
|
|
99
|
+
'validators',
|
|
100
|
+
'operations',
|
|
101
|
+
'unknownPaths',
|
|
102
|
+
'dynamicOperations',
|
|
103
|
+
'counts',
|
|
104
|
+
'truncated',
|
|
105
|
+
],
|
|
106
|
+
};
|
|
1
107
|
/**
|
|
2
|
-
* @angular-modernizer/adapter-mcp - Inspect Form Group Tool
|
|
3
|
-
*
|
|
4
108
|
* MCP tool that returns the Reactive Forms of a component or service file
|
|
5
109
|
* as structure: controls with validators and initial state, and every
|
|
6
110
|
* enable/disable/validator change per control, including what an ancestor
|
|
@@ -18,18 +122,16 @@
|
|
|
18
122
|
* // args: { file: 'src/app/edit/edit.component.ts', projectRoot: '/project' }
|
|
19
123
|
* ```
|
|
20
124
|
*/
|
|
21
|
-
import { FormGroupInspector, } from '@angular-modernizer/api';
|
|
22
|
-
import { existsSync } from 'node:fs';
|
|
23
|
-
import { isAbsolute, resolve } from 'node:path';
|
|
24
|
-
import { findTsConfig } from './helpers/find-ts-config.js';
|
|
25
|
-
import { ProjectCache } from './helpers/project-cache.js';
|
|
26
|
-
import { COMPACT_OUTPUT_SCHEMA, limitList, parseCompactOptions, } from './helpers/compact-output.js';
|
|
27
|
-
/**
|
|
28
|
-
* MCP tool that inspects Reactive Forms in a file.
|
|
29
|
-
*/
|
|
30
125
|
export class InspectFormGroupTool {
|
|
31
126
|
projects;
|
|
32
127
|
name = 'inspect-form-group';
|
|
128
|
+
title = 'Inspect Form Group';
|
|
129
|
+
annotations = {
|
|
130
|
+
readOnlyHint: true,
|
|
131
|
+
destructiveHint: false,
|
|
132
|
+
idempotentHint: true,
|
|
133
|
+
openWorldHint: false,
|
|
134
|
+
};
|
|
33
135
|
constructor(projects = new ProjectCache()) {
|
|
34
136
|
this.projects = projects;
|
|
35
137
|
}
|
|
@@ -43,8 +145,13 @@ export class InspectFormGroupTool {
|
|
|
43
145
|
'lists paths that do not exist in the form (typos, stale names: a runtime error when called); ' +
|
|
44
146
|
'dynamicOperations lists computed keys (controls[key] in a loop). Only this file is searched. summaryOnly ' +
|
|
45
147
|
'drops the control lists, maxResults caps them.';
|
|
148
|
+
/**
|
|
149
|
+
* JSON Schema of the tool arguments.
|
|
150
|
+
* @hidden
|
|
151
|
+
*/
|
|
46
152
|
inputSchema = {
|
|
47
153
|
type: 'object',
|
|
154
|
+
additionalProperties: false,
|
|
48
155
|
properties: {
|
|
49
156
|
file: {
|
|
50
157
|
type: 'string',
|
|
@@ -76,6 +183,20 @@ export class InspectFormGroupTool {
|
|
|
76
183
|
},
|
|
77
184
|
required: ['file', 'projectRoot'],
|
|
78
185
|
};
|
|
186
|
+
/**
|
|
187
|
+
* JSON Schema of the tool result (`structuredContent`).
|
|
188
|
+
* @hidden
|
|
189
|
+
*/
|
|
190
|
+
outputSchema = {
|
|
191
|
+
type: 'object',
|
|
192
|
+
properties: {
|
|
193
|
+
forms: { type: 'array', items: FORM_SCHEMA },
|
|
194
|
+
summary: { type: 'string' },
|
|
195
|
+
tsConfigPath: { type: 'string' },
|
|
196
|
+
...WARNINGS_OUTPUT_SCHEMA,
|
|
197
|
+
},
|
|
198
|
+
required: ['forms', 'summary', 'tsConfigPath'],
|
|
199
|
+
};
|
|
79
200
|
async execute(args) {
|
|
80
201
|
const params = args;
|
|
81
202
|
if (!params.file || typeof params.file !== 'string') {
|
|
@@ -106,11 +227,11 @@ export class InspectFormGroupTool {
|
|
|
106
227
|
includeValueOperations: params.includeValueOperations === true,
|
|
107
228
|
});
|
|
108
229
|
const includeCascade = params.includeCascade !== false;
|
|
109
|
-
return {
|
|
230
|
+
return withWarnings({
|
|
110
231
|
forms: forms.map((f) => this.shape(f, compact.summaryOnly, compact.maxResults, includeCascade)),
|
|
111
232
|
summary: this.buildSummary(filePath, forms),
|
|
112
233
|
tsConfigPath,
|
|
113
|
-
};
|
|
234
|
+
}, this.projects.warnings(tsConfigPath));
|
|
114
235
|
}
|
|
115
236
|
shape(form, summaryOnly, maxResults, includeCascade) {
|
|
116
237
|
const { controls, ...rest } = form;
|