@angular-modernizer/adapter-mcp 0.3.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +181 -282
- package/dist/cli.js +21 -13
- package/dist/core/project-analyzer.d.ts +3 -12
- package/dist/core/project-analyzer.js +3 -12
- package/dist/index.d.ts +122 -6
- package/dist/index.js +49 -5
- package/dist/mcp-watcher.d.ts +32 -7
- package/dist/mcp-watcher.js +16 -15
- package/dist/scan-host/scan-host.d.ts +119 -0
- package/dist/scan-host/scan-host.js +376 -0
- package/dist/scan-host/scan-protocol.d.ts +35 -0
- package/dist/scan-host/scan-protocol.js +6 -0
- package/dist/scan-host/scan-worker.d.ts +14 -0
- package/dist/scan-host/scan-worker.js +48 -0
- package/dist/server/limited-stdio-transport.d.ts +75 -0
- package/dist/server/limited-stdio-transport.js +115 -0
- package/dist/server/mcp-server.d.ts +20 -18
- package/dist/server/mcp-server.js +42 -79
- package/dist/server/package-version.d.ts +16 -0
- package/dist/server/package-version.js +37 -0
- package/dist/server/sdk-server.d.ts +71 -0
- package/dist/server/sdk-server.js +113 -0
- package/dist/server/tool-registry.d.ts +6 -9
- package/dist/server/tool-registry.js +6 -12
- package/dist/streaming/progress-store.d.ts +22 -5
- package/dist/streaming/progress-store.js +9 -5
- package/dist/tools/analyze-build-impact.d.ts +276 -35
- package/dist/tools/analyze-build-impact.js +175 -28
- package/dist/tools/analyze-core-to-shared.d.ts +176 -16
- package/dist/tools/analyze-core-to-shared.js +124 -19
- package/dist/tools/analyze-parser-performance.d.ts +209 -15
- package/dist/tools/analyze-parser-performance.js +119 -56
- package/dist/tools/analyze-project.d.ts +349 -17
- package/dist/tools/analyze-project.js +282 -97
- package/dist/tools/check-incremental-compatibility.d.ts +74 -12
- package/dist/tools/check-incremental-compatibility.js +69 -10
- package/dist/tools/collect-feedback.d.ts +225 -21
- package/dist/tools/collect-feedback.js +199 -118
- package/dist/tools/compare-health.d.ts +413 -0
- package/dist/tools/compare-health.js +479 -0
- package/dist/tools/extract-libraries.d.ts +200 -24
- package/dist/tools/extract-libraries.js +131 -27
- package/dist/tools/find-angular-symbol.d.ts +92 -24
- package/dist/tools/find-angular-symbol.js +70 -20
- package/dist/tools/find-component-hosts.d.ts +603 -27
- package/dist/tools/find-component-hosts.js +223 -19
- package/dist/tools/find-usages.d.ts +102 -22
- package/dist/tools/find-usages.js +81 -21
- package/dist/tools/get-bootstrap-execution.d.ts +183 -25
- package/dist/tools/get-bootstrap-execution.js +109 -25
- package/dist/tools/get-call-graph.d.ts +127 -12
- package/dist/tools/get-call-graph.js +84 -19
- package/dist/tools/get-operation-progress-tool.d.ts +126 -8
- package/dist/tools/get-operation-progress-tool.js +124 -12
- package/dist/tools/get-operation-progress.d.ts +27 -1
- package/dist/tools/get-operation-progress.js +5 -5
- package/dist/tools/helpers/analysis-output.d.ts +182 -0
- package/dist/tools/helpers/analysis-output.js +165 -0
- package/dist/tools/helpers/batch-kernel.d.ts +14 -0
- package/dist/tools/helpers/batch-kernel.js +12 -0
- package/dist/tools/helpers/build-schemas.d.ts +36 -0
- package/dist/tools/helpers/build-schemas.js +23 -0
- package/dist/tools/helpers/citation-file-source.d.ts +10 -0
- package/dist/tools/helpers/citation-file-source.js +82 -0
- package/dist/tools/helpers/compact-output.d.ts +2 -1
- package/dist/tools/helpers/compact-output.js +2 -1
- package/dist/tools/helpers/finding-window.d.ts +43 -0
- package/dist/tools/helpers/finding-window.js +64 -0
- package/dist/tools/helpers/health-delta.d.ts +99 -0
- package/dist/tools/helpers/health-delta.js +236 -0
- package/dist/tools/helpers/investigation-schemas.d.ts +93 -0
- package/dist/tools/helpers/investigation-schemas.js +48 -0
- package/dist/tools/helpers/library-imports.d.ts +57 -0
- package/dist/tools/helpers/library-imports.js +151 -0
- package/dist/tools/helpers/load-source-files.d.ts +30 -0
- package/dist/tools/helpers/load-source-files.js +34 -0
- package/dist/tools/helpers/output-contract.d.ts +32 -0
- package/dist/tools/helpers/output-contract.js +32 -0
- package/dist/tools/helpers/platform-root-resolver.d.ts +55 -25
- package/dist/tools/helpers/platform-root-resolver.js +75 -48
- package/dist/tools/helpers/process-output.d.ts +19 -0
- package/dist/tools/helpers/process-output.js +31 -0
- package/dist/tools/helpers/project-cache.d.ts +60 -37
- package/dist/tools/helpers/project-cache.js +54 -37
- package/dist/tools/helpers/project-decorators.d.ts +14 -0
- package/dist/tools/helpers/project-decorators.js +22 -0
- package/dist/tools/helpers/rule-matcher.js +5 -0
- package/dist/tools/helpers/rule-runner.d.ts +25 -13
- package/dist/tools/helpers/rule-runner.js +45 -24
- package/dist/tools/helpers/scan-cache.d.ts +22 -0
- package/dist/tools/helpers/scan-cache.js +34 -0
- package/dist/tools/helpers/scan-engine.d.ts +107 -0
- package/dist/tools/helpers/scan-engine.js +197 -0
- package/dist/tools/helpers/scan-plan.d.ts +5 -2
- package/dist/tools/helpers/scan-plan.js +18 -3
- package/dist/tools/helpers/scope-paths.d.ts +17 -0
- package/dist/tools/helpers/scope-paths.js +32 -0
- package/dist/tools/helpers/suggestion-generator.d.ts +9 -13
- package/dist/tools/helpers/suggestion-generator.js +0 -12
- package/dist/tools/helpers/tool-cache.d.ts +11 -0
- package/dist/tools/helpers/tool-cache.js +15 -0
- package/dist/tools/helpers/tool-context.d.ts +63 -0
- package/dist/tools/helpers/tool-context.js +79 -0
- package/dist/tools/helpers/transform-safety.d.ts +40 -0
- package/dist/tools/helpers/transform-safety.js +87 -0
- package/dist/tools/helpers/validation-output.d.ts +53 -0
- package/dist/tools/helpers/validation-output.js +48 -0
- package/dist/tools/inspect-form-group.d.ts +262 -24
- package/dist/tools/inspect-form-group.js +134 -13
- package/dist/tools/inspect-i18n.d.ts +410 -23
- package/dist/tools/inspect-i18n.js +213 -13
- package/dist/tools/inspect-template.d.ts +260 -22
- package/dist/tools/inspect-template.js +174 -13
- package/dist/tools/learn-patterns.d.ts +210 -13
- package/dist/tools/learn-patterns.js +113 -12
- package/dist/tools/list-imports.d.ts +152 -34
- package/dist/tools/list-imports.js +124 -18
- package/dist/tools/orchestrate-migration.d.ts +159 -14
- package/dist/tools/orchestrate-migration.js +147 -20
- package/dist/tools/parse-stack-trace.d.ts +78 -21
- package/dist/tools/parse-stack-trace.js +44 -7
- package/dist/tools/plan-migration.d.ts +395 -26
- package/dist/tools/plan-migration.js +173 -22
- package/dist/tools/resolve-type.d.ts +57 -9
- package/dist/tools/resolve-type.js +49 -12
- package/dist/tools/review-feedback.d.ts +214 -16
- package/dist/tools/review-feedback.js +142 -57
- package/dist/tools/rollback-changes.d.ts +88 -7
- package/dist/tools/rollback-changes.js +74 -19
- package/dist/tools/run-angular-cli.d.ts +57 -12
- package/dist/tools/run-angular-cli.js +76 -13
- package/dist/tools/run-build.d.ts +127 -13
- package/dist/tools/run-build.js +128 -16
- package/dist/tools/run-schematic.d.ts +82 -12
- package/dist/tools/run-schematic.js +115 -18
- package/dist/tools/scan-all.d.ts +88 -23
- package/dist/tools/scan-all.js +161 -220
- package/dist/tools/scan-angular.d.ts +60 -19
- package/dist/tools/scan-angular.js +100 -141
- package/dist/tools/scan-architecture.d.ts +92 -24
- package/dist/tools/scan-architecture.js +268 -211
- package/dist/tools/scan-solid.d.ts +59 -19
- package/dist/tools/scan-solid.js +98 -139
- package/dist/tools/search-codebase.d.ts +110 -23
- package/dist/tools/search-codebase.js +67 -11
- package/dist/tools/server-status.d.ts +392 -26
- package/dist/tools/server-status.js +260 -27
- package/dist/tools/suggest-improvements.d.ts +105 -10
- package/dist/tools/suggest-improvements.js +91 -51
- package/dist/tools/trace-output-flow.d.ts +713 -26
- package/dist/tools/trace-output-flow.js +396 -33
- package/dist/tools/transform-code-batch.d.ts +3 -0
- package/dist/tools/transform-code-batch.js +10 -5
- package/dist/tools/transform-code.d.ts +402 -18
- package/dist/tools/transform-code.js +708 -649
- package/dist/tools/validate-before-transform.d.ts +136 -7
- package/dist/tools/validate-before-transform.js +65 -9
- package/dist/tools/validate-project-compatibility.d.ts +82 -15
- package/dist/tools/validate-project-compatibility.js +84 -15
- package/dist/tools/validate-transformation.d.ts +243 -8
- package/dist/tools/validate-transformation.js +127 -23
- package/dist/tools/verify-citations.d.ts +202 -0
- package/dist/tools/verify-citations.js +221 -0
- package/dist/types.d.ts +78 -11
- package/dist/types.js +0 -5
- package/dist/utils/format-tool-response.d.ts +22 -59
- package/dist/utils/format-tool-response.js +25 -134
- package/package.json +31 -20
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/core/project-analyzer.d.ts.map +0 -1
- package/dist/core/project-analyzer.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/mcp-watcher.d.ts.map +0 -1
- package/dist/mcp-watcher.js.map +0 -1
- package/dist/server/json-rpc-handler.d.ts +0 -98
- package/dist/server/json-rpc-handler.d.ts.map +0 -1
- package/dist/server/json-rpc-handler.js +0 -301
- package/dist/server/json-rpc-handler.js.map +0 -1
- package/dist/server/mcp-server.d.ts.map +0 -1
- package/dist/server/mcp-server.js.map +0 -1
- package/dist/server/stdio-guard.d.ts.map +0 -1
- package/dist/server/stdio-guard.js.map +0 -1
- package/dist/server/tool-registry.d.ts.map +0 -1
- package/dist/server/tool-registry.js.map +0 -1
- package/dist/streaming/progress-store.d.ts.map +0 -1
- package/dist/streaming/progress-store.js.map +0 -1
- package/dist/tools/analyze-build-impact.d.ts.map +0 -1
- package/dist/tools/analyze-build-impact.js.map +0 -1
- package/dist/tools/analyze-core-to-shared.d.ts.map +0 -1
- package/dist/tools/analyze-core-to-shared.js.map +0 -1
- package/dist/tools/analyze-parser-performance.d.ts.map +0 -1
- package/dist/tools/analyze-parser-performance.js.map +0 -1
- package/dist/tools/analyze-project.d.ts.map +0 -1
- package/dist/tools/analyze-project.js.map +0 -1
- package/dist/tools/check-incremental-compatibility.d.ts.map +0 -1
- package/dist/tools/check-incremental-compatibility.js.map +0 -1
- package/dist/tools/collect-feedback.d.ts.map +0 -1
- package/dist/tools/collect-feedback.js.map +0 -1
- package/dist/tools/extract-libraries.d.ts.map +0 -1
- package/dist/tools/extract-libraries.js.map +0 -1
- package/dist/tools/find-angular-symbol.d.ts.map +0 -1
- package/dist/tools/find-angular-symbol.js.map +0 -1
- package/dist/tools/find-component-hosts.d.ts.map +0 -1
- package/dist/tools/find-component-hosts.js.map +0 -1
- package/dist/tools/find-usages.d.ts.map +0 -1
- package/dist/tools/find-usages.js.map +0 -1
- package/dist/tools/get-bootstrap-execution.d.ts.map +0 -1
- package/dist/tools/get-bootstrap-execution.js.map +0 -1
- package/dist/tools/get-call-graph.d.ts.map +0 -1
- package/dist/tools/get-call-graph.js.map +0 -1
- package/dist/tools/get-operation-progress-tool.d.ts.map +0 -1
- package/dist/tools/get-operation-progress-tool.js.map +0 -1
- package/dist/tools/get-operation-progress.d.ts.map +0 -1
- package/dist/tools/get-operation-progress.js.map +0 -1
- package/dist/tools/helpers/compact-output.d.ts.map +0 -1
- package/dist/tools/helpers/compact-output.js.map +0 -1
- package/dist/tools/helpers/feedback-analyzer.d.ts.map +0 -1
- package/dist/tools/helpers/feedback-analyzer.js.map +0 -1
- package/dist/tools/helpers/find-ts-config.d.ts.map +0 -1
- package/dist/tools/helpers/find-ts-config.js.map +0 -1
- package/dist/tools/helpers/platform-root-resolver.d.ts.map +0 -1
- package/dist/tools/helpers/platform-root-resolver.js.map +0 -1
- package/dist/tools/helpers/project-cache.d.ts.map +0 -1
- package/dist/tools/helpers/project-cache.js.map +0 -1
- package/dist/tools/helpers/rule-matcher.d.ts.map +0 -1
- package/dist/tools/helpers/rule-matcher.js.map +0 -1
- package/dist/tools/helpers/rule-runner.d.ts.map +0 -1
- package/dist/tools/helpers/rule-runner.js.map +0 -1
- package/dist/tools/helpers/scan-plan.d.ts.map +0 -1
- package/dist/tools/helpers/scan-plan.js.map +0 -1
- package/dist/tools/helpers/stack-frame-file-index.d.ts.map +0 -1
- package/dist/tools/helpers/stack-frame-file-index.js.map +0 -1
- package/dist/tools/helpers/suggestion-generator.d.ts.map +0 -1
- package/dist/tools/helpers/suggestion-generator.js.map +0 -1
- package/dist/tools/inspect-form-group.d.ts.map +0 -1
- package/dist/tools/inspect-form-group.js.map +0 -1
- package/dist/tools/inspect-i18n.d.ts.map +0 -1
- package/dist/tools/inspect-i18n.js.map +0 -1
- package/dist/tools/inspect-template.d.ts.map +0 -1
- package/dist/tools/inspect-template.js.map +0 -1
- package/dist/tools/learn-patterns.d.ts.map +0 -1
- package/dist/tools/learn-patterns.js.map +0 -1
- package/dist/tools/list-imports.d.ts.map +0 -1
- package/dist/tools/list-imports.js.map +0 -1
- package/dist/tools/orchestrate-migration.d.ts.map +0 -1
- package/dist/tools/orchestrate-migration.js.map +0 -1
- package/dist/tools/parse-stack-trace.d.ts.map +0 -1
- package/dist/tools/parse-stack-trace.js.map +0 -1
- package/dist/tools/plan-migration.d.ts.map +0 -1
- package/dist/tools/plan-migration.js.map +0 -1
- package/dist/tools/resolve-type.d.ts.map +0 -1
- package/dist/tools/resolve-type.js.map +0 -1
- package/dist/tools/review-feedback.d.ts.map +0 -1
- package/dist/tools/review-feedback.js.map +0 -1
- package/dist/tools/rollback-changes.d.ts.map +0 -1
- package/dist/tools/rollback-changes.js.map +0 -1
- package/dist/tools/run-angular-cli.d.ts.map +0 -1
- package/dist/tools/run-angular-cli.js.map +0 -1
- package/dist/tools/run-build.d.ts.map +0 -1
- package/dist/tools/run-build.js.map +0 -1
- package/dist/tools/run-schematic.d.ts.map +0 -1
- package/dist/tools/run-schematic.js.map +0 -1
- package/dist/tools/scan-all.d.ts.map +0 -1
- package/dist/tools/scan-all.js.map +0 -1
- package/dist/tools/scan-angular.d.ts.map +0 -1
- package/dist/tools/scan-angular.js.map +0 -1
- package/dist/tools/scan-architecture.d.ts.map +0 -1
- package/dist/tools/scan-architecture.js.map +0 -1
- package/dist/tools/scan-solid.d.ts.map +0 -1
- package/dist/tools/scan-solid.js.map +0 -1
- package/dist/tools/search-codebase.d.ts.map +0 -1
- package/dist/tools/search-codebase.js.map +0 -1
- package/dist/tools/server-status.d.ts.map +0 -1
- package/dist/tools/server-status.js.map +0 -1
- package/dist/tools/shared/scan-types.d.ts +0 -200
- package/dist/tools/shared/scan-types.d.ts.map +0 -1
- package/dist/tools/shared/scan-types.js +0 -7
- package/dist/tools/shared/scan-types.js.map +0 -1
- package/dist/tools/suggest-improvements.d.ts.map +0 -1
- package/dist/tools/suggest-improvements.js.map +0 -1
- package/dist/tools/trace-output-flow.d.ts.map +0 -1
- package/dist/tools/trace-output-flow.js.map +0 -1
- package/dist/tools/transform-code-batch.d.ts.map +0 -1
- package/dist/tools/transform-code-batch.js.map +0 -1
- package/dist/tools/transform-code.d.ts.map +0 -1
- package/dist/tools/transform-code.js.map +0 -1
- package/dist/tools/validate-before-transform.d.ts.map +0 -1
- package/dist/tools/validate-before-transform.js.map +0 -1
- package/dist/tools/validate-project-compatibility.d.ts.map +0 -1
- package/dist/tools/validate-project-compatibility.js.map +0 -1
- package/dist/tools/validate-transformation.d.ts.map +0 -1
- package/dist/tools/validate-transformation.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/utils/format-tool-response.d.ts.map +0 -1
- package/dist/utils/format-tool-response.js.map +0 -1
package/dist/tools/run-build.js
CHANGED
|
@@ -1,22 +1,67 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @angular-modernizer/adapter-mcp - Run Build Tool
|
|
3
|
-
*
|
|
4
|
-
* MCP tool for executing build systems and validating code transformations.
|
|
5
|
-
* Supports Angular CLI, Nx, Webpack, Vite, and auto-detection.
|
|
6
|
-
* Includes incremental build mode for efficient validation.
|
|
7
|
-
*/
|
|
8
1
|
import { spawn, execSync } from 'node:child_process';
|
|
9
2
|
import { existsSync, readFileSync } from 'node:fs';
|
|
10
3
|
import { join } from 'node:path';
|
|
11
|
-
import { loadConfig, } from '@angular-modernizer/core';
|
|
4
|
+
import { loadConfig, processGroupOptions, terminateOnAbort, terminateProcessTree, } from '@angular-modernizer/core';
|
|
5
|
+
import { INCOMPATIBILITY_ISSUES_SCHEMA } from './helpers/build-schemas.js';
|
|
6
|
+
import { STRING_ARRAY } from './helpers/investigation-schemas.js';
|
|
7
|
+
import { outputTail, seconds } from './helpers/process-output.js';
|
|
8
|
+
/** Build warnings spelled out in the summary; the rest is in `warnings`. */
|
|
9
|
+
const SUMMARY_BUILD_WARNINGS = 5;
|
|
10
|
+
/** Text summary: outcome, build mode, warnings, blockers and the tail of the output on failure. */
|
|
11
|
+
function describeBuild(result) {
|
|
12
|
+
const ending = result.timedOut === true
|
|
13
|
+
? `timed out after ${seconds(result.executionTime)}`
|
|
14
|
+
: `exited ${result.exitCode} after ${seconds(result.executionTime)}`;
|
|
15
|
+
const lines = [
|
|
16
|
+
`Build ${result.success ? 'passed' : 'failed'} (${result.buildSystem}): \`${result.fullCommand}\` ${ending}.`,
|
|
17
|
+
];
|
|
18
|
+
const inc = result.incremental;
|
|
19
|
+
if (inc !== undefined) {
|
|
20
|
+
lines.push(inc.enabled
|
|
21
|
+
? `Incremental (${inc.scope ?? 'unknown scope'}): ${inc.filesBuilt ?? 0} file(s) built, ` +
|
|
22
|
+
`${inc.filesSkipped ?? 0} skipped${inc.speedup === undefined ? '' : `; ${inc.speedup}`}.`
|
|
23
|
+
: `Full build${inc.fallbackReason === undefined ? '' : `: ${inc.fallbackReason}`}.`);
|
|
24
|
+
}
|
|
25
|
+
const blockers = (result.incompatibilityIssues ?? []).filter((i) => i.detected && i.severity === 'blocker');
|
|
26
|
+
if (blockers.length > 0) {
|
|
27
|
+
lines.push(`Blockers for incremental builds: ${blockers.map((b) => b.type).join(', ')}.`);
|
|
28
|
+
}
|
|
29
|
+
const warnings = result.warnings ?? [];
|
|
30
|
+
if (warnings.length > 0) {
|
|
31
|
+
lines.push(`${warnings.length} build warning(s):`);
|
|
32
|
+
lines.push(...warnings.slice(0, SUMMARY_BUILD_WARNINGS).map((w) => `- ${w}`));
|
|
33
|
+
}
|
|
34
|
+
if (!result.success) {
|
|
35
|
+
const tail = outputTail(result.errors) ?? outputTail(result.output);
|
|
36
|
+
if (tail !== undefined) {
|
|
37
|
+
lines.push(`Last output:\n${tail}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return lines.join('\n');
|
|
41
|
+
}
|
|
12
42
|
/**
|
|
13
|
-
* MCP tool for executing build systems.
|
|
43
|
+
* MCP tool for executing build systems and validating code transformations.
|
|
44
|
+
* Supports Angular CLI, Nx, Webpack, Vite, and auto-detection.
|
|
45
|
+
* Includes incremental build mode for efficient validation.
|
|
14
46
|
*/
|
|
15
47
|
export class RunBuildTool {
|
|
16
48
|
name = 'run-build';
|
|
17
|
-
|
|
49
|
+
title = 'Run Build';
|
|
50
|
+
annotations = {
|
|
51
|
+
readOnlyHint: false,
|
|
52
|
+
destructiveHint: true,
|
|
53
|
+
idempotentHint: true,
|
|
54
|
+
openWorldHint: false,
|
|
55
|
+
};
|
|
56
|
+
description = 'Execute build systems to validate code transformations. Supports incremental mode for 2-4x faster builds by validating only changed files and their dependencies. Automatically detects incompatibilities and falls back to full build when needed. ' +
|
|
57
|
+
'The result has the full build output; summary is a short text with the outcome, the build mode and, on failure, the last output lines.';
|
|
58
|
+
/**
|
|
59
|
+
* JSON Schema of the tool arguments.
|
|
60
|
+
* @hidden
|
|
61
|
+
*/
|
|
18
62
|
inputSchema = {
|
|
19
63
|
type: 'object',
|
|
64
|
+
additionalProperties: false,
|
|
20
65
|
properties: {
|
|
21
66
|
rootPath: {
|
|
22
67
|
type: 'string',
|
|
@@ -75,7 +120,61 @@ export class RunBuildTool {
|
|
|
75
120
|
},
|
|
76
121
|
required: ['rootPath'],
|
|
77
122
|
};
|
|
78
|
-
|
|
123
|
+
/**
|
|
124
|
+
* JSON Schema of the tool result (`structuredContent`).
|
|
125
|
+
* @hidden
|
|
126
|
+
*/
|
|
127
|
+
outputSchema = {
|
|
128
|
+
type: 'object',
|
|
129
|
+
properties: {
|
|
130
|
+
success: { type: 'boolean' },
|
|
131
|
+
buildSystem: { type: 'string' },
|
|
132
|
+
command: { type: 'string' },
|
|
133
|
+
fullCommand: { type: 'string' },
|
|
134
|
+
exitCode: { type: 'integer' },
|
|
135
|
+
output: { type: 'string' },
|
|
136
|
+
errors: { type: 'string' },
|
|
137
|
+
executionTime: { type: 'number' },
|
|
138
|
+
timedOut: { type: 'boolean' },
|
|
139
|
+
artifacts: STRING_ARRAY,
|
|
140
|
+
warnings: {
|
|
141
|
+
type: 'array',
|
|
142
|
+
items: { type: 'string' },
|
|
143
|
+
description: 'Warnings the build printed.',
|
|
144
|
+
},
|
|
145
|
+
incremental: {
|
|
146
|
+
type: 'object',
|
|
147
|
+
properties: {
|
|
148
|
+
enabled: { type: 'boolean' },
|
|
149
|
+
scope: { type: 'string' },
|
|
150
|
+
filesBuilt: { type: 'integer' },
|
|
151
|
+
filesSkipped: { type: 'integer' },
|
|
152
|
+
cacheHit: { type: 'boolean' },
|
|
153
|
+
speedup: { type: 'string' },
|
|
154
|
+
fallbackReason: { type: 'string' },
|
|
155
|
+
},
|
|
156
|
+
required: ['enabled'],
|
|
157
|
+
},
|
|
158
|
+
incompatibilityIssues: INCOMPATIBILITY_ISSUES_SCHEMA,
|
|
159
|
+
summary: { type: 'string' },
|
|
160
|
+
},
|
|
161
|
+
required: [
|
|
162
|
+
'success',
|
|
163
|
+
'buildSystem',
|
|
164
|
+
'command',
|
|
165
|
+
'fullCommand',
|
|
166
|
+
'exitCode',
|
|
167
|
+
'output',
|
|
168
|
+
'errors',
|
|
169
|
+
'executionTime',
|
|
170
|
+
'summary',
|
|
171
|
+
],
|
|
172
|
+
};
|
|
173
|
+
async execute(args, ctx = {}) {
|
|
174
|
+
const result = await this.runBuild(args, ctx.signal);
|
|
175
|
+
return { ...result, summary: describeBuild(result) };
|
|
176
|
+
}
|
|
177
|
+
async runBuild(args, signal) {
|
|
79
178
|
const params = args;
|
|
80
179
|
if (!params.rootPath) {
|
|
81
180
|
throw new Error('rootPath is required');
|
|
@@ -117,10 +216,13 @@ export class RunBuildTool {
|
|
|
117
216
|
// Attempt incremental build if enabled
|
|
118
217
|
if (attemptIncremental) {
|
|
119
218
|
try {
|
|
120
|
-
return await this.executeIncrementalBuild(rootPath, params, systemInfo, options, timeout);
|
|
219
|
+
return await this.executeIncrementalBuild(rootPath, params, systemInfo, options, timeout, signal);
|
|
121
220
|
}
|
|
122
221
|
catch (error) {
|
|
123
|
-
//
|
|
222
|
+
// A cancelled build stops; any other error falls back to a full build
|
|
223
|
+
if (signal?.aborted === true) {
|
|
224
|
+
throw error;
|
|
225
|
+
}
|
|
124
226
|
incrementalMetadata = {
|
|
125
227
|
enabled: false,
|
|
126
228
|
fallbackReason: error instanceof Error
|
|
@@ -135,6 +237,7 @@ export class RunBuildTool {
|
|
|
135
237
|
const result = await this.executeBuildCommand(buildArgs, {
|
|
136
238
|
cwd: rootPath,
|
|
137
239
|
timeout,
|
|
240
|
+
signal,
|
|
138
241
|
});
|
|
139
242
|
const executionTime = Date.now() - startTime;
|
|
140
243
|
const { warnings, artifacts } = this.parseBuildOutput(result.stdout);
|
|
@@ -215,7 +318,7 @@ export class RunBuildTool {
|
|
|
215
318
|
/**
|
|
216
319
|
* Executes an incremental build using IncompatibilityDetector and IncrementalBuildValidator
|
|
217
320
|
*/
|
|
218
|
-
async executeIncrementalBuild(rootPath, params, systemInfo, options, timeout) {
|
|
321
|
+
async executeIncrementalBuild(rootPath, params, systemInfo, options, timeout, signal) {
|
|
219
322
|
// Dynamic import to avoid circular dependencies
|
|
220
323
|
const { Project } = await import('ts-morph');
|
|
221
324
|
const { IncompatibilityDetector, IncrementalBuildValidator, IncrementalAnalyzer, } = await import('@angular-modernizer/core');
|
|
@@ -237,6 +340,7 @@ export class RunBuildTool {
|
|
|
237
340
|
const result = await this.executeBuildCommand(buildArgs, {
|
|
238
341
|
cwd: rootPath,
|
|
239
342
|
timeout,
|
|
343
|
+
signal,
|
|
240
344
|
});
|
|
241
345
|
const executionTime = Date.now() - startTime;
|
|
242
346
|
const { warnings, artifacts } = this.parseBuildOutput(result.stdout);
|
|
@@ -313,6 +417,7 @@ export class RunBuildTool {
|
|
|
313
417
|
baseBranch: 'HEAD',
|
|
314
418
|
forceFiles: params.changedFiles,
|
|
315
419
|
includeDependents: true,
|
|
420
|
+
signal,
|
|
316
421
|
});
|
|
317
422
|
// Calculate speedup with better messaging
|
|
318
423
|
const fullBuildEstimate = validationResult.scope.estimatedBuildTime * 1000;
|
|
@@ -494,16 +599,19 @@ export class RunBuildTool {
|
|
|
494
599
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
495
600
|
shell: true,
|
|
496
601
|
env: { ...process.env, CI: 'true' },
|
|
602
|
+
...processGroupOptions(),
|
|
497
603
|
});
|
|
498
604
|
let stdout = '';
|
|
499
605
|
let stderr = '';
|
|
500
|
-
// Set up timeout
|
|
606
|
+
// Set up timeout; the build runs under a shell, so the whole process tree goes
|
|
501
607
|
const timeoutId = setTimeout(() => {
|
|
502
|
-
buildProcess
|
|
608
|
+
terminateProcessTree(buildProcess);
|
|
503
609
|
reject(new Error(`Build command timed out after ${options.timeout}ms`));
|
|
504
610
|
}, options.timeout);
|
|
611
|
+
const stopOnAbort = terminateOnAbort(buildProcess, options.signal);
|
|
505
612
|
const cleanup = () => {
|
|
506
613
|
clearTimeout(timeoutId);
|
|
614
|
+
stopOnAbort();
|
|
507
615
|
};
|
|
508
616
|
buildProcess.stdout.on('data', (data) => {
|
|
509
617
|
stdout += data.toString();
|
|
@@ -513,6 +621,10 @@ export class RunBuildTool {
|
|
|
513
621
|
});
|
|
514
622
|
buildProcess.on('close', (code) => {
|
|
515
623
|
cleanup();
|
|
624
|
+
if (options.signal?.aborted === true) {
|
|
625
|
+
reject(new Error('Build cancelled'));
|
|
626
|
+
return;
|
|
627
|
+
}
|
|
516
628
|
resolve({
|
|
517
629
|
exitCode: code ?? 0,
|
|
518
630
|
stdout,
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
* @angular-modernizer/adapter-mcp - Run Schematic Tool
|
|
3
|
-
*
|
|
4
|
-
* MCP tool for executing Angular schematics programmatically.
|
|
5
|
-
* Enables AI assistants to run code generation and migration schematics
|
|
6
|
-
* from built-in Angular collections or custom schematic libraries.
|
|
7
|
-
*/
|
|
8
|
-
import { type MCPTool } from '../types.js';
|
|
1
|
+
import { type MCPTool, type ToolAnnotations, type ToolContext } from '../types.js';
|
|
9
2
|
/**
|
|
10
3
|
* Result of schematic execution.
|
|
11
4
|
*/
|
|
12
|
-
interface SchematicResult {
|
|
5
|
+
export interface SchematicResult {
|
|
13
6
|
/**
|
|
14
7
|
* Whether the schematic executed successfully.
|
|
15
8
|
*/
|
|
@@ -66,15 +59,28 @@ interface SchematicResult {
|
|
|
66
59
|
* Warnings or informational messages.
|
|
67
60
|
*/
|
|
68
61
|
warnings: string[];
|
|
62
|
+
/**
|
|
63
|
+
* Short text: command, exit code, generated files, conflicts, and the last output lines on failure.
|
|
64
|
+
*/
|
|
65
|
+
summary: string;
|
|
69
66
|
}
|
|
70
67
|
/**
|
|
71
|
-
* MCP tool for executing Angular schematics.
|
|
68
|
+
* MCP tool for executing Angular schematics programmatically.
|
|
69
|
+
* Enables AI assistants to run code generation and migration schematics
|
|
70
|
+
* from built-in Angular collections or custom schematic libraries.
|
|
72
71
|
*/
|
|
73
72
|
export declare class RunSchematicTool implements MCPTool {
|
|
74
73
|
name: string;
|
|
74
|
+
title: string;
|
|
75
|
+
annotations: ToolAnnotations;
|
|
75
76
|
description: string;
|
|
77
|
+
/**
|
|
78
|
+
* JSON Schema of the tool arguments.
|
|
79
|
+
* @hidden
|
|
80
|
+
*/
|
|
76
81
|
inputSchema: {
|
|
77
82
|
type: string;
|
|
83
|
+
additionalProperties: boolean;
|
|
78
84
|
properties: {
|
|
79
85
|
schematic: {
|
|
80
86
|
type: string;
|
|
@@ -131,7 +137,72 @@ export declare class RunSchematicTool implements MCPTool {
|
|
|
131
137
|
};
|
|
132
138
|
required: string[];
|
|
133
139
|
};
|
|
134
|
-
|
|
140
|
+
/**
|
|
141
|
+
* JSON Schema of the tool result (`structuredContent`).
|
|
142
|
+
* @hidden
|
|
143
|
+
*/
|
|
144
|
+
outputSchema: {
|
|
145
|
+
type: string;
|
|
146
|
+
properties: {
|
|
147
|
+
success: {
|
|
148
|
+
type: string;
|
|
149
|
+
};
|
|
150
|
+
schematic: {
|
|
151
|
+
type: string;
|
|
152
|
+
};
|
|
153
|
+
collection: {
|
|
154
|
+
type: string;
|
|
155
|
+
};
|
|
156
|
+
target: {
|
|
157
|
+
type: string;
|
|
158
|
+
};
|
|
159
|
+
fullCommand: {
|
|
160
|
+
type: string;
|
|
161
|
+
};
|
|
162
|
+
exitCode: {
|
|
163
|
+
type: string;
|
|
164
|
+
};
|
|
165
|
+
stdout: {
|
|
166
|
+
type: string;
|
|
167
|
+
};
|
|
168
|
+
stderr: {
|
|
169
|
+
type: string;
|
|
170
|
+
};
|
|
171
|
+
filesGenerated: {
|
|
172
|
+
readonly type: "array";
|
|
173
|
+
readonly items: {
|
|
174
|
+
readonly type: "string";
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
conflicts: {
|
|
178
|
+
readonly type: "array";
|
|
179
|
+
readonly items: {
|
|
180
|
+
readonly type: "string";
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
executionTime: {
|
|
184
|
+
type: string;
|
|
185
|
+
};
|
|
186
|
+
timedOut: {
|
|
187
|
+
type: string;
|
|
188
|
+
};
|
|
189
|
+
cwd: {
|
|
190
|
+
type: string;
|
|
191
|
+
};
|
|
192
|
+
warnings: {
|
|
193
|
+
type: string;
|
|
194
|
+
items: {
|
|
195
|
+
type: string;
|
|
196
|
+
};
|
|
197
|
+
description: string;
|
|
198
|
+
};
|
|
199
|
+
summary: {
|
|
200
|
+
type: string;
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
required: string[];
|
|
204
|
+
};
|
|
205
|
+
execute(args: Record<string, unknown>, ctx?: ToolContext): Promise<SchematicResult>;
|
|
135
206
|
/**
|
|
136
207
|
* Validate schematic name format.
|
|
137
208
|
*/
|
|
@@ -169,5 +240,4 @@ export declare class RunSchematicTool implements MCPTool {
|
|
|
169
240
|
*/
|
|
170
241
|
private extractWarnings;
|
|
171
242
|
}
|
|
172
|
-
export {};
|
|
173
243
|
//# sourceMappingURL=run-schematic.d.ts.map
|
|
@@ -1,13 +1,41 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @angular-modernizer/adapter-mcp - Run Schematic Tool
|
|
3
|
-
*
|
|
4
|
-
* MCP tool for executing Angular schematics programmatically.
|
|
5
|
-
* Enables AI assistants to run code generation and migration schematics
|
|
6
|
-
* from built-in Angular collections or custom schematic libraries.
|
|
7
|
-
*/
|
|
8
1
|
import { spawn } from 'node:child_process';
|
|
2
|
+
import { processGroupOptions, terminateOnAbort, terminateProcessTree, } from '@angular-modernizer/core';
|
|
9
3
|
import { existsSync } from 'node:fs';
|
|
10
4
|
import { resolve, dirname } from 'node:path';
|
|
5
|
+
import { STRING_ARRAY } from './helpers/investigation-schemas.js';
|
|
6
|
+
import { outputTail, seconds } from './helpers/process-output.js';
|
|
7
|
+
/** Generated files spelled out in the summary; the rest is in `filesGenerated`. */
|
|
8
|
+
const SUMMARY_FILES = 10;
|
|
9
|
+
/** Text summary: outcome, files, conflicts, warnings and the tail of the output on failure. */
|
|
10
|
+
function describeSchematic(result) {
|
|
11
|
+
const ending = result.timedOut === true
|
|
12
|
+
? `timed out after ${seconds(result.executionTime)}`
|
|
13
|
+
: `exited ${result.exitCode} after ${seconds(result.executionTime)}`;
|
|
14
|
+
const lines = [
|
|
15
|
+
`Schematic ${result.collection}:${result.schematic} ${result.success ? 'passed' : 'failed'}: ` +
|
|
16
|
+
`\`${result.fullCommand}\` ${ending} in ${result.cwd}.`,
|
|
17
|
+
];
|
|
18
|
+
if (result.filesGenerated.length > 0) {
|
|
19
|
+
lines.push(`${result.filesGenerated.length} file(s) generated or updated:`);
|
|
20
|
+
lines.push(...result.filesGenerated.slice(0, SUMMARY_FILES).map((f) => `- ${f}`));
|
|
21
|
+
}
|
|
22
|
+
if (result.conflicts.length > 0) {
|
|
23
|
+
lines.push(`${result.conflicts.length} conflict(s): ${result.conflicts.join('; ')}`);
|
|
24
|
+
}
|
|
25
|
+
if (result.warnings.length > 0) {
|
|
26
|
+
lines.push(`${result.warnings.length} warning(s).`);
|
|
27
|
+
}
|
|
28
|
+
if (!result.success) {
|
|
29
|
+
const tail = outputTail(result.stderr) ?? outputTail(result.stdout);
|
|
30
|
+
if (tail !== undefined) {
|
|
31
|
+
lines.push(`Last output:\n${tail}`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return lines.join('\n');
|
|
35
|
+
}
|
|
36
|
+
function withSummary(result) {
|
|
37
|
+
return { ...result, summary: describeSchematic(result) };
|
|
38
|
+
}
|
|
11
39
|
/**
|
|
12
40
|
* Safe schematic options whitelist.
|
|
13
41
|
* Only these options are allowed to prevent security issues and ensure compatibility.
|
|
@@ -44,17 +72,32 @@ const SAFE_SCHEMATIC_OPTIONS = new Set([
|
|
|
44
72
|
// Additional safe options
|
|
45
73
|
'dry-run',
|
|
46
74
|
'force',
|
|
47
|
-
'
|
|
75
|
+
'interactive',
|
|
48
76
|
'defaults',
|
|
49
77
|
]);
|
|
50
78
|
/**
|
|
51
|
-
* MCP tool for executing Angular schematics.
|
|
79
|
+
* MCP tool for executing Angular schematics programmatically.
|
|
80
|
+
* Enables AI assistants to run code generation and migration schematics
|
|
81
|
+
* from built-in Angular collections or custom schematic libraries.
|
|
52
82
|
*/
|
|
53
83
|
export class RunSchematicTool {
|
|
54
84
|
name = 'run-schematic';
|
|
55
|
-
|
|
85
|
+
title = 'Run Schematic';
|
|
86
|
+
annotations = {
|
|
87
|
+
readOnlyHint: false,
|
|
88
|
+
destructiveHint: true,
|
|
89
|
+
idempotentHint: false,
|
|
90
|
+
openWorldHint: true,
|
|
91
|
+
};
|
|
92
|
+
description = 'Execute Angular schematics for code generation and automated migrations. ' +
|
|
93
|
+
'The result has the full stdout and stderr; summary is a short text with the outcome, the generated files and, on failure, the last output lines.';
|
|
94
|
+
/**
|
|
95
|
+
* JSON Schema of the tool arguments.
|
|
96
|
+
* @hidden
|
|
97
|
+
*/
|
|
56
98
|
inputSchema = {
|
|
57
99
|
type: 'object',
|
|
100
|
+
additionalProperties: false,
|
|
58
101
|
properties: {
|
|
59
102
|
schematic: {
|
|
60
103
|
type: 'string',
|
|
@@ -87,7 +130,7 @@ export class RunSchematicTool {
|
|
|
87
130
|
},
|
|
88
131
|
skipPrompts: {
|
|
89
132
|
type: 'boolean',
|
|
90
|
-
description: 'Skip interactive prompts',
|
|
133
|
+
description: 'Skip interactive prompts (passes --interactive=false to ng generate)',
|
|
91
134
|
default: true,
|
|
92
135
|
},
|
|
93
136
|
dryRun: {
|
|
@@ -111,7 +154,51 @@ export class RunSchematicTool {
|
|
|
111
154
|
},
|
|
112
155
|
required: ['schematic', 'target'],
|
|
113
156
|
};
|
|
114
|
-
|
|
157
|
+
/**
|
|
158
|
+
* JSON Schema of the tool result (`structuredContent`).
|
|
159
|
+
* @hidden
|
|
160
|
+
*/
|
|
161
|
+
outputSchema = {
|
|
162
|
+
type: 'object',
|
|
163
|
+
properties: {
|
|
164
|
+
success: { type: 'boolean' },
|
|
165
|
+
schematic: { type: 'string' },
|
|
166
|
+
collection: { type: 'string' },
|
|
167
|
+
target: { type: 'string' },
|
|
168
|
+
fullCommand: { type: 'string' },
|
|
169
|
+
exitCode: { type: 'integer' },
|
|
170
|
+
stdout: { type: 'string' },
|
|
171
|
+
stderr: { type: 'string' },
|
|
172
|
+
filesGenerated: STRING_ARRAY,
|
|
173
|
+
conflicts: STRING_ARRAY,
|
|
174
|
+
executionTime: { type: 'number' },
|
|
175
|
+
timedOut: { type: 'boolean' },
|
|
176
|
+
cwd: { type: 'string' },
|
|
177
|
+
warnings: {
|
|
178
|
+
type: 'array',
|
|
179
|
+
items: { type: 'string' },
|
|
180
|
+
description: 'Warnings the schematic printed.',
|
|
181
|
+
},
|
|
182
|
+
summary: { type: 'string' },
|
|
183
|
+
},
|
|
184
|
+
required: [
|
|
185
|
+
'success',
|
|
186
|
+
'schematic',
|
|
187
|
+
'collection',
|
|
188
|
+
'target',
|
|
189
|
+
'fullCommand',
|
|
190
|
+
'exitCode',
|
|
191
|
+
'stdout',
|
|
192
|
+
'stderr',
|
|
193
|
+
'filesGenerated',
|
|
194
|
+
'conflicts',
|
|
195
|
+
'executionTime',
|
|
196
|
+
'cwd',
|
|
197
|
+
'warnings',
|
|
198
|
+
'summary',
|
|
199
|
+
],
|
|
200
|
+
};
|
|
201
|
+
async execute(args, ctx = {}) {
|
|
115
202
|
const params = args;
|
|
116
203
|
// Validate required parameters
|
|
117
204
|
if (!params.schematic || typeof params.schematic !== 'string') {
|
|
@@ -150,13 +237,14 @@ export class RunSchematicTool {
|
|
|
150
237
|
const result = await this.executeSchematic(commandArgs, {
|
|
151
238
|
cwd: projectRoot,
|
|
152
239
|
timeout: executionOptions.timeout ?? 300000,
|
|
240
|
+
signal: ctx.signal,
|
|
153
241
|
});
|
|
154
242
|
const executionTime = Date.now() - startTime;
|
|
155
243
|
// Parse output for generated files and conflicts
|
|
156
244
|
const filesGenerated = this.extractGeneratedFiles(result.stdout);
|
|
157
245
|
const conflicts = this.extractConflicts(result.stderr);
|
|
158
246
|
const warnings = this.extractWarnings(result.stdout, result.stderr);
|
|
159
|
-
return {
|
|
247
|
+
return withSummary({
|
|
160
248
|
success: result.exitCode === 0,
|
|
161
249
|
schematic,
|
|
162
250
|
collection,
|
|
@@ -170,11 +258,11 @@ export class RunSchematicTool {
|
|
|
170
258
|
executionTime,
|
|
171
259
|
cwd: projectRoot,
|
|
172
260
|
warnings,
|
|
173
|
-
};
|
|
261
|
+
});
|
|
174
262
|
}
|
|
175
263
|
catch (error) {
|
|
176
264
|
if (error instanceof Error && error.message.includes('timed out')) {
|
|
177
|
-
return {
|
|
265
|
+
return withSummary({
|
|
178
266
|
success: false,
|
|
179
267
|
schematic,
|
|
180
268
|
collection,
|
|
@@ -189,7 +277,7 @@ export class RunSchematicTool {
|
|
|
189
277
|
timedOut: true,
|
|
190
278
|
cwd: projectRoot,
|
|
191
279
|
warnings: [],
|
|
192
|
-
};
|
|
280
|
+
});
|
|
193
281
|
}
|
|
194
282
|
throw new Error(`Schematic execution failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
195
283
|
}
|
|
@@ -311,8 +399,10 @@ export class RunSchematicTool {
|
|
|
311
399
|
if (executionOptions.force) {
|
|
312
400
|
args.push('--force');
|
|
313
401
|
}
|
|
402
|
+
// ng generate has no --skip-confirmation (only ng add and ng update do);
|
|
403
|
+
// --interactive=false turns the prompts off.
|
|
314
404
|
if (executionOptions.skipPrompts ?? true) {
|
|
315
|
-
args.push('--
|
|
405
|
+
args.push('--interactive=false');
|
|
316
406
|
}
|
|
317
407
|
return args;
|
|
318
408
|
}
|
|
@@ -326,16 +416,19 @@ export class RunSchematicTool {
|
|
|
326
416
|
env: process.env,
|
|
327
417
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
328
418
|
shell: true,
|
|
419
|
+
...processGroupOptions(),
|
|
329
420
|
});
|
|
330
421
|
let stdout = '';
|
|
331
422
|
let stderr = '';
|
|
332
423
|
// Set up timeout
|
|
333
424
|
const timeoutId = setTimeout(() => {
|
|
334
|
-
ngProcess
|
|
425
|
+
terminateProcessTree(ngProcess);
|
|
335
426
|
reject(new Error(`Schematic execution timed out after ${options.timeout}ms`));
|
|
336
427
|
}, options.timeout);
|
|
428
|
+
const stopOnAbort = terminateOnAbort(ngProcess, options.signal);
|
|
337
429
|
const cleanup = () => {
|
|
338
430
|
clearTimeout(timeoutId);
|
|
431
|
+
stopOnAbort();
|
|
339
432
|
};
|
|
340
433
|
ngProcess.stdout.on('data', (data) => {
|
|
341
434
|
stdout += data.toString();
|
|
@@ -345,6 +438,10 @@ export class RunSchematicTool {
|
|
|
345
438
|
});
|
|
346
439
|
ngProcess.on('close', (code) => {
|
|
347
440
|
cleanup();
|
|
441
|
+
if (options.signal?.aborted === true) {
|
|
442
|
+
reject(new Error('Command cancelled'));
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
348
445
|
resolve({
|
|
349
446
|
exitCode: code ?? 0,
|
|
350
447
|
stdout,
|