@angular-modernizer/adapter-mcp 1.2.0 → 2.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.
Files changed (130) hide show
  1. package/CHANGELOG.md +662 -0
  2. package/README.md +84 -445
  3. package/dist/cli.js +9 -1
  4. package/dist/core/project-analyzer.js +2 -2
  5. package/dist/index.d.ts +9 -0
  6. package/dist/index.js +1 -0
  7. package/dist/scan-host/scan-host.d.ts +7 -0
  8. package/dist/scan-host/scan-host.js +73 -10
  9. package/dist/scan-host/scan-protocol.d.ts +2 -0
  10. package/dist/scan-host/scan-worker.js +14 -8
  11. package/dist/server/limited-stdio-transport.d.ts +6 -3
  12. package/dist/server/limited-stdio-transport.js +26 -9
  13. package/dist/server/mcp-server.js +1 -1
  14. package/dist/server/sdk-server.d.ts +14 -3
  15. package/dist/server/sdk-server.js +54 -6
  16. package/dist/server/tool-registry.d.ts +3 -1
  17. package/dist/server/tool-registry.js +8 -3
  18. package/dist/streaming/progress-store.d.ts +19 -7
  19. package/dist/streaming/progress-store.js +19 -8
  20. package/dist/tools/analyze-build-impact.d.ts +7 -4
  21. package/dist/tools/analyze-build-impact.js +8 -3
  22. package/dist/tools/analyze-core-to-shared.d.ts +10 -6
  23. package/dist/tools/analyze-core-to-shared.js +63 -60
  24. package/dist/tools/analyze-parser-performance.d.ts +57 -13
  25. package/dist/tools/analyze-parser-performance.js +67 -6
  26. package/dist/tools/analyze-project.d.ts +30 -4
  27. package/dist/tools/analyze-project.js +99 -15
  28. package/dist/tools/check-incremental-compatibility.d.ts +30 -41
  29. package/dist/tools/check-incremental-compatibility.js +32 -264
  30. package/dist/tools/collect-feedback.js +15 -2
  31. package/dist/tools/extract-libraries.js +42 -27
  32. package/dist/tools/find-angular-symbol.js +3 -2
  33. package/dist/tools/find-component-hosts.js +3 -2
  34. package/dist/tools/find-usages.js +21 -12
  35. package/dist/tools/get-call-graph.js +15 -2
  36. package/dist/tools/get-operation-progress-tool.d.ts +1 -1
  37. package/dist/tools/get-operation-progress-tool.js +2 -2
  38. package/dist/tools/get-operation-progress.d.ts +4 -1
  39. package/dist/tools/get-operation-progress.js +6 -2
  40. package/dist/tools/helpers/analysis-output.d.ts +32 -1
  41. package/dist/tools/helpers/analysis-output.js +22 -1
  42. package/dist/tools/helpers/build-cache.d.ts +27 -0
  43. package/dist/tools/helpers/build-cache.js +86 -0
  44. package/dist/tools/helpers/class-filter.d.ts +18 -0
  45. package/dist/tools/helpers/class-filter.js +30 -0
  46. package/dist/tools/helpers/cli-arguments.d.ts +23 -0
  47. package/dist/tools/helpers/cli-arguments.js +35 -0
  48. package/dist/tools/helpers/feedback-catalog.d.ts +38 -0
  49. package/dist/tools/helpers/feedback-catalog.js +196 -0
  50. package/dist/tools/helpers/feedback-sidecar.d.ts +201 -0
  51. package/dist/tools/helpers/feedback-sidecar.js +381 -0
  52. package/dist/tools/helpers/file-type-check.d.ts +34 -0
  53. package/dist/tools/helpers/file-type-check.js +56 -0
  54. package/dist/tools/helpers/output-contract.d.ts +42 -0
  55. package/dist/tools/helpers/output-contract.js +54 -0
  56. package/dist/tools/helpers/pattern-anonymizer.d.ts +27 -0
  57. package/dist/tools/helpers/pattern-anonymizer.js +159 -0
  58. package/dist/tools/helpers/project-cache.d.ts +5 -4
  59. package/dist/tools/helpers/project-cache.js +21 -16
  60. package/dist/tools/helpers/project-decorators.d.ts +11 -4
  61. package/dist/tools/helpers/project-decorators.js +13 -6
  62. package/dist/tools/helpers/refresh-apply.d.ts +94 -0
  63. package/dist/tools/helpers/refresh-apply.js +460 -0
  64. package/dist/tools/helpers/refresh-inventory.d.ts +106 -0
  65. package/dist/tools/helpers/refresh-inventory.js +610 -0
  66. package/dist/tools/helpers/rule-runner.js +3 -1
  67. package/dist/tools/helpers/scan-cache.d.ts +74 -5
  68. package/dist/tools/helpers/scan-cache.js +134 -6
  69. package/dist/tools/helpers/scan-engine.d.ts +30 -6
  70. package/dist/tools/helpers/scan-engine.js +131 -22
  71. package/dist/tools/helpers/scan-plan.js +16 -2
  72. package/dist/tools/helpers/source-map-loader.d.ts +55 -0
  73. package/dist/tools/helpers/source-map-loader.js +226 -0
  74. package/dist/tools/helpers/template-check.d.ts +76 -0
  75. package/dist/tools/helpers/template-check.js +158 -0
  76. package/dist/tools/helpers/tool-cache.d.ts +7 -2
  77. package/dist/tools/helpers/tool-cache.js +9 -3
  78. package/dist/tools/helpers/tool-context.d.ts +18 -0
  79. package/dist/tools/helpers/tool-context.js +29 -0
  80. package/dist/tools/helpers/transform-safety.d.ts +151 -1
  81. package/dist/tools/helpers/transform-safety.js +357 -4
  82. package/dist/tools/inspect-form-group.js +5 -0
  83. package/dist/tools/inspect-i18n.d.ts +1 -1
  84. package/dist/tools/inspect-template.js +8 -2
  85. package/dist/tools/learn-patterns.d.ts +43 -28
  86. package/dist/tools/learn-patterns.js +83 -161
  87. package/dist/tools/list-imports.d.ts +1 -1
  88. package/dist/tools/orchestrate-migration.d.ts +19 -1
  89. package/dist/tools/orchestrate-migration.js +52 -10
  90. package/dist/tools/parse-stack-trace.d.ts +48 -1
  91. package/dist/tools/parse-stack-trace.js +108 -9
  92. package/dist/tools/plan-migration.js +22 -10
  93. package/dist/tools/refresh-state.d.ts +378 -0
  94. package/dist/tools/refresh-state.js +370 -0
  95. package/dist/tools/resolve-type.js +10 -3
  96. package/dist/tools/review-feedback.d.ts +42 -7
  97. package/dist/tools/review-feedback.js +24 -17
  98. package/dist/tools/rollback-changes.d.ts +5 -0
  99. package/dist/tools/rollback-changes.js +7 -2
  100. package/dist/tools/run-angular-cli.js +36 -22
  101. package/dist/tools/run-build.d.ts +33 -28
  102. package/dist/tools/run-build.js +136 -438
  103. package/dist/tools/run-schematic.d.ts +8 -2
  104. package/dist/tools/run-schematic.js +80 -50
  105. package/dist/tools/scan-all.d.ts +31 -15
  106. package/dist/tools/scan-all.js +75 -109
  107. package/dist/tools/scan-angular.d.ts +27 -14
  108. package/dist/tools/scan-angular.js +70 -92
  109. package/dist/tools/scan-architecture.d.ts +29 -12
  110. package/dist/tools/scan-architecture.js +205 -135
  111. package/dist/tools/scan-solid.d.ts +27 -14
  112. package/dist/tools/scan-solid.js +73 -89
  113. package/dist/tools/search-codebase.d.ts +6 -1
  114. package/dist/tools/search-codebase.js +13 -7
  115. package/dist/tools/suggest-improvements.d.ts +34 -3
  116. package/dist/tools/suggest-improvements.js +34 -9
  117. package/dist/tools/trace-output-flow.js +3 -2
  118. package/dist/tools/transform-code-batch.d.ts +9 -9
  119. package/dist/tools/transform-code.d.ts +161 -12
  120. package/dist/tools/transform-code.js +715 -206
  121. package/dist/tools/validate-before-transform.js +2 -1
  122. package/dist/tools/validate-project-compatibility.d.ts +28 -55
  123. package/dist/tools/validate-project-compatibility.js +33 -225
  124. package/dist/tools/validate-transformation.d.ts +40 -26
  125. package/dist/tools/validate-transformation.js +115 -294
  126. package/dist/tools/verify-citations.js +8 -2
  127. package/dist/types.d.ts +9 -9
  128. package/dist/utils/format-tool-response.d.ts +3 -1
  129. package/dist/utils/format-tool-response.js +8 -3
  130. package/package.json +14 -13
@@ -1,5 +1,6 @@
1
1
  import { CallGraphBuilder, } from '@angular-modernizer/api';
2
2
  import { existsSync } from 'node:fs';
3
+ import { isAbsolute, resolve } from 'node:path';
3
4
  import { findTsConfig } from './helpers/find-ts-config.js';
4
5
  import { ProjectCache, acquireProject } from './helpers/project-cache.js';
5
6
  import { WARNINGS_OUTPUT_SCHEMA, withWarnings, } from './helpers/output-contract.js';
@@ -64,6 +65,9 @@ export class GetCallGraphTool {
64
65
  'Callers of component members include calls from the component template as leaf nodes ' +
65
66
  '(kind "template", template file and line, snippet), also from templates of subclasses that inherit the member ' +
66
67
  '(className of the subclass, inheritedFrom of the declaring class; a subclass overriding it is left out). ' +
68
+ 'Calls at the top level of a file, also inside anonymous callbacks there (describe/it blocks), are leaf callers ' +
69
+ 'with name "<module>" and kind "module" (file, line and snippet of the call); calls in anonymous callbacks ' +
70
+ 'inside a method or function count for that method or function. ' +
67
71
  'Use method "ClassName.constructor" to see what runs transitively during construction. ' +
68
72
  'Use after parse-stack-trace to trace error propagation through the call hierarchy.';
69
73
  /**
@@ -81,7 +85,7 @@ export class GetCallGraphTool {
81
85
  },
82
86
  file: {
83
87
  type: 'string',
84
- description: 'Absolute path of the source file containing the method.',
88
+ description: 'Source file containing the method (absolute path, or relative to projectRoot).',
85
89
  },
86
90
  projectRoot: {
87
91
  type: 'string',
@@ -164,6 +168,12 @@ export class GetCallGraphTool {
164
168
  if (!existsSync(params.projectRoot)) {
165
169
  throw new Error(`projectRoot does not exist: ${params.projectRoot}`);
166
170
  }
171
+ const filePath = isAbsolute(params.file)
172
+ ? params.file
173
+ : resolve(params.projectRoot, params.file);
174
+ if (!existsSync(filePath)) {
175
+ throw new Error(`file does not exist: ${filePath}`);
176
+ }
167
177
  const tsConfigPath = findTsConfig(params.projectRoot);
168
178
  if (!tsConfigPath) {
169
179
  throw new Error(`tsconfig.json not found in projectRoot: ${params.projectRoot}`);
@@ -180,7 +190,7 @@ export class GetCallGraphTool {
180
190
  maxNodes: params.maxNodes ?? 200,
181
191
  includeLifecycleHooks: params.includeLifecycleHooks ?? false,
182
192
  };
183
- const result = graphBuilder.buildCallGraph(params.method, params.file, options);
193
+ const result = graphBuilder.buildCallGraph(params.method, filePath, options);
184
194
  const summary = this.buildSummary(params.method, result);
185
195
  if (params.summaryOnly) {
186
196
  const { callers: _callers, callees: _callees, ...rest } = result;
@@ -233,6 +243,9 @@ export class GetCallGraphTool {
233
243
  return lines;
234
244
  }
235
245
  label(node) {
246
+ if (node.kind === 'module') {
247
+ return `module level: ${node.snippet ?? ''}`;
248
+ }
236
249
  if (node.kind === 'template') {
237
250
  const inherited = node.inheritedFrom === undefined ? '' : ` (inherits ${node.inheritedFrom})`;
238
251
  return `template of ${node.className ?? 'component'}${inherited}: ${node.snippet ?? ''}`;
@@ -3,7 +3,7 @@ import { getOperationProgress } from './get-operation-progress.js';
3
3
  type OperationProgress = Awaited<ReturnType<typeof getOperationProgress>>;
4
4
  /**
5
5
  * MCP tool for querying the progress of streaming operations (deprecated, kept
6
- * in 1.x): polls an operation started with `streaming: true` by transform-code
6
+ * in 2.x): polls an operation started with `streaming: true` by transform-code
7
7
  * or scan-architecture.
8
8
  */
9
9
  export declare class GetOperationProgressTool implements MCPTool {
@@ -30,7 +30,7 @@ function describeProgress(progress) {
30
30
  }
31
31
  /**
32
32
  * MCP tool for querying the progress of streaming operations (deprecated, kept
33
- * in 1.x): polls an operation started with `streaming: true` by transform-code
33
+ * in 2.x): polls an operation started with `streaming: true` by transform-code
34
34
  * or scan-architecture.
35
35
  */
36
36
  export class GetOperationProgressTool {
@@ -42,7 +42,7 @@ export class GetOperationProgressTool {
42
42
  idempotentHint: true,
43
43
  openWorldHint: false,
44
44
  };
45
- description = 'Deprecated, kept in 1.x: polls an operation started with streaming: true (transform-code, scan-architecture). ' +
45
+ description = 'Deprecated, kept in 2.x: polls an operation started with streaming: true (transform-code, scan-architecture). ' +
46
46
  'Call those tools synchronously instead: they send MCP progress notifications when the request has a progressToken ' +
47
47
  'and stop on notifications/cancelled. ' +
48
48
  'Get progress for a streaming operation (transformation or analysis). ' +
@@ -65,7 +65,10 @@ export declare function getOperationProgress(input: GetOperationProgressInput):
65
65
  }[];
66
66
  /** Number of all events of the operation, regardless of `sinceTimestamp`. */
67
67
  totalEvents: number;
68
- /** Milliseconds since the operation started. */
68
+ /**
69
+ * Milliseconds from the start to now for a running operation, to the moment
70
+ * it completed, failed, timed out or was cancelled for a finished one.
71
+ */
69
72
  elapsedTime: number;
70
73
  /** Estimated milliseconds until completion; only for running operations with progress. */
71
74
  eta?: number;
@@ -36,8 +36,12 @@ export async function getOperationProgress(input) {
36
36
  // Get metadata
37
37
  const metadata = store.getMetadata(operationId);
38
38
  const events = store.getEvents(operationId, sinceTimestamp);
39
- // Calculate elapsed time
40
- const elapsedTime = Date.now() - metadata.startTime;
39
+ // A finished operation's clock stops when it completed, failed, timed out
40
+ // or was cancelled; only a running operation counts up to now.
41
+ const endTime = metadata.status === 'running'
42
+ ? Date.now()
43
+ : (metadata.completedAt ?? Date.now());
44
+ const elapsedTime = endTime - metadata.startTime;
41
45
  // Estimate ETA based on progress (only for running operations)
42
46
  let eta;
43
47
  if (metadata.status === 'running' && events.length > 0) {
@@ -135,7 +135,8 @@ export declare const SCAN_VIOLATION_SCHEMA: {
135
135
  readonly required: readonly ["ruleId", "severity", "message", "filePath"];
136
136
  };
137
137
  /**
138
- * Run details of a scan that stopped early (time budget or cancellation);
138
+ * Run details of a scan that stopped early (time budget or cancellation) or,
139
+ * in scan-architecture, left files out at its `maxFiles` cap;
139
140
  * scan-architecture always reports them.
140
141
  */
141
142
  export declare const SCAN_EXECUTION_SCHEMA: {
@@ -153,6 +154,9 @@ export declare const SCAN_EXECUTION_SCHEMA: {
153
154
  readonly skippedFiles: {
154
155
  readonly type: "integer";
155
156
  };
157
+ readonly scopeFiles: {
158
+ readonly type: "integer";
159
+ };
156
160
  readonly ruleTimings: {
157
161
  readonly type: "array";
158
162
  readonly items: {
@@ -165,6 +169,33 @@ export declare const SCAN_EXECUTION_SCHEMA: {
165
169
  };
166
170
  readonly required: readonly ["incomplete", "skippedFiles"];
167
171
  };
172
+ /**
173
+ * Notice for an `orchestration` argument of scan-all, scan-solid or
174
+ * scan-angular. They always run in the scan worker; the argument used to be
175
+ * ignored while the result claimed a parallel run.
176
+ */
177
+ export declare const SCAN_ORCHESTRATION_NOTICE = "orchestration is deprecated and has no effect: the scan always runs in the scan worker. Leave it unset.";
178
+ /**
179
+ * Input schema of the deprecated `orchestration` argument of scan-all,
180
+ * scan-solid and scan-angular, kept so 1.x callers are not rejected.
181
+ */
182
+ export declare const DEPRECATED_SCAN_ORCHESTRATION_SCHEMA: {
183
+ readonly type: "object";
184
+ readonly description: "Deprecated, no effect, kept in 2.x: the scan always runs in the scan worker and answers with a notice in warnings. Leave unset.";
185
+ readonly deprecated: true;
186
+ readonly properties: {
187
+ readonly parallel: {
188
+ readonly type: "boolean";
189
+ readonly description: "Deprecated, no effect.";
190
+ readonly deprecated: true;
191
+ };
192
+ readonly maxWorkers: {
193
+ readonly type: "number";
194
+ readonly description: "Deprecated, no effect.";
195
+ readonly deprecated: true;
196
+ };
197
+ };
198
+ };
168
199
  /**
169
200
  * Output schema of a scan: violations, counts, metadata and summary, plus
170
201
  * the tool's own fields. Only `counts`, `metadata` and `summary` are required.
@@ -79,7 +79,8 @@ export const SCAN_VIOLATION_SCHEMA = {
79
79
  required: ['ruleId', 'severity', 'message', 'filePath'],
80
80
  };
81
81
  /**
82
- * Run details of a scan that stopped early (time budget or cancellation);
82
+ * Run details of a scan that stopped early (time budget or cancellation) or,
83
+ * in scan-architecture, left files out at its `maxFiles` cap;
83
84
  * scan-architecture always reports them.
84
85
  */
85
86
  export const SCAN_EXECUTION_SCHEMA = {
@@ -89,11 +90,31 @@ export const SCAN_EXECUTION_SCHEMA = {
89
90
  incomplete: { type: 'boolean' },
90
91
  stopReason: { type: 'string' },
91
92
  skippedFiles: { type: 'integer' },
93
+ scopeFiles: { type: 'integer' },
92
94
  ruleTimings: { type: 'array', items: { type: 'object' } },
93
95
  note: { type: 'string' },
94
96
  },
95
97
  required: ['incomplete', 'skippedFiles'],
96
98
  };
99
+ /**
100
+ * Notice for an `orchestration` argument of scan-all, scan-solid or
101
+ * scan-angular. They always run in the scan worker; the argument used to be
102
+ * ignored while the result claimed a parallel run.
103
+ */
104
+ export const SCAN_ORCHESTRATION_NOTICE = 'orchestration is deprecated and has no effect: the scan always runs in the scan worker. Leave it unset.';
105
+ /**
106
+ * Input schema of the deprecated `orchestration` argument of scan-all,
107
+ * scan-solid and scan-angular, kept so 1.x callers are not rejected.
108
+ */
109
+ export const DEPRECATED_SCAN_ORCHESTRATION_SCHEMA = {
110
+ type: 'object',
111
+ description: 'Deprecated, no effect, kept in 2.x: the scan always runs in the scan worker and answers with a notice in warnings. Leave unset.',
112
+ deprecated: true,
113
+ properties: {
114
+ parallel: { type: 'boolean', description: 'Deprecated, no effect.', deprecated: true },
115
+ maxWorkers: { type: 'number', description: 'Deprecated, no effect.', deprecated: true },
116
+ },
117
+ };
97
118
  /**
98
119
  * Output schema of a scan: violations, counts, metadata and summary, plus
99
120
  * the tool's own fields. Only `counts`, `metadata` and `summary` are required.
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @angular-modernizer/adapter-mcp - Build cache clearing (`cacheStrategy: 'clear'`)
3
+ *
4
+ * run-build and validate-transformation remove the build caches of the project
5
+ * before an incremental build. Each cache is resolved through symlinks first and
6
+ * removed only when it lies inside the project root and not under `node_modules`:
7
+ * a linked or shared `node_modules` (pnpm, monorepos, project copies) leads out
8
+ * of the project, and `rm -rf` used to delete there.
9
+ */
10
+ /** Outcome of {@link clearBuildCaches}. */
11
+ export interface CacheClearResult {
12
+ /** Caches removed, relative to the project root. */
13
+ cleared: string[];
14
+ /** Caches left in place, with the reason. */
15
+ warnings: string[];
16
+ }
17
+ /**
18
+ * Remove the Angular CLI cache and, in an Nx workspace, the Nx cache of a project.
19
+ *
20
+ * Missing caches are skipped silently; a cache that resolves outside the project
21
+ * root or under `node_modules`, or that cannot be removed, is left in place and
22
+ * reported in `warnings`.
23
+ *
24
+ * @param projectRoot - Root folder of the project
25
+ */
26
+ export declare function clearBuildCaches(projectRoot: string): CacheClearResult;
27
+ //# sourceMappingURL=build-cache.d.ts.map
@@ -0,0 +1,86 @@
1
+ /**
2
+ * @angular-modernizer/adapter-mcp - Build cache clearing (`cacheStrategy: 'clear'`)
3
+ *
4
+ * run-build and validate-transformation remove the build caches of the project
5
+ * before an incremental build. Each cache is resolved through symlinks first and
6
+ * removed only when it lies inside the project root and not under `node_modules`:
7
+ * a linked or shared `node_modules` (pnpm, monorepos, project copies) leads out
8
+ * of the project, and `rm -rf` used to delete there.
9
+ */
10
+ import { existsSync, realpathSync, rmSync } from 'node:fs';
11
+ import { isAbsolute, join, relative, sep } from 'node:path';
12
+ /** Angular CLI build cache, relative to the project root. */
13
+ const ANGULAR_CACHE = '.angular/cache';
14
+ /** Nx cache of Nx 17 and later, relative to the project root. */
15
+ const NX_CACHE = '.nx/cache';
16
+ /** Nx cache of older Nx versions; under node_modules, so it is never removed. */
17
+ const LEGACY_NX_CACHE = 'node_modules/.cache/nx';
18
+ /**
19
+ * Remove the Angular CLI cache and, in an Nx workspace, the Nx cache of a project.
20
+ *
21
+ * Missing caches are skipped silently; a cache that resolves outside the project
22
+ * root or under `node_modules`, or that cannot be removed, is left in place and
23
+ * reported in `warnings`.
24
+ *
25
+ * @param projectRoot - Root folder of the project
26
+ */
27
+ export function clearBuildCaches(projectRoot) {
28
+ const result = { cleared: [], warnings: [] };
29
+ let root;
30
+ try {
31
+ root = realpathSync(projectRoot);
32
+ }
33
+ catch (error) {
34
+ result.warnings.push(`Build caches not cleared: ${errorMessage(error)}`);
35
+ return result;
36
+ }
37
+ const isNx = existsSync(join(root, 'nx.json'));
38
+ const targets = isNx ? [ANGULAR_CACHE, NX_CACHE] : [ANGULAR_CACHE];
39
+ for (const target of targets) {
40
+ clearCache(root, target, result);
41
+ }
42
+ if (isNx && existsSync(join(root, LEGACY_NX_CACHE))) {
43
+ result.warnings.push(`${LEGACY_NX_CACHE} left in place: caches under node_modules are never removed; run \`nx reset\` to clear it`);
44
+ }
45
+ return result;
46
+ }
47
+ function clearCache(root, target, result) {
48
+ let resolved;
49
+ try {
50
+ resolved = realpathSync(join(root, target));
51
+ }
52
+ catch (error) {
53
+ if (isMissing(error)) {
54
+ return;
55
+ }
56
+ result.warnings.push(`${target} not cleared: ${errorMessage(error)}`);
57
+ return;
58
+ }
59
+ if (!isInsideProject(root, resolved)) {
60
+ result.warnings.push(`${target} not cleared: it resolves to ${resolved}, outside the project root or under node_modules`);
61
+ return;
62
+ }
63
+ try {
64
+ rmSync(resolved, { recursive: true, force: true });
65
+ result.cleared.push(target);
66
+ }
67
+ catch (error) {
68
+ result.warnings.push(`${target} could not be removed: ${errorMessage(error)}`);
69
+ }
70
+ }
71
+ function isInsideProject(root, resolved) {
72
+ const path = relative(root, resolved);
73
+ const outside = path === '' || path === '..' || path.startsWith(`..${sep}`) || isAbsolute(path);
74
+ return !outside && !path.split(sep).includes('node_modules');
75
+ }
76
+ // Structural checks: fs errors from another realm (Jest's vm) fail `instanceof Error`
77
+ function isMissing(error) {
78
+ return typeof error === 'object' && error !== null && 'code' in error && error.code === 'ENOENT';
79
+ }
80
+ function errorMessage(error) {
81
+ if (typeof error === 'object' && error !== null && 'message' in error) {
82
+ return String(error.message);
83
+ }
84
+ return String(error);
85
+ }
86
+ //# sourceMappingURL=build-cache.js.map
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @angular-modernizer/adapter-mcp - Class filter
3
+ *
4
+ * Explains an empty result of a tool that takes `className` for a file
5
+ * (inspect-template, inspect-form-group) when no class of the file has that
6
+ * name, instead of the generic "nothing found" message.
7
+ */
8
+ import { type SourceFile } from 'ts-morph';
9
+ /**
10
+ * Message for a `className` that matches no class of `sourceFile`.
11
+ *
12
+ * @param sourceFile - The inspected file; `undefined` (an `.html` file) never matches.
13
+ * @param className - The requested class, if any.
14
+ * @param filePath - Path shown in the message.
15
+ * @returns The message, or `undefined` when no class was requested or the file declares it.
16
+ */
17
+ export declare function missingClassMessage(sourceFile: SourceFile | undefined, className: string | undefined, filePath: string): string | undefined;
18
+ //# sourceMappingURL=class-filter.d.ts.map
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @angular-modernizer/adapter-mcp - Class filter
3
+ *
4
+ * Explains an empty result of a tool that takes `className` for a file
5
+ * (inspect-template, inspect-form-group) when no class of the file has that
6
+ * name, instead of the generic "nothing found" message.
7
+ */
8
+ /**
9
+ * Message for a `className` that matches no class of `sourceFile`.
10
+ *
11
+ * @param sourceFile - The inspected file; `undefined` (an `.html` file) never matches.
12
+ * @param className - The requested class, if any.
13
+ * @param filePath - Path shown in the message.
14
+ * @returns The message, or `undefined` when no class was requested or the file declares it.
15
+ */
16
+ export function missingClassMessage(sourceFile, className, filePath) {
17
+ if (className === undefined || sourceFile === undefined) {
18
+ return undefined;
19
+ }
20
+ const names = sourceFile
21
+ .getClasses()
22
+ .map((cls) => cls.getName())
23
+ .filter((name) => name !== undefined);
24
+ if (names.includes(className)) {
25
+ return undefined;
26
+ }
27
+ const found = names.length === 0 ? 'the file declares no class' : `classes in the file: ${names.join(', ')}`;
28
+ return `No class named ${className} in ${filePath}; ${found}.`;
29
+ }
30
+ //# sourceMappingURL=class-filter.js.map
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Spawn settings for the Angular CLI tools (run-angular-cli, run-schematic).
3
+ *
4
+ * On POSIX the arguments go to `npx` as argv without a shell, so `;`, `$( )`,
5
+ * backticks or quotes in a value stay part of that value. Windows needs the
6
+ * shell to start `npx.cmd`; there cmd.exe would interpret the line, so values
7
+ * with its metacharacters are rejected before anything runs.
8
+ */
9
+ /**
10
+ * Whether the CLI process needs a shell: only on Windows, for `npx.cmd`.
11
+ *
12
+ * @returns `true` on win32
13
+ */
14
+ export declare function cliNeedsShell(): boolean;
15
+ /**
16
+ * Throws when a value would be interpreted by the shell the CLI runs in. Does
17
+ * nothing where the CLI runs without a shell.
18
+ *
19
+ * @param values - Every value that becomes part of the command line
20
+ * @throws Error naming the first value with a shell metacharacter
21
+ */
22
+ export declare function assertShellSafeArguments(values: readonly string[]): void;
23
+ //# sourceMappingURL=cli-arguments.d.ts.map
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Spawn settings for the Angular CLI tools (run-angular-cli, run-schematic).
3
+ *
4
+ * On POSIX the arguments go to `npx` as argv without a shell, so `;`, `$( )`,
5
+ * backticks or quotes in a value stay part of that value. Windows needs the
6
+ * shell to start `npx.cmd`; there cmd.exe would interpret the line, so values
7
+ * with its metacharacters are rejected before anything runs.
8
+ */
9
+ /** Characters cmd.exe interprets in a command line. */
10
+ const CMD_METACHARACTERS = /[&|<>^%!"`\r\n]/;
11
+ /**
12
+ * Whether the CLI process needs a shell: only on Windows, for `npx.cmd`.
13
+ *
14
+ * @returns `true` on win32
15
+ */
16
+ export function cliNeedsShell() {
17
+ return process.platform === 'win32';
18
+ }
19
+ /**
20
+ * Throws when a value would be interpreted by the shell the CLI runs in. Does
21
+ * nothing where the CLI runs without a shell.
22
+ *
23
+ * @param values - Every value that becomes part of the command line
24
+ * @throws Error naming the first value with a shell metacharacter
25
+ */
26
+ export function assertShellSafeArguments(values) {
27
+ if (!cliNeedsShell()) {
28
+ return;
29
+ }
30
+ const unsafe = values.find((value) => CMD_METACHARACTERS.test(value));
31
+ if (unsafe !== undefined) {
32
+ throw new Error(`Argument contains a shell metacharacter (one of & | < > ^ % ! " \` or a line break), rejected on Windows: ${unsafe}`);
33
+ }
34
+ }
35
+ //# sourceMappingURL=cli-arguments.js.map
@@ -0,0 +1,38 @@
1
+ /** Values of transform-code's `transformation` argument. */
2
+ export declare const TRANSFORMATION_TYPES: readonly ["constructor-to-inject", "interface-extraction", "standalone-migration", "dependency-injection-migration", "facade-pattern", "form-modernization", "constructor-injection-transform", "component-inputs-interface-extraction", "service-injection-cleanup", "container-presentational", "core-shared-modules", "inheritance-to-composition", "promise-service-to-observable", "promise-component-to-reactive", "promise-cleanup", "sequential-await-to-forkjoin", "missing-output-transform", "subscription-transform", "library-extraction", "service-bag-transform", "any-to-interface", "dto-object-literal", "interface-duplication", "static-class-to-functions", "extract-static-from-stateful", "type-safety"];
3
+ /** Ids of the analysis and transform rules of plugin-angular, plugin-architecture, plugin-solid, plugin-standalone and plugin-analyzer. */
4
+ export declare const REGISTERED_RULE_IDS: readonly string[];
5
+ /** A tool the server registers. */
6
+ export interface CatalogTool {
7
+ /** Tool name. */
8
+ name: string;
9
+ /** Whether its description marks it as deprecated. */
10
+ deprecated: boolean;
11
+ }
12
+ /** Tools the server registers, read on each call (the server registers some after the others). */
13
+ export type ToolCatalogProvider = () => readonly CatalogTool[];
14
+ /** Why a feedback record counts as outdated. */
15
+ export type OutdatedReason = 'unknown-rule' | 'unknown-transformation' | 'unknown-tool' | 'deprecated-tool';
16
+ /** Tool entry of a registered tool, from its name and description. */
17
+ export declare function catalogTool(tool: {
18
+ name: string;
19
+ description: string;
20
+ }): CatalogTool;
21
+ /**
22
+ * Why a raw session record is outdated, or `undefined` when it is current or not checked. A transformation record
23
+ * names its rule in `rule.ruleId`: with a `:` it must be a registered rule id, without one a transformation type or
24
+ * a rule name (collect-feedback documents `'constructor-to-inject'`). Analysis records name a tool; only a single
25
+ * tool name is checked (free text like `find-usages/get-call-graph (manual synthesis)` never named a removed tool).
26
+ * Old analysis records stored as transformation records are checked by tool only when their rule id names one; a
27
+ * plugin rule id (`solid:circular-dependency`) is checked as a rule, a free slug (`platform:mcp-registration`) not
28
+ * at all. Tools are checked only with a catalog.
29
+ */
30
+ export declare function outdatedReason(record: {
31
+ kind?: unknown;
32
+ tool?: unknown;
33
+ rule?: unknown;
34
+ }, tools: readonly CatalogTool[] | undefined): {
35
+ reason: OutdatedReason;
36
+ detail: string;
37
+ } | undefined;
38
+ //# sourceMappingURL=feedback-catalog.d.ts.map