@depup/nx 23.1.2-depup.1 → 23.2.0-depup.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 +7 -6
- package/changes.json +12 -8
- package/dist/bin/init-local.js +3 -5
- package/dist/bin/nx.js +1 -0
- package/dist/src/adapter/ngcli-adapter.js +60 -1
- package/dist/src/ai/constants.d.ts +15 -0
- package/dist/src/ai/constants.js +17 -1
- package/dist/src/ai/set-up-ai-agents/set-up-ai-agents.js +57 -9
- package/dist/src/ai/utils.d.ts +13 -0
- package/dist/src/ai/utils.js +29 -0
- package/dist/src/analytics/analytics.js +2 -4
- package/dist/src/command-line/completion/command-object.js +7 -12
- package/dist/src/command-line/configure-ai-agents/configure-ai-agents.js +42 -31
- package/dist/src/command-line/format/format.js +84 -101
- package/dist/src/command-line/generate/generate.js +35 -35
- package/dist/src/command-line/import/import.js +29 -38
- package/dist/src/command-line/init/ai-agent-prompts.js +5 -11
- package/dist/src/command-line/init/command-object.js +4 -2
- package/dist/src/command-line/init/configure-plugins.js +4 -1
- package/dist/src/command-line/init/implementation/add-nx-to-monorepo.js +12 -32
- package/dist/src/command-line/init/implementation/add-nx-to-nest.js +17 -21
- package/dist/src/command-line/init/implementation/add-nx-to-npm-repo.js +8 -21
- package/dist/src/command-line/init/implementation/add-nx-to-turborepo.js +3 -17
- package/dist/src/command-line/init/implementation/angular/index.js +10 -15
- package/dist/src/command-line/init/implementation/angular/legacy-angular-versions.js +2 -0
- package/dist/src/command-line/init/implementation/angular/standalone-workspace.js +8 -2
- package/dist/src/command-line/init/implementation/check-compatible-with-plugins.js +2 -0
- package/dist/src/command-line/init/implementation/dot-nx/add-nx-scripts.js +5 -0
- package/dist/src/command-line/init/implementation/format.d.ts +18 -0
- package/dist/src/command-line/init/implementation/format.js +114 -0
- package/dist/src/command-line/init/implementation/utils.js +8 -8
- package/dist/src/command-line/init/init-v1.js +15 -18
- package/dist/src/command-line/init/init-v2.js +77 -66
- package/dist/src/command-line/migrate/agentic/definitions.js +36 -9
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.d.ts +37 -22
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.js +30 -39
- package/dist/src/command-line/migrate/agentic/handoff.d.ts +7 -7
- package/dist/src/command-line/migrate/agentic/handoff.js +13 -10
- package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.d.ts +7 -12
- package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.js +7 -0
- package/dist/src/command-line/migrate/agentic/run-step.d.ts +10 -0
- package/dist/src/command-line/migrate/agentic/run-step.js +1 -0
- package/dist/src/command-line/migrate/agentic/runner.js +24 -24
- package/dist/src/command-line/migrate/agentic/select.d.ts +10 -2
- package/dist/src/command-line/migrate/agentic/select.js +30 -32
- package/dist/src/command-line/migrate/agentic/types.d.ts +33 -3
- package/dist/src/command-line/migrate/agentic/types.js +35 -0
- package/dist/src/command-line/migrate/command-object.d.ts +6 -0
- package/dist/src/command-line/migrate/command-object.js +19 -1
- package/dist/src/command-line/migrate/execute-migration.d.ts +28 -9
- package/dist/src/command-line/migrate/execute-migration.js +112 -27
- package/dist/src/command-line/migrate/migrate-analytics.d.ts +35 -0
- package/dist/src/command-line/migrate/migrate-analytics.js +64 -0
- package/dist/src/command-line/migrate/migrate-commits.d.ts +38 -8
- package/dist/src/command-line/migrate/migrate-commits.js +130 -15
- package/dist/src/command-line/migrate/migrate-config.d.ts +13 -12
- package/dist/src/command-line/migrate/migrate-config.js +22 -14
- package/dist/src/command-line/migrate/migrate-output.d.ts +45 -7
- package/dist/src/command-line/migrate/migrate-output.js +52 -8
- package/dist/src/command-line/migrate/migrate-ui-api.d.ts +2 -1
- package/dist/src/command-line/migrate/migrate-ui-api.js +16 -7
- package/dist/src/command-line/migrate/migrate.d.ts +24 -55
- package/dist/src/command-line/migrate/migrate.js +553 -226
- package/dist/src/command-line/migrate/migration-shape.d.ts +8 -0
- package/dist/src/command-line/migrate/multi-major.js +7 -10
- package/dist/src/command-line/migrate/resolve-package-version.js +4 -8
- package/dist/src/command-line/migrate/run/agent-output.d.ts +20 -0
- package/dist/src/command-line/migrate/run/agent-output.js +65 -0
- package/dist/src/command-line/migrate/run/index.d.ts +9 -0
- package/dist/src/command-line/migrate/run/index.js +23 -0
- package/dist/src/command-line/migrate/run/orchestrator.d.ts +20 -0
- package/dist/src/command-line/migrate/run/orchestrator.js +1200 -0
- package/dist/src/command-line/migrate/run/run-id.d.ts +16 -0
- package/dist/src/command-line/migrate/run/run-id.js +56 -0
- package/dist/src/command-line/migrate/run/run-state.d.ts +157 -0
- package/dist/src/command-line/migrate/run/run-state.js +438 -0
- package/dist/src/command-line/migrate/run/state-lock.d.ts +25 -0
- package/dist/src/command-line/migrate/run/state-lock.js +76 -0
- package/dist/src/command-line/migrate/run/state-machine.d.ts +84 -0
- package/dist/src/command-line/migrate/run/state-machine.js +315 -0
- package/dist/src/command-line/migrate/run/util.d.ts +59 -0
- package/dist/src/command-line/migrate/run/util.js +148 -0
- package/dist/src/command-line/migrate/run/worker.d.ts +16 -0
- package/dist/src/command-line/migrate/run/worker.js +682 -0
- package/dist/src/command-line/migrate/run-migration-process.js +6 -5
- package/dist/src/command-line/migrate/safe-prompt.d.ts +14 -26
- package/dist/src/command-line/migrate/safe-prompt.js +32 -43
- package/dist/src/command-line/migrate/sort-migrations.d.ts +16 -0
- package/dist/src/command-line/migrate/sort-migrations.js +32 -0
- package/dist/src/command-line/migrate/step-actions.d.ts +5 -0
- package/dist/src/command-line/migrate/step-actions.js +12 -0
- package/dist/src/command-line/migrate/text.d.ts +18 -0
- package/dist/src/command-line/migrate/text.js +26 -0
- package/dist/src/command-line/migrate/version-skew-guard.d.ts +60 -0
- package/dist/src/command-line/migrate/version-skew-guard.js +175 -0
- package/dist/src/command-line/nx-cloud/connect/connect-to-nx-cloud.js +16 -20
- package/dist/src/command-line/nx-cloud/start-nx-agents/command-object.d.ts +2 -0
- package/dist/src/command-line/nx-cloud/start-nx-agents/command-object.js +16 -0
- package/dist/src/command-line/nx-cloud/start-nx-agents/start-nx-agents.d.ts +4 -0
- package/dist/src/command-line/nx-cloud/start-nx-agents/start-nx-agents.js +13 -0
- package/dist/src/command-line/nx-commands.js +26 -24
- package/dist/src/command-line/release/changelog.js +6 -17
- package/dist/src/command-line/release/plan.js +15 -28
- package/dist/src/command-line/release/publish.js +5 -0
- package/dist/src/command-line/release/release.js +6 -17
- package/dist/src/command-line/release/utils/release-graph.d.ts +1 -0
- package/dist/src/command-line/release/utils/release-graph.js +10 -2
- package/dist/src/command-line/release/utils/remote-release-clients/github.js +10 -22
- package/dist/src/command-line/release/utils/remote-release-clients/gitlab.js +13 -22
- package/dist/src/command-line/release/utils/resolve-semver-specifier.js +19 -41
- package/dist/src/command-line/release/version/resolve-current-version.js +7 -10
- package/dist/src/command-line/release/version.js +2 -2
- package/dist/src/command-line/reset/reset.js +17 -15
- package/dist/src/command-line/yargs-utils/shared-options.d.ts +1 -1
- package/dist/src/command-line/yargs-utils/shared-options.js +3 -1
- package/dist/src/config/misc-interfaces.d.ts +19 -7
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/core/graph/styles.js +1 -1
- package/dist/src/daemon/client/client.d.ts +2 -7
- package/dist/src/daemon/client/client.js +113 -28
- package/dist/src/daemon/client/daemon-environment.d.ts +35 -0
- package/dist/src/daemon/client/daemon-environment.js +106 -6
- package/dist/src/daemon/client/daemon-socket-messenger.d.ts +1 -1
- package/dist/src/daemon/client/daemon-socket-messenger.js +8 -3
- package/dist/src/daemon/is-v8-serializer-enabled.d.ts +2 -2
- package/dist/src/daemon/is-v8-serializer-enabled.js +2 -2
- package/dist/src/daemon/message-types/daemon-message.d.ts +2 -1
- package/dist/src/daemon/message-types/daemon-message.js +25 -2
- package/dist/src/daemon/sandbox-socket-hint.d.ts +27 -0
- package/dist/src/daemon/sandbox-socket-hint.js +136 -0
- package/dist/src/daemon/server/client-socket-context.d.ts +1 -1
- package/dist/src/daemon/server/client-socket-context.js +2 -3
- package/dist/src/daemon/server/dotenv-graph-changes.d.ts +97 -0
- package/dist/src/daemon/server/dotenv-graph-changes.js +284 -0
- package/dist/src/daemon/server/handle-client-env.d.ts +8 -0
- package/dist/src/daemon/server/handle-client-env.js +92 -0
- package/dist/src/daemon/server/handle-outputs-changes.d.ts +10 -0
- package/dist/src/daemon/server/handle-outputs-changes.js +86 -0
- package/dist/src/daemon/server/project-graph-incremental-recomputation.d.ts +21 -0
- package/dist/src/daemon/server/project-graph-incremental-recomputation.js +159 -6
- package/dist/src/daemon/server/server.js +36 -72
- package/dist/src/daemon/server/shutdown-utils.d.ts +1 -1
- package/dist/src/daemon/server/shutdown-utils.js +2 -2
- package/dist/src/daemon/socket-utils.d.ts +26 -7
- package/dist/src/daemon/socket-utils.js +45 -31
- package/dist/src/daemon/tmp-dir.d.ts +10 -0
- package/dist/src/daemon/tmp-dir.js +21 -37
- package/dist/src/devkit-internals.d.ts +20 -9
- package/dist/src/devkit-internals.js +49 -6
- package/dist/src/executors/run-commands/running-tasks.js +46 -29
- package/dist/src/generators/internal-utils/{format-changed-files-with-prettier-if-available.d.ts → format-changed-files.d.ts} +6 -6
- package/dist/src/generators/internal-utils/format-changed-files.js +163 -0
- package/dist/src/generators/testing-utils/create-tree-with-empty-workspace.d.ts +15 -0
- package/dist/src/generators/testing-utils/create-tree-with-empty-workspace.js +21 -3
- package/dist/src/migrations/update-15-0-0/prefix-outputs.js +2 -2
- package/dist/src/migrations/update-16-0-0/remove-nrwl-cli.js +2 -2
- package/dist/src/migrations/update-16-0-0/update-depends-on-to-tokens.js +2 -2
- package/dist/src/migrations/update-16-0-0/update-nx-cloud-runner.js +2 -2
- package/dist/src/migrations/update-16-2-0/remove-run-commands-output-path.js +2 -2
- package/dist/src/migrations/update-17-0-0/rm-default-collection-npm-scope.js +2 -2
- package/dist/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.js +2 -2
- package/dist/src/migrations/update-17-2-0/move-default-base.js +2 -2
- package/dist/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.js +2 -2
- package/dist/src/migrations/update-19-2-4/set-project-name.js +2 -2
- package/dist/src/migrations/update-20-0-0/move-use-daemon-process.js +2 -2
- package/dist/src/migrations/update-20-0-1/use-legacy-cache.js +2 -2
- package/dist/src/migrations/update-21-0-0/release-changelog-config-changes.js +2 -2
- package/dist/src/migrations/update-21-0-0/release-version-config-changes.js +2 -2
- package/dist/src/migrations/update-21-0-0/remove-custom-tasks-runner.js +2 -2
- package/dist/src/migrations/update-21-0-0/remove-legacy-cache.js +2 -2
- package/dist/src/migrations/update-22-0-0/consolidate-release-tag-config.js +2 -2
- package/dist/src/migrations/update-22-0-0/release-version-config-changes.js +2 -2
- package/dist/src/migrations/update-22-2-0/add-self-healing-to-gitignore.js +2 -2
- package/dist/src/migrations/update-22-6-0/add-claude-settings-local-to-git-ignore.js +2 -2
- package/dist/src/migrations/update-22-6-0/add-claude-worktrees-to-git-ignore.js +2 -2
- package/dist/src/migrations/update-22-7-0/add-polygraph-to-git-ignore.js +2 -2
- package/dist/src/migrations/update-23-0-0/add-migrate-runs-to-git-ignore.js +2 -2
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.js +2 -2
- package/dist/src/native/index.d.ts +7 -3
- 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/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +3 -3
- package/dist/src/nx-cloud/utilities/url-shorten.d.ts +1 -4
- package/dist/src/nx-cloud/utilities/url-shorten.js +9 -8
- package/dist/src/plugins/js/lock-file/lock-file.d.ts +46 -4
- package/dist/src/plugins/js/lock-file/lock-file.js +192 -15
- package/dist/src/plugins/js/lock-file/npm-parser.js +10 -3
- package/dist/src/plugins/js/lock-file/pnpm-parser.js +356 -62
- package/dist/src/plugins/js/lock-file/project-graph-pruning.d.ts +25 -1
- package/dist/src/plugins/js/lock-file/project-graph-pruning.js +78 -4
- package/dist/src/plugins/js/lock-file/pruned-output.d.ts +330 -0
- package/dist/src/plugins/js/lock-file/pruned-output.js +1441 -0
- package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.d.ts +1 -0
- package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.js +6 -5
- package/dist/src/plugins/js/utils/register.d.ts +11 -0
- package/dist/src/plugins/js/utils/register.js +40 -6
- package/dist/src/project-graph/plugins/get-plugins.d.ts +27 -1
- package/dist/src/project-graph/plugins/get-plugins.js +110 -5
- package/dist/src/project-graph/plugins/isolation/enabled.js +1 -4
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.d.ts +16 -0
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +69 -11
- package/dist/src/project-graph/plugins/isolation/messaging.js +1 -3
- package/dist/src/project-graph/plugins/isolation/plugin-worker.js +23 -2
- package/dist/src/project-graph/project-graph.js +27 -2
- package/dist/src/project-graph/utils/project-configuration/project-nodes-manager.d.ts +7 -0
- package/dist/src/project-graph/utils/project-configuration/project-nodes-manager.js +14 -6
- package/dist/src/project-graph/utils/project-configuration/target-defaults.js +47 -21
- package/dist/src/tasks-runner/is-tui-enabled.js +3 -1
- package/dist/src/tasks-runner/life-cycle.d.ts +2 -2
- package/dist/src/tasks-runner/life-cycle.js +2 -2
- package/dist/src/tasks-runner/life-cycles/performance-report.d.ts +12 -0
- package/dist/src/tasks-runner/life-cycles/performance-report.js +62 -3
- package/dist/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.d.ts +26 -1
- package/dist/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.js +99 -5
- package/dist/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.d.ts +26 -0
- package/dist/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.js +113 -17
- package/dist/src/tasks-runner/pseudo-ipc.js +14 -13
- package/dist/src/tasks-runner/pseudo-terminal.d.ts +17 -3
- package/dist/src/tasks-runner/pseudo-terminal.js +22 -10
- package/dist/src/tasks-runner/run-command.js +32 -39
- package/dist/src/tasks-runner/running-tasks/batch-process.d.ts +55 -0
- package/dist/src/tasks-runner/running-tasks/batch-process.js +161 -8
- package/dist/src/tasks-runner/task-env.d.ts +25 -0
- package/dist/src/tasks-runner/task-env.js +39 -0
- package/dist/src/tasks-runner/task-orchestrator.d.ts +68 -0
- package/dist/src/tasks-runner/task-orchestrator.js +159 -8
- package/dist/src/utils/analytics-enabled.d.ts +7 -0
- package/dist/src/utils/analytics-enabled.js +11 -0
- package/dist/src/utils/analytics-prompt.js +4 -7
- package/dist/src/utils/cache-directory.d.ts +62 -3
- package/dist/src/utils/cache-directory.js +276 -25
- package/dist/src/utils/catalog/bun-manager-utils.d.ts +8 -0
- package/dist/src/utils/catalog/bun-manager-utils.js +174 -0
- package/dist/src/utils/catalog/bun-manager.d.ts +28 -0
- package/dist/src/utils/catalog/bun-manager.js +130 -0
- package/dist/src/utils/catalog/index.d.ts +1 -1
- package/dist/src/utils/catalog/index.js +1 -1
- package/dist/src/utils/catalog/manager-factory.js +3 -0
- package/dist/src/utils/catalog/manager-utils.d.ts +8 -1
- package/dist/src/utils/catalog/manager-utils.js +9 -4
- package/dist/src/utils/catalog/manager.d.ts +13 -1
- package/dist/src/utils/catalog/manager.js +30 -0
- package/dist/src/utils/catalog/pnpm-manager.d.ts +2 -1
- package/dist/src/utils/catalog/pnpm-manager.js +3 -0
- package/dist/src/utils/catalog/types.d.ts +4 -0
- package/dist/src/utils/catalog/yarn-manager.d.ts +6 -2
- package/dist/src/utils/catalog/yarn-manager.js +23 -32
- package/dist/src/utils/child-process.d.ts +31 -1
- package/dist/src/utils/child-process.js +103 -0
- package/dist/src/utils/chunkify.d.ts +7 -1
- package/dist/src/utils/chunkify.js +10 -3
- package/dist/src/utils/consume-messages-from-socket.d.ts +42 -7
- package/dist/src/utils/consume-messages-from-socket.js +273 -38
- package/dist/src/utils/db-connection.js +8 -16
- package/dist/src/utils/exit-codes.d.ts +9 -0
- package/dist/src/utils/exit-codes.js +19 -0
- package/dist/src/utils/formatters/index.d.ts +13 -0
- package/dist/src/utils/formatters/index.js +74 -0
- package/dist/src/utils/formatters/oxfmt.d.ts +32 -0
- package/dist/src/utils/formatters/oxfmt.js +764 -0
- package/dist/src/utils/formatters/prettier.d.ts +26 -0
- package/dist/src/utils/formatters/prettier.js +201 -0
- package/dist/src/utils/formatters/shared.d.ts +5 -0
- package/dist/src/utils/formatters/shared.js +8 -0
- package/dist/src/utils/git-utils.d.ts +38 -2
- package/dist/src/utils/git-utils.js +422 -19
- package/dist/src/utils/has-nx-js-plugin.d.ts +1 -1
- package/dist/src/utils/has-nx-js-plugin.js +1 -1
- package/dist/src/utils/ignore.d.ts +47 -5
- package/dist/src/utils/ignore.js +93 -11
- package/dist/src/utils/kill-child-on-host-exit.d.ts +7 -0
- package/dist/src/utils/kill-child-on-host-exit.js +42 -0
- package/dist/src/utils/nx-console-prompt.js +3 -6
- package/dist/src/utils/nx-tmp-dir.d.ts +5 -0
- package/dist/src/utils/nx-tmp-dir.js +7 -2
- package/dist/src/utils/output.d.ts +153 -0
- package/dist/src/utils/output.js +289 -5
- package/dist/src/utils/owned-private-dir.d.ts +13 -0
- package/dist/src/utils/owned-private-dir.js +39 -0
- package/dist/src/utils/package-json.d.ts +2 -0
- package/dist/src/utils/package-manager.js +17 -7
- package/dist/src/utils/params.d.ts +7 -1
- package/dist/src/utils/params.js +64 -6
- package/dist/src/utils/permission-errors.d.ts +11 -0
- package/dist/src/utils/permission-errors.js +17 -0
- package/dist/src/utils/plugins/core-plugins.js +4 -0
- package/dist/src/utils/prompt-helpers.d.ts +53 -0
- package/dist/src/utils/prompt-helpers.js +111 -0
- package/dist/src/utils/socket-refused-exit-code.d.ts +15 -0
- package/dist/src/utils/socket-refused-exit-code.js +18 -0
- package/dist/src/utils/write-formatted-json-file.d.ts +3 -2
- package/dist/src/utils/write-formatted-json-file.js +5 -4
- package/package.json +33 -24
- package/dist/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +0 -88
- package/dist/src/utils/is-using-prettier.d.ts +0 -3
- package/dist/src/utils/is-using-prettier.js +0 -62
|
@@ -1,2 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HANDOFFS_DIR_NAME = exports.MIGRATE_RUNS_RELATIVE_DIR = void 0;
|
|
4
|
+
exports.isHandoffGitignoreMigration = isHandoffGitignoreMigration;
|
|
5
|
+
/**
|
|
6
|
+
* Workspace-relative directory holding all migrate-run scratch: a run
|
|
7
|
+
* directory per run id. Shared by the run-dir layout in `handoff.ts` and the
|
|
8
|
+
* agent permission rules in `definitions.ts` so the pre-authorized write scope
|
|
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 handoff
|
|
11
|
+
* runtime for the path alone.
|
|
12
|
+
*/
|
|
13
|
+
exports.MIGRATE_RUNS_RELATIVE_DIR = '.nx/migrate-runs';
|
|
14
|
+
/**
|
|
15
|
+
* The one subtree of a run directory an agent writes: its handoff files.
|
|
16
|
+
* Everything beside it is state Nx owns and reads back, the orchestrator's
|
|
17
|
+
* run state and plan snapshots included, so the pre-authorized write scope
|
|
18
|
+
* stops at this segment. Package names make up the rest of a handoff path,
|
|
19
|
+
* so without it they would occupy the run directory's top level and leave Nx
|
|
20
|
+
* no name it could add there safely.
|
|
21
|
+
*/
|
|
22
|
+
exports.HANDOFFS_DIR_NAME = 'handoffs';
|
|
23
|
+
/**
|
|
24
|
+
* Composite identity of the v23 migration that adds `.nx/migrate-runs` to
|
|
25
|
+
* `.gitignore`. Hard-coded because the agentic preflight is a deliberate
|
|
26
|
+
* one-off coupling: this exact migration owns the entry that keeps
|
|
27
|
+
* `.nx/migrate-runs/<run-id>/...` scratch out of per-migration commits. If
|
|
28
|
+
* the migration is ever renamed, this entry must move with it. It lives here
|
|
29
|
+
* rather than in `handoff-gitignore.ts` so `sortMigrations`' hoist check
|
|
30
|
+
* doesn't load that module's migration-execution machinery.
|
|
31
|
+
*/
|
|
32
|
+
const HANDOFF_GITIGNORE_MIGRATION_PACKAGE = 'nx';
|
|
33
|
+
const HANDOFF_GITIGNORE_MIGRATION_NAME = '23-0-0-add-migrate-runs-to-git-ignore';
|
|
34
|
+
function isHandoffGitignoreMigration(m) {
|
|
35
|
+
return (m.package === HANDOFF_GITIGNORE_MIGRATION_PACKAGE &&
|
|
36
|
+
m.name === HANDOFF_GITIGNORE_MIGRATION_NAME);
|
|
37
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CommandModule } from 'yargs';
|
|
2
2
|
import type { AgenticArg } from './agentic/select';
|
|
3
|
+
import { type StepAction } from './step-actions';
|
|
3
4
|
export declare const yargsMigrateCommand: CommandModule;
|
|
4
5
|
export declare const yargsInternalMigrateCommand: CommandModule;
|
|
5
6
|
export declare const DEFAULT_MIGRATION_COMMIT_PREFIX = "chore: [nx migration] ";
|
|
@@ -17,6 +18,9 @@ export type MultiMajorMode = (typeof MULTI_MAJOR_MODES)[number];
|
|
|
17
18
|
export interface MigrateArgs {
|
|
18
19
|
packageAndVersion?: string;
|
|
19
20
|
runMigrations?: string;
|
|
21
|
+
runMigration?: string;
|
|
22
|
+
runId?: string;
|
|
23
|
+
stepAction?: StepAction;
|
|
20
24
|
include?: MigrateInclude;
|
|
21
25
|
/**
|
|
22
26
|
* nx.json `migrate.include` default. Consumed by `resolveInclude` only when the
|
|
@@ -30,6 +34,8 @@ export interface MigrateArgs {
|
|
|
30
34
|
commitPrefix?: string;
|
|
31
35
|
agentic?: AgenticArg;
|
|
32
36
|
validate?: boolean;
|
|
37
|
+
ifExists?: boolean;
|
|
38
|
+
interactive?: boolean;
|
|
33
39
|
[key: string]: any;
|
|
34
40
|
}
|
|
35
41
|
/**
|
|
@@ -6,11 +6,13 @@ const handle_import_1 = require("../../utils/handle-import");
|
|
|
6
6
|
const documentation_1 = require("../yargs-utils/documentation");
|
|
7
7
|
const shared_options_1 = require("../yargs-utils/shared-options");
|
|
8
8
|
const cli_args_1 = require("./agentic/cli-args");
|
|
9
|
+
const step_actions_1 = require("./step-actions");
|
|
9
10
|
exports.yargsMigrateCommand = {
|
|
10
11
|
command: 'migrate [packageAndVersion]',
|
|
11
12
|
describe: `Creates a migrations file or runs migrations from the migrations file.
|
|
12
13
|
- Migrate packages and create migrations.json (e.g., nx migrate @nx/workspace@latest)
|
|
13
|
-
- Run migrations (e.g., nx migrate --run-migrations=migrations.json). Use flag --if-exists to run migrations only if the migrations file exists
|
|
14
|
+
- Run migrations (e.g., nx migrate --run-migrations=migrations.json). Use flag --if-exists to run migrations only if the migrations file exists.
|
|
15
|
+
- Run a single migration from migrations.json by id (e.g., nx migrate --run-migration=@nx/js:my-migration).`,
|
|
14
16
|
builder: (yargs) => (0, documentation_1.linkToNxDevAndExamples)(withMigrationOptions(yargs), 'migrate'),
|
|
15
17
|
handler: async () => process.exit(await (await (0, handle_import_1.handleImport)('./migrate.js', __dirname)).runMigration()),
|
|
16
18
|
};
|
|
@@ -51,6 +53,22 @@ function withMigrationOptions(yargs) {
|
|
|
51
53
|
.option('runMigrations', {
|
|
52
54
|
describe: `Execute migrations from a file (when the file isn't provided, execute migrations from migrations.json).`,
|
|
53
55
|
type: 'string',
|
|
56
|
+
})
|
|
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.",
|
|
59
|
+
type: 'string',
|
|
60
|
+
})
|
|
61
|
+
.option('runId', {
|
|
62
|
+
// Hidden with the orchestrator itself.
|
|
63
|
+
describe: 'The orchestrated migrate run to record a single migration into, or to reconcile when given without --run-migration.',
|
|
64
|
+
type: 'string',
|
|
65
|
+
hidden: true,
|
|
66
|
+
})
|
|
67
|
+
.option('stepAction', {
|
|
68
|
+
describe: 'How an orchestrated reconcile resolves its single failed or died step.',
|
|
69
|
+
choices: step_actions_1.STEP_ACTIONS,
|
|
70
|
+
type: 'string',
|
|
71
|
+
hidden: true,
|
|
54
72
|
})
|
|
55
73
|
.option('ifExists', {
|
|
56
74
|
describe: `Run migrations only if the migrations file exists, if not continues successfully.`,
|
|
@@ -6,7 +6,7 @@ interface PackageMigrationConfig extends NxMigrationsConfiguration {
|
|
|
6
6
|
packageGroup: ArrayPackageGroup;
|
|
7
7
|
}
|
|
8
8
|
export declare function readPackageMigrationConfig(packageName: string, dir: string): PackageMigrationConfig;
|
|
9
|
-
export declare function runInstall(nxWorkspaceRoot?: string, phase?: MigrationInstallPhase): Promise<void>;
|
|
9
|
+
export declare function runInstall(nxWorkspaceRoot?: string, phase?: MigrationInstallPhase, rerunCommand?: string): Promise<void>;
|
|
10
10
|
export type MigrationInstallPhase = 'pre-migration' | 'post-migration';
|
|
11
11
|
export declare class NpmPeerDepsInstallError extends Error {
|
|
12
12
|
constructor();
|
|
@@ -19,14 +19,24 @@ export declare class NpmPeerDepsInstallError extends Error {
|
|
|
19
19
|
* captured output.
|
|
20
20
|
*/
|
|
21
21
|
export declare function isNpmPeerDepsError(stderr: string): boolean;
|
|
22
|
-
export declare function
|
|
22
|
+
export declare function formatSingleMigrationRerunCommand(migrationId: string): string;
|
|
23
|
+
export declare function logNpmPeerDepsError(phase: MigrationInstallPhase, rerunCommand?: string): void;
|
|
24
|
+
export declare function logSkippedPostMigrationInstall(root: string): void;
|
|
23
25
|
export declare class ChangedDepInstaller {
|
|
24
26
|
private readonly root;
|
|
25
27
|
private readonly shouldSkipInstall;
|
|
28
|
+
private readonly rerunCommand?;
|
|
26
29
|
private initialDeps;
|
|
27
30
|
private _skippedInstall;
|
|
28
|
-
|
|
31
|
+
private _installed;
|
|
32
|
+
constructor(root: string, shouldSkipInstall?: boolean, rerunCommand?: string);
|
|
29
33
|
get skippedInstall(): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Whether an install actually ran. Distinct from `!skippedInstall`, which is
|
|
36
|
+
* only about the skip-install flag: dependencies that never changed leave
|
|
37
|
+
* both false.
|
|
38
|
+
*/
|
|
39
|
+
get installed(): boolean;
|
|
30
40
|
installDepsIfChanged(): Promise<void>;
|
|
31
41
|
}
|
|
32
42
|
export declare function runNxOrAngularMigration(root: string, migration: {
|
|
@@ -34,32 +44,41 @@ export declare function runNxOrAngularMigration(root: string, migration: {
|
|
|
34
44
|
name: string;
|
|
35
45
|
description?: string;
|
|
36
46
|
version: string;
|
|
37
|
-
}, isVerbose: boolean, captureGeneratorOutput?: boolean, resolvedCollection?: {
|
|
38
|
-
collection: MigrationsJson;
|
|
39
|
-
collectionPath: string;
|
|
40
|
-
}): Promise<{
|
|
47
|
+
}, isVerbose: boolean, captureGeneratorOutput?: boolean, resolvedCollection?: ResolvedMigrationCollection): Promise<{
|
|
41
48
|
changes: FileChange[];
|
|
42
49
|
nextSteps: string[];
|
|
43
50
|
agentContext: string[];
|
|
51
|
+
skipAgentic: boolean;
|
|
44
52
|
logs: string;
|
|
45
53
|
madeChanges: boolean;
|
|
46
54
|
}>;
|
|
55
|
+
/**
|
|
56
|
+
* The workspace's declared dependencies, serialized for equality comparison,
|
|
57
|
+
* or `null` when package.json could not be read or parsed. Callers that
|
|
58
|
+
* persist the value across processes need that distinction: an unreadable
|
|
59
|
+
* package.json is not an empty dependency set.
|
|
60
|
+
*/
|
|
61
|
+
export declare function readPackageJsonDeps(root: string): string | null;
|
|
47
62
|
export declare function getStringifiedPackageJsonDeps(root: string): string;
|
|
48
63
|
export declare function runNxMigration(root: string, collectionPath: string, collection: MigrationsJson, name: string, migrationVersion: string | undefined, captureGeneratorOutput: boolean): Promise<{
|
|
49
64
|
changes: FileChange[];
|
|
50
65
|
nextSteps: string[];
|
|
51
66
|
agentContext: string[];
|
|
67
|
+
skipAgentic: boolean;
|
|
52
68
|
logs: string;
|
|
53
69
|
}>;
|
|
54
70
|
export declare function parseMigrationReturn(value: unknown): {
|
|
55
71
|
nextSteps: string[];
|
|
56
72
|
agentContext: string[];
|
|
73
|
+
skipAgentic: boolean;
|
|
57
74
|
};
|
|
58
75
|
export declare function filterStrings(value: unknown): string[];
|
|
59
|
-
export
|
|
76
|
+
export interface ResolvedMigrationCollection {
|
|
60
77
|
collection: MigrationsJson;
|
|
61
78
|
collectionPath: string;
|
|
62
|
-
}
|
|
79
|
+
}
|
|
80
|
+
export declare function readMigrationCollection(packageName: string, root: string): ResolvedMigrationCollection;
|
|
81
|
+
export declare function resolveDocumentationFileToWorkspacePath(root: string, migrationsDir: string, documentation: string): string | undefined;
|
|
63
82
|
export declare function getImplementationPath(collection: MigrationsJson, collectionPath: string, name: string, migrationVersion?: string): {
|
|
64
83
|
path: string;
|
|
65
84
|
fnSymbol: string;
|
|
@@ -4,13 +4,17 @@ exports.getNgCompatLayer = exports.MigrationImplementationMissingError = exports
|
|
|
4
4
|
exports.readPackageMigrationConfig = readPackageMigrationConfig;
|
|
5
5
|
exports.runInstall = runInstall;
|
|
6
6
|
exports.isNpmPeerDepsError = isNpmPeerDepsError;
|
|
7
|
+
exports.formatSingleMigrationRerunCommand = formatSingleMigrationRerunCommand;
|
|
7
8
|
exports.logNpmPeerDepsError = logNpmPeerDepsError;
|
|
9
|
+
exports.logSkippedPostMigrationInstall = logSkippedPostMigrationInstall;
|
|
8
10
|
exports.runNxOrAngularMigration = runNxOrAngularMigration;
|
|
11
|
+
exports.readPackageJsonDeps = readPackageJsonDeps;
|
|
9
12
|
exports.getStringifiedPackageJsonDeps = getStringifiedPackageJsonDeps;
|
|
10
13
|
exports.runNxMigration = runNxMigration;
|
|
11
14
|
exports.parseMigrationReturn = parseMigrationReturn;
|
|
12
15
|
exports.filterStrings = filterStrings;
|
|
13
16
|
exports.readMigrationCollection = readMigrationCollection;
|
|
17
|
+
exports.resolveDocumentationFileToWorkspacePath = resolveDocumentationFileToWorkspacePath;
|
|
14
18
|
exports.getImplementationPath = getImplementationPath;
|
|
15
19
|
exports.isAngularMigration = isAngularMigration;
|
|
16
20
|
const tslib_1 = require("tslib");
|
|
@@ -22,11 +26,13 @@ const handle_import_1 = require("../../utils/handle-import");
|
|
|
22
26
|
const tree_1 = require("../../generators/tree");
|
|
23
27
|
const fileutils_1 = require("../../utils/fileutils");
|
|
24
28
|
const logger_1 = require("../../utils/logger");
|
|
29
|
+
const text_1 = require("./text");
|
|
25
30
|
const package_json_1 = require("../../utils/package-json");
|
|
26
31
|
const package_manager_1 = require("../../utils/package-manager");
|
|
27
32
|
const output_1 = require("../../utils/output");
|
|
28
33
|
const fs_1 = require("fs");
|
|
29
34
|
const installation_directory_1 = require("../../utils/installation-directory");
|
|
35
|
+
const shell_quoting_1 = require("../../utils/shell-quoting");
|
|
30
36
|
const project_graph_1 = require("../../project-graph/project-graph");
|
|
31
37
|
const version_utils_1 = require("./version-utils");
|
|
32
38
|
function readPackageMigrationConfig(packageName, dir) {
|
|
@@ -55,7 +61,7 @@ function readPackageMigrationConfig(packageName, dir) {
|
|
|
55
61
|
};
|
|
56
62
|
}
|
|
57
63
|
}
|
|
58
|
-
function runInstall(nxWorkspaceRoot, phase = 'pre-migration') {
|
|
64
|
+
function runInstall(nxWorkspaceRoot, phase = 'pre-migration', rerunCommand) {
|
|
59
65
|
const cwd = nxWorkspaceRoot ?? process.cwd();
|
|
60
66
|
const packageManager = (0, package_manager_1.detectPackageManager)(cwd);
|
|
61
67
|
const pmCommands = (0, package_manager_1.getPackageManagerCommand)(packageManager, cwd);
|
|
@@ -92,7 +98,7 @@ function runInstall(nxWorkspaceRoot, phase = 'pre-migration') {
|
|
|
92
98
|
// (CLI migrate, `nx repair`, single-migration runner, etc.) surfaces
|
|
93
99
|
// it consistently. Top-level callers catch `NpmPeerDepsInstallError`
|
|
94
100
|
// and return a non-zero exit code without re-logging.
|
|
95
|
-
logNpmPeerDepsError(phase);
|
|
101
|
+
logNpmPeerDepsError(phase, rerunCommand);
|
|
96
102
|
reject(new NpmPeerDepsInstallError());
|
|
97
103
|
return;
|
|
98
104
|
}
|
|
@@ -124,7 +130,20 @@ function isNpmPeerDepsError(stderr) {
|
|
|
124
130
|
lowerStderr.includes('could not resolve dependency') ||
|
|
125
131
|
lowerStderr.includes('conflicting peer dependency'));
|
|
126
132
|
}
|
|
127
|
-
|
|
133
|
+
// The single-migration rerun command lands in copyable guidance (see
|
|
134
|
+
// `logNpmPeerDepsError` below), so quote ids a shell would split or expand.
|
|
135
|
+
// Single quotes stay literal in POSIX shells and PowerShell alike; double
|
|
136
|
+
// quotes would leave $-expansion active in both. The embedded-quote escape is
|
|
137
|
+
// the POSIX '\'' sequence, the one character PowerShell disagrees on (it wants
|
|
138
|
+
// ''). cmd.exe is knowingly not covered: it does not group on single quotes,
|
|
139
|
+
// and no quoting suppresses its %VAR% expansion.
|
|
140
|
+
function formatSingleMigrationRerunCommand(migrationId) {
|
|
141
|
+
const id = (0, shell_quoting_1.needsShellQuoting)(migrationId)
|
|
142
|
+
? `'${migrationId.replace(/'/g, String.raw `'\''`)}'`
|
|
143
|
+
: migrationId;
|
|
144
|
+
return `nx migrate --run-migration=${id}`;
|
|
145
|
+
}
|
|
146
|
+
function logNpmPeerDepsError(phase, rerunCommand = 'nx migrate --run-migrations') {
|
|
128
147
|
const peerDepsResolutionSteps = [
|
|
129
148
|
'Recommended approaches (in order of preference):',
|
|
130
149
|
'',
|
|
@@ -138,7 +157,7 @@ function logNpmPeerDepsError(phase) {
|
|
|
138
157
|
];
|
|
139
158
|
const manualInstallHint = [
|
|
140
159
|
'If you installed the dependencies manually, pass "--skip-install" to avoid re-installing them:',
|
|
141
|
-
|
|
160
|
+
` ${rerunCommand} --skip-install`,
|
|
142
161
|
];
|
|
143
162
|
if (phase === 'pre-migration') {
|
|
144
163
|
output_1.output.error({
|
|
@@ -146,8 +165,8 @@ function logNpmPeerDepsError(phase) {
|
|
|
146
165
|
bodyLines: [
|
|
147
166
|
...peerDepsResolutionSteps,
|
|
148
167
|
'',
|
|
149
|
-
'Once the conflicts are resolved, re-run the
|
|
150
|
-
|
|
168
|
+
'Once the conflicts are resolved, re-run the migration command:',
|
|
169
|
+
` ${rerunCommand}`,
|
|
151
170
|
'',
|
|
152
171
|
...manualInstallHint,
|
|
153
172
|
],
|
|
@@ -160,24 +179,42 @@ function logNpmPeerDepsError(phase) {
|
|
|
160
179
|
...peerDepsResolutionSteps,
|
|
161
180
|
'',
|
|
162
181
|
'Once the conflicts are resolved, run "npm install" to install the updated dependencies.',
|
|
163
|
-
'If the migration was interrupted before completing, re-run
|
|
164
|
-
|
|
182
|
+
'If the migration run was interrupted before completing, re-run it:',
|
|
183
|
+
` ${rerunCommand}`,
|
|
165
184
|
'',
|
|
166
185
|
...manualInstallHint,
|
|
167
186
|
],
|
|
168
187
|
});
|
|
169
188
|
}
|
|
170
189
|
}
|
|
190
|
+
function logSkippedPostMigrationInstall(root) {
|
|
191
|
+
const packageManager = (0, package_manager_1.detectPackageManager)(root);
|
|
192
|
+
const installCommand = (0, package_manager_1.getPackageManagerCommand)(packageManager, root).install;
|
|
193
|
+
output_1.output.warn({
|
|
194
|
+
title: 'Migrations updated your dependencies, but the install was skipped',
|
|
195
|
+
bodyLines: [`Run "${installCommand}" to install the updated dependencies.`],
|
|
196
|
+
});
|
|
197
|
+
}
|
|
171
198
|
class ChangedDepInstaller {
|
|
172
|
-
constructor(root, shouldSkipInstall = false) {
|
|
199
|
+
constructor(root, shouldSkipInstall = false, rerunCommand) {
|
|
173
200
|
this.root = root;
|
|
174
201
|
this.shouldSkipInstall = shouldSkipInstall;
|
|
202
|
+
this.rerunCommand = rerunCommand;
|
|
175
203
|
this._skippedInstall = false;
|
|
204
|
+
this._installed = false;
|
|
176
205
|
this.initialDeps = getStringifiedPackageJsonDeps(root);
|
|
177
206
|
}
|
|
178
207
|
get skippedInstall() {
|
|
179
208
|
return this._skippedInstall;
|
|
180
209
|
}
|
|
210
|
+
/**
|
|
211
|
+
* Whether an install actually ran. Distinct from `!skippedInstall`, which is
|
|
212
|
+
* only about the skip-install flag: dependencies that never changed leave
|
|
213
|
+
* both false.
|
|
214
|
+
*/
|
|
215
|
+
get installed() {
|
|
216
|
+
return this._installed;
|
|
217
|
+
}
|
|
181
218
|
async installDepsIfChanged() {
|
|
182
219
|
const currentDeps = getStringifiedPackageJsonDeps(this.root);
|
|
183
220
|
if (this.initialDeps !== currentDeps) {
|
|
@@ -185,7 +222,8 @@ class ChangedDepInstaller {
|
|
|
185
222
|
this._skippedInstall = true;
|
|
186
223
|
}
|
|
187
224
|
else {
|
|
188
|
-
await runInstall(this.root, 'post-migration');
|
|
225
|
+
await runInstall(this.root, 'post-migration', this.rerunCommand);
|
|
226
|
+
this._installed = true;
|
|
189
227
|
}
|
|
190
228
|
}
|
|
191
229
|
this.initialDeps = currentDeps;
|
|
@@ -197,6 +235,8 @@ async function runNxOrAngularMigration(root, migration, isVerbose, captureGenera
|
|
|
197
235
|
let changes = [];
|
|
198
236
|
let nextSteps = [];
|
|
199
237
|
let agentContext = [];
|
|
238
|
+
// Angular schematics have no return channel, so they can never waive it.
|
|
239
|
+
let skipAgentic = false;
|
|
200
240
|
let logs = '';
|
|
201
241
|
// Angular's `ngResult.changes` is synthesized from the schematic's
|
|
202
242
|
// DryRunEvent stream so Nx and Angular paths can share commit/validation
|
|
@@ -204,16 +244,24 @@ async function runNxOrAngularMigration(root, migration, isVerbose, captureGenera
|
|
|
204
244
|
let madeChanges = false;
|
|
205
245
|
logger_1.logger.info(pc.dim('→ Running generator…'));
|
|
206
246
|
if (!isAngularMigration(collection, migration.name)) {
|
|
207
|
-
({ nextSteps, changes, agentContext, logs } =
|
|
247
|
+
({ nextSteps, changes, agentContext, skipAgentic, logs } =
|
|
248
|
+
await runNxMigration(root, collectionPath, collection, migration.name, migration.version, captureGeneratorOutput));
|
|
208
249
|
madeChanges = changes.length > 0;
|
|
209
|
-
logger_1.logger.info(`Ran ${migration.name} from ${migration.package}`);
|
|
250
|
+
logger_1.logger.info((0, text_1.singleLine)(`Ran ${migration.name} from ${migration.package}`));
|
|
210
251
|
if (migration.description) {
|
|
211
|
-
logger_1.logger.info(` ${migration.description}`);
|
|
252
|
+
logger_1.logger.info((0, text_1.singleLine)(` ${migration.description}`));
|
|
212
253
|
}
|
|
213
254
|
logger_1.logger.info('');
|
|
214
255
|
if (!madeChanges) {
|
|
215
256
|
logger_1.logger.info(`No changes were made\n`);
|
|
216
|
-
return {
|
|
257
|
+
return {
|
|
258
|
+
changes,
|
|
259
|
+
nextSteps,
|
|
260
|
+
agentContext,
|
|
261
|
+
skipAgentic,
|
|
262
|
+
logs,
|
|
263
|
+
madeChanges,
|
|
264
|
+
};
|
|
217
265
|
}
|
|
218
266
|
logger_1.logger.info('Changes:');
|
|
219
267
|
(0, tree_1.printChanges)(changes, ' ');
|
|
@@ -226,32 +274,48 @@ async function runNxOrAngularMigration(root, migration, isVerbose, captureGenera
|
|
|
226
274
|
changes = ngResult.changes;
|
|
227
275
|
madeChanges = ngResult.madeChanges;
|
|
228
276
|
logs = ngResult.loggingQueue.join('\n');
|
|
229
|
-
logger_1.logger.info(`Ran ${migration.name} from ${migration.package}`);
|
|
277
|
+
logger_1.logger.info((0, text_1.singleLine)(`Ran ${migration.name} from ${migration.package}`));
|
|
230
278
|
if (migration.description) {
|
|
231
|
-
logger_1.logger.info(` ${migration.description}`);
|
|
279
|
+
logger_1.logger.info((0, text_1.singleLine)(` ${migration.description}`));
|
|
232
280
|
}
|
|
233
281
|
logger_1.logger.info('');
|
|
234
282
|
if (!madeChanges) {
|
|
235
283
|
logger_1.logger.info(`No changes were made\n`);
|
|
236
|
-
return {
|
|
284
|
+
return {
|
|
285
|
+
changes,
|
|
286
|
+
nextSteps,
|
|
287
|
+
agentContext,
|
|
288
|
+
skipAgentic,
|
|
289
|
+
logs,
|
|
290
|
+
madeChanges,
|
|
291
|
+
};
|
|
237
292
|
}
|
|
238
293
|
logger_1.logger.info('Changes:');
|
|
239
|
-
ngResult.loggingQueue.forEach((log) => logger_1.logger.info(' ' + log));
|
|
294
|
+
ngResult.loggingQueue.forEach((log) => logger_1.logger.info((0, text_1.singleLine)(' ' + log)));
|
|
240
295
|
logger_1.logger.info('');
|
|
241
296
|
}
|
|
242
|
-
return { changes, nextSteps, agentContext, logs, madeChanges };
|
|
297
|
+
return { changes, nextSteps, agentContext, skipAgentic, logs, madeChanges };
|
|
243
298
|
}
|
|
244
|
-
|
|
299
|
+
/**
|
|
300
|
+
* The workspace's declared dependencies, serialized for equality comparison,
|
|
301
|
+
* or `null` when package.json could not be read or parsed. Callers that
|
|
302
|
+
* persist the value across processes need that distinction: an unreadable
|
|
303
|
+
* package.json is not an empty dependency set.
|
|
304
|
+
*/
|
|
305
|
+
function readPackageJsonDeps(root) {
|
|
245
306
|
try {
|
|
246
307
|
const { dependencies, devDependencies } = (0, fileutils_1.readJsonFile)((0, path_1.join)(root, 'package.json'));
|
|
247
308
|
return JSON.stringify([dependencies, devDependencies]);
|
|
248
309
|
}
|
|
249
310
|
catch {
|
|
250
|
-
|
|
251
|
-
// whenever nxw is invoked it will handle the dep updates.
|
|
252
|
-
return '';
|
|
311
|
+
return null;
|
|
253
312
|
}
|
|
254
313
|
}
|
|
314
|
+
function getStringifiedPackageJsonDeps(root) {
|
|
315
|
+
// We don't really care if the .nx/installation property changes,
|
|
316
|
+
// whenever nxw is invoked it will handle the dep updates.
|
|
317
|
+
return readPackageJsonDeps(root) ?? '';
|
|
318
|
+
}
|
|
255
319
|
async function runNxMigration(root, collectionPath, collection, name, migrationVersion, captureGeneratorOutput) {
|
|
256
320
|
const { path: implPath, fnSymbol } = getImplementationPath(collection, collectionPath, name, migrationVersion);
|
|
257
321
|
const fn = require(implPath)[fnSymbol];
|
|
@@ -265,25 +329,31 @@ async function runNxMigration(root, collectionPath, collection, name, migrationV
|
|
|
265
329
|
else {
|
|
266
330
|
result = await fn(host, {});
|
|
267
331
|
}
|
|
268
|
-
const { nextSteps, agentContext } = parseMigrationReturn(result);
|
|
332
|
+
const { nextSteps, agentContext, skipAgentic } = parseMigrationReturn(result);
|
|
269
333
|
host.lock();
|
|
270
334
|
const changes = host.listChanges();
|
|
271
335
|
(0, tree_1.flushChanges)(root, changes);
|
|
272
|
-
return { changes, nextSteps, agentContext, logs };
|
|
336
|
+
return { changes, nextSteps, agentContext, skipAgentic, logs };
|
|
273
337
|
}
|
|
274
338
|
function parseMigrationReturn(value) {
|
|
275
339
|
if (Array.isArray(value)) {
|
|
276
|
-
return {
|
|
340
|
+
return {
|
|
341
|
+
nextSteps: filterStrings(value),
|
|
342
|
+
agentContext: [],
|
|
343
|
+
skipAgentic: false,
|
|
344
|
+
};
|
|
277
345
|
}
|
|
278
346
|
if (value && typeof value === 'object') {
|
|
279
347
|
const obj = value;
|
|
280
348
|
return {
|
|
281
349
|
nextSteps: filterStrings(obj.nextSteps),
|
|
282
350
|
agentContext: filterStrings(obj.agentContext),
|
|
351
|
+
// Strict, so a truthy non-boolean can't opt a migration out of its AI step.
|
|
352
|
+
skipAgentic: obj.skipAgentic === true,
|
|
283
353
|
};
|
|
284
354
|
}
|
|
285
355
|
// Catches `void`, mistakenly-returned generator callbacks, malformed values.
|
|
286
|
-
return { nextSteps: [], agentContext: [] };
|
|
356
|
+
return { nextSteps: [], agentContext: [], skipAgentic: false };
|
|
287
357
|
}
|
|
288
358
|
// Bucket-level tolerance: a single non-string entry shouldn't discard the
|
|
289
359
|
// whole `nextSteps` / `agentContext` array. Migration authors occasionally
|
|
@@ -303,6 +373,21 @@ function readMigrationCollection(packageName, root) {
|
|
|
303
373
|
collectionPath,
|
|
304
374
|
};
|
|
305
375
|
}
|
|
376
|
+
// Workspace-relative because the agent runs with cwd at the workspace root;
|
|
377
|
+
// absolute only for layouts that resolve outside it (hoisted/symlinked).
|
|
378
|
+
function resolveDocumentationFileToWorkspacePath(root, migrationsDir, documentation) {
|
|
379
|
+
let documentationFile;
|
|
380
|
+
try {
|
|
381
|
+
documentationFile = require.resolve(documentation, {
|
|
382
|
+
paths: [migrationsDir],
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
catch {
|
|
386
|
+
return undefined;
|
|
387
|
+
}
|
|
388
|
+
const relativePath = (0, path_1.relative)(root, documentationFile);
|
|
389
|
+
return relativePath.startsWith('..') ? documentationFile : relativePath;
|
|
390
|
+
}
|
|
306
391
|
function getImplementationPath(collection, collectionPath, name, migrationVersion) {
|
|
307
392
|
const g = collection.generators?.[name] || collection.schematics?.[name];
|
|
308
393
|
if (!g) {
|
|
@@ -67,5 +67,40 @@ export declare function reportMigrateRunError(opts: {
|
|
|
67
67
|
migrationCount?: number;
|
|
68
68
|
error?: unknown;
|
|
69
69
|
}): void;
|
|
70
|
+
export declare function reportMigrateOrchestratorInit(opts: {
|
|
71
|
+
migrationCount: number;
|
|
72
|
+
createCommits: boolean;
|
|
73
|
+
}): void;
|
|
74
|
+
/**
|
|
75
|
+
* One event per orchestrator dispense. The `action` (dispense case) is a
|
|
76
|
+
* closed enum carried on a reused dimension, read conditioned on the event
|
|
77
|
+
* name (the same multiplexing pattern as {@link reportMigratePrompt});
|
|
78
|
+
* `attempt` rides the migration-count dimension.
|
|
79
|
+
*/
|
|
80
|
+
export declare function reportMigrateOrchestratorDispense(opts: {
|
|
81
|
+
action: string;
|
|
82
|
+
attempt: number;
|
|
83
|
+
}): void;
|
|
84
|
+
/**
|
|
85
|
+
* Terminal funnel event. The two step tallies and the total dispense count
|
|
86
|
+
* ride reused numeric dimensions, read conditioned on the event name.
|
|
87
|
+
*/
|
|
88
|
+
export declare function reportMigrateOrchestratorComplete(opts: {
|
|
89
|
+
completed: number;
|
|
90
|
+
skipped: number;
|
|
91
|
+
dispenseCount: number;
|
|
92
|
+
}): void;
|
|
93
|
+
/**
|
|
94
|
+
* Counts invocations, not completions: emitted as soon as the migration id
|
|
95
|
+
* resolves, while the worker can still stop before running anything.
|
|
96
|
+
*
|
|
97
|
+
* An invocation recorded into an orchestrated run (`--run-id`) gets its own
|
|
98
|
+
* event name. Every other one keeps the name `--run-migration` shipped with,
|
|
99
|
+
* so that series stays continuous for users who never enable the orchestrator.
|
|
100
|
+
*/
|
|
101
|
+
export declare function reportMigrateSingleMigrationInvocation(opts: {
|
|
102
|
+
migrationType: 'generator' | 'prompt' | 'hybrid';
|
|
103
|
+
orchestrated: boolean;
|
|
104
|
+
}): void;
|
|
70
105
|
export declare function computeMajorsCrossed(installed: string | null | undefined, target: string | null | undefined): number | undefined;
|
|
71
106
|
export declare function safeReport(emit: () => void): void;
|
|
@@ -11,6 +11,10 @@ exports.reportMigrateRunStart = reportMigrateRunStart;
|
|
|
11
11
|
exports.hasMigrateRunStarted = hasMigrateRunStarted;
|
|
12
12
|
exports.reportMigrateRunComplete = reportMigrateRunComplete;
|
|
13
13
|
exports.reportMigrateRunError = reportMigrateRunError;
|
|
14
|
+
exports.reportMigrateOrchestratorInit = reportMigrateOrchestratorInit;
|
|
15
|
+
exports.reportMigrateOrchestratorDispense = reportMigrateOrchestratorDispense;
|
|
16
|
+
exports.reportMigrateOrchestratorComplete = reportMigrateOrchestratorComplete;
|
|
17
|
+
exports.reportMigrateSingleMigrationInvocation = reportMigrateSingleMigrationInvocation;
|
|
14
18
|
exports.computeMajorsCrossed = computeMajorsCrossed;
|
|
15
19
|
exports.safeReport = safeReport;
|
|
16
20
|
const semver_1 = require("semver");
|
|
@@ -180,6 +184,66 @@ function reportMigrateRunError(opts) {
|
|
|
180
184
|
});
|
|
181
185
|
});
|
|
182
186
|
}
|
|
187
|
+
function reportMigrateOrchestratorInit(opts) {
|
|
188
|
+
safeReport(() => {
|
|
189
|
+
if (!analytics_1.customDimensions)
|
|
190
|
+
return;
|
|
191
|
+
(0, analytics_1.reportEvent)('migrate_orchestrator_init', {
|
|
192
|
+
[analytics_1.customDimensions.createCommits]: opts.createCommits,
|
|
193
|
+
[analytics_1.customDimensions.migrationCount]: opts.migrationCount,
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* One event per orchestrator dispense. The `action` (dispense case) is a
|
|
199
|
+
* closed enum carried on a reused dimension, read conditioned on the event
|
|
200
|
+
* name (the same multiplexing pattern as {@link reportMigratePrompt});
|
|
201
|
+
* `attempt` rides the migration-count dimension.
|
|
202
|
+
*/
|
|
203
|
+
function reportMigrateOrchestratorDispense(opts) {
|
|
204
|
+
safeReport(() => {
|
|
205
|
+
if (!analytics_1.customDimensions)
|
|
206
|
+
return;
|
|
207
|
+
(0, analytics_1.reportEvent)('migrate_orchestrator_dispense', {
|
|
208
|
+
[analytics_1.customDimensions.promptChoice]: opts.action,
|
|
209
|
+
[analytics_1.customDimensions.migrationCount]: opts.attempt,
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Terminal funnel event. The two step tallies and the total dispense count
|
|
215
|
+
* ride reused numeric dimensions, read conditioned on the event name.
|
|
216
|
+
*/
|
|
217
|
+
function reportMigrateOrchestratorComplete(opts) {
|
|
218
|
+
safeReport(() => {
|
|
219
|
+
if (!analytics_1.customDimensions)
|
|
220
|
+
return;
|
|
221
|
+
(0, analytics_1.reportEvent)('migrate_orchestrator_complete', {
|
|
222
|
+
[analytics_1.customDimensions.appliedCount]: opts.completed,
|
|
223
|
+
[analytics_1.customDimensions.taskCount]: opts.skipped,
|
|
224
|
+
[analytics_1.customDimensions.migrationCount]: opts.dispenseCount,
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Counts invocations, not completions: emitted as soon as the migration id
|
|
230
|
+
* resolves, while the worker can still stop before running anything.
|
|
231
|
+
*
|
|
232
|
+
* An invocation recorded into an orchestrated run (`--run-id`) gets its own
|
|
233
|
+
* event name. Every other one keeps the name `--run-migration` shipped with,
|
|
234
|
+
* so that series stays continuous for users who never enable the orchestrator.
|
|
235
|
+
*/
|
|
236
|
+
function reportMigrateSingleMigrationInvocation(opts) {
|
|
237
|
+
safeReport(() => {
|
|
238
|
+
if (!analytics_1.customDimensions)
|
|
239
|
+
return;
|
|
240
|
+
(0, analytics_1.reportEvent)(opts.orchestrated
|
|
241
|
+
? 'migrate_single_migration_recorded'
|
|
242
|
+
: 'migrate_single_migration_invocation', {
|
|
243
|
+
[analytics_1.customDimensions.promptChoice]: opts.migrationType,
|
|
244
|
+
});
|
|
245
|
+
});
|
|
246
|
+
}
|
|
183
247
|
// `_migrate` runs either from a temp install of the latest CLI or from the
|
|
184
248
|
// workspace-local installation; same signal as the run-phase re-dispatch
|
|
185
249
|
// check in migrate.ts.
|