@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,10 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @angular-modernizer/adapter-mcp - Check Incremental Compatibility Tool
|
|
3
|
-
*
|
|
4
|
-
* MCP tool for checking project compatibility with incremental build validation.
|
|
5
|
-
* Detects blockers like circular dependencies, old Angular versions, custom webpack config,
|
|
6
|
-
* and complex monorepo structures. Provides clear recommendations and speedup estimates.
|
|
7
|
-
*/
|
|
8
1
|
import { Project } from 'ts-morph';
|
|
9
2
|
import { IncompatibilityDetector, } from '@angular-modernizer/core';
|
|
10
3
|
import { existsSync, readFileSync } from 'node:fs';
|
|
@@ -32,7 +25,9 @@ function describeCompatibility(output) {
|
|
|
32
25
|
return lines.join('\n');
|
|
33
26
|
}
|
|
34
27
|
/**
|
|
35
|
-
* MCP tool for checking incremental build
|
|
28
|
+
* MCP tool for checking project compatibility with incremental build validation.
|
|
29
|
+
* Detects blockers like circular dependencies, old Angular versions, custom webpack config,
|
|
30
|
+
* and complex monorepo structures. Provides clear recommendations and speedup estimates.
|
|
36
31
|
*/
|
|
37
32
|
export class CheckIncrementalCompatibilityTool {
|
|
38
33
|
name = 'check-incremental-compatibility';
|
|
@@ -45,6 +40,10 @@ export class CheckIncrementalCompatibilityTool {
|
|
|
45
40
|
};
|
|
46
41
|
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
42
|
'summary is a short text with the verdict, the recommendation and the detected issues.';
|
|
43
|
+
/**
|
|
44
|
+
* JSON Schema of the tool arguments.
|
|
45
|
+
* @hidden
|
|
46
|
+
*/
|
|
48
47
|
inputSchema = {
|
|
49
48
|
type: 'object',
|
|
50
49
|
additionalProperties: false,
|
|
@@ -71,6 +70,10 @@ export class CheckIncrementalCompatibilityTool {
|
|
|
71
70
|
},
|
|
72
71
|
required: ['projectPath'],
|
|
73
72
|
};
|
|
73
|
+
/**
|
|
74
|
+
* JSON Schema of the tool result (`structuredContent`).
|
|
75
|
+
* @hidden
|
|
76
|
+
*/
|
|
74
77
|
outputSchema = {
|
|
75
78
|
type: 'object',
|
|
76
79
|
properties: {
|
|
@@ -1,31 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @angular-modernizer/adapter-mcp - Collect Feedback Tool
|
|
3
|
-
*
|
|
4
|
-
* MCP tool for manually collecting transformation feedback for AI learning.
|
|
5
|
-
* Stores feedback in the user's project (`<projectRoot>/.claude-feedback`).
|
|
6
|
-
*
|
|
7
|
-
* Record kinds:
|
|
8
|
-
* - 'transformation' (default): outcome of a transform-code run
|
|
9
|
-
* - 'analysis': a read-only tool result (find-usages, search-codebase, ...)
|
|
10
|
-
* that had to be corrected via grep, build output, a script or manual reading
|
|
11
|
-
*
|
|
12
|
-
* Privacy-First:
|
|
13
|
-
* - All file paths anonymized with SHA-256 hashing
|
|
14
|
-
* - No code snippets stored, only metadata
|
|
15
|
-
* - Privacy audit enforced before storage
|
|
16
|
-
*
|
|
17
|
-
* Storage Strategy:
|
|
18
|
-
* - Always the project; a platform store only with ANGULAR_MODERNIZER_PLATFORM_ROOT
|
|
19
|
-
* - 'both' (default): project, plus the platform store when configured
|
|
20
|
-
* - 'project' / 'platform' ('platform' needs the variable)
|
|
21
|
-
* - Graceful partial failure handling
|
|
22
|
-
*/
|
|
23
1
|
import { type MCPTool, type ToolAnnotations } from '../types.js';
|
|
24
2
|
import type { AnalysisFeedbackCategory, ErrorType, TransformFeedbackValidationIssue, Learning, ValidationIssue } from '@angular-modernizer/core';
|
|
25
3
|
/**
|
|
26
4
|
* Output from collect-feedback tool
|
|
27
5
|
*/
|
|
28
|
-
interface CollectFeedbackOutput {
|
|
6
|
+
export interface CollectFeedbackOutput {
|
|
29
7
|
/** Unique feedback identifier (UUID) */
|
|
30
8
|
feedbackId: string;
|
|
31
9
|
/** Session identifier (UUID) */
|
|
@@ -49,7 +27,8 @@ interface CollectFeedbackOutput {
|
|
|
49
27
|
/**
|
|
50
28
|
* Output from collect-feedback tool for kind 'analysis'
|
|
51
29
|
*/
|
|
52
|
-
interface CollectAnalysisFeedbackOutput {
|
|
30
|
+
export interface CollectAnalysisFeedbackOutput {
|
|
31
|
+
/** Record kind; present only for analysis feedback. */
|
|
53
32
|
kind: 'analysis';
|
|
54
33
|
/** Session identifier (UUID) */
|
|
55
34
|
sessionId: string;
|
|
@@ -59,21 +38,48 @@ interface CollectAnalysisFeedbackOutput {
|
|
|
59
38
|
storageLocations: string[];
|
|
60
39
|
/** Per-record result, in input order */
|
|
61
40
|
records: {
|
|
41
|
+
/** Unique feedback identifier (UUID). */
|
|
62
42
|
feedbackId: string;
|
|
43
|
+
/** Read-only tool whose result the record corrects. */
|
|
63
44
|
tool: string;
|
|
45
|
+
/** Whether the record was stored. */
|
|
64
46
|
stored: boolean;
|
|
47
|
+
/** Completeness score of the record (0-100). */
|
|
65
48
|
completenessScore: number;
|
|
49
|
+
/** Validation issues of the record. */
|
|
66
50
|
issues: TransformFeedbackValidationIssue[];
|
|
67
51
|
}[];
|
|
68
52
|
}
|
|
69
53
|
/**
|
|
70
|
-
*
|
|
54
|
+
* MCP tool for collecting transformation feedback for AI learning. Stores
|
|
55
|
+
* feedback in the user's project (`<projectRoot>/.claude-feedback`).
|
|
56
|
+
*
|
|
57
|
+
* @remarks
|
|
58
|
+
* Record kinds:
|
|
59
|
+
* - `transformation` (default): outcome of a transform-code run
|
|
60
|
+
* - `analysis`: a read-only tool result (find-usages, search-codebase, ...)
|
|
61
|
+
* that had to be corrected via grep, build output, a script or manual reading
|
|
62
|
+
*
|
|
63
|
+
* Privacy:
|
|
64
|
+
* - All file paths anonymized with SHA-256 hashing
|
|
65
|
+
* - No code snippets stored, only metadata
|
|
66
|
+
* - Privacy audit enforced before storage
|
|
67
|
+
*
|
|
68
|
+
* Storage:
|
|
69
|
+
* - Always the project; a platform store only with `ANGULAR_MODERNIZER_PLATFORM_ROOT`
|
|
70
|
+
* - `both` (default): the project, plus the platform store when configured
|
|
71
|
+
* - `project` / `platform` (`platform` needs the variable)
|
|
72
|
+
* - Handles partial failures across the locations
|
|
71
73
|
*/
|
|
72
74
|
export declare class CollectFeedbackTool implements MCPTool {
|
|
73
75
|
name: string;
|
|
74
76
|
title: string;
|
|
75
77
|
annotations: ToolAnnotations;
|
|
76
78
|
description: string;
|
|
79
|
+
/**
|
|
80
|
+
* JSON Schema of the tool arguments.
|
|
81
|
+
* @hidden
|
|
82
|
+
*/
|
|
77
83
|
inputSchema: {
|
|
78
84
|
readonly type: "object";
|
|
79
85
|
readonly additionalProperties: false;
|
|
@@ -278,6 +284,10 @@ export declare class CollectFeedbackTool implements MCPTool {
|
|
|
278
284
|
};
|
|
279
285
|
readonly required: readonly [];
|
|
280
286
|
};
|
|
287
|
+
/**
|
|
288
|
+
* JSON Schema of the tool result (`structuredContent`).
|
|
289
|
+
* @hidden
|
|
290
|
+
*/
|
|
281
291
|
outputSchema: {
|
|
282
292
|
type: string;
|
|
283
293
|
properties: {
|
|
@@ -408,10 +418,15 @@ export declare class CollectFeedbackTool implements MCPTool {
|
|
|
408
418
|
};
|
|
409
419
|
required: string[];
|
|
410
420
|
};
|
|
421
|
+
/**
|
|
422
|
+
* Validates, anonymizes and stores the feedback.
|
|
423
|
+
* @param args - Tool arguments validated against the input schema
|
|
424
|
+
* @returns The stored feedback result with a text summary
|
|
425
|
+
*/
|
|
411
426
|
execute(args: Record<string, unknown>): Promise<(CollectFeedbackOutput | CollectAnalysisFeedbackOutput) & {
|
|
427
|
+
/** Short text: what was stored and the validation issues. */
|
|
412
428
|
summary: string;
|
|
413
429
|
}>;
|
|
414
430
|
private collect;
|
|
415
431
|
}
|
|
416
|
-
export {};
|
|
417
432
|
//# sourceMappingURL=collect-feedback.d.ts.map
|
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @angular-modernizer/adapter-mcp - Collect Feedback Tool
|
|
3
|
-
*
|
|
4
|
-
* MCP tool for manually collecting transformation feedback for AI learning.
|
|
5
|
-
* Stores feedback in the user's project (`<projectRoot>/.claude-feedback`).
|
|
6
|
-
*
|
|
7
|
-
* Record kinds:
|
|
8
|
-
* - 'transformation' (default): outcome of a transform-code run
|
|
9
|
-
* - 'analysis': a read-only tool result (find-usages, search-codebase, ...)
|
|
10
|
-
* that had to be corrected via grep, build output, a script or manual reading
|
|
11
|
-
*
|
|
12
|
-
* Privacy-First:
|
|
13
|
-
* - All file paths anonymized with SHA-256 hashing
|
|
14
|
-
* - No code snippets stored, only metadata
|
|
15
|
-
* - Privacy audit enforced before storage
|
|
16
|
-
*
|
|
17
|
-
* Storage Strategy:
|
|
18
|
-
* - Always the project; a platform store only with ANGULAR_MODERNIZER_PLATFORM_ROOT
|
|
19
|
-
* - 'both' (default): project, plus the platform store when configured
|
|
20
|
-
* - 'project' / 'platform' ('platform' needs the variable)
|
|
21
|
-
* - Graceful partial failure handling
|
|
22
|
-
*/
|
|
23
1
|
import { FeedbackCollector, PrivacyFilter, FeedbackValidator, FeedbackStorage, loadConfig, FEEDBACK_VERSION, FEEDBACK_FORMAT, ValidationType, ValidationSeverity, ANALYSIS_FEEDBACK_CATEGORIES, ERROR_TYPES, inferErrorType, isErrorType, scoreAnalysisCompleteness, validateAnalysisFeedback, } from '@angular-modernizer/core';
|
|
24
2
|
import { randomUUID } from 'node:crypto';
|
|
25
3
|
import * as path from 'node:path';
|
|
@@ -251,7 +229,25 @@ const ANALYSIS_RECORD_SCHEMA = {
|
|
|
251
229
|
},
|
|
252
230
|
};
|
|
253
231
|
/**
|
|
254
|
-
*
|
|
232
|
+
* MCP tool for collecting transformation feedback for AI learning. Stores
|
|
233
|
+
* feedback in the user's project (`<projectRoot>/.claude-feedback`).
|
|
234
|
+
*
|
|
235
|
+
* @remarks
|
|
236
|
+
* Record kinds:
|
|
237
|
+
* - `transformation` (default): outcome of a transform-code run
|
|
238
|
+
* - `analysis`: a read-only tool result (find-usages, search-codebase, ...)
|
|
239
|
+
* that had to be corrected via grep, build output, a script or manual reading
|
|
240
|
+
*
|
|
241
|
+
* Privacy:
|
|
242
|
+
* - All file paths anonymized with SHA-256 hashing
|
|
243
|
+
* - No code snippets stored, only metadata
|
|
244
|
+
* - Privacy audit enforced before storage
|
|
245
|
+
*
|
|
246
|
+
* Storage:
|
|
247
|
+
* - Always the project; a platform store only with `ANGULAR_MODERNIZER_PLATFORM_ROOT`
|
|
248
|
+
* - `both` (default): the project, plus the platform store when configured
|
|
249
|
+
* - `project` / `platform` (`platform` needs the variable)
|
|
250
|
+
* - Handles partial failures across the locations
|
|
255
251
|
*/
|
|
256
252
|
export class CollectFeedbackTool {
|
|
257
253
|
name = 'collect-feedback';
|
|
@@ -269,6 +265,10 @@ export class CollectFeedbackTool {
|
|
|
269
265
|
'that had to be corrected by grep, build output, a script or manual reading; ' +
|
|
270
266
|
"'analysis' accepts one record or an array and needs no execution/duration/build data. " +
|
|
271
267
|
'summary is a short text with what was stored and the validation issues.';
|
|
268
|
+
/**
|
|
269
|
+
* JSON Schema of the tool arguments.
|
|
270
|
+
* @hidden
|
|
271
|
+
*/
|
|
272
272
|
inputSchema = {
|
|
273
273
|
type: 'object',
|
|
274
274
|
additionalProperties: false,
|
|
@@ -396,6 +396,10 @@ export class CollectFeedbackTool {
|
|
|
396
396
|
// (checked at runtime); kind 'analysis' needs only `analysis`.
|
|
397
397
|
required: [],
|
|
398
398
|
};
|
|
399
|
+
/**
|
|
400
|
+
* JSON Schema of the tool result (`structuredContent`).
|
|
401
|
+
* @hidden
|
|
402
|
+
*/
|
|
399
403
|
outputSchema = {
|
|
400
404
|
type: 'object',
|
|
401
405
|
properties: {
|
|
@@ -475,6 +479,11 @@ export class CollectFeedbackTool {
|
|
|
475
479
|
},
|
|
476
480
|
required: ['sessionId', 'stored', 'storageLocations', 'summary'],
|
|
477
481
|
};
|
|
482
|
+
/**
|
|
483
|
+
* Validates, anonymizes and stores the feedback.
|
|
484
|
+
* @param args - Tool arguments validated against the input schema
|
|
485
|
+
* @returns The stored feedback result with a text summary
|
|
486
|
+
*/
|
|
478
487
|
async execute(args) {
|
|
479
488
|
const output = await this.collect(args);
|
|
480
489
|
return { ...output, summary: describeFeedback(output) };
|
|
@@ -1,71 +1,86 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @angular-modernizer/adapter-mcp - Compare Health Tool
|
|
3
|
-
*
|
|
4
|
-
* MCP tool that runs the scan-all scan and compares it with the previous run:
|
|
5
|
-
* which violations are new, fixed or unchanged, per rule and per file.
|
|
6
|
-
*
|
|
7
|
-
* @remarks
|
|
8
|
-
* scan-all returns a window of `maxResults` violations and sums only that
|
|
9
|
-
* window, so a comparison of two scan-all answers would compare two windows.
|
|
10
|
-
* This tool takes the complete result, stores it as a snapshot in the target
|
|
11
|
-
* project (default `.angular-modernizer-cache/health/last-run.json`, ignored
|
|
12
|
-
* like the cache) and compares the next run against it. Matching and snapshot
|
|
13
|
-
* format live in `helpers/health-delta.ts`.
|
|
14
|
-
*
|
|
15
|
-
* The snapshot is replaced after every comparison unless `updateSnapshot` is
|
|
16
|
-
* false. When the stored run used another scope (rules, include or exclude
|
|
17
|
-
* patterns) or the file cannot be read, nothing is compared and the file is
|
|
18
|
-
* kept unless `updateSnapshot` is explicitly true.
|
|
19
|
-
*/
|
|
20
1
|
import { type FileSystemAdapter } from '@angular-modernizer/core';
|
|
21
2
|
import { type MCPTool, type ToolAnnotations, type ToolContext } from '../types.js';
|
|
22
3
|
import { type FileDelta, type HealthViolation, type RuleDelta } from './helpers/health-delta.js';
|
|
23
4
|
/** The part of a scan-all result the comparison needs. */
|
|
24
5
|
export interface HealthScanResult {
|
|
6
|
+
/** All violations of the scan. */
|
|
25
7
|
violations: readonly {
|
|
8
|
+
/** Rule that reported the violation. */
|
|
26
9
|
ruleId: string;
|
|
10
|
+
/** Severity of the violation. */
|
|
27
11
|
severity: string;
|
|
12
|
+
/** Rule message. */
|
|
28
13
|
message: string;
|
|
14
|
+
/** File path relative to the project root. */
|
|
29
15
|
filePath: string;
|
|
16
|
+
/** 1-based line, when the rule reports one. */
|
|
30
17
|
line?: number;
|
|
18
|
+
/** Rule category. */
|
|
31
19
|
category: string;
|
|
32
20
|
}[];
|
|
21
|
+
/** Scan counts. */
|
|
33
22
|
counts: {
|
|
23
|
+
/** Number of analyzed files. */
|
|
34
24
|
analyzedFiles: number;
|
|
35
25
|
};
|
|
26
|
+
/** Scan metadata. */
|
|
36
27
|
metadata: {
|
|
28
|
+
/** Ids of the rules that ran. */
|
|
37
29
|
rulesExecuted: string[];
|
|
38
30
|
};
|
|
39
31
|
/** Set by scan-all when the client cancelled the scan. */
|
|
40
32
|
execution?: {
|
|
33
|
+
/** `cancelled` when the client cancelled the scan. */
|
|
41
34
|
stopReason?: string;
|
|
42
35
|
};
|
|
43
36
|
}
|
|
44
37
|
/** Runs the scan with scan-all arguments. */
|
|
45
38
|
export type HealthScan = (args: Record<string, unknown>, ctx?: ToolContext) => Promise<HealthScanResult>;
|
|
39
|
+
/**
|
|
40
|
+
* Outcome of a compare-health run:
|
|
41
|
+
* - `compared`: the run was compared with the stored snapshot.
|
|
42
|
+
* - `baseline-created`: no snapshot existed; the current run was stored.
|
|
43
|
+
* - `no-baseline`: no snapshot existed and `updateSnapshot` was `false`.
|
|
44
|
+
* - `scope-mismatch`: the snapshot used other rules or include/exclude
|
|
45
|
+
* patterns; nothing was compared.
|
|
46
|
+
* - `invalid-snapshot`: the snapshot could not be read; nothing was compared.
|
|
47
|
+
*/
|
|
46
48
|
export type CompareHealthStatus = 'compared' | 'baseline-created' | 'no-baseline' | 'scope-mismatch' | 'invalid-snapshot';
|
|
47
49
|
/** Counts of one run. */
|
|
48
50
|
export interface HealthRunInfo {
|
|
51
|
+
/** Time of the run (ISO 8601). */
|
|
49
52
|
createdAt: string;
|
|
53
|
+
/** Number of analyzed files. */
|
|
50
54
|
analyzedFiles: number;
|
|
55
|
+
/** Number of all violations. */
|
|
51
56
|
totalViolations: number;
|
|
52
57
|
}
|
|
53
58
|
/** Output of the compare-health tool. */
|
|
54
59
|
export interface CompareHealthOutput {
|
|
60
|
+
/** Outcome of the run. */
|
|
55
61
|
status: CompareHealthStatus;
|
|
62
|
+
/** Absolute project root. */
|
|
56
63
|
projectRoot: string;
|
|
57
64
|
/** Relative to `projectRoot` when inside it. */
|
|
58
65
|
snapshotPath: string;
|
|
66
|
+
/** Whether the current run was written as the new snapshot. */
|
|
59
67
|
snapshotWritten: boolean;
|
|
68
|
+
/** Counts of the stored run, when a readable snapshot exists. */
|
|
60
69
|
previousRun?: HealthRunInfo;
|
|
70
|
+
/** Counts of the current run. */
|
|
61
71
|
currentRun: HealthRunInfo & {
|
|
72
|
+
/** Violations per severity, over all violations. */
|
|
62
73
|
bySeverity: Record<string, number>;
|
|
74
|
+
/** Violations per category, over all violations. */
|
|
63
75
|
byCategory: Record<string, number>;
|
|
64
76
|
};
|
|
65
77
|
/** Only for status `compared`. */
|
|
66
78
|
totals?: {
|
|
79
|
+
/** Violations only in the current run. */
|
|
67
80
|
new: number;
|
|
81
|
+
/** Violations only in the previous run. */
|
|
68
82
|
fixed: number;
|
|
83
|
+
/** Violations in both runs. */
|
|
69
84
|
unchanged: number;
|
|
70
85
|
};
|
|
71
86
|
/**
|
|
@@ -73,16 +88,50 @@ export interface CompareHealthOutput {
|
|
|
73
88
|
* statuses: current counts only (`previous` and the deltas are 0).
|
|
74
89
|
*/
|
|
75
90
|
byRule: RuleDelta[];
|
|
91
|
+
/**
|
|
92
|
+
* Changed files; only for status `compared`, dropped with `summaryOnly`,
|
|
93
|
+
* capped by `maxResults`.
|
|
94
|
+
*/
|
|
76
95
|
byFile?: FileDelta[];
|
|
96
|
+
/**
|
|
97
|
+
* Violations only in the current run; only for status `compared`, dropped
|
|
98
|
+
* with `summaryOnly`, capped by `maxResults`.
|
|
99
|
+
*/
|
|
77
100
|
newViolations?: HealthViolation[];
|
|
101
|
+
/**
|
|
102
|
+
* Violations only in the previous run; only for status `compared`, dropped
|
|
103
|
+
* with `summaryOnly`, capped by `maxResults`.
|
|
104
|
+
*/
|
|
78
105
|
fixedViolations?: HealthViolation[];
|
|
79
106
|
/** Rules that ran now but not in the previous run; their findings count as new. */
|
|
80
107
|
rulesAdded: string[];
|
|
108
|
+
/** Rules that ran in the previous run but not now. */
|
|
81
109
|
rulesRemoved: string[];
|
|
110
|
+
/** Scope keys that differ from the snapshot, as `key: previous -> current`. */
|
|
82
111
|
scopeDifferences: string[];
|
|
112
|
+
/** `true` when `maxResults` cut one of the lists. */
|
|
83
113
|
truncated: boolean;
|
|
114
|
+
/** Human-readable summary for LLM consumption. */
|
|
84
115
|
summary: string;
|
|
85
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* MCP tool `compare-health`: runs the scan-all scan and compares it with the
|
|
119
|
+
* previous run: which violations are new, fixed or unchanged, per rule and
|
|
120
|
+
* per file.
|
|
121
|
+
*
|
|
122
|
+
* @remarks
|
|
123
|
+
* scan-all returns a window of `maxResults` violations and sums only that
|
|
124
|
+
* window, so a comparison of two scan-all answers would compare two windows.
|
|
125
|
+
* This tool takes the complete result, stores it as a snapshot in the target
|
|
126
|
+
* project (default `.angular-modernizer-cache/health/last-run.json`, ignored
|
|
127
|
+
* like the cache) and compares the next run against it.
|
|
128
|
+
*
|
|
129
|
+
* The snapshot is replaced after every comparison unless `updateSnapshot` is
|
|
130
|
+
* false. When the stored run used another scope (rules, include or exclude
|
|
131
|
+
* patterns) or the file cannot be read, nothing is compared and the file is
|
|
132
|
+
* kept unless `updateSnapshot` is explicitly true. A cancelled scan throws
|
|
133
|
+
* instead of comparing or writing a partial snapshot.
|
|
134
|
+
*/
|
|
86
135
|
export declare class CompareHealthTool implements MCPTool {
|
|
87
136
|
private readonly scan;
|
|
88
137
|
private readonly fileSystem;
|
|
@@ -91,6 +140,10 @@ export declare class CompareHealthTool implements MCPTool {
|
|
|
91
140
|
readonly title = "Compare Health With Last Run";
|
|
92
141
|
readonly description: string;
|
|
93
142
|
readonly annotations: ToolAnnotations;
|
|
143
|
+
/**
|
|
144
|
+
* JSON Schema of the tool arguments.
|
|
145
|
+
* @hidden
|
|
146
|
+
*/
|
|
94
147
|
readonly inputSchema: {
|
|
95
148
|
type: string;
|
|
96
149
|
additionalProperties: boolean;
|
|
@@ -144,6 +197,10 @@ export declare class CompareHealthTool implements MCPTool {
|
|
|
144
197
|
};
|
|
145
198
|
required: string[];
|
|
146
199
|
};
|
|
200
|
+
/**
|
|
201
|
+
* JSON Schema of the tool result (`structuredContent`).
|
|
202
|
+
* @hidden
|
|
203
|
+
*/
|
|
147
204
|
readonly outputSchema: {
|
|
148
205
|
type: string;
|
|
149
206
|
properties: {
|
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @angular-modernizer/adapter-mcp - Compare Health Tool
|
|
3
|
-
*
|
|
4
|
-
* MCP tool that runs the scan-all scan and compares it with the previous run:
|
|
5
|
-
* which violations are new, fixed or unchanged, per rule and per file.
|
|
6
|
-
*
|
|
7
|
-
* @remarks
|
|
8
|
-
* scan-all returns a window of `maxResults` violations and sums only that
|
|
9
|
-
* window, so a comparison of two scan-all answers would compare two windows.
|
|
10
|
-
* This tool takes the complete result, stores it as a snapshot in the target
|
|
11
|
-
* project (default `.angular-modernizer-cache/health/last-run.json`, ignored
|
|
12
|
-
* like the cache) and compares the next run against it. Matching and snapshot
|
|
13
|
-
* format live in `helpers/health-delta.ts`.
|
|
14
|
-
*
|
|
15
|
-
* The snapshot is replaced after every comparison unless `updateSnapshot` is
|
|
16
|
-
* false. When the stored run used another scope (rules, include or exclude
|
|
17
|
-
* patterns) or the file cannot be read, nothing is compared and the file is
|
|
18
|
-
* kept unless `updateSnapshot` is explicitly true.
|
|
19
|
-
*/
|
|
20
1
|
import { isAbsolute, relative, resolve } from 'node:path';
|
|
21
2
|
import { RealFileSystemAdapter, } from '@angular-modernizer/core';
|
|
22
3
|
import { COMPACT_OUTPUT_SCHEMA, limitList, parseCompactOptions, } from './helpers/compact-output.js';
|
|
@@ -50,6 +31,24 @@ const COUNTS_SCHEMA = {
|
|
|
50
31
|
type: 'object',
|
|
51
32
|
additionalProperties: { type: 'integer' },
|
|
52
33
|
};
|
|
34
|
+
/**
|
|
35
|
+
* MCP tool `compare-health`: runs the scan-all scan and compares it with the
|
|
36
|
+
* previous run: which violations are new, fixed or unchanged, per rule and
|
|
37
|
+
* per file.
|
|
38
|
+
*
|
|
39
|
+
* @remarks
|
|
40
|
+
* scan-all returns a window of `maxResults` violations and sums only that
|
|
41
|
+
* window, so a comparison of two scan-all answers would compare two windows.
|
|
42
|
+
* This tool takes the complete result, stores it as a snapshot in the target
|
|
43
|
+
* project (default `.angular-modernizer-cache/health/last-run.json`, ignored
|
|
44
|
+
* like the cache) and compares the next run against it.
|
|
45
|
+
*
|
|
46
|
+
* The snapshot is replaced after every comparison unless `updateSnapshot` is
|
|
47
|
+
* false. When the stored run used another scope (rules, include or exclude
|
|
48
|
+
* patterns) or the file cannot be read, nothing is compared and the file is
|
|
49
|
+
* kept unless `updateSnapshot` is explicitly true. A cancelled scan throws
|
|
50
|
+
* instead of comparing or writing a partial snapshot.
|
|
51
|
+
*/
|
|
53
52
|
export class CompareHealthTool {
|
|
54
53
|
scan;
|
|
55
54
|
fileSystem;
|
|
@@ -70,6 +69,10 @@ export class CompareHealthTool {
|
|
|
70
69
|
idempotentHint: false,
|
|
71
70
|
openWorldHint: false,
|
|
72
71
|
};
|
|
72
|
+
/**
|
|
73
|
+
* JSON Schema of the tool arguments.
|
|
74
|
+
* @hidden
|
|
75
|
+
*/
|
|
73
76
|
inputSchema = {
|
|
74
77
|
type: 'object',
|
|
75
78
|
additionalProperties: false,
|
|
@@ -107,6 +110,10 @@ export class CompareHealthTool {
|
|
|
107
110
|
},
|
|
108
111
|
required: ['rootPath'],
|
|
109
112
|
};
|
|
113
|
+
/**
|
|
114
|
+
* JSON Schema of the tool result (`structuredContent`).
|
|
115
|
+
* @hidden
|
|
116
|
+
*/
|
|
110
117
|
outputSchema = {
|
|
111
118
|
type: 'object',
|
|
112
119
|
properties: {
|
|
@@ -1,53 +1,63 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @angular-modernizer/adapter-mcp - Extract Libraries Tool
|
|
3
|
-
*
|
|
4
|
-
* MCP tool for detecting Angular artifacts that qualify for extraction into
|
|
5
|
-
* dedicated Angular libraries with secondary entry points.
|
|
6
|
-
*
|
|
7
|
-
* Two-phase usage:
|
|
8
|
-
* 1. Detection: scan shared/common/core folders → returns LibraryExtractionOpportunity[]
|
|
9
|
-
* 2. Extraction: pass an opportunity's artifacts to transform-code with
|
|
10
|
-
* transformation: 'library-extraction' to execute the actual migration
|
|
11
|
-
*/
|
|
12
1
|
import type { MCPTool, ToolAnnotations } from '../types.js';
|
|
13
2
|
/**
|
|
14
3
|
* A single library extraction opportunity.
|
|
15
4
|
*/
|
|
16
|
-
interface ExtractionOpportunity {
|
|
5
|
+
export interface ExtractionOpportunity {
|
|
6
|
+
/** Always `architecture:library-extraction-opportunity`. */
|
|
17
7
|
ruleId: string;
|
|
8
|
+
/** Rule message. */
|
|
18
9
|
message: string;
|
|
10
|
+
/** File the opportunity was reported on. */
|
|
19
11
|
filePath: string;
|
|
12
|
+
/** Suggested library name (e.g. `ui`, `forms`, `utils`). */
|
|
20
13
|
suggestedLibraryName: string;
|
|
14
|
+
/** Artifact category. */
|
|
21
15
|
category: string;
|
|
16
|
+
/** File paths of the artifacts belonging to this library. */
|
|
22
17
|
artifacts: string[];
|
|
18
|
+
/** Suggested secondary entry point names. */
|
|
23
19
|
secondaryEntryPoints: string[];
|
|
20
|
+
/** Cohesion score of the artifact cluster (0-1). */
|
|
24
21
|
cohesionScore: number;
|
|
22
|
+
/** Reusability score (0-100). */
|
|
25
23
|
reusabilityScore: number;
|
|
24
|
+
/** Migration complexity estimate. */
|
|
26
25
|
migrationComplexity: 'low' | 'medium' | 'high';
|
|
26
|
+
/** Estimated effort. */
|
|
27
27
|
estimatedEffort: {
|
|
28
|
+
/** Effort amount in `unit`. */
|
|
28
29
|
value: number;
|
|
30
|
+
/** Unit of `value`. */
|
|
29
31
|
unit: 'minutes' | 'hours' | 'days';
|
|
30
32
|
};
|
|
33
|
+
/** External dependencies of this library. */
|
|
31
34
|
dependencies: string[];
|
|
35
|
+
/** Circular dependency blockers. */
|
|
32
36
|
circularDependencies: string[];
|
|
33
37
|
/** 'data-only': interfaces / types / enums / consts foundation. */
|
|
34
38
|
candidateKind?: 'standard' | 'data-only';
|
|
39
|
+
/** Rule-specific details. */
|
|
35
40
|
metadata?: Record<string, unknown>;
|
|
36
41
|
}
|
|
37
42
|
/**
|
|
38
43
|
* Result returned by extract-libraries.
|
|
39
44
|
*/
|
|
40
|
-
interface ExtractLibrariesResult {
|
|
45
|
+
export interface ExtractLibrariesResult {
|
|
41
46
|
/** Detected extraction opportunities. */
|
|
42
47
|
opportunities: ExtractionOpportunity[];
|
|
43
48
|
/** Counts over all opportunities, independent of the page. */
|
|
44
49
|
counts: {
|
|
50
|
+
/** Number of all opportunities. */
|
|
45
51
|
totalOpportunities: number;
|
|
52
|
+
/** Number of source files in the project. */
|
|
46
53
|
analyzedFiles: number;
|
|
54
|
+
/** Opportunities per category. */
|
|
47
55
|
byCategory: Record<string, number>;
|
|
56
|
+
/** Opportunities per migration complexity. */
|
|
48
57
|
byComplexity: Record<string, number>;
|
|
49
58
|
/** Opportunities per candidate kind ('standard' / 'data-only'). */
|
|
50
59
|
byKind: Record<string, number>;
|
|
60
|
+
/** Artifacts over all opportunities. */
|
|
51
61
|
totalArtifacts: number;
|
|
52
62
|
};
|
|
53
63
|
/** Human-readable summary for LLM consumption. */
|
|
@@ -56,27 +66,38 @@ interface ExtractLibrariesResult {
|
|
|
56
66
|
nextSteps: string[];
|
|
57
67
|
/** Analysis metadata. */
|
|
58
68
|
metadata: {
|
|
69
|
+
/** Duration of the analysis in milliseconds. */
|
|
59
70
|
duration: number;
|
|
71
|
+
/** Root path of the analyzed project. */
|
|
60
72
|
projectRoot: string;
|
|
73
|
+
/** Folders scanned for candidates. */
|
|
61
74
|
targetFolders: string[];
|
|
75
|
+
/** Minimum reusability score that was applied (0-100). */
|
|
62
76
|
minReusabilityScore: number;
|
|
77
|
+
/** Minimum cohesion score that was applied (0-1). */
|
|
63
78
|
minCohesionScore: number;
|
|
64
79
|
};
|
|
65
80
|
}
|
|
66
81
|
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* folders that qualify for extraction into dedicated Angular libraries.
|
|
82
|
+
* MCP tool `extract-libraries`: detects cohesive groups of Angular artifacts
|
|
83
|
+
* (in shared, common, core and similar folders) that qualify for extraction
|
|
84
|
+
* into dedicated Angular libraries with secondary entry points.
|
|
71
85
|
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
86
|
+
* @remarks
|
|
87
|
+
* Two-step usage:
|
|
88
|
+
* 1. Detection: this tool returns the extraction opportunities.
|
|
89
|
+
* 2. Extraction: pass an opportunity's artifacts to the `transform-code` tool
|
|
90
|
+
* with `transformation: 'library-extraction'` to run the migration.
|
|
74
91
|
*/
|
|
75
92
|
export declare class ExtractLibrariesTool implements MCPTool {
|
|
76
93
|
readonly name = "extract-libraries";
|
|
77
94
|
readonly title = "Detect Library Candidates";
|
|
78
95
|
readonly annotations: ToolAnnotations;
|
|
79
96
|
readonly description = "Detect Angular artifacts in shared folders that qualify for extraction into dedicated libraries with secondary entry points. Returns opportunities with cohesion/reusability scores and suggested library names; counts cover all of them, summary is a short text.";
|
|
97
|
+
/**
|
|
98
|
+
* JSON Schema of the tool arguments.
|
|
99
|
+
* @hidden
|
|
100
|
+
*/
|
|
80
101
|
readonly inputSchema: {
|
|
81
102
|
type: string;
|
|
82
103
|
additionalProperties: boolean;
|
|
@@ -122,6 +143,10 @@ export declare class ExtractLibrariesTool implements MCPTool {
|
|
|
122
143
|
};
|
|
123
144
|
required: string[];
|
|
124
145
|
};
|
|
146
|
+
/**
|
|
147
|
+
* JSON Schema of the tool result (`structuredContent`).
|
|
148
|
+
* @hidden
|
|
149
|
+
*/
|
|
125
150
|
readonly outputSchema: {
|
|
126
151
|
type: string;
|
|
127
152
|
properties: {
|
|
@@ -273,5 +298,4 @@ export declare class ExtractLibrariesTool implements MCPTool {
|
|
|
273
298
|
private emptyResult;
|
|
274
299
|
private buildNextSteps;
|
|
275
300
|
}
|
|
276
|
-
export {};
|
|
277
301
|
//# sourceMappingURL=extract-libraries.d.ts.map
|