@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,5 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MIGRATE_OWNED_PATHS = void 0;
|
|
4
|
+
exports.migrateCommitExcludes = migrateCommitExcludes;
|
|
5
|
+
exports.migrateTreeStatus = migrateTreeStatus;
|
|
3
6
|
exports.commitMigrationIfRequested = commitMigrationIfRequested;
|
|
4
7
|
exports.commitCheckpointBeforeMigrations = commitCheckpointBeforeMigrations;
|
|
5
8
|
exports.resolveCreateCommits = resolveCreateCommits;
|
|
@@ -14,35 +17,93 @@ const git_utils_1 = require("../../utils/git-utils");
|
|
|
14
17
|
const logger_1 = require("../../utils/logger");
|
|
15
18
|
const output_1 = require("../../utils/output");
|
|
16
19
|
const types_1 = require("./agentic/types");
|
|
20
|
+
const prompt_files_1 = require("./prompt-files");
|
|
17
21
|
const safe_prompt_1 = require("./safe-prompt");
|
|
18
22
|
const deferred_output_1 = require("./deferred-output");
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
const MIGRATE_PLAN_PATHS = ['migrations.json', prompt_files_1.AI_MIGRATIONS_DIR];
|
|
24
|
+
/** Workspace-relative paths nx migrate writes for itself. */
|
|
25
|
+
exports.MIGRATE_OWNED_PATHS = [
|
|
26
|
+
types_1.MIGRATE_RUNS_RELATIVE_DIR,
|
|
27
|
+
...MIGRATE_PLAN_PATHS,
|
|
28
|
+
];
|
|
29
|
+
/**
|
|
30
|
+
* The scratch state is excluded even when git ignores it, since its ignore
|
|
31
|
+
* rule can go missing mid-run.
|
|
32
|
+
*/
|
|
33
|
+
function migrateCommitExcludes(root) {
|
|
34
|
+
return [
|
|
35
|
+
types_1.MIGRATE_RUNS_RELATIVE_DIR,
|
|
36
|
+
...MIGRATE_PLAN_PATHS.filter((path) => isUncommitted(path, root)),
|
|
37
|
+
];
|
|
38
|
+
}
|
|
39
|
+
function isUncommitted(path, root) {
|
|
40
|
+
const status = (0, git_utils_1.getPathHeadStatus)(path, root);
|
|
41
|
+
switch (status) {
|
|
42
|
+
case 'absent':
|
|
43
|
+
return true;
|
|
44
|
+
// On a failed probe the path stays visible, so clean-tree checks err
|
|
45
|
+
// toward dirty.
|
|
46
|
+
case 'committed':
|
|
47
|
+
case 'unknown':
|
|
48
|
+
return false;
|
|
49
|
+
default: {
|
|
50
|
+
const unhandled = status;
|
|
51
|
+
throw new Error(`Unhandled path HEAD status: ${unhandled}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function migrateTreeStatus(root) {
|
|
56
|
+
return (0, git_utils_1.getWorkingTreeStatus)(root, migrateCommitExcludes(root));
|
|
57
|
+
}
|
|
58
|
+
const AGENT_SESSION_NO_INPUT = "Commits in this session cannot ask for input, such as a signing passphrase or a hook's prompt";
|
|
59
|
+
function commitFailureGuidance(recovery, inAgentSession) {
|
|
60
|
+
switch (recovery) {
|
|
61
|
+
case 'later-step':
|
|
62
|
+
// Without the session half, the agent continues as the absorb guidance
|
|
63
|
+
// says, and a cause that fails every commit leaves the run uncommitted.
|
|
64
|
+
return `Any uncommitted changes will be included in the next successful commit, which will reference this migration; if they remain uncommitted, the end-of-run output will list this migration so you can commit or revert them manually.${inAgentSession
|
|
65
|
+
? ` ${AGENT_SESSION_NO_INPUT}, so later commits may fail the same way until the cause is fixed. Before the next step, tell the user what failed and ask whether to fix the cause first or to continue as is. Either way nx tries every later commit, and the first one that lands includes these changes.`
|
|
66
|
+
: ''}`;
|
|
67
|
+
case 'manual':
|
|
68
|
+
return `Commit or revert any remaining uncommitted changes manually.${inAgentSession
|
|
69
|
+
? ` ${AGENT_SESSION_NO_INPUT}. Tell the user what failed.`
|
|
70
|
+
: ''}`;
|
|
71
|
+
default: {
|
|
72
|
+
const unhandled = recovery;
|
|
73
|
+
throw new Error(`Unhandled commit failure recovery: ${unhandled}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
23
77
|
/**
|
|
24
78
|
* `pendingMigrations` are listed in the commit body so a `git log -p` reader
|
|
25
79
|
* can see which earlier migrations' diffs this commit absorbed (their own
|
|
26
80
|
* commits failed and `git add -A` picked their working-tree state up too).
|
|
27
81
|
*
|
|
28
|
-
*
|
|
29
|
-
* behavior
|
|
30
|
-
*
|
|
82
|
+
* `recovery` picks the failure guidance: the default describes the classic
|
|
83
|
+
* loop's absorb-and-recap behavior, and a caller with no later migration step
|
|
84
|
+
* (a `--run-migration` run) passes 'manual'.
|
|
85
|
+
*
|
|
86
|
+
* A `sink` collects the output for a caller sharing the terminal with an
|
|
87
|
+
* agent, and the commit then runs without the terminal.
|
|
31
88
|
*/
|
|
32
|
-
async function commitMigrationIfRequested(root, migration, shouldCreateCommits, commitPrefix, installDepsIfChanged, pendingMigrations = [],
|
|
89
|
+
async function commitMigrationIfRequested(root, migration, shouldCreateCommits, commitPrefix, installDepsIfChanged, pendingMigrations = [], recovery = 'later-step', sink) {
|
|
33
90
|
if (!shouldCreateCommits)
|
|
34
91
|
return { status: 'disabled' };
|
|
92
|
+
const out = sink ?? deferred_output_1.terminalOutput;
|
|
35
93
|
await installDepsIfChanged();
|
|
36
|
-
// Generator may have only touched gitignored paths or the excluded
|
|
37
|
-
//
|
|
94
|
+
// Generator may have only touched gitignored paths or the excluded owned
|
|
95
|
+
// paths, or the prompt half made no change: log neutrally, not as an error.
|
|
38
96
|
// The probe excludes what the commit excludes, else the commit fails empty.
|
|
39
|
-
|
|
97
|
+
const excludes = migrateCommitExcludes(root);
|
|
98
|
+
if (!(0, git_utils_1.hasUncommittedChanges)(root, excludes)) {
|
|
40
99
|
out.line('dim', `- No changes to commit for ${migration.name}.`);
|
|
41
100
|
return { status: 'no-changes' };
|
|
42
101
|
}
|
|
43
102
|
const commitMessage = buildCommitMessage(`${commitPrefix}${migration.name}`, pendingMigrations);
|
|
44
103
|
try {
|
|
45
|
-
const sha = await (0, git_utils_1.tryCommitChangesAsync)(commitMessage, root,
|
|
104
|
+
const sha = await (0, git_utils_1.tryCommitChangesAsync)(commitMessage, root, excludes, {
|
|
105
|
+
withoutTerminal: sink !== undefined,
|
|
106
|
+
});
|
|
46
107
|
if (sha)
|
|
47
108
|
return { status: 'committed', sha };
|
|
48
109
|
// null = commit landed but `git rev-parse HEAD` failed (see
|
|
@@ -52,7 +113,7 @@ async function commitMigrationIfRequested(root, migration, shouldCreateCommits,
|
|
|
52
113
|
}
|
|
53
114
|
catch (err) {
|
|
54
115
|
const reason = err instanceof Error ? err.message : String(err);
|
|
55
|
-
out.line('red', `The commit for ${migration.name} failed:\n${reason}\nCheck \`git status\` and \`git log\`; the commit may have landed despite this error. ${
|
|
116
|
+
out.line('red', `The commit for ${migration.name} failed:\n${reason}\nCheck \`git status\` and \`git log\`; the commit may have landed despite this error. ${commitFailureGuidance(recovery, sink !== undefined)}`);
|
|
56
117
|
return { status: 'failed', reason };
|
|
57
118
|
}
|
|
58
119
|
}
|
|
@@ -76,19 +137,21 @@ function buildCommitMessage(subject, pendingMigrations) {
|
|
|
76
137
|
return lines.join('\n');
|
|
77
138
|
}
|
|
78
139
|
/**
|
|
79
|
-
* Commits
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
* package.json edit `nx migrate latest`
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* the working tree is
|
|
140
|
+
* Commits pre-existing working-tree state, except what `migrateCommitExcludes`
|
|
141
|
+
* leaves out, into a dedicated "checkpoint" commit before the first migration
|
|
142
|
+
* runs. Without this, the first migration's commit would absorb whatever was
|
|
143
|
+
* already pending (most commonly the package.json edit `nx migrate latest`
|
|
144
|
+
* produces and the lockfile churn from the orchestrator's
|
|
145
|
+
* `npm install --ignore-scripts` step), and migration 1's validation would see
|
|
146
|
+
* that mixed in with the generator output. No-op when the working tree is
|
|
147
|
+
* already clean.
|
|
86
148
|
*/
|
|
87
149
|
function commitCheckpointBeforeMigrations(root, commitPrefix) {
|
|
88
|
-
|
|
150
|
+
const excludes = migrateCommitExcludes(root);
|
|
151
|
+
if (!(0, git_utils_1.hasUncommittedChanges)(root, excludes))
|
|
89
152
|
return;
|
|
90
153
|
try {
|
|
91
|
-
const sha = (0, git_utils_1.tryCommitChanges)(`${commitPrefix}checkpoint before running migrations`, root,
|
|
154
|
+
const sha = (0, git_utils_1.tryCommitChanges)(`${commitPrefix}checkpoint before running migrations`, root, excludes);
|
|
92
155
|
if (sha) {
|
|
93
156
|
logger_1.logger.info(pc.dim(`- Checkpoint commit created: ${sha}`));
|
|
94
157
|
return;
|
|
@@ -113,11 +176,6 @@ function commitCheckpointBeforeMigrations(root, commitPrefix) {
|
|
|
113
176
|
});
|
|
114
177
|
}
|
|
115
178
|
}
|
|
116
|
-
/**
|
|
117
|
-
* `agenticHasDiffContext` gates the agent prompt: without per-migration commits
|
|
118
|
-
* to isolate a migration's diff, the prompt embeds a file list instead of
|
|
119
|
-
* pointing at git.
|
|
120
|
-
*/
|
|
121
179
|
function resolveCreateCommits(args) {
|
|
122
180
|
const { createCommits, mode, isGitRepo, commitPrefixIsCustom } = args;
|
|
123
181
|
// The orchestrator forces the agentic defaults without the `--agentic` flag,
|
|
@@ -127,7 +185,6 @@ function resolveCreateCommits(args) {
|
|
|
127
185
|
if (createCommits === true && !isGitRepo) {
|
|
128
186
|
return {
|
|
129
187
|
effective: false,
|
|
130
|
-
agenticHasDiffContext: false,
|
|
131
188
|
error: '`--create-commits` requires a git repository. Run `git init` first, or omit the flag.',
|
|
132
189
|
};
|
|
133
190
|
}
|
|
@@ -135,7 +192,6 @@ function resolveCreateCommits(args) {
|
|
|
135
192
|
if (createCommits === false) {
|
|
136
193
|
return {
|
|
137
194
|
effective: false,
|
|
138
|
-
agenticHasDiffContext: false,
|
|
139
195
|
warning: (orchestrated
|
|
140
196
|
? "--no-create-commits was passed, but orchestrated migrate runs create per-migration commits by default. Without them, the agent can't isolate the current migration's changes from earlier migrations in this run. Drop --no-create-commits for accurate per-migration review."
|
|
141
197
|
: "--no-create-commits was passed alongside --agentic. Without per-migration commits, the agent can't isolate the current migration's changes from earlier migrations in this run. Drop --no-create-commits for accurate per-migration review.") +
|
|
@@ -149,7 +205,6 @@ function resolveCreateCommits(args) {
|
|
|
149
205
|
if (!isGitRepo) {
|
|
150
206
|
return {
|
|
151
207
|
effective: false,
|
|
152
|
-
agenticHasDiffContext: false,
|
|
153
208
|
warning: (orchestrated
|
|
154
209
|
? 'Orchestrated migrate runs create per-migration commits by default, but the workspace is not a git repository. Continuing without commits, so the agent will not receive per-file diff context. Run `git init` to enable.'
|
|
155
210
|
: '`--agentic` enables per-migration commits by default, but the workspace is not a git repository. Continuing without commits, so the agent will not receive per-file diff context. Run `git init` to enable.') +
|
|
@@ -158,11 +213,10 @@ function resolveCreateCommits(args) {
|
|
|
158
213
|
: ''),
|
|
159
214
|
};
|
|
160
215
|
}
|
|
161
|
-
return { effective: true
|
|
216
|
+
return { effective: true };
|
|
162
217
|
}
|
|
163
218
|
return {
|
|
164
219
|
effective: createCommits === true,
|
|
165
|
-
agenticHasDiffContext: false,
|
|
166
220
|
warning: commitPrefixIsCustom && createCommits !== true
|
|
167
221
|
? 'A custom migrate commit prefix is configured, but commits are not enabled for this run, so it has no effect. Set `migrate.createCommits` to `true` (or pass `--create-commits`) to create a commit per migration.'
|
|
168
222
|
: undefined,
|
|
@@ -9,12 +9,12 @@ import { type MigrateArgs } from './command-object';
|
|
|
9
9
|
* config value never trips the mutually-exclusive-flag guards in
|
|
10
10
|
* `parseMigrationsOptions`: `include` and `multiMajorMode` in the generate
|
|
11
11
|
* phase only; `createCommits` / `commitPrefix` and `agentic` / `validate` when
|
|
12
|
-
* running the whole migrations file or a standalone single migration
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
12
|
+
* running the whole migrations file or a standalone single migration, and
|
|
13
|
+
* `finalValidation` for the whole file only. A `--run-id` reconcile or
|
|
14
|
+
* recorded worker takes none of them: a recorded run takes its commit config
|
|
15
|
+
* from run.json and is driven by the outer agent. A `--run-migrations
|
|
16
|
+
* --run-id` continue takes `agentic` only, to select the agent of the new
|
|
17
|
+
* session. A `--start-fresh` starts a new run and takes all five.
|
|
18
18
|
*
|
|
19
19
|
* `include` is carried as `includeFromConfig` so it is never mistaken for an
|
|
20
20
|
* explicit `--include`: `resolveInclude` applies it only when the resolved
|
|
@@ -14,12 +14,12 @@ const MULTI_MAJOR_MODE_ENV = 'NX_MULTI_MAJOR_MODE';
|
|
|
14
14
|
* config value never trips the mutually-exclusive-flag guards in
|
|
15
15
|
* `parseMigrationsOptions`: `include` and `multiMajorMode` in the generate
|
|
16
16
|
* phase only; `createCommits` / `commitPrefix` and `agentic` / `validate` when
|
|
17
|
-
* running the whole migrations file or a standalone single migration
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
17
|
+
* running the whole migrations file or a standalone single migration, and
|
|
18
|
+
* `finalValidation` for the whole file only. A `--run-id` reconcile or
|
|
19
|
+
* recorded worker takes none of them: a recorded run takes its commit config
|
|
20
|
+
* from run.json and is driven by the outer agent. A `--run-migrations
|
|
21
|
+
* --run-id` continue takes `agentic` only, to select the agent of the new
|
|
22
|
+
* session. A `--start-fresh` starts a new run and takes all five.
|
|
23
23
|
*
|
|
24
24
|
* `include` is carried as `includeFromConfig` so it is never mistaken for an
|
|
25
25
|
* explicit `--include`: `resolveInclude` applies it only when the resolved
|
|
@@ -60,6 +60,12 @@ function applyNxJsonMigrateDefaults(args, migrateConfig, env = process.env) {
|
|
|
60
60
|
assertType(migrateConfig.validate, 'boolean', 'validate');
|
|
61
61
|
merged.validate = migrateConfig.validate;
|
|
62
62
|
}
|
|
63
|
+
if (isRunMigrations &&
|
|
64
|
+
merged.finalValidation === undefined &&
|
|
65
|
+
migrateConfig.finalValidation !== undefined) {
|
|
66
|
+
assertType(migrateConfig.finalValidation, 'boolean', 'finalValidation');
|
|
67
|
+
merged.finalValidation = migrateConfig.finalValidation;
|
|
68
|
+
}
|
|
63
69
|
}
|
|
64
70
|
// A continue takes `agentic` too; the reconcile and the worker must not:
|
|
65
71
|
// there it trips the `--agentic`/`--run-id` parse conflict.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Pure presentation helpers for the migrate run phase (`--run-migrations` and
|
|
3
3
|
* the single-migration worker). Shared glyph vocabulary:
|
|
4
|
-
* `→` start,
|
|
4
|
+
* `→` start, `↷` skipped, `ℹ` info, `─` boundary
|
|
5
5
|
*
|
|
6
6
|
* Inputs are typed structurally (e.g. `{ name: string }[]`) so this module
|
|
7
7
|
* stays decoupled from the migration executor in migrate.ts.
|
|
@@ -18,11 +18,6 @@ export declare function resetSgrAfterAgent(): void;
|
|
|
18
18
|
* each migration with the migration index and identity.
|
|
19
19
|
*/
|
|
20
20
|
export declare function logMigrationBoundary(index: number, total: number, pkg: string, name: string): void;
|
|
21
|
-
/**
|
|
22
|
-
* Logs the outcome line that closes an agentic phase. Vocabulary:
|
|
23
|
-
* ✓ <label>[ (<sha>)]: <summary>
|
|
24
|
-
*/
|
|
25
|
-
export declare function logAgenticSuccessOutcome(label: string, sha: string | null, summary: string): void;
|
|
26
21
|
/**
|
|
27
22
|
* Callers must already know an agentic step was owed; this only picks which one
|
|
28
23
|
* the waiver dropped. The dropped-`agentContext` note is aimed at the migration
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resetSgrAfterAgent = resetSgrAfterAgent;
|
|
4
4
|
exports.logMigrationBoundary = logMigrationBoundary;
|
|
5
|
-
exports.logAgenticSuccessOutcome = logAgenticSuccessOutcome;
|
|
6
5
|
exports.logWaivedAgenticStep = logWaivedAgenticStep;
|
|
7
6
|
exports.countLandedCommits = countLandedCommits;
|
|
8
7
|
exports.countWaivedAgenticSteps = countWaivedAgenticSteps;
|
|
@@ -19,7 +18,7 @@ const migration_shape_1 = require("./migration-shape");
|
|
|
19
18
|
/**
|
|
20
19
|
* Pure presentation helpers for the migrate run phase (`--run-migrations` and
|
|
21
20
|
* the single-migration worker). Shared glyph vocabulary:
|
|
22
|
-
* `→` start,
|
|
21
|
+
* `→` start, `↷` skipped, `ℹ` info, `─` boundary
|
|
23
22
|
*
|
|
24
23
|
* Inputs are typed structurally (e.g. `{ name: string }[]`) so this module
|
|
25
24
|
* stays decoupled from the migration executor in migrate.ts.
|
|
@@ -43,14 +42,6 @@ function logMigrationBoundary(index, total, pkg, name) {
|
|
|
43
42
|
const dashes = Math.max(3, targetWidth - label.length);
|
|
44
43
|
logger_1.logger.info(`${label}${'─'.repeat(dashes)}`);
|
|
45
44
|
}
|
|
46
|
-
/**
|
|
47
|
-
* Logs the outcome line that closes an agentic phase. Vocabulary:
|
|
48
|
-
* ✓ <label>[ (<sha>)]: <summary>
|
|
49
|
-
*/
|
|
50
|
-
function logAgenticSuccessOutcome(label, sha, summary) {
|
|
51
|
-
const shaPart = sha ? ` (${sha})` : '';
|
|
52
|
-
logger_1.logger.info(`${pc.green('✓')} ${label}${shaPart}: ${summary}`);
|
|
53
|
-
}
|
|
54
45
|
/**
|
|
55
46
|
* Callers must already know an agentic step was owed; this only picks which one
|
|
56
47
|
* the waiver dropped. The dropped-`agentContext` note is aimed at the migration
|
|
@@ -81,6 +81,7 @@ export declare class Migrator {
|
|
|
81
81
|
prompt?: string;
|
|
82
82
|
requires?: Record<string, string>;
|
|
83
83
|
documentation?: string;
|
|
84
|
+
optionalUpdate?: boolean;
|
|
84
85
|
package: string;
|
|
85
86
|
name: string;
|
|
86
87
|
}[];
|
|
@@ -111,6 +112,8 @@ export declare class Migrator {
|
|
|
111
112
|
private addPackageUpdate;
|
|
112
113
|
private areRequirementsMet;
|
|
113
114
|
private areIncompatiblePackagesPresent;
|
|
115
|
+
private shouldCollectMigration;
|
|
116
|
+
private areRequirementsMetAfterUpdates;
|
|
114
117
|
private areMigrationRequirementsMet;
|
|
115
118
|
private isMigrationForHigherVersionThanWhatIsInstalled;
|
|
116
119
|
private wasMigrationSkipped;
|
|
@@ -196,7 +199,9 @@ export { filterDowngradedUpdates };
|
|
|
196
199
|
export declare function generateMigrationsJsonAndUpdatePackageJson(root: string, opts: GenerateMigrations, fetch?: MigratorOptions['fetch']): Promise<void>;
|
|
197
200
|
export { isPromptOnlyMigration, isHybridMigration };
|
|
198
201
|
export declare function formatSkippedPromptsNextStep(skipped: PlannedMigration[]): string;
|
|
199
|
-
export declare function executeMigrations(root: string, migrations: PlannedMigration[], isVerbose: boolean, shouldCreateCommits: boolean, commitPrefix: string, shouldSkipInstall?: boolean, agentic?: ResolvedAgentic,
|
|
202
|
+
export declare function executeMigrations(root: string, migrations: PlannedMigration[], isVerbose: boolean, shouldCreateCommits: boolean, commitPrefix: string, shouldSkipInstall?: boolean, agentic?: Exclude<ResolvedAgentic, {
|
|
203
|
+
kind: 'enabled';
|
|
204
|
+
}>): Promise<{
|
|
200
205
|
migrationsWithNoChanges: PlannedMigration[];
|
|
201
206
|
skippedPromptsCount: number;
|
|
202
207
|
notRunMigrationsCount: number;
|
|
@@ -213,33 +218,4 @@ export declare function migrate(root: string, args: {
|
|
|
213
218
|
}, rawArgs: string[]): Promise<number>;
|
|
214
219
|
export declare function readLocalNxVersion(root: string): string | undefined;
|
|
215
220
|
export declare function runMigration(): Promise<number>;
|
|
216
|
-
/**
|
|
217
|
-
* Resolves a migration's collection once and derives everything the run loop
|
|
218
|
-
* needs from that single read: the implementation context (`collection` +
|
|
219
|
-
* `collectionPath`, handed to `runNxOrAngularMigration`) and, for agentic runs,
|
|
220
|
-
* the workspace-relative documentation path handed to the agent.
|
|
221
|
-
*
|
|
222
|
-
* Read fresh per migration (not cached across the loop) so a prior migration's
|
|
223
|
-
* reinstall is reflected, exactly as before. Error handling matches each field's
|
|
224
|
-
* role:
|
|
225
|
-
* - Migrations that run an implementation REQUIRE the collection; an unreadable
|
|
226
|
-
* collection throws and aborts that migration (caught by the run loop).
|
|
227
|
-
* - Prompt-only migrations don't run an implementation, so the collection is
|
|
228
|
-
* read only to resolve documentation - a failure there is non-fatal: the
|
|
229
|
-
* prompt still runs and the supplementary doc is skipped with a warning.
|
|
230
|
-
*/
|
|
231
|
-
export declare function resolveMigrationForRun(root: string, migration: {
|
|
232
|
-
package: string;
|
|
233
|
-
name: string;
|
|
234
|
-
documentation?: string;
|
|
235
|
-
implementation?: string;
|
|
236
|
-
factory?: string;
|
|
237
|
-
prompt?: string;
|
|
238
|
-
}, resolveDocumentation: boolean): {
|
|
239
|
-
resolvedCollection?: {
|
|
240
|
-
collection: MigrationsJson;
|
|
241
|
-
collectionPath: string;
|
|
242
|
-
};
|
|
243
|
-
documentationPath?: string;
|
|
244
|
-
};
|
|
245
221
|
export declare function nxCliPath(nxWorkspaceRoot?: string): Promise<string>;
|