@angular-modernizer/adapter-mcp 1.1.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 (144) hide show
  1. package/CHANGELOG.md +662 -0
  2. package/README.md +86 -445
  3. package/dist/cli.js +9 -1
  4. package/dist/core/project-analyzer.js +2 -2
  5. package/dist/index.d.ts +10 -1
  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 +9 -6
  21. package/dist/tools/analyze-build-impact.js +14 -7
  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 +35 -6
  27. package/dist/tools/analyze-project.js +141 -36
  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.d.ts +2 -2
  33. package/dist/tools/find-angular-symbol.js +6 -5
  34. package/dist/tools/find-component-hosts.d.ts +2 -2
  35. package/dist/tools/find-component-hosts.js +6 -5
  36. package/dist/tools/find-usages.d.ts +2 -2
  37. package/dist/tools/find-usages.js +24 -15
  38. package/dist/tools/get-bootstrap-execution.d.ts +2 -2
  39. package/dist/tools/get-bootstrap-execution.js +3 -3
  40. package/dist/tools/get-call-graph.d.ts +2 -2
  41. package/dist/tools/get-call-graph.js +18 -5
  42. package/dist/tools/get-operation-progress-tool.d.ts +1 -1
  43. package/dist/tools/get-operation-progress-tool.js +2 -2
  44. package/dist/tools/get-operation-progress.d.ts +4 -1
  45. package/dist/tools/get-operation-progress.js +6 -2
  46. package/dist/tools/helpers/analysis-output.d.ts +32 -1
  47. package/dist/tools/helpers/analysis-output.js +22 -1
  48. package/dist/tools/helpers/build-cache.d.ts +27 -0
  49. package/dist/tools/helpers/build-cache.js +86 -0
  50. package/dist/tools/helpers/class-filter.d.ts +18 -0
  51. package/dist/tools/helpers/class-filter.js +30 -0
  52. package/dist/tools/helpers/cli-arguments.d.ts +23 -0
  53. package/dist/tools/helpers/cli-arguments.js +35 -0
  54. package/dist/tools/helpers/feedback-catalog.d.ts +38 -0
  55. package/dist/tools/helpers/feedback-catalog.js +196 -0
  56. package/dist/tools/helpers/feedback-sidecar.d.ts +201 -0
  57. package/dist/tools/helpers/feedback-sidecar.js +381 -0
  58. package/dist/tools/helpers/file-type-check.d.ts +34 -0
  59. package/dist/tools/helpers/file-type-check.js +56 -0
  60. package/dist/tools/helpers/output-contract.d.ts +42 -0
  61. package/dist/tools/helpers/output-contract.js +54 -0
  62. package/dist/tools/helpers/pattern-anonymizer.d.ts +27 -0
  63. package/dist/tools/helpers/pattern-anonymizer.js +159 -0
  64. package/dist/tools/helpers/project-cache.d.ts +78 -6
  65. package/dist/tools/helpers/project-cache.js +205 -15
  66. package/dist/tools/helpers/project-decorators.d.ts +11 -4
  67. package/dist/tools/helpers/project-decorators.js +13 -6
  68. package/dist/tools/helpers/refresh-apply.d.ts +94 -0
  69. package/dist/tools/helpers/refresh-apply.js +460 -0
  70. package/dist/tools/helpers/refresh-inventory.d.ts +106 -0
  71. package/dist/tools/helpers/refresh-inventory.js +610 -0
  72. package/dist/tools/helpers/rule-runner.js +3 -1
  73. package/dist/tools/helpers/scan-cache.d.ts +74 -5
  74. package/dist/tools/helpers/scan-cache.js +134 -6
  75. package/dist/tools/helpers/scan-engine.d.ts +30 -6
  76. package/dist/tools/helpers/scan-engine.js +131 -22
  77. package/dist/tools/helpers/scan-plan.d.ts +1 -1
  78. package/dist/tools/helpers/scan-plan.js +16 -2
  79. package/dist/tools/helpers/source-map-loader.d.ts +55 -0
  80. package/dist/tools/helpers/source-map-loader.js +226 -0
  81. package/dist/tools/helpers/template-check.d.ts +76 -0
  82. package/dist/tools/helpers/template-check.js +158 -0
  83. package/dist/tools/helpers/tool-cache.d.ts +7 -2
  84. package/dist/tools/helpers/tool-cache.js +9 -3
  85. package/dist/tools/helpers/tool-context.d.ts +18 -0
  86. package/dist/tools/helpers/tool-context.js +29 -0
  87. package/dist/tools/helpers/transform-safety.d.ts +151 -1
  88. package/dist/tools/helpers/transform-safety.js +357 -4
  89. package/dist/tools/inspect-form-group.d.ts +2 -2
  90. package/dist/tools/inspect-form-group.js +8 -3
  91. package/dist/tools/inspect-i18n.d.ts +2 -2
  92. package/dist/tools/inspect-i18n.js +3 -3
  93. package/dist/tools/inspect-template.d.ts +2 -2
  94. package/dist/tools/inspect-template.js +11 -5
  95. package/dist/tools/learn-patterns.d.ts +43 -28
  96. package/dist/tools/learn-patterns.js +83 -161
  97. package/dist/tools/list-imports.d.ts +2 -2
  98. package/dist/tools/list-imports.js +3 -3
  99. package/dist/tools/orchestrate-migration.d.ts +19 -1
  100. package/dist/tools/orchestrate-migration.js +52 -10
  101. package/dist/tools/parse-stack-trace.d.ts +48 -1
  102. package/dist/tools/parse-stack-trace.js +108 -9
  103. package/dist/tools/plan-migration.d.ts +2 -2
  104. package/dist/tools/plan-migration.js +25 -12
  105. package/dist/tools/refresh-state.d.ts +378 -0
  106. package/dist/tools/refresh-state.js +370 -0
  107. package/dist/tools/resolve-type.d.ts +2 -2
  108. package/dist/tools/resolve-type.js +13 -6
  109. package/dist/tools/review-feedback.d.ts +42 -7
  110. package/dist/tools/review-feedback.js +24 -17
  111. package/dist/tools/rollback-changes.d.ts +5 -0
  112. package/dist/tools/rollback-changes.js +7 -2
  113. package/dist/tools/run-angular-cli.js +36 -22
  114. package/dist/tools/run-build.d.ts +33 -28
  115. package/dist/tools/run-build.js +136 -438
  116. package/dist/tools/run-schematic.d.ts +8 -2
  117. package/dist/tools/run-schematic.js +80 -50
  118. package/dist/tools/scan-all.d.ts +31 -15
  119. package/dist/tools/scan-all.js +75 -109
  120. package/dist/tools/scan-angular.d.ts +27 -14
  121. package/dist/tools/scan-angular.js +70 -92
  122. package/dist/tools/scan-architecture.d.ts +29 -12
  123. package/dist/tools/scan-architecture.js +205 -135
  124. package/dist/tools/scan-solid.d.ts +27 -14
  125. package/dist/tools/scan-solid.js +73 -89
  126. package/dist/tools/search-codebase.d.ts +8 -3
  127. package/dist/tools/search-codebase.js +16 -10
  128. package/dist/tools/suggest-improvements.d.ts +34 -3
  129. package/dist/tools/suggest-improvements.js +34 -9
  130. package/dist/tools/trace-output-flow.d.ts +2 -2
  131. package/dist/tools/trace-output-flow.js +6 -5
  132. package/dist/tools/transform-code-batch.d.ts +9 -9
  133. package/dist/tools/transform-code.d.ts +161 -12
  134. package/dist/tools/transform-code.js +782 -197
  135. package/dist/tools/validate-before-transform.js +2 -1
  136. package/dist/tools/validate-project-compatibility.d.ts +28 -55
  137. package/dist/tools/validate-project-compatibility.js +33 -225
  138. package/dist/tools/validate-transformation.d.ts +40 -26
  139. package/dist/tools/validate-transformation.js +115 -294
  140. package/dist/tools/verify-citations.js +8 -2
  141. package/dist/types.d.ts +9 -9
  142. package/dist/utils/format-tool-response.d.ts +3 -1
  143. package/dist/utils/format-tool-response.js +8 -3
  144. package/package.json +14 -13
@@ -1,6 +1,7 @@
1
1
  import { FeedbackStorage, OutlierDetector, loadConfig, fromLegacyAnalysisRecord, scoreAnalysisCompleteness, summarizeAnalysisFeedback, } from '@angular-modernizer/core';
2
2
  import { feedbackSessionDirs, feedbackStorageConfig, resolveFeedbackRoots, } from './helpers/platform-root-resolver.js';
3
3
  import { STRING_ARRAY } from './helpers/investigation-schemas.js';
4
+ import { INCLUDE_OUTDATED_SCHEMA, SKIPPED_RECORDS_OUTPUT_SCHEMA, describeSkipped, skipMarkedRecords, } from './helpers/feedback-sidecar.js';
4
5
  /** Insights and analysis groups spelled out in the summary. */
5
6
  const SUMMARY_INSIGHTS = 5;
6
7
  /** Text summary: what was read, success rate, top insights, analysis groups, warnings. */
@@ -20,6 +21,7 @@ function describeReview(output) {
20
21
  for (const warning of output.qualityWarnings) {
21
22
  lines.push(`Warning: ${warning.message}`);
22
23
  }
24
+ lines.push(...describeSkipped(output.skippedRecords, output.sidecarWarnings ?? []));
23
25
  return lines.join('\n');
24
26
  }
25
27
  /**
@@ -81,7 +83,7 @@ export class ReviewFeedbackTool {
81
83
  analysisType: {
82
84
  type: 'string',
83
85
  enum: ['success-patterns', 'failure-patterns', 'quality-trends', 'all'],
84
- description: 'Type of analysis to perform',
86
+ description: "Type of analysis to perform (default: tools['review-feedback'].analysisType, else 'all')",
85
87
  },
86
88
  minConfidence: {
87
89
  type: 'number',
@@ -93,7 +95,8 @@ export class ReviewFeedbackTool {
93
95
  type: 'number',
94
96
  minimum: 0,
95
97
  maximum: 100,
96
- description: 'Minimum completeness threshold (default: 70)',
98
+ description: 'Minimum completeness score 0-100 of a feedback record (default: 40). collect-feedback scores 20 points each for execution, validation, outcome metrics, diff and learnings; ' +
99
+ 'a successful transformation sent with execution and validation results scores 40, without validation 20.',
97
100
  },
98
101
  source: {
99
102
  type: 'string',
@@ -106,8 +109,8 @@ export class ReviewFeedbackTool {
106
109
  type: 'string',
107
110
  description: "Optional tool filter for analysis records (e.g. 'find-usages')",
108
111
  },
112
+ ...INCLUDE_OUTDATED_SCHEMA,
109
113
  },
110
- required: ['analysisType'],
111
114
  };
112
115
  /**
113
116
  * JSON Schema of the tool result (`structuredContent`).
@@ -116,6 +119,7 @@ export class ReviewFeedbackTool {
116
119
  outputSchema = {
117
120
  type: 'object',
118
121
  properties: {
122
+ analysisType: { type: 'string' },
119
123
  sessions: { type: 'integer' },
120
124
  transformations: { type: 'integer' },
121
125
  successRate: { type: 'number' },
@@ -183,6 +187,7 @@ export class ReviewFeedbackTool {
183
187
  required: ['tool', 'category', 'count'],
184
188
  },
185
189
  },
190
+ ...SKIPPED_RECORDS_OUTPUT_SCHEMA,
186
191
  summary: { type: 'string' },
187
192
  },
188
193
  required: [
@@ -210,7 +215,7 @@ export class ReviewFeedbackTool {
210
215
  * @param args.since - Optional ISO 8601 date filter for recent feedback
211
216
  * @param args.analysisType - Type of analysis: 'success-patterns', 'failure-patterns', 'quality-trends', or 'all'
212
217
  * @param args.minConfidence - Minimum confidence threshold 0.0-1.0 (default: 0.7)
213
- * @param args.minCompleteness - Minimum completeness threshold 0-100 (default: 70)
218
+ * @param args.minCompleteness - Minimum completeness threshold 0-100 (default: 40)
214
219
  * @param args.source - Storage location strategy: 'project', 'platform', or 'both' (default: 'both')
215
220
  *
216
221
  * @returns ReviewFeedbackOutput containing:
@@ -262,8 +267,9 @@ export class ReviewFeedbackTool {
262
267
  fullConfig.projectRoot ??
263
268
  initialProjectRoot;
264
269
  // Apply defaults
270
+ const analysisType = input.analysisType ?? 'all';
265
271
  const minConfidence = input.minConfidence ?? 0.7;
266
- const minCompleteness = input.minCompleteness ?? 70;
272
+ const minCompleteness = input.minCompleteness ?? 40;
267
273
  const source = input.source ?? 'both';
268
274
  // The project always; the platform store only when configured
269
275
  const roots = resolveFeedbackRoots(projectRoot, source);
@@ -286,7 +292,9 @@ export class ReviewFeedbackTool {
286
292
  // Session not found in any location, skip
287
293
  }
288
294
  }
289
- const sessions = Array.from(sessionMap.values());
295
+ // Records the sidecar marks (duplicates, outdated) stay out unless includeOutdated
296
+ const marked = skipMarkedRecords(projectRoot, sessionMap, input.includeOutdated === true);
297
+ const sessions = marked.sessions;
290
298
  // Flatten all transformations and analysis records. Analysis misses that
291
299
  // were backfilled as transformation records are moved to the analysis list.
292
300
  let allFeedback = [];
@@ -335,11 +343,12 @@ export class ReviewFeedbackTool {
335
343
  const successRate = validFeedback.length > 0 ? successfulCount / validFeedback.length : 0;
336
344
  // Analyze patterns
337
345
  const { analyzePatterns } = await import('./helpers/feedback-analyzer.js');
338
- const insights = analyzePatterns(validFeedback, input.analysisType, minConfidence);
346
+ const insights = analyzePatterns(validFeedback, analysisType, minConfidence);
339
347
  // Generate quality warnings
340
348
  const qualityWarnings = generateQualityWarnings(unfilteredFeedback, outlierReport, minCompleteness, analysisScores);
341
349
  // Return output
342
350
  const output = {
351
+ analysisType,
343
352
  sessions: sessions.length,
344
353
  transformations: validFeedback.length,
345
354
  successRate,
@@ -348,12 +357,12 @@ export class ReviewFeedbackTool {
348
357
  qualityWarnings,
349
358
  analysisRecords: validAnalyses.length,
350
359
  analysisInsights,
360
+ skippedRecords: marked.skipped,
361
+ ...(marked.warnings.length === 0 ? {} : { sidecarWarnings: marked.warnings }),
351
362
  };
352
363
  return { ...output, summary: describeReview(output) };
353
364
  }
354
365
  }
355
- /** Completeness below this value is reported as low quality */
356
- const LOW_COMPLETENESS_THRESHOLD = 70;
357
366
  /**
358
367
  * Generate quality warnings about feedback data
359
368
  *
@@ -371,19 +380,17 @@ function generateQualityWarnings(allFeedback, outlierReport, minCompleteness, an
371
380
  if (scores.length === 0) {
372
381
  return warnings;
373
382
  }
374
- // Low-completeness records (transformation + analysis), counted on the
375
- // unfiltered list so records dropped by minCompleteness are visible here.
376
- const lowCompletenessCount = scores.filter((score) => score < LOW_COMPLETENESS_THRESHOLD).length;
377
- const excludedCount = scores.filter((score) => score < minCompleteness).length;
383
+ // Low-completeness records (transformation + analysis): the records the
384
+ // minCompleteness filter drops, counted on the unfiltered list so they are
385
+ // visible here. A fixed threshold above the filter warned about every record
386
+ // the agents send (collect-feedback never stores metrics or a diff).
387
+ const lowCompletenessCount = scores.filter((score) => score < minCompleteness).length;
378
388
  if (lowCompletenessCount > 0) {
379
- const excludedNote = excludedCount > 0
380
- ? `; ${excludedCount} excluded from learning by minCompleteness ${minCompleteness}`
381
- : '';
382
389
  warnings.push({
383
390
  type: 'low-completeness',
384
391
  count: lowCompletenessCount,
385
392
  percentage: (lowCompletenessCount / scores.length) * 100,
386
- message: `${lowCompletenessCount} feedback records have low completeness (<${LOW_COMPLETENESS_THRESHOLD}%), reducing learning quality${excludedNote}`,
393
+ message: `${lowCompletenessCount} feedback records below minCompleteness ${minCompleteness} are excluded from learning`,
387
394
  });
388
395
  }
389
396
  if (allFeedback.length === 0) {
@@ -75,6 +75,11 @@ export declare class RollbackChangesTool implements MCPTool {
75
75
  type: string;
76
76
  description: string;
77
77
  };
78
+ force: {
79
+ type: string;
80
+ description: string;
81
+ default: boolean;
82
+ };
78
83
  };
79
84
  };
80
85
  /**
@@ -62,6 +62,11 @@ export class RollbackChangesTool {
62
62
  type: 'string',
63
63
  description: 'Git project root (optional - used as project root when projectRoot is not given)',
64
64
  },
65
+ force: {
66
+ type: 'boolean',
67
+ description: 'Restore files that changed since the transformation that wrote their backup (default: false: such a file is left alone and reported, so an old backup never overwrites later edits)',
68
+ default: false,
69
+ },
65
70
  },
66
71
  };
67
72
  /**
@@ -89,7 +94,7 @@ export class RollbackChangesTool {
89
94
  };
90
95
  async execute(args) {
91
96
  const typedArgs = args;
92
- const { files, strategy = 'auto', backupDir, projectRoot, gitRoot, } = typedArgs;
97
+ const { files, strategy = 'auto', backupDir, projectRoot, gitRoot, force = false, } = typedArgs;
93
98
  const startTime = Date.now();
94
99
  // Convert strategy string to RollbackStrategy enum
95
100
  let rollbackStrategy;
@@ -115,7 +120,7 @@ export class RollbackChangesTool {
115
120
  strategy: rollbackStrategy,
116
121
  });
117
122
  try {
118
- const result = await rollbackManager.rollback(files);
123
+ const result = await rollbackManager.rollback(files, { force });
119
124
  const duration = Date.now() - startTime;
120
125
  const response = {
121
126
  success: result.success,
@@ -1,5 +1,7 @@
1
1
  import { spawn } from 'node:child_process';
2
- import { processGroupOptions, terminateOnAbort, terminateProcessTree, } from '@angular-modernizer/core';
2
+ import { noColorEnv, processGroupOptions, stripAnsi, terminateOnAbort, terminateProcessTree, } from '@angular-modernizer/core';
3
+ import { existsSync } from 'node:fs';
4
+ import { assertShellSafeArguments, cliNeedsShell } from './helpers/cli-arguments.js';
3
5
  import { outputTail, seconds } from './helpers/process-output.js';
4
6
  /** Text summary: what ran, how it ended, and the tail of stderr (or stdout) on failure. */
5
7
  function describeCliRun(result) {
@@ -53,6 +55,9 @@ export class RunAngularCliTool {
53
55
  'serve',
54
56
  'test',
55
57
  'lint',
58
+ 'e2e',
59
+ 'extract-i18n',
60
+ 'version',
56
61
  ],
57
62
  },
58
63
  args: {
@@ -122,8 +127,13 @@ export class RunAngularCliTool {
122
127
  const options = params.options ?? {};
123
128
  const cwd = options.cwd ?? process.cwd();
124
129
  const timeout = options.timeout ?? 300000; // 5 minutes default
125
- const env = options.env ? { ...process.env, ...options.env } : process.env;
126
- // Build the full command
130
+ // Color off unless options.env asks for it: summary and output are text
131
+ const env = noColorEnv(process.env, options.env);
132
+ assertShellSafeArguments(commandArgs);
133
+ if (!existsSync(cwd)) {
134
+ throw new Error(`Working directory does not exist: ${cwd}`);
135
+ }
136
+ // Build the full command (for display; the process gets argv)
127
137
  const fullCommand = `ng ${command} ${commandArgs.join(' ')}`.trim();
128
138
  try {
129
139
  const startTime = Date.now();
@@ -135,6 +145,20 @@ export class RunAngularCliTool {
135
145
  signal: ctx.signal,
136
146
  });
137
147
  const executionTime = Date.now() - startTime;
148
+ if (result.timedOut) {
149
+ // What the command printed before the timeout stays in the result
150
+ return withSummary({
151
+ success: false,
152
+ command,
153
+ fullCommand,
154
+ exitCode: -1,
155
+ stdout: result.stdout,
156
+ stderr: `${result.stderr}${result.stderr === '' || result.stderr.endsWith('\n') ? '' : '\n'}Command timed out after ${timeout}ms`,
157
+ executionTime,
158
+ timedOut: true,
159
+ cwd,
160
+ });
161
+ }
138
162
  return withSummary({
139
163
  success: result.exitCode === 0,
140
164
  command,
@@ -147,19 +171,6 @@ export class RunAngularCliTool {
147
171
  });
148
172
  }
149
173
  catch (error) {
150
- if (error instanceof Error && error.message.includes('timed out')) {
151
- return withSummary({
152
- success: false,
153
- command,
154
- fullCommand,
155
- exitCode: -1,
156
- stdout: '',
157
- stderr: 'Command timed out',
158
- executionTime: timeout,
159
- timedOut: true,
160
- cwd,
161
- });
162
- }
163
174
  throw new Error(`Angular CLI command failed: ${error instanceof Error ? error.message : String(error)}`);
164
175
  }
165
176
  }
@@ -168,19 +179,21 @@ export class RunAngularCliTool {
168
179
  */
169
180
  async executeCommand(command, args, options) {
170
181
  return new Promise((resolve, reject) => {
182
+ // argv without a shell: `;` or `$( )` in an argument stays an argument
171
183
  const ngProcess = spawn('npx', ['ng', command, ...args], {
172
184
  cwd: options.cwd,
173
185
  env: options.env,
174
186
  stdio: ['pipe', 'pipe', 'pipe'],
175
- shell: true,
187
+ shell: cliNeedsShell(),
176
188
  ...processGroupOptions(),
177
189
  });
178
190
  let stdout = '';
179
191
  let stderr = '';
180
- // Set up timeout
192
+ let timedOut = false;
193
+ // Timeout: end the process tree, resolve on close with the output so far
181
194
  const timeoutId = setTimeout(() => {
195
+ timedOut = true;
182
196
  terminateProcessTree(ngProcess);
183
- reject(new Error(`Command timed out after ${options.timeout}ms`));
184
197
  }, options.timeout);
185
198
  const stopOnAbort = terminateOnAbort(ngProcess, options.signal);
186
199
  const cleanup = () => {
@@ -200,9 +213,10 @@ export class RunAngularCliTool {
200
213
  return;
201
214
  }
202
215
  resolve({
203
- exitCode: code ?? 0,
204
- stdout,
205
- stderr,
216
+ exitCode: code ?? -1,
217
+ stdout: stripAnsi(stdout),
218
+ stderr: stripAnsi(stderr),
219
+ timedOut,
206
220
  });
207
221
  });
208
222
  ngProcess.on('error', (error) => {
@@ -1,7 +1,10 @@
1
1
  import { type MCPTool, type ToolAnnotations, type ToolContext } from '../types.js';
2
2
  import { type IncompatibilityCheck } from '@angular-modernizer/core';
3
3
  /**
4
- * Incremental build metadata
4
+ * Incremental build metadata.
5
+ *
6
+ * @deprecated run-build has no incremental mode any more and no longer sets
7
+ * this field; kept for 1.x consumers of the type.
5
8
  */
6
9
  export interface IncrementalMetadata {
7
10
  /**
@@ -42,11 +45,17 @@ export interface BuildResult {
42
45
  */
43
46
  success: boolean;
44
47
  /**
45
- * Detected build system.
48
+ * Build system of the command: `angular-cli`, `nx`, `vite`, `webpack`,
49
+ * `npm` (build script), `config` (`build.command`) or `none`.
46
50
  */
47
51
  buildSystem: string;
48
52
  /**
49
- * Command that was executed.
53
+ * Where the command came from: `config`, `angular-cli`, `nx`, `vite`,
54
+ * `webpack`, `package-script`, or `argument` for an explicit `buildSystem`.
55
+ */
56
+ commandSource?: string;
57
+ /**
58
+ * First word of the command that was executed.
50
59
  */
51
60
  command: string;
52
61
  /**
@@ -54,7 +63,8 @@ export interface BuildResult {
54
63
  */
55
64
  fullCommand: string;
56
65
  /**
57
- * Exit code of the build command.
66
+ * Exit code of the build command (-1 when it did not run or timed out
67
+ * without one).
58
68
  */
59
69
  exitCode: number;
60
70
  /**
@@ -70,7 +80,7 @@ export interface BuildResult {
70
80
  */
71
81
  executionTime: number;
72
82
  /**
73
- * Whether the command timed out.
83
+ * Whether the command timed out; the build is stopped then.
74
84
  */
75
85
  timedOut?: boolean;
76
86
  /**
@@ -78,26 +88,26 @@ export interface BuildResult {
78
88
  */
79
89
  artifacts?: string[];
80
90
  /**
81
- * Build warnings and notices.
91
+ * Build warnings, cache warnings and deprecation notices.
82
92
  */
83
93
  warnings?: string[];
84
94
  /**
85
- * Incremental build metadata (if incremental mode was attempted)
95
+ * @deprecated No longer set; run-build has no incremental mode.
86
96
  */
87
97
  incremental?: IncrementalMetadata;
88
98
  /**
89
- * Incompatibility issues detected (if incremental mode was blocked)
99
+ * @deprecated No longer set; run-build has no incremental mode.
90
100
  */
91
101
  incompatibilityIssues?: IncompatibilityCheck[];
92
102
  /**
93
- * Short text: command, exit code, time, build mode, and the last output lines on failure.
103
+ * Short text: command, exit code, time, warnings, and the last output lines on failure.
94
104
  */
95
105
  summary: string;
96
106
  }
97
107
  /**
98
108
  * MCP tool for executing build systems and validating code transformations.
99
- * Supports Angular CLI, Nx, Webpack, Vite, and auto-detection.
100
- * Includes incremental build mode for efficient validation.
109
+ * Runs the project's build command: `build.command` of the project config,
110
+ * else the detected build system, else the `build` script of package.json.
101
111
  */
102
112
  export declare class RunBuildTool implements MCPTool {
103
113
  name: string;
@@ -125,6 +135,7 @@ export declare class RunBuildTool implements MCPTool {
125
135
  incrementalMode: {
126
136
  type: string;
127
137
  description: string;
138
+ deprecated: boolean;
128
139
  };
129
140
  changedFiles: {
130
141
  type: string;
@@ -132,11 +143,12 @@ export declare class RunBuildTool implements MCPTool {
132
143
  type: string;
133
144
  };
134
145
  description: string;
146
+ deprecated: boolean;
135
147
  };
136
148
  forceFullBuild: {
137
149
  type: string;
138
150
  description: string;
139
- default: boolean;
151
+ deprecated: boolean;
140
152
  };
141
153
  cacheStrategy: {
142
154
  type: string;
@@ -159,7 +171,6 @@ export declare class RunBuildTool implements MCPTool {
159
171
  timeout: {
160
172
  type: string;
161
173
  description: string;
162
- default: number;
163
174
  };
164
175
  args: {
165
176
  type: string;
@@ -186,6 +197,9 @@ export declare class RunBuildTool implements MCPTool {
186
197
  buildSystem: {
187
198
  type: string;
188
199
  };
200
+ commandSource: {
201
+ type: string;
202
+ };
189
203
  command: {
190
204
  type: string;
191
205
  };
@@ -222,6 +236,7 @@ export declare class RunBuildTool implements MCPTool {
222
236
  };
223
237
  incremental: {
224
238
  type: string;
239
+ description: string;
225
240
  properties: {
226
241
  enabled: {
227
242
  type: string;
@@ -284,27 +299,17 @@ export declare class RunBuildTool implements MCPTool {
284
299
  execute(args: Record<string, unknown>, ctx?: ToolContext): Promise<BuildResult>;
285
300
  private runBuild;
286
301
  /**
287
- * Detects changed files using git status
302
+ * The command to run: the project's build command for `auto-detect`, the
303
+ * default command of an explicitly named build system otherwise.
288
304
  */
289
- private detectChangedFiles;
290
- /**
291
- * Executes an incremental build using IncompatibilityDetector and IncrementalBuildValidator
292
- */
293
- private executeIncrementalBuild;
294
- /**
295
- * Detect the build system used in the project.
296
- */
297
- private detectBuildSystem;
305
+ private resolveCommand;
298
306
  /**
299
307
  * Get default build command for a specific build system.
300
308
  */
301
309
  private getDefaultBuildCommand;
302
310
  /**
303
- * Build command arguments with options.
304
- */
305
- private buildCommandArgs;
306
- /**
307
- * Execute a build command.
311
+ * Execute a build command line in a shell. A timeout stops the process tree
312
+ * and resolves with `timedOut`; a cancel stops it and rejects.
308
313
  */
309
314
  private executeBuildCommand;
310
315
  /**