@angular-modernizer/adapter-mcp 0.3.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +103 -218
- package/dist/cli.js +13 -13
- package/dist/index.d.ts +4 -3
- package/dist/index.js +3 -2
- package/dist/mcp-watcher.d.ts +6 -1
- package/dist/mcp-watcher.js +11 -10
- package/dist/server/limited-stdio-transport.d.ts +68 -0
- package/dist/server/limited-stdio-transport.js +115 -0
- package/dist/server/mcp-server.d.ts +12 -14
- package/dist/server/mcp-server.js +41 -75
- package/dist/server/package-version.d.ts +16 -0
- package/dist/server/package-version.js +37 -0
- package/dist/server/sdk-server.d.ts +70 -0
- package/dist/server/sdk-server.js +113 -0
- package/dist/server/tool-registry.d.ts +3 -2
- package/dist/server/tool-registry.js +5 -5
- package/dist/tools/analyze-build-impact.d.ts +220 -1
- package/dist/tools/analyze-build-impact.js +145 -3
- package/dist/tools/analyze-core-to-shared.d.ts +134 -4
- package/dist/tools/analyze-core-to-shared.js +113 -9
- package/dist/tools/analyze-parser-performance.d.ts +200 -7
- package/dist/tools/analyze-parser-performance.js +108 -47
- package/dist/tools/analyze-project.d.ts +267 -5
- package/dist/tools/analyze-project.js +196 -8
- package/dist/tools/check-incremental-compatibility.d.ts +61 -1
- package/dist/tools/check-incremental-compatibility.js +58 -2
- package/dist/tools/collect-feedback.d.ts +199 -10
- package/dist/tools/collect-feedback.js +171 -99
- package/dist/tools/compare-health.d.ts +356 -0
- package/dist/tools/compare-health.js +472 -0
- package/dist/tools/extract-libraries.d.ts +156 -4
- package/dist/tools/extract-libraries.js +115 -10
- package/dist/tools/find-angular-symbol.d.ts +69 -3
- package/dist/tools/find-angular-symbol.js +55 -8
- package/dist/tools/find-component-hosts.d.ts +572 -2
- package/dist/tools/find-component-hosts.js +207 -6
- package/dist/tools/find-usages.d.ts +79 -1
- package/dist/tools/find-usages.js +64 -7
- package/dist/tools/get-bootstrap-execution.d.ts +151 -1
- package/dist/tools/get-bootstrap-execution.js +84 -3
- package/dist/tools/get-call-graph.d.ts +111 -1
- package/dist/tools/get-call-graph.js +72 -10
- package/dist/tools/get-operation-progress-tool.d.ts +114 -2
- package/dist/tools/get-operation-progress-tool.js +114 -7
- package/dist/tools/get-operation-progress.d.ts +1 -1
- package/dist/tools/get-operation-progress.js +5 -5
- package/dist/tools/helpers/analysis-output.d.ts +177 -0
- package/dist/tools/helpers/analysis-output.js +165 -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/finding-window.d.ts +43 -0
- package/dist/tools/helpers/finding-window.js +64 -0
- package/dist/tools/helpers/health-delta.d.ts +86 -0
- package/dist/tools/helpers/health-delta.js +239 -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 +11 -4
- package/dist/tools/helpers/project-cache.js +22 -4
- 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 +9 -4
- package/dist/tools/helpers/rule-runner.js +28 -14
- package/dist/tools/helpers/scan-cache.d.ts +22 -0
- package/dist/tools/helpers/scan-cache.js +34 -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/tool-context.d.ts +60 -0
- package/dist/tools/helpers/tool-context.js +82 -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 +232 -1
- package/dist/tools/inspect-form-group.js +120 -2
- package/dist/tools/inspect-i18n.d.ts +382 -1
- package/dist/tools/inspect-i18n.js +199 -2
- package/dist/tools/inspect-template.d.ts +232 -1
- package/dist/tools/inspect-template.js +160 -2
- package/dist/tools/learn-patterns.d.ts +122 -1
- package/dist/tools/learn-patterns.js +97 -2
- package/dist/tools/list-imports.d.ts +111 -10
- package/dist/tools/list-imports.js +110 -7
- package/dist/tools/orchestrate-migration.d.ts +128 -5
- package/dist/tools/orchestrate-migration.js +135 -13
- package/dist/tools/parse-stack-trace.d.ts +56 -1
- package/dist/tools/parse-stack-trace.js +34 -0
- package/dist/tools/plan-migration.d.ts +330 -1
- package/dist/tools/plan-migration.js +154 -3
- package/dist/tools/resolve-type.d.ts +39 -1
- package/dist/tools/resolve-type.js +31 -2
- package/dist/tools/review-feedback.d.ts +206 -11
- package/dist/tools/review-feedback.js +132 -51
- package/dist/tools/rollback-changes.d.ts +79 -2
- package/dist/tools/rollback-changes.js +66 -14
- package/dist/tools/run-angular-cli.d.ts +45 -2
- package/dist/tools/run-angular-cli.js +67 -7
- package/dist/tools/run-build.d.ts +114 -2
- package/dist/tools/run-build.js +117 -8
- package/dist/tools/run-schematic.d.ts +70 -2
- package/dist/tools/run-schematic.js +104 -10
- package/dist/tools/scan-all.d.ts +19 -11
- package/dist/tools/scan-all.js +139 -131
- package/dist/tools/scan-angular.d.ts +19 -10
- package/dist/tools/scan-angular.js +51 -23
- package/dist/tools/scan-architecture.d.ts +17 -10
- package/dist/tools/scan-architecture.js +93 -31
- package/dist/tools/scan-solid.d.ts +19 -10
- package/dist/tools/scan-solid.js +51 -23
- package/dist/tools/search-codebase.d.ts +82 -1
- package/dist/tools/search-codebase.js +55 -2
- package/dist/tools/server-status.d.ts +279 -5
- package/dist/tools/server-status.js +179 -5
- package/dist/tools/suggest-improvements.d.ts +97 -5
- package/dist/tools/suggest-improvements.js +80 -44
- package/dist/tools/trace-output-flow.d.ts +682 -2
- package/dist/tools/trace-output-flow.js +375 -15
- 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 +335 -12
- package/dist/tools/transform-code.js +649 -608
- package/dist/tools/validate-before-transform.d.ts +116 -2
- package/dist/tools/validate-before-transform.js +55 -2
- package/dist/tools/validate-project-compatibility.d.ts +64 -2
- package/dist/tools/validate-project-compatibility.js +67 -4
- package/dist/tools/validate-transformation.d.ts +220 -2
- package/dist/tools/validate-transformation.js +113 -15
- package/dist/tools/verify-citations.d.ts +181 -0
- package/dist/tools/verify-citations.js +218 -0
- package/dist/types.d.ts +38 -1
- package/dist/utils/format-tool-response.d.ts +22 -59
- package/dist/utils/format-tool-response.js +25 -134
- package/package.json +30 -13
- 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.map +0 -1
- 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
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* // args: { file: '/project/src/app/list/list.component.html', projectRoot: '/project' }
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
|
-
import { type MCPTool } from '../types.js';
|
|
20
|
+
import { type MCPTool, type ToolAnnotations } from '../types.js';
|
|
21
21
|
import { type ComponentTemplateReport } from '@angular-modernizer/api';
|
|
22
22
|
import { ProjectCache } from './helpers/project-cache.js';
|
|
23
23
|
/** A report shaped by the compact options. */
|
|
@@ -32,6 +32,8 @@ interface InspectTemplateOutput {
|
|
|
32
32
|
templates: TemplateReportOutput[];
|
|
33
33
|
summary: string;
|
|
34
34
|
tsConfigPath: string;
|
|
35
|
+
/** Conditions that can make the result incomplete (unresolved library imports). */
|
|
36
|
+
warnings?: string[];
|
|
35
37
|
}
|
|
36
38
|
/**
|
|
37
39
|
* MCP tool that inspects the structure of component templates.
|
|
@@ -39,10 +41,13 @@ interface InspectTemplateOutput {
|
|
|
39
41
|
export declare class InspectTemplateTool implements MCPTool {
|
|
40
42
|
private readonly projects;
|
|
41
43
|
readonly name = "inspect-template";
|
|
44
|
+
readonly title = "Inspect Template";
|
|
45
|
+
readonly annotations: ToolAnnotations;
|
|
42
46
|
constructor(projects?: ProjectCache);
|
|
43
47
|
readonly description: string;
|
|
44
48
|
readonly inputSchema: {
|
|
45
49
|
type: string;
|
|
50
|
+
additionalProperties: boolean;
|
|
46
51
|
properties: {
|
|
47
52
|
summaryOnly: {
|
|
48
53
|
readonly type: "boolean";
|
|
@@ -80,6 +85,232 @@ export declare class InspectTemplateTool implements MCPTool {
|
|
|
80
85
|
};
|
|
81
86
|
required: string[];
|
|
82
87
|
};
|
|
88
|
+
readonly outputSchema: {
|
|
89
|
+
type: string;
|
|
90
|
+
properties: {
|
|
91
|
+
warnings: {
|
|
92
|
+
readonly type: "array";
|
|
93
|
+
readonly items: {
|
|
94
|
+
readonly type: "string";
|
|
95
|
+
};
|
|
96
|
+
readonly description: "Conditions that can make the result incomplete, e.g. library imports that do not resolve because node_modules is missing.";
|
|
97
|
+
};
|
|
98
|
+
templates: {
|
|
99
|
+
type: string;
|
|
100
|
+
items: {
|
|
101
|
+
readonly type: "object";
|
|
102
|
+
readonly properties: {
|
|
103
|
+
readonly component: {
|
|
104
|
+
readonly type: "string";
|
|
105
|
+
};
|
|
106
|
+
readonly componentFile: {
|
|
107
|
+
readonly type: "string";
|
|
108
|
+
};
|
|
109
|
+
readonly templateFile: {
|
|
110
|
+
readonly type: "string";
|
|
111
|
+
};
|
|
112
|
+
readonly inline: {
|
|
113
|
+
readonly type: "boolean";
|
|
114
|
+
};
|
|
115
|
+
readonly directives: {
|
|
116
|
+
readonly type: "array";
|
|
117
|
+
readonly items: {
|
|
118
|
+
readonly type: "object";
|
|
119
|
+
readonly properties: {
|
|
120
|
+
readonly className: {
|
|
121
|
+
readonly type: "string";
|
|
122
|
+
};
|
|
123
|
+
readonly kind: {
|
|
124
|
+
readonly type: "string";
|
|
125
|
+
};
|
|
126
|
+
readonly selector: {
|
|
127
|
+
readonly type: "string";
|
|
128
|
+
};
|
|
129
|
+
readonly file: {
|
|
130
|
+
readonly type: "string";
|
|
131
|
+
};
|
|
132
|
+
readonly count: {
|
|
133
|
+
readonly type: "integer";
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
readonly required: readonly ["className", "kind", "selector", "file", "count"];
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
readonly pipes: {
|
|
140
|
+
readonly type: "array";
|
|
141
|
+
readonly items: {
|
|
142
|
+
readonly type: "object";
|
|
143
|
+
readonly properties: {
|
|
144
|
+
readonly name: {
|
|
145
|
+
readonly type: "string";
|
|
146
|
+
};
|
|
147
|
+
readonly count: {
|
|
148
|
+
readonly type: "integer";
|
|
149
|
+
};
|
|
150
|
+
readonly className: {
|
|
151
|
+
readonly type: "string";
|
|
152
|
+
};
|
|
153
|
+
readonly file: {
|
|
154
|
+
readonly type: "string";
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
readonly required: readonly ["name", "count"];
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
readonly unresolvedElements: {
|
|
161
|
+
readonly type: "array";
|
|
162
|
+
readonly items: {
|
|
163
|
+
readonly type: "object";
|
|
164
|
+
readonly properties: {
|
|
165
|
+
readonly tag: {
|
|
166
|
+
readonly type: "string";
|
|
167
|
+
};
|
|
168
|
+
readonly count: {
|
|
169
|
+
readonly type: "integer";
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
readonly required: readonly ["tag", "count"];
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
readonly controlFlow: {
|
|
176
|
+
readonly type: "object";
|
|
177
|
+
readonly properties: {
|
|
178
|
+
readonly blocks: {
|
|
179
|
+
readonly type: "object";
|
|
180
|
+
readonly additionalProperties: {
|
|
181
|
+
readonly type: "integer";
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
readonly structuralDirectives: {
|
|
185
|
+
readonly type: "object";
|
|
186
|
+
readonly additionalProperties: {
|
|
187
|
+
readonly type: "integer";
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
readonly maxDepth: {
|
|
191
|
+
readonly type: "integer";
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
readonly required: readonly ["blocks", "structuralDirectives", "maxDepth"];
|
|
195
|
+
};
|
|
196
|
+
readonly dynamicI18nCount: {
|
|
197
|
+
readonly type: "integer";
|
|
198
|
+
};
|
|
199
|
+
readonly parseErrors: {
|
|
200
|
+
readonly type: "array";
|
|
201
|
+
readonly items: {
|
|
202
|
+
readonly type: "string";
|
|
203
|
+
};
|
|
204
|
+
};
|
|
205
|
+
readonly counts: {
|
|
206
|
+
readonly type: "object";
|
|
207
|
+
readonly properties: {
|
|
208
|
+
[k: string]: {
|
|
209
|
+
type: string;
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
readonly required: readonly ["elements", "bindings", "inputs", "outputs", "directives", "pipes", "i18nKeys"];
|
|
213
|
+
};
|
|
214
|
+
readonly elements: {
|
|
215
|
+
readonly type: "array";
|
|
216
|
+
readonly items: {
|
|
217
|
+
readonly type: "object";
|
|
218
|
+
readonly properties: {
|
|
219
|
+
readonly tag: {
|
|
220
|
+
readonly type: "string";
|
|
221
|
+
};
|
|
222
|
+
readonly line: {
|
|
223
|
+
readonly type: "integer";
|
|
224
|
+
};
|
|
225
|
+
readonly col: {
|
|
226
|
+
readonly type: "integer";
|
|
227
|
+
};
|
|
228
|
+
readonly depth: {
|
|
229
|
+
readonly type: "integer";
|
|
230
|
+
};
|
|
231
|
+
readonly matches: {
|
|
232
|
+
readonly type: "array";
|
|
233
|
+
readonly items: {
|
|
234
|
+
readonly type: "string";
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
readonly bindings: {
|
|
238
|
+
readonly type: "array";
|
|
239
|
+
readonly items: {
|
|
240
|
+
readonly type: "object";
|
|
241
|
+
readonly properties: {
|
|
242
|
+
readonly kind: {
|
|
243
|
+
readonly type: "string";
|
|
244
|
+
};
|
|
245
|
+
readonly name: {
|
|
246
|
+
readonly type: "string";
|
|
247
|
+
};
|
|
248
|
+
readonly value: {
|
|
249
|
+
readonly type: "string";
|
|
250
|
+
};
|
|
251
|
+
readonly line: {
|
|
252
|
+
readonly type: "integer";
|
|
253
|
+
};
|
|
254
|
+
};
|
|
255
|
+
readonly required: readonly ["kind", "name"];
|
|
256
|
+
};
|
|
257
|
+
};
|
|
258
|
+
};
|
|
259
|
+
readonly required: readonly ["tag", "line", "col", "depth", "matches", "bindings"];
|
|
260
|
+
};
|
|
261
|
+
};
|
|
262
|
+
readonly i18nKeys: {
|
|
263
|
+
readonly type: "array";
|
|
264
|
+
readonly items: {
|
|
265
|
+
readonly type: "object";
|
|
266
|
+
readonly properties: {
|
|
267
|
+
readonly key: {
|
|
268
|
+
readonly type: "string";
|
|
269
|
+
};
|
|
270
|
+
readonly source: {
|
|
271
|
+
readonly type: "string";
|
|
272
|
+
};
|
|
273
|
+
readonly line: {
|
|
274
|
+
readonly type: "integer";
|
|
275
|
+
};
|
|
276
|
+
};
|
|
277
|
+
readonly required: readonly ["key", "source", "line"];
|
|
278
|
+
};
|
|
279
|
+
};
|
|
280
|
+
readonly dynamicI18nPrefixes: {
|
|
281
|
+
readonly type: "array";
|
|
282
|
+
readonly items: {
|
|
283
|
+
readonly type: "object";
|
|
284
|
+
readonly properties: {
|
|
285
|
+
readonly prefix: {
|
|
286
|
+
readonly type: "string";
|
|
287
|
+
};
|
|
288
|
+
readonly source: {
|
|
289
|
+
readonly type: "string";
|
|
290
|
+
};
|
|
291
|
+
readonly line: {
|
|
292
|
+
readonly type: "integer";
|
|
293
|
+
};
|
|
294
|
+
};
|
|
295
|
+
readonly required: readonly ["prefix", "source", "line"];
|
|
296
|
+
};
|
|
297
|
+
};
|
|
298
|
+
readonly truncated: {
|
|
299
|
+
readonly type: "boolean";
|
|
300
|
+
};
|
|
301
|
+
};
|
|
302
|
+
readonly required: readonly ["component", "componentFile", "templateFile", "inline", "directives", "pipes", "unresolvedElements", "controlFlow", "dynamicI18nCount", "parseErrors", "counts", "truncated"];
|
|
303
|
+
};
|
|
304
|
+
};
|
|
305
|
+
summary: {
|
|
306
|
+
type: string;
|
|
307
|
+
};
|
|
308
|
+
tsConfigPath: {
|
|
309
|
+
type: string;
|
|
310
|
+
};
|
|
311
|
+
};
|
|
312
|
+
required: string[];
|
|
313
|
+
};
|
|
83
314
|
execute(args: Record<string, unknown>): Promise<InspectTemplateOutput>;
|
|
84
315
|
private parseI18nNames;
|
|
85
316
|
private shape;
|
|
@@ -23,12 +23,158 @@ import { isAbsolute, resolve } from 'node:path';
|
|
|
23
23
|
import { findTsConfig } from './helpers/find-ts-config.js';
|
|
24
24
|
import { ProjectCache } from './helpers/project-cache.js';
|
|
25
25
|
import { COMPACT_OUTPUT_SCHEMA, limitList, parseCompactOptions, } from './helpers/compact-output.js';
|
|
26
|
+
import { configuredComponentDecorators } from './helpers/project-decorators.js';
|
|
27
|
+
import { WARNINGS_OUTPUT_SCHEMA, withWarnings, } from './helpers/output-contract.js';
|
|
28
|
+
const COUNT_OBJECT = { type: 'object', additionalProperties: { type: 'integer' } };
|
|
29
|
+
const TEMPLATE_COUNT_KEYS = [
|
|
30
|
+
'elements',
|
|
31
|
+
'bindings',
|
|
32
|
+
'inputs',
|
|
33
|
+
'outputs',
|
|
34
|
+
'directives',
|
|
35
|
+
'pipes',
|
|
36
|
+
'i18nKeys',
|
|
37
|
+
];
|
|
38
|
+
/** Output schema of one template report. */
|
|
39
|
+
const TEMPLATE_REPORT_SCHEMA = {
|
|
40
|
+
type: 'object',
|
|
41
|
+
properties: {
|
|
42
|
+
component: { type: 'string' },
|
|
43
|
+
componentFile: { type: 'string' },
|
|
44
|
+
templateFile: { type: 'string' },
|
|
45
|
+
inline: { type: 'boolean' },
|
|
46
|
+
directives: {
|
|
47
|
+
type: 'array',
|
|
48
|
+
items: {
|
|
49
|
+
type: 'object',
|
|
50
|
+
properties: {
|
|
51
|
+
className: { type: 'string' },
|
|
52
|
+
kind: { type: 'string' },
|
|
53
|
+
selector: { type: 'string' },
|
|
54
|
+
file: { type: 'string' },
|
|
55
|
+
count: { type: 'integer' },
|
|
56
|
+
},
|
|
57
|
+
required: ['className', 'kind', 'selector', 'file', 'count'],
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
pipes: {
|
|
61
|
+
type: 'array',
|
|
62
|
+
items: {
|
|
63
|
+
type: 'object',
|
|
64
|
+
properties: {
|
|
65
|
+
name: { type: 'string' },
|
|
66
|
+
count: { type: 'integer' },
|
|
67
|
+
className: { type: 'string' },
|
|
68
|
+
file: { type: 'string' },
|
|
69
|
+
},
|
|
70
|
+
required: ['name', 'count'],
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
unresolvedElements: {
|
|
74
|
+
type: 'array',
|
|
75
|
+
items: {
|
|
76
|
+
type: 'object',
|
|
77
|
+
properties: { tag: { type: 'string' }, count: { type: 'integer' } },
|
|
78
|
+
required: ['tag', 'count'],
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
controlFlow: {
|
|
82
|
+
type: 'object',
|
|
83
|
+
properties: {
|
|
84
|
+
blocks: COUNT_OBJECT,
|
|
85
|
+
structuralDirectives: COUNT_OBJECT,
|
|
86
|
+
maxDepth: { type: 'integer' },
|
|
87
|
+
},
|
|
88
|
+
required: ['blocks', 'structuralDirectives', 'maxDepth'],
|
|
89
|
+
},
|
|
90
|
+
dynamicI18nCount: { type: 'integer' },
|
|
91
|
+
parseErrors: { type: 'array', items: { type: 'string' } },
|
|
92
|
+
counts: {
|
|
93
|
+
type: 'object',
|
|
94
|
+
properties: Object.fromEntries(TEMPLATE_COUNT_KEYS.map((k) => [k, { type: 'integer' }])),
|
|
95
|
+
required: [...TEMPLATE_COUNT_KEYS],
|
|
96
|
+
},
|
|
97
|
+
elements: {
|
|
98
|
+
type: 'array',
|
|
99
|
+
items: {
|
|
100
|
+
type: 'object',
|
|
101
|
+
properties: {
|
|
102
|
+
tag: { type: 'string' },
|
|
103
|
+
line: { type: 'integer' },
|
|
104
|
+
col: { type: 'integer' },
|
|
105
|
+
depth: { type: 'integer' },
|
|
106
|
+
matches: { type: 'array', items: { type: 'string' } },
|
|
107
|
+
bindings: {
|
|
108
|
+
type: 'array',
|
|
109
|
+
items: {
|
|
110
|
+
type: 'object',
|
|
111
|
+
properties: {
|
|
112
|
+
kind: { type: 'string' },
|
|
113
|
+
name: { type: 'string' },
|
|
114
|
+
value: { type: 'string' },
|
|
115
|
+
line: { type: 'integer' },
|
|
116
|
+
},
|
|
117
|
+
required: ['kind', 'name'],
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
required: ['tag', 'line', 'col', 'depth', 'matches', 'bindings'],
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
i18nKeys: {
|
|
125
|
+
type: 'array',
|
|
126
|
+
items: {
|
|
127
|
+
type: 'object',
|
|
128
|
+
properties: {
|
|
129
|
+
key: { type: 'string' },
|
|
130
|
+
source: { type: 'string' },
|
|
131
|
+
line: { type: 'integer' },
|
|
132
|
+
},
|
|
133
|
+
required: ['key', 'source', 'line'],
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
dynamicI18nPrefixes: {
|
|
137
|
+
type: 'array',
|
|
138
|
+
items: {
|
|
139
|
+
type: 'object',
|
|
140
|
+
properties: {
|
|
141
|
+
prefix: { type: 'string' },
|
|
142
|
+
source: { type: 'string' },
|
|
143
|
+
line: { type: 'integer' },
|
|
144
|
+
},
|
|
145
|
+
required: ['prefix', 'source', 'line'],
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
truncated: { type: 'boolean' },
|
|
149
|
+
},
|
|
150
|
+
required: [
|
|
151
|
+
'component',
|
|
152
|
+
'componentFile',
|
|
153
|
+
'templateFile',
|
|
154
|
+
'inline',
|
|
155
|
+
'directives',
|
|
156
|
+
'pipes',
|
|
157
|
+
'unresolvedElements',
|
|
158
|
+
'controlFlow',
|
|
159
|
+
'dynamicI18nCount',
|
|
160
|
+
'parseErrors',
|
|
161
|
+
'counts',
|
|
162
|
+
'truncated',
|
|
163
|
+
],
|
|
164
|
+
};
|
|
26
165
|
/**
|
|
27
166
|
* MCP tool that inspects the structure of component templates.
|
|
28
167
|
*/
|
|
29
168
|
export class InspectTemplateTool {
|
|
30
169
|
projects;
|
|
31
170
|
name = 'inspect-template';
|
|
171
|
+
title = 'Inspect Template';
|
|
172
|
+
annotations = {
|
|
173
|
+
readOnlyHint: true,
|
|
174
|
+
destructiveHint: false,
|
|
175
|
+
idempotentHint: true,
|
|
176
|
+
openWorldHint: false,
|
|
177
|
+
};
|
|
32
178
|
constructor(projects = new ProjectCache()) {
|
|
33
179
|
this.projects = projects;
|
|
34
180
|
}
|
|
@@ -45,6 +191,7 @@ export class InspectTemplateTool {
|
|
|
45
191
|
'element, key and prefix lists, maxResults caps them.';
|
|
46
192
|
inputSchema = {
|
|
47
193
|
type: 'object',
|
|
194
|
+
additionalProperties: false,
|
|
48
195
|
properties: {
|
|
49
196
|
file: {
|
|
50
197
|
type: 'string',
|
|
@@ -72,6 +219,16 @@ export class InspectTemplateTool {
|
|
|
72
219
|
},
|
|
73
220
|
required: ['file', 'projectRoot'],
|
|
74
221
|
};
|
|
222
|
+
outputSchema = {
|
|
223
|
+
type: 'object',
|
|
224
|
+
properties: {
|
|
225
|
+
templates: { type: 'array', items: TEMPLATE_REPORT_SCHEMA },
|
|
226
|
+
summary: { type: 'string' },
|
|
227
|
+
tsConfigPath: { type: 'string' },
|
|
228
|
+
...WARNINGS_OUTPUT_SCHEMA,
|
|
229
|
+
},
|
|
230
|
+
required: ['templates', 'summary', 'tsConfigPath'],
|
|
231
|
+
};
|
|
75
232
|
async execute(args) {
|
|
76
233
|
const params = args;
|
|
77
234
|
if (!params.file || typeof params.file !== 'string') {
|
|
@@ -100,15 +257,16 @@ export class InspectTemplateTool {
|
|
|
100
257
|
throw new Error(`file is not part of the tsconfig program: ${filePath}`);
|
|
101
258
|
}
|
|
102
259
|
const inspector = new TemplateInspector(project, {
|
|
260
|
+
componentDecorators: configuredComponentDecorators(params.projectRoot),
|
|
103
261
|
includePlainElements: params.includePlainElements === true,
|
|
104
262
|
...(i18nNames === undefined ? {} : { i18nNames }),
|
|
105
263
|
});
|
|
106
264
|
const reports = inspector.inspectFile(filePath, params.className);
|
|
107
|
-
return {
|
|
265
|
+
return withWarnings({
|
|
108
266
|
templates: reports.map((r) => this.shape(r, compact.summaryOnly, compact.maxResults)),
|
|
109
267
|
summary: this.buildSummary(filePath, reports),
|
|
110
268
|
tsConfigPath,
|
|
111
|
-
};
|
|
269
|
+
}, this.projects.warnings(tsConfigPath));
|
|
112
270
|
}
|
|
113
271
|
parseI18nNames(value) {
|
|
114
272
|
if (value === undefined) {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Enhancement: Self-learning with style-aware pattern discovery
|
|
9
9
|
*/
|
|
10
|
-
import { type MCPTool } from '../types.js';
|
|
10
|
+
import { type MCPTool, type ToolAnnotations } from '../types.js';
|
|
11
11
|
/**
|
|
12
12
|
* Pattern discovery result.
|
|
13
13
|
*/
|
|
@@ -131,15 +131,22 @@ interface LearnPatternsResult {
|
|
|
131
131
|
alignedWithStyle: boolean;
|
|
132
132
|
rationale: string;
|
|
133
133
|
}[];
|
|
134
|
+
/**
|
|
135
|
+
* Human-readable summary for LLM consumption.
|
|
136
|
+
*/
|
|
137
|
+
summary: string;
|
|
134
138
|
}
|
|
135
139
|
/**
|
|
136
140
|
* MCP tool for learning patterns from codebases.
|
|
137
141
|
*/
|
|
138
142
|
export declare class LearnPatternsTool implements MCPTool {
|
|
139
143
|
name: string;
|
|
144
|
+
title: string;
|
|
145
|
+
annotations: ToolAnnotations;
|
|
140
146
|
description: string;
|
|
141
147
|
inputSchema: {
|
|
142
148
|
type: string;
|
|
149
|
+
additionalProperties: boolean;
|
|
143
150
|
properties: {
|
|
144
151
|
targetPath: {
|
|
145
152
|
type: string;
|
|
@@ -269,6 +276,120 @@ export declare class LearnPatternsTool implements MCPTool {
|
|
|
269
276
|
};
|
|
270
277
|
required: string[];
|
|
271
278
|
};
|
|
279
|
+
outputSchema: {
|
|
280
|
+
type: string;
|
|
281
|
+
properties: {
|
|
282
|
+
patterns: {
|
|
283
|
+
type: string;
|
|
284
|
+
items: {
|
|
285
|
+
type: string;
|
|
286
|
+
properties: {
|
|
287
|
+
id: {
|
|
288
|
+
type: string;
|
|
289
|
+
};
|
|
290
|
+
name: {
|
|
291
|
+
type: string;
|
|
292
|
+
};
|
|
293
|
+
category: {
|
|
294
|
+
type: string;
|
|
295
|
+
};
|
|
296
|
+
description: {
|
|
297
|
+
type: string;
|
|
298
|
+
};
|
|
299
|
+
occurrences: {
|
|
300
|
+
type: string;
|
|
301
|
+
};
|
|
302
|
+
complexity: {
|
|
303
|
+
type: string;
|
|
304
|
+
};
|
|
305
|
+
examples: {
|
|
306
|
+
type: string;
|
|
307
|
+
items: {
|
|
308
|
+
type: string;
|
|
309
|
+
};
|
|
310
|
+
};
|
|
311
|
+
suggestedRule: {
|
|
312
|
+
type: string;
|
|
313
|
+
};
|
|
314
|
+
confidence: {
|
|
315
|
+
type: string;
|
|
316
|
+
};
|
|
317
|
+
confidenceExplanation: {
|
|
318
|
+
type: string;
|
|
319
|
+
};
|
|
320
|
+
alignsWithStyle: {
|
|
321
|
+
type: string;
|
|
322
|
+
};
|
|
323
|
+
styleAlignment: {
|
|
324
|
+
type: string;
|
|
325
|
+
};
|
|
326
|
+
dominancePercentage: {
|
|
327
|
+
type: string;
|
|
328
|
+
};
|
|
329
|
+
trending: {
|
|
330
|
+
type: string;
|
|
331
|
+
};
|
|
332
|
+
scanCount: {
|
|
333
|
+
type: string;
|
|
334
|
+
};
|
|
335
|
+
};
|
|
336
|
+
required: string[];
|
|
337
|
+
};
|
|
338
|
+
};
|
|
339
|
+
statistics: {
|
|
340
|
+
type: string;
|
|
341
|
+
properties: {
|
|
342
|
+
totalPatternsFound: {
|
|
343
|
+
type: string;
|
|
344
|
+
};
|
|
345
|
+
byCategory: {
|
|
346
|
+
readonly type: "object";
|
|
347
|
+
readonly additionalProperties: {
|
|
348
|
+
readonly type: "integer";
|
|
349
|
+
};
|
|
350
|
+
};
|
|
351
|
+
byComplexity: {
|
|
352
|
+
readonly type: "object";
|
|
353
|
+
readonly additionalProperties: {
|
|
354
|
+
readonly type: "integer";
|
|
355
|
+
};
|
|
356
|
+
};
|
|
357
|
+
filesAnalyzed: {
|
|
358
|
+
type: string;
|
|
359
|
+
};
|
|
360
|
+
duration: {
|
|
361
|
+
type: string;
|
|
362
|
+
};
|
|
363
|
+
};
|
|
364
|
+
required: string[];
|
|
365
|
+
};
|
|
366
|
+
artifacts: {
|
|
367
|
+
type: string;
|
|
368
|
+
};
|
|
369
|
+
validation: {
|
|
370
|
+
type: string;
|
|
371
|
+
};
|
|
372
|
+
styleProfile: {
|
|
373
|
+
type: string;
|
|
374
|
+
};
|
|
375
|
+
learningEvolution: {
|
|
376
|
+
type: string;
|
|
377
|
+
};
|
|
378
|
+
confidenceAnalysis: {
|
|
379
|
+
type: string;
|
|
380
|
+
};
|
|
381
|
+
generatedRules: {
|
|
382
|
+
type: string;
|
|
383
|
+
items: {
|
|
384
|
+
type: string;
|
|
385
|
+
};
|
|
386
|
+
};
|
|
387
|
+
summary: {
|
|
388
|
+
type: string;
|
|
389
|
+
};
|
|
390
|
+
};
|
|
391
|
+
required: string[];
|
|
392
|
+
};
|
|
272
393
|
execute(args: Record<string, unknown>): Promise<LearnPatternsResult>;
|
|
273
394
|
/**
|
|
274
395
|
* Discover patterns from the project.
|