@depup/nx 23.2.1-depup.8 → 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 +7 -18
- package/changes.json +9 -53
- 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 +36 -98
- 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
|
@@ -1,14 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.applyStepEvent = applyStepEvent;
|
|
4
|
+
exports.discardGeneratorRun = discardGeneratorRun;
|
|
5
|
+
exports.tallySteps = tallySteps;
|
|
6
|
+
exports.runTallies = runTallies;
|
|
7
|
+
exports.unresolvedFailureDetail = unresolvedFailureDetail;
|
|
8
|
+
exports.completionSummaryLines = completionSummaryLines;
|
|
9
|
+
exports.unresolvedCommitName = unresolvedCommitName;
|
|
10
|
+
exports.commitNameForStep = commitNameForStep;
|
|
4
11
|
exports.markInstallFailed = markInstallFailed;
|
|
5
12
|
exports.uncoveredFailedStepIds = uncoveredFailedStepIds;
|
|
6
13
|
exports.hasPendingCommitDebt = hasPendingCommitDebt;
|
|
7
14
|
exports.coveringLandedEntries = coveringLandedEntries;
|
|
15
|
+
exports.markCommitStarted = markCommitStarted;
|
|
16
|
+
exports.clearCommitStarted = clearCommitStarted;
|
|
17
|
+
exports.commitMayBeInHistory = commitMayBeInHistory;
|
|
18
|
+
exports.appendCommit = appendCommit;
|
|
19
|
+
exports.commitReceipt = commitReceipt;
|
|
8
20
|
exports.latestRound = latestRound;
|
|
21
|
+
exports.stepNoun = stepNoun;
|
|
22
|
+
exports.stepLabel = stepLabel;
|
|
9
23
|
exports.splitMigrationId = splitMigrationId;
|
|
10
24
|
exports.stepsToPendingMigrations = stepsToPendingMigrations;
|
|
25
|
+
exports.gitRan = gitRan;
|
|
11
26
|
exports.commitResultToLedgerEntry = commitResultToLedgerEntry;
|
|
27
|
+
const text_1 = require("../text");
|
|
12
28
|
const PROMPT_OUTCOME_TO_STEP_STATUS = {
|
|
13
29
|
completed: 'succeeded',
|
|
14
30
|
skipped: 'skipped',
|
|
@@ -68,11 +84,37 @@ function applyStepEvent(state, event) {
|
|
|
68
84
|
...step,
|
|
69
85
|
status: 'awaiting-prompt-outcome',
|
|
70
86
|
finishedAt: event.finishedAt,
|
|
87
|
+
awaitingKind: event.awaitingKind,
|
|
88
|
+
});
|
|
89
|
+
case 'parkForFinalValidation':
|
|
90
|
+
if (step.kind !== 'final-validation') {
|
|
91
|
+
return {
|
|
92
|
+
kind: 'error',
|
|
93
|
+
reason: `Cannot apply '${event.type}' to step '${step.id}': it is a ${step.kind} step.`,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
if (step.status !== 'pending')
|
|
97
|
+
return illegal(step, event.type);
|
|
98
|
+
return commit(state, index, {
|
|
99
|
+
...step,
|
|
100
|
+
status: 'awaiting-prompt-outcome',
|
|
101
|
+
dispenseCount: step.dispenseCount + 1,
|
|
102
|
+
finishedAt: event.finishedAt,
|
|
103
|
+
awaitingKind: 'final-validation',
|
|
71
104
|
});
|
|
72
105
|
case 'markGeneratorCompleted':
|
|
73
106
|
if (step.status !== 'running')
|
|
74
107
|
return illegal(step, event.type);
|
|
75
|
-
return commit(state, index, {
|
|
108
|
+
return commit(state, index, {
|
|
109
|
+
...step,
|
|
110
|
+
generatorCompleted: true,
|
|
111
|
+
generatorCompletedAtAttempt: step.attempt,
|
|
112
|
+
...(event.agenticWaived ? { agenticWaived: true } : {}),
|
|
113
|
+
...(event.validationOwed ? { validationOwed: true } : {}),
|
|
114
|
+
// Written even when false, unlike the conditional spreads above: absent is
|
|
115
|
+
// reserved for markers an older nx wrote.
|
|
116
|
+
generatorMadeChanges: event.madeChanges,
|
|
117
|
+
});
|
|
76
118
|
case 'foldPromptOutcome':
|
|
77
119
|
if (step.status !== 'awaiting-prompt-outcome')
|
|
78
120
|
return illegal(step, event.type);
|
|
@@ -114,8 +156,20 @@ function applyStepAction(state, index, step, action) {
|
|
|
114
156
|
// exec side effect, or a crash mid-flush), so a reset-backed retry is
|
|
115
157
|
// offered under the same guard as for a death.
|
|
116
158
|
return commit(state, index, cleanRearm(state, step));
|
|
159
|
+
case 'adopt':
|
|
160
|
+
return commit(state, index, adopt(step));
|
|
117
161
|
case 'skip':
|
|
118
|
-
|
|
162
|
+
case 'unresolved':
|
|
163
|
+
if (commitMayBeInHistory(state, step)) {
|
|
164
|
+
return {
|
|
165
|
+
kind: 'error',
|
|
166
|
+
reason: `Cannot apply action '${action}' to step '${step.id}': a commit of its changes landed or was started and never recorded, so the ${stepNoun(step)} may be committed. Use 'adopt' to record it as applied once the ${stepNoun(step)} is finished.`,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
return commit(state, index, {
|
|
170
|
+
...step,
|
|
171
|
+
status: action === 'skip' ? 'skipped' : 'unresolved',
|
|
172
|
+
});
|
|
119
173
|
}
|
|
120
174
|
}
|
|
121
175
|
if (step.status === 'died') {
|
|
@@ -131,19 +185,44 @@ function applyStepAction(state, index, step, action) {
|
|
|
131
185
|
}
|
|
132
186
|
return {
|
|
133
187
|
kind: 'error',
|
|
134
|
-
reason: `Cannot apply action 'retry' to step '${step.id}': the worker died before recording that its generator ran, so keeping the current tree could apply the migration twice. Use
|
|
188
|
+
reason: `Cannot apply action 'retry' to step '${step.id}': the worker died before recording that its generator ran, so keeping the current tree could apply the migration twice. Use ${commitMayBeInHistory(state, step)
|
|
189
|
+
? `'retry-clean' where offered, or 'adopt'`
|
|
190
|
+
: `'retry-clean', 'adopt', 'skip' or 'unresolved'`} instead.`,
|
|
135
191
|
};
|
|
136
192
|
case 'retry-clean':
|
|
137
193
|
return commit(state, index, cleanRearm(state, step));
|
|
138
194
|
case 'adopt':
|
|
195
|
+
return commit(state, index, adopt(step));
|
|
196
|
+
case 'skip': {
|
|
197
|
+
if (coveringLandedEntries(state, step.id).length > 0) {
|
|
198
|
+
return {
|
|
199
|
+
kind: 'error',
|
|
200
|
+
reason: `Cannot apply action 'skip' to step '${step.id}': a commit of its changes already landed, so the migration is applied. Use 'adopt' to record that.`,
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
if (step.commitStarted === true) {
|
|
204
|
+
return {
|
|
205
|
+
kind: 'error',
|
|
206
|
+
reason: `Cannot apply action 'skip' to step '${step.id}': a commit of its changes was started and never recorded, so it may be in history. Use 'adopt' to record the migration as applied.`,
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
// Same as skipping a failure: the tree stays as the worker left it.
|
|
210
|
+
return commit(state, index, { ...step, status: 'skipped' });
|
|
211
|
+
}
|
|
212
|
+
case 'unresolved':
|
|
213
|
+
if (commitMayBeInHistory(state, step)) {
|
|
214
|
+
return {
|
|
215
|
+
kind: 'error',
|
|
216
|
+
reason: `Cannot apply action 'unresolved' to step '${step.id}': a commit of its changes landed or was started and never recorded, so the migration may be committed. Use 'adopt' to record it as applied once the migration is finished.`,
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
// A death records no outcome, so the failure given up on is the death
|
|
220
|
+
// itself.
|
|
139
221
|
return commit(state, index, {
|
|
140
222
|
...step,
|
|
141
|
-
status: '
|
|
142
|
-
outcome: {
|
|
223
|
+
status: 'unresolved',
|
|
224
|
+
outcome: { summary: workerDiedSummary(step) },
|
|
143
225
|
});
|
|
144
|
-
case 'skip':
|
|
145
|
-
// Same as skipping a failure: the tree stays as the worker left it.
|
|
146
|
-
return commit(state, index, { ...step, status: 'skipped' });
|
|
147
226
|
}
|
|
148
227
|
}
|
|
149
228
|
return {
|
|
@@ -151,6 +230,9 @@ function applyStepAction(state, index, step, action) {
|
|
|
151
230
|
reason: `Cannot apply action '${action}' to step '${step.id}' in status '${step.status}'.`,
|
|
152
231
|
};
|
|
153
232
|
}
|
|
233
|
+
function workerDiedSummary(step) {
|
|
234
|
+
return `the worker process${step.pid === undefined ? '' : ` (pid ${step.pid})`} died before recording an outcome`;
|
|
235
|
+
}
|
|
154
236
|
// Re-arms for a retry that resets the tree first. The reset target predates
|
|
155
237
|
// the generator unless a commit of this step's own already carries it, so the
|
|
156
238
|
// marker only survives when such a commit exists; otherwise the reset discards
|
|
@@ -158,31 +240,39 @@ function applyStepAction(state, index, step, action) {
|
|
|
158
240
|
function cleanRearm(state, step) {
|
|
159
241
|
return rearm(step, coveringLandedEntries(state, step.id).length > 0);
|
|
160
242
|
}
|
|
161
|
-
|
|
162
|
-
|
|
243
|
+
function adopt(step) {
|
|
244
|
+
return {
|
|
245
|
+
...step,
|
|
246
|
+
status: 'succeeded',
|
|
247
|
+
adopted: true,
|
|
248
|
+
outcome: { ...step.outcome, summary: adoptedSummary(step) },
|
|
249
|
+
};
|
|
250
|
+
}
|
|
163
251
|
function adoptedSummary(step) {
|
|
252
|
+
if (step.status === 'failed') {
|
|
253
|
+
return `Adopted after the attempt failed: the working tree as it stood was taken as this ${stepNoun(step)}'s result.`;
|
|
254
|
+
}
|
|
164
255
|
return step.generatorCompleted === true
|
|
165
256
|
? "Adopted after the worker died: its generator had run, and the working tree it left was taken as this migration's result."
|
|
166
257
|
: "Adopted after the worker died before recording that its generator had run; the working tree it left was taken as this migration's result.";
|
|
167
258
|
}
|
|
168
|
-
//
|
|
169
|
-
//
|
|
170
|
-
// can't carry a stale failure outcome; dispenseCount stays cumulative across
|
|
171
|
-
// attempts.
|
|
259
|
+
// Rebuilds the step for a fresh attempt so a stale outcome cannot survive;
|
|
260
|
+
// dispenseCount stays cumulative across attempts.
|
|
172
261
|
// `keepGeneratorCompleted` says whether the generator's changes reach the new
|
|
173
262
|
// attempt. They do when nothing resets the tree, and when the reset target
|
|
174
263
|
// already contains the commit that landed them; re-running the generator there
|
|
175
264
|
// would apply them twice. They do not when the reset discards them, and
|
|
176
265
|
// keeping the marker then would skip the generator and record a success for a
|
|
177
|
-
// migration that never ran. The step kind
|
|
178
|
-
// and always
|
|
179
|
-
// the last dependencies that were installed, so dropping it here would
|
|
180
|
-
// the retry with nothing to detect the previous attempt's package.json
|
|
266
|
+
// migration that never ran. The step kind and generator flag are plan facts,
|
|
267
|
+
// not an attempt's, and always survive. So does the dependency baseline: it
|
|
268
|
+
// tracks the last dependencies that were installed, so dropping it here would
|
|
269
|
+
// leave the retry with nothing to detect the previous attempt's package.json
|
|
270
|
+
// edits.
|
|
181
271
|
function rearm(step, keepGeneratorCompleted) {
|
|
182
272
|
return {
|
|
183
273
|
id: step.id,
|
|
184
274
|
roundIndex: step.roundIndex,
|
|
185
|
-
|
|
275
|
+
...stepKindFields(step),
|
|
186
276
|
status: 'pending',
|
|
187
277
|
attempt: step.attempt + 1,
|
|
188
278
|
dispenseCount: step.dispenseCount,
|
|
@@ -192,11 +282,130 @@ function rearm(step, keepGeneratorCompleted) {
|
|
|
192
282
|
...(step.depsHashAtDispense !== undefined
|
|
193
283
|
? { depsHashAtDispense: step.depsHashAtDispense }
|
|
194
284
|
: {}),
|
|
195
|
-
|
|
196
|
-
|
|
285
|
+
// A reset keeps a commit that landed before this attempt's ref as well.
|
|
286
|
+
...(step.commitStarted ? { commitStarted: true } : {}),
|
|
287
|
+
...(keepGeneratorCompleted ? generatorRunFields(step) : {}),
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
function generatorRunFields(step) {
|
|
291
|
+
if (!step.generatorCompleted)
|
|
292
|
+
return {};
|
|
293
|
+
return {
|
|
294
|
+
generatorCompleted: true,
|
|
295
|
+
...(step.generatorCompletedAtAttempt !== undefined
|
|
296
|
+
? { generatorCompletedAtAttempt: step.generatorCompletedAtAttempt }
|
|
297
|
+
: {}),
|
|
298
|
+
...(step.agenticWaived ? { agenticWaived: true } : {}),
|
|
299
|
+
...(step.validationOwed ? { validationOwed: true } : {}),
|
|
300
|
+
...(step.generatorMadeChanges !== undefined
|
|
301
|
+
? { generatorMadeChanges: step.generatorMadeChanges }
|
|
197
302
|
: {}),
|
|
198
303
|
};
|
|
199
304
|
}
|
|
305
|
+
/**
|
|
306
|
+
* Forgets the generator run of `stepId`'s current attempt, unless a landed
|
|
307
|
+
* commit already carries its changes.
|
|
308
|
+
*/
|
|
309
|
+
function discardGeneratorRun(state, stepId) {
|
|
310
|
+
if (coveringLandedEntries(state, stepId).length > 0)
|
|
311
|
+
return state;
|
|
312
|
+
return {
|
|
313
|
+
...state,
|
|
314
|
+
steps: state.steps.map((step) => {
|
|
315
|
+
if (step.id !== stepId || !step.generatorCompleted)
|
|
316
|
+
return step;
|
|
317
|
+
const { generatorCompleted: _completed, generatorCompletedAtAttempt: _atAttempt, agenticWaived: _waived, validationOwed: _owed, generatorMadeChanges: _madeChanges, ...rest } = step;
|
|
318
|
+
return rest;
|
|
319
|
+
}),
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
function tallySteps(state) {
|
|
323
|
+
const tally = {
|
|
324
|
+
applied: 0,
|
|
325
|
+
adopted: 0,
|
|
326
|
+
skipped: 0,
|
|
327
|
+
unresolved: [],
|
|
328
|
+
remaining: 0,
|
|
329
|
+
stalled: 0,
|
|
330
|
+
};
|
|
331
|
+
for (const step of state.steps) {
|
|
332
|
+
switch (step.status) {
|
|
333
|
+
case 'succeeded':
|
|
334
|
+
if (step.adopted)
|
|
335
|
+
tally.adopted++;
|
|
336
|
+
else
|
|
337
|
+
tally.applied++;
|
|
338
|
+
break;
|
|
339
|
+
case 'skipped':
|
|
340
|
+
tally.skipped++;
|
|
341
|
+
break;
|
|
342
|
+
case 'unresolved':
|
|
343
|
+
tally.unresolved.push(step);
|
|
344
|
+
break;
|
|
345
|
+
case 'failed':
|
|
346
|
+
case 'died':
|
|
347
|
+
tally.stalled++;
|
|
348
|
+
tally.remaining++;
|
|
349
|
+
break;
|
|
350
|
+
case 'pending':
|
|
351
|
+
case 'dispensed':
|
|
352
|
+
case 'running':
|
|
353
|
+
case 'awaiting-prompt-outcome':
|
|
354
|
+
tally.remaining++;
|
|
355
|
+
break;
|
|
356
|
+
default: {
|
|
357
|
+
const exhaustive = step.status;
|
|
358
|
+
throw new Error(`Unhandled step status '${exhaustive}'.`);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
return tally;
|
|
363
|
+
}
|
|
364
|
+
function runTallies(state) {
|
|
365
|
+
const tally = tallySteps(state);
|
|
366
|
+
return {
|
|
367
|
+
completed: tally.applied + tally.adopted,
|
|
368
|
+
skipped: tally.skipped,
|
|
369
|
+
unresolved: tally.unresolved.length,
|
|
370
|
+
dispenseCount: state.steps.reduce((n, s) => n + s.dispenseCount, 0),
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
// The failure a given-up step is reported with, in the issue ledger and the
|
|
374
|
+
// completion report alike. Agent text is collapsed to one line so a break
|
|
375
|
+
// inside it cannot open a block at a line start; an accepted handoff may carry
|
|
376
|
+
// an empty summary, which gets the fallback.
|
|
377
|
+
function unresolvedFailureDetail(step) {
|
|
378
|
+
const failure = (0, text_1.singleLine)(step.outcome?.summary ?? step.promptOutcome?.summary ?? '').trim();
|
|
379
|
+
return failure.length === 0 ? 'no failure detail was recorded' : failure;
|
|
380
|
+
}
|
|
381
|
+
function completionSummaryLines(state) {
|
|
382
|
+
const tally = tallySteps(state);
|
|
383
|
+
return [
|
|
384
|
+
` applied: ${tally.applied}`,
|
|
385
|
+
` adopted: ${tally.adopted}`,
|
|
386
|
+
` skipped: ${tally.skipped}`,
|
|
387
|
+
` unresolved: ${tally.unresolved.length}`,
|
|
388
|
+
...tally.unresolved.map((step) => ` - ${stepLabel(step)}: ${unresolvedFailureDetail(step)}`),
|
|
389
|
+
];
|
|
390
|
+
}
|
|
391
|
+
// Suffixed so history does not read the partial result as the migration
|
|
392
|
+
// applied.
|
|
393
|
+
function unresolvedCommitName(step) {
|
|
394
|
+
return `${commitNameForStep(step)} (unresolved)`;
|
|
395
|
+
}
|
|
396
|
+
// Takes the place after the commit prefix in a step's commits.
|
|
397
|
+
function commitNameForStep(step) {
|
|
398
|
+
switch (step.kind) {
|
|
399
|
+
case 'migration':
|
|
400
|
+
return splitMigrationId(step.migrationId).name;
|
|
401
|
+
case 'final-validation':
|
|
402
|
+
return 'final validation';
|
|
403
|
+
default: {
|
|
404
|
+
const exhaustive = step;
|
|
405
|
+
throw new Error(`Unhandled step kind '${exhaustive}'.`);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
200
409
|
// A guarded transition whose observation was made against an earlier attempt
|
|
201
410
|
// of the same step: the status recurred, so the observation says nothing about
|
|
202
411
|
// the attempt on disk now.
|
|
@@ -260,10 +469,96 @@ function hasPendingCommitDebt(state) {
|
|
|
260
469
|
function coveringLandedEntries(state, stepId) {
|
|
261
470
|
return state.commits.filter((commit) => commit.kind === 'landed' && commit.stepIds.includes(stepId));
|
|
262
471
|
}
|
|
472
|
+
function markCommitStarted(state, stepId) {
|
|
473
|
+
return {
|
|
474
|
+
...state,
|
|
475
|
+
steps: state.steps.map((step) => step.id === stepId ? { ...step, commitStarted: true } : step),
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
function clearCommitStarted(state, stepId) {
|
|
479
|
+
return {
|
|
480
|
+
...state,
|
|
481
|
+
steps: state.steps.map((step) => {
|
|
482
|
+
if (step.id !== stepId || !step.commitStarted)
|
|
483
|
+
return step;
|
|
484
|
+
const { commitStarted: _started, ...rest } = step;
|
|
485
|
+
return rest;
|
|
486
|
+
}),
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* True when a landed entry names the step, or a commit was started for it
|
|
491
|
+
* that no entry accounts for. Skipping the step would then report as not
|
|
492
|
+
* applied a migration whose commit is, or may be, in history.
|
|
493
|
+
*/
|
|
494
|
+
function commitMayBeInHistory(state, step) {
|
|
495
|
+
return (coveringLandedEntries(state, step.id).length > 0 ||
|
|
496
|
+
step.commitStarted === true);
|
|
497
|
+
}
|
|
498
|
+
// Every ledger append. Entries are never removed or reordered: step receipts
|
|
499
|
+
// and resolution stamps index into the ledger. A failed entry says nothing
|
|
500
|
+
// about an earlier commit, so only a landed one clears the mark.
|
|
501
|
+
function appendCommit(state, entry) {
|
|
502
|
+
const accounted = entry.kind === 'landed'
|
|
503
|
+
? entry.stepIds.reduce(clearCommitStarted, state)
|
|
504
|
+
: state;
|
|
505
|
+
return { ...accounted, commits: [...state.commits, entry] };
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* The entry a parent session recorded for this attempt's commit, or undefined
|
|
509
|
+
* without a receipt. A receipt past the ledger or naming another step is
|
|
510
|
+
* corrupt run state, so it throws.
|
|
511
|
+
*/
|
|
512
|
+
function commitReceipt(state, step) {
|
|
513
|
+
const index = step.commitLedgerIndex;
|
|
514
|
+
if (index === undefined)
|
|
515
|
+
return undefined;
|
|
516
|
+
const entry = state.commits[index];
|
|
517
|
+
if (!entry || !entry.stepIds.includes(step.id)) {
|
|
518
|
+
throw new Error(`Step ${step.id} records its commit at ledger index ${index}, which ${entry ? 'does not name it' : 'does not exist'}.`);
|
|
519
|
+
}
|
|
520
|
+
return { index, entry };
|
|
521
|
+
}
|
|
263
522
|
// The round with the highest index.
|
|
264
523
|
function latestRound(state) {
|
|
265
524
|
return state.rounds.reduce((newest, round) => (!newest || round.index > newest.index ? round : newest), undefined);
|
|
266
525
|
}
|
|
526
|
+
function stepKindFields(step) {
|
|
527
|
+
switch (step.kind) {
|
|
528
|
+
case 'migration':
|
|
529
|
+
return { kind: 'migration', migrationId: step.migrationId };
|
|
530
|
+
case 'final-validation':
|
|
531
|
+
return { kind: 'final-validation' };
|
|
532
|
+
default: {
|
|
533
|
+
const exhaustive = step;
|
|
534
|
+
throw new Error(`Unhandled step kind '${exhaustive}'.`);
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
function stepNoun(step) {
|
|
539
|
+
switch (step.kind) {
|
|
540
|
+
case 'migration':
|
|
541
|
+
return 'migration';
|
|
542
|
+
case 'final-validation':
|
|
543
|
+
return 'validation pass';
|
|
544
|
+
default: {
|
|
545
|
+
const exhaustive = step;
|
|
546
|
+
throw new Error(`Unhandled step kind '${exhaustive}'.`);
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
function stepLabel(step) {
|
|
551
|
+
switch (step.kind) {
|
|
552
|
+
case 'migration':
|
|
553
|
+
return step.migrationId;
|
|
554
|
+
case 'final-validation':
|
|
555
|
+
return 'the final validation pass';
|
|
556
|
+
default: {
|
|
557
|
+
const exhaustive = step;
|
|
558
|
+
throw new Error(`Unhandled step kind '${exhaustive}'.`);
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
}
|
|
267
562
|
// '<package>:<name>' splits on the first ':', leaving names that contain a ':'
|
|
268
563
|
// intact; a bare id has no package.
|
|
269
564
|
function splitMigrationId(id) {
|
|
@@ -273,21 +568,39 @@ function splitMigrationId(id) {
|
|
|
273
568
|
: { package: id.slice(0, colon), name: id.slice(colon + 1) };
|
|
274
569
|
}
|
|
275
570
|
// Maps absorbed step ids to `{package, name}` for the commit body; an id with
|
|
276
|
-
// no matching step, or one whose migration id
|
|
277
|
-
// attributed there.
|
|
571
|
+
// no matching step, a step that ran no migration, or one whose migration id
|
|
572
|
+
// carries no package, can't be attributed there.
|
|
278
573
|
function stepsToPendingMigrations(state, stepIds) {
|
|
279
574
|
const pending = [];
|
|
280
575
|
for (const id of stepIds) {
|
|
281
|
-
const
|
|
282
|
-
if (
|
|
576
|
+
const step = state.steps.find((s) => s.id === id);
|
|
577
|
+
if (step?.kind !== 'migration')
|
|
283
578
|
continue;
|
|
284
|
-
const { package: pkg, name } = splitMigrationId(migrationId);
|
|
579
|
+
const { package: pkg, name } = splitMigrationId(step.migrationId);
|
|
285
580
|
if (!pkg)
|
|
286
581
|
continue;
|
|
287
582
|
pending.push({ package: pkg, name });
|
|
288
583
|
}
|
|
289
584
|
return pending;
|
|
290
585
|
}
|
|
586
|
+
// Whether git may have written history for this result. A landed commit's
|
|
587
|
+
// mark is the ledger entry's to clear, and a failure reported once git ran
|
|
588
|
+
// (a hook's output overflowing the subprocess buffer after the commit) cannot
|
|
589
|
+
// vouch that nothing landed, so only the other results release the mark.
|
|
590
|
+
function gitRan(result) {
|
|
591
|
+
switch (result.status) {
|
|
592
|
+
case 'committed':
|
|
593
|
+
case 'failed':
|
|
594
|
+
return true;
|
|
595
|
+
case 'no-changes':
|
|
596
|
+
case 'disabled':
|
|
597
|
+
return false;
|
|
598
|
+
default: {
|
|
599
|
+
const exhaustive = result;
|
|
600
|
+
throw new Error(`Unhandled commit result: ${JSON.stringify(exhaustive)}`);
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
}
|
|
291
604
|
/**
|
|
292
605
|
* Classifies a commit attempt into the ledger entry to record, or null when
|
|
293
606
|
* there is nothing to record ('no-changes' / 'disabled'). A landed entry
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { MigrateOutputSink } from '../deferred-output';
|
|
1
2
|
import type { MigrateStep } from './run-state';
|
|
2
3
|
export declare function nowIso(): string;
|
|
3
4
|
/**
|
|
@@ -28,7 +29,7 @@ export declare function depsHash(root: string): string | null;
|
|
|
28
29
|
* started from are unknown rather than unchanged, and skipping there would
|
|
29
30
|
* strand the change with nothing left to detect it.
|
|
30
31
|
*/
|
|
31
|
-
export declare function installDepsChangedSinceDispense(root: string, dir: string, step: MigrateStep, skipInstall: boolean, rerunCommand?: string): Promise<void>;
|
|
32
|
+
export declare function installDepsChangedSinceDispense(root: string, dir: string, step: MigrateStep, skipInstall: boolean, rerunCommand?: string, sink?: MigrateOutputSink): Promise<void>;
|
|
32
33
|
/**
|
|
33
34
|
* Records what an install that just landed means for the run: the installing
|
|
34
35
|
* step's dependency baseline moves to what is now on disk, and every step's
|
|
@@ -56,4 +57,5 @@ export declare function isPidAlive(pid: number): boolean;
|
|
|
56
57
|
export declare function summarizeError(e: unknown): string;
|
|
57
58
|
export declare function warnCommitFailed(name: string, cause?: unknown): void;
|
|
58
59
|
export declare function pmExecPrefix(root: string): string;
|
|
60
|
+
export declare function runMigrationsFlag(migrationsPath: string): string | null;
|
|
59
61
|
export declare function pmInstallCommand(root: string): string;
|
|
@@ -9,12 +9,15 @@ exports.isPidAlive = isPidAlive;
|
|
|
9
9
|
exports.summarizeError = summarizeError;
|
|
10
10
|
exports.warnCommitFailed = warnCommitFailed;
|
|
11
11
|
exports.pmExecPrefix = pmExecPrefix;
|
|
12
|
+
exports.runMigrationsFlag = runMigrationsFlag;
|
|
12
13
|
exports.pmInstallCommand = pmInstallCommand;
|
|
13
14
|
const crypto_1 = require("crypto");
|
|
15
|
+
const shell_quoting_1 = require("../../../utils/shell-quoting");
|
|
14
16
|
const package_manager_1 = require("../../../utils/package-manager");
|
|
15
17
|
const execute_migration_1 = require("../execute-migration");
|
|
16
18
|
const state_lock_1 = require("./state-lock");
|
|
17
19
|
const agent_output_1 = require("./agent-output");
|
|
20
|
+
const text_1 = require("../text");
|
|
18
21
|
function nowIso() {
|
|
19
22
|
return new Date().toISOString();
|
|
20
23
|
}
|
|
@@ -49,15 +52,15 @@ function depsHash(root) {
|
|
|
49
52
|
* started from are unknown rather than unchanged, and skipping there would
|
|
50
53
|
* strand the change with nothing left to detect it.
|
|
51
54
|
*/
|
|
52
|
-
async function installDepsChangedSinceDispense(root, dir, step, skipInstall, rerunCommand) {
|
|
55
|
+
async function installDepsChangedSinceDispense(root, dir, step, skipInstall, rerunCommand, sink) {
|
|
53
56
|
const current = depsHash(root);
|
|
54
57
|
if (current !== null && current === step.depsHashAtDispense)
|
|
55
58
|
return;
|
|
56
59
|
if (skipInstall) {
|
|
57
|
-
(0, execute_migration_1.logSkippedPostMigrationInstall)(root);
|
|
60
|
+
(0, execute_migration_1.logSkippedPostMigrationInstall)(root, sink);
|
|
58
61
|
return;
|
|
59
62
|
}
|
|
60
|
-
await (0, execute_migration_1.runInstall)(root, 'post-migration', rerunCommand);
|
|
63
|
+
await (0, execute_migration_1.runInstall)(root, 'post-migration', rerunCommand, sink);
|
|
61
64
|
recordInstallLanded(root, dir, step.id);
|
|
62
65
|
}
|
|
63
66
|
/**
|
|
@@ -143,6 +146,24 @@ function pmCommands(root) {
|
|
|
143
146
|
function pmExecPrefix(root) {
|
|
144
147
|
return pmCommands(root).exec;
|
|
145
148
|
}
|
|
149
|
+
const DEFAULT_MIGRATIONS_FILE = 'migrations.json';
|
|
150
|
+
// The --run-migrations flag a rendered command repeats; null when the path
|
|
151
|
+
// cannot go out as a one-line command for this shell. On Windows the paste
|
|
152
|
+
// target may be cmd.exe or PowerShell, whose quoting and expansion conflict
|
|
153
|
+
// (`%VAR%` expands in cmd, `$(...)` runs in PowerShell).
|
|
154
|
+
function runMigrationsFlag(migrationsPath) {
|
|
155
|
+
if (migrationsPath === DEFAULT_MIGRATIONS_FILE) {
|
|
156
|
+
return '--run-migrations';
|
|
157
|
+
}
|
|
158
|
+
if ((0, text_1.hasLineBreak)(migrationsPath)) {
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
const arg = `--run-migrations=${migrationsPath}`;
|
|
162
|
+
if (process.platform !== 'win32') {
|
|
163
|
+
return (0, shell_quoting_1.quoteShellArg)(arg);
|
|
164
|
+
}
|
|
165
|
+
return !(0, shell_quoting_1.needsShellQuoting)(arg) && !/[%^]/.test(arg) ? arg : null;
|
|
166
|
+
}
|
|
146
167
|
function pmInstallCommand(root) {
|
|
147
168
|
return pmCommands(root).install;
|
|
148
169
|
}
|