@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
|
@@ -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
|
|
@@ -9,14 +9,45 @@ import { Project } from 'ts-morph';
|
|
|
9
9
|
import { IncompatibilityDetector, } from '@angular-modernizer/core';
|
|
10
10
|
import { existsSync, readFileSync } from 'node:fs';
|
|
11
11
|
import { join } from 'node:path';
|
|
12
|
+
import { INCOMPATIBILITY_ISSUES_SCHEMA } from './helpers/build-schemas.js';
|
|
13
|
+
/** Text summary: verdict, Angular version, recommendation and one line per detected issue. */
|
|
14
|
+
function describeCompatibility(output) {
|
|
15
|
+
const detected = output.issues.filter((i) => i.detected);
|
|
16
|
+
const blockers = detected.filter((i) => i.severity === 'blocker');
|
|
17
|
+
const verdict = !output.compatible
|
|
18
|
+
? 'Not compatible with incremental builds'
|
|
19
|
+
: output.recommendation === 'use-with-caution'
|
|
20
|
+
? 'Compatible with incremental builds, with caution'
|
|
21
|
+
: 'Compatible with incremental builds';
|
|
22
|
+
const lines = [
|
|
23
|
+
`${verdict} (Angular ${output.angularVersion ?? 'not detected'}); recommendation ${output.recommendation}; ` +
|
|
24
|
+
`${blockers.length} blocker(s), ${detected.length - blockers.length} warning(s)` +
|
|
25
|
+
(output.estimatedSpeedup === null
|
|
26
|
+
? '.'
|
|
27
|
+
: `; estimated speedup ${output.estimatedSpeedup}x.`),
|
|
28
|
+
];
|
|
29
|
+
for (const issue of detected) {
|
|
30
|
+
lines.push(`- ${issue.severity} ${issue.type}: ${issue.message} ${issue.recommendation}`);
|
|
31
|
+
}
|
|
32
|
+
return lines.join('\n');
|
|
33
|
+
}
|
|
12
34
|
/**
|
|
13
35
|
* MCP tool for checking incremental build compatibility.
|
|
14
36
|
*/
|
|
15
37
|
export class CheckIncrementalCompatibilityTool {
|
|
16
38
|
name = 'check-incremental-compatibility';
|
|
17
|
-
|
|
39
|
+
title = 'Check Incremental Build Compatibility';
|
|
40
|
+
annotations = {
|
|
41
|
+
readOnlyHint: true,
|
|
42
|
+
destructiveHint: false,
|
|
43
|
+
idempotentHint: true,
|
|
44
|
+
openWorldHint: false,
|
|
45
|
+
};
|
|
46
|
+
description = 'Check if a project is compatible with incremental build validation. Detects blockers like circular dependencies, old Angular versions, custom build configs, and complex monorepos. Returns compatibility status, issues, recommendations, and estimated speedup. ' +
|
|
47
|
+
'summary is a short text with the verdict, the recommendation and the detected issues.';
|
|
18
48
|
inputSchema = {
|
|
19
49
|
type: 'object',
|
|
50
|
+
additionalProperties: false,
|
|
20
51
|
properties: {
|
|
21
52
|
projectPath: {
|
|
22
53
|
type: 'string',
|
|
@@ -40,6 +71,30 @@ export class CheckIncrementalCompatibilityTool {
|
|
|
40
71
|
},
|
|
41
72
|
required: ['projectPath'],
|
|
42
73
|
};
|
|
74
|
+
outputSchema = {
|
|
75
|
+
type: 'object',
|
|
76
|
+
properties: {
|
|
77
|
+
compatible: { type: 'boolean' },
|
|
78
|
+
angularVersion: { type: ['string', 'null'] },
|
|
79
|
+
issues: INCOMPATIBILITY_ISSUES_SCHEMA,
|
|
80
|
+
recommendation: {
|
|
81
|
+
type: 'string',
|
|
82
|
+
enum: ['use-incremental', 'use-full', 'use-with-caution'],
|
|
83
|
+
},
|
|
84
|
+
estimatedSpeedup: { type: ['number', 'null'] },
|
|
85
|
+
message: { type: 'string' },
|
|
86
|
+
summary: { type: 'string' },
|
|
87
|
+
},
|
|
88
|
+
required: [
|
|
89
|
+
'compatible',
|
|
90
|
+
'angularVersion',
|
|
91
|
+
'issues',
|
|
92
|
+
'recommendation',
|
|
93
|
+
'estimatedSpeedup',
|
|
94
|
+
'message',
|
|
95
|
+
'summary',
|
|
96
|
+
],
|
|
97
|
+
};
|
|
43
98
|
async execute(args) {
|
|
44
99
|
const params = args;
|
|
45
100
|
if (!params.projectPath) {
|
|
@@ -79,7 +134,7 @@ export class CheckIncrementalCompatibilityTool {
|
|
|
79
134
|
const estimatedSpeedup = compatible ? this.calculateSpeedup(project) : null;
|
|
80
135
|
// Format user-facing message
|
|
81
136
|
const message = this.formatMessage(compatible, angularVersion, issues, recommendation, estimatedSpeedup);
|
|
82
|
-
|
|
137
|
+
const output = {
|
|
83
138
|
compatible,
|
|
84
139
|
angularVersion,
|
|
85
140
|
issues,
|
|
@@ -87,6 +142,7 @@ export class CheckIncrementalCompatibilityTool {
|
|
|
87
142
|
estimatedSpeedup,
|
|
88
143
|
message,
|
|
89
144
|
};
|
|
145
|
+
return { ...output, summary: describeCompatibility(output) };
|
|
90
146
|
}
|
|
91
147
|
/**
|
|
92
148
|
* Extracts Angular version from package.json
|