nx 23.2.0-beta.0 → 23.2.0-beta.10
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/dist/bin/init-local.js +3 -5
- package/dist/bin/nx.js +3 -1
- package/dist/release/changelog-renderer/index.js +4 -5
- package/dist/release/index.d.ts +1 -1
- package/dist/src/adapter/ngcli-adapter.js +60 -1
- package/dist/src/ai/set-up-ai-agents/set-up-ai-agents.js +35 -15
- package/dist/src/analytics/analytics.d.ts +6 -0
- package/dist/src/analytics/analytics.js +16 -10
- package/dist/src/analytics/index.d.ts +1 -1
- package/dist/src/analytics/index.js +2 -1
- package/dist/src/command-line/add/add.js +5 -0
- package/dist/src/command-line/affected/affected.js +1 -0
- package/dist/src/command-line/completion/command-object.js +7 -12
- package/dist/src/command-line/configure-ai-agents/configure-ai-agents.js +19 -25
- 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/graph/graph.d.ts +1 -0
- package/dist/src/command-line/graph/graph.js +15 -6
- package/dist/src/command-line/import/import.js +30 -40
- package/dist/src/command-line/init/ai-agent-prompts.d.ts +1 -1
- package/dist/src/command-line/init/ai-agent-prompts.js +12 -17
- package/dist/src/command-line/init/command-object.js +14 -4
- 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/integrated-workspace.js +2 -5
- package/dist/src/command-line/init/implementation/angular/legacy-angular-versions.js +5 -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 +9 -1
- 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 -0
- package/dist/src/command-line/init/init-v1.js +15 -18
- package/dist/src/command-line/init/init-v2.js +40 -57
- 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 +91 -0
- package/dist/src/command-line/migrate/execute-migration.js +474 -0
- 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 +33 -19
- package/dist/src/command-line/migrate/migrate.d.ts +29 -113
- package/dist/src/command-line/migrate/migrate.js +666 -664
- 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 +17 -21
- package/dist/src/command-line/nx-cloud/connect/view-logs.js +2 -0
- 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 +11 -17
- package/dist/src/command-line/release/index.d.ts +1 -1
- 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/git.js +1 -1
- package/dist/src/command-line/release/utils/release-graph.d.ts +20 -2
- package/dist/src/command-line/release/utils/release-graph.js +81 -21
- package/dist/src/command-line/release/utils/remote-release-clients/github.js +17 -23
- package/dist/src/command-line/release/utils/remote-release-clients/gitlab.js +14 -23
- package/dist/src/command-line/release/utils/resolve-semver-specifier.js +19 -41
- package/dist/src/command-line/release/utils/shared.d.ts +2 -2
- package/dist/src/command-line/release/version/release-group-processor.d.ts +24 -0
- package/dist/src/command-line/release/version/release-group-processor.js +80 -6
- package/dist/src/command-line/release/version/resolve-current-version.js +7 -10
- package/dist/src/command-line/release/version/version-actions.d.ts +27 -2
- package/dist/src/command-line/release/version/version-actions.js +9 -1
- package/dist/src/command-line/release/version.js +10 -6
- package/dist/src/command-line/reset/reset.js +6 -1
- package/dist/src/command-line/run/run-one.js +1 -0
- package/dist/src/command-line/run-many/run-many.js +1 -0
- package/dist/src/command-line/show/show-target/inputs.js +50 -153
- package/dist/src/command-line/show/show-target/outputs.js +48 -173
- package/dist/src/command-line/show/show-target/utils.d.ts +28 -0
- package/dist/src/command-line/show/show-target/utils.js +83 -3
- package/dist/src/command-line/watch/watch.js +13 -0
- package/dist/src/command-line/yargs-utils/shared-options.d.ts +2 -2
- package/dist/src/command-line/yargs-utils/shared-options.js +3 -1
- package/dist/src/commands-runner/create-command-graph.js +5 -0
- package/dist/src/config/misc-interfaces.d.ts +19 -7
- package/dist/src/config/nx-json.d.ts +5 -3
- 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 +52 -1
- package/dist/src/daemon/client/client.js +160 -36
- package/dist/src/daemon/client/daemon-environment.d.ts +17 -0
- package/dist/src/daemon/client/daemon-environment.js +110 -2
- package/dist/src/daemon/client/daemon-socket-messenger.js +4 -0
- package/dist/src/daemon/message-types/daemon-message.d.ts +32 -0
- package/dist/src/daemon/message-types/daemon-message.js +25 -0
- package/dist/src/daemon/server/file-watching/file-watcher-sockets.d.ts +5 -0
- package/dist/src/daemon/server/file-watching/file-watcher-sockets.js +16 -0
- package/dist/src/daemon/server/handle-tasks-execution-hooks.d.ts +1 -1
- package/dist/src/daemon/server/latest-nx.js +5 -2
- package/dist/src/daemon/server/server.js +31 -4
- package/dist/src/daemon/server/shutdown-utils.d.ts +5 -0
- package/dist/src/daemon/server/shutdown-utils.js +11 -4
- package/dist/src/daemon/socket-utils.d.ts +1 -0
- package/dist/src/daemon/socket-utils.js +24 -3
- package/dist/src/daemon/tmp-dir.d.ts +43 -3
- package/dist/src/daemon/tmp-dir.js +437 -15
- package/dist/src/devkit-internals.d.ts +105 -8
- package/dist/src/devkit-internals.js +223 -7
- package/dist/src/executors/run-commands/running-tasks.js +46 -29
- package/dist/src/generators/internal-utils/format-changed-files.d.ts +24 -0
- 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/generators/tree.d.ts +4 -2
- package/dist/src/generators/utils/nx-json.js +13 -3
- package/dist/src/hasher/check-task-files.d.ts +86 -0
- package/dist/src/hasher/check-task-files.js +378 -0
- 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.d.ts +12 -0
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.js +250 -0
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.md +50 -0
- package/dist/src/native/index.d.ts +37 -4
- package/dist/src/native/index.js +71 -28
- package/dist/src/native/native-bindings.js +3 -0
- package/dist/src/native/native-file-cache-location.d.ts +17 -1
- package/dist/src/native/native-file-cache-location.js +86 -12
- 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/get-cloud-options.js +5 -2
- package/dist/src/nx-cloud/utilities/onboarding.js +5 -2
- 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/bun-parser.js +43 -10
- 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/pnpm-parser.js +420 -64
- 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 +92 -12
- 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 +9 -5
- package/dist/src/plugins/js/project-graph/affected/npm-packages.js +51 -20
- package/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +14 -4
- package/dist/src/project-graph/affected/affected-project-graph-models.d.ts +1 -1
- package/dist/src/project-graph/affected/affected-project-graph.d.ts +1 -1
- package/dist/src/project-graph/affected/affected-project-graph.js +2 -2
- package/dist/src/project-graph/affected/locators/project-glob-changes.js +5 -2
- package/dist/src/project-graph/build-project-graph.js +7 -1
- package/dist/src/project-graph/error-types.d.ts +12 -1
- package/dist/src/project-graph/error-types.js +27 -2
- package/dist/src/project-graph/file-utils.js +6 -1
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.d.ts +1 -0
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +18 -1
- package/dist/src/project-graph/plugins/isolation/messaging.d.ts +16 -3
- package/dist/src/project-graph/plugins/isolation/messaging.js +3 -0
- package/dist/src/project-graph/plugins/isolation/plugin-worker.js +58 -8
- package/dist/src/project-graph/plugins/loaded-nx-plugin.js +1 -0
- package/dist/src/project-graph/project-graph.js +23 -0
- package/dist/src/project-graph/utils/project-configuration/name-substitution-manager.d.ts +1 -0
- package/dist/src/project-graph/utils/project-configuration/name-substitution-manager.js +16 -2
- package/dist/src/project-graph/utils/project-configuration/project-nodes-manager.d.ts +12 -8
- package/dist/src/project-graph/utils/project-configuration/project-nodes-manager.js +30 -21
- package/dist/src/project-graph/utils/project-configuration/source-maps.d.ts +12 -5
- package/dist/src/project-graph/utils/project-configuration/source-maps.js +21 -7
- package/dist/src/project-graph/utils/project-configuration/target-defaults.d.ts +1 -1
- package/dist/src/project-graph/utils/project-configuration/target-defaults.js +26 -27
- package/dist/src/project-graph/utils/project-configuration/target-merging.js +50 -8
- package/dist/src/project-graph/utils/project-configuration/target-normalization.js +149 -6
- package/dist/src/project-graph/utils/project-configuration/utils.d.ts +15 -0
- package/dist/src/project-graph/utils/project-configuration/utils.js +42 -6
- package/dist/src/project-graph/utils/project-configuration-utils.d.ts +15 -12
- package/dist/src/project-graph/utils/project-configuration-utils.js +79 -99
- 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-analysis.d.ts +9 -4
- package/dist/src/tasks-runner/life-cycles/performance-life-cycle.js +5 -4
- package/dist/src/tasks-runner/life-cycles/performance-report.d.ts +28 -8
- package/dist/src/tasks-runner/life-cycles/performance-report.js +117 -30
- 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-terminal.d.ts +17 -3
- package/dist/src/tasks-runner/pseudo-terminal.js +22 -10
- package/dist/src/tasks-runner/run-command.js +28 -35
- 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 +9 -0
- package/dist/src/tasks-runner/task-env.js +31 -4
- package/dist/src/tasks-runner/task-orchestrator.d.ts +72 -1
- package/dist/src/tasks-runner/task-orchestrator.js +182 -18
- package/dist/src/tasks-runner/utils.js +2 -6
- package/dist/src/utils/acknowledge-build-scripts.js +7 -5
- 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.d.ts +0 -6
- package/dist/src/utils/analytics-prompt.js +4 -58
- package/dist/src/utils/assert-workspace-validity.js +7 -2
- 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/command-line-utils.js +30 -20
- package/dist/src/utils/exit-codes.d.ts +9 -0
- package/dist/src/utils/exit-codes.js +19 -0
- package/dist/src/utils/fileutils.d.ts +5 -0
- package/dist/src/utils/fileutils.js +7 -2
- 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-revision.d.ts +12 -0
- package/dist/src/utils/git-revision.js +25 -0
- package/dist/src/utils/git-utils.d.ts +48 -2
- package/dist/src/utils/git-utils.js +220 -14
- package/dist/src/utils/git-worktrees.d.ts +30 -0
- package/dist/src/utils/git-worktrees.js +212 -0
- package/dist/src/utils/ignore.d.ts +170 -1
- package/dist/src/utils/ignore.js +263 -11
- package/dist/src/utils/long-running-target.d.ts +10 -0
- package/dist/src/utils/long-running-target.js +19 -0
- package/dist/src/utils/min-release-age/behavior/bun.js +7 -11
- package/dist/src/utils/min-release-age/behavior/npm.js +5 -2
- package/dist/src/utils/min-release-age/packument.js +1 -1
- package/dist/src/utils/nx-console-prompt.js +3 -6
- package/dist/src/utils/nx-tmp-dir.d.ts +18 -0
- package/dist/src/utils/nx-tmp-dir.js +40 -0
- 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 +132 -0
- package/dist/src/utils/owned-private-dir.js +323 -0
- package/dist/src/utils/package-json.d.ts +2 -0
- package/dist/src/utils/package-json.js +11 -7
- package/dist/src/utils/package-manager-config/bunfig.d.ts +14 -0
- package/dist/src/utils/package-manager-config/bunfig.js +49 -0
- package/dist/src/utils/package-manager-config/npmrc.d.ts +23 -0
- package/dist/src/utils/package-manager-config/npmrc.js +124 -0
- package/dist/src/utils/package-manager-config/pnpm-config.d.ts +17 -0
- package/dist/src/utils/package-manager-config/pnpm-config.js +60 -0
- package/dist/src/utils/package-manager.d.ts +23 -2
- package/dist/src/utils/package-manager.js +268 -44
- package/dist/src/utils/params.d.ts +7 -1
- package/dist/src/utils/params.js +64 -6
- 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/provenance.js +6 -14
- package/dist/src/utils/registry-config/bun.d.ts +2 -0
- package/dist/src/utils/registry-config/bun.js +257 -0
- package/dist/src/utils/registry-config/index.d.ts +13 -0
- package/dist/src/utils/registry-config/index.js +102 -0
- package/dist/src/utils/registry-config/pnpm.d.ts +2 -0
- package/dist/src/utils/registry-config/pnpm.js +1551 -0
- package/dist/src/utils/registry-config/utils.d.ts +195 -0
- package/dist/src/utils/registry-config/utils.js +496 -0
- package/dist/src/utils/registry-config/yarn-berry.d.ts +2 -0
- package/dist/src/utils/registry-config/yarn-berry.js +612 -0
- package/dist/src/utils/registry-config/yarn-classic.d.ts +2 -0
- package/dist/src/utils/registry-config/yarn-classic.js +1001 -0
- package/dist/src/utils/safe-spawn.d.ts +24 -0
- package/dist/src/utils/safe-spawn.js +104 -0
- package/dist/src/utils/shell-quoting.d.ts +15 -0
- package/dist/src/utils/shell-quoting.js +35 -0
- package/dist/src/utils/wait-for-socket-connection.d.ts +11 -0
- package/dist/src/utils/wait-for-socket-connection.js +14 -8
- package/dist/src/utils/workspace-id.d.ts +20 -0
- package/dist/src/utils/workspace-id.js +54 -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/migrations.json +6 -0
- package/package.json +29 -19
- package/dist/src/generators/internal-utils/format-changed-files-with-prettier-if-available.d.ts +0 -19
- package/dist/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +0 -81
- package/dist/src/utils/is-using-prettier.d.ts +0 -3
- package/dist/src/utils/is-using-prettier.js +0 -62
- package/dist/src/utils/min-release-age/npmrc.d.ts +0 -15
- package/dist/src/utils/min-release-age/npmrc.js +0 -45
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isHandoffGitignoreMigration = isHandoffGitignoreMigration;
|
|
4
3
|
exports.applyAgenticHandoffGitignoreFallback = applyAgenticHandoffGitignoreFallback;
|
|
5
4
|
const tslib_1 = require("tslib");
|
|
6
5
|
const semver_1 = require("semver");
|
|
@@ -9,50 +8,42 @@ const add_migrate_runs_to_git_ignore_1 = tslib_1.__importDefault(require("../../
|
|
|
9
8
|
const tree_1 = require("../../../generators/tree");
|
|
10
9
|
const git_utils_1 = require("../../../utils/git-utils");
|
|
11
10
|
const logger_1 = require("../../../utils/logger");
|
|
11
|
+
const types_1 = require("./types");
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
* `.
|
|
15
|
-
*
|
|
16
|
-
* `.nx/migrate-runs/<run-id>/...` scratch out of per-migration commits. If
|
|
17
|
-
* the migration is ever renamed, this entry must move with it.
|
|
18
|
-
*/
|
|
19
|
-
const HANDOFF_GITIGNORE_MIGRATION_PACKAGE = 'nx';
|
|
20
|
-
const HANDOFF_GITIGNORE_MIGRATION_NAME = '23-0-0-add-migrate-runs-to-git-ignore';
|
|
21
|
-
function isHandoffGitignoreMigration(m) {
|
|
22
|
-
return (m.package === HANDOFF_GITIGNORE_MIGRATION_PACKAGE &&
|
|
23
|
-
m.name === HANDOFF_GITIGNORE_MIGRATION_NAME);
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Under `--agentic`, the runner writes per-run scratch under
|
|
27
|
-
* `.nx/migrate-runs/<run-id>/`. The v23 migration
|
|
13
|
+
* Both the agentic runner and the orchestrator write per-run scratch under
|
|
14
|
+
* `.nx/migrate-runs/<run-id>/`: handoff files in both cases, plus the durable
|
|
15
|
+
* run state and its plan snapshots for the orchestrator. The v23 migration
|
|
28
16
|
* `23-0-0-add-migrate-runs-to-git-ignore` adds `.nx/migrate-runs` to
|
|
29
|
-
* `.gitignore`;
|
|
30
|
-
*
|
|
31
|
-
* scratch into the user-visible diff.
|
|
17
|
+
* `.gitignore`; in its declared slot (typically late) earlier per-migration
|
|
18
|
+
* commits would absorb the scratch into the user-visible diff.
|
|
32
19
|
*
|
|
33
20
|
* Two paths cover the leak, with no overlap:
|
|
34
21
|
*
|
|
35
|
-
* 1. HOIST
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
22
|
+
* 1. HOIST: `sortMigrations`, which `executeMigrations` applies, sorts the
|
|
23
|
+
* v23 migration to position 0 when it is in the queue, so it runs first
|
|
24
|
+
* through the normal runner with its own log line and commit. A
|
|
25
|
+
* single-migration worker run needs no hoisting: the requested migration
|
|
26
|
+
* is the entire queue.
|
|
39
27
|
*
|
|
40
|
-
* 2. INLINE FALLBACK
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
28
|
+
* 2. INLINE FALLBACK, this function. When the migration is NOT in the queue
|
|
29
|
+
* AND the highest target version is < v23 (intra-pre-v23 `--agentic`
|
|
30
|
+
* run) it will never run, so apply its body inline against an `FsTree`
|
|
31
|
+
* and commit it as a standalone preflight commit (or leave it in the
|
|
32
|
+
* working tree under `--no-create-commits`).
|
|
45
33
|
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
34
|
+
* Not in the queue AND target >= v23 means the user is already past v23. They
|
|
35
|
+
* had the entry historically; if it is gone, that is a conscious removal we
|
|
36
|
+
* respect.
|
|
49
37
|
*/
|
|
50
|
-
async function applyAgenticHandoffGitignoreFallback({ migrations, installedNxVersion, effectiveCreateCommits, commitPrefix, root, }) {
|
|
51
|
-
if (migrations.some(isHandoffGitignoreMigration)) {
|
|
52
|
-
|
|
53
|
-
|
|
38
|
+
async function applyAgenticHandoffGitignoreFallback({ migrations, installedNxVersion, effectiveCreateCommits, commitPrefix, root, applyWhenPlanned = false, commitStandalone = true, }) {
|
|
39
|
+
if (migrations.some(types_1.isHandoffGitignoreMigration)) {
|
|
40
|
+
if (!applyWhenPlanned) {
|
|
41
|
+
// The queue runs it itself: hoisted to the front by the sort comparator
|
|
42
|
+
// in a full run, or as the single requested migration in a worker run.
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
54
45
|
}
|
|
55
|
-
if ((0, semver_1.major)(installedNxVersion) >= 23) {
|
|
46
|
+
else if ((0, semver_1.major)(installedNxVersion) >= 23) {
|
|
56
47
|
// User is past v23. Respect their `.gitignore` state — if the entry
|
|
57
48
|
// is missing, that's a conscious removal.
|
|
58
49
|
return;
|
|
@@ -66,13 +57,13 @@ async function applyAgenticHandoffGitignoreFallback({ migrations, installedNxVer
|
|
|
66
57
|
return;
|
|
67
58
|
}
|
|
68
59
|
(0, tree_1.flushChanges)(root, changes);
|
|
69
|
-
logger_1.logger.info(pc.dim(`- Added .
|
|
70
|
-
if (!effectiveCreateCommits)
|
|
60
|
+
logger_1.logger.info(pc.dim(`- Added ${types_1.MIGRATE_RUNS_RELATIVE_DIR} to .gitignore so this run's scratch state is ignored.`));
|
|
61
|
+
if (!effectiveCreateCommits || !commitStandalone)
|
|
71
62
|
return;
|
|
72
63
|
if (!(0, git_utils_1.hasUncommittedChanges)(root))
|
|
73
64
|
return;
|
|
74
65
|
try {
|
|
75
|
-
const sha = (0, git_utils_1.tryCommitChanges)(`${commitPrefix}add .
|
|
66
|
+
const sha = (0, git_utils_1.tryCommitChanges)(`${commitPrefix}add ${types_1.MIGRATE_RUNS_RELATIVE_DIR} to .gitignore`, root, [types_1.MIGRATE_RUNS_RELATIVE_DIR]);
|
|
76
67
|
if (sha) {
|
|
77
68
|
logger_1.logger.info(pc.dim(` Commit: ${sha}`));
|
|
78
69
|
}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { HandoffFile } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Workspace-relative directory holding all migrate-run scratch (handoff
|
|
4
|
-
* files). Shared with the agent permission rules in `definitions.ts` so the
|
|
5
|
-
* pre-authorized write scope can't drift from the actual layout.
|
|
6
|
-
*/
|
|
7
|
-
export declare const MIGRATE_RUNS_RELATIVE_DIR = ".nx/migrate-runs";
|
|
8
2
|
/** Returns the run directory for a given workspace + run id (target version). */
|
|
9
3
|
export declare function runDirPath(workspaceRoot: string, runId: string): string;
|
|
4
|
+
/** The version-derived run id: the highest target version in the plan. */
|
|
5
|
+
export declare function resolveAgenticRunId(migrations: ReadonlyArray<{
|
|
6
|
+
version: string;
|
|
7
|
+
}>): string;
|
|
10
8
|
/**
|
|
11
9
|
* `mkdir -p` with a contextual error wrapper. Without this, the raw
|
|
12
10
|
* ENOSPC/EACCES/EROFS surfaces with no indication of which directory the
|
|
@@ -22,7 +20,9 @@ export declare function mkdirSafely(dir: string, purpose: string): void;
|
|
|
22
20
|
*/
|
|
23
21
|
export declare function initRunDir(workspaceRoot: string, runId: string): string;
|
|
24
22
|
/**
|
|
25
|
-
* Absolute path of the handoff file for a migration step within a run
|
|
23
|
+
* Absolute path of the handoff file for a migration step within a run, under
|
|
24
|
+
* the run directory's `handoffs/` subtree: the pre-authorized write scope
|
|
25
|
+
* stops there, so a handoff placed anywhere else costs an approval prompt.
|
|
26
26
|
* The package's scope (if any) becomes a real subdirectory so the package name
|
|
27
27
|
* stays readable; two packages can ship a migration with the same name without
|
|
28
28
|
* colliding because they land in different package subdirectories. Each
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MIGRATE_RUNS_RELATIVE_DIR = void 0;
|
|
4
3
|
exports.runDirPath = runDirPath;
|
|
4
|
+
exports.resolveAgenticRunId = resolveAgenticRunId;
|
|
5
5
|
exports.mkdirSafely = mkdirSafely;
|
|
6
6
|
exports.initRunDir = initRunDir;
|
|
7
7
|
exports.stepHandoffPath = stepHandoffPath;
|
|
@@ -10,15 +10,16 @@ exports.readHandoff = readHandoff;
|
|
|
10
10
|
exports.waitForValidHandoff = waitForValidHandoff;
|
|
11
11
|
const fs_1 = require("fs");
|
|
12
12
|
const path_1 = require("path");
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
* pre-authorized write scope can't drift from the actual layout.
|
|
17
|
-
*/
|
|
18
|
-
exports.MIGRATE_RUNS_RELATIVE_DIR = '.nx/migrate-runs';
|
|
13
|
+
const semver_1 = require("semver");
|
|
14
|
+
const version_utils_1 = require("../version-utils");
|
|
15
|
+
const types_1 = require("./types");
|
|
19
16
|
/** Returns the run directory for a given workspace + run id (target version). */
|
|
20
17
|
function runDirPath(workspaceRoot, runId) {
|
|
21
|
-
return (0, path_1.join)(workspaceRoot,
|
|
18
|
+
return (0, path_1.join)(workspaceRoot, types_1.MIGRATE_RUNS_RELATIVE_DIR, runId);
|
|
19
|
+
}
|
|
20
|
+
/** The version-derived run id: the highest target version in the plan. */
|
|
21
|
+
function resolveAgenticRunId(migrations) {
|
|
22
|
+
return (0, semver_1.rsort)(migrations.map((m) => (0, version_utils_1.normalizeVersion)(m.version)))[0];
|
|
22
23
|
}
|
|
23
24
|
/**
|
|
24
25
|
* `mkdir -p` with a contextual error wrapper. Without this, the raw
|
|
@@ -71,14 +72,16 @@ function sanitizeSegment(value) {
|
|
|
71
72
|
return sanitized || '_';
|
|
72
73
|
}
|
|
73
74
|
/**
|
|
74
|
-
* Absolute path of the handoff file for a migration step within a run
|
|
75
|
+
* Absolute path of the handoff file for a migration step within a run, under
|
|
76
|
+
* the run directory's `handoffs/` subtree: the pre-authorized write scope
|
|
77
|
+
* stops there, so a handoff placed anywhere else costs an approval prompt.
|
|
75
78
|
* The package's scope (if any) becomes a real subdirectory so the package name
|
|
76
79
|
* stays readable; two packages can ship a migration with the same name without
|
|
77
80
|
* colliding because they land in different package subdirectories. Each
|
|
78
81
|
* segment is sanitized so the path is always writable on every platform.
|
|
79
82
|
*/
|
|
80
83
|
function stepHandoffPath(runDir, migration) {
|
|
81
|
-
return (0, path_1.join)(runDir, ...migration.package.split('/').map(sanitizeSegment), `${sanitizeSegment(migration.name)}.json`);
|
|
84
|
+
return (0, path_1.join)(runDir, types_1.HANDOFFS_DIR_NAME, ...migration.package.split('/').map(sanitizeSegment), `${sanitizeSegment(migration.name)}.json`);
|
|
82
85
|
}
|
|
83
86
|
/**
|
|
84
87
|
* Reads and validates a handoff file written by an agent. Returns a tagged
|
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Surfaces a migration's `agentContext` to stdout in an XML-tagged block so an
|
|
3
|
-
* outer AI agent driving `nx migrate` can ingest the hints when no inner agent
|
|
4
|
-
* step ran to consume them.
|
|
5
|
-
*
|
|
6
|
-
* Used only when `agentic.kind === 'inside-agent'`. Under `enabled`, the inner
|
|
7
|
-
* step consumes `agentContext` via the prompt builders. Under `disabled` the
|
|
8
|
-
* run is human-driven and printing agent-targeted context would only add noise.
|
|
9
|
-
*
|
|
10
|
-
* The label format is unambiguous so the outer agent can locate the block
|
|
11
|
-
* within the mixed stdout stream (logger output, migration progress, etc.).
|
|
12
|
-
*/
|
|
13
1
|
export interface DroppedAgentContextInput {
|
|
14
2
|
migration: {
|
|
15
3
|
package: string;
|
|
@@ -19,4 +7,11 @@ export interface DroppedAgentContextInput {
|
|
|
19
7
|
agentContext: string[];
|
|
20
8
|
}
|
|
21
9
|
export declare function formatDroppedAgentContextForOuterAgent(input: DroppedAgentContextInput): string;
|
|
10
|
+
export declare function escapeXmlAttr(value: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* Both the classic loop and the single-migration worker call this only under
|
|
13
|
+
* `agentic.kind === 'inside-agent'`. Under `enabled` the inner agent step
|
|
14
|
+
* consumes `agentContext` through the prompt builders; under `disabled` the
|
|
15
|
+
* run is human-driven and agent-targeted context is only noise.
|
|
16
|
+
*/
|
|
22
17
|
export declare function printDroppedAgentContextForOuterAgent(input: DroppedAgentContextInput): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.formatDroppedAgentContextForOuterAgent = formatDroppedAgentContextForOuterAgent;
|
|
4
|
+
exports.escapeXmlAttr = escapeXmlAttr;
|
|
4
5
|
exports.printDroppedAgentContextForOuterAgent = printDroppedAgentContextForOuterAgent;
|
|
5
6
|
const shared_rendering_1 = require("./prompts/shared-rendering");
|
|
6
7
|
function formatDroppedAgentContextForOuterAgent(input) {
|
|
@@ -40,6 +41,12 @@ function escapeXmlAttr(value) {
|
|
|
40
41
|
.replace(/"/g, '"')
|
|
41
42
|
.replace(/'/g, ''');
|
|
42
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Both the classic loop and the single-migration worker call this only under
|
|
46
|
+
* `agentic.kind === 'inside-agent'`. Under `enabled` the inner agent step
|
|
47
|
+
* consumes `agentContext` through the prompt builders; under `disabled` the
|
|
48
|
+
* run is human-driven and agent-targeted context is only noise.
|
|
49
|
+
*/
|
|
43
50
|
function printDroppedAgentContextForOuterAgent(input) {
|
|
44
51
|
const block = formatDroppedAgentContextForOuterAgent(input);
|
|
45
52
|
if (block) {
|
|
@@ -22,6 +22,16 @@ export interface AgenticStepResult {
|
|
|
22
22
|
*/
|
|
23
23
|
ambiguous: boolean;
|
|
24
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* `runStep` travels in the context rather than being imported by its call
|
|
27
|
+
* sites, so this module loads only where the context is built, behind an
|
|
28
|
+
* agentic-enabled gate.
|
|
29
|
+
*/
|
|
30
|
+
export interface AgenticRunContext {
|
|
31
|
+
agentic: EnabledResolvedAgentic;
|
|
32
|
+
runDir: string;
|
|
33
|
+
runStep: typeof runAgenticPromptStep;
|
|
34
|
+
}
|
|
25
35
|
export interface RunAgenticPromptStepInput {
|
|
26
36
|
root: string;
|
|
27
37
|
migration: {
|
|
@@ -41,10 +41,11 @@ async function runAgentic(args) {
|
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
// Counts SIGINTs while the agent runs. Non-zero after exit means the
|
|
44
|
-
// user pressed Ctrl+C → skip the ambiguous abort/continue prompt
|
|
45
|
-
//
|
|
46
|
-
// (ERR_USE_AFTER_CLOSE, setRawMode EIO)
|
|
47
|
-
//
|
|
44
|
+
// user pressed Ctrl+C → skip the ambiguous abort/continue prompt. Prompting
|
|
45
|
+
// in the TTY state left by a SIGINT-killed child misbehaved under enquirer
|
|
46
|
+
// (ERR_USE_AFTER_CLOSE, setRawMode EIO) from async chains `await` could not
|
|
47
|
+
// catch. Whether @clack/prompts shares that fault is unverified, so the skip
|
|
48
|
+
// stays; reproducing it needs a real terminal.
|
|
48
49
|
let userInterruptCount = 0;
|
|
49
50
|
const swallowSigint = () => {
|
|
50
51
|
userInterruptCount++;
|
|
@@ -279,9 +280,10 @@ async function resolveFromHandoffOrPrompt(handoffFilePath, userInterrupted = fal
|
|
|
279
280
|
};
|
|
280
281
|
if (userInterrupted) {
|
|
281
282
|
// User pressed Ctrl+C. Don't show the abort/continue prompt — they
|
|
282
|
-
// already told us what they want
|
|
283
|
-
// SIGINT-killed child
|
|
284
|
-
// ERR_USE_AFTER_CLOSE bugs
|
|
283
|
+
// already told us what they want. Prompting in the TTY state left by a
|
|
284
|
+
// SIGINT-killed child also tripped enquirer's setRawMode-EIO and
|
|
285
|
+
// ERR_USE_AFTER_CLOSE bugs; whether @clack/prompts shares that fault is
|
|
286
|
+
// unverified, so the skip stays. The orchestrator's standard failure
|
|
285
287
|
// cascade surfaces the abort outcome.
|
|
286
288
|
//
|
|
287
289
|
// Forward the underlying cause as pre-rendered summary lines so the
|
|
@@ -357,13 +359,14 @@ function escapeCmdCommand(arg) {
|
|
|
357
359
|
}
|
|
358
360
|
async function promptAmbiguous(cause) {
|
|
359
361
|
// stderr blank line so the spacer lands in the same stream as output.warn
|
|
360
|
-
// and the
|
|
361
|
-
//
|
|
362
|
+
// and the prompt — buffered stdout could otherwise reorder it and glue the
|
|
363
|
+
// prompt to the agent's trailing exit message.
|
|
362
364
|
process.stderr.write('\n');
|
|
363
|
-
// Cause rendered ABOVE the prompt rather than inlined into
|
|
364
|
-
// enquirer's select redraw
|
|
365
|
-
// restore (raw \n-split count), so a multi-line message
|
|
366
|
-
// cells on arrow-key re-renders.
|
|
365
|
+
// Cause rendered ABOVE the prompt rather than inlined into its message:
|
|
366
|
+
// enquirer's select redraw used different math for clear (wrap-aware) vs
|
|
367
|
+
// restore (raw \n-split count), so a multi-line message could leave orphaned
|
|
368
|
+
// cells on arrow-key re-renders. Kept single-line because that constraint is
|
|
369
|
+
// unverified under @clack/prompts, not because the cause still applies.
|
|
367
370
|
const causeLines = describeAmbiguousCause(cause);
|
|
368
371
|
if (causeLines.length > 0) {
|
|
369
372
|
output_1.output.warn({
|
|
@@ -371,24 +374,21 @@ async function promptAmbiguous(cause) {
|
|
|
371
374
|
bodyLines: causeLines,
|
|
372
375
|
});
|
|
373
376
|
}
|
|
374
|
-
//
|
|
375
|
-
//
|
|
376
|
-
// Any other rejection we treat as abort.
|
|
377
|
+
// Cancelling exits 130 from inside the prompt; any other rejection is an
|
|
378
|
+
// abort.
|
|
377
379
|
try {
|
|
378
|
-
const
|
|
379
|
-
name: 'choice',
|
|
380
|
-
type: 'select',
|
|
380
|
+
const choice = await (0, safe_prompt_1.migrateChoice)({
|
|
381
381
|
message: 'How should nx migrate proceed?',
|
|
382
382
|
choices: [
|
|
383
|
-
{
|
|
383
|
+
{ value: 'abort', label: 'Treat as failed — abort the run' },
|
|
384
384
|
{
|
|
385
|
-
|
|
386
|
-
|
|
385
|
+
value: 'continue',
|
|
386
|
+
label: 'Treat as completed — mark done and continue',
|
|
387
387
|
},
|
|
388
388
|
],
|
|
389
389
|
});
|
|
390
|
-
(0, migrate_analytics_1.reportMigratePrompt)('ambiguous_agent_outcome',
|
|
391
|
-
return
|
|
390
|
+
(0, migrate_analytics_1.reportMigratePrompt)('ambiguous_agent_outcome', choice);
|
|
391
|
+
return choice === 'continue'
|
|
392
392
|
? { kind: 'ambiguous-continue' }
|
|
393
393
|
: { kind: 'ambiguous-abort' };
|
|
394
394
|
}
|
|
@@ -10,7 +10,15 @@ export interface ResolveAgenticInput {
|
|
|
10
10
|
interactive?: boolean;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* Callers resolve this once per run-phase invocation and reuse the result for
|
|
14
|
+
* every migration it covers.
|
|
15
15
|
*/
|
|
16
16
|
export declare function resolveAgentic(input: ResolveAgenticInput): Promise<ResolvedAgentic>;
|
|
17
|
+
/**
|
|
18
|
+
* No warning when `--validate` is passed with the agentic flow off: validation
|
|
19
|
+
* requires an active agent session by definition.
|
|
20
|
+
*/
|
|
21
|
+
export declare function resolveShouldRunValidation(args: {
|
|
22
|
+
validate: boolean | undefined;
|
|
23
|
+
agenticKind: ResolvedAgentic['kind'];
|
|
24
|
+
}): boolean;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveAgentic = resolveAgentic;
|
|
4
|
-
|
|
4
|
+
exports.resolveShouldRunValidation = resolveShouldRunValidation;
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
6
|
const jsonc_parser_1 = require("jsonc-parser");
|
|
7
7
|
const path_1 = require("path");
|
|
8
|
-
const pc = tslib_1.__importStar(require("picocolors"));
|
|
9
8
|
const output_1 = require("../../../utils/output");
|
|
10
9
|
const workspace_root_1 = require("../../../utils/workspace-root");
|
|
11
10
|
const migrate_analytics_1 = require("../migrate-analytics");
|
|
@@ -18,8 +17,8 @@ const INSTALL_SUPPORTED_AGENTS_HINT = [
|
|
|
18
17
|
...definitions_1.AGENT_DEFINITIONS.map((def) => ` - ${def.displayName}`),
|
|
19
18
|
];
|
|
20
19
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
20
|
+
* Callers resolve this once per run-phase invocation and reuse the result for
|
|
21
|
+
* every migration it covers.
|
|
23
22
|
*/
|
|
24
23
|
async function resolveAgentic(input) {
|
|
25
24
|
if ((0, inception_1.isInsideAgent)()) {
|
|
@@ -57,6 +56,13 @@ async function resolveAgentic(input) {
|
|
|
57
56
|
}
|
|
58
57
|
return { kind: 'enabled', selectedAgent: selected };
|
|
59
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* No warning when `--validate` is passed with the agentic flow off: validation
|
|
61
|
+
* requires an active agent session by definition.
|
|
62
|
+
*/
|
|
63
|
+
function resolveShouldRunValidation(args) {
|
|
64
|
+
return args.validate !== false && args.agenticKind === 'enabled';
|
|
65
|
+
}
|
|
60
66
|
async function resolveFlag(input, isInteractive, detected) {
|
|
61
67
|
if (input.agentic === true) {
|
|
62
68
|
if (!isInteractive) {
|
|
@@ -121,46 +127,40 @@ async function firePromptForAgentic(migrations, detected) {
|
|
|
121
127
|
const pinChoice = multipleAgents
|
|
122
128
|
? [
|
|
123
129
|
{
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
130
|
+
value: 'yes-pin',
|
|
131
|
+
label: 'Yes, always with the same agent',
|
|
132
|
+
hint: rememberHint,
|
|
127
133
|
},
|
|
128
134
|
]
|
|
129
135
|
: [];
|
|
130
136
|
const choices = [
|
|
131
137
|
{
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
138
|
+
value: 'yes-once',
|
|
139
|
+
label: 'Yes, just this time',
|
|
140
|
+
hint: applyHint,
|
|
135
141
|
},
|
|
136
142
|
{
|
|
137
|
-
|
|
138
|
-
|
|
143
|
+
value: 'yes-flex',
|
|
144
|
+
label: multipleAgents
|
|
139
145
|
? "Yes, always (I'll pick the agent each run)"
|
|
140
146
|
: 'Yes, always',
|
|
141
|
-
|
|
147
|
+
hint: rememberHint,
|
|
142
148
|
},
|
|
143
149
|
...pinChoice,
|
|
144
|
-
{
|
|
145
|
-
{
|
|
150
|
+
{ value: 'no-once', label: 'No, just this time', hint: skipHint },
|
|
151
|
+
{ value: 'no-never', label: 'No, never', hint: rememberHint },
|
|
146
152
|
];
|
|
147
153
|
// Blank line keeps the prompt from gluing to the previous `npm install`
|
|
148
154
|
// output or any earlier orchestrator line.
|
|
149
155
|
console.log();
|
|
150
|
-
//
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
type: 'select',
|
|
156
|
+
// Each choice's hint renders beside it, so the description no longer needs a
|
|
157
|
+
// footer that tracks the cursor.
|
|
158
|
+
const choice = await (0, safe_prompt_1.migrateChoice)({
|
|
154
159
|
message: 'Enable the agentic flow?',
|
|
155
160
|
choices,
|
|
156
|
-
initial: 0,
|
|
157
|
-
footer: function () {
|
|
158
|
-
const focused = this.focused;
|
|
159
|
-
return focused?.description ? pc.dim(` ${focused.description}`) : '';
|
|
160
|
-
},
|
|
161
161
|
});
|
|
162
|
-
(0, migrate_analytics_1.reportMigratePrompt)('agentic',
|
|
163
|
-
switch (
|
|
162
|
+
(0, migrate_analytics_1.reportMigratePrompt)('agentic', choice);
|
|
163
|
+
switch (choice) {
|
|
164
164
|
case 'yes-once':
|
|
165
165
|
return { enabled: true };
|
|
166
166
|
case 'yes-flex':
|
|
@@ -242,12 +242,10 @@ async function selectAgent(detected, explicitId, isInteractive) {
|
|
|
242
242
|
requireInteractiveOrAbort(isInteractive);
|
|
243
243
|
// Blank line keeps the prompt from gluing to the preceding output.
|
|
244
244
|
console.log();
|
|
245
|
-
const
|
|
246
|
-
name: 'id',
|
|
247
|
-
type: 'select',
|
|
245
|
+
const id = await (0, safe_prompt_1.migrateChoice)({
|
|
248
246
|
message: 'Multiple AI agents detected. Which one should Nx use?',
|
|
249
|
-
choices: detected.map((d) => ({
|
|
247
|
+
choices: detected.map((d) => ({ value: d.id, label: d.displayName })),
|
|
250
248
|
});
|
|
251
|
-
(0, migrate_analytics_1.reportMigratePrompt)('agent_select',
|
|
252
|
-
return detected.find((d) => d.id ===
|
|
249
|
+
(0, migrate_analytics_1.reportMigratePrompt)('agent_select', id);
|
|
250
|
+
return detected.find((d) => d.id === id);
|
|
253
251
|
}
|
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
import type { AgentId } from './cli-args';
|
|
2
2
|
export type { AgentId };
|
|
3
|
+
/**
|
|
4
|
+
* Workspace-relative directory holding all migrate-run scratch: a run
|
|
5
|
+
* directory per run id. Shared by the run-dir layout in `handoff.ts` and the
|
|
6
|
+
* agent permission rules in `definitions.ts` so the pre-authorized write scope
|
|
7
|
+
* can't drift from the actual layout. It lives here so `definitions.ts`,
|
|
8
|
+
* loaded whenever the agentic flow is resolved, doesn't pull in the handoff
|
|
9
|
+
* runtime for the path alone.
|
|
10
|
+
*/
|
|
11
|
+
export declare const MIGRATE_RUNS_RELATIVE_DIR = ".nx/migrate-runs";
|
|
12
|
+
/**
|
|
13
|
+
* The one subtree of a run directory an agent writes: its handoff files.
|
|
14
|
+
* Everything beside it is state Nx owns and reads back, the orchestrator's
|
|
15
|
+
* run state and plan snapshots included, so the pre-authorized write scope
|
|
16
|
+
* stops at this segment. Package names make up the rest of a handoff path,
|
|
17
|
+
* so without it they would occupy the run directory's top level and leave Nx
|
|
18
|
+
* no name it could add there safely.
|
|
19
|
+
*/
|
|
20
|
+
export declare const HANDOFFS_DIR_NAME = "handoffs";
|
|
21
|
+
export declare function isHandoffGitignoreMigration(m: {
|
|
22
|
+
package: string;
|
|
23
|
+
name: string;
|
|
24
|
+
}): boolean;
|
|
3
25
|
/**
|
|
4
26
|
* A coding agent that was found on the user's machine, ready to be spawned.
|
|
5
27
|
*
|
|
@@ -21,6 +43,13 @@ export interface InvocationContext {
|
|
|
21
43
|
systemContext: string;
|
|
22
44
|
userPrompt: string;
|
|
23
45
|
workspaceRoot: string;
|
|
46
|
+
/**
|
|
47
|
+
* Name of the run directory under `MIGRATE_RUNS_RELATIVE_DIR` holding this
|
|
48
|
+
* invocation's handoff. A workspace can carry several run directories at
|
|
49
|
+
* once, so a definition that pre-authorizes the handoff write narrows it to
|
|
50
|
+
* this one: the others belong to runs this invocation is not executing.
|
|
51
|
+
*/
|
|
52
|
+
runDirName: string;
|
|
24
53
|
}
|
|
25
54
|
/**
|
|
26
55
|
* What an agent definition returns from `buildInteractive`. The runner combines
|
|
@@ -78,11 +107,12 @@ export type HandoffOutcome = {
|
|
|
78
107
|
causeSummary?: string[];
|
|
79
108
|
};
|
|
80
109
|
/**
|
|
81
|
-
* Result of the up-front resolution phase
|
|
82
|
-
*
|
|
110
|
+
* Result of the up-front resolution phase, run once per run-phase invocation
|
|
111
|
+
* and applied to every migration it covers.
|
|
83
112
|
*
|
|
84
113
|
* - `inside-agent`: nx detected it is itself running inside another agent;
|
|
85
|
-
* every agentic step is skipped and prompt migrations
|
|
114
|
+
* every agentic step is skipped and prompt migrations are surfaced for the
|
|
115
|
+
* outer agent to apply.
|
|
86
116
|
* - `disabled`: the user opted out (explicit `--agentic=false`, declined the
|
|
87
117
|
* up-front prompt, or non-TTY without the flag).
|
|
88
118
|
* - `enabled`: the agentic flow runs and `selectedAgent` is the agent it
|
|
@@ -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.`,
|