@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,14 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveAgentic = resolveAgentic;
|
|
4
|
-
exports.
|
|
4
|
+
exports.idProblemLines = idProblemLines;
|
|
5
|
+
exports.dropUnsupportedAgent = dropUnsupportedAgent;
|
|
5
6
|
const fs_1 = require("fs");
|
|
6
7
|
const jsonc_parser_1 = require("jsonc-parser");
|
|
7
8
|
const path_1 = require("path");
|
|
9
|
+
const native_1 = require("../../../native");
|
|
8
10
|
const output_1 = require("../../../utils/output");
|
|
9
11
|
const workspace_root_1 = require("../../../utils/workspace-root");
|
|
10
12
|
const migrate_analytics_1 = require("../migrate-analytics");
|
|
11
13
|
const safe_prompt_1 = require("../safe-prompt");
|
|
14
|
+
const text_1 = require("../text");
|
|
12
15
|
const detect_installed_1 = require("./detect-installed");
|
|
13
16
|
const inception_1 = require("./inception");
|
|
14
17
|
const definitions_1 = require("./definitions");
|
|
@@ -56,12 +59,39 @@ async function resolveAgentic(input) {
|
|
|
56
59
|
}
|
|
57
60
|
return { kind: 'enabled', selectedAgent: selected };
|
|
58
61
|
}
|
|
62
|
+
const ID_PROBLEM_LABELS = {
|
|
63
|
+
'not-shell-safe': 'not shell-safe',
|
|
64
|
+
duplicate: 'listed more than once',
|
|
65
|
+
};
|
|
66
|
+
function idProblemLines(problems) {
|
|
67
|
+
return problems.map(({ id, problem }) => `- ${(0, text_1.singleLine)(id)} (${ID_PROBLEM_LABELS[problem]})`);
|
|
68
|
+
}
|
|
59
69
|
/**
|
|
60
|
-
*
|
|
61
|
-
*
|
|
70
|
+
* Drops an enabled agent, with a warning, where the orchestrator that drives
|
|
71
|
+
* it cannot run: under the WASM build, and for migration ids an orchestrated
|
|
72
|
+
* run cannot take.
|
|
62
73
|
*/
|
|
63
|
-
function
|
|
64
|
-
|
|
74
|
+
function dropUnsupportedAgent(agentic, idProblems) {
|
|
75
|
+
if (agentic.kind !== 'enabled')
|
|
76
|
+
return agentic;
|
|
77
|
+
if (native_1.IS_WASM) {
|
|
78
|
+
output_1.output.warn({
|
|
79
|
+
title: 'Skipping the agentic flow: it needs the native nx binary, and this run loaded the WASM build.',
|
|
80
|
+
bodyLines: ['Continuing the migration without the agentic flow.'],
|
|
81
|
+
});
|
|
82
|
+
return { kind: 'disabled' };
|
|
83
|
+
}
|
|
84
|
+
if (idProblems.length > 0) {
|
|
85
|
+
output_1.output.warn({
|
|
86
|
+
title: 'Skipping the agentic flow: it needs each migration id to be shell-safe (letters, digits and @/:._-) and listed once, and these are not:',
|
|
87
|
+
bodyLines: [
|
|
88
|
+
...idProblemLines(idProblems),
|
|
89
|
+
'Continuing the migration without the agentic flow. Generators still run. Prompt-only migrations and the prompt part of hybrid migrations are skipped and listed as next steps, and no AI validation runs.',
|
|
90
|
+
],
|
|
91
|
+
});
|
|
92
|
+
return { kind: 'disabled' };
|
|
93
|
+
}
|
|
94
|
+
return agentic;
|
|
65
95
|
}
|
|
66
96
|
async function resolveFlag(input, isInteractive, detected) {
|
|
67
97
|
if (input.agentic === true) {
|
|
@@ -97,7 +127,7 @@ function requireInteractiveOrAbort(isInteractive) {
|
|
|
97
127
|
if (isInteractive)
|
|
98
128
|
return;
|
|
99
129
|
output_1.output.error({
|
|
100
|
-
title: 'The agentic flow
|
|
130
|
+
title: 'The agentic flow needs an interactive terminal.',
|
|
101
131
|
bodyLines: [
|
|
102
132
|
'Re-run in an interactive terminal, or pass `--agentic=false` to skip the agentic flow.',
|
|
103
133
|
],
|
|
@@ -106,9 +136,9 @@ function requireInteractiveOrAbort(isInteractive) {
|
|
|
106
136
|
}
|
|
107
137
|
function warnAgenticInteractiveOnly() {
|
|
108
138
|
output_1.output.warn({
|
|
109
|
-
title: 'Skipping the agentic flow:
|
|
139
|
+
title: 'Skipping the agentic flow: the agent session needs an interactive terminal, and this run is non-interactive.',
|
|
110
140
|
bodyLines: [
|
|
111
|
-
'Continuing
|
|
141
|
+
'Continuing without the agentic flow. Generators still run, prompt-based changes are left for you to apply, and no AI validation runs. Re-run in an interactive terminal to use the agentic flow.',
|
|
112
142
|
],
|
|
113
143
|
});
|
|
114
144
|
}
|
|
@@ -2,18 +2,18 @@ import type { AgentId } from './cli-args';
|
|
|
2
2
|
export type { AgentId };
|
|
3
3
|
/**
|
|
4
4
|
* Workspace-relative directory holding all migrate-run scratch: a run
|
|
5
|
-
* directory per run id. Shared by the run-dir layout in `
|
|
5
|
+
* directory per run id. Shared by the run-dir layout in `run-state.ts` and the
|
|
6
6
|
* agent permission rules in `definitions.ts` so the pre-authorized write scope
|
|
7
7
|
* can't drift from the actual layout. It lives here so `definitions.ts`,
|
|
8
|
-
* loaded whenever the agentic flow is resolved, doesn't pull in the
|
|
9
|
-
*
|
|
8
|
+
* loaded whenever the agentic flow is resolved, doesn't pull in the run state
|
|
9
|
+
* module for the path alone.
|
|
10
10
|
*/
|
|
11
11
|
export declare const MIGRATE_RUNS_RELATIVE_DIR = ".nx/migrate-runs";
|
|
12
12
|
/**
|
|
13
13
|
* The one subtree of a run directory an agent writes; everything beside it is
|
|
14
14
|
* state Nx owns, so the pre-authorized write scope stops here. Handoff names
|
|
15
|
-
* derive from step ids
|
|
16
|
-
*
|
|
15
|
+
* derive from step ids, so flattening them into the run dir would leave Nx no
|
|
16
|
+
* name it could safely add.
|
|
17
17
|
*/
|
|
18
18
|
export declare const HANDOFFS_DIR_NAME = "handoffs";
|
|
19
19
|
/**
|
|
@@ -29,7 +29,7 @@ export declare function isHandoffGitignoreMigration(m: {
|
|
|
29
29
|
* A coding agent that was found on the user's machine, ready to be spawned.
|
|
30
30
|
*
|
|
31
31
|
* Produced by `detect-installed.ts`. The `binary` is an absolute path so the
|
|
32
|
-
*
|
|
32
|
+
* master session can spawn it directly without re-resolving against PATH.
|
|
33
33
|
*/
|
|
34
34
|
export interface DetectedInstalledAgent {
|
|
35
35
|
id: AgentId;
|
|
@@ -38,37 +38,8 @@ export interface DetectedInstalledAgent {
|
|
|
38
38
|
source: 'path' | 'well-known';
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* name for OpenCode) are encoded inside the definition, not here.
|
|
44
|
-
*
|
|
45
|
-
* Both prompts are written to disk (see `instruction-files.ts`) and reached
|
|
46
|
-
* through `systemPromptFilePath` / `instructionsPointer`. The inline fields
|
|
47
|
-
* below are the exception, for agents that cannot be pointed at a file.
|
|
48
|
-
*/
|
|
49
|
-
export interface InvocationContext {
|
|
50
|
-
/** Absolute path of the file holding the step's system prompt. */
|
|
51
|
-
systemPromptFilePath: string;
|
|
52
|
-
/** Verbatim system prompt, only for a step with no file-loading path. */
|
|
53
|
-
systemPrompt: string;
|
|
54
|
-
/** Single-line command-line text pointing the agent at its instructions. */
|
|
55
|
-
instructionsPointer: string;
|
|
56
|
-
/** Inline handoff contract and pointer to `systemPromptFilePath`. */
|
|
57
|
-
inlineSystemContext: string;
|
|
58
|
-
/** Shorter `inlineSystemContext`, substituted on Windows shim overflow. */
|
|
59
|
-
inlineSystemContextFallback: string;
|
|
60
|
-
workspaceRoot: string;
|
|
61
|
-
/**
|
|
62
|
-
* Name of the run directory under `MIGRATE_RUNS_RELATIVE_DIR` holding this
|
|
63
|
-
* invocation's handoff. A workspace can carry several run directories at
|
|
64
|
-
* once, so a definition that pre-authorizes the handoff write narrows it to
|
|
65
|
-
* this one: the others belong to runs this invocation is not executing.
|
|
66
|
-
*/
|
|
67
|
-
runDirName: string;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* What an agent definition returns from `buildInteractive`. The runner combines
|
|
71
|
-
* this with the detected binary path to actually spawn.
|
|
41
|
+
* What a master invocation builder returns. The master session combines this
|
|
42
|
+
* with the detected binary path to actually spawn.
|
|
72
43
|
*/
|
|
73
44
|
export interface InvocationSpec {
|
|
74
45
|
args: string[];
|
|
@@ -85,42 +56,16 @@ export interface AgentDefinition {
|
|
|
85
56
|
binaryNames: string[];
|
|
86
57
|
/** Absolute paths to probe as a fallback when PATH lookup misses. */
|
|
87
58
|
wellKnownPaths(): string[];
|
|
88
|
-
buildInteractive(ctx: InvocationContext): InvocationSpec;
|
|
89
59
|
}
|
|
90
60
|
/**
|
|
91
61
|
* Output of the agent's handoff file, written at the end of an agentic step.
|
|
92
|
-
*
|
|
93
|
-
* extra fields are tolerated and surfaced via `extras`.
|
|
62
|
+
* Extra fields are tolerated and surfaced via `extras`.
|
|
94
63
|
*/
|
|
95
64
|
export interface HandoffFile {
|
|
96
65
|
status: 'success' | 'failed';
|
|
97
66
|
summary: string;
|
|
98
67
|
extras?: Record<string, unknown>;
|
|
99
68
|
}
|
|
100
|
-
/**
|
|
101
|
-
* Outcome the runner reports back to the migrate orchestrator after a single
|
|
102
|
-
* agentic step. The four kinds mirror the (a)/(b)/(c) matrix plus the user's
|
|
103
|
-
* choice when (c) fires.
|
|
104
|
-
*
|
|
105
|
-
* `ambiguous-abort.causeSummary`: pre-rendered explanation lines. Populated
|
|
106
|
-
* when Ctrl+C bypasses the ambiguous prompt (so the cause was never shown
|
|
107
|
-
* inline) and forwarded so the caller can surface it. Omitted when the user
|
|
108
|
-
* chose "abort" at the prompt — the cause was already shown there.
|
|
109
|
-
*/
|
|
110
|
-
export type HandoffOutcome = {
|
|
111
|
-
kind: 'success';
|
|
112
|
-
summary: string;
|
|
113
|
-
extras?: Record<string, unknown>;
|
|
114
|
-
} | {
|
|
115
|
-
kind: 'failed';
|
|
116
|
-
summary: string;
|
|
117
|
-
extras?: Record<string, unknown>;
|
|
118
|
-
} | {
|
|
119
|
-
kind: 'ambiguous-continue';
|
|
120
|
-
} | {
|
|
121
|
-
kind: 'ambiguous-abort';
|
|
122
|
-
causeSummary?: string[];
|
|
123
|
-
};
|
|
124
69
|
/**
|
|
125
70
|
* Result of the up-front resolution phase, run once per run-phase invocation
|
|
126
71
|
* and applied to every migration it covers.
|
|
@@ -141,7 +86,3 @@ export type ResolvedAgentic = {
|
|
|
141
86
|
kind: 'enabled';
|
|
142
87
|
selectedAgent: DetectedInstalledAgent;
|
|
143
88
|
};
|
|
144
|
-
/** The `enabled` variant, useful for narrowed function signatures. */
|
|
145
|
-
export type EnabledResolvedAgentic = Extract<ResolvedAgentic, {
|
|
146
|
-
kind: 'enabled';
|
|
147
|
-
}>;
|
|
@@ -4,18 +4,18 @@ exports.PROMPTS_DIR_NAME = exports.HANDOFFS_DIR_NAME = exports.MIGRATE_RUNS_RELA
|
|
|
4
4
|
exports.isHandoffGitignoreMigration = isHandoffGitignoreMigration;
|
|
5
5
|
/**
|
|
6
6
|
* Workspace-relative directory holding all migrate-run scratch: a run
|
|
7
|
-
* directory per run id. Shared by the run-dir layout in `
|
|
7
|
+
* directory per run id. Shared by the run-dir layout in `run-state.ts` and the
|
|
8
8
|
* agent permission rules in `definitions.ts` so the pre-authorized write scope
|
|
9
9
|
* can't drift from the actual layout. It lives here so `definitions.ts`,
|
|
10
|
-
* loaded whenever the agentic flow is resolved, doesn't pull in the
|
|
11
|
-
*
|
|
10
|
+
* loaded whenever the agentic flow is resolved, doesn't pull in the run state
|
|
11
|
+
* module for the path alone.
|
|
12
12
|
*/
|
|
13
13
|
exports.MIGRATE_RUNS_RELATIVE_DIR = '.nx/migrate-runs';
|
|
14
14
|
/**
|
|
15
15
|
* The one subtree of a run directory an agent writes; everything beside it is
|
|
16
16
|
* state Nx owns, so the pre-authorized write scope stops here. Handoff names
|
|
17
|
-
* derive from step ids
|
|
18
|
-
*
|
|
17
|
+
* derive from step ids, so flattening them into the run dir would leave Nx no
|
|
18
|
+
* name it could safely add.
|
|
19
19
|
*/
|
|
20
20
|
exports.HANDOFFS_DIR_NAME = 'handoffs';
|
|
21
21
|
/**
|
|
@@ -28,9 +28,7 @@ exports.PROMPTS_DIR_NAME = 'prompts';
|
|
|
28
28
|
* `.gitignore`. Hard-coded because the agentic preflight is a deliberate
|
|
29
29
|
* one-off coupling: this exact migration owns the entry that keeps
|
|
30
30
|
* `.nx/migrate-runs/<run-id>/...` scratch out of per-migration commits. If
|
|
31
|
-
* the migration is ever renamed, this entry must move with it.
|
|
32
|
-
* rather than in `handoff-gitignore.ts` so `sortMigrations`' hoist check
|
|
33
|
-
* doesn't load that module's migration-execution machinery.
|
|
31
|
+
* the migration is ever renamed, this entry must move with it.
|
|
34
32
|
*/
|
|
35
33
|
const HANDOFF_GITIGNORE_MIGRATION_PACKAGE = 'nx';
|
|
36
34
|
const HANDOFF_GITIGNORE_MIGRATION_NAME = '23-0-0-add-migrate-runs-to-git-ignore';
|
|
@@ -55,14 +55,12 @@ function withMigrationOptions(yargs) {
|
|
|
55
55
|
type: 'string',
|
|
56
56
|
})
|
|
57
57
|
.option('runMigration', {
|
|
58
|
-
describe: "Run a single migration from migrations.json by id. The id is '<package>:<name>'; a bare '<name>' is accepted when it matches exactly one migration. A name that contains ':' must use the full '<package>:<name>' form.",
|
|
58
|
+
describe: "Run a single migration from migrations.json by id. The id is '<package>:<name>'; a bare '<name>' is accepted when it matches exactly one migration. A name that contains ':' must use the full '<package>:<name>' form. With an AI agent, nx runs the migration's generator itself, when it has one, and starts the agent only when the migration leaves a prompt to apply or changes to review. Refuses to start while another nx migrate process is working on a run.",
|
|
59
59
|
type: 'string',
|
|
60
60
|
})
|
|
61
61
|
.option('runId', {
|
|
62
|
-
|
|
63
|
-
describe: 'The orchestrated migrate run to record a single migration into, to continue with --run-migrations, or to reconcile when given alone.',
|
|
62
|
+
describe: "The id of a migrate run, as nx prints it. With --run-migrations: continue that run, or replace it with --start-fresh. The AI agent driving a run also passes it with --run-migration to record a migration into the run, and alone to record a step's outcome and get the next step.",
|
|
64
63
|
type: 'string',
|
|
65
|
-
hidden: true,
|
|
66
64
|
})
|
|
67
65
|
.option('stepAction', {
|
|
68
66
|
describe: 'How an orchestrated reconcile resolves its single failed or died step.',
|
|
@@ -71,9 +69,8 @@ function withMigrationOptions(yargs) {
|
|
|
71
69
|
hidden: true,
|
|
72
70
|
})
|
|
73
71
|
.option('startFresh', {
|
|
74
|
-
describe: 'With --run-migrations and --run-id=<id
|
|
72
|
+
describe: 'With --run-migrations and --run-id=<id>: delete the record of the active migrate run the id names, then run the whole plan again, as a new run when orchestrated. Migrations the deleted run applied stay applied.',
|
|
75
73
|
type: 'boolean',
|
|
76
|
-
hidden: true,
|
|
77
74
|
})
|
|
78
75
|
.option('ifExists', {
|
|
79
76
|
describe: `Run migrations only if the migrations file exists, if not continues successfully.`,
|
|
@@ -123,17 +120,16 @@ function withMigrationOptions(yargs) {
|
|
|
123
120
|
choices: exports.MULTI_MAJOR_MODES,
|
|
124
121
|
})
|
|
125
122
|
.option('agentic', {
|
|
126
|
-
describe: '
|
|
123
|
+
describe: 'Use an AI agent to apply prompt-based migrations and review the results. With --run-migrations, one agent session drives the whole run. With --run-migration, the session covers that one migration. Pass `--agentic=<agent>` to pin a specific agent (claude-code, codex, or opencode). Pass `--agentic=false` or `--no-agentic` to disable it. Inside an AI agent, disabling it stops nx from asking that agent to review the changes of generator-only migrations. Migration prompts still go to that agent.',
|
|
127
124
|
coerce: cli_args_1.coerceAgenticArg,
|
|
128
125
|
})
|
|
129
126
|
.option('validate', {
|
|
130
|
-
describe: '
|
|
127
|
+
describe: 'Have the AI agent driving the run review the changes of generator-only migrations (those with no `prompt:` field). On by default; pass `--no-validate` to opt out. A continued run keeps the setting it started with. Has no effect when no agent drives the run. With --run-migration inside an AI agent, it controls whether nx prints review instructions for that agent. `--agentic=false` turns them off too.',
|
|
131
128
|
type: 'boolean',
|
|
132
129
|
})
|
|
133
130
|
.option('finalValidation', {
|
|
134
|
-
describe: 'With --run-migrations
|
|
131
|
+
describe: 'With --run-migrations, when an AI agent drives the run: once every migration has run, the agent checks that the projects the run touched still lint, build, and pass their unit tests. On by default; pass --no-final-validation to opt out. A continued run keeps the setting it started with.',
|
|
135
132
|
type: 'boolean',
|
|
136
|
-
hidden: true,
|
|
137
133
|
})
|
|
138
134
|
.check(({ createCommits, commitPrefix, from, excludeAppliedMigrations, include, agentic, }) => {
|
|
139
135
|
// Only an explicit `--no-create-commits` is decidable here, before the
|
|
@@ -9,8 +9,8 @@ interface PackageMigrationConfig extends NxMigrationsConfiguration {
|
|
|
9
9
|
export declare function readPackageMigrationConfig(packageName: string, dir: string): PackageMigrationConfig;
|
|
10
10
|
/**
|
|
11
11
|
* With a `sink`, stdin is ignored and stdout and stderr are collected for a
|
|
12
|
-
* caller sharing the terminal
|
|
13
|
-
*
|
|
12
|
+
* caller sharing the terminal, and the install runs without the terminal (see
|
|
13
|
+
* `spawnWithoutTerminal`). Without a sink, the install owns the terminal.
|
|
14
14
|
*/
|
|
15
15
|
export declare function runInstall(nxWorkspaceRoot?: string, phase?: MigrationInstallPhase, rerunCommand?: string, sink?: MigrateOutputSink): Promise<void>;
|
|
16
16
|
export type MigrationInstallPhase = 'pre-migration' | 'post-migration';
|
|
@@ -59,10 +59,10 @@ export declare function runNxOrAngularMigration(root: string, migration: {
|
|
|
59
59
|
madeChanges: boolean;
|
|
60
60
|
}>;
|
|
61
61
|
/**
|
|
62
|
-
* The workspace's declared dependencies, serialized for
|
|
63
|
-
* or `null` when package.json could not be read or
|
|
64
|
-
* persist the value across processes need that
|
|
65
|
-
* package.json is not an empty dependency set.
|
|
62
|
+
* The workspace's declared dependencies, catalogs included, serialized for
|
|
63
|
+
* equality comparison, or `null` when package.json could not be read or
|
|
64
|
+
* parsed. Callers that persist the value across processes need that
|
|
65
|
+
* distinction: an unreadable package.json is not an empty dependency set.
|
|
66
66
|
*/
|
|
67
67
|
export declare function readPackageJsonDeps(root: string): string | null;
|
|
68
68
|
export declare function getStringifiedPackageJsonDeps(root: string): string;
|
|
@@ -25,6 +25,7 @@ const path_1 = require("path");
|
|
|
25
25
|
const semver_1 = require("semver");
|
|
26
26
|
const handle_import_1 = require("../../utils/handle-import");
|
|
27
27
|
const tree_1 = require("../../generators/tree");
|
|
28
|
+
const catalog_1 = require("../../utils/catalog");
|
|
28
29
|
const fileutils_1 = require("../../utils/fileutils");
|
|
29
30
|
const logger_1 = require("../../utils/logger");
|
|
30
31
|
const text_1 = require("./text");
|
|
@@ -33,6 +34,7 @@ const package_manager_1 = require("../../utils/package-manager");
|
|
|
33
34
|
const fs_1 = require("fs");
|
|
34
35
|
const installation_directory_1 = require("../../utils/installation-directory");
|
|
35
36
|
const shell_quoting_1 = require("../../utils/shell-quoting");
|
|
37
|
+
const spawn_without_terminal_1 = require("../../utils/spawn-without-terminal");
|
|
36
38
|
const project_graph_1 = require("../../project-graph/project-graph");
|
|
37
39
|
const version_utils_1 = require("./version-utils");
|
|
38
40
|
const deferred_output_1 = require("./deferred-output");
|
|
@@ -64,8 +66,8 @@ function readPackageMigrationConfig(packageName, dir) {
|
|
|
64
66
|
}
|
|
65
67
|
/**
|
|
66
68
|
* With a `sink`, stdin is ignored and stdout and stderr are collected for a
|
|
67
|
-
* caller sharing the terminal
|
|
68
|
-
*
|
|
69
|
+
* caller sharing the terminal, and the install runs without the terminal (see
|
|
70
|
+
* `spawnWithoutTerminal`). Without a sink, the install owns the terminal.
|
|
69
71
|
*/
|
|
70
72
|
function runInstall(nxWorkspaceRoot, phase = 'pre-migration', rerunCommand, sink) {
|
|
71
73
|
const cwd = nxWorkspaceRoot ?? process.cwd();
|
|
@@ -81,14 +83,21 @@ function runInstall(nxWorkspaceRoot, phase = 'pre-migration', rerunCommand, sink
|
|
|
81
83
|
// Without a sink it is mirrored live and other package managers inherit
|
|
82
84
|
// stderr directly, since their output is not inspected.
|
|
83
85
|
const shouldCaptureStderr = packageManager === 'npm';
|
|
84
|
-
const child =
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
86
|
+
const child = sink
|
|
87
|
+
? (0, spawn_without_terminal_1.spawnWithoutTerminal)(installCommand, {
|
|
88
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
89
|
+
cwd,
|
|
90
|
+
})
|
|
91
|
+
: (0, child_process_1.spawn)(installCommand, {
|
|
92
|
+
shell: true,
|
|
93
|
+
stdio: [
|
|
94
|
+
'inherit',
|
|
95
|
+
'inherit',
|
|
96
|
+
shouldCaptureStderr ? 'pipe' : 'inherit',
|
|
97
|
+
],
|
|
98
|
+
windowsHide: true,
|
|
99
|
+
cwd,
|
|
100
|
+
});
|
|
92
101
|
// Decoded per stream: a chunk boundary can split a multi-byte character,
|
|
93
102
|
// and a sequence still incomplete at the end is what `end()` returns.
|
|
94
103
|
const stdoutText = new string_decoder_1.StringDecoder('utf8');
|
|
@@ -334,15 +343,16 @@ async function runNxOrAngularMigration(root, migration, isVerbose, captureGenera
|
|
|
334
343
|
return { changes, nextSteps, agentContext, skipAgentic, logs, madeChanges };
|
|
335
344
|
}
|
|
336
345
|
/**
|
|
337
|
-
* The workspace's declared dependencies, serialized for
|
|
338
|
-
* or `null` when package.json could not be read or
|
|
339
|
-
* persist the value across processes need that
|
|
340
|
-
* package.json is not an empty dependency set.
|
|
346
|
+
* The workspace's declared dependencies, catalogs included, serialized for
|
|
347
|
+
* equality comparison, or `null` when package.json could not be read or
|
|
348
|
+
* parsed. Callers that persist the value across processes need that
|
|
349
|
+
* distinction: an unreadable package.json is not an empty dependency set.
|
|
341
350
|
*/
|
|
342
351
|
function readPackageJsonDeps(root) {
|
|
343
352
|
try {
|
|
344
353
|
const { dependencies, devDependencies } = (0, fileutils_1.readJsonFile)((0, path_1.join)(root, 'package.json'));
|
|
345
|
-
|
|
354
|
+
const catalogs = (0, catalog_1.getCatalogManager)(root)?.getCatalogDefinitions(root);
|
|
355
|
+
return JSON.stringify([dependencies, devDependencies, catalogs]);
|
|
346
356
|
}
|
|
347
357
|
catch {
|
|
348
358
|
return null;
|
|
@@ -13,11 +13,11 @@ export type MigratePromptChoices = {
|
|
|
13
13
|
multi_major: 'direct' | 'latest-in-current' | 'latest-in-next';
|
|
14
14
|
agentic: 'yes-once' | 'yes-flex' | 'yes-pin' | 'no-once' | 'no-never';
|
|
15
15
|
agent_select: string;
|
|
16
|
-
ambiguous_agent_outcome: 'abort' | 'continue';
|
|
17
16
|
};
|
|
18
17
|
export type MigratePromptName = keyof MigratePromptChoices;
|
|
19
18
|
export type MigrateGenerateErrorCode = 'resolve_version' | 'fetch_migrations' | 'package_updates';
|
|
20
19
|
export type MigrateRunErrorCode = 'npm_install' | 'migration_exec' | 'agentic' | 'other';
|
|
20
|
+
export type MigrateRunStopReason = 'existing_run' | 'declined_commits' | 'aborted' | 'runbook_missing';
|
|
21
21
|
export declare function setMigrateInclude(include: MigrateInclude): void;
|
|
22
22
|
export declare function setMigrateIncludeSource(source: MigrateIncludeSource): void;
|
|
23
23
|
export declare function classifyMigrateFetchFallback(error: unknown): MigrateFetchFallbackReason;
|
|
@@ -60,6 +60,11 @@ export declare function reportMigrateRunComplete(opts: {
|
|
|
60
60
|
migrationCount: number;
|
|
61
61
|
appliedCount: number;
|
|
62
62
|
}): void;
|
|
63
|
+
/**
|
|
64
|
+
* Closes a `migrate_run_start` whose invocation stopped before running any
|
|
65
|
+
* migration.
|
|
66
|
+
*/
|
|
67
|
+
export declare function reportMigrateRunStopped(reason: MigrateRunStopReason): void;
|
|
63
68
|
export declare function reportMigrateRunError(opts: {
|
|
64
69
|
code: MigrateRunErrorCode;
|
|
65
70
|
migrationPackage?: string;
|
|
@@ -127,5 +132,17 @@ export declare function reportMigrateSingleMigrationInvocation(opts: {
|
|
|
127
132
|
migrationType: 'generator' | 'prompt' | 'hybrid';
|
|
128
133
|
orchestrated: boolean;
|
|
129
134
|
}): void;
|
|
135
|
+
/**
|
|
136
|
+
* Closes a `--run-migration` run that had an agent selected. `agentUsed` is
|
|
137
|
+
* set only when the agent started: a migration that left it no work
|
|
138
|
+
* completes without one.
|
|
139
|
+
*/
|
|
140
|
+
export declare function reportMigrateSingleMigrationComplete(opts: {
|
|
141
|
+
agentUsed?: string;
|
|
142
|
+
}): void;
|
|
143
|
+
/** The agent session of a `--run-migration` run ended with the migration unfinished. */
|
|
144
|
+
export declare function reportMigrateSingleMigrationAbandoned(opts: {
|
|
145
|
+
agentUsed: string;
|
|
146
|
+
}): void;
|
|
130
147
|
export declare function computeMajorsCrossed(installed: string | null | undefined, target: string | null | undefined): number | undefined;
|
|
131
148
|
export declare function safeReport(emit: () => void): void;
|
|
@@ -10,6 +10,7 @@ exports.reportMigrateGenerateError = reportMigrateGenerateError;
|
|
|
10
10
|
exports.reportMigrateRunStart = reportMigrateRunStart;
|
|
11
11
|
exports.hasMigrateRunStarted = hasMigrateRunStarted;
|
|
12
12
|
exports.reportMigrateRunComplete = reportMigrateRunComplete;
|
|
13
|
+
exports.reportMigrateRunStopped = reportMigrateRunStopped;
|
|
13
14
|
exports.reportMigrateRunError = reportMigrateRunError;
|
|
14
15
|
exports.reportMigrateOrchestratorInit = reportMigrateOrchestratorInit;
|
|
15
16
|
exports.reportMigrateOrchestratorDispense = reportMigrateOrchestratorDispense;
|
|
@@ -19,6 +20,8 @@ exports.reportMigrateOrchestratorAbandoned = reportMigrateOrchestratorAbandoned;
|
|
|
19
20
|
exports.reportMigrateOrchestratorResume = reportMigrateOrchestratorResume;
|
|
20
21
|
exports.reportMigrateOrchestratorExistingRun = reportMigrateOrchestratorExistingRun;
|
|
21
22
|
exports.reportMigrateSingleMigrationInvocation = reportMigrateSingleMigrationInvocation;
|
|
23
|
+
exports.reportMigrateSingleMigrationComplete = reportMigrateSingleMigrationComplete;
|
|
24
|
+
exports.reportMigrateSingleMigrationAbandoned = reportMigrateSingleMigrationAbandoned;
|
|
22
25
|
exports.computeMajorsCrossed = computeMajorsCrossed;
|
|
23
26
|
exports.safeReport = safeReport;
|
|
24
27
|
const semver_1 = require("semver");
|
|
@@ -165,6 +168,17 @@ function reportMigrateRunComplete(opts) {
|
|
|
165
168
|
});
|
|
166
169
|
});
|
|
167
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* Closes a `migrate_run_start` whose invocation stopped before running any
|
|
173
|
+
* migration.
|
|
174
|
+
*/
|
|
175
|
+
function reportMigrateRunStopped(reason) {
|
|
176
|
+
safeReport(() => {
|
|
177
|
+
if (!analytics_1.customDimensions)
|
|
178
|
+
return;
|
|
179
|
+
(0, analytics_1.reportEvent)(`migrate_run_stopped_${reason}`);
|
|
180
|
+
});
|
|
181
|
+
}
|
|
168
182
|
function reportMigrateRunError(opts) {
|
|
169
183
|
safeReport(() => {
|
|
170
184
|
if (!analytics_1.customDimensions || runErrorRecorded)
|
|
@@ -305,6 +319,30 @@ function reportMigrateSingleMigrationInvocation(opts) {
|
|
|
305
319
|
});
|
|
306
320
|
});
|
|
307
321
|
}
|
|
322
|
+
/**
|
|
323
|
+
* Closes a `--run-migration` run that had an agent selected. `agentUsed` is
|
|
324
|
+
* set only when the agent started: a migration that left it no work
|
|
325
|
+
* completes without one.
|
|
326
|
+
*/
|
|
327
|
+
function reportMigrateSingleMigrationComplete(opts) {
|
|
328
|
+
safeReport(() => {
|
|
329
|
+
if (!analytics_1.customDimensions)
|
|
330
|
+
return;
|
|
331
|
+
(0, analytics_1.reportEvent)('migrate_single_migration_complete', {
|
|
332
|
+
[analytics_1.customDimensions.agentUsed]: opts.agentUsed,
|
|
333
|
+
});
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
/** The agent session of a `--run-migration` run ended with the migration unfinished. */
|
|
337
|
+
function reportMigrateSingleMigrationAbandoned(opts) {
|
|
338
|
+
safeReport(() => {
|
|
339
|
+
if (!analytics_1.customDimensions)
|
|
340
|
+
return;
|
|
341
|
+
(0, analytics_1.reportEvent)('migrate_single_migration_abandoned', {
|
|
342
|
+
[analytics_1.customDimensions.agentUsed]: opts.agentUsed,
|
|
343
|
+
});
|
|
344
|
+
});
|
|
345
|
+
}
|
|
308
346
|
// `_migrate` runs either from a temp install of the latest CLI or from the
|
|
309
347
|
// workspace-local installation; same signal as the run-phase re-dispatch
|
|
310
348
|
// check in migrate.ts.
|
|
@@ -1,5 +1,19 @@
|
|
|
1
|
+
import { type WorkingTreeStatus } from '../../utils/git-utils';
|
|
1
2
|
import type { ResolvedAgentic } from './agentic/types';
|
|
2
3
|
import { type MigrateOutputSink } from './deferred-output';
|
|
4
|
+
/** Workspace-relative paths nx migrate writes for itself. */
|
|
5
|
+
export declare const MIGRATE_OWNED_PATHS: string[];
|
|
6
|
+
/**
|
|
7
|
+
* The scratch state is excluded even when git ignores it, since its ignore
|
|
8
|
+
* rule can go missing mid-run.
|
|
9
|
+
*/
|
|
10
|
+
export declare function migrateCommitExcludes(root: string): string[];
|
|
11
|
+
export declare function migrateTreeStatus(root: string): WorkingTreeStatus;
|
|
12
|
+
/**
|
|
13
|
+
* What becomes of a failed commit's changes: a later migration step's commit
|
|
14
|
+
* takes them in, or, with no later step, the user commits or reverts them.
|
|
15
|
+
*/
|
|
16
|
+
export type CommitFailureRecovery = 'later-step' | 'manual';
|
|
3
17
|
/**
|
|
4
18
|
* Discriminated result for `commitMigrationIfRequested`. Distinguishes the
|
|
5
19
|
* shapes the executor needs to react to:
|
|
@@ -28,31 +42,30 @@ export type CommitResult = {
|
|
|
28
42
|
* can see which earlier migrations' diffs this commit absorbed (their own
|
|
29
43
|
* commits failed and `git add -A` picked their working-tree state up too).
|
|
30
44
|
*
|
|
31
|
-
*
|
|
32
|
-
* behavior
|
|
33
|
-
*
|
|
45
|
+
* `recovery` picks the failure guidance: the default describes the classic
|
|
46
|
+
* loop's absorb-and-recap behavior, and a caller with no later migration step
|
|
47
|
+
* (a `--run-migration` run) passes 'manual'.
|
|
48
|
+
*
|
|
49
|
+
* A `sink` collects the output for a caller sharing the terminal with an
|
|
50
|
+
* agent, and the commit then runs without the terminal.
|
|
34
51
|
*/
|
|
35
52
|
export declare function commitMigrationIfRequested(root: string, migration: {
|
|
36
53
|
name: string;
|
|
37
54
|
}, shouldCreateCommits: boolean, commitPrefix: string, installDepsIfChanged: () => Promise<void>, pendingMigrations?: ReadonlyArray<{
|
|
38
55
|
package: string;
|
|
39
56
|
name: string;
|
|
40
|
-
}>,
|
|
57
|
+
}>, recovery?: CommitFailureRecovery, sink?: MigrateOutputSink): Promise<CommitResult>;
|
|
41
58
|
/**
|
|
42
|
-
* Commits
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* package.json edit `nx migrate latest`
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* the working tree is
|
|
59
|
+
* Commits pre-existing working-tree state, except what `migrateCommitExcludes`
|
|
60
|
+
* leaves out, into a dedicated "checkpoint" commit before the first migration
|
|
61
|
+
* runs. Without this, the first migration's commit would absorb whatever was
|
|
62
|
+
* already pending (most commonly the package.json edit `nx migrate latest`
|
|
63
|
+
* produces and the lockfile churn from the orchestrator's
|
|
64
|
+
* `npm install --ignore-scripts` step), and migration 1's validation would see
|
|
65
|
+
* that mixed in with the generator output. No-op when the working tree is
|
|
66
|
+
* already clean.
|
|
49
67
|
*/
|
|
50
68
|
export declare function commitCheckpointBeforeMigrations(root: string, commitPrefix: string): void;
|
|
51
|
-
/**
|
|
52
|
-
* `agenticHasDiffContext` gates the agent prompt: without per-migration commits
|
|
53
|
-
* to isolate a migration's diff, the prompt embeds a file list instead of
|
|
54
|
-
* pointing at git.
|
|
55
|
-
*/
|
|
56
69
|
export declare function resolveCreateCommits(args: {
|
|
57
70
|
createCommits: boolean | undefined;
|
|
58
71
|
mode: ResolvedAgentic['kind'] | 'orchestrated';
|
|
@@ -60,7 +73,6 @@ export declare function resolveCreateCommits(args: {
|
|
|
60
73
|
commitPrefixIsCustom?: boolean;
|
|
61
74
|
}): {
|
|
62
75
|
effective: boolean;
|
|
63
|
-
agenticHasDiffContext: boolean;
|
|
64
76
|
warning?: string;
|
|
65
77
|
error?: string;
|
|
66
78
|
};
|