@angular-modernizer/adapter-mcp 0.2.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 +188 -235
- package/dist/cli.js +77 -27
- package/dist/index.d.ts +11 -3
- package/dist/index.js +10 -2
- package/dist/mcp-watcher.d.ts +6 -1
- package/dist/mcp-watcher.js +14 -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 +41 -12
- package/dist/server/mcp-server.js +113 -94
- 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/stdio-guard.d.ts +20 -0
- package/dist/server/stdio-guard.js +48 -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 +346 -14
- package/dist/tools/analyze-build-impact.js +315 -31
- 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 +98 -9
- package/dist/tools/find-angular-symbol.js +104 -12
- package/dist/tools/find-component-hosts.d.ts +684 -0
- package/dist/tools/find-component-hosts.js +441 -0
- package/dist/tools/find-usages.d.ts +99 -4
- package/dist/tools/find-usages.js +131 -11
- package/dist/tools/get-bootstrap-execution.d.ts +258 -0
- package/dist/tools/get-bootstrap-execution.js +324 -0
- package/dist/tools/get-call-graph.d.ts +139 -4
- package/dist/tools/get-call-graph.js +123 -13
- 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/compact-output.d.ts +61 -0
- package/dist/tools/helpers/compact-output.js +83 -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 +184 -0
- package/dist/tools/helpers/project-cache.js +331 -0
- 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 +72 -0
- package/dist/tools/helpers/rule-runner.js +131 -0
- 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 +48 -0
- package/dist/tools/helpers/scan-plan.js +166 -0
- package/dist/tools/helpers/scope-paths.d.ts +17 -0
- package/dist/tools/helpers/scope-paths.js +32 -0
- package/dist/tools/helpers/stack-frame-file-index.d.ts +10 -0
- package/dist/tools/helpers/stack-frame-file-index.js +71 -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 +324 -0
- package/dist/tools/inspect-form-group.js +279 -0
- package/dist/tools/inspect-i18n.d.ts +466 -0
- package/dist/tools/inspect-i18n.js +400 -0
- package/dist/tools/inspect-template.d.ts +320 -0
- package/dist/tools/inspect-template.js +324 -0
- package/dist/tools/learn-patterns.d.ts +122 -1
- package/dist/tools/learn-patterns.js +97 -2
- package/dist/tools/list-imports.d.ts +128 -11
- package/dist/tools/list-imports.js +128 -8
- package/dist/tools/orchestrate-migration.d.ts +129 -5
- package/dist/tools/orchestrate-migration.js +166 -12
- package/dist/tools/parse-stack-trace.d.ts +59 -2
- package/dist/tools/parse-stack-trace.js +52 -4
- package/dist/tools/plan-migration.d.ts +418 -1
- package/dist/tools/plan-migration.js +355 -8
- package/dist/tools/resolve-type.d.ts +42 -1
- package/dist/tools/resolve-type.js +37 -4
- 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 +24 -16
- package/dist/tools/scan-all.js +145 -137
- package/dist/tools/scan-angular.d.ts +20 -11
- package/dist/tools/scan-angular.js +52 -24
- package/dist/tools/scan-architecture.d.ts +42 -14
- package/dist/tools/scan-architecture.js +206 -163
- package/dist/tools/scan-solid.d.ts +20 -11
- package/dist/tools/scan-solid.js +52 -24
- package/dist/tools/search-codebase.d.ts +85 -1
- package/dist/tools/search-codebase.js +61 -4
- package/dist/tools/server-status.d.ts +370 -0
- package/dist/tools/server-status.js +369 -0
- 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 +791 -0
- package/dist/tools/trace-output-flow.js +668 -0
- 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 +45 -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 -57
- package/dist/server/json-rpc-handler.d.ts.map +0 -1
- package/dist/server/json-rpc-handler.js +0 -222
- 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/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-usages.d.ts.map +0 -1
- package/dist/tools/find-usages.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/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/rule-matcher.d.ts.map +0 -1
- package/dist/tools/helpers/rule-matcher.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/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/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/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
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* MCP tool for analyzing Angular projects to detect framework,
|
|
5
5
|
* architecture, layers, and technologies.
|
|
6
6
|
*/
|
|
7
|
-
import type { MCPTool } from '../types.js';
|
|
7
|
+
import type { MCPTool, ToolAnnotations, ToolContext } from '../types.js';
|
|
8
|
+
import { type CancelledExecution } from './helpers/tool-context.js';
|
|
8
9
|
/**
|
|
9
10
|
* Result from the analyze-project tool.
|
|
10
11
|
*/
|
|
@@ -76,14 +77,18 @@ interface AnalyzeProjectResult {
|
|
|
76
77
|
metadata?: Record<string, unknown>;
|
|
77
78
|
}[];
|
|
78
79
|
/**
|
|
79
|
-
*
|
|
80
|
+
* Counts of the run.
|
|
80
81
|
*/
|
|
81
|
-
|
|
82
|
+
counts: {
|
|
82
83
|
totalFiles: number;
|
|
83
84
|
analyzedFiles: number;
|
|
84
85
|
rulesExecuted: number;
|
|
85
86
|
duration: number;
|
|
86
87
|
};
|
|
88
|
+
/**
|
|
89
|
+
* Human-readable summary for LLM consumption.
|
|
90
|
+
*/
|
|
91
|
+
summary: string;
|
|
87
92
|
/**
|
|
88
93
|
* Project metadata.
|
|
89
94
|
*/
|
|
@@ -132,6 +137,8 @@ interface AnalyzeProjectResult {
|
|
|
132
137
|
eta?: number;
|
|
133
138
|
phase: string;
|
|
134
139
|
};
|
|
140
|
+
/** Set when the client cancelled the analysis; counts cover the analyzed files. */
|
|
141
|
+
execution?: CancelledExecution;
|
|
135
142
|
}
|
|
136
143
|
/**
|
|
137
144
|
* Analyze Project Tool
|
|
@@ -141,9 +148,12 @@ interface AnalyzeProjectResult {
|
|
|
141
148
|
*/
|
|
142
149
|
export declare class AnalyzeProjectTool implements MCPTool {
|
|
143
150
|
readonly name = "analyze-project";
|
|
144
|
-
readonly
|
|
151
|
+
readonly title = "Analyze Project";
|
|
152
|
+
readonly annotations: ToolAnnotations;
|
|
153
|
+
readonly description: string;
|
|
145
154
|
readonly inputSchema: {
|
|
146
155
|
type: string;
|
|
156
|
+
additionalProperties: boolean;
|
|
147
157
|
properties: {
|
|
148
158
|
rootPath: {
|
|
149
159
|
type: string;
|
|
@@ -242,7 +252,259 @@ export declare class AnalyzeProjectTool implements MCPTool {
|
|
|
242
252
|
};
|
|
243
253
|
required: never[];
|
|
244
254
|
};
|
|
245
|
-
|
|
255
|
+
readonly outputSchema: {
|
|
256
|
+
type: string;
|
|
257
|
+
properties: {
|
|
258
|
+
framework: {
|
|
259
|
+
type: string;
|
|
260
|
+
properties: {
|
|
261
|
+
detected: {
|
|
262
|
+
type: string;
|
|
263
|
+
};
|
|
264
|
+
type: {
|
|
265
|
+
type: string;
|
|
266
|
+
};
|
|
267
|
+
confidence: {
|
|
268
|
+
type: string;
|
|
269
|
+
};
|
|
270
|
+
indicators: {
|
|
271
|
+
readonly type: "array";
|
|
272
|
+
readonly items: {
|
|
273
|
+
readonly type: "string";
|
|
274
|
+
};
|
|
275
|
+
};
|
|
276
|
+
projects: {
|
|
277
|
+
type: string;
|
|
278
|
+
properties: {
|
|
279
|
+
applications: {
|
|
280
|
+
type: string;
|
|
281
|
+
items: {
|
|
282
|
+
readonly type: "object";
|
|
283
|
+
readonly properties: {
|
|
284
|
+
readonly name: {
|
|
285
|
+
readonly type: "string";
|
|
286
|
+
};
|
|
287
|
+
readonly root: {
|
|
288
|
+
readonly type: "string";
|
|
289
|
+
};
|
|
290
|
+
readonly sourceRoot: {
|
|
291
|
+
readonly type: "string";
|
|
292
|
+
};
|
|
293
|
+
};
|
|
294
|
+
readonly required: readonly ["name", "root"];
|
|
295
|
+
};
|
|
296
|
+
};
|
|
297
|
+
libraries: {
|
|
298
|
+
type: string;
|
|
299
|
+
items: {
|
|
300
|
+
readonly type: "object";
|
|
301
|
+
readonly properties: {
|
|
302
|
+
readonly name: {
|
|
303
|
+
readonly type: "string";
|
|
304
|
+
};
|
|
305
|
+
readonly root: {
|
|
306
|
+
readonly type: "string";
|
|
307
|
+
};
|
|
308
|
+
readonly sourceRoot: {
|
|
309
|
+
readonly type: "string";
|
|
310
|
+
};
|
|
311
|
+
};
|
|
312
|
+
readonly required: readonly ["name", "root"];
|
|
313
|
+
};
|
|
314
|
+
};
|
|
315
|
+
};
|
|
316
|
+
required: string[];
|
|
317
|
+
};
|
|
318
|
+
offlineApp: {
|
|
319
|
+
type: string;
|
|
320
|
+
properties: {
|
|
321
|
+
detected: {
|
|
322
|
+
type: string;
|
|
323
|
+
};
|
|
324
|
+
indicators: {
|
|
325
|
+
readonly type: "array";
|
|
326
|
+
readonly items: {
|
|
327
|
+
readonly type: "string";
|
|
328
|
+
};
|
|
329
|
+
};
|
|
330
|
+
};
|
|
331
|
+
required: string[];
|
|
332
|
+
};
|
|
333
|
+
};
|
|
334
|
+
required: string[];
|
|
335
|
+
};
|
|
336
|
+
architecture: {
|
|
337
|
+
type: string;
|
|
338
|
+
properties: {
|
|
339
|
+
pattern: {
|
|
340
|
+
type: string;
|
|
341
|
+
};
|
|
342
|
+
confidence: {
|
|
343
|
+
type: string;
|
|
344
|
+
};
|
|
345
|
+
layers: {
|
|
346
|
+
type: string;
|
|
347
|
+
items: {
|
|
348
|
+
type: string;
|
|
349
|
+
properties: {
|
|
350
|
+
name: {
|
|
351
|
+
type: string;
|
|
352
|
+
};
|
|
353
|
+
path: {
|
|
354
|
+
type: string;
|
|
355
|
+
};
|
|
356
|
+
purpose: {
|
|
357
|
+
type: string;
|
|
358
|
+
};
|
|
359
|
+
};
|
|
360
|
+
required: string[];
|
|
361
|
+
};
|
|
362
|
+
};
|
|
363
|
+
};
|
|
364
|
+
required: string[];
|
|
365
|
+
};
|
|
366
|
+
technologyStack: {
|
|
367
|
+
type: string;
|
|
368
|
+
properties: {
|
|
369
|
+
languages: {
|
|
370
|
+
readonly type: "array";
|
|
371
|
+
readonly items: {
|
|
372
|
+
readonly type: "string";
|
|
373
|
+
};
|
|
374
|
+
};
|
|
375
|
+
frameworks: {
|
|
376
|
+
readonly type: "array";
|
|
377
|
+
readonly items: {
|
|
378
|
+
readonly type: "string";
|
|
379
|
+
};
|
|
380
|
+
};
|
|
381
|
+
buildTools: {
|
|
382
|
+
readonly type: "array";
|
|
383
|
+
readonly items: {
|
|
384
|
+
readonly type: "string";
|
|
385
|
+
};
|
|
386
|
+
};
|
|
387
|
+
packageManager: {
|
|
388
|
+
type: string;
|
|
389
|
+
};
|
|
390
|
+
};
|
|
391
|
+
required: string[];
|
|
392
|
+
};
|
|
393
|
+
results: {
|
|
394
|
+
type: string;
|
|
395
|
+
items: {
|
|
396
|
+
type: string;
|
|
397
|
+
properties: {
|
|
398
|
+
ruleId: {
|
|
399
|
+
type: string;
|
|
400
|
+
};
|
|
401
|
+
message: {
|
|
402
|
+
type: string;
|
|
403
|
+
};
|
|
404
|
+
filePath: {
|
|
405
|
+
type: string;
|
|
406
|
+
};
|
|
407
|
+
metadata: {
|
|
408
|
+
type: string;
|
|
409
|
+
};
|
|
410
|
+
};
|
|
411
|
+
required: string[];
|
|
412
|
+
};
|
|
413
|
+
};
|
|
414
|
+
counts: {
|
|
415
|
+
type: string;
|
|
416
|
+
properties: {
|
|
417
|
+
totalFiles: {
|
|
418
|
+
type: string;
|
|
419
|
+
};
|
|
420
|
+
analyzedFiles: {
|
|
421
|
+
type: string;
|
|
422
|
+
};
|
|
423
|
+
rulesExecuted: {
|
|
424
|
+
type: string;
|
|
425
|
+
};
|
|
426
|
+
duration: {
|
|
427
|
+
type: string;
|
|
428
|
+
};
|
|
429
|
+
};
|
|
430
|
+
required: string[];
|
|
431
|
+
};
|
|
432
|
+
metadata: {
|
|
433
|
+
type: string;
|
|
434
|
+
properties: {
|
|
435
|
+
projectRoot: {
|
|
436
|
+
type: string;
|
|
437
|
+
};
|
|
438
|
+
tsconfigPath: {
|
|
439
|
+
type: string;
|
|
440
|
+
};
|
|
441
|
+
packageJsonPath: {
|
|
442
|
+
type: string;
|
|
443
|
+
};
|
|
444
|
+
angularJsonPath: {
|
|
445
|
+
type: string;
|
|
446
|
+
};
|
|
447
|
+
};
|
|
448
|
+
required: string[];
|
|
449
|
+
};
|
|
450
|
+
pagination: {
|
|
451
|
+
readonly type: "object";
|
|
452
|
+
readonly properties: {
|
|
453
|
+
readonly totalResults: {
|
|
454
|
+
readonly type: "integer";
|
|
455
|
+
};
|
|
456
|
+
readonly returnedResults: {
|
|
457
|
+
readonly type: "integer";
|
|
458
|
+
};
|
|
459
|
+
readonly offset: {
|
|
460
|
+
readonly type: "integer";
|
|
461
|
+
};
|
|
462
|
+
readonly hasMore: {
|
|
463
|
+
readonly type: "boolean";
|
|
464
|
+
};
|
|
465
|
+
};
|
|
466
|
+
readonly required: readonly ["totalResults", "returnedResults", "offset", "hasMore"];
|
|
467
|
+
};
|
|
468
|
+
orchestration: {
|
|
469
|
+
type: string;
|
|
470
|
+
};
|
|
471
|
+
execution: {
|
|
472
|
+
readonly type: "object";
|
|
473
|
+
readonly properties: {
|
|
474
|
+
readonly maxDurationMs: {
|
|
475
|
+
readonly type: "number";
|
|
476
|
+
};
|
|
477
|
+
readonly incomplete: {
|
|
478
|
+
readonly type: "boolean";
|
|
479
|
+
};
|
|
480
|
+
readonly stopReason: {
|
|
481
|
+
readonly type: "string";
|
|
482
|
+
};
|
|
483
|
+
readonly skippedFiles: {
|
|
484
|
+
readonly type: "integer";
|
|
485
|
+
};
|
|
486
|
+
readonly ruleTimings: {
|
|
487
|
+
readonly type: "array";
|
|
488
|
+
readonly items: {
|
|
489
|
+
readonly type: "object";
|
|
490
|
+
};
|
|
491
|
+
};
|
|
492
|
+
readonly note: {
|
|
493
|
+
readonly type: "string";
|
|
494
|
+
};
|
|
495
|
+
};
|
|
496
|
+
readonly required: readonly ["incomplete", "skippedFiles"];
|
|
497
|
+
};
|
|
498
|
+
progress: {
|
|
499
|
+
type: string;
|
|
500
|
+
};
|
|
501
|
+
summary: {
|
|
502
|
+
type: string;
|
|
503
|
+
};
|
|
504
|
+
};
|
|
505
|
+
required: string[];
|
|
506
|
+
};
|
|
507
|
+
execute(args: Record<string, unknown>, ctx?: ToolContext): Promise<AnalyzeProjectResult>;
|
|
246
508
|
/**
|
|
247
509
|
* Analyze the basic project structure.
|
|
248
510
|
*/
|
|
@@ -15,6 +15,58 @@ import { getMCPWatcher } from '../mcp-watcher.js';
|
|
|
15
15
|
import { glob } from 'glob';
|
|
16
16
|
import { resolve, extname } from 'node:path';
|
|
17
17
|
import { readFileSync, existsSync } from 'node:fs';
|
|
18
|
+
import { PAGINATION_SCHEMA, SCAN_EXECUTION_SCHEMA, nameList, pageNote, } from './helpers/analysis-output.js';
|
|
19
|
+
import { cancelledExecution, fileProgressMessage, forwardKernelProgress, yieldIfCancellable, } from './helpers/tool-context.js';
|
|
20
|
+
import { STRING_ARRAY } from './helpers/investigation-schemas.js';
|
|
21
|
+
/** Application or library entry of `framework.projects`. */
|
|
22
|
+
const NAMED_PROJECT_SCHEMA = {
|
|
23
|
+
type: 'object',
|
|
24
|
+
properties: {
|
|
25
|
+
name: { type: 'string' },
|
|
26
|
+
root: { type: 'string' },
|
|
27
|
+
sourceRoot: { type: 'string' },
|
|
28
|
+
},
|
|
29
|
+
required: ['name', 'root'],
|
|
30
|
+
};
|
|
31
|
+
/** Layers, projects and stack entries named in the summary. */
|
|
32
|
+
const SUMMARY_NAMES = 10;
|
|
33
|
+
/**
|
|
34
|
+
* Text summary of an analysis: framework, architecture, projects, stack,
|
|
35
|
+
* counts and the returned page of rule findings.
|
|
36
|
+
*/
|
|
37
|
+
function describeAnalysis(analysis, totalResults) {
|
|
38
|
+
const { framework, architecture, technologyStack, counts } = analysis;
|
|
39
|
+
const lines = [
|
|
40
|
+
`Framework: ${framework.detected ? framework.type : 'not detected'} ` +
|
|
41
|
+
`(confidence ${framework.confidence}). Architecture: ${architecture.pattern} ` +
|
|
42
|
+
`(confidence ${architecture.confidence}).`,
|
|
43
|
+
];
|
|
44
|
+
const layers = nameList(architecture.layers.map((l) => `${l.name} (${l.path})`), SUMMARY_NAMES);
|
|
45
|
+
if (layers !== undefined) {
|
|
46
|
+
lines.push(`Layers: ${layers}.`);
|
|
47
|
+
}
|
|
48
|
+
const projects = framework.projects;
|
|
49
|
+
if (projects !== undefined) {
|
|
50
|
+
const apps = nameList(projects.applications.map((a) => a.name), SUMMARY_NAMES);
|
|
51
|
+
const libs = nameList(projects.libraries.map((l) => l.name), SUMMARY_NAMES);
|
|
52
|
+
lines.push(`Applications: ${apps ?? 'none'}. Libraries: ${libs ?? 'none'}.` +
|
|
53
|
+
(framework.offlineApp?.detected === true ? ' Offline app detected.' : ''));
|
|
54
|
+
}
|
|
55
|
+
const stack = nameList([...technologyStack.languages, ...technologyStack.frameworks, ...technologyStack.buildTools], SUMMARY_NAMES);
|
|
56
|
+
lines.push(`Stack: ${stack ?? 'unknown'}; package manager ${technologyStack.packageManager}.`, `${counts.analyzedFiles} of ${counts.totalFiles} file(s) analyzed with ${counts.rulesExecuted} rule(s) ` +
|
|
57
|
+
`in ${counts.duration} ms, ${totalResults} finding(s)` +
|
|
58
|
+
(analysis.pagination === undefined && totalResults > 0
|
|
59
|
+
? '; includeDetails returns them.'
|
|
60
|
+
: '.'));
|
|
61
|
+
const page = pageNote(analysis.pagination, 'findings');
|
|
62
|
+
if (page !== undefined) {
|
|
63
|
+
lines.push(page);
|
|
64
|
+
}
|
|
65
|
+
if (analysis.execution !== undefined) {
|
|
66
|
+
lines.push(analysis.execution.note);
|
|
67
|
+
}
|
|
68
|
+
return lines.join('\n');
|
|
69
|
+
}
|
|
18
70
|
/**
|
|
19
71
|
* Analyze Project Tool
|
|
20
72
|
*
|
|
@@ -23,9 +75,19 @@ import { readFileSync, existsSync } from 'node:fs';
|
|
|
23
75
|
*/
|
|
24
76
|
export class AnalyzeProjectTool {
|
|
25
77
|
name = 'analyze-project';
|
|
26
|
-
|
|
78
|
+
title = 'Analyze Project';
|
|
79
|
+
annotations = {
|
|
80
|
+
readOnlyHint: true,
|
|
81
|
+
destructiveHint: false,
|
|
82
|
+
idempotentHint: true,
|
|
83
|
+
openWorldHint: false,
|
|
84
|
+
};
|
|
85
|
+
description = 'Analyze Angular projects to detect framework, architecture, layers, and technologies. ' +
|
|
86
|
+
'counts holds the file and rule numbers, summary a short text; includeDetails returns the rule findings ' +
|
|
87
|
+
'(maxResults and resultOffset page them).';
|
|
27
88
|
inputSchema = {
|
|
28
89
|
type: 'object',
|
|
90
|
+
additionalProperties: false,
|
|
29
91
|
properties: {
|
|
30
92
|
rootPath: {
|
|
31
93
|
type: 'string',
|
|
@@ -122,7 +184,115 @@ export class AnalyzeProjectTool {
|
|
|
122
184
|
},
|
|
123
185
|
required: [],
|
|
124
186
|
};
|
|
125
|
-
|
|
187
|
+
outputSchema = {
|
|
188
|
+
type: 'object',
|
|
189
|
+
properties: {
|
|
190
|
+
framework: {
|
|
191
|
+
type: 'object',
|
|
192
|
+
properties: {
|
|
193
|
+
detected: { type: 'boolean' },
|
|
194
|
+
type: { type: 'string' },
|
|
195
|
+
confidence: { type: 'number' },
|
|
196
|
+
indicators: STRING_ARRAY,
|
|
197
|
+
projects: {
|
|
198
|
+
type: 'object',
|
|
199
|
+
properties: {
|
|
200
|
+
applications: { type: 'array', items: NAMED_PROJECT_SCHEMA },
|
|
201
|
+
libraries: { type: 'array', items: NAMED_PROJECT_SCHEMA },
|
|
202
|
+
},
|
|
203
|
+
required: ['applications', 'libraries'],
|
|
204
|
+
},
|
|
205
|
+
offlineApp: {
|
|
206
|
+
type: 'object',
|
|
207
|
+
properties: {
|
|
208
|
+
detected: { type: 'boolean' },
|
|
209
|
+
indicators: STRING_ARRAY,
|
|
210
|
+
},
|
|
211
|
+
required: ['detected', 'indicators'],
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
required: ['detected', 'type', 'confidence', 'indicators'],
|
|
215
|
+
},
|
|
216
|
+
architecture: {
|
|
217
|
+
type: 'object',
|
|
218
|
+
properties: {
|
|
219
|
+
pattern: { type: 'string' },
|
|
220
|
+
confidence: { type: 'number' },
|
|
221
|
+
layers: {
|
|
222
|
+
type: 'array',
|
|
223
|
+
items: {
|
|
224
|
+
type: 'object',
|
|
225
|
+
properties: {
|
|
226
|
+
name: { type: 'string' },
|
|
227
|
+
path: { type: 'string' },
|
|
228
|
+
purpose: { type: 'string' },
|
|
229
|
+
},
|
|
230
|
+
required: ['name', 'path', 'purpose'],
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
required: ['pattern', 'confidence', 'layers'],
|
|
235
|
+
},
|
|
236
|
+
technologyStack: {
|
|
237
|
+
type: 'object',
|
|
238
|
+
properties: {
|
|
239
|
+
languages: STRING_ARRAY,
|
|
240
|
+
frameworks: STRING_ARRAY,
|
|
241
|
+
buildTools: STRING_ARRAY,
|
|
242
|
+
packageManager: { type: 'string' },
|
|
243
|
+
},
|
|
244
|
+
required: ['languages', 'frameworks', 'buildTools', 'packageManager'],
|
|
245
|
+
},
|
|
246
|
+
results: {
|
|
247
|
+
type: 'array',
|
|
248
|
+
items: {
|
|
249
|
+
type: 'object',
|
|
250
|
+
properties: {
|
|
251
|
+
ruleId: { type: 'string' },
|
|
252
|
+
message: { type: 'string' },
|
|
253
|
+
filePath: { type: 'string' },
|
|
254
|
+
metadata: { type: 'object' },
|
|
255
|
+
},
|
|
256
|
+
required: ['ruleId', 'message'],
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
counts: {
|
|
260
|
+
type: 'object',
|
|
261
|
+
properties: {
|
|
262
|
+
totalFiles: { type: 'integer' },
|
|
263
|
+
analyzedFiles: { type: 'integer' },
|
|
264
|
+
rulesExecuted: { type: 'integer' },
|
|
265
|
+
duration: { type: 'number' },
|
|
266
|
+
},
|
|
267
|
+
required: ['totalFiles', 'analyzedFiles', 'rulesExecuted', 'duration'],
|
|
268
|
+
},
|
|
269
|
+
metadata: {
|
|
270
|
+
type: 'object',
|
|
271
|
+
properties: {
|
|
272
|
+
projectRoot: { type: 'string' },
|
|
273
|
+
tsconfigPath: { type: 'string' },
|
|
274
|
+
packageJsonPath: { type: 'string' },
|
|
275
|
+
angularJsonPath: { type: 'string' },
|
|
276
|
+
},
|
|
277
|
+
required: ['projectRoot', 'tsconfigPath'],
|
|
278
|
+
},
|
|
279
|
+
pagination: PAGINATION_SCHEMA,
|
|
280
|
+
orchestration: { type: 'object' },
|
|
281
|
+
execution: SCAN_EXECUTION_SCHEMA,
|
|
282
|
+
progress: { type: 'object' },
|
|
283
|
+
summary: { type: 'string' },
|
|
284
|
+
},
|
|
285
|
+
required: [
|
|
286
|
+
'framework',
|
|
287
|
+
'architecture',
|
|
288
|
+
'technologyStack',
|
|
289
|
+
'results',
|
|
290
|
+
'counts',
|
|
291
|
+
'metadata',
|
|
292
|
+
'summary',
|
|
293
|
+
],
|
|
294
|
+
};
|
|
295
|
+
async execute(args, ctx = {}) {
|
|
126
296
|
const params = args;
|
|
127
297
|
// Register operation with watcher for debugging
|
|
128
298
|
const watcher = getMCPWatcher();
|
|
@@ -188,6 +358,9 @@ export class AnalyzeProjectTool {
|
|
|
188
358
|
}
|
|
189
359
|
// Setup progress tracking if requested
|
|
190
360
|
let lastProgress;
|
|
361
|
+
if (ctx.progress !== undefined) {
|
|
362
|
+
forwardKernelProgress(kernel.getProgressReporter(), ctx.progress);
|
|
363
|
+
}
|
|
191
364
|
if (orchestration.enableProgress) {
|
|
192
365
|
const progressReporter = kernel.getProgressReporter();
|
|
193
366
|
if (progressReporter) {
|
|
@@ -205,6 +378,7 @@ export class AnalyzeProjectTool {
|
|
|
205
378
|
// Run analysis using full Phase 6d/7b orchestration
|
|
206
379
|
let results = [];
|
|
207
380
|
let filesAnalyzed = 0;
|
|
381
|
+
let execution;
|
|
208
382
|
if (orchestration.parallel || orchestration.incremental) {
|
|
209
383
|
if (opId) {
|
|
210
384
|
const mode = orchestration.incremental ? 'incremental' : 'parallel';
|
|
@@ -268,11 +442,18 @@ export class AnalyzeProjectTool {
|
|
|
268
442
|
if (opId) {
|
|
269
443
|
watcher?.updateOperation(opId, 'scanning-files', `Found ${tsFiles.length} files to analyze`);
|
|
270
444
|
}
|
|
271
|
-
|
|
272
|
-
|
|
445
|
+
const sequentialFiles = tsFiles.slice(0, 50);
|
|
446
|
+
for (let i = 0; i < sequentialFiles.length; i++) {
|
|
447
|
+
const filePath = sequentialFiles[i];
|
|
273
448
|
if (!filePath) {
|
|
274
449
|
continue;
|
|
275
450
|
}
|
|
451
|
+
await yieldIfCancellable(ctx.signal);
|
|
452
|
+
if (ctx.signal?.aborted === true) {
|
|
453
|
+
execution = cancelledExecution(i, sequentialFiles.length - i);
|
|
454
|
+
break;
|
|
455
|
+
}
|
|
456
|
+
ctx.progress?.(i, sequentialFiles.length, fileProgressMessage(i, sequentialFiles.length, results.length));
|
|
276
457
|
// Update progress every 10 files
|
|
277
458
|
if (opId && i > 0 && i % 10 === 0) {
|
|
278
459
|
watcher?.updateOperation(opId, 'analyzing-files', `${i}/${tsFiles.slice(0, 50).length} files processed`);
|
|
@@ -301,7 +482,8 @@ export class AnalyzeProjectTool {
|
|
|
301
482
|
console.warn(`Error analyzing ${filePath}:`, error);
|
|
302
483
|
}
|
|
303
484
|
}
|
|
304
|
-
filesAnalyzed =
|
|
485
|
+
filesAnalyzed =
|
|
486
|
+
sequentialFiles.length - (execution?.skippedFiles ?? 0);
|
|
305
487
|
if (opId) {
|
|
306
488
|
watcher?.updateOperation(opId, 'sequential-complete', `Analyzed ${filesAnalyzed} files sequentially`);
|
|
307
489
|
}
|
|
@@ -354,12 +536,12 @@ export class AnalyzeProjectTool {
|
|
|
354
536
|
hasMore: resultOffset + maxResults < totalResults,
|
|
355
537
|
};
|
|
356
538
|
}
|
|
357
|
-
const
|
|
539
|
+
const analysis = {
|
|
358
540
|
framework,
|
|
359
541
|
architecture,
|
|
360
542
|
technologyStack,
|
|
361
543
|
results: params.includeDetails ? paginatedResults : [],
|
|
362
|
-
|
|
544
|
+
counts: {
|
|
363
545
|
totalFiles: projectStructure.totalFiles,
|
|
364
546
|
analyzedFiles: filesAnalyzed,
|
|
365
547
|
rulesExecuted: kernel.getPlugin('analyzer').getAnalysisRules().length,
|
|
@@ -374,6 +556,11 @@ export class AnalyzeProjectTool {
|
|
|
374
556
|
pagination: paginationMetadata,
|
|
375
557
|
orchestration: orchestrationMetrics,
|
|
376
558
|
progress: lastProgress,
|
|
559
|
+
...(execution === undefined ? {} : { execution }),
|
|
560
|
+
};
|
|
561
|
+
const result = {
|
|
562
|
+
...analysis,
|
|
563
|
+
summary: describeAnalysis(analysis, totalResults),
|
|
377
564
|
};
|
|
378
565
|
// Mark operation as completed successfully
|
|
379
566
|
if (opId) {
|
|
@@ -625,7 +812,8 @@ export class AnalyzeProjectTool {
|
|
|
625
812
|
});
|
|
626
813
|
files.push(...found);
|
|
627
814
|
}
|
|
628
|
-
|
|
815
|
+
// Sorted: glob returns files in no fixed order
|
|
816
|
+
return [...new Set(files)].sort().filter((file) => ['.ts', '.tsx'].includes(extname(file)));
|
|
629
817
|
}
|
|
630
818
|
/**
|
|
631
819
|
* Determine framework from analysis results and structure.
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Detects blockers like circular dependencies, old Angular versions, custom webpack config,
|
|
6
6
|
* and complex monorepo structures. Provides clear recommendations and speedup estimates.
|
|
7
7
|
*/
|
|
8
|
-
import { type MCPTool } from '../types.js';
|
|
8
|
+
import { type MCPTool, type ToolAnnotations } from '../types.js';
|
|
9
9
|
import { type IncompatibilityCheck } from '@angular-modernizer/core';
|
|
10
10
|
/**
|
|
11
11
|
* Recommendation type for incremental build usage.
|
|
@@ -40,15 +40,22 @@ interface CompatibilityCheckOutput {
|
|
|
40
40
|
* User-facing formatted message.
|
|
41
41
|
*/
|
|
42
42
|
message: string;
|
|
43
|
+
/**
|
|
44
|
+
* Short text: verdict, recommendation, detected blockers and warnings, speedup.
|
|
45
|
+
*/
|
|
46
|
+
summary: string;
|
|
43
47
|
}
|
|
44
48
|
/**
|
|
45
49
|
* MCP tool for checking incremental build compatibility.
|
|
46
50
|
*/
|
|
47
51
|
export declare class CheckIncrementalCompatibilityTool implements MCPTool {
|
|
48
52
|
name: string;
|
|
53
|
+
title: string;
|
|
54
|
+
annotations: ToolAnnotations;
|
|
49
55
|
description: string;
|
|
50
56
|
inputSchema: {
|
|
51
57
|
type: string;
|
|
58
|
+
additionalProperties: boolean;
|
|
52
59
|
properties: {
|
|
53
60
|
projectPath: {
|
|
54
61
|
type: string;
|
|
@@ -72,6 +79,59 @@ export declare class CheckIncrementalCompatibilityTool implements MCPTool {
|
|
|
72
79
|
};
|
|
73
80
|
required: string[];
|
|
74
81
|
};
|
|
82
|
+
outputSchema: {
|
|
83
|
+
type: string;
|
|
84
|
+
properties: {
|
|
85
|
+
compatible: {
|
|
86
|
+
type: string;
|
|
87
|
+
};
|
|
88
|
+
angularVersion: {
|
|
89
|
+
type: string[];
|
|
90
|
+
};
|
|
91
|
+
issues: {
|
|
92
|
+
readonly type: "array";
|
|
93
|
+
readonly items: {
|
|
94
|
+
readonly type: "object";
|
|
95
|
+
readonly properties: {
|
|
96
|
+
readonly type: {
|
|
97
|
+
readonly type: "string";
|
|
98
|
+
};
|
|
99
|
+
readonly detected: {
|
|
100
|
+
readonly type: "boolean";
|
|
101
|
+
};
|
|
102
|
+
readonly severity: {
|
|
103
|
+
readonly type: "string";
|
|
104
|
+
readonly enum: readonly ["blocker", "warning"];
|
|
105
|
+
};
|
|
106
|
+
readonly message: {
|
|
107
|
+
readonly type: "string";
|
|
108
|
+
};
|
|
109
|
+
readonly recommendation: {
|
|
110
|
+
readonly type: "string";
|
|
111
|
+
};
|
|
112
|
+
readonly details: {
|
|
113
|
+
readonly type: "object";
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
readonly required: readonly ["type", "detected", "severity", "message", "recommendation"];
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
recommendation: {
|
|
120
|
+
type: string;
|
|
121
|
+
enum: string[];
|
|
122
|
+
};
|
|
123
|
+
estimatedSpeedup: {
|
|
124
|
+
type: string[];
|
|
125
|
+
};
|
|
126
|
+
message: {
|
|
127
|
+
type: string;
|
|
128
|
+
};
|
|
129
|
+
summary: {
|
|
130
|
+
type: string;
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
required: string[];
|
|
134
|
+
};
|
|
75
135
|
execute(args: Record<string, unknown>): Promise<CompatibilityCheckOutput>;
|
|
76
136
|
/**
|
|
77
137
|
* Extracts Angular version from package.json
|