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,3 +1,4 @@
|
|
|
1
|
+
import type { ResolvedAgentic } from './agentic/types';
|
|
1
2
|
/**
|
|
2
3
|
* Discriminated result for `commitMigrationIfRequested`. Distinguishes the
|
|
3
4
|
* shapes the executor needs to react to:
|
|
@@ -23,21 +24,20 @@ export type CommitResult = {
|
|
|
23
24
|
status: 'disabled';
|
|
24
25
|
};
|
|
25
26
|
/**
|
|
26
|
-
*
|
|
27
|
+
* `pendingMigrations` are listed in the commit body so a `git log -p` reader
|
|
28
|
+
* can see which earlier migrations' diffs this commit absorbed (their own
|
|
29
|
+
* commits failed and `git add -A` picked their working-tree state up too).
|
|
27
30
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* `git add -A` here captured their working-tree state too). Each entry is
|
|
32
|
-
* rendered as `<package>: <name>` for unambiguous attribution across
|
|
33
|
-
* packages.
|
|
31
|
+
* The default `failureGuidance` describes the classic loop's absorb-and-recap
|
|
32
|
+
* behavior; a caller with no later commit or recap to absorb the diff (the
|
|
33
|
+
* standalone single-migration worker) passes its own.
|
|
34
34
|
*/
|
|
35
35
|
export declare function commitMigrationIfRequested(root: string, migration: {
|
|
36
36
|
name: string;
|
|
37
37
|
}, shouldCreateCommits: boolean, commitPrefix: string, installDepsIfChanged: () => Promise<void>, pendingMigrations?: ReadonlyArray<{
|
|
38
38
|
package: string;
|
|
39
39
|
name: string;
|
|
40
|
-
}
|
|
40
|
+
}>, failureGuidance?: string): Promise<CommitResult>;
|
|
41
41
|
/**
|
|
42
42
|
* Commits any pre-existing working-tree state into a dedicated "checkpoint"
|
|
43
43
|
* commit before the first migration runs. Without this, the first migration's
|
|
@@ -48,3 +48,33 @@ export declare function commitMigrationIfRequested(root: string, migration: {
|
|
|
48
48
|
* the working tree is already clean.
|
|
49
49
|
*/
|
|
50
50
|
export declare function commitCheckpointBeforeMigrations(root: string, commitPrefix: string): void;
|
|
51
|
+
/**
|
|
52
|
+
* `agenticHasDiffContext` gates the agent prompt: without per-migration commits
|
|
53
|
+
* to isolate a migration's diff, the prompt embeds a file list instead of
|
|
54
|
+
* pointing at git.
|
|
55
|
+
*/
|
|
56
|
+
export declare function resolveCreateCommits(args: {
|
|
57
|
+
createCommits: boolean | undefined;
|
|
58
|
+
mode: ResolvedAgentic['kind'] | 'orchestrated';
|
|
59
|
+
isGitRepo: boolean;
|
|
60
|
+
commitPrefixIsCustom?: boolean;
|
|
61
|
+
}): {
|
|
62
|
+
effective: boolean;
|
|
63
|
+
agenticHasDiffContext: boolean;
|
|
64
|
+
warning?: string;
|
|
65
|
+
error?: string;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Asks before a run starts committing on the workspace's default branch, and
|
|
69
|
+
* reports the decision when the answer is no. Returns whether to proceed.
|
|
70
|
+
*
|
|
71
|
+
* Callers gate this on commits being effective and on prompting being
|
|
72
|
+
* possible, so non-interactive runs (CI, `--no-interactive`) never reach here;
|
|
73
|
+
* `confirmCommitsOnDefaultBranch` has no guard of its own and would block on a
|
|
74
|
+
* prompt nobody can answer.
|
|
75
|
+
*/
|
|
76
|
+
export declare function confirmMigrationCommitsOnDefaultBranch(root: string, whatWouldRun: 'running migrations' | 'running the migration'): Promise<boolean>;
|
|
77
|
+
export declare function confirmCommitsOnDefaultBranch(args: {
|
|
78
|
+
currentBranch: string | null;
|
|
79
|
+
defaultBranch: string | null;
|
|
80
|
+
}): Promise<boolean>;
|
|
@@ -2,34 +2,45 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.commitMigrationIfRequested = commitMigrationIfRequested;
|
|
4
4
|
exports.commitCheckpointBeforeMigrations = commitCheckpointBeforeMigrations;
|
|
5
|
+
exports.resolveCreateCommits = resolveCreateCommits;
|
|
6
|
+
exports.confirmMigrationCommitsOnDefaultBranch = confirmMigrationCommitsOnDefaultBranch;
|
|
7
|
+
exports.confirmCommitsOnDefaultBranch = confirmCommitsOnDefaultBranch;
|
|
5
8
|
const tslib_1 = require("tslib");
|
|
6
9
|
const pc = tslib_1.__importStar(require("picocolors"));
|
|
10
|
+
const configuration_1 = require("../../config/configuration");
|
|
11
|
+
const command_line_utils_1 = require("../../utils/command-line-utils");
|
|
7
12
|
const git_utils_1 = require("../../utils/git-utils");
|
|
8
13
|
const logger_1 = require("../../utils/logger");
|
|
9
14
|
const output_1 = require("../../utils/output");
|
|
15
|
+
const types_1 = require("./agentic/types");
|
|
16
|
+
const safe_prompt_1 = require("./safe-prompt");
|
|
17
|
+
// `git add -A` captures an orchestrated run's scratch state whenever the
|
|
18
|
+
// ignore rule that normally hides it goes missing mid-run (a checkout, a
|
|
19
|
+
// .gitignore edit, or the migration's own changes).
|
|
20
|
+
const MIGRATE_COMMIT_EXCLUDES = [types_1.MIGRATE_RUNS_RELATIVE_DIR];
|
|
10
21
|
/**
|
|
11
|
-
*
|
|
22
|
+
* `pendingMigrations` are listed in the commit body so a `git log -p` reader
|
|
23
|
+
* can see which earlier migrations' diffs this commit absorbed (their own
|
|
24
|
+
* commits failed and `git add -A` picked their working-tree state up too).
|
|
12
25
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* `git add -A` here captured their working-tree state too). Each entry is
|
|
17
|
-
* rendered as `<package>: <name>` for unambiguous attribution across
|
|
18
|
-
* packages.
|
|
26
|
+
* The default `failureGuidance` describes the classic loop's absorb-and-recap
|
|
27
|
+
* behavior; a caller with no later commit or recap to absorb the diff (the
|
|
28
|
+
* standalone single-migration worker) passes its own.
|
|
19
29
|
*/
|
|
20
|
-
async function commitMigrationIfRequested(root, migration, shouldCreateCommits, commitPrefix, installDepsIfChanged, pendingMigrations = []) {
|
|
30
|
+
async function commitMigrationIfRequested(root, migration, shouldCreateCommits, commitPrefix, installDepsIfChanged, pendingMigrations = [], failureGuidance = 'The next successful commit will absorb it and reference this migration in its body; if no later commit lands, the end-of-run output will list this migration so you can commit or revert manually.') {
|
|
21
31
|
if (!shouldCreateCommits)
|
|
22
32
|
return { status: 'disabled' };
|
|
23
33
|
await installDepsIfChanged();
|
|
24
|
-
// Generator may have only touched gitignored paths
|
|
25
|
-
// made no change
|
|
26
|
-
|
|
34
|
+
// Generator may have only touched gitignored paths or the excluded scratch
|
|
35
|
+
// dir, or the prompt half made no change: log neutrally, not as an error.
|
|
36
|
+
// The probe excludes what the commit excludes, else the commit fails empty.
|
|
37
|
+
if (!(0, git_utils_1.hasUncommittedChanges)(root, MIGRATE_COMMIT_EXCLUDES)) {
|
|
27
38
|
logger_1.logger.info(pc.dim(`- No changes to commit for ${migration.name}.`));
|
|
28
39
|
return { status: 'no-changes' };
|
|
29
40
|
}
|
|
30
41
|
const commitMessage = buildCommitMessage(`${commitPrefix}${migration.name}`, pendingMigrations);
|
|
31
42
|
try {
|
|
32
|
-
const sha = (0, git_utils_1.tryCommitChanges)(commitMessage, root);
|
|
43
|
+
const sha = (0, git_utils_1.tryCommitChanges)(commitMessage, root, MIGRATE_COMMIT_EXCLUDES);
|
|
33
44
|
if (sha)
|
|
34
45
|
return { status: 'committed', sha };
|
|
35
46
|
// null = commit landed but `git rev-parse HEAD` failed (see
|
|
@@ -39,7 +50,7 @@ async function commitMigrationIfRequested(root, migration, shouldCreateCommits,
|
|
|
39
50
|
}
|
|
40
51
|
catch (err) {
|
|
41
52
|
const reason = err instanceof Error ? err.message : String(err);
|
|
42
|
-
logger_1.logger.info(pc.red(`Could not create a commit for ${migration.name}:\n${reason}\nThe migration's diff remains in the working tree; inspect with \`git status\` / \`git diff\` to review.
|
|
53
|
+
logger_1.logger.info(pc.red(`Could not create a commit for ${migration.name}:\n${reason}\nThe migration's diff remains in the working tree; inspect with \`git status\` / \`git diff\` to review. ${failureGuidance}`));
|
|
43
54
|
return { status: 'failed', reason };
|
|
44
55
|
}
|
|
45
56
|
}
|
|
@@ -72,10 +83,10 @@ function buildCommitMessage(subject, pendingMigrations) {
|
|
|
72
83
|
* the working tree is already clean.
|
|
73
84
|
*/
|
|
74
85
|
function commitCheckpointBeforeMigrations(root, commitPrefix) {
|
|
75
|
-
if (!(0, git_utils_1.hasUncommittedChanges)(root))
|
|
86
|
+
if (!(0, git_utils_1.hasUncommittedChanges)(root, MIGRATE_COMMIT_EXCLUDES))
|
|
76
87
|
return;
|
|
77
88
|
try {
|
|
78
|
-
const sha = (0, git_utils_1.tryCommitChanges)(`${commitPrefix}checkpoint before running migrations`, root);
|
|
89
|
+
const sha = (0, git_utils_1.tryCommitChanges)(`${commitPrefix}checkpoint before running migrations`, root, MIGRATE_COMMIT_EXCLUDES);
|
|
79
90
|
if (sha) {
|
|
80
91
|
logger_1.logger.info(pc.dim(`- Checkpoint commit created: ${sha}`));
|
|
81
92
|
return;
|
|
@@ -100,3 +111,107 @@ function commitCheckpointBeforeMigrations(root, commitPrefix) {
|
|
|
100
111
|
});
|
|
101
112
|
}
|
|
102
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* `agenticHasDiffContext` gates the agent prompt: without per-migration commits
|
|
116
|
+
* to isolate a migration's diff, the prompt embeds a file list instead of
|
|
117
|
+
* pointing at git.
|
|
118
|
+
*/
|
|
119
|
+
function resolveCreateCommits(args) {
|
|
120
|
+
const { createCommits, mode, isGitRepo, commitPrefixIsCustom } = args;
|
|
121
|
+
// The orchestrator forces the agentic defaults without the `--agentic` flag,
|
|
122
|
+
// so its warnings must not name a flag the user never passed.
|
|
123
|
+
const orchestrated = mode === 'orchestrated';
|
|
124
|
+
const agenticKind = orchestrated ? 'enabled' : mode;
|
|
125
|
+
if (createCommits === true && !isGitRepo) {
|
|
126
|
+
return {
|
|
127
|
+
effective: false,
|
|
128
|
+
agenticHasDiffContext: false,
|
|
129
|
+
error: '`--create-commits` requires a git repository. Run `git init` first, or omit the flag.',
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
if (agenticKind === 'enabled') {
|
|
133
|
+
if (createCommits === false) {
|
|
134
|
+
return {
|
|
135
|
+
effective: false,
|
|
136
|
+
agenticHasDiffContext: false,
|
|
137
|
+
warning: (orchestrated
|
|
138
|
+
? "--no-create-commits was passed, but orchestrated migrate runs create per-migration commits by default. Without them, the agent can't isolate the current migration's changes from earlier migrations in this run. Drop --no-create-commits for accurate per-migration review."
|
|
139
|
+
: "--no-create-commits was passed alongside --agentic. Without per-migration commits, the agent can't isolate the current migration's changes from earlier migrations in this run. Drop --no-create-commits for accurate per-migration review.") +
|
|
140
|
+
(commitPrefixIsCustom
|
|
141
|
+
? ' Note: the custom --commit-prefix value will have no effect because commits are disabled.'
|
|
142
|
+
: ''),
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
// Not an error like the explicit `--create-commits` branch above: the
|
|
146
|
+
// agentic default was never asked for, so degrade instead.
|
|
147
|
+
if (!isGitRepo) {
|
|
148
|
+
return {
|
|
149
|
+
effective: false,
|
|
150
|
+
agenticHasDiffContext: false,
|
|
151
|
+
warning: (orchestrated
|
|
152
|
+
? 'Orchestrated migrate runs create per-migration commits by default, but the workspace is not a git repository. Continuing without commits, so the agent will not receive per-file diff context. Run `git init` to enable.'
|
|
153
|
+
: '`--agentic` enables per-migration commits by default, but the workspace is not a git repository. Continuing without commits, so the agent will not receive per-file diff context. Run `git init` to enable.') +
|
|
154
|
+
(commitPrefixIsCustom
|
|
155
|
+
? ' The custom --commit-prefix value will have no effect.'
|
|
156
|
+
: ''),
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
return { effective: true, agenticHasDiffContext: true };
|
|
160
|
+
}
|
|
161
|
+
return {
|
|
162
|
+
effective: createCommits === true,
|
|
163
|
+
agenticHasDiffContext: false,
|
|
164
|
+
warning: commitPrefixIsCustom && createCommits !== true
|
|
165
|
+
? 'A custom migrate commit prefix is configured, but commits are not enabled for this run, so it has no effect. Set `migrate.createCommits` to `true` (or pass `--create-commits`) to create a commit per migration.'
|
|
166
|
+
: undefined,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
// The branch to hold `getBaseRef`'s value against. It may name a remote-tracking
|
|
170
|
+
// ref whose local counterpart drops the remote (the CI-workflow generator writes
|
|
171
|
+
// `origin/<branch>`), yet a local branch can be named `up/feature` while `up` is
|
|
172
|
+
// a remote, so an exact match wins before any stripping and the longest matching
|
|
173
|
+
// remote wins after. `origin` counts even undeclared: the generator assumes it.
|
|
174
|
+
function defaultBranchToCompare(baseRef, currentBranch, root) {
|
|
175
|
+
if (currentBranch === baseRef) {
|
|
176
|
+
return baseRef;
|
|
177
|
+
}
|
|
178
|
+
const remote = [...(0, git_utils_1.getGitRemoteNames)(root), 'origin']
|
|
179
|
+
.filter((name) => baseRef.startsWith(`${name}/`))
|
|
180
|
+
.sort((a, b) => b.length - a.length)[0];
|
|
181
|
+
return remote ? baseRef.slice(remote.length + 1) : baseRef;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Asks before a run starts committing on the workspace's default branch, and
|
|
185
|
+
* reports the decision when the answer is no. Returns whether to proceed.
|
|
186
|
+
*
|
|
187
|
+
* Callers gate this on commits being effective and on prompting being
|
|
188
|
+
* possible, so non-interactive runs (CI, `--no-interactive`) never reach here;
|
|
189
|
+
* `confirmCommitsOnDefaultBranch` has no guard of its own and would block on a
|
|
190
|
+
* prompt nobody can answer.
|
|
191
|
+
*/
|
|
192
|
+
async function confirmMigrationCommitsOnDefaultBranch(root, whatWouldRun) {
|
|
193
|
+
const currentBranch = (0, git_utils_1.getGitCurrentBranch)(root);
|
|
194
|
+
const proceed = await confirmCommitsOnDefaultBranch({
|
|
195
|
+
currentBranch,
|
|
196
|
+
defaultBranch: defaultBranchToCompare((0, command_line_utils_1.getBaseRef)((0, configuration_1.readNxJson)(root)), currentBranch, root),
|
|
197
|
+
});
|
|
198
|
+
if (!proceed) {
|
|
199
|
+
output_1.output.log({
|
|
200
|
+
title: `Skipped ${whatWouldRun} to avoid committing to the default branch '${currentBranch}'.`,
|
|
201
|
+
bodyLines: [
|
|
202
|
+
'Switch to a different branch and re-run, or re-run and confirm to proceed.',
|
|
203
|
+
],
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
return proceed;
|
|
207
|
+
}
|
|
208
|
+
async function confirmCommitsOnDefaultBranch(args) {
|
|
209
|
+
const { currentBranch, defaultBranch } = args;
|
|
210
|
+
if (!currentBranch || !defaultBranch || currentBranch !== defaultBranch) {
|
|
211
|
+
return true;
|
|
212
|
+
}
|
|
213
|
+
return (0, safe_prompt_1.migrateConfirm)({
|
|
214
|
+
message: `You're on the default branch '${currentBranch}'. nx migrate will create a commit for each migration on this branch. Continue?`,
|
|
215
|
+
initial: false,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import type { NxMigrateConfiguration } from '../../config/nx-json';
|
|
2
2
|
import { type MigrateArgs } from './command-object';
|
|
3
3
|
/**
|
|
4
|
-
* Overlays `nx.json` `migrate` defaults onto the raw
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Overlays `nx.json` `migrate` defaults onto the raw CLI args: a CLI flag wins,
|
|
5
|
+
* then `nx.json`, then the built-in default. Returns a new args object; the
|
|
6
|
+
* input is not mutated.
|
|
7
7
|
*
|
|
8
|
-
* Phase-aware
|
|
9
|
-
*
|
|
10
|
-
* `
|
|
11
|
-
*
|
|
12
|
-
*
|
|
8
|
+
* Phase-aware so each option is only filled where it is consumed, and so a
|
|
9
|
+
* config value never trips the mutually-exclusive-flag guards in
|
|
10
|
+
* `parseMigrationsOptions`: `include` and `multiMajorMode` in the generate
|
|
11
|
+
* phase only; `createCommits` / `commitPrefix` and `agentic` / `validate` when
|
|
12
|
+
* running the whole migrations file or a standalone single migration. A
|
|
13
|
+
* `--run-id` invocation takes none of them: a recorded run takes its commit
|
|
14
|
+
* config from run.json and is driven by the outer agent.
|
|
13
15
|
*
|
|
14
|
-
* `include` is carried as `includeFromConfig`
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* unaffected.
|
|
16
|
+
* `include` is carried as `includeFromConfig` so it is never mistaken for an
|
|
17
|
+
* explicit `--include`: `resolveInclude` applies it only when the resolved
|
|
18
|
+
* target supports optional updates.
|
|
18
19
|
*/
|
|
19
20
|
export declare function applyNxJsonMigrateDefaults(args: MigrateArgs, migrateConfig: NxMigrateConfiguration | undefined, env?: NodeJS.ProcessEnv): MigrateArgs;
|
|
20
21
|
/**
|
|
@@ -6,20 +6,21 @@ const cli_args_1 = require("./agentic/cli-args");
|
|
|
6
6
|
const command_object_1 = require("./command-object");
|
|
7
7
|
const MULTI_MAJOR_MODE_ENV = 'NX_MULTI_MAJOR_MODE';
|
|
8
8
|
/**
|
|
9
|
-
* Overlays `nx.json` `migrate` defaults onto the raw
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* Overlays `nx.json` `migrate` defaults onto the raw CLI args: a CLI flag wins,
|
|
10
|
+
* then `nx.json`, then the built-in default. Returns a new args object; the
|
|
11
|
+
* input is not mutated.
|
|
12
12
|
*
|
|
13
|
-
* Phase-aware
|
|
14
|
-
*
|
|
15
|
-
* `
|
|
16
|
-
*
|
|
17
|
-
*
|
|
13
|
+
* Phase-aware so each option is only filled where it is consumed, and so a
|
|
14
|
+
* config value never trips the mutually-exclusive-flag guards in
|
|
15
|
+
* `parseMigrationsOptions`: `include` and `multiMajorMode` in the generate
|
|
16
|
+
* phase only; `createCommits` / `commitPrefix` and `agentic` / `validate` when
|
|
17
|
+
* running the whole migrations file or a standalone single migration. A
|
|
18
|
+
* `--run-id` invocation takes none of them: a recorded run takes its commit
|
|
19
|
+
* config from run.json and is driven by the outer agent.
|
|
18
20
|
*
|
|
19
|
-
* `include` is carried as `includeFromConfig`
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* unaffected.
|
|
21
|
+
* `include` is carried as `includeFromConfig` so it is never mistaken for an
|
|
22
|
+
* explicit `--include`: `resolveInclude` applies it only when the resolved
|
|
23
|
+
* target supports optional updates.
|
|
23
24
|
*/
|
|
24
25
|
function applyNxJsonMigrateDefaults(args, migrateConfig, env = process.env) {
|
|
25
26
|
if (!migrateConfig) {
|
|
@@ -29,7 +30,14 @@ function applyNxJsonMigrateDefaults(args, migrateConfig, env = process.env) {
|
|
|
29
30
|
// `--run-migrations` with no value is normalized to '' by yargs, so a defined
|
|
30
31
|
// (even empty-string) value means we're in the run-migrations phase.
|
|
31
32
|
const isRunMigrations = merged.runMigrations !== undefined;
|
|
32
|
-
|
|
33
|
+
// A bare `--run-id` (orchestrated reconcile) must never take the
|
|
34
|
+
// generate-options overlay, which would leak `include` etc. from nx.json.
|
|
35
|
+
const isSingleMigration = merged.runMigration !== undefined || merged.runId !== undefined;
|
|
36
|
+
// Both overlays are for an invocation that decides these options for
|
|
37
|
+
// itself, which a `--run-id` invocation never does: the recorded worker and
|
|
38
|
+
// the reconcile both read the commit config from run.json, and overlaying
|
|
39
|
+
// `agentic` would trip the `--agentic`/`--run-id` parse conflict.
|
|
40
|
+
if ((isRunMigrations || isSingleMigration) && merged.runId === undefined) {
|
|
33
41
|
if (merged.createCommits === undefined &&
|
|
34
42
|
migrateConfig.createCommits !== undefined) {
|
|
35
43
|
assertType(migrateConfig.createCommits, 'boolean', 'createCommits');
|
|
@@ -53,7 +61,7 @@ function applyNxJsonMigrateDefaults(args, migrateConfig, env = process.env) {
|
|
|
53
61
|
merged.validate = migrateConfig.validate;
|
|
54
62
|
}
|
|
55
63
|
}
|
|
56
|
-
|
|
64
|
+
if (!isRunMigrations && !isSingleMigration) {
|
|
57
65
|
if (merged.include === undefined && migrateConfig.include !== undefined) {
|
|
58
66
|
assertOneOf(migrateConfig.include, command_object_1.MIGRATE_INCLUDE_VALUES, 'include');
|
|
59
67
|
merged.includeFromConfig = migrateConfig.include;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* `→` start · `✓` success · `✗` failure · `↷` skipped · `ℹ` info · `─` boundary
|
|
2
|
+
* Pure presentation helpers for the migrate run phase (`--run-migrations` and
|
|
3
|
+
* the single-migration worker). Shared glyph vocabulary:
|
|
4
|
+
* `→` start, `✓` success, `✗` failure, `↷` skipped, `ℹ` info, `─` boundary
|
|
6
5
|
*
|
|
7
6
|
* Inputs are typed structurally (e.g. `{ name: string }[]`) so this module
|
|
8
|
-
* stays decoupled from
|
|
7
|
+
* stays decoupled from the migration executor in migrate.ts.
|
|
9
8
|
*/
|
|
10
9
|
/**
|
|
11
10
|
* Some agent TUIs (codex, opencode) don't fully reset their cursor / SGR state
|
|
@@ -24,6 +23,22 @@ export declare function logMigrationBoundary(index: number, total: number, pkg:
|
|
|
24
23
|
* ✓ <label>[ (<sha>)]: <summary>
|
|
25
24
|
*/
|
|
26
25
|
export declare function logAgenticSuccessOutcome(label: string, sha: string | null, summary: string): void;
|
|
26
|
+
/**
|
|
27
|
+
* Logs the skip line for a migration that waived its AI step through
|
|
28
|
+
* `skipAgentic`, plus a verbose note for any `agentContext` the waiver
|
|
29
|
+
* dropped. A hybrid waives its paired prompt; a generator-only migration
|
|
30
|
+
* waives the validation pass, so callers must reach here only once they know
|
|
31
|
+
* one was on the table. Under `inside-agent` only a hybrid can, so the
|
|
32
|
+
* hand-off dropped alongside is always a prompt's; a waived generator-only
|
|
33
|
+
* migration keeps its own. The note is author-facing, hence `--verbose`.
|
|
34
|
+
*/
|
|
35
|
+
export declare function logWaivedAgenticStep(migration: {
|
|
36
|
+
package: string;
|
|
37
|
+
name: string;
|
|
38
|
+
prompt?: string;
|
|
39
|
+
implementation?: string;
|
|
40
|
+
factory?: string;
|
|
41
|
+
}, agentContext: string[]): void;
|
|
27
42
|
/**
|
|
28
43
|
* Per-migration outcome record consumed by the failure recap. One entry is
|
|
29
44
|
* appended per iteration that returned without throwing; the failing migration
|
|
@@ -80,6 +95,13 @@ export type CommitState = {
|
|
|
80
95
|
* means the migration threw before completing — the executor's catch block
|
|
81
96
|
* records it so the recap can list it under retained-state alongside any
|
|
82
97
|
* other migrations whose commits never landed.
|
|
98
|
+
*
|
|
99
|
+
* `waivedAgenticStep` is set when the migration returned `skipAgentic: true`
|
|
100
|
+
* and something was actually waived: a hybrid's prompt, which is owed in every
|
|
101
|
+
* agentic mode, or a generator-only migration's validation step, only when it
|
|
102
|
+
* would have run. Recorded here rather than counted in the executor so the
|
|
103
|
+
* success tally and the failure recap derive the same number from the same
|
|
104
|
+
* records instead of threading a counter through both.
|
|
83
105
|
*/
|
|
84
106
|
export type MigrationOutcome = {
|
|
85
107
|
migration: {
|
|
@@ -89,6 +111,7 @@ export type MigrationOutcome = {
|
|
|
89
111
|
status: 'completed';
|
|
90
112
|
kind: MigrationOutcomeKind;
|
|
91
113
|
commit: CommitState;
|
|
114
|
+
waivedAgenticStep?: boolean;
|
|
92
115
|
} | {
|
|
93
116
|
migration: {
|
|
94
117
|
package: string;
|
|
@@ -106,6 +129,18 @@ export type MigrationOutcome = {
|
|
|
106
129
|
* counted because the absorbing commit's record already contributes one.
|
|
107
130
|
*/
|
|
108
131
|
export declare function countLandedCommits(outcomes: ReadonlyArray<MigrationOutcome>): number;
|
|
132
|
+
/**
|
|
133
|
+
* Counts the migrations that waived the AI step they would otherwise have
|
|
134
|
+
* run. Shared by the success tally and the failure recap so the two can't
|
|
135
|
+
* report different numbers.
|
|
136
|
+
*/
|
|
137
|
+
export declare function countWaivedAgenticSteps(outcomes: ReadonlyArray<MigrationOutcome>): number;
|
|
138
|
+
/**
|
|
139
|
+
* The recap phrase for waived AI steps. "not needed" rather than
|
|
140
|
+
* "skipped"/"deferred", which both recaps reserve for work the user still
|
|
141
|
+
* owes.
|
|
142
|
+
*/
|
|
143
|
+
export declare function formatWaivedAgenticSteps(count: number): string;
|
|
109
144
|
/**
|
|
110
145
|
* Migrations whose own commit attempt failed and whose diff was never
|
|
111
146
|
* absorbed by a later commit. Surfaces what the user has to commit or
|
|
@@ -144,17 +179,20 @@ export declare function logFailureRecap(opts: {
|
|
|
144
179
|
* emitting a misleading `0 prompt migrations skipped.` line.
|
|
145
180
|
*
|
|
146
181
|
* Rule (kept coherent across every scenario):
|
|
147
|
-
* - When at least one migration was applied: `<N> migrations applied, <K> commits created[, <D> prompt migrations <skipped|deferred>]`.
|
|
182
|
+
* - When at least one migration was applied: `<N> migrations applied, <K> commits created[, <D> prompt migrations <skipped|deferred>][, <W> AI steps not needed]`.
|
|
148
183
|
* The `<K> commits created` part stays even at 0 — it tells the reader work
|
|
149
184
|
* was applied but not committed (the J4/J8 information made explicit).
|
|
150
185
|
* - When zero migrations were applied but some prompt halves were
|
|
151
|
-
* skipped/deferred: `<D> prompt migrations <skipped|deferred>` only.
|
|
186
|
+
* skipped/deferred: `<D> prompt migrations <skipped|deferred>` only. Waiving
|
|
187
|
+
* never adds to `skippedPromptsCount`, so `appliedCount` is non-zero whenever
|
|
188
|
+
* `waivedAgenticStepsCount` is, and this branch can't be reached with one.
|
|
152
189
|
* - When zero of either: no body line.
|
|
153
190
|
*/
|
|
154
191
|
export declare function buildTallyBodyLine(opts: {
|
|
155
192
|
appliedCount: number;
|
|
156
193
|
committedShasCount: number;
|
|
157
194
|
skippedPromptsCount: number;
|
|
195
|
+
waivedAgenticStepsCount: number;
|
|
158
196
|
insideAgent: boolean;
|
|
159
197
|
}): string | null;
|
|
160
198
|
/**
|
|
@@ -3,7 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.resetSgrAfterAgent = resetSgrAfterAgent;
|
|
4
4
|
exports.logMigrationBoundary = logMigrationBoundary;
|
|
5
5
|
exports.logAgenticSuccessOutcome = logAgenticSuccessOutcome;
|
|
6
|
+
exports.logWaivedAgenticStep = logWaivedAgenticStep;
|
|
6
7
|
exports.countLandedCommits = countLandedCommits;
|
|
8
|
+
exports.countWaivedAgenticSteps = countWaivedAgenticSteps;
|
|
9
|
+
exports.formatWaivedAgenticSteps = formatWaivedAgenticSteps;
|
|
7
10
|
exports.retainedMigrations = retainedMigrations;
|
|
8
11
|
exports.logFailureRecap = logFailureRecap;
|
|
9
12
|
exports.buildTallyBodyLine = buildTallyBodyLine;
|
|
@@ -14,13 +17,12 @@ const pc = tslib_1.__importStar(require("picocolors"));
|
|
|
14
17
|
const logger_1 = require("../../utils/logger");
|
|
15
18
|
const migration_shape_1 = require("./migration-shape");
|
|
16
19
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* `→` start · `✓` success · `✗` failure · `↷` skipped · `ℹ` info · `─` boundary
|
|
20
|
+
* Pure presentation helpers for the migrate run phase (`--run-migrations` and
|
|
21
|
+
* the single-migration worker). Shared glyph vocabulary:
|
|
22
|
+
* `→` start, `✓` success, `✗` failure, `↷` skipped, `ℹ` info, `─` boundary
|
|
21
23
|
*
|
|
22
24
|
* Inputs are typed structurally (e.g. `{ name: string }[]`) so this module
|
|
23
|
-
* stays decoupled from
|
|
25
|
+
* stays decoupled from the migration executor in migrate.ts.
|
|
24
26
|
*/
|
|
25
27
|
/**
|
|
26
28
|
* Some agent TUIs (codex, opencode) don't fully reset their cursor / SGR state
|
|
@@ -49,6 +51,23 @@ function logAgenticSuccessOutcome(label, sha, summary) {
|
|
|
49
51
|
const shaPart = sha ? ` (${sha})` : '';
|
|
50
52
|
logger_1.logger.info(`${pc.green('✓')} ${label}${shaPart}: ${summary}`);
|
|
51
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Logs the skip line for a migration that waived its AI step through
|
|
56
|
+
* `skipAgentic`, plus a verbose note for any `agentContext` the waiver
|
|
57
|
+
* dropped. A hybrid waives its paired prompt; a generator-only migration
|
|
58
|
+
* waives the validation pass, so callers must reach here only once they know
|
|
59
|
+
* one was on the table. Under `inside-agent` only a hybrid can, so the
|
|
60
|
+
* hand-off dropped alongside is always a prompt's; a waived generator-only
|
|
61
|
+
* migration keeps its own. The note is author-facing, hence `--verbose`.
|
|
62
|
+
*/
|
|
63
|
+
function logWaivedAgenticStep(migration, agentContext) {
|
|
64
|
+
logger_1.logger.info(pc.dim((0, migration_shape_1.isHybridMigration)(migration)
|
|
65
|
+
? '↷ Prompt phase skipped. The migration reported nothing left for the AI step to do.'
|
|
66
|
+
: '↷ Validation skipped. The migration reported its changes need no AI review.'));
|
|
67
|
+
if (agentContext.length === 0)
|
|
68
|
+
return;
|
|
69
|
+
logger_1.logger.verbose(`${migration.package}: ${migration.name} returned skipAgentic: true alongside agentContext, which was dropped. agentContext exists to feed the AI step this migration waived.`);
|
|
70
|
+
}
|
|
52
71
|
/**
|
|
53
72
|
* Counts the migrations whose own commit actually landed — including the
|
|
54
73
|
* HEAD-resolve-race case (`commit: { kind: 'landed', sha: null }`). Used by
|
|
@@ -60,6 +79,22 @@ function logAgenticSuccessOutcome(label, sha, summary) {
|
|
|
60
79
|
function countLandedCommits(outcomes) {
|
|
61
80
|
return outcomes.filter((o) => o.commit.kind === 'landed').length;
|
|
62
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Counts the migrations that waived the AI step they would otherwise have
|
|
84
|
+
* run. Shared by the success tally and the failure recap so the two can't
|
|
85
|
+
* report different numbers.
|
|
86
|
+
*/
|
|
87
|
+
function countWaivedAgenticSteps(outcomes) {
|
|
88
|
+
return outcomes.filter((o) => o.status === 'completed' && o.waivedAgenticStep === true).length;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* The recap phrase for waived AI steps. "not needed" rather than
|
|
92
|
+
* "skipped"/"deferred", which both recaps reserve for work the user still
|
|
93
|
+
* owes.
|
|
94
|
+
*/
|
|
95
|
+
function formatWaivedAgenticSteps(count) {
|
|
96
|
+
return `${count} AI step${count === 1 ? '' : 's'} not needed`;
|
|
97
|
+
}
|
|
63
98
|
/**
|
|
64
99
|
* Migrations whose own commit attempt failed and whose diff was never
|
|
65
100
|
* absorbed by a later commit. Surfaces what the user has to commit or
|
|
@@ -90,6 +125,7 @@ function logFailureRecap(opts) {
|
|
|
90
125
|
const appliedCount = outcomes.filter((o) => o.status === 'completed' &&
|
|
91
126
|
(o.kind === 'applied' || o.kind === 'no-changes')).length;
|
|
92
127
|
const deferredCount = outcomes.filter((o) => o.status === 'completed' && o.kind === 'deferred').length;
|
|
128
|
+
const waivedAgenticCount = countWaivedAgenticSteps(outcomes);
|
|
93
129
|
const notAttempted = totalMigrations - migrationIndex;
|
|
94
130
|
// Walk back to the most recent completed record whose work is anchored to
|
|
95
131
|
// a sha — either its own commit (`landed`), or a later commit that
|
|
@@ -146,6 +182,9 @@ function logFailureRecap(opts) {
|
|
|
146
182
|
if (deferredCount > 0) {
|
|
147
183
|
parts.push(`${deferredCount} deferred`);
|
|
148
184
|
}
|
|
185
|
+
if (waivedAgenticCount > 0) {
|
|
186
|
+
parts.push(formatWaivedAgenticSteps(waivedAgenticCount));
|
|
187
|
+
}
|
|
149
188
|
logger_1.logger.info(`${parts.join(', ')}. ${notAttempted} not attempted.`);
|
|
150
189
|
logger_1.logger.info(`See the per-migration log above for full details.`);
|
|
151
190
|
}
|
|
@@ -181,15 +220,17 @@ function logFailureRecap(opts) {
|
|
|
181
220
|
* emitting a misleading `0 prompt migrations skipped.` line.
|
|
182
221
|
*
|
|
183
222
|
* Rule (kept coherent across every scenario):
|
|
184
|
-
* - When at least one migration was applied: `<N> migrations applied, <K> commits created[, <D> prompt migrations <skipped|deferred>]`.
|
|
223
|
+
* - When at least one migration was applied: `<N> migrations applied, <K> commits created[, <D> prompt migrations <skipped|deferred>][, <W> AI steps not needed]`.
|
|
185
224
|
* The `<K> commits created` part stays even at 0 — it tells the reader work
|
|
186
225
|
* was applied but not committed (the J4/J8 information made explicit).
|
|
187
226
|
* - When zero migrations were applied but some prompt halves were
|
|
188
|
-
* skipped/deferred: `<D> prompt migrations <skipped|deferred>` only.
|
|
227
|
+
* skipped/deferred: `<D> prompt migrations <skipped|deferred>` only. Waiving
|
|
228
|
+
* never adds to `skippedPromptsCount`, so `appliedCount` is non-zero whenever
|
|
229
|
+
* `waivedAgenticStepsCount` is, and this branch can't be reached with one.
|
|
189
230
|
* - When zero of either: no body line.
|
|
190
231
|
*/
|
|
191
232
|
function buildTallyBodyLine(opts) {
|
|
192
|
-
const { appliedCount, committedShasCount, skippedPromptsCount, insideAgent } = opts;
|
|
233
|
+
const { appliedCount, committedShasCount, skippedPromptsCount, waivedAgenticStepsCount, insideAgent, } = opts;
|
|
193
234
|
const skipVerb = insideAgent ? 'deferred' : 'skipped';
|
|
194
235
|
if (appliedCount === 0) {
|
|
195
236
|
if (skippedPromptsCount === 0)
|
|
@@ -203,6 +244,9 @@ function buildTallyBodyLine(opts) {
|
|
|
203
244
|
if (skippedPromptsCount > 0) {
|
|
204
245
|
parts.push(`${skippedPromptsCount} prompt migration${skippedPromptsCount === 1 ? '' : 's'} ${skipVerb}`);
|
|
205
246
|
}
|
|
247
|
+
if (waivedAgenticStepsCount > 0) {
|
|
248
|
+
parts.push(formatWaivedAgenticSteps(waivedAgenticStepsCount));
|
|
249
|
+
}
|
|
206
250
|
return `${parts.join(', ')}.`;
|
|
207
251
|
}
|
|
208
252
|
/**
|
|
@@ -19,6 +19,7 @@ export type SuccessfulMigration = {
|
|
|
19
19
|
ref: string;
|
|
20
20
|
nextSteps?: string[];
|
|
21
21
|
acknowledgedPrompt?: boolean;
|
|
22
|
+
skipAgentic?: boolean;
|
|
22
23
|
};
|
|
23
24
|
export type FailedMigration = {
|
|
24
25
|
type: 'failed';
|
|
@@ -41,7 +42,7 @@ export declare function runSingleMigration(workspacePath: string, migration: Mig
|
|
|
41
42
|
}): Promise<void>;
|
|
42
43
|
export declare function getImplementationPath(workspacePath: string, migration: MigrationDetailsWithId): Promise<string>;
|
|
43
44
|
export declare function modifyMigrationsJsonMetadata(workspacePath: string, modify: (migrationsJsonMetadata: MigrationsJsonMetadata) => MigrationsJsonMetadata): void;
|
|
44
|
-
export declare function addSuccessfulMigration(id: string, fileChanges: Omit<FileChange, 'content'>[], ref: string, nextSteps: string[]): (migrationsJsonMetadata: MigrationsJsonMetadata) => MigrationsJsonMetadata;
|
|
45
|
+
export declare function addSuccessfulMigration(id: string, fileChanges: Omit<FileChange, 'content'>[], ref: string, nextSteps: string[], skipAgentic?: boolean): (migrationsJsonMetadata: MigrationsJsonMetadata) => MigrationsJsonMetadata;
|
|
45
46
|
export declare function updateRefForSuccessfulMigration(id: string, ref: string): (migrationsJsonMetadata: MigrationsJsonMetadata) => MigrationsJsonMetadata;
|
|
46
47
|
export declare function addFailedMigration(id: string, error: string): (migrationsJsonMetadata: MigrationsJsonMetadata) => {
|
|
47
48
|
completedMigrations?: Record<string, SuccessfulMigration | FailedMigration | SkippedMigration | StoppedMigration>;
|