@angular-modernizer/adapter-mcp 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +78 -64
- package/dist/cli.js +8 -0
- package/dist/core/project-analyzer.d.ts +3 -12
- package/dist/core/project-analyzer.js +3 -12
- package/dist/index.d.ts +118 -3
- package/dist/index.js +46 -3
- package/dist/mcp-watcher.d.ts +28 -8
- package/dist/mcp-watcher.js +7 -7
- package/dist/scan-host/scan-host.d.ts +119 -0
- package/dist/scan-host/scan-host.js +376 -0
- package/dist/scan-host/scan-protocol.d.ts +35 -0
- package/dist/scan-host/scan-protocol.js +6 -0
- package/dist/scan-host/scan-worker.d.ts +14 -0
- package/dist/scan-host/scan-worker.js +48 -0
- package/dist/server/limited-stdio-transport.d.ts +7 -0
- package/dist/server/mcp-server.d.ts +11 -7
- package/dist/server/mcp-server.js +4 -7
- package/dist/server/sdk-server.d.ts +1 -0
- package/dist/server/tool-registry.d.ts +3 -7
- package/dist/server/tool-registry.js +1 -7
- package/dist/streaming/progress-store.d.ts +22 -5
- package/dist/streaming/progress-store.js +9 -5
- package/dist/tools/analyze-build-impact.d.ts +56 -34
- package/dist/tools/analyze-build-impact.js +30 -25
- package/dist/tools/analyze-core-to-shared.d.ts +42 -12
- package/dist/tools/analyze-core-to-shared.js +11 -10
- package/dist/tools/analyze-parser-performance.d.ts +23 -22
- package/dist/tools/analyze-parser-performance.js +20 -18
- package/dist/tools/analyze-project.d.ts +82 -12
- package/dist/tools/analyze-project.js +98 -101
- package/dist/tools/check-incremental-compatibility.d.ts +13 -11
- package/dist/tools/check-incremental-compatibility.js +11 -8
- package/dist/tools/collect-feedback.d.ts +41 -26
- package/dist/tools/collect-feedback.js +32 -23
- package/dist/tools/compare-health.d.ts +76 -19
- package/dist/tools/compare-health.js +26 -19
- package/dist/tools/extract-libraries.d.ts +44 -20
- package/dist/tools/extract-libraries.js +16 -17
- package/dist/tools/find-angular-symbol.d.ts +25 -23
- package/dist/tools/find-angular-symbol.js +17 -14
- package/dist/tools/find-component-hosts.d.ts +31 -25
- package/dist/tools/find-component-hosts.js +24 -21
- package/dist/tools/find-usages.d.ts +23 -21
- package/dist/tools/find-usages.js +19 -16
- package/dist/tools/get-bootstrap-execution.d.ts +33 -25
- package/dist/tools/get-bootstrap-execution.js +25 -22
- package/dist/tools/get-call-graph.d.ts +18 -13
- package/dist/tools/get-call-graph.js +24 -21
- package/dist/tools/get-operation-progress-tool.d.ts +12 -6
- package/dist/tools/get-operation-progress-tool.js +11 -6
- package/dist/tools/get-operation-progress.d.ts +26 -0
- package/dist/tools/helpers/analysis-output.d.ts +5 -0
- package/dist/tools/helpers/batch-kernel.d.ts +14 -0
- package/dist/tools/helpers/batch-kernel.js +12 -0
- package/dist/tools/helpers/compact-output.d.ts +2 -1
- package/dist/tools/helpers/compact-output.js +2 -1
- package/dist/tools/helpers/health-delta.d.ts +27 -14
- package/dist/tools/helpers/health-delta.js +11 -14
- package/dist/tools/helpers/project-cache.d.ts +50 -34
- package/dist/tools/helpers/project-cache.js +33 -34
- package/dist/tools/helpers/rule-runner.d.ts +23 -16
- package/dist/tools/helpers/rule-runner.js +24 -17
- package/dist/tools/helpers/scan-engine.d.ts +107 -0
- package/dist/tools/helpers/scan-engine.js +197 -0
- package/dist/tools/helpers/suggestion-generator.d.ts +9 -13
- package/dist/tools/helpers/suggestion-generator.js +0 -12
- package/dist/tools/helpers/tool-cache.d.ts +11 -0
- package/dist/tools/helpers/tool-cache.js +15 -0
- package/dist/tools/helpers/tool-context.d.ts +11 -8
- package/dist/tools/helpers/tool-context.js +5 -8
- package/dist/tools/inspect-form-group.d.ts +32 -25
- package/dist/tools/inspect-form-group.js +24 -21
- package/dist/tools/inspect-i18n.d.ts +28 -22
- package/dist/tools/inspect-i18n.js +20 -17
- package/dist/tools/inspect-template.d.ts +31 -24
- package/dist/tools/inspect-template.js +23 -20
- package/dist/tools/learn-patterns.d.ts +88 -12
- package/dist/tools/learn-patterns.js +17 -11
- package/dist/tools/list-imports.d.ts +42 -25
- package/dist/tools/list-imports.js +23 -20
- package/dist/tools/orchestrate-migration.d.ts +31 -9
- package/dist/tools/orchestrate-migration.js +12 -7
- package/dist/tools/parse-stack-trace.d.ts +23 -21
- package/dist/tools/parse-stack-trace.js +10 -7
- package/dist/tools/plan-migration.d.ts +65 -25
- package/dist/tools/plan-migration.js +19 -19
- package/dist/tools/resolve-type.d.ts +19 -9
- package/dist/tools/resolve-type.js +19 -11
- package/dist/tools/review-feedback.d.ts +27 -24
- package/dist/tools/review-feedback.js +24 -20
- package/dist/tools/rollback-changes.d.ts +13 -9
- package/dist/tools/rollback-changes.js +10 -7
- package/dist/tools/run-angular-cli.d.ts +12 -10
- package/dist/tools/run-angular-cli.js +11 -8
- package/dist/tools/run-build.d.ts +13 -11
- package/dist/tools/run-build.js +11 -8
- package/dist/tools/run-schematic.d.ts +12 -10
- package/dist/tools/run-schematic.js +11 -8
- package/dist/tools/scan-all.d.ts +69 -12
- package/dist/tools/scan-all.js +55 -122
- package/dist/tools/scan-angular.d.ts +41 -9
- package/dist/tools/scan-angular.js +66 -135
- package/dist/tools/scan-architecture.d.ts +75 -14
- package/dist/tools/scan-architecture.js +180 -185
- package/dist/tools/scan-solid.d.ts +40 -9
- package/dist/tools/scan-solid.js +64 -133
- package/dist/tools/search-codebase.d.ts +30 -24
- package/dist/tools/search-codebase.js +13 -10
- package/dist/tools/server-status.d.ts +116 -24
- package/dist/tools/server-status.js +85 -26
- package/dist/tools/suggest-improvements.d.ts +22 -19
- package/dist/tools/suggest-improvements.js +21 -17
- package/dist/tools/trace-output-flow.d.ts +32 -25
- package/dist/tools/trace-output-flow.js +24 -21
- package/dist/tools/transform-code.d.ts +71 -10
- package/dist/tools/transform-code.js +60 -42
- package/dist/tools/validate-before-transform.d.ts +24 -9
- package/dist/tools/validate-before-transform.js +10 -7
- package/dist/tools/validate-project-compatibility.d.ts +18 -13
- package/dist/tools/validate-project-compatibility.js +17 -11
- package/dist/tools/validate-transformation.d.ts +28 -11
- package/dist/tools/validate-transformation.js +14 -8
- package/dist/tools/verify-citations.d.ts +37 -16
- package/dist/tools/verify-citations.js +19 -16
- package/dist/types.d.ts +40 -10
- package/dist/types.js +0 -5
- package/package.json +12 -18
- package/dist/tools/shared/scan-types.d.ts +0 -200
- package/dist/tools/shared/scan-types.js +0 -7
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @angular-modernizer/adapter-mcp - Scan Architecture Tool
|
|
3
|
-
*
|
|
4
|
-
* MCP tool for scanning Angular codebases for architectural issues.
|
|
5
|
-
* Runs only the ArchitecturePlugin (17 rules: import cycles, layer violations, god objects, etc.).
|
|
6
|
-
*/
|
|
7
1
|
import type { MCPTool, ToolAnnotations, ToolContext } from '../types.js';
|
|
8
2
|
import { type ScanCounts } from './helpers/analysis-output.js';
|
|
9
3
|
import { type RuleTiming } from './helpers/rule-runner.js';
|
|
@@ -34,28 +28,39 @@ interface ScanScope {
|
|
|
34
28
|
/**
|
|
35
29
|
* Resolved scope information returned in results.
|
|
36
30
|
*/
|
|
37
|
-
interface ResolvedScope {
|
|
31
|
+
export interface ResolvedScope {
|
|
32
|
+
/** Scope type that was scanned. */
|
|
38
33
|
type: ScanScope['type'];
|
|
34
|
+
/** Project or feature names from the requested scope. */
|
|
39
35
|
names?: string[];
|
|
36
|
+
/** Folder paths from the requested scope. */
|
|
40
37
|
paths?: string[];
|
|
38
|
+
/** Paths the scope resolved to; files below them are scanned. */
|
|
41
39
|
resolvedPaths: string[];
|
|
40
|
+
/** Number of files in scope that were selected for the scan. */
|
|
42
41
|
matchedFiles: number;
|
|
43
42
|
}
|
|
44
43
|
/**
|
|
45
44
|
* Run details of a scan.
|
|
46
45
|
*/
|
|
47
|
-
interface ScanExecution {
|
|
46
|
+
export interface ScanExecution {
|
|
47
|
+
/** Time budget of the scan in milliseconds; `0` means no budget. */
|
|
48
48
|
maxDurationMs: number;
|
|
49
|
+
/** `true` when the time budget or a cancellation stopped the scan early. */
|
|
49
50
|
incomplete: boolean;
|
|
51
|
+
/** Why the scan stopped early. */
|
|
50
52
|
stopReason?: 'time-budget' | 'cancelled';
|
|
53
|
+
/** Files that were not analyzed because the scan stopped early. */
|
|
51
54
|
skippedFiles: number;
|
|
55
|
+
/** Time per rule, slowest first. */
|
|
52
56
|
ruleTimings: RuleTiming[];
|
|
57
|
+
/** Human-readable note on an incomplete scan. */
|
|
53
58
|
note?: string;
|
|
54
59
|
}
|
|
55
60
|
/**
|
|
56
61
|
* Result from the scan-architecture tool.
|
|
57
62
|
*/
|
|
58
|
-
interface ScanArchitectureResult {
|
|
63
|
+
export interface ScanArchitectureResult {
|
|
59
64
|
/**
|
|
60
65
|
* Operation ID for streaming mode (when streaming=true).
|
|
61
66
|
*/
|
|
@@ -64,15 +69,25 @@ interface ScanArchitectureResult {
|
|
|
64
69
|
* All violations found.
|
|
65
70
|
*/
|
|
66
71
|
violations: {
|
|
72
|
+
/** Violation id built from rule id, file, line and column. */
|
|
67
73
|
id: string;
|
|
74
|
+
/** Rule that reported the violation, e.g. `solid:circular-dependency`. */
|
|
68
75
|
ruleId: string;
|
|
76
|
+
/** Severity reported by the rule, else the rule's default severity. */
|
|
69
77
|
severity: 'error' | 'warning' | 'info';
|
|
78
|
+
/** Rule message. */
|
|
70
79
|
message: string;
|
|
80
|
+
/** File the violation was reported on. */
|
|
71
81
|
filePath: string;
|
|
82
|
+
/** 1-based line of the finding, when the rule reports one. */
|
|
72
83
|
line?: number;
|
|
84
|
+
/** Column of the finding, when the rule reports one. */
|
|
73
85
|
column?: number;
|
|
86
|
+
/** Category of the rule. */
|
|
74
87
|
category: string;
|
|
88
|
+
/** Fix suggested by the rule. */
|
|
75
89
|
suggestedFix?: string;
|
|
90
|
+
/** Rule-specific details. */
|
|
76
91
|
metadata?: Record<string, unknown>;
|
|
77
92
|
}[];
|
|
78
93
|
/**
|
|
@@ -87,8 +102,11 @@ interface ScanArchitectureResult {
|
|
|
87
102
|
* Analysis metadata.
|
|
88
103
|
*/
|
|
89
104
|
metadata: {
|
|
105
|
+
/** Ids of the rules that ran. */
|
|
90
106
|
rulesExecuted: string[];
|
|
107
|
+
/** Duration of the scan in milliseconds. */
|
|
91
108
|
duration: number;
|
|
109
|
+
/** Root path of the scanned project. */
|
|
92
110
|
projectRoot: string;
|
|
93
111
|
};
|
|
94
112
|
/**
|
|
@@ -100,25 +118,42 @@ interface ScanArchitectureResult {
|
|
|
100
118
|
*/
|
|
101
119
|
scope?: ResolvedScope;
|
|
102
120
|
/**
|
|
103
|
-
* Orchestration metrics
|
|
121
|
+
* Orchestration metrics; set when `orchestration.parallel` or
|
|
122
|
+
* `orchestration.incremental` is set.
|
|
104
123
|
*/
|
|
105
124
|
orchestration?: {
|
|
125
|
+
/** Value of `orchestration.parallel`. */
|
|
106
126
|
parallel: boolean;
|
|
127
|
+
/** Value of `orchestration.incremental`. */
|
|
107
128
|
incremental: boolean;
|
|
129
|
+
/** Value of `orchestration.useWorkerThreads`. */
|
|
108
130
|
useWorkerThreads?: boolean;
|
|
131
|
+
/** Value of `orchestration.autoSelectMode`. */
|
|
109
132
|
autoSelectMode?: boolean;
|
|
133
|
+
/** Files analyzed. */
|
|
110
134
|
filesAnalyzed: number;
|
|
135
|
+
/** Files skipped by incremental analysis. */
|
|
111
136
|
filesSkipped: number;
|
|
137
|
+
/** Cache hit rate of incremental analysis. */
|
|
112
138
|
cacheHitRate: number;
|
|
139
|
+
/** Duration of the scan in milliseconds. */
|
|
113
140
|
duration: number;
|
|
141
|
+
/** Files per second. */
|
|
114
142
|
throughput: number;
|
|
143
|
+
/** Parallel execution figures of the kernel. */
|
|
115
144
|
workerStats?: {
|
|
145
|
+
/** Completed tasks. */
|
|
116
146
|
completedTasks: number;
|
|
147
|
+
/** Average task duration in milliseconds. */
|
|
117
148
|
averageTaskDuration: number;
|
|
149
|
+
/** Summed CPU time of all tasks. */
|
|
118
150
|
totalCpuTime: number;
|
|
119
151
|
};
|
|
152
|
+
/** Resource limits from `orchestration.resourceLimits`. */
|
|
120
153
|
resourceUsage?: {
|
|
154
|
+
/** Maximum number of workers. */
|
|
121
155
|
maxWorkers?: number;
|
|
156
|
+
/** Memory limit. */
|
|
122
157
|
maxMemory?: number;
|
|
123
158
|
};
|
|
124
159
|
};
|
|
@@ -126,19 +161,28 @@ interface ScanArchitectureResult {
|
|
|
126
161
|
* Pagination metadata (when pagination is used).
|
|
127
162
|
*/
|
|
128
163
|
pagination?: {
|
|
164
|
+
/** Number of all violations. */
|
|
129
165
|
totalResults: number;
|
|
166
|
+
/** Number of violations in this page. */
|
|
130
167
|
returnedResults: number;
|
|
168
|
+
/** Offset of the page (`resultOffset`). */
|
|
131
169
|
offset: number;
|
|
170
|
+
/** Whether violations follow after this page. */
|
|
132
171
|
hasMore: boolean;
|
|
133
172
|
};
|
|
134
173
|
/**
|
|
135
174
|
* Progress state (if enableProgress was true).
|
|
136
175
|
*/
|
|
137
176
|
progress?: {
|
|
177
|
+
/** Processed items. */
|
|
138
178
|
current: number;
|
|
179
|
+
/** Items in total. */
|
|
139
180
|
total: number;
|
|
181
|
+
/** Progress in percent. */
|
|
140
182
|
percentage: number;
|
|
183
|
+
/** Estimated remaining time; 0 when unknown. */
|
|
141
184
|
eta: number;
|
|
185
|
+
/** Progress event type of the kernel's progress reporter. */
|
|
142
186
|
phase: string;
|
|
143
187
|
};
|
|
144
188
|
/**
|
|
@@ -150,23 +194,30 @@ interface ScanArchitectureResult {
|
|
|
150
194
|
* Intermediate results from each pipeline stage (fluent API only).
|
|
151
195
|
*/
|
|
152
196
|
intermediateResults?: Record<string, {
|
|
197
|
+
/** Whether the stage succeeded. */
|
|
153
198
|
success: boolean;
|
|
199
|
+
/** Violations found by the stage. */
|
|
154
200
|
violations?: number;
|
|
201
|
+
/** Files processed by the stage. */
|
|
155
202
|
filesProcessed?: number;
|
|
203
|
+
/** Stage message. */
|
|
156
204
|
message?: string;
|
|
157
205
|
}>;
|
|
158
206
|
}
|
|
159
207
|
/**
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
* the ArchitecturePlugin.
|
|
208
|
+
* MCP tool `scan-architecture`: scans for architectural issues. Runs only the
|
|
209
|
+
* ArchitecturePlugin (17 rules: import cycles, layer violations, god objects
|
|
210
|
+
* and others).
|
|
164
211
|
*/
|
|
165
212
|
export declare class ScanArchitectureTool implements MCPTool {
|
|
166
213
|
readonly name = "scan-architecture";
|
|
167
214
|
readonly title = "Scan Architecture";
|
|
168
215
|
readonly annotations: ToolAnnotations;
|
|
169
216
|
readonly description: string;
|
|
217
|
+
/**
|
|
218
|
+
* JSON Schema of the tool arguments.
|
|
219
|
+
* @hidden
|
|
220
|
+
*/
|
|
170
221
|
readonly inputSchema: {
|
|
171
222
|
type: string;
|
|
172
223
|
additionalProperties: boolean;
|
|
@@ -333,12 +384,22 @@ export declare class ScanArchitectureTool implements MCPTool {
|
|
|
333
384
|
};
|
|
334
385
|
required: string[];
|
|
335
386
|
};
|
|
387
|
+
/**
|
|
388
|
+
* JSON Schema of the tool result (`structuredContent`).
|
|
389
|
+
* @hidden
|
|
390
|
+
*/
|
|
336
391
|
readonly outputSchema: {
|
|
337
392
|
type: "object";
|
|
338
393
|
properties: Record<string, unknown>;
|
|
339
394
|
required: string[];
|
|
340
395
|
};
|
|
341
396
|
execute(args: Record<string, unknown>, ctx?: ToolContext): Promise<ScanArchitectureResult>;
|
|
397
|
+
/**
|
|
398
|
+
* Runs the rules through the scan engine (in a scan worker when enabled)
|
|
399
|
+
* and appends each file's findings to `violations`. A worker terminated by
|
|
400
|
+
* a cancel leaves no run summary; it is rebuilt from the files received.
|
|
401
|
+
*/
|
|
402
|
+
private runRules;
|
|
342
403
|
/**
|
|
343
404
|
* Execute analysis using fluent API.
|
|
344
405
|
*/
|