@depup/nx 23.2.1-depup.7 → 23.3.0-depup.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -19
- package/changes.json +10 -54
- package/dist/bin/init-local.js +7 -1
- package/dist/nx-cloud-internals.d.ts +1 -0
- package/dist/nx-cloud-internals.js +9 -0
- package/dist/plugins/package-json.js +1 -1
- package/dist/src/command-line/add/add.js +5 -1
- package/dist/src/command-line/affected/affected.js +70 -9
- package/dist/src/command-line/affected/command-object.js +1 -1
- package/dist/src/command-line/format/format.js +2 -18
- package/dist/src/command-line/graph/graph.d.ts +31 -0
- package/dist/src/command-line/graph/graph.js +113 -20
- package/dist/src/command-line/init/implementation/add-nx-to-monorepo.js +0 -3
- package/dist/src/command-line/init/implementation/add-nx-to-nest.js +0 -3
- package/dist/src/command-line/init/implementation/add-nx-to-npm-repo.js +0 -3
- package/dist/src/command-line/init/implementation/angular/index.js +0 -3
- package/dist/src/command-line/init/implementation/angular/legacy-angular-versions.js +0 -3
- package/dist/src/command-line/init/implementation/format.js +2 -3
- package/dist/src/command-line/init/implementation/utils.d.ts +0 -1
- package/dist/src/command-line/init/implementation/utils.js +6 -9
- package/dist/src/command-line/init/init-v2.js +0 -3
- package/dist/src/command-line/migrate/agentic/capture-generator-output.d.ts +25 -0
- package/dist/src/command-line/migrate/agentic/capture-generator-output.js +121 -5
- package/dist/src/command-line/migrate/agentic/close-agent-session.d.ts +21 -0
- package/dist/src/command-line/migrate/agentic/close-agent-session.js +126 -0
- package/dist/src/command-line/migrate/agentic/definitions.d.ts +24 -0
- package/dist/src/command-line/migrate/agentic/definitions.js +79 -20
- package/dist/src/command-line/migrate/agentic/format-command.d.ts +14 -0
- package/dist/src/command-line/migrate/agentic/format-command.js +44 -0
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.d.ts +3 -3
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.js +3 -3
- package/dist/src/command-line/migrate/agentic/handoff.d.ts +50 -17
- package/dist/src/command-line/migrate/agentic/handoff.js +166 -24
- package/dist/src/command-line/migrate/agentic/instruction-files.d.ts +23 -0
- package/dist/src/command-line/migrate/agentic/instruction-files.js +41 -0
- package/dist/src/command-line/migrate/agentic/master/invocations.d.ts +12 -0
- package/dist/src/command-line/migrate/agentic/master/invocations.js +54 -0
- package/dist/src/command-line/migrate/agentic/master/run-master-session.d.ts +16 -0
- package/dist/src/command-line/migrate/agentic/master/run-master-session.js +175 -0
- package/dist/src/command-line/migrate/agentic/master/spawn-master.d.ts +31 -0
- package/dist/src/command-line/migrate/agentic/master/spawn-master.js +222 -0
- package/dist/src/command-line/migrate/agentic/prompts/final-validation.d.ts +13 -0
- package/dist/src/command-line/migrate/agentic/prompts/final-validation.js +41 -0
- package/dist/src/command-line/migrate/agentic/prompts/fragments.d.ts +17 -0
- package/dist/src/command-line/migrate/agentic/prompts/fragments.js +90 -0
- package/dist/src/command-line/migrate/agentic/prompts/generic-validation.js +4 -3
- package/dist/src/command-line/migrate/agentic/prompts/system-prompt.d.ts +25 -1
- package/dist/src/command-line/migrate/agentic/prompts/system-prompt.js +57 -34
- package/dist/src/command-line/migrate/agentic/run-step.js +28 -4
- package/dist/src/command-line/migrate/agentic/runner.d.ts +3 -15
- package/dist/src/command-line/migrate/agentic/runner.js +57 -239
- package/dist/src/command-line/migrate/agentic/terminal-repair.d.ts +1 -0
- package/dist/src/command-line/migrate/agentic/terminal-repair.js +27 -0
- package/dist/src/command-line/migrate/agentic/types.d.ts +23 -8
- package/dist/src/command-line/migrate/agentic/types.js +10 -7
- package/dist/src/command-line/migrate/agentic/windows-cmd.d.ts +33 -0
- package/dist/src/command-line/migrate/agentic/windows-cmd.js +88 -0
- package/dist/src/command-line/migrate/command-object.d.ts +2 -0
- package/dist/src/command-line/migrate/command-object.js +11 -1
- package/dist/src/command-line/migrate/deferred-output.d.ts +44 -0
- package/dist/src/command-line/migrate/deferred-output.js +92 -0
- package/dist/src/command-line/migrate/execute-migration.d.ts +9 -3
- package/dist/src/command-line/migrate/execute-migration.js +53 -16
- package/dist/src/command-line/migrate/migrate-analytics.d.ts +34 -9
- package/dist/src/command-line/migrate/migrate-analytics.js +71 -10
- package/dist/src/command-line/migrate/migrate-commits.d.ts +5 -4
- package/dist/src/command-line/migrate/migrate-commits.js +16 -6
- package/dist/src/command-line/migrate/migrate-config.d.ts +5 -2
- package/dist/src/command-line/migrate/migrate-config.js +19 -11
- package/dist/src/command-line/migrate/migrate-output.d.ts +3 -7
- package/dist/src/command-line/migrate/migrate-output.js +3 -7
- package/dist/src/command-line/migrate/migrate.d.ts +3 -0
- package/dist/src/command-line/migrate/migrate.js +183 -46
- package/dist/src/command-line/migrate/resolve-package-version.js +2 -19
- package/dist/src/command-line/migrate/run/agent-output.d.ts +11 -0
- package/dist/src/command-line/migrate/run/agent-output.js +21 -2
- package/dist/src/command-line/migrate/run/agent-work-payload.d.ts +37 -0
- package/dist/src/command-line/migrate/run/agent-work-payload.js +156 -0
- package/dist/src/command-line/migrate/run/atomic-write.d.ts +8 -0
- package/dist/src/command-line/migrate/run/atomic-write.js +17 -0
- package/dist/src/command-line/migrate/run/broker.d.ts +150 -0
- package/dist/src/command-line/migrate/run/broker.js +568 -0
- package/dist/src/command-line/migrate/run/clean-retry.d.ts +12 -0
- package/dist/src/command-line/migrate/run/clean-retry.js +99 -0
- package/dist/src/command-line/migrate/run/existing-run-report.d.ts +55 -0
- package/dist/src/command-line/migrate/run/existing-run-report.js +227 -0
- package/dist/src/command-line/migrate/run/give-up.d.ts +41 -0
- package/dist/src/command-line/migrate/run/give-up.js +148 -0
- package/dist/src/command-line/migrate/run/index.d.ts +9 -6
- package/dist/src/command-line/migrate/run/index.js +21 -2
- package/dist/src/command-line/migrate/run/issues.d.ts +127 -0
- package/dist/src/command-line/migrate/run/issues.js +1121 -0
- package/dist/src/command-line/migrate/run/orchestrator.d.ts +59 -1
- package/dist/src/command-line/migrate/run/orchestrator.js +1529 -457
- package/dist/src/command-line/migrate/run/run-id.d.ts +0 -8
- package/dist/src/command-line/migrate/run/run-id.js +0 -30
- package/dist/src/command-line/migrate/run/run-state.d.ts +77 -17
- package/dist/src/command-line/migrate/run/run-state.js +263 -32
- package/dist/src/command-line/migrate/run/runbook.d.ts +18 -0
- package/dist/src/command-line/migrate/run/runbook.js +118 -0
- package/dist/src/command-line/migrate/run/state-lock.d.ts +33 -2
- package/dist/src/command-line/migrate/run/state-lock.js +128 -2
- package/dist/src/command-line/migrate/run/state-machine.d.ts +50 -1
- package/dist/src/command-line/migrate/run/state-machine.js +339 -26
- package/dist/src/command-line/migrate/run/util.d.ts +3 -1
- package/dist/src/command-line/migrate/run/util.js +24 -3
- package/dist/src/command-line/migrate/run/worker.js +290 -129
- package/dist/src/command-line/migrate/step-actions.d.ts +1 -1
- package/dist/src/command-line/migrate/step-actions.js +7 -1
- package/dist/src/command-line/migrate/text.d.ts +6 -0
- package/dist/src/command-line/migrate/text.js +25 -0
- package/dist/src/command-line/migrate/version-skew-guard.js +2 -0
- package/dist/src/command-line/nx-cloud/connect/connect-to-nx-cloud.js +5 -11
- package/dist/src/command-line/release/publish.js +11 -8
- package/dist/src/command-line/release/utils/get-touched-projects-for-group.js +3 -3
- package/dist/src/command-line/release/utils/release-graph.js +1 -1
- package/dist/src/command-line/release/utils/remote-release-clients/github.js +5 -8
- package/dist/src/command-line/release/utils/remote-release-clients/gitlab.js +3 -3
- package/dist/src/command-line/release/utils/remote-release-clients/remote-release-client.d.ts +4 -2
- package/dist/src/command-line/release/utils/remote-release-clients/remote-release-client.js +37 -3
- package/dist/src/command-line/release/version/version-actions.d.ts +3 -0
- package/dist/src/command-line/reset/reset.js +10 -4
- package/dist/src/command-line/run/run-one.js +5 -1
- package/dist/src/command-line/run-many/run-many.js +6 -12
- package/dist/src/command-line/show/command-object.js +1 -1
- package/dist/src/command-line/show/projects.js +52 -1
- package/dist/src/command-line/yargs-utils/shared-options.d.ts +5 -1
- package/dist/src/command-line/yargs-utils/shared-options.js +38 -4
- package/dist/src/config/task-graph.d.ts +1 -1
- package/dist/src/config/workspace-json-project-json.d.ts +23 -1
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/core/graph/runtime.js +1 -1
- package/dist/src/core/graph/styles.js +1 -1
- package/dist/src/daemon/client/client.d.ts +14 -8
- package/dist/src/daemon/client/client.js +41 -12
- package/dist/src/daemon/message-types/get-plugin-capabilities.d.ts +5 -0
- package/dist/src/daemon/message-types/get-plugin-capabilities.js +11 -0
- package/dist/src/daemon/message-types/run-tasks-execution-hooks.d.ts +3 -2
- package/dist/src/daemon/message-types/select-affected-tasks.d.ts +21 -0
- package/dist/src/daemon/message-types/select-affected-tasks.js +11 -0
- package/dist/src/daemon/message-types/ultracache-configuration-version.d.ts +8 -0
- package/dist/src/daemon/message-types/ultracache-configuration-version.js +2 -0
- package/dist/src/daemon/server/dotenv-graph-changes.d.ts +1 -1
- package/dist/src/daemon/server/dotenv-graph-changes.js +2 -2
- package/dist/src/daemon/server/handle-get-plugin-capabilities.d.ts +2 -0
- package/dist/src/daemon/server/handle-get-plugin-capabilities.js +13 -0
- package/dist/src/daemon/server/handle-hash-tasks.d.ts +10 -2
- package/dist/src/daemon/server/handle-hash-tasks.js +18 -3
- package/dist/src/daemon/server/handle-select-affected-tasks.d.ts +3 -0
- package/dist/src/daemon/server/handle-select-affected-tasks.js +26 -0
- package/dist/src/daemon/server/handle-tasks-execution-hooks.d.ts +3 -2
- package/dist/src/daemon/server/{handle-outputs-changes.d.ts → handle-watch-events.d.ts} +4 -4
- package/dist/src/daemon/server/{handle-outputs-changes.js → handle-watch-events.js} +36 -37
- package/dist/src/daemon/server/outputs-tracking.d.ts +7 -19
- package/dist/src/daemon/server/outputs-tracking.js +7 -107
- package/dist/src/daemon/server/planning-context.d.ts +8 -0
- package/dist/src/daemon/server/planning-context.js +18 -0
- package/dist/src/daemon/server/project-graph-incremental-recomputation.d.ts +22 -7
- package/dist/src/daemon/server/project-graph-incremental-recomputation.js +104 -74
- package/dist/src/daemon/server/restart-checks.d.ts +22 -0
- package/dist/src/daemon/server/restart-checks.js +77 -0
- package/dist/src/daemon/server/server.d.ts +1 -0
- package/dist/src/daemon/server/server.js +54 -30
- package/dist/src/daemon/server/shutdown-utils.d.ts +0 -5
- package/dist/src/daemon/server/shutdown-utils.js +3 -26
- package/dist/src/daemon/server/ultracache-configuration-state.d.ts +7 -0
- package/dist/src/daemon/server/ultracache-configuration-state.js +36 -0
- package/dist/src/devkit-internals.d.ts +3 -1
- package/dist/src/devkit-internals.js +8 -3
- package/dist/src/executors/run-commands/run-commands.impl.d.ts +2 -1
- package/dist/src/executors/run-commands/run-commands.impl.js +19 -5
- package/dist/src/executors/run-commands/running-tasks.d.ts +5 -4
- package/dist/src/executors/run-commands/running-tasks.js +13 -13
- package/dist/src/hasher/create-task-hasher.d.ts +8 -1
- package/dist/src/hasher/create-task-hasher.js +13 -3
- package/dist/src/hasher/hash-plan-inspector.js +2 -2
- package/dist/src/hasher/hash-task.d.ts +2 -2
- package/dist/src/hasher/hash-task.js +28 -17
- package/dist/src/hasher/native-task-hasher-impl.d.ts +20 -4
- package/dist/src/hasher/native-task-hasher-impl.js +75 -9
- package/dist/src/hasher/task-hasher.d.ts +24 -7
- package/dist/src/hasher/task-hasher.js +27 -8
- package/dist/src/hasher/task-planning-context.d.ts +13 -0
- package/dist/src/hasher/task-planning-context.js +12 -0
- package/dist/src/native/index.d.ts +582 -21
- package/dist/src/native/index.js +3 -3
- package/dist/src/native/native-bindings.js +13 -1
- package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
- package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
- package/dist/src/native/transform-objects.d.ts +11 -2
- package/dist/src/native/transform-objects.js +46 -0
- package/dist/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +15 -8
- package/dist/src/nx-cloud/update-manager.d.ts +3 -0
- package/dist/src/nx-cloud/update-manager.js +19 -13
- package/dist/src/nx-cloud/utilities/client.d.ts +1 -1
- package/dist/src/nx-cloud/utilities/client.js +1 -1
- package/dist/src/nx-cloud/utilities/is-workspace-claimed.js +2 -1
- package/dist/src/nx-cloud/utilities/nx-cloud-http-client.d.ts +5 -0
- package/dist/src/nx-cloud/utilities/nx-cloud-http-client.js +16 -0
- package/dist/src/nx-cloud/utilities/url-shorten.js +17 -10
- package/dist/src/plugins/js/index.js +45 -64
- package/dist/src/plugins/js/lock-file/lock-file.d.ts +4 -4
- package/dist/src/plugins/js/lock-file/lock-file.js +6 -7
- package/dist/src/plugins/js/lock-file/pnpm-parser.js +1 -1
- package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.d.ts +2 -0
- package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.js +22 -0
- package/dist/src/plugins/js/project-graph/affected/lock-file-changes.d.ts +10 -2
- package/dist/src/plugins/js/project-graph/affected/lock-file-changes.js +51 -29
- package/dist/src/plugins/js/project-graph/affected/npm-packages.d.ts +10 -2
- package/dist/src/plugins/js/project-graph/affected/npm-packages.js +32 -11
- package/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +22 -18
- package/dist/src/plugins/js/utils/register.js +13 -4
- package/dist/src/plugins/package-json/create-nodes.d.ts +2 -2
- package/dist/src/plugins/package-json/create-nodes.js +13 -13
- package/dist/src/project-graph/affected/affected-project-graph-models.d.ts +14 -0
- package/dist/src/project-graph/affected/affected-project-graph.js +5 -18
- package/dist/src/project-graph/affected/affected-projects.d.ts +7 -0
- package/dist/src/project-graph/affected/affected-projects.js +42 -0
- package/dist/src/project-graph/affected/affected-reasons.d.ts +116 -0
- package/dist/src/project-graph/affected/affected-reasons.js +459 -0
- package/dist/src/project-graph/affected/affected-tasks.d.ts +103 -0
- package/dist/src/project-graph/affected/affected-tasks.js +386 -0
- package/dist/src/project-graph/affected/print-explanation.d.ts +11 -0
- package/dist/src/project-graph/affected/print-explanation.js +44 -0
- package/dist/src/project-graph/error-types.d.ts +5 -0
- package/dist/src/project-graph/error-types.js +44 -5
- package/dist/src/project-graph/file-utils.d.ts +2 -0
- package/dist/src/project-graph/file-utils.js +12 -3
- package/dist/src/project-graph/nx-deps-cache.d.ts +5 -2
- package/dist/src/project-graph/nx-deps-cache.js +4 -4
- package/dist/src/project-graph/plugins/get-plugins.d.ts +3 -1
- package/dist/src/project-graph/plugins/get-plugins.js +60 -82
- package/dist/src/project-graph/plugins/in-process-loader.d.ts +1 -1
- package/dist/src/project-graph/plugins/in-process-loader.js +1 -4
- package/dist/src/project-graph/plugins/isolation/index.d.ts +1 -1
- package/dist/src/project-graph/plugins/isolation/index.js +3 -1
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.d.ts +8 -0
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +42 -6
- package/dist/src/project-graph/plugins/isolation/load-isolated-plugin.d.ts +10 -1
- package/dist/src/project-graph/plugins/isolation/load-isolated-plugin.js +67 -17
- package/dist/src/project-graph/plugins/isolation/messaging.d.ts +3 -2
- package/dist/src/project-graph/plugins/isolation/plugin-worker.js +5 -1
- package/dist/src/project-graph/plugins/loaded-nx-plugin.d.ts +5 -2
- package/dist/src/project-graph/plugins/loaded-nx-plugin.js +14 -1
- package/dist/src/project-graph/plugins/nx-plugin-capabilities.d.ts +6 -0
- package/dist/src/project-graph/plugins/nx-plugin-capabilities.js +28 -0
- package/dist/src/project-graph/plugins/task-results-stub.d.ts +50 -0
- package/dist/src/project-graph/plugins/task-results-stub.js +111 -0
- package/dist/src/project-graph/plugins/tasks-execution-hooks.d.ts +3 -2
- package/dist/src/project-graph/plugins/tasks-execution-hooks.js +14 -1
- package/dist/src/project-graph/project-graph.js +43 -42
- package/dist/src/project-graph/utils/project-configuration/target-merging.js +67 -0
- package/dist/src/project-graph/utils/project-configuration/target-normalization.js +83 -0
- package/dist/src/project-graph/utils/project-configuration/utils.d.ts +1 -0
- package/dist/src/project-graph/utils/project-configuration/utils.js +1 -0
- package/dist/src/tasks-runner/batch/run-batch.js +15 -0
- package/dist/src/tasks-runner/cache.d.ts +37 -2
- package/dist/src/tasks-runner/cache.js +42 -1
- package/dist/src/tasks-runner/create-task-graph.d.ts +24 -1
- package/dist/src/tasks-runner/create-task-graph.js +57 -2
- package/dist/src/tasks-runner/default-tasks-runner.js +1 -1
- package/dist/src/tasks-runner/forked-process-task-runner.d.ts +1 -1
- package/dist/src/tasks-runner/forked-process-task-runner.js +11 -10
- package/dist/src/tasks-runner/init-tasks-runner.d.ts +7 -2
- package/dist/src/tasks-runner/init-tasks-runner.js +15 -7
- package/dist/src/tasks-runner/is-tui-enabled.js +4 -3
- package/dist/src/tasks-runner/life-cycle.d.ts +7 -0
- package/dist/src/tasks-runner/life-cycle.js +7 -0
- package/dist/src/tasks-runner/life-cycles/summary-terminal-output-life-cycle.d.ts +35 -0
- package/dist/src/tasks-runner/life-cycles/summary-terminal-output-life-cycle.js +146 -0
- package/dist/src/tasks-runner/prune-task-graph.d.ts +17 -0
- package/dist/src/tasks-runner/prune-task-graph.js +45 -0
- package/dist/src/tasks-runner/run-command.d.ts +41 -5
- package/dist/src/tasks-runner/run-command.js +98 -22
- package/dist/src/tasks-runner/running-tasks/batch-process.d.ts +93 -19
- package/dist/src/tasks-runner/running-tasks/batch-process.js +184 -88
- package/dist/src/tasks-runner/task-io-service.d.ts +11 -3
- package/dist/src/tasks-runner/task-io-service.js +14 -5
- package/dist/src/tasks-runner/task-orchestrator.d.ts +71 -4
- package/dist/src/tasks-runner/task-orchestrator.js +266 -66
- package/dist/src/tasks-runner/tasks-runner.d.ts +2 -0
- package/dist/src/tasks-runner/terminal-output-path.d.ts +11 -0
- package/dist/src/tasks-runner/terminal-output-path.js +18 -0
- package/dist/src/tasks-runner/utils.d.ts +5 -0
- package/dist/src/tasks-runner/utils.js +14 -2
- package/dist/src/ultracache/config.d.ts +21 -0
- package/dist/src/ultracache/config.js +29 -0
- package/dist/src/ultracache/fetch.d.ts +21 -0
- package/dist/src/ultracache/fetch.js +43 -0
- package/dist/src/ultracache/overrides.d.ts +17 -0
- package/dist/src/ultracache/overrides.js +61 -0
- package/dist/src/ultracache/report.d.ts +13 -0
- package/dist/src/ultracache/report.js +62 -0
- package/dist/src/ultracache/store.d.ts +41 -0
- package/dist/src/ultracache/store.js +158 -0
- package/dist/src/utils/ab-testing.d.ts +4 -1
- package/dist/src/utils/ab-testing.js +22 -19
- package/dist/src/utils/chunkify.d.ts +1 -7
- package/dist/src/utils/chunkify.js +2 -8
- package/dist/src/utils/command-line-utils.d.ts +20 -0
- package/dist/src/utils/command-line-utils.js +10 -3
- package/dist/src/utils/create-cli-options.d.ts +6 -0
- package/dist/src/utils/create-cli-options.js +29 -0
- package/dist/src/utils/db-connection.d.ts +2 -0
- package/dist/src/utils/db-connection.js +2 -0
- package/dist/src/utils/formatters/index.d.ts +6 -0
- package/dist/src/utils/formatters/index.js +5 -0
- package/dist/src/utils/formatters/prettier.d.ts +0 -8
- package/dist/src/utils/formatters/prettier.js +4 -26
- package/dist/src/utils/git-utils.d.ts +19 -0
- package/dist/src/utils/git-utils.js +97 -39
- package/dist/src/utils/handle-errors.js +5 -43
- package/dist/src/utils/http-client.d.ts +27 -0
- package/dist/src/utils/http-client.js +193 -0
- package/dist/src/utils/installed-nx-version.js +2 -48
- package/dist/src/utils/json-diff.d.ts +4 -2
- package/dist/src/utils/json-diff.js +6 -94
- package/dist/src/utils/min-release-age/packument.js +1 -1
- package/dist/src/utils/nx-cloud-utils.d.ts +2 -0
- package/dist/src/utils/nx-cloud-utils.js +6 -1
- package/dist/src/utils/output.d.ts +22 -3
- package/dist/src/utils/output.js +28 -5
- package/dist/src/utils/package-json.d.ts +25 -0
- package/dist/src/utils/package-json.js +49 -6
- package/dist/src/utils/package-manager.d.ts +6 -0
- package/dist/src/utils/package-manager.js +10 -0
- package/dist/src/utils/plugins/plugin-capabilities.js +7 -2
- package/dist/src/utils/project-graph-utils.d.ts +2 -0
- package/dist/src/utils/project-graph-utils.js +12 -0
- package/dist/src/utils/provenance.js +20 -4
- package/dist/src/utils/serialize-overrides-into-command-line.js +2 -4
- package/dist/src/utils/workspace-context.d.ts +51 -3
- package/dist/src/utils/workspace-context.js +174 -10
- package/package.json +38 -100
- package/schemas/nx-schema.json +38 -0
- package/schemas/project-schema.json +35 -0
- package/dist/src/daemon/server/file-watching/route-workspace-changes.d.ts +0 -9
- package/dist/src/daemon/server/file-watching/route-workspace-changes.js +0 -76
- package/dist/src/daemon/server/watcher.d.ts +0 -18
- package/dist/src/daemon/server/watcher.js +0 -126
- package/dist/src/nx-cloud/utilities/axios.d.ts +0 -4
- package/dist/src/nx-cloud/utilities/axios.js +0 -17
- package/dist/src/project-graph/affected/locators/project-glob-changes.d.ts +0 -2
- package/dist/src/project-graph/affected/locators/project-glob-changes.js +0 -47
- package/dist/src/project-graph/affected/locators/workspace-json-changes.d.ts +0 -4
- package/dist/src/project-graph/affected/locators/workspace-json-changes.js +0 -47
- package/dist/src/project-graph/affected/locators/workspace-projects.d.ts +0 -3
- package/dist/src/project-graph/affected/locators/workspace-projects.js +0 -74
- package/dist/src/utils/collapse-expanded-outputs.d.ts +0 -10
- package/dist/src/utils/collapse-expanded-outputs.js +0 -72
|
@@ -7,7 +7,6 @@ const git_utils_1 = require("../../../utils/git-utils");
|
|
|
7
7
|
const fileutils_1 = require("../../../utils/fileutils");
|
|
8
8
|
const installation_directory_1 = require("../../../utils/installation-directory");
|
|
9
9
|
const package_json_1 = require("../../../utils/package-json");
|
|
10
|
-
const inception_1 = require("../agentic/inception");
|
|
11
10
|
const print_dropped_agent_context_1 = require("../agentic/print-dropped-agent-context");
|
|
12
11
|
const select_1 = require("../agentic/select");
|
|
13
12
|
const types_1 = require("../agentic/types");
|
|
@@ -23,8 +22,11 @@ const run_id_1 = require("./run-id");
|
|
|
23
22
|
const state_machine_1 = require("./state-machine");
|
|
24
23
|
const state_lock_1 = require("./state-lock");
|
|
25
24
|
const util_1 = require("./util");
|
|
25
|
+
const broker_1 = require("./broker");
|
|
26
26
|
const text_1 = require("../text");
|
|
27
27
|
const agent_output_1 = require("./agent-output");
|
|
28
|
+
const agent_work_payload_1 = require("./agent-work-payload");
|
|
29
|
+
const issues_1 = require("./issues");
|
|
28
30
|
async function runSingleMigrationWorker(input) {
|
|
29
31
|
const { root, runMigration, runId, commitPrefix, interactive, skipInstall, isVerbose, } = input;
|
|
30
32
|
// The worker is a second CLI entry point: the run id reaches runDir() (where
|
|
@@ -97,13 +99,15 @@ async function runSingleMigrationWorker(input) {
|
|
|
97
99
|
function readMigrationsSource(root, runId) {
|
|
98
100
|
if (runId) {
|
|
99
101
|
const dir = (0, run_state_1.runDir)(root, runId);
|
|
100
|
-
// A missing run.json would surface a raw ENOENT from readRunState
|
|
101
|
-
//
|
|
102
|
-
//
|
|
103
|
-
// and `--run-migrations` would run the whole plan in process instead.
|
|
102
|
+
// A missing run.json would surface a raw ENOENT from readRunState; report
|
|
103
|
+
// it the way the orchestrator does instead, with no remediation: starting
|
|
104
|
+
// a run is a gated entry point of its own.
|
|
104
105
|
if (!(0, run_state_1.hasRunState)(dir)) {
|
|
105
106
|
throw new Error(`No migrate run '${runId}' was found under ${types_1.MIGRATE_RUNS_RELATIVE_DIR}.`);
|
|
106
107
|
}
|
|
108
|
+
// Before the state and plan reads: a concurrent start-fresh must not
|
|
109
|
+
// delete the run while this worker resolves its migration.
|
|
110
|
+
(0, state_lock_1.holdRunActivity)(root, runId);
|
|
107
111
|
// Version refusal (NewerRunStateFormatError) propagates.
|
|
108
112
|
const state = (0, run_state_1.readRunState)(dir);
|
|
109
113
|
const round = (0, state_machine_1.latestRound)(state);
|
|
@@ -317,27 +321,31 @@ async function runStandalone(root, migration, opts) {
|
|
|
317
321
|
// and no "apply this manually" block for the user either.
|
|
318
322
|
if ((0, migration_shape_1.isHybridMigration)(migration) && !skipAgentic) {
|
|
319
323
|
emitOrPrintPrompt(root, migration, agentic.kind, {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
+
impl: {
|
|
325
|
+
logs,
|
|
326
|
+
changes,
|
|
327
|
+
agentContext,
|
|
328
|
+
},
|
|
329
|
+
resolvedCollection,
|
|
330
|
+
});
|
|
324
331
|
}
|
|
325
332
|
}
|
|
326
333
|
async function runRecorded(root, runId, migration, skipInstall, isVerbose) {
|
|
327
334
|
const dir = (0, run_state_1.runDir)(root, runId);
|
|
328
335
|
// Version refusal (NewerRunStateFormatError) propagates.
|
|
329
336
|
let state = (0, run_state_1.readRunState)(dir);
|
|
330
|
-
// A recorded run never resolves the agentic flow
|
|
331
|
-
//
|
|
332
|
-
// the
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
: 'disabled';
|
|
337
|
+
// A recorded run never resolves the agentic flow: the outer agent drives it,
|
|
338
|
+
// and the dispensed command is part of the orchestrated protocol whoever
|
|
339
|
+
// re-runs it. Gating the block on ambient agent detection would park the
|
|
340
|
+
// step awaiting an outcome whose payload was never emitted.
|
|
341
|
+
const agenticKind = 'inside-agent';
|
|
336
342
|
const migrationId = `${migration.package}:${migration.name}`;
|
|
337
343
|
// The plan was read from the latest round's snapshot, so only that round's
|
|
338
344
|
// step may match; a same-id step from an older round must not.
|
|
339
345
|
const latest = (0, state_machine_1.latestRound)(state);
|
|
340
|
-
const step = state.steps.find((s) => s.
|
|
346
|
+
const step = state.steps.find((s) => s.kind === 'migration' &&
|
|
347
|
+
s.migrationId === migrationId &&
|
|
348
|
+
s.roundIndex === latest?.index);
|
|
341
349
|
if (!step) {
|
|
342
350
|
throw new Error(`The migrate run '${runId}' has no step for migration '${migrationId}'.`);
|
|
343
351
|
}
|
|
@@ -350,99 +358,185 @@ async function runRecorded(root, runId, migration, skipInstall, isVerbose) {
|
|
|
350
358
|
startedAt: (0, util_1.nowIso)(),
|
|
351
359
|
});
|
|
352
360
|
// A prior attempt's generator half already ran, so this attempt must not
|
|
353
|
-
// reapply it against a tree that already holds its changes
|
|
354
|
-
//
|
|
355
|
-
//
|
|
356
|
-
// Read from the state the start transition returned: a delayed invocation
|
|
357
|
-
// may have claimed a later attempt whose flag its entry snapshot predates.
|
|
361
|
+
// reapply it against a tree that already holds its changes. Read from the
|
|
362
|
+
// state the start transition returned, not the entry snapshot: a delayed
|
|
363
|
+
// invocation may have claimed a later attempt whose flag `step` predates.
|
|
358
364
|
const startedStep = state.steps.find((s) => s.id === step.id);
|
|
359
365
|
const generatorAlreadyCompleted = startedStep.generatorCompleted === true;
|
|
360
|
-
//
|
|
361
|
-
//
|
|
362
|
-
//
|
|
366
|
+
// Dispensed worker commands never carry the user's flags, so the run records
|
|
367
|
+
// its install policy. An explicit --skip-install here applies only to the
|
|
368
|
+
// installs this process runs itself; a parent session answers from its own.
|
|
363
369
|
const effectiveSkipInstall = state.skipInstall === true || skipInstall;
|
|
370
|
+
// The run records the resolved validation policy at init; absent (a state
|
|
371
|
+
// predating the field) falls back to the same default init applies.
|
|
372
|
+
const shouldValidate = state.validate !== false;
|
|
373
|
+
// The tree reservation an in-process install or commit takes is held until
|
|
374
|
+
// the transition that records this attempt's outcome is written.
|
|
375
|
+
const scope = {};
|
|
376
|
+
// Called before a retry hands the step's work back: the prompt or validation
|
|
377
|
+
// may need the dependencies the earlier attempt's generator added.
|
|
378
|
+
const reinstallFromBaseline = () => (0, broker_1.installStepTree)(dir, startedStep, 'install', () => recordingInstallFailure(dir, step.id, () => (0, util_1.installDepsChangedSinceDispense)(root, dir, startedStep, effectiveSkipInstall, `${(0, execute_migration_1.formatSingleMigrationRerunCommand)(migrationId)} --run-id=${runId}`)), scope);
|
|
364
379
|
let outcome;
|
|
380
|
+
let awaitingKind;
|
|
381
|
+
const payloadPath = (0, agent_work_payload_1.agentWorkPayloadPath)(dir, step.id, startedStep.attempt);
|
|
365
382
|
try {
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
outcome = buildOutcome([], [], 'The generator ran in an earlier attempt; this attempt completed its install and commit.', root);
|
|
373
|
-
}
|
|
374
|
-
else {
|
|
375
|
-
const installer = new execute_migration_1.ChangedDepInstaller(root, effectiveSkipInstall, `${(0, execute_migration_1.formatSingleMigrationRerunCommand)(migrationId)} --run-id=${runId}`);
|
|
376
|
-
// Read once; the run and the hybrid documentation resolution share it.
|
|
377
|
-
const resolvedCollection = (0, execute_migration_1.readMigrationCollection)(migration.package, root);
|
|
378
|
-
const { changes, nextSteps, agentContext, logs, madeChanges } = await (0, execute_migration_1.runNxOrAngularMigration)(root, migration, isVerbose, (0, migration_shape_1.isHybridMigration)(migration), resolvedCollection);
|
|
379
|
-
// Recorded before the commit is attempted: from here on the changes are
|
|
380
|
-
// in the tree, so a failed install or commit must leave a retry with
|
|
381
|
-
// only those left to do rather than running the generator again.
|
|
382
|
-
state = transition(dir, {
|
|
383
|
-
type: 'markGeneratorCompleted',
|
|
384
|
-
stepId: step.id,
|
|
385
|
-
});
|
|
386
|
-
if (!(0, migration_shape_1.isHybridMigration)(migration)) {
|
|
387
|
-
forwardDroppedAgentContext(migration, agentContext, agenticKind);
|
|
388
|
-
}
|
|
389
|
-
const install = () => recordingInstallFailure(dir, step.id, () => installer.installDepsIfChanged());
|
|
390
|
-
// Commits follow the run config, not CLI flags, and only when the
|
|
391
|
-
// generator changed something: a no-op step must not create a commit (nor
|
|
392
|
-
// a ledger entry) that absorbs prior pending diffs under its name.
|
|
393
|
-
if (state.createCommits && madeChanges) {
|
|
394
|
-
state = await commitStepChanges(dir, root, state, step, migration, install);
|
|
395
|
-
}
|
|
396
|
-
else {
|
|
397
|
-
await install();
|
|
383
|
+
try {
|
|
384
|
+
if ((0, migration_shape_1.isPromptOnlyMigration)(migration)) {
|
|
385
|
+
emitOrPrintPrompt(root, migration, agenticKind, {
|
|
386
|
+
persistPath: payloadPath,
|
|
387
|
+
});
|
|
388
|
+
awaitingKind = 'migration-prompt';
|
|
398
389
|
}
|
|
399
|
-
if (
|
|
400
|
-
|
|
390
|
+
else if (generatorAlreadyCompleted &&
|
|
391
|
+
startedStep.agenticWaived !== true &&
|
|
392
|
+
(0, migration_shape_1.isHybridMigration)(migration)) {
|
|
393
|
+
await reinstallFromBaseline();
|
|
394
|
+
const carried = (0, agent_work_payload_1.latestStoredAgentWorkPayload)(dir, step.id, startedStep.attempt, startedStep.generatorCompletedAtAttempt, {
|
|
395
|
+
migrationId,
|
|
396
|
+
kind: 'migration-prompt',
|
|
397
|
+
promptPath: migration.prompt,
|
|
398
|
+
});
|
|
399
|
+
if (carried) {
|
|
400
|
+
reemitCarriedAgentWork(migrationId, 'migration-prompt', payloadPath, carried);
|
|
401
|
+
}
|
|
402
|
+
else {
|
|
403
|
+
emitOrPrintPrompt(root, migration, agenticKind, {
|
|
404
|
+
persistPath: payloadPath,
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
awaitingKind = 'migration-prompt';
|
|
401
408
|
}
|
|
402
|
-
else if (
|
|
403
|
-
|
|
409
|
+
else if (generatorAlreadyCompleted &&
|
|
410
|
+
startedStep.validationOwed === true) {
|
|
411
|
+
// The flag is the only record that these changes still owe a validation
|
|
412
|
+
// pass; the decision needed the generator result, which is gone with the
|
|
413
|
+
// attempt that made it. The commit stays with the fold.
|
|
414
|
+
await reinstallFromBaseline();
|
|
415
|
+
const carried = (0, agent_work_payload_1.latestStoredAgentWorkPayload)(dir, step.id, startedStep.attempt, startedStep.generatorCompletedAtAttempt, { migrationId, kind: 'generator-validation' });
|
|
416
|
+
if (carried) {
|
|
417
|
+
reemitCarriedAgentWork(migrationId, 'generator-validation', payloadPath, carried);
|
|
418
|
+
}
|
|
419
|
+
else {
|
|
420
|
+
emitValidationBlock(root, migration, undefined, {
|
|
421
|
+
persistPath: payloadPath,
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
awaitingKind = 'generator-validation';
|
|
404
425
|
}
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
logs,
|
|
409
|
-
changes,
|
|
410
|
-
agentContext,
|
|
411
|
-
}, resolvedCollection);
|
|
426
|
+
else if (generatorAlreadyCompleted) {
|
|
427
|
+
state = await finishCompletedGenerator(dir, root, state, startedStep, migration, effectiveSkipInstall, runId, scope);
|
|
428
|
+
outcome = buildOutcome([], [], 'The generator ran in an earlier attempt; this attempt completed its install and commit.', root);
|
|
412
429
|
}
|
|
413
430
|
else {
|
|
414
|
-
|
|
431
|
+
const installer = new execute_migration_1.ChangedDepInstaller(root, effectiveSkipInstall, `${(0, execute_migration_1.formatSingleMigrationRerunCommand)(migrationId)} --run-id=${runId}`);
|
|
432
|
+
// Read once; the run and the hybrid documentation resolution share it.
|
|
433
|
+
const resolvedCollection = (0, execute_migration_1.readMigrationCollection)(migration.package, root);
|
|
434
|
+
const { changes, nextSteps, agentContext, skipAgentic, logs, madeChanges, } = await (0, execute_migration_1.runNxOrAngularMigration)(root, migration, isVerbose,
|
|
435
|
+
// Captured whenever an agent step may consume it: a hybrid's prompt
|
|
436
|
+
// payload, or the validation pass over the generator's changes.
|
|
437
|
+
(0, migration_shape_1.isHybridMigration)(migration) || shouldValidate, resolvedCollection);
|
|
438
|
+
// Mirrors the classic loop's waiver semantics (migrate.ts): the two must
|
|
439
|
+
// agree on when an AI step was owed for skipAgentic to waive.
|
|
440
|
+
const validationApplies = shouldValidate && !(0, migration_shape_1.isHybridMigration)(migration) && changes.length > 0;
|
|
441
|
+
const waivedAgenticStep = skipAgentic && ((0, migration_shape_1.isHybridMigration)(migration) || validationApplies);
|
|
442
|
+
const validationOwed = validationApplies && !waivedAgenticStep;
|
|
443
|
+
const promptOwed = (0, migration_shape_1.isHybridMigration)(migration) && !waivedAgenticStep;
|
|
444
|
+
// Recorded before the commit is attempted: from here on the changes are
|
|
445
|
+
// in the tree, so a failed install or commit must leave a retry with
|
|
446
|
+
// only those left to do rather than running the generator again.
|
|
447
|
+
state = transition(dir, {
|
|
448
|
+
type: 'markGeneratorCompleted',
|
|
449
|
+
stepId: step.id,
|
|
450
|
+
agenticWaived: waivedAgenticStep,
|
|
451
|
+
validationOwed,
|
|
452
|
+
madeChanges,
|
|
453
|
+
});
|
|
454
|
+
if (waivedAgenticStep) {
|
|
455
|
+
(0, migrate_output_1.logWaivedAgenticStep)(migration, agentContext);
|
|
456
|
+
}
|
|
457
|
+
else if (!(0, migration_shape_1.isHybridMigration)(migration) && !validationApplies) {
|
|
458
|
+
forwardDroppedAgentContext(migration, agentContext, agenticKind);
|
|
459
|
+
}
|
|
460
|
+
// Stored before the install: a failed install fails the attempt, and
|
|
461
|
+
// the retry re-hands this payload instead of a context-free one.
|
|
462
|
+
const impl = { logs, changes, agentContext };
|
|
463
|
+
const owed = validationOwed
|
|
464
|
+
? validationPayload(root, migration, impl, resolvedCollection)
|
|
465
|
+
: promptOwed
|
|
466
|
+
? promptPayload(root, migration, impl, resolvedCollection)
|
|
467
|
+
: undefined;
|
|
468
|
+
if (owed) {
|
|
469
|
+
(0, agent_work_payload_1.persistAgentWorkPayload)(payloadPath, owed);
|
|
470
|
+
}
|
|
471
|
+
const install = () => recordingInstallFailure(dir, step.id, () => installer.installDepsIfChanged());
|
|
472
|
+
// A no-op step's commit would absorb prior pending diffs under its name;
|
|
473
|
+
// a step handing work back defers its commit to the fold, so the
|
|
474
|
+
// migration still lands as one commit. The install runs either way: the
|
|
475
|
+
// agent may run tasks that need what the generator added.
|
|
476
|
+
if (state.createCommits &&
|
|
477
|
+
madeChanges &&
|
|
478
|
+
!validationOwed &&
|
|
479
|
+
!promptOwed) {
|
|
480
|
+
state = await commitStepChanges(dir, root, state, startedStep, migration, install, scope);
|
|
481
|
+
}
|
|
482
|
+
else {
|
|
483
|
+
await (0, broker_1.installStepTree)(dir, startedStep, 'install', install, scope);
|
|
484
|
+
}
|
|
485
|
+
if (installer.skippedInstall) {
|
|
486
|
+
(0, execute_migration_1.logSkippedPostMigrationInstall)(root);
|
|
487
|
+
}
|
|
488
|
+
else if (installer.installed) {
|
|
489
|
+
(0, util_1.recordInstallLanded)(root, dir, step.id);
|
|
490
|
+
}
|
|
491
|
+
printNextSteps(migration, nextSteps);
|
|
492
|
+
if (validationOwed) {
|
|
493
|
+
emitValidationPayload(migrationId, owed);
|
|
494
|
+
awaitingKind = 'generator-validation';
|
|
495
|
+
}
|
|
496
|
+
else if (promptOwed) {
|
|
497
|
+
emitPromptForOuterAgent(migrationId, owed, true);
|
|
498
|
+
awaitingKind = 'migration-prompt';
|
|
499
|
+
}
|
|
500
|
+
else {
|
|
501
|
+
outcome = buildOutcome(changes, nextSteps, migration.description, root);
|
|
502
|
+
}
|
|
415
503
|
}
|
|
416
504
|
}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
505
|
+
catch (e) {
|
|
506
|
+
// Another attempt owns the step, and `fail` is not attempt-bound.
|
|
507
|
+
if (e instanceof broker_1.BrokerStaleRequestError)
|
|
508
|
+
throw e;
|
|
509
|
+
// The failed-step dispense surfaces this so the agent can decide
|
|
510
|
+
// retry-vs-skip; carry the error's first line, not a full stack.
|
|
511
|
+
transition(dir, {
|
|
512
|
+
type: 'fail',
|
|
513
|
+
stepId: step.id,
|
|
514
|
+
finishedAt: (0, util_1.nowIso)(),
|
|
515
|
+
outcome: { summary: (0, util_1.summarizeError)(e) },
|
|
516
|
+
});
|
|
517
|
+
throw e;
|
|
518
|
+
}
|
|
519
|
+
// Handed-back work is applied by a separate actor, so parking exits
|
|
520
|
+
// successfully rather than failing the step.
|
|
521
|
+
if (awaitingKind !== undefined) {
|
|
522
|
+
transition(dir, {
|
|
523
|
+
type: 'awaitPromptOutcome',
|
|
524
|
+
stepId: step.id,
|
|
525
|
+
finishedAt: (0, util_1.nowIso)(),
|
|
526
|
+
awaitingKind,
|
|
527
|
+
});
|
|
528
|
+
return;
|
|
529
|
+
}
|
|
421
530
|
transition(dir, {
|
|
422
|
-
type: '
|
|
531
|
+
type: 'succeed',
|
|
423
532
|
stepId: step.id,
|
|
424
533
|
finishedAt: (0, util_1.nowIso)(),
|
|
425
|
-
outcome
|
|
534
|
+
...(outcome ? { outcome } : {}),
|
|
426
535
|
});
|
|
427
|
-
throw e;
|
|
428
536
|
}
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
// process exits successfully.
|
|
432
|
-
if ((0, migration_shape_1.isPromptOnlyMigration)(migration) || (0, migration_shape_1.isHybridMigration)(migration)) {
|
|
433
|
-
transition(dir, {
|
|
434
|
-
type: 'awaitPromptOutcome',
|
|
435
|
-
stepId: step.id,
|
|
436
|
-
finishedAt: (0, util_1.nowIso)(),
|
|
437
|
-
});
|
|
438
|
-
return;
|
|
537
|
+
finally {
|
|
538
|
+
scope.lease?.release();
|
|
439
539
|
}
|
|
440
|
-
transition(dir, {
|
|
441
|
-
type: 'succeed',
|
|
442
|
-
stepId: step.id,
|
|
443
|
-
finishedAt: (0, util_1.nowIso)(),
|
|
444
|
-
...(outcome ? { outcome } : {}),
|
|
445
|
-
});
|
|
446
540
|
}
|
|
447
541
|
// Applies a step event to the freshest on-disk state under the lock, writes it,
|
|
448
542
|
// and returns it. Reading fresh is what makes a racing worker's 'start' see the
|
|
@@ -475,44 +569,52 @@ async function recordingInstallFailure(dir, stepId, install) {
|
|
|
475
569
|
// on the install or the commit. The generator's changes are already in the
|
|
476
570
|
// tree, so only those two are left, and the install compares against the
|
|
477
571
|
// step's persisted baseline rather than against what that generator wrote.
|
|
478
|
-
async function finishCompletedGenerator(dir, root, state, step, migration, skipInstall, runId) {
|
|
572
|
+
async function finishCompletedGenerator(dir, root, state, step, migration, skipInstall, runId, scope) {
|
|
479
573
|
const migrationId = `${migration.package}:${migration.name}`;
|
|
480
574
|
const installDeps = () => recordingInstallFailure(dir, step.id, () => (0, util_1.installDepsChangedSinceDispense)(root, dir, step, skipInstall, `${(0, execute_migration_1.formatSingleMigrationRerunCommand)(migrationId)} --run-id=${runId}`));
|
|
481
|
-
|
|
482
|
-
|
|
575
|
+
// Same no-op guard as the first attempt. Only an explicit false skips the
|
|
576
|
+
// commit: absent means an older nx wrote the marker without recording the
|
|
577
|
+
// answer, and the commit is kept as that version's retries did.
|
|
578
|
+
if (!state.createCommits || step.generatorMadeChanges === false) {
|
|
579
|
+
await (0, broker_1.installStepTree)(dir, step, 'install', installDeps, scope);
|
|
483
580
|
return state;
|
|
484
581
|
}
|
|
485
|
-
return commitStepChanges(dir, root, state, step, migration, installDeps);
|
|
582
|
+
return commitStepChanges(dir, root, state, step, migration, installDeps, scope);
|
|
486
583
|
}
|
|
487
584
|
// Installs what the step changed, commits it, and records the result in the
|
|
488
585
|
// ledger, shared by a step's first attempt and by one that only has the commit
|
|
489
586
|
// left to do. The absorbed step ids are computed before the commit so the
|
|
490
587
|
// ledger entry and the commit body name the same ones.
|
|
491
|
-
async function commitStepChanges(dir, root, state, step, migration, installDeps) {
|
|
588
|
+
async function commitStepChanges(dir, root, state, step, migration, installDeps, scope) {
|
|
492
589
|
const absorbedStepIds = (0, state_machine_1.uncoveredFailedStepIds)(state).filter((id) => id !== step.id);
|
|
493
|
-
let
|
|
590
|
+
let commit;
|
|
494
591
|
try {
|
|
495
|
-
|
|
592
|
+
commit = await (0, broker_1.commitStepTree)(dir, step, absorbedStepIds, () => (0, migrate_commits_1.commitMigrationIfRequested)(root, migration, true, state.commitPrefix, installDeps, (0, state_machine_1.stepsToPendingMigrations)(state, absorbedStepIds)), scope);
|
|
496
593
|
}
|
|
497
594
|
catch (commitError) {
|
|
498
|
-
//
|
|
499
|
-
|
|
500
|
-
|
|
595
|
+
// Nothing ran for a stale or refused request, so there is no debt.
|
|
596
|
+
if (commitError instanceof broker_1.BrokerStaleRequestError ||
|
|
597
|
+
commitError instanceof broker_1.TreeBusyError) {
|
|
598
|
+
throw commitError;
|
|
599
|
+
}
|
|
600
|
+
// The install failed, or the session ended unanswered and the commit may
|
|
601
|
+
// or may not have landed; record the debt until a landed entry covers it.
|
|
602
|
+
recordCommitEntry(dir, { kind: 'failed', stepIds: [step.id] });
|
|
501
603
|
throw commitError;
|
|
502
604
|
}
|
|
503
|
-
if (result.status === 'failed') {
|
|
605
|
+
if (commit.result.status === 'failed') {
|
|
504
606
|
(0, util_1.warnCommitFailed)(migration.name);
|
|
505
607
|
}
|
|
506
|
-
const entry = (0, state_machine_1.commitResultToLedgerEntry)(result, step.id, absorbedStepIds);
|
|
507
|
-
|
|
608
|
+
const entry = (0, state_machine_1.commitResultToLedgerEntry)(commit.result, step.id, commit.absorbedStepIds);
|
|
609
|
+
// A session's parent records what it commits itself, receipt included.
|
|
610
|
+
return entry && !commit.recorded ? recordCommitEntry(dir, entry) : state;
|
|
508
611
|
}
|
|
509
|
-
//
|
|
510
|
-
//
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
}));
|
|
612
|
+
// The git commit itself already ran outside the lock; only this pure append is
|
|
613
|
+
// locked. A landed entry carries the resolved issues of every step it names,
|
|
614
|
+
// same as the orchestrator's fold and adopt appends: an absorbed step's
|
|
615
|
+
// resolutions would otherwise land unattached.
|
|
616
|
+
function recordCommitEntry(dir, entry) {
|
|
617
|
+
return (0, state_lock_1.updateRunState)(dir, (fresh) => (0, state_machine_1.appendCommit)(fresh, (0, issues_1.attachIssueIdsToCommitEntry)(fresh, entry)));
|
|
516
618
|
}
|
|
517
619
|
function buildOutcome(changes, nextSteps, description, root) {
|
|
518
620
|
const outcome = {};
|
|
@@ -577,7 +679,7 @@ async function runAgenticStep(agenticRun, input) {
|
|
|
577
679
|
// commit's diff, so it passes its own guidance instead of the default.
|
|
578
680
|
// `commitMigrationIfRequested` logs a failed commit itself with that guidance.
|
|
579
681
|
function attemptStandaloneCommit(root, migration, createCommits, commitPrefix, installDepsIfChanged) {
|
|
580
|
-
return (0, migrate_commits_1.commitMigrationIfRequested)(root, migration, createCommits, commitPrefix, installDepsIfChanged, [], 'Commit or revert
|
|
682
|
+
return (0, migrate_commits_1.commitMigrationIfRequested)(root, migration, createCommits, commitPrefix, installDepsIfChanged, [], 'Commit or revert any remaining uncommitted changes manually.');
|
|
581
683
|
}
|
|
582
684
|
async function commitAndLogAgenticOutcome(args) {
|
|
583
685
|
const commit = await attemptStandaloneCommit(args.root, args.migration, args.createCommits, args.commitPrefix, args.installDepsIfChanged);
|
|
@@ -598,32 +700,60 @@ function printNextSteps(migration, nextSteps) {
|
|
|
598
700
|
bodyLines: nextSteps.map((line) => `- ${(0, text_1.singleLine)(line)}`),
|
|
599
701
|
});
|
|
600
702
|
}
|
|
601
|
-
function emitOrPrintPrompt(root, migration, agenticKind,
|
|
703
|
+
function emitOrPrintPrompt(root, migration, agenticKind, opts = {}) {
|
|
602
704
|
const migrationId = `${migration.package}:${migration.name}`;
|
|
603
|
-
const promptPath = migration.prompt;
|
|
604
|
-
const documentationPath = resolveDocumentationPath(root, migration, resolvedCollection);
|
|
605
705
|
if (agenticKind === 'inside-agent') {
|
|
606
|
-
|
|
706
|
+
const payload = promptPayload(root, migration, opts.impl, opts.resolvedCollection);
|
|
707
|
+
if (opts.persistPath) {
|
|
708
|
+
(0, agent_work_payload_1.persistAgentWorkPayload)(opts.persistPath, payload);
|
|
709
|
+
}
|
|
710
|
+
emitPromptForOuterAgent(migrationId, payload, opts.persistPath !== undefined);
|
|
607
711
|
}
|
|
608
712
|
else {
|
|
609
|
-
printPromptForUser(root, migration,
|
|
713
|
+
printPromptForUser(root, migration, migration.prompt, resolveDocumentationPath(root, migration, opts.resolvedCollection));
|
|
610
714
|
}
|
|
611
715
|
}
|
|
612
|
-
function
|
|
613
|
-
const payload = {
|
|
716
|
+
function promptPayload(root, migration, impl, resolvedCollection) {
|
|
717
|
+
const payload = {
|
|
718
|
+
migrationId: `${migration.package}:${migration.name}`,
|
|
719
|
+
prompt: migration.prompt,
|
|
720
|
+
};
|
|
721
|
+
const documentationPath = resolveDocumentationPath(root, migration, resolvedCollection);
|
|
614
722
|
if (documentationPath)
|
|
615
723
|
payload.documentationPath = documentationPath;
|
|
616
|
-
if (impl)
|
|
617
|
-
payload.impl =
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
724
|
+
if (impl)
|
|
725
|
+
payload.impl = implPayload(impl);
|
|
726
|
+
return payload;
|
|
727
|
+
}
|
|
728
|
+
const PROMPT_NOT_APPLIED = `The following prompt-based migration was not applied automatically.`;
|
|
729
|
+
// Recorded steps hand work back through the orchestrator, per the runbook's loop.
|
|
730
|
+
const RUN_NEXT_FIRST = `Run the dispensed "next" command first: its response restates this work and names the handoff file to write.`;
|
|
731
|
+
const CHANGES_AWAIT_VALIDATION = `The following migration's generator ran in an earlier attempt and its changes still await validation.`;
|
|
732
|
+
function emitPromptForOuterAgent(migrationId, payload, recorded) {
|
|
625
733
|
(0, agent_output_1.logToAgent)({
|
|
626
|
-
title:
|
|
734
|
+
title: recorded
|
|
735
|
+
? `${PROMPT_NOT_APPLIED} ${RUN_NEXT_FIRST}`
|
|
736
|
+
: `${PROMPT_NOT_APPLIED} Apply it to this workspace, then continue.`,
|
|
737
|
+
});
|
|
738
|
+
(0, agent_output_1.emitPromptBlock)(migrationId, payload);
|
|
739
|
+
}
|
|
740
|
+
function implPayload(impl) {
|
|
741
|
+
return {
|
|
742
|
+
logs: impl.logs,
|
|
743
|
+
changes: impl.changes.map((c) => ({ type: c.type, path: c.path })),
|
|
744
|
+
...(impl.agentContext.length > 0
|
|
745
|
+
? { agentContext: impl.agentContext }
|
|
746
|
+
: {}),
|
|
747
|
+
};
|
|
748
|
+
}
|
|
749
|
+
// Re-hands what an earlier attempt stored. The payload is re-persisted under
|
|
750
|
+
// this attempt because the dispense reads only the current attempt's file.
|
|
751
|
+
function reemitCarriedAgentWork(migrationId, kind, payloadPath, payload) {
|
|
752
|
+
(0, agent_work_payload_1.persistAgentWorkPayload)(payloadPath, payload);
|
|
753
|
+
(0, agent_output_1.logToAgent)({
|
|
754
|
+
title: `${kind === 'migration-prompt'
|
|
755
|
+
? PROMPT_NOT_APPLIED
|
|
756
|
+
: CHANGES_AWAIT_VALIDATION} ${RUN_NEXT_FIRST}`,
|
|
627
757
|
});
|
|
628
758
|
(0, agent_output_1.emitPromptBlock)(migrationId, payload);
|
|
629
759
|
}
|
|
@@ -660,6 +790,37 @@ function printPromptForUser(root, migration, promptPath, documentationPath) {
|
|
|
660
790
|
bodyLines,
|
|
661
791
|
});
|
|
662
792
|
}
|
|
793
|
+
// `impl` is absent on a retry whose earlier attempt left no stored payload;
|
|
794
|
+
// the emission then points at the tree.
|
|
795
|
+
function emitValidationBlock(root, migration, impl, opts = {}) {
|
|
796
|
+
const payload = validationPayload(root, migration, impl, opts.resolvedCollection);
|
|
797
|
+
if (opts.persistPath) {
|
|
798
|
+
(0, agent_work_payload_1.persistAgentWorkPayload)(opts.persistPath, payload);
|
|
799
|
+
}
|
|
800
|
+
emitValidationPayload(`${migration.package}:${migration.name}`, payload);
|
|
801
|
+
}
|
|
802
|
+
function emitValidationPayload(migrationId, payload) {
|
|
803
|
+
(0, agent_output_1.logToAgent)({
|
|
804
|
+
title: payload.impl !== undefined
|
|
805
|
+
? `The following migration's generator ran without an AI-driven part. ${RUN_NEXT_FIRST}`
|
|
806
|
+
: `${CHANGES_AWAIT_VALIDATION} ${RUN_NEXT_FIRST} Inspect the changes with git.`,
|
|
807
|
+
});
|
|
808
|
+
(0, agent_output_1.emitPromptBlock)(migrationId, payload);
|
|
809
|
+
}
|
|
810
|
+
function validationPayload(root, migration, impl, resolvedCollection) {
|
|
811
|
+
// `kind` is what tells the block apart from an applied-prompt payload,
|
|
812
|
+
// which carries `prompt` instead.
|
|
813
|
+
const payload = {
|
|
814
|
+
migrationId: `${migration.package}:${migration.name}`,
|
|
815
|
+
kind: 'generator-validation',
|
|
816
|
+
};
|
|
817
|
+
const documentationPath = resolveDocumentationPath(root, migration, resolvedCollection);
|
|
818
|
+
if (documentationPath)
|
|
819
|
+
payload.documentationPath = documentationPath;
|
|
820
|
+
if (impl)
|
|
821
|
+
payload.impl = implPayload(impl);
|
|
822
|
+
return payload;
|
|
823
|
+
}
|
|
663
824
|
// Non-fatal: documentation is supplementary, so a failure warns and the
|
|
664
825
|
// prompt still runs without it.
|
|
665
826
|
function resolveDocumentationPath(root, migration, resolvedCollection) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Allowed values for `--step-action`, the orchestrated reconcile's decision relay. */
|
|
2
|
-
export declare const STEP_ACTIONS: readonly ['retry', 'skip', 'retry-clean', 'adopt'];
|
|
2
|
+
export declare const STEP_ACTIONS: readonly ['retry', 'skip', 'retry-clean', 'adopt', 'unresolved'];
|
|
3
3
|
export type StepAction = (typeof STEP_ACTIONS)[number];
|
|
4
4
|
/** Runtime guard backed by {@link STEP_ACTIONS} so the two can't drift apart. */
|
|
5
5
|
export declare function isStepAction(value: unknown): value is StepAction;
|
|
@@ -5,7 +5,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
5
5
|
exports.STEP_ACTIONS = void 0;
|
|
6
6
|
exports.isStepAction = isStepAction;
|
|
7
7
|
/** Allowed values for `--step-action`, the orchestrated reconcile's decision relay. */
|
|
8
|
-
exports.STEP_ACTIONS = [
|
|
8
|
+
exports.STEP_ACTIONS = [
|
|
9
|
+
'retry',
|
|
10
|
+
'skip',
|
|
11
|
+
'retry-clean',
|
|
12
|
+
'adopt',
|
|
13
|
+
'unresolved',
|
|
14
|
+
];
|
|
9
15
|
/** Runtime guard backed by {@link STEP_ACTIONS} so the two can't drift apart. */
|
|
10
16
|
function isStepAction(value) {
|
|
11
17
|
return exports.STEP_ACTIONS.includes(value);
|
|
@@ -16,3 +16,9 @@
|
|
|
16
16
|
* real terminator can put a value at the start of a line.
|
|
17
17
|
*/
|
|
18
18
|
export declare function singleLine(value: string): string;
|
|
19
|
+
export declare function hasLineBreak(value: string): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Renders an ISO timestamp as a human age ("6 hours ago"), falling back to
|
|
22
|
+
* the raw value when it is not parseable or lies in the future.
|
|
23
|
+
*/
|
|
24
|
+
export declare function formatAge(timestamp: string): string;
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
// run/util.ts without a cycle through run/state-lock.ts.
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.singleLine = singleLine;
|
|
7
|
+
exports.hasLineBreak = hasLineBreak;
|
|
8
|
+
exports.formatAge = formatAge;
|
|
7
9
|
/**
|
|
8
10
|
* Collapses every character a reader could take for a line break, so a value
|
|
9
11
|
* cannot break out of the line it is rendered on. The driving agent scans the
|
|
@@ -24,3 +26,26 @@ exports.singleLine = singleLine;
|
|
|
24
26
|
function singleLine(value) {
|
|
25
27
|
return value.replace(/[\r\n\u000b\u000c\u0085\u2028\u2029]+/g, ' ');
|
|
26
28
|
}
|
|
29
|
+
function hasLineBreak(value) {
|
|
30
|
+
return singleLine(value) !== value;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Renders an ISO timestamp as a human age ("6 hours ago"), falling back to
|
|
34
|
+
* the raw value when it is not parseable or lies in the future.
|
|
35
|
+
*/
|
|
36
|
+
function formatAge(timestamp) {
|
|
37
|
+
const elapsedMs = Date.now() - Date.parse(timestamp);
|
|
38
|
+
if (!Number.isFinite(elapsedMs) || elapsedMs < 0) {
|
|
39
|
+
return timestamp;
|
|
40
|
+
}
|
|
41
|
+
const minutes = Math.floor(elapsedMs / 60_000);
|
|
42
|
+
if (minutes < 60) {
|
|
43
|
+
return `${minutes} minute${minutes === 1 ? '' : 's'} ago`;
|
|
44
|
+
}
|
|
45
|
+
const hours = Math.floor(elapsedMs / 3_600_000);
|
|
46
|
+
if (hours < 48) {
|
|
47
|
+
return `${hours} hour${hours === 1 ? '' : 's'} ago`;
|
|
48
|
+
}
|
|
49
|
+
const days = Math.floor(elapsedMs / 86_400_000);
|
|
50
|
+
return `${days} day${days === 1 ? '' : 's'} ago`;
|
|
51
|
+
}
|
|
@@ -19,6 +19,8 @@ const version_utils_1 = require("./version-utils");
|
|
|
19
19
|
// pass this floor and route to a temp CLI that drops the new flags and runs
|
|
20
20
|
// the plan phase instead.
|
|
21
21
|
exports.NEW_MIGRATE_FLAGS_FLOOR = '23.2.0';
|
|
22
|
+
// List only flags that pick which migrate path runs: an older nx drops them
|
|
23
|
+
// and runs another one. Flags read only by --run-migrations do not belong.
|
|
22
24
|
// yargs accepts both spellings of each flag and the raw argv is forwarded
|
|
23
25
|
// across both migrate hops, so detection must catch every one.
|
|
24
26
|
exports.NEW_MIGRATE_FLAGS = [
|