@angular-modernizer/adapter-mcp 1.0.0 → 1.2.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.
Files changed (131) hide show
  1. package/README.md +81 -65
  2. package/dist/cli.js +8 -0
  3. package/dist/core/project-analyzer.d.ts +3 -12
  4. package/dist/core/project-analyzer.js +3 -12
  5. package/dist/index.d.ts +118 -3
  6. package/dist/index.js +46 -3
  7. package/dist/mcp-watcher.d.ts +28 -8
  8. package/dist/mcp-watcher.js +7 -7
  9. package/dist/scan-host/scan-host.d.ts +119 -0
  10. package/dist/scan-host/scan-host.js +376 -0
  11. package/dist/scan-host/scan-protocol.d.ts +35 -0
  12. package/dist/scan-host/scan-protocol.js +6 -0
  13. package/dist/scan-host/scan-worker.d.ts +14 -0
  14. package/dist/scan-host/scan-worker.js +48 -0
  15. package/dist/server/limited-stdio-transport.d.ts +7 -0
  16. package/dist/server/mcp-server.d.ts +11 -7
  17. package/dist/server/mcp-server.js +4 -7
  18. package/dist/server/sdk-server.d.ts +1 -0
  19. package/dist/server/tool-registry.d.ts +3 -7
  20. package/dist/server/tool-registry.js +1 -7
  21. package/dist/streaming/progress-store.d.ts +22 -5
  22. package/dist/streaming/progress-store.js +9 -5
  23. package/dist/tools/analyze-build-impact.d.ts +58 -36
  24. package/dist/tools/analyze-build-impact.js +36 -29
  25. package/dist/tools/analyze-core-to-shared.d.ts +42 -12
  26. package/dist/tools/analyze-core-to-shared.js +11 -10
  27. package/dist/tools/analyze-parser-performance.d.ts +23 -22
  28. package/dist/tools/analyze-parser-performance.js +20 -18
  29. package/dist/tools/analyze-project.d.ts +87 -14
  30. package/dist/tools/analyze-project.js +140 -122
  31. package/dist/tools/check-incremental-compatibility.d.ts +13 -11
  32. package/dist/tools/check-incremental-compatibility.js +11 -8
  33. package/dist/tools/collect-feedback.d.ts +41 -26
  34. package/dist/tools/collect-feedback.js +32 -23
  35. package/dist/tools/compare-health.d.ts +76 -19
  36. package/dist/tools/compare-health.js +26 -19
  37. package/dist/tools/extract-libraries.d.ts +44 -20
  38. package/dist/tools/extract-libraries.js +16 -17
  39. package/dist/tools/find-angular-symbol.d.ts +27 -25
  40. package/dist/tools/find-angular-symbol.js +19 -16
  41. package/dist/tools/find-component-hosts.d.ts +33 -27
  42. package/dist/tools/find-component-hosts.js +27 -24
  43. package/dist/tools/find-usages.d.ts +25 -23
  44. package/dist/tools/find-usages.js +21 -18
  45. package/dist/tools/get-bootstrap-execution.d.ts +35 -27
  46. package/dist/tools/get-bootstrap-execution.js +28 -25
  47. package/dist/tools/get-call-graph.d.ts +19 -14
  48. package/dist/tools/get-call-graph.js +26 -23
  49. package/dist/tools/get-operation-progress-tool.d.ts +12 -6
  50. package/dist/tools/get-operation-progress-tool.js +11 -6
  51. package/dist/tools/get-operation-progress.d.ts +26 -0
  52. package/dist/tools/helpers/analysis-output.d.ts +5 -0
  53. package/dist/tools/helpers/batch-kernel.d.ts +14 -0
  54. package/dist/tools/helpers/batch-kernel.js +12 -0
  55. package/dist/tools/helpers/compact-output.d.ts +2 -1
  56. package/dist/tools/helpers/compact-output.js +2 -1
  57. package/dist/tools/helpers/health-delta.d.ts +27 -14
  58. package/dist/tools/helpers/health-delta.js +11 -14
  59. package/dist/tools/helpers/project-cache.d.ts +123 -36
  60. package/dist/tools/helpers/project-cache.js +227 -43
  61. package/dist/tools/helpers/rule-runner.d.ts +23 -16
  62. package/dist/tools/helpers/rule-runner.js +24 -17
  63. package/dist/tools/helpers/scan-engine.d.ts +107 -0
  64. package/dist/tools/helpers/scan-engine.js +197 -0
  65. package/dist/tools/helpers/scan-plan.d.ts +1 -1
  66. package/dist/tools/helpers/scan-plan.js +1 -1
  67. package/dist/tools/helpers/suggestion-generator.d.ts +9 -13
  68. package/dist/tools/helpers/suggestion-generator.js +0 -12
  69. package/dist/tools/helpers/tool-cache.d.ts +11 -0
  70. package/dist/tools/helpers/tool-cache.js +15 -0
  71. package/dist/tools/helpers/tool-context.d.ts +11 -8
  72. package/dist/tools/helpers/tool-context.js +5 -8
  73. package/dist/tools/inspect-form-group.d.ts +34 -27
  74. package/dist/tools/inspect-form-group.js +27 -24
  75. package/dist/tools/inspect-i18n.d.ts +31 -25
  76. package/dist/tools/inspect-i18n.js +23 -20
  77. package/dist/tools/inspect-template.d.ts +32 -25
  78. package/dist/tools/inspect-template.js +26 -23
  79. package/dist/tools/learn-patterns.d.ts +88 -12
  80. package/dist/tools/learn-patterns.js +17 -11
  81. package/dist/tools/list-imports.d.ts +45 -28
  82. package/dist/tools/list-imports.js +26 -23
  83. package/dist/tools/orchestrate-migration.d.ts +31 -9
  84. package/dist/tools/orchestrate-migration.js +12 -7
  85. package/dist/tools/parse-stack-trace.d.ts +23 -21
  86. package/dist/tools/parse-stack-trace.js +10 -7
  87. package/dist/tools/plan-migration.d.ts +67 -27
  88. package/dist/tools/plan-migration.js +22 -21
  89. package/dist/tools/resolve-type.d.ts +20 -10
  90. package/dist/tools/resolve-type.js +21 -13
  91. package/dist/tools/review-feedback.d.ts +27 -24
  92. package/dist/tools/review-feedback.js +24 -20
  93. package/dist/tools/rollback-changes.d.ts +13 -9
  94. package/dist/tools/rollback-changes.js +10 -7
  95. package/dist/tools/run-angular-cli.d.ts +12 -10
  96. package/dist/tools/run-angular-cli.js +11 -8
  97. package/dist/tools/run-build.d.ts +13 -11
  98. package/dist/tools/run-build.js +11 -8
  99. package/dist/tools/run-schematic.d.ts +12 -10
  100. package/dist/tools/run-schematic.js +11 -8
  101. package/dist/tools/scan-all.d.ts +69 -12
  102. package/dist/tools/scan-all.js +55 -122
  103. package/dist/tools/scan-angular.d.ts +41 -9
  104. package/dist/tools/scan-angular.js +66 -135
  105. package/dist/tools/scan-architecture.d.ts +75 -14
  106. package/dist/tools/scan-architecture.js +180 -185
  107. package/dist/tools/scan-solid.d.ts +40 -9
  108. package/dist/tools/scan-solid.js +64 -133
  109. package/dist/tools/search-codebase.d.ts +32 -26
  110. package/dist/tools/search-codebase.js +15 -12
  111. package/dist/tools/server-status.d.ts +116 -24
  112. package/dist/tools/server-status.js +85 -26
  113. package/dist/tools/suggest-improvements.d.ts +22 -19
  114. package/dist/tools/suggest-improvements.js +21 -17
  115. package/dist/tools/trace-output-flow.d.ts +34 -27
  116. package/dist/tools/trace-output-flow.js +27 -24
  117. package/dist/tools/transform-code.d.ts +71 -10
  118. package/dist/tools/transform-code.js +148 -54
  119. package/dist/tools/validate-before-transform.d.ts +24 -9
  120. package/dist/tools/validate-before-transform.js +10 -7
  121. package/dist/tools/validate-project-compatibility.d.ts +18 -13
  122. package/dist/tools/validate-project-compatibility.js +17 -11
  123. package/dist/tools/validate-transformation.d.ts +28 -11
  124. package/dist/tools/validate-transformation.js +14 -8
  125. package/dist/tools/verify-citations.d.ts +37 -16
  126. package/dist/tools/verify-citations.js +19 -16
  127. package/dist/types.d.ts +40 -10
  128. package/dist/types.js +0 -5
  129. package/package.json +12 -18
  130. package/dist/tools/shared/scan-types.d.ts +0 -200
  131. package/dist/tools/shared/scan-types.js +0 -7
@@ -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
- * Collect transformation feedback for AI learning
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
- * Extract Libraries Tool
68
- *
69
- * Scans Angular codebases for cohesive artifact groups in shared/common/core
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
- * After detecting opportunities, use the `transform-code` tool with
73
- * `transformation: 'library-extraction'` to execute the actual migration.
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
@@ -1,14 +1,3 @@
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 { findTsConfig } from './helpers/find-ts-config.js';
13
2
  import { Kernel, loadConfig } from '@angular-modernizer/core';
14
3
  import { LibraryExtractionAnalysisRule } from '@angular-modernizer/plugin-architecture';
@@ -78,13 +67,15 @@ function describeOpportunities(counts, page, offset) {
78
67
  return lines.join('\n');
79
68
  }
80
69
  /**
81
- * Extract Libraries Tool
82
- *
83
- * Scans Angular codebases for cohesive artifact groups in shared/common/core
84
- * folders that qualify for extraction into dedicated Angular libraries.
70
+ * MCP tool `extract-libraries`: detects cohesive groups of Angular artifacts
71
+ * (in shared, common, core and similar folders) that qualify for extraction
72
+ * into dedicated Angular libraries with secondary entry points.
85
73
  *
86
- * After detecting opportunities, use the `transform-code` tool with
87
- * `transformation: 'library-extraction'` to execute the actual migration.
74
+ * @remarks
75
+ * Two-step usage:
76
+ * 1. Detection: this tool returns the extraction opportunities.
77
+ * 2. Extraction: pass an opportunity's artifacts to the `transform-code` tool
78
+ * with `transformation: 'library-extraction'` to run the migration.
88
79
  */
89
80
  export class ExtractLibrariesTool {
90
81
  name = 'extract-libraries';
@@ -96,6 +87,10 @@ export class ExtractLibrariesTool {
96
87
  openWorldHint: false,
97
88
  };
98
89
  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.';
90
+ /**
91
+ * JSON Schema of the tool arguments.
92
+ * @hidden
93
+ */
99
94
  inputSchema = {
100
95
  type: 'object',
101
96
  additionalProperties: false,
@@ -137,6 +132,10 @@ export class ExtractLibrariesTool {
137
132
  },
138
133
  required: ['rootPath'],
139
134
  };
135
+ /**
136
+ * JSON Schema of the tool result (`structuredContent`).
137
+ * @hidden
138
+ */
140
139
  outputSchema = {
141
140
  type: 'object',
142
141
  properties: {
@@ -1,28 +1,8 @@
1
- /**
2
- * @angular-modernizer/adapter-mcp - Find Angular Symbol Tool
3
- *
4
- * MCP tool for locating Angular symbols (components, directives, pipes,
5
- * services, guards, interceptors, resolvers, modules, tokens) in a project.
6
- * Accepts selectors, pipe names, class names, or partial selector substrings.
7
- *
8
- * @remarks
9
- * Supports both standard Angular decorators (@Component, @Directive, @Pipe,
10
- * @Injectable, @NgModule) and the project's own component decorators
11
- * (`parser.componentDecorators` in `.angular-modernizer.json`).
12
- *
13
- * @example
14
- * ```typescript
15
- * // Via MCP:
16
- * // tool: find-angular-symbol
17
- * // args: { query: 'app-user', projectRoot: '/project' }
18
- * // args: { query: 'UserService', type: 'service', projectRoot: '/project' }
19
- * ```
20
- */
21
- import { type MCPTool, type ToolAnnotations } from '../types.js';
1
+ import { type MCPTool, type ToolAnnotations, type ToolContext } from '../types.js';
22
2
  import { type AngularSymbolResult, type AngularSymbolType } from '@angular-modernizer/api';
23
3
  import { ProjectCache } from './helpers/project-cache.js';
24
4
  /** Output of the find-angular-symbol tool. */
25
- interface FindAngularSymbolOutput {
5
+ export interface FindAngularSymbolOutput {
26
6
  /** Matching symbols, cut to `maxResults`; omitted with `summaryOnly`. */
27
7
  results?: AngularSymbolResult[];
28
8
  /** Total number of matches (before `maxResults`). */
@@ -37,7 +17,22 @@ interface FindAngularSymbolOutput {
37
17
  warnings?: string[];
38
18
  }
39
19
  /**
40
- * MCP tool that finds Angular symbols by selector, pipe name, or class name.
20
+ * MCP tool for locating Angular symbols (components, directives, pipes,
21
+ * services, guards, interceptors, resolvers, modules, tokens) in a project.
22
+ * Accepts selectors, pipe names, class names, or partial selector substrings.
23
+ *
24
+ * @remarks
25
+ * Supports both standard Angular decorators (@Component, @Directive, @Pipe,
26
+ * @Injectable, @NgModule) and the project's own component decorators
27
+ * (`parser.componentDecorators` in `.angular-modernizer.json`).
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * // Via MCP:
32
+ * // tool: find-angular-symbol
33
+ * // args: { query: 'app-user', projectRoot: '/project' }
34
+ * // args: { query: 'UserService', type: 'service', projectRoot: '/project' }
35
+ * ```
41
36
  */
42
37
  export declare class FindAngularSymbolTool implements MCPTool {
43
38
  private readonly projects;
@@ -46,6 +41,10 @@ export declare class FindAngularSymbolTool implements MCPTool {
46
41
  readonly annotations: ToolAnnotations;
47
42
  constructor(projects?: ProjectCache);
48
43
  readonly description: string;
44
+ /**
45
+ * JSON Schema of the tool arguments.
46
+ * @hidden
47
+ */
49
48
  readonly inputSchema: {
50
49
  type: string;
51
50
  additionalProperties: boolean;
@@ -75,6 +74,10 @@ export declare class FindAngularSymbolTool implements MCPTool {
75
74
  };
76
75
  required: string[];
77
76
  };
77
+ /**
78
+ * JSON Schema of the tool result (`structuredContent`).
79
+ * @hidden
80
+ */
78
81
  readonly outputSchema: {
79
82
  type: string;
80
83
  properties: {
@@ -136,9 +139,8 @@ export declare class FindAngularSymbolTool implements MCPTool {
136
139
  };
137
140
  required: string[];
138
141
  };
139
- execute(args: Record<string, unknown>): Promise<FindAngularSymbolOutput>;
142
+ execute(args: Record<string, unknown>, ctx?: ToolContext): Promise<FindAngularSymbolOutput>;
140
143
  private buildCompactSummary;
141
144
  private buildSummary;
142
145
  }
143
- export {};
144
146
  //# sourceMappingURL=find-angular-symbol.d.ts.map