@ohos-ports/nx 23.3.0-beta.2 → 24.0.2-beta.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 +3 -6
- package/dist/bin/nx.js +2 -2
- package/dist/bin/post-install.js +5 -3
- package/dist/nx-cloud-internals.d.ts +1 -0
- package/dist/nx-cloud-internals.js +7 -1
- package/dist/src/adapter/ngcli-adapter.js +2 -2
- package/dist/src/ai/clone-ai-config-repo.js +49 -12
- package/dist/src/command-line/add/add.d.ts +2 -0
- package/dist/src/command-line/add/add.js +23 -5
- package/dist/src/command-line/affected/affected.js +2 -2
- package/dist/src/command-line/configure-ai-agents/configure-ai-agents.js +0 -12
- package/dist/src/command-line/graph/graph.js +38 -10
- package/dist/src/command-line/init/command-object.js +0 -12
- package/dist/src/command-line/init/implementation/add-nx-to-nest.js +21 -62
- package/dist/src/command-line/init/init-v2.js +0 -2
- package/dist/src/command-line/migrate/agentic/close-agent-session.d.ts +1 -1
- package/dist/src/command-line/migrate/agentic/close-agent-session.js +4 -3
- package/dist/src/command-line/migrate/agentic/definitions.d.ts +1 -3
- package/dist/src/command-line/migrate/agentic/definitions.js +5 -97
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.d.ts +7 -45
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.js +9 -51
- package/dist/src/command-line/migrate/agentic/handoff.d.ts +1 -43
- package/dist/src/command-line/migrate/agentic/handoff.js +3 -119
- package/dist/src/command-line/migrate/agentic/instruction-files.d.ts +0 -21
- package/dist/src/command-line/migrate/agentic/instruction-files.js +6 -27
- package/dist/src/command-line/migrate/agentic/master/run-master-session.d.ts +19 -1
- package/dist/src/command-line/migrate/agentic/master/run-master-session.js +88 -49
- package/dist/src/command-line/migrate/agentic/master/spawn-master.d.ts +1 -0
- package/dist/src/command-line/migrate/agentic/master/spawn-master.js +86 -24
- package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.d.ts +2 -2
- package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.js +2 -2
- package/dist/src/command-line/migrate/agentic/prompts/fragments.d.ts +1 -12
- package/dist/src/command-line/migrate/agentic/prompts/fragments.js +8 -17
- package/dist/src/command-line/migrate/agentic/prompts/shared-rendering.d.ts +0 -15
- package/dist/src/command-line/migrate/agentic/prompts/shared-rendering.js +3 -100
- package/dist/src/command-line/migrate/agentic/select.d.ts +12 -6
- package/dist/src/command-line/migrate/agentic/select.js +38 -8
- package/dist/src/command-line/migrate/agentic/types.d.ts +9 -68
- package/dist/src/command-line/migrate/agentic/types.js +6 -8
- package/dist/src/command-line/migrate/command-object.js +6 -10
- package/dist/src/command-line/migrate/execute-migration.d.ts +6 -6
- package/dist/src/command-line/migrate/execute-migration.js +25 -15
- package/dist/src/command-line/migrate/migrate-analytics.d.ts +18 -1
- package/dist/src/command-line/migrate/migrate-analytics.js +38 -0
- package/dist/src/command-line/migrate/migrate-commits.d.ts +29 -17
- package/dist/src/command-line/migrate/migrate-commits.js +86 -32
- package/dist/src/command-line/migrate/migrate-config.d.ts +6 -6
- package/dist/src/command-line/migrate/migrate-config.js +12 -6
- package/dist/src/command-line/migrate/migrate-output.d.ts +1 -6
- package/dist/src/command-line/migrate/migrate-output.js +1 -10
- package/dist/src/command-line/migrate/migrate.d.ts +6 -30
- package/dist/src/command-line/migrate/migrate.js +257 -255
- package/dist/src/command-line/migrate/resolve-package-version.d.ts +2 -4
- package/dist/src/command-line/migrate/resolve-package-version.js +2 -35
- package/dist/src/command-line/migrate/run/agent-output.d.ts +2 -0
- package/dist/src/command-line/migrate/run/agent-output.js +9 -0
- package/dist/src/command-line/migrate/run/broker.d.ts +14 -5
- package/dist/src/command-line/migrate/run/broker.js +69 -21
- package/dist/src/command-line/migrate/run/clean-retry.js +4 -2
- package/dist/src/command-line/migrate/run/existing-run-report.d.ts +1 -1
- package/dist/src/command-line/migrate/run/existing-run-report.js +7 -5
- package/dist/src/command-line/migrate/run/give-up.d.ts +4 -3
- package/dist/src/command-line/migrate/run/give-up.js +8 -5
- package/dist/src/command-line/migrate/run/index.d.ts +7 -5
- package/dist/src/command-line/migrate/run/index.js +16 -1
- package/dist/src/command-line/migrate/run/issues.js +7 -2
- package/dist/src/command-line/migrate/run/orchestrator.d.ts +61 -4
- package/dist/src/command-line/migrate/run/orchestrator.js +397 -133
- package/dist/src/command-line/migrate/run/run-state.d.ts +17 -1
- package/dist/src/command-line/migrate/run/run-state.js +41 -2
- package/dist/src/command-line/migrate/run/runbook.d.ts +1 -0
- package/dist/src/command-line/migrate/run/runbook.js +115 -18
- package/dist/src/command-line/migrate/run/state-lock.d.ts +29 -4
- package/dist/src/command-line/migrate/run/state-lock.js +102 -10
- package/dist/src/command-line/migrate/run/state-machine.js +4 -1
- package/dist/src/command-line/migrate/run/util.d.ts +7 -2
- package/dist/src/command-line/migrate/run/util.js +30 -3
- package/dist/src/command-line/migrate/run/worker.d.ts +1 -1
- package/dist/src/command-line/migrate/run/worker.js +252 -250
- package/dist/src/command-line/migrate/sort-migrations.d.ts +1 -7
- package/dist/src/command-line/migrate/sort-migrations.js +1 -12
- package/dist/src/command-line/nx-cloud/connect/connect-to-nx-cloud.js +17 -12
- package/dist/src/command-line/release/changelog.js +9 -6
- package/dist/src/command-line/release/config/config.d.ts +1 -0
- package/dist/src/command-line/release/config/config.js +48 -9
- package/dist/src/command-line/release/release.js +2 -2
- package/dist/src/command-line/release/utils/git.js +8 -7
- package/dist/src/command-line/release/utils/interpolate-release-config.d.ts +6 -0
- package/dist/src/command-line/release/utils/interpolate-release-config.js +39 -0
- package/dist/src/command-line/release/utils/release-graph.d.ts +5 -0
- package/dist/src/command-line/release/utils/release-graph.js +1 -0
- package/dist/src/command-line/release/utils/remote-release-clients/github.js +5 -6
- package/dist/src/command-line/release/utils/remote-release-clients/gitlab.js +5 -6
- package/dist/src/command-line/release/utils/resolve-changelog-renderer.js +2 -2
- package/dist/src/command-line/release/utils/shared.js +10 -10
- package/dist/src/command-line/release/utils/version-plan-utils.d.ts +3 -12
- package/dist/src/command-line/release/utils/version-plan-utils.js +33 -55
- package/dist/src/command-line/release/version/version-actions.js +2 -1
- package/dist/src/command-line/release/version.js +5 -2
- package/dist/src/command-line/reset/reset.js +58 -62
- package/dist/src/command-line/run/executor-utils.js +1 -0
- package/dist/src/command-line/run/run-one.d.ts +20 -1
- package/dist/src/command-line/run/run-one.js +153 -5
- package/dist/src/command-line/run/run.js +2 -1
- package/dist/src/command-line/show/projects.js +5 -3
- package/dist/src/command-line/show/show-target/info.d.ts +10 -1
- package/dist/src/command-line/show/show-target/info.js +100 -15
- package/dist/src/command-line/show/show-target/inputs.js +10 -2
- package/dist/src/command-line/show/show-target/utils.js +1 -0
- package/dist/src/command-line/watch/command-object.js +3 -22
- package/dist/src/command-line/watch/watch.d.ts +0 -7
- package/dist/src/command-line/watch/watch.js +1 -1
- package/dist/src/command-line/yargs-utils/shared-options.js +1 -1
- package/dist/src/config/misc-interfaces.d.ts +18 -0
- package/dist/src/config/nx-json.d.ts +22 -11
- package/dist/src/config/task-graph.d.ts +1 -1
- package/dist/src/config/workspace-json-project-json.d.ts +88 -0
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/core/graph/runtime.js +1 -1
- package/dist/src/core/graph/styles.css +1 -1
- package/dist/src/core/graph/styles.js +1 -1
- package/dist/src/daemon/client/client.d.ts +15 -0
- package/dist/src/daemon/client/client.js +181 -71
- package/dist/src/daemon/client/daemon-socket-messenger.d.ts +1 -1
- package/dist/src/daemon/client/daemon-socket-messenger.js +2 -2
- package/dist/src/daemon/server/client-socket-context.js +1 -1
- package/dist/src/daemon/server/handle-process-in-background.js +21 -9
- package/dist/src/daemon/server/handle-select-affected-tasks.d.ts +2 -1
- package/dist/src/daemon/server/handle-select-affected-tasks.js +21 -13
- package/dist/src/daemon/server/native-js-loader.d.ts +1 -0
- package/dist/src/daemon/server/native-js-loader.js +21 -0
- package/dist/src/daemon/server/project-graph-incremental-recomputation.js +4 -8
- package/dist/src/daemon/server/server.d.ts +2 -1
- package/dist/src/daemon/server/server.js +17 -4
- package/dist/src/daemon/server/shutdown-utils.js +0 -3
- package/dist/src/daemon/server/start.d.ts +1 -0
- package/dist/src/daemon/server/start.js +2 -0
- package/dist/src/daemon/socket-utils.d.ts +11 -9
- package/dist/src/daemon/socket-utils.js +31 -61
- package/dist/src/daemon/tmp-dir.d.ts +19 -14
- package/dist/src/daemon/tmp-dir.js +142 -354
- package/dist/src/devkit-exports.d.ts +9 -1
- package/dist/src/devkit-exports.js +12 -1
- package/dist/src/devkit-internals.d.ts +6 -5
- package/dist/src/devkit-internals.js +13 -4
- package/dist/src/executors/run-commands/run-commands.impl.d.ts +4 -2
- package/dist/src/executors/run-commands/run-commands.impl.js +53 -27
- package/dist/src/executors/run-commands/running-tasks.d.ts +13 -4
- package/dist/src/executors/run-commands/running-tasks.js +148 -95
- package/dist/src/executors/run-commands/schema.json +1 -1
- package/dist/src/hasher/check-task-files.js +5 -8
- package/dist/src/hasher/file-hasher.js +9 -7
- package/dist/src/hasher/hash-task.js +4 -0
- package/dist/src/hasher/native-task-hasher-impl.js +3 -1
- package/dist/src/hasher/task-hasher.d.ts +2 -0
- package/dist/src/hasher/task-hasher.js +4 -1
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.d.ts +1 -2
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.js +6 -11
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.md +2 -2
- package/dist/src/migrations/update-24-0-0/enable-legacy-affected.d.ts +4 -0
- package/dist/src/migrations/update-24-0-0/enable-legacy-affected.js +15 -0
- package/dist/src/migrations/update-24-0-0/enable-legacy-affected.md +30 -0
- package/dist/src/migrations/update-24-0-0/find-custom-hashers.d.ts +3 -0
- package/dist/src/migrations/update-24-0-0/find-custom-hashers.js +100 -0
- package/dist/src/migrations/update-24-0-0/find-custom-hashers.md +63 -0
- package/dist/src/migrations/update-24-0-0/move-custom-hashers-to-inputs.md +146 -0
- package/dist/src/migrations/update-24-0-0/rename-ultracache-ignore-options.d.ts +3 -0
- package/dist/src/migrations/update-24-0-0/rename-ultracache-ignore-options.js +130 -0
- package/dist/src/migrations/update-24-0-0/rename-ultracache-ignore-options.md +62 -0
- package/dist/src/native/assert-supported-platform.js +1 -1
- package/dist/src/native/index.d.ts +238 -18
- package/dist/src/native/index.js +6 -1
- package/dist/src/native/native-bindings.js +15 -6
- package/dist/src/native/nx.openharmony-arm64.node +0 -0
- package/dist/src/native/nx.wasi-browser.js +1 -0
- package/dist/src/native/nx.wasi.cjs +1 -0
- package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
- package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
- package/dist/src/nx-cloud/update-manager.d.ts +14 -0
- package/dist/src/nx-cloud/update-manager.js +237 -50
- package/dist/src/plugins/js/lock-file/pnpm-parser.js +3 -4
- package/dist/src/plugins/js/lock-file/pruned-output.d.ts +2 -2
- package/dist/src/plugins/js/lock-file/pruned-output.js +4 -4
- package/dist/src/plugins/js/utils/register.js +9 -4
- package/dist/src/project-graph/affected/affected-tasks.d.ts +9 -6
- package/dist/src/project-graph/affected/affected-tasks.js +31 -7
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +7 -0
- package/dist/src/project-graph/plugins/loaded-nx-plugin.js +49 -6
- package/dist/src/project-graph/utils/project-configuration/target-merging.js +1 -1
- package/dist/src/project-graph/utils/project-configuration/target-normalization.js +12 -133
- package/dist/src/project-graph/utils/project-configuration-utils.js +2 -2
- package/dist/src/project-graph/utils/retrieve-workspace-files.js +27 -6
- package/dist/src/tasks-runner/create-task-graph.d.ts +8 -7
- package/dist/src/tasks-runner/create-task-graph.js +50 -27
- package/dist/src/tasks-runner/default-tasks-runner.js +1 -1
- package/dist/src/tasks-runner/init-tasks-runner.js +116 -59
- package/dist/src/tasks-runner/life-cycle.d.ts +4 -1
- package/dist/src/tasks-runner/life-cycle.js +7 -0
- package/dist/src/tasks-runner/life-cycles/performance-analysis.d.ts +5 -2
- package/dist/src/tasks-runner/life-cycles/performance-analysis.js +13 -7
- package/dist/src/tasks-runner/life-cycles/performance-life-cycle.d.ts +4 -3
- package/dist/src/tasks-runner/life-cycles/performance-life-cycle.js +9 -2
- package/dist/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.js +5 -2
- package/dist/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.js +4 -1
- package/dist/src/tasks-runner/life-cycles/summary-terminal-output-life-cycle.js +5 -1
- package/dist/src/tasks-runner/pseudo-ipc.d.ts +1 -0
- package/dist/src/tasks-runner/pseudo-ipc.js +4 -0
- package/dist/src/tasks-runner/pseudo-terminal.d.ts +1 -1
- package/dist/src/tasks-runner/pseudo-terminal.js +2 -2
- package/dist/src/tasks-runner/readiness/executor-ready-signal.d.ts +7 -0
- package/dist/src/tasks-runner/readiness/executor-ready-signal.js +43 -0
- package/dist/src/tasks-runner/readiness/probes.d.ts +14 -0
- package/dist/src/tasks-runner/readiness/probes.js +101 -0
- package/dist/src/tasks-runner/readiness/ready-signal-server.d.ts +18 -0
- package/dist/src/tasks-runner/readiness/ready-signal-server.js +72 -0
- package/dist/src/tasks-runner/readiness/ready-signal.d.ts +33 -0
- package/dist/src/tasks-runner/readiness/ready-signal.js +92 -0
- package/dist/src/tasks-runner/readiness/ready-when.d.ts +84 -0
- package/dist/src/tasks-runner/readiness/ready-when.js +371 -0
- package/dist/src/tasks-runner/readiness/startup-host.d.ts +1 -0
- package/dist/src/tasks-runner/readiness/startup-host.js +32 -0
- package/dist/src/tasks-runner/run-command.d.ts +6 -2
- package/dist/src/tasks-runner/run-command.js +21 -31
- package/dist/src/tasks-runner/run-outcome.d.ts +16 -0
- package/dist/src/tasks-runner/run-outcome.js +39 -0
- package/dist/src/tasks-runner/running-tasks/batch-process.js +6 -0
- package/dist/src/tasks-runner/running-tasks/node-child-process.js +5 -4
- package/dist/src/tasks-runner/running-tasks/running-task.d.ts +1 -1
- package/dist/src/tasks-runner/task-env.d.ts +10 -0
- package/dist/src/tasks-runner/task-env.js +37 -5
- package/dist/src/tasks-runner/task-graph-utils.d.ts +9 -6
- package/dist/src/tasks-runner/task-graph-utils.js +17 -12
- package/dist/src/tasks-runner/task-orchestrator.d.ts +62 -18
- package/dist/src/tasks-runner/task-orchestrator.js +750 -150
- package/dist/src/tasks-runner/tasks-runner.d.ts +1 -1
- package/dist/src/tasks-runner/tasks-schedule.d.ts +18 -1
- package/dist/src/tasks-runner/tasks-schedule.js +63 -6
- package/dist/src/tasks-runner/tokens.d.ts +54 -0
- package/dist/src/tasks-runner/tokens.js +161 -0
- package/dist/src/tasks-runner/utils.d.ts +35 -6
- package/dist/src/tasks-runner/utils.js +149 -68
- package/dist/src/ultracache/ci-status.d.ts +24 -0
- package/dist/src/ultracache/ci-status.js +87 -0
- package/dist/src/ultracache/config.d.ts +3 -3
- package/dist/src/ultracache/config.js +4 -4
- package/dist/src/ultracache/fetch.d.ts +2 -0
- package/dist/src/ultracache/fetch.js +1 -0
- package/dist/src/ultracache/overrides.js +4 -0
- package/dist/src/utils/acknowledge-build-scripts.d.ts +34 -1
- package/dist/src/utils/acknowledge-build-scripts.js +171 -32
- package/dist/src/utils/child-process.js +2 -1
- package/dist/src/utils/find-matching-projects.js +9 -6
- package/dist/src/utils/git-utils.d.ts +12 -5
- package/dist/src/utils/git-utils.js +69 -11
- package/dist/src/utils/long-running-target.d.ts +1 -3
- package/dist/src/utils/long-running-target.js +1 -3
- package/dist/src/utils/output.d.ts +4 -3
- package/dist/src/utils/output.js +4 -3
- package/dist/src/utils/owned-private-dir.d.ts +1 -17
- package/dist/src/utils/owned-private-dir.js +10 -62
- package/dist/src/utils/package-manager.d.ts +8 -0
- package/dist/src/utils/package-manager.js +65 -8
- package/dist/src/utils/perf-hooks.d.ts +1 -0
- package/dist/src/utils/plugins/core-plugins.js +5 -1
- package/dist/src/utils/progress-topics.d.ts +1 -0
- package/dist/src/utils/progress-topics.js +1 -0
- package/dist/src/utils/safe-spawn.js +1 -5
- package/dist/src/utils/shell-quoting.d.ts +8 -1
- package/dist/src/utils/shell-quoting.js +12 -1
- package/dist/src/utils/spawn-without-terminal.d.ts +27 -0
- package/dist/src/utils/spawn-without-terminal.js +110 -0
- package/dist/src/utils/string-similarity.d.ts +38 -0
- package/dist/src/utils/string-similarity.js +108 -0
- package/migrations.json +20 -6
- package/package.json +15 -24
- package/schemas/migrations-schema.json +11 -0
- package/schemas/nx-schema.json +133 -11
- package/schemas/project-schema.json +114 -4
- package/dist/src/command-line/migrate/agentic/prompts/generic-validation.d.ts +0 -56
- package/dist/src/command-line/migrate/agentic/prompts/generic-validation.js +0 -67
- package/dist/src/command-line/migrate/agentic/prompts/hybrid-prompt-migration.d.ts +0 -49
- package/dist/src/command-line/migrate/agentic/prompts/hybrid-prompt-migration.js +0 -53
- package/dist/src/command-line/migrate/agentic/prompts/prompt-migration.d.ts +0 -26
- package/dist/src/command-line/migrate/agentic/prompts/prompt-migration.js +0 -27
- package/dist/src/command-line/migrate/agentic/prompts/system-prompt.d.ts +0 -70
- package/dist/src/command-line/migrate/agentic/prompts/system-prompt.js +0 -113
- package/dist/src/command-line/migrate/agentic/run-step.d.ts +0 -68
- package/dist/src/command-line/migrate/agentic/run-step.js +0 -148
- package/dist/src/command-line/migrate/agentic/runner.d.ts +0 -21
- package/dist/src/command-line/migrate/agentic/runner.js +0 -262
- package/dist/src/migrations/update-23-0-0/consolidate-release-tag-config.d.ts +0 -9
- package/dist/src/migrations/update-23-0-0/consolidate-release-tag-config.js +0 -18
- package/dist/src/tasks-runner/legacy-depends-on-warning.d.ts +0 -18
- package/dist/src/tasks-runner/legacy-depends-on-warning.js +0 -109
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.runAgenticPromptStep = runAgenticPromptStep;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const path_1 = require("path");
|
|
6
|
-
const pc = tslib_1.__importStar(require("picocolors"));
|
|
7
|
-
const child_process_1 = require("../../../utils/child-process");
|
|
8
|
-
const logger_1 = require("../../../utils/logger");
|
|
9
|
-
const package_manager_1 = require("../../../utils/package-manager");
|
|
10
|
-
const migrate_output_1 = require("../migrate-output");
|
|
11
|
-
const format_command_1 = require("./format-command");
|
|
12
|
-
const handoff_1 = require("./handoff");
|
|
13
|
-
const instruction_files_1 = require("./instruction-files");
|
|
14
|
-
const generic_validation_1 = require("./prompts/generic-validation");
|
|
15
|
-
const hybrid_prompt_migration_1 = require("./prompts/hybrid-prompt-migration");
|
|
16
|
-
const prompt_migration_1 = require("./prompts/prompt-migration");
|
|
17
|
-
const system_prompt_1 = require("./prompts/system-prompt");
|
|
18
|
-
const definitions_1 = require("./definitions");
|
|
19
|
-
const runner_1 = require("./runner");
|
|
20
|
-
const types_1 = require("./types");
|
|
21
|
-
/**
|
|
22
|
-
* Spawns the configured AI agent against a migration step, awaits its handoff,
|
|
23
|
-
* and translates the outcome into a structured result the executor can branch
|
|
24
|
-
* on. Throws on failure / abort; returns a result with `ambiguous` set when
|
|
25
|
-
* the agent exited without writing a handoff and the user chose to continue.
|
|
26
|
-
*
|
|
27
|
-
* `installDepsIfChanged` is a callback rather than a `ChangedDepInstaller`
|
|
28
|
-
* instance so this module stays decoupled from the executor's internal state.
|
|
29
|
-
* The structural `migration` type captures only the fields read here, keeping
|
|
30
|
-
* the file free of cross-imports with the orchestrator.
|
|
31
|
-
*/
|
|
32
|
-
async function runAgenticPromptStep(input) {
|
|
33
|
-
const { root, migration, agentic, runDir, installDepsIfChanged, implContext, documentationPath, mode = 'author', } = input;
|
|
34
|
-
const handoffFilePath = (0, handoff_1.stepHandoffPath)(runDir, migration);
|
|
35
|
-
// The system prompt tells the agent the parent dir exists, so the agent
|
|
36
|
-
// doesn't defensively `mkdir -p` (which triggers a workspace-permission
|
|
37
|
-
// prompt in agents like Claude Code every run).
|
|
38
|
-
(0, handoff_1.mkdirSafely)((0, path_1.dirname)(handoffFilePath), `handoff directory for ${migration.name}`);
|
|
39
|
-
const pm = (0, package_manager_1.detectPackageManager)(root);
|
|
40
|
-
const pmCommand = (0, package_manager_1.getPackageManagerCommand)(pm, root);
|
|
41
|
-
const systemPrompt = (0, system_prompt_1.buildSystemPrompt)({
|
|
42
|
-
workspaceRoot: root,
|
|
43
|
-
handoffFileAbsolutePath: handoffFilePath,
|
|
44
|
-
packageManager: pm,
|
|
45
|
-
nxInvocation: (0, child_process_1.getRunNxBaseCommand)(pmCommand, root),
|
|
46
|
-
mode,
|
|
47
|
-
pmExec: pmCommand.exec,
|
|
48
|
-
// Validation prompts carry no format rule, so don't probe the workspace
|
|
49
|
-
// (detectFormatter can warn) for a command the prompt would discard.
|
|
50
|
-
formatCommand: mode === 'generic-validation'
|
|
51
|
-
? null
|
|
52
|
-
: (0, format_command_1.resolveFormatCommand)(root, pmCommand.exec),
|
|
53
|
-
});
|
|
54
|
-
let userPrompt;
|
|
55
|
-
if (mode === 'generic-validation') {
|
|
56
|
-
if (!implContext) {
|
|
57
|
-
throw new Error(`Internal error: generic-validation mode requires impl context (logs, changes, agentContext, hasDiffContext) but none was provided.`);
|
|
58
|
-
}
|
|
59
|
-
userPrompt = (0, generic_validation_1.buildGenericValidationUserPrompt)({
|
|
60
|
-
package: migration.package,
|
|
61
|
-
name: migration.name,
|
|
62
|
-
version: migration.version,
|
|
63
|
-
description: migration.description,
|
|
64
|
-
handoffFileAbsolutePath: handoffFilePath,
|
|
65
|
-
documentationPath,
|
|
66
|
-
impl: implContext,
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
const promptCtx = {
|
|
71
|
-
package: migration.package,
|
|
72
|
-
name: migration.name,
|
|
73
|
-
version: migration.version,
|
|
74
|
-
description: migration.description,
|
|
75
|
-
promptPath: migration.prompt,
|
|
76
|
-
handoffFileAbsolutePath: handoffFilePath,
|
|
77
|
-
documentationPath,
|
|
78
|
-
};
|
|
79
|
-
userPrompt = implContext
|
|
80
|
-
? (0, hybrid_prompt_migration_1.buildHybridPromptUserPrompt)({ ...promptCtx, impl: implContext })
|
|
81
|
-
: (0, prompt_migration_1.buildPromptMigrationUserPrompt)(promptCtx);
|
|
82
|
-
}
|
|
83
|
-
const definition = (0, definitions_1.getAgentDefinition)(agentic.selectedAgent.id);
|
|
84
|
-
if (!definition) {
|
|
85
|
-
throw new Error(`No agent definition registered for "${agentic.selectedAgent.id}".`);
|
|
86
|
-
}
|
|
87
|
-
const { systemPromptFilePath, instructionsPointer } = (0, instruction_files_1.writeStepInstructionFiles)({
|
|
88
|
-
workspaceRoot: root,
|
|
89
|
-
runDir,
|
|
90
|
-
migration,
|
|
91
|
-
systemPrompt,
|
|
92
|
-
instructions: userPrompt,
|
|
93
|
-
});
|
|
94
|
-
const phase = mode === 'generic-validation' ? 'Validating' : 'Running prompt';
|
|
95
|
-
logger_1.logger.info(pc.dim(`→ ${phase} with ${agentic.selectedAgent.displayName}…`));
|
|
96
|
-
const outcome = await (0, runner_1.runAgentic)({
|
|
97
|
-
detected: agentic.selectedAgent,
|
|
98
|
-
definition,
|
|
99
|
-
invocationContext: {
|
|
100
|
-
systemPrompt,
|
|
101
|
-
systemPromptFilePath,
|
|
102
|
-
instructionsPointer,
|
|
103
|
-
inlineSystemContext: (0, system_prompt_1.buildInlineSystemContext)({
|
|
104
|
-
handoffFileAbsolutePath: handoffFilePath,
|
|
105
|
-
systemPromptFilePath,
|
|
106
|
-
}),
|
|
107
|
-
inlineSystemContextFallback: (0, system_prompt_1.buildMinimalSystemContext)(systemPromptFilePath),
|
|
108
|
-
workspaceRoot: root,
|
|
109
|
-
runDirName: (0, path_1.basename)(runDir),
|
|
110
|
-
},
|
|
111
|
-
handoffFilePath,
|
|
112
|
-
handoffsDir: (0, path_1.join)(runDir, types_1.HANDOFFS_DIR_NAME),
|
|
113
|
-
});
|
|
114
|
-
// Some agent TUIs leave cursor/SGR state behind on exit. Reset before our
|
|
115
|
-
// own log lines so the outcome line lands clean instead of overlaid on the
|
|
116
|
-
// agent's trailing status bar.
|
|
117
|
-
(0, migrate_output_1.resetSgrAfterAgent)();
|
|
118
|
-
switch (outcome.kind) {
|
|
119
|
-
case 'success':
|
|
120
|
-
await installDepsIfChanged();
|
|
121
|
-
return { summary: outcome.summary, ambiguous: false };
|
|
122
|
-
case 'ambiguous-continue':
|
|
123
|
-
await installDepsIfChanged();
|
|
124
|
-
return {
|
|
125
|
-
summary: 'No handoff file was written; marked complete by user.',
|
|
126
|
-
ambiguous: true,
|
|
127
|
-
};
|
|
128
|
-
case 'failed': {
|
|
129
|
-
const failLabel = mode === 'generic-validation' ? 'Validation failed' : 'Failed';
|
|
130
|
-
logger_1.logger.info(`${pc.red('✗')} ${failLabel}: ${outcome.summary}`);
|
|
131
|
-
throw new Error(`Prompt migration ${migration.package}: ${migration.name} failed.`);
|
|
132
|
-
}
|
|
133
|
-
case 'ambiguous-abort':
|
|
134
|
-
// When Ctrl+C masked an underlying crash, the runner forwards the
|
|
135
|
-
// pre-rendered cause lines so we surface them before "Aborted by
|
|
136
|
-
// user" — otherwise the user sees only "aborted" with no signal that
|
|
137
|
-
// anything also crashed. When the abort came from the user picking
|
|
138
|
-
// "abort" at the prompt, the cause was already shown there.
|
|
139
|
-
if (outcome.causeSummary && outcome.causeSummary.length > 0) {
|
|
140
|
-
logger_1.logger.info(pc.dim('The agent run ended without a usable handoff:'));
|
|
141
|
-
for (const line of outcome.causeSummary) {
|
|
142
|
-
logger_1.logger.info(pc.dim(` ${line}`));
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
logger_1.logger.info(`${pc.red('✗')} Aborted by user.`);
|
|
146
|
-
throw new Error(`Prompt migration ${migration.package}: ${migration.name} was aborted by user.`);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { AgentDefinition, DetectedInstalledAgent, HandoffOutcome, InvocationContext } from './types';
|
|
2
|
-
export interface RunAgenticArgs {
|
|
3
|
-
detected: DetectedInstalledAgent;
|
|
4
|
-
definition: AgentDefinition;
|
|
5
|
-
invocationContext: InvocationContext;
|
|
6
|
-
handoffFilePath: string;
|
|
7
|
-
/** Directory the handoff sits in; passing a parent instead skips the symlink guard. */
|
|
8
|
-
handoffsDir: string;
|
|
9
|
-
/** Override the handoff-file poll interval (test seam). */
|
|
10
|
-
handoffPollIntervalMs?: number;
|
|
11
|
-
/** Override the SIGINT-to-SIGKILL grace period (test seam). */
|
|
12
|
-
gracefulExitMs?: number;
|
|
13
|
-
/** Override the post-force-kill safety bound (test seam). */
|
|
14
|
-
forceKillWaitMs?: number;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Spawns the selected agent with `stdio: 'inherit'`, swallows SIGINT while the
|
|
18
|
-
* child is alive, waits for it to exit, and resolves the run's outcome from
|
|
19
|
-
* the handoff file (or the user when the file is missing).
|
|
20
|
-
*/
|
|
21
|
-
export declare function runAgentic(args: RunAgenticArgs): Promise<HandoffOutcome>;
|
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.runAgentic = runAgentic;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const child_process_1 = require("child_process");
|
|
6
|
-
const pc = tslib_1.__importStar(require("picocolors"));
|
|
7
|
-
const logger_1 = require("../../../utils/logger");
|
|
8
|
-
const output_1 = require("../../../utils/output");
|
|
9
|
-
const migrate_analytics_1 = require("../migrate-analytics");
|
|
10
|
-
const safe_prompt_1 = require("../safe-prompt");
|
|
11
|
-
const close_agent_session_1 = require("./close-agent-session");
|
|
12
|
-
const handoff_1 = require("./handoff");
|
|
13
|
-
const terminal_repair_1 = require("./terminal-repair");
|
|
14
|
-
const windows_cmd_1 = require("./windows-cmd");
|
|
15
|
-
/**
|
|
16
|
-
* Spawns the selected agent with `stdio: 'inherit'`, swallows SIGINT while the
|
|
17
|
-
* child is alive, waits for it to exit, and resolves the run's outcome from
|
|
18
|
-
* the handoff file (or the user when the file is missing).
|
|
19
|
-
*/
|
|
20
|
-
async function runAgentic(args) {
|
|
21
|
-
const { detected, definition, invocationContext, handoffFilePath, handoffsDir, handoffPollIntervalMs, gracefulExitMs = close_agent_session_1.AGENT_GRACEFUL_EXIT_MS, forceKillWaitMs = close_agent_session_1.FORCE_KILL_WAIT_MS, } = args;
|
|
22
|
-
const adapted = adaptWithinCommandLineBudget(detected, definition, invocationContext);
|
|
23
|
-
let child;
|
|
24
|
-
// Local alias so `@nx/workspace-require-windows-hide` recognizes the
|
|
25
|
-
// options arg as a tracked Identifier rather than giving up on a
|
|
26
|
-
// member-expression skip — keeps the lint rule strict on other call sites.
|
|
27
|
-
const spawnOptions = adapted.options;
|
|
28
|
-
try {
|
|
29
|
-
child = (0, child_process_1.spawn)(adapted.binary, adapted.args, spawnOptions);
|
|
30
|
-
}
|
|
31
|
-
catch (err) {
|
|
32
|
-
return resolveFromHandoffOrPrompt(handoffFilePath, handoffsDir, false, {
|
|
33
|
-
spawnError: err instanceof Error ? err.message : String(err),
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
// Counts SIGINTs while the agent runs. Non-zero after exit means the
|
|
37
|
-
// user pressed Ctrl+C → skip the ambiguous abort/continue prompt. Prompting
|
|
38
|
-
// in the TTY state left by a SIGINT-killed child misbehaved under enquirer
|
|
39
|
-
// (ERR_USE_AFTER_CLOSE, setRawMode EIO) from async chains `await` could not
|
|
40
|
-
// catch. Whether @clack/prompts shares that fault is unverified, so the skip
|
|
41
|
-
// stays; reproducing it needs a real terminal.
|
|
42
|
-
let userInterruptCount = 0;
|
|
43
|
-
const swallowSigint = () => {
|
|
44
|
-
userInterruptCount++;
|
|
45
|
-
};
|
|
46
|
-
process.on('SIGINT', swallowSigint);
|
|
47
|
-
const handoffWatchAbort = new AbortController();
|
|
48
|
-
const exitPromise = (0, close_agent_session_1.waitForExit)(child);
|
|
49
|
-
const handoffPromise = (0, handoff_1.waitForValidHandoff)(handoffFilePath, handoffsDir, {
|
|
50
|
-
signal: handoffWatchAbort.signal,
|
|
51
|
-
intervalMs: handoffPollIntervalMs,
|
|
52
|
-
});
|
|
53
|
-
let exitInfo = {};
|
|
54
|
-
try {
|
|
55
|
-
const winner = await Promise.race([
|
|
56
|
-
exitPromise.then((info) => {
|
|
57
|
-
exitInfo = info;
|
|
58
|
-
return 'exit';
|
|
59
|
-
}),
|
|
60
|
-
// Rejection handler swallows the abort-triggered rejection from the
|
|
61
|
-
// `finally` block after the race has settled — otherwise Node logs it
|
|
62
|
-
// as an unhandled rejection.
|
|
63
|
-
handoffPromise.then(() => 'handoff', () => 'exit'),
|
|
64
|
-
]);
|
|
65
|
-
if (winner === 'handoff') {
|
|
66
|
-
await (0, close_agent_session_1.closeAgentSession)(child, exitPromise, gracefulExitMs, forceKillWaitMs);
|
|
67
|
-
// Extra safety bound so the orchestrator can't hang if the child
|
|
68
|
-
// stays stuck after SIGKILL / taskkill (e.g. D-state on a hung NFS
|
|
69
|
-
// read, or taskkill returning before the process actually exits).
|
|
70
|
-
await (0, close_agent_session_1.raceWithTimeout)(exitPromise, forceKillWaitMs);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
finally {
|
|
74
|
-
handoffWatchAbort.abort();
|
|
75
|
-
process.removeListener('SIGINT', swallowSigint);
|
|
76
|
-
(0, terminal_repair_1.restoreTermiosAfterAgent)();
|
|
77
|
-
}
|
|
78
|
-
return resolveFromHandoffOrPrompt(handoffFilePath, handoffsDir, userInterruptCount > 0, exitInfoToCause(exitInfo));
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Builds Windows shim arguments within budget, trying the shorter context
|
|
82
|
-
* before aborting. Rejects overflow to avoid truncated instructions.
|
|
83
|
-
* Leaves command lines unmeasured off the shim path.
|
|
84
|
-
*/
|
|
85
|
-
function adaptWithinCommandLineBudget(detected, definition, invocationContext) {
|
|
86
|
-
const adapt = (ctx) => {
|
|
87
|
-
const spec = definition.buildInteractive(ctx);
|
|
88
|
-
return (0, windows_cmd_1.adaptSpawnForWindowsShim)(detected.binary, spec.args, {
|
|
89
|
-
stdio: 'inherit',
|
|
90
|
-
cwd: spec.cwd ?? ctx.workspaceRoot,
|
|
91
|
-
env: spec.env ? { ...process.env, ...spec.env } : process.env,
|
|
92
|
-
windowsHide: true,
|
|
93
|
-
});
|
|
94
|
-
};
|
|
95
|
-
const adapted = adapt(invocationContext);
|
|
96
|
-
if ((0, windows_cmd_1.withinCommandLineBudget)(adapted)) {
|
|
97
|
-
return adapted;
|
|
98
|
-
}
|
|
99
|
-
const reduced = adapt({
|
|
100
|
-
...invocationContext,
|
|
101
|
-
inlineSystemContext: invocationContext.inlineSystemContextFallback,
|
|
102
|
-
});
|
|
103
|
-
if ((0, windows_cmd_1.withinCommandLineBudget)(reduced)) {
|
|
104
|
-
logger_1.logger.info(pc.dim(` Passing the agent a reduced system context. The full one does not fit on a Windows command line alongside these paths.`));
|
|
105
|
-
return reduced;
|
|
106
|
-
}
|
|
107
|
-
output_1.output.error({
|
|
108
|
-
title: `${detected.displayName} cannot be started for this migration step`,
|
|
109
|
-
bodyLines: [
|
|
110
|
-
`Launching it needs a ${reduced.commandLineLength}-character command line. cmd.exe runs at most ${windows_cmd_1.WINDOWS_COMMAND_LINE_LIMIT} characters, and nx stops at ${windows_cmd_1.WINDOWS_COMMAND_LINE_BUDGET} to leave room for what it cannot measure from here.`,
|
|
111
|
-
`The length is paths: the workspace root, at ${invocationContext.workspaceRoot.length} characters, and the migration's package and name, each repeated across several of them.`,
|
|
112
|
-
``,
|
|
113
|
-
`Re-run with \`--agentic=false\` to apply the remaining migrations yourself. Moving the workspace to a shorter path can help too, but only for agents that put it on the command line.`,
|
|
114
|
-
],
|
|
115
|
-
});
|
|
116
|
-
throw new Error(`Cannot start ${detected.displayName}: the command line exceeds the Windows limit.`);
|
|
117
|
-
}
|
|
118
|
-
function exitInfoToCause(info) {
|
|
119
|
-
const cause = {};
|
|
120
|
-
// Include `code === 0` so the prompt can distinguish "agent exited cleanly
|
|
121
|
-
// without writing a handoff" (likely the user closed the agent on purpose,
|
|
122
|
-
// or the agent terminated without invoking the handoff step) from "agent
|
|
123
|
-
// was killed before it could write" (signal) or "agent crashed" (non-zero
|
|
124
|
-
// code). Without this distinction every clean-exit-no-handoff collapses
|
|
125
|
-
// into the same uninformative ambiguous-prompt body.
|
|
126
|
-
if (info.code !== undefined && info.code !== null) {
|
|
127
|
-
cause.exitCode = info.code;
|
|
128
|
-
}
|
|
129
|
-
if (info.signal)
|
|
130
|
-
cause.exitSignal = info.signal;
|
|
131
|
-
if (info.error)
|
|
132
|
-
cause.exitError = info.error.message;
|
|
133
|
-
return cause;
|
|
134
|
-
}
|
|
135
|
-
async function resolveFromHandoffOrPrompt(handoffFilePath, handoffsDir, userInterrupted = false, cause = {}) {
|
|
136
|
-
const read = (0, handoff_1.readHandoffWithReason)(handoffFilePath, handoffsDir);
|
|
137
|
-
if (read.ok === true) {
|
|
138
|
-
return {
|
|
139
|
-
kind: read.handoff.status,
|
|
140
|
-
summary: read.handoff.summary,
|
|
141
|
-
extras: read.handoff.extras,
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
const fullCause = {
|
|
145
|
-
...cause,
|
|
146
|
-
handoff: { reason: read.reason, detail: read.detail },
|
|
147
|
-
};
|
|
148
|
-
if (userInterrupted) {
|
|
149
|
-
// User pressed Ctrl+C. Don't show the abort/continue prompt — they
|
|
150
|
-
// already told us what they want. Prompting in the TTY state left by a
|
|
151
|
-
// SIGINT-killed child also tripped enquirer's setRawMode-EIO and
|
|
152
|
-
// ERR_USE_AFTER_CLOSE bugs; whether @clack/prompts shares that fault is
|
|
153
|
-
// unverified, so the skip stays. The orchestrator's standard failure
|
|
154
|
-
// cascade surfaces the abort outcome.
|
|
155
|
-
//
|
|
156
|
-
// After user interruption, suppress conventional stop statuses and retain
|
|
157
|
-
// independent failure diagnostics for the caller to display.
|
|
158
|
-
const exitWasCtrlC = cause.exitCode === 130 ||
|
|
159
|
-
cause.exitCode === 143 ||
|
|
160
|
-
cause.exitSignal === 'SIGINT' ||
|
|
161
|
-
cause.exitSignal === 'SIGTERM';
|
|
162
|
-
const userScrubbed = {
|
|
163
|
-
exitError: cause.exitError,
|
|
164
|
-
exitCode: exitWasCtrlC ? undefined : cause.exitCode,
|
|
165
|
-
exitSignal: exitWasCtrlC ? undefined : cause.exitSignal,
|
|
166
|
-
handoff: read.reason === 'missing'
|
|
167
|
-
? undefined
|
|
168
|
-
: { reason: read.reason, detail: read.detail },
|
|
169
|
-
};
|
|
170
|
-
const causeSummary = describeAmbiguousCause(userScrubbed);
|
|
171
|
-
return {
|
|
172
|
-
kind: 'ambiguous-abort',
|
|
173
|
-
...(causeSummary.length > 0 && { causeSummary }),
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
return promptAmbiguous(fullCause);
|
|
177
|
-
}
|
|
178
|
-
async function promptAmbiguous(cause) {
|
|
179
|
-
// stderr blank line so the spacer lands in the same stream as output.warn
|
|
180
|
-
// and the prompt — buffered stdout could otherwise reorder it and glue the
|
|
181
|
-
// prompt to the agent's trailing exit message.
|
|
182
|
-
process.stderr.write('\n');
|
|
183
|
-
// Cause rendered ABOVE the prompt rather than inlined into its message:
|
|
184
|
-
// enquirer's select redraw used different math for clear (wrap-aware) vs
|
|
185
|
-
// restore (raw \n-split count), so a multi-line message could leave orphaned
|
|
186
|
-
// cells on arrow-key re-renders. Kept single-line because that constraint is
|
|
187
|
-
// unverified under @clack/prompts, not because the cause still applies.
|
|
188
|
-
const causeLines = describeAmbiguousCause(cause);
|
|
189
|
-
if (causeLines.length > 0) {
|
|
190
|
-
output_1.output.warn({
|
|
191
|
-
title: 'The agent run ended without a usable handoff',
|
|
192
|
-
bodyLines: causeLines,
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
// Cancelling exits 130 from inside the prompt; any other rejection is an
|
|
196
|
-
// abort.
|
|
197
|
-
try {
|
|
198
|
-
const choice = await (0, safe_prompt_1.migrateChoice)({
|
|
199
|
-
message: 'How should nx migrate proceed?',
|
|
200
|
-
choices: [
|
|
201
|
-
{ value: 'abort', label: 'Treat as failed — abort the run' },
|
|
202
|
-
{
|
|
203
|
-
value: 'continue',
|
|
204
|
-
label: 'Treat as completed — mark done and continue',
|
|
205
|
-
},
|
|
206
|
-
],
|
|
207
|
-
});
|
|
208
|
-
(0, migrate_analytics_1.reportMigratePrompt)('ambiguous_agent_outcome', choice);
|
|
209
|
-
return choice === 'continue'
|
|
210
|
-
? { kind: 'ambiguous-continue' }
|
|
211
|
-
: { kind: 'ambiguous-abort' };
|
|
212
|
-
}
|
|
213
|
-
catch {
|
|
214
|
-
return { kind: 'ambiguous-abort' };
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
function describeAmbiguousCause(cause) {
|
|
218
|
-
const lines = [];
|
|
219
|
-
if (cause.spawnError) {
|
|
220
|
-
lines.push(`Could not spawn the agent: ${cause.spawnError}`);
|
|
221
|
-
}
|
|
222
|
-
if (cause.exitError) {
|
|
223
|
-
lines.push(`Agent process emitted an error: ${cause.exitError}`);
|
|
224
|
-
}
|
|
225
|
-
if (cause.exitCode !== undefined && cause.exitCode !== null) {
|
|
226
|
-
// Distinguish clean-exit-without-handoff (likely a deliberate close by
|
|
227
|
-
// the user, or the agent ended its session without invoking the handoff
|
|
228
|
-
// step) from a non-zero crash, so the prompt body doesn't collapse them
|
|
229
|
-
// into the same uninformative "exited with code N" line.
|
|
230
|
-
lines.push(cause.exitCode === 0
|
|
231
|
-
? 'Agent exited cleanly (code 0) without writing a handoff.'
|
|
232
|
-
: `Agent exited with code ${cause.exitCode}.`);
|
|
233
|
-
}
|
|
234
|
-
if (cause.exitSignal) {
|
|
235
|
-
lines.push(`Agent was terminated by signal ${cause.exitSignal}.`);
|
|
236
|
-
}
|
|
237
|
-
// "No handoff file was written." is redundant when another cause line
|
|
238
|
-
// already implies it (spawn error, exit code/signal, process error).
|
|
239
|
-
// Independent diagnostics (read-error, parse-error, shape-mismatch) always
|
|
240
|
-
// surface — they're not implied by the exit shape.
|
|
241
|
-
const handoffMissingIsRedundant = !!cause.spawnError ||
|
|
242
|
-
!!cause.exitError ||
|
|
243
|
-
cause.exitCode !== undefined ||
|
|
244
|
-
cause.exitSignal !== undefined;
|
|
245
|
-
switch (cause.handoff?.reason) {
|
|
246
|
-
case 'missing':
|
|
247
|
-
if (!handoffMissingIsRedundant) {
|
|
248
|
-
lines.push('No handoff file was written.');
|
|
249
|
-
}
|
|
250
|
-
break;
|
|
251
|
-
case 'read-error':
|
|
252
|
-
lines.push(`Handoff file could not be read${cause.handoff.detail ? `: ${cause.handoff.detail}` : '.'}`);
|
|
253
|
-
break;
|
|
254
|
-
case 'parse-error':
|
|
255
|
-
lines.push(`Handoff file contained invalid JSON${cause.handoff.detail ? `: ${cause.handoff.detail}` : '.'}`);
|
|
256
|
-
break;
|
|
257
|
-
case 'shape-mismatch':
|
|
258
|
-
lines.push('Handoff file was missing required fields or had an unexpected shape.');
|
|
259
|
-
break;
|
|
260
|
-
}
|
|
261
|
-
return lines;
|
|
262
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Tree } from '../../generators/tree';
|
|
2
|
-
/**
|
|
3
|
-
* The deprecated releaseTag* flat properties were removed in Nx 23. Re-run the
|
|
4
|
-
* v22 consolidation for any workspaces that still have the legacy keys (e.g.,
|
|
5
|
-
* configs added manually after the v22 migration ran). Runs automatically as
|
|
6
|
-
* part of `nx migrate` and is also triggered by `nx repair` when the runtime
|
|
7
|
-
* detects legacy keys still present in `nx.json`.
|
|
8
|
-
*/
|
|
9
|
-
export default function (tree: Tree): Promise<void>;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = default_1;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const consolidate_release_tag_config_1 = tslib_1.__importDefault(require("../update-22-0-0/consolidate-release-tag-config"));
|
|
6
|
-
/**
|
|
7
|
-
* The deprecated releaseTag* flat properties were removed in Nx 23. Re-run the
|
|
8
|
-
* v22 consolidation for any workspaces that still have the legacy keys (e.g.,
|
|
9
|
-
* configs added manually after the v22 migration ran). Runs automatically as
|
|
10
|
-
* part of `nx migrate` and is also triggered by `nx repair` when the runtime
|
|
11
|
-
* detects legacy keys still present in `nx.json`.
|
|
12
|
-
*/
|
|
13
|
-
// TODO(v24): remove this migration (along with its registration in
|
|
14
|
-
// migrations.json) and the LEGACY_RELEASE_TAG_PATTERN_PROPERTIES_DETECTED
|
|
15
|
-
// runtime error path in packages/nx/src/command-line/release/config/config.ts.
|
|
16
|
-
async function default_1(tree) {
|
|
17
|
-
return (0, consolidate_release_tag_config_1.default)(tree);
|
|
18
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { TargetDependencyConfig } from '../config/workspace-json-project-json';
|
|
2
|
-
type LegacyValue = 'self' | 'dependencies';
|
|
3
|
-
type LegacyEntry = TargetDependencyConfig & {
|
|
4
|
-
projects: LegacyValue;
|
|
5
|
-
};
|
|
6
|
-
export interface LegacyDependsOnViolation {
|
|
7
|
-
index: number;
|
|
8
|
-
originalEntry: LegacyEntry;
|
|
9
|
-
}
|
|
10
|
-
export interface LegacyDependsOnLocation {
|
|
11
|
-
ownerTarget?: string;
|
|
12
|
-
index?: number;
|
|
13
|
-
legacyViolations?: LegacyDependsOnViolation[];
|
|
14
|
-
}
|
|
15
|
-
export declare function warnLegacyDependsOnMagicString(currentProject: string | undefined, dependencyConfig: TargetDependencyConfig, location: LegacyDependsOnLocation | undefined): void;
|
|
16
|
-
export declare function flushLegacyDependsOnViolations(project: string, ownerTarget: string, violations: LegacyDependsOnViolation[], projectRoot: string | undefined): void;
|
|
17
|
-
export declare function __resetForTests(): void;
|
|
18
|
-
export {};
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.warnLegacyDependsOnMagicString = warnLegacyDependsOnMagicString;
|
|
4
|
-
exports.flushLegacyDependsOnViolations = flushLegacyDependsOnViolations;
|
|
5
|
-
exports.__resetForTests = __resetForTests;
|
|
6
|
-
const nx_deps_cache_1 = require("../project-graph/nx-deps-cache");
|
|
7
|
-
const source_maps_1 = require("../project-graph/utils/project-configuration/source-maps");
|
|
8
|
-
const output_1 = require("../utils/output");
|
|
9
|
-
const warned = new Set();
|
|
10
|
-
const isInternal = (p) => !p || p.startsWith('nx/');
|
|
11
|
-
// Callers gate this on `dependencyConfig.projects` already being a legacy value;
|
|
12
|
-
// the inner cast snapshots that runtime guarantee into the type system.
|
|
13
|
-
function warnLegacyDependsOnMagicString(currentProject, dependencyConfig, location) {
|
|
14
|
-
const violation = {
|
|
15
|
-
index: location?.index ?? -1,
|
|
16
|
-
originalEntry: { ...dependencyConfig },
|
|
17
|
-
};
|
|
18
|
-
// Collector-aware caller (`getDependencyConfigs`) batches violations so the
|
|
19
|
-
// warning can group all offending entries for a single target. External
|
|
20
|
-
// callers fall through to an immediate per-entry warning.
|
|
21
|
-
if (location?.legacyViolations)
|
|
22
|
-
return void location.legacyViolations.push(violation);
|
|
23
|
-
flushLegacyDependsOnViolations(currentProject ?? '<unknown>', location?.ownerTarget ?? '<unknown>', [violation], undefined);
|
|
24
|
-
}
|
|
25
|
-
function flushLegacyDependsOnViolations(project, ownerTarget, violations, projectRoot) {
|
|
26
|
-
if (violations.length === 0)
|
|
27
|
-
return;
|
|
28
|
-
// Read source maps fresh each flush so daemon-cached maps don't go stale;
|
|
29
|
-
// only runs when violations exist, which is rare.
|
|
30
|
-
let sourceMaps = null;
|
|
31
|
-
try {
|
|
32
|
-
sourceMaps = (0, nx_deps_cache_1.readSourceMapsCache)();
|
|
33
|
-
}
|
|
34
|
-
catch { } // best-effort context
|
|
35
|
-
const map = projectRoot && sourceMaps ? sourceMaps[projectRoot] : undefined;
|
|
36
|
-
const arrayKey = `targets.${ownerTarget}.dependsOn`;
|
|
37
|
-
const items = violations.map((v) => {
|
|
38
|
-
const info = map
|
|
39
|
-
? (0, source_maps_1.readArrayItemSourceInfo)(map, arrayKey, v.index)
|
|
40
|
-
: undefined;
|
|
41
|
-
return {
|
|
42
|
-
...v,
|
|
43
|
-
value: v.originalEntry.projects,
|
|
44
|
-
plugin: info?.[1],
|
|
45
|
-
file: info?.[0] ?? undefined,
|
|
46
|
-
};
|
|
47
|
-
});
|
|
48
|
-
const shared = (key) => items.every((i) => i[key] === items[0][key]) ? items[0][key] : null;
|
|
49
|
-
const value = shared('value');
|
|
50
|
-
const plugin = shared('plugin');
|
|
51
|
-
const file = shared('file');
|
|
52
|
-
// External-plugin warnings are workspace-wide (the plugin's behavior, not a
|
|
53
|
-
// specific config): dedupe per (plugin, value) so the user sees one warning
|
|
54
|
-
// per offending plugin, not one per affected target.
|
|
55
|
-
const dedupeKey = plugin && !isInternal(plugin) && value
|
|
56
|
-
? `plugin::${plugin}::${value}`
|
|
57
|
-
: `target::${project}::${ownerTarget}`;
|
|
58
|
-
if (warned.has(dedupeKey))
|
|
59
|
-
return;
|
|
60
|
-
warned.add(dedupeKey);
|
|
61
|
-
const n = items.length;
|
|
62
|
-
const word = n === 1 ? 'entry' : 'entries';
|
|
63
|
-
const deprecation = 'This is deprecated and will be removed in Nx v24 —';
|
|
64
|
-
let phrase;
|
|
65
|
-
if (value) {
|
|
66
|
-
phrase = `projects: '${value}'`;
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
const self = items.filter((i) => i.value === 'self').length;
|
|
70
|
-
phrase = `legacy projects values (${self} 'self', ${n - self} 'dependencies')`;
|
|
71
|
-
}
|
|
72
|
-
let title;
|
|
73
|
-
let suppressBody = false;
|
|
74
|
-
if (plugin && !isInternal(plugin)) {
|
|
75
|
-
// Single external plugin: same plugin emits the same value across projects.
|
|
76
|
-
title = `The ${plugin} plugin infers dependsOn entries using ${phrase}. ${deprecation} please upgrade ${plugin} to a version that doesn't emit this.`;
|
|
77
|
-
suppressBody = true;
|
|
78
|
-
}
|
|
79
|
-
else if (plugin && isInternal(plugin) && file) {
|
|
80
|
-
// Single hand-authored config file — lead with the file path.
|
|
81
|
-
title = `${file} defines ${project}:${ownerTarget} with ${n} dependsOn ${word} using ${phrase}. ${deprecation} run 'nx repair' to fix this.`;
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
// Mixed sources or no source-map info — tailor advice to what's offending.
|
|
85
|
-
const offending = Array.from(new Set(items
|
|
86
|
-
.filter((i) => i.plugin && !isInternal(i.plugin))
|
|
87
|
-
.map((i) => i.plugin)));
|
|
88
|
-
const origin = plugin
|
|
89
|
-
? ` (set by ${plugin}${file ? ` in ${file}` : ''})`
|
|
90
|
-
: '';
|
|
91
|
-
const advice = offending.length
|
|
92
|
-
? `run 'nx repair' for hand-authored entries and upgrade ${offending.join(', ')} for plugin-inferred entries`
|
|
93
|
-
: `run 'nx repair' to fix`;
|
|
94
|
-
title = `${project}:${ownerTarget} has ${n} dependsOn ${word} using ${phrase}${origin}. ${deprecation} ${advice}.`;
|
|
95
|
-
}
|
|
96
|
-
const bodyLines = suppressBody
|
|
97
|
-
? []
|
|
98
|
-
: items.map((i) => {
|
|
99
|
-
const src = i.plugin && !plugin
|
|
100
|
-
? ` from ${i.plugin}${i.file ? ` in ${i.file}` : ''}`
|
|
101
|
-
: '';
|
|
102
|
-
return ` - ${JSON.stringify(i.originalEntry)} (${i.index}${src})`;
|
|
103
|
-
});
|
|
104
|
-
output_1.output.warn({ title, bodyLines });
|
|
105
|
-
}
|
|
106
|
-
// Test-only: clears the process-wide dedupe set.
|
|
107
|
-
function __resetForTests() {
|
|
108
|
-
warned.clear();
|
|
109
|
-
}
|