@ohos-ports/nx 23.3.0-beta.2 → 24.0.2-beta.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.
Files changed (294) hide show
  1. package/README.md +3 -6
  2. package/dist/bin/nx.js +2 -2
  3. package/dist/bin/post-install.js +5 -3
  4. package/dist/nx-cloud-internals.d.ts +1 -0
  5. package/dist/nx-cloud-internals.js +7 -1
  6. package/dist/src/adapter/ngcli-adapter.js +2 -2
  7. package/dist/src/ai/clone-ai-config-repo.js +49 -12
  8. package/dist/src/command-line/add/add.d.ts +2 -0
  9. package/dist/src/command-line/add/add.js +23 -5
  10. package/dist/src/command-line/affected/affected.js +2 -2
  11. package/dist/src/command-line/configure-ai-agents/configure-ai-agents.js +0 -12
  12. package/dist/src/command-line/graph/graph.js +38 -10
  13. package/dist/src/command-line/init/command-object.js +0 -12
  14. package/dist/src/command-line/init/implementation/add-nx-to-nest.js +21 -62
  15. package/dist/src/command-line/init/init-v2.js +0 -2
  16. package/dist/src/command-line/migrate/agentic/close-agent-session.d.ts +1 -1
  17. package/dist/src/command-line/migrate/agentic/close-agent-session.js +4 -3
  18. package/dist/src/command-line/migrate/agentic/definitions.d.ts +1 -3
  19. package/dist/src/command-line/migrate/agentic/definitions.js +5 -97
  20. package/dist/src/command-line/migrate/agentic/handoff-gitignore.d.ts +7 -45
  21. package/dist/src/command-line/migrate/agentic/handoff-gitignore.js +9 -51
  22. package/dist/src/command-line/migrate/agentic/handoff.d.ts +1 -43
  23. package/dist/src/command-line/migrate/agentic/handoff.js +3 -119
  24. package/dist/src/command-line/migrate/agentic/instruction-files.d.ts +0 -21
  25. package/dist/src/command-line/migrate/agentic/instruction-files.js +6 -27
  26. package/dist/src/command-line/migrate/agentic/master/run-master-session.d.ts +19 -1
  27. package/dist/src/command-line/migrate/agentic/master/run-master-session.js +88 -49
  28. package/dist/src/command-line/migrate/agentic/master/spawn-master.d.ts +1 -0
  29. package/dist/src/command-line/migrate/agentic/master/spawn-master.js +86 -24
  30. package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.d.ts +2 -2
  31. package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.js +2 -2
  32. package/dist/src/command-line/migrate/agentic/prompts/fragments.d.ts +1 -12
  33. package/dist/src/command-line/migrate/agentic/prompts/fragments.js +8 -17
  34. package/dist/src/command-line/migrate/agentic/prompts/shared-rendering.d.ts +0 -15
  35. package/dist/src/command-line/migrate/agentic/prompts/shared-rendering.js +3 -100
  36. package/dist/src/command-line/migrate/agentic/select.d.ts +12 -6
  37. package/dist/src/command-line/migrate/agentic/select.js +38 -8
  38. package/dist/src/command-line/migrate/agentic/types.d.ts +9 -68
  39. package/dist/src/command-line/migrate/agentic/types.js +6 -8
  40. package/dist/src/command-line/migrate/command-object.js +6 -10
  41. package/dist/src/command-line/migrate/execute-migration.d.ts +6 -6
  42. package/dist/src/command-line/migrate/execute-migration.js +25 -15
  43. package/dist/src/command-line/migrate/migrate-analytics.d.ts +18 -1
  44. package/dist/src/command-line/migrate/migrate-analytics.js +38 -0
  45. package/dist/src/command-line/migrate/migrate-commits.d.ts +29 -17
  46. package/dist/src/command-line/migrate/migrate-commits.js +86 -32
  47. package/dist/src/command-line/migrate/migrate-config.d.ts +6 -6
  48. package/dist/src/command-line/migrate/migrate-config.js +12 -6
  49. package/dist/src/command-line/migrate/migrate-output.d.ts +1 -6
  50. package/dist/src/command-line/migrate/migrate-output.js +1 -10
  51. package/dist/src/command-line/migrate/migrate.d.ts +6 -30
  52. package/dist/src/command-line/migrate/migrate.js +257 -255
  53. package/dist/src/command-line/migrate/resolve-package-version.d.ts +2 -4
  54. package/dist/src/command-line/migrate/resolve-package-version.js +2 -35
  55. package/dist/src/command-line/migrate/run/agent-output.d.ts +2 -0
  56. package/dist/src/command-line/migrate/run/agent-output.js +9 -0
  57. package/dist/src/command-line/migrate/run/broker.d.ts +14 -5
  58. package/dist/src/command-line/migrate/run/broker.js +69 -21
  59. package/dist/src/command-line/migrate/run/clean-retry.js +4 -2
  60. package/dist/src/command-line/migrate/run/existing-run-report.d.ts +1 -1
  61. package/dist/src/command-line/migrate/run/existing-run-report.js +7 -5
  62. package/dist/src/command-line/migrate/run/give-up.d.ts +4 -3
  63. package/dist/src/command-line/migrate/run/give-up.js +8 -5
  64. package/dist/src/command-line/migrate/run/index.d.ts +7 -5
  65. package/dist/src/command-line/migrate/run/index.js +16 -1
  66. package/dist/src/command-line/migrate/run/issues.js +7 -2
  67. package/dist/src/command-line/migrate/run/orchestrator.d.ts +61 -4
  68. package/dist/src/command-line/migrate/run/orchestrator.js +397 -133
  69. package/dist/src/command-line/migrate/run/run-state.d.ts +17 -1
  70. package/dist/src/command-line/migrate/run/run-state.js +41 -2
  71. package/dist/src/command-line/migrate/run/runbook.d.ts +1 -0
  72. package/dist/src/command-line/migrate/run/runbook.js +115 -18
  73. package/dist/src/command-line/migrate/run/state-lock.d.ts +29 -4
  74. package/dist/src/command-line/migrate/run/state-lock.js +102 -10
  75. package/dist/src/command-line/migrate/run/state-machine.js +4 -1
  76. package/dist/src/command-line/migrate/run/util.d.ts +7 -2
  77. package/dist/src/command-line/migrate/run/util.js +30 -3
  78. package/dist/src/command-line/migrate/run/worker.d.ts +1 -1
  79. package/dist/src/command-line/migrate/run/worker.js +252 -250
  80. package/dist/src/command-line/migrate/sort-migrations.d.ts +1 -7
  81. package/dist/src/command-line/migrate/sort-migrations.js +1 -12
  82. package/dist/src/command-line/nx-cloud/connect/connect-to-nx-cloud.js +17 -12
  83. package/dist/src/command-line/release/changelog.js +9 -6
  84. package/dist/src/command-line/release/config/config.d.ts +1 -0
  85. package/dist/src/command-line/release/config/config.js +48 -9
  86. package/dist/src/command-line/release/release.js +2 -2
  87. package/dist/src/command-line/release/utils/git.js +8 -7
  88. package/dist/src/command-line/release/utils/interpolate-release-config.d.ts +6 -0
  89. package/dist/src/command-line/release/utils/interpolate-release-config.js +39 -0
  90. package/dist/src/command-line/release/utils/release-graph.d.ts +5 -0
  91. package/dist/src/command-line/release/utils/release-graph.js +1 -0
  92. package/dist/src/command-line/release/utils/remote-release-clients/github.js +5 -6
  93. package/dist/src/command-line/release/utils/remote-release-clients/gitlab.js +5 -6
  94. package/dist/src/command-line/release/utils/resolve-changelog-renderer.js +2 -2
  95. package/dist/src/command-line/release/utils/shared.js +10 -10
  96. package/dist/src/command-line/release/utils/version-plan-utils.d.ts +3 -12
  97. package/dist/src/command-line/release/utils/version-plan-utils.js +33 -55
  98. package/dist/src/command-line/release/version/version-actions.js +2 -1
  99. package/dist/src/command-line/release/version.js +5 -2
  100. package/dist/src/command-line/reset/reset.js +58 -62
  101. package/dist/src/command-line/run/executor-utils.js +1 -0
  102. package/dist/src/command-line/run/run-one.d.ts +20 -1
  103. package/dist/src/command-line/run/run-one.js +153 -5
  104. package/dist/src/command-line/run/run.js +2 -1
  105. package/dist/src/command-line/show/projects.js +5 -3
  106. package/dist/src/command-line/show/show-target/info.d.ts +10 -1
  107. package/dist/src/command-line/show/show-target/info.js +100 -15
  108. package/dist/src/command-line/show/show-target/inputs.js +10 -2
  109. package/dist/src/command-line/show/show-target/utils.js +1 -0
  110. package/dist/src/command-line/watch/command-object.js +3 -22
  111. package/dist/src/command-line/watch/watch.d.ts +0 -7
  112. package/dist/src/command-line/watch/watch.js +1 -1
  113. package/dist/src/command-line/yargs-utils/shared-options.js +1 -1
  114. package/dist/src/config/misc-interfaces.d.ts +18 -0
  115. package/dist/src/config/nx-json.d.ts +22 -11
  116. package/dist/src/config/task-graph.d.ts +1 -1
  117. package/dist/src/config/workspace-json-project-json.d.ts +88 -0
  118. package/dist/src/core/graph/main.js +1 -1
  119. package/dist/src/core/graph/runtime.js +1 -1
  120. package/dist/src/core/graph/styles.css +1 -1
  121. package/dist/src/core/graph/styles.js +1 -1
  122. package/dist/src/daemon/client/client.d.ts +15 -0
  123. package/dist/src/daemon/client/client.js +181 -71
  124. package/dist/src/daemon/client/daemon-socket-messenger.d.ts +1 -1
  125. package/dist/src/daemon/client/daemon-socket-messenger.js +2 -2
  126. package/dist/src/daemon/server/client-socket-context.js +1 -1
  127. package/dist/src/daemon/server/handle-process-in-background.js +21 -9
  128. package/dist/src/daemon/server/handle-select-affected-tasks.d.ts +2 -1
  129. package/dist/src/daemon/server/handle-select-affected-tasks.js +21 -13
  130. package/dist/src/daemon/server/native-js-loader.d.ts +1 -0
  131. package/dist/src/daemon/server/native-js-loader.js +21 -0
  132. package/dist/src/daemon/server/project-graph-incremental-recomputation.js +4 -8
  133. package/dist/src/daemon/server/server.d.ts +2 -1
  134. package/dist/src/daemon/server/server.js +17 -4
  135. package/dist/src/daemon/server/shutdown-utils.js +0 -3
  136. package/dist/src/daemon/server/start.d.ts +1 -0
  137. package/dist/src/daemon/server/start.js +2 -0
  138. package/dist/src/daemon/socket-utils.d.ts +11 -9
  139. package/dist/src/daemon/socket-utils.js +31 -61
  140. package/dist/src/daemon/tmp-dir.d.ts +19 -14
  141. package/dist/src/daemon/tmp-dir.js +142 -354
  142. package/dist/src/devkit-exports.d.ts +9 -1
  143. package/dist/src/devkit-exports.js +12 -1
  144. package/dist/src/devkit-internals.d.ts +6 -5
  145. package/dist/src/devkit-internals.js +13 -4
  146. package/dist/src/executors/run-commands/run-commands.impl.d.ts +4 -2
  147. package/dist/src/executors/run-commands/run-commands.impl.js +53 -27
  148. package/dist/src/executors/run-commands/running-tasks.d.ts +13 -4
  149. package/dist/src/executors/run-commands/running-tasks.js +148 -95
  150. package/dist/src/executors/run-commands/schema.json +1 -1
  151. package/dist/src/hasher/check-task-files.js +5 -8
  152. package/dist/src/hasher/file-hasher.js +9 -7
  153. package/dist/src/hasher/hash-task.js +4 -0
  154. package/dist/src/hasher/native-task-hasher-impl.js +3 -1
  155. package/dist/src/hasher/task-hasher.d.ts +2 -0
  156. package/dist/src/hasher/task-hasher.js +4 -1
  157. package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.d.ts +1 -2
  158. package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.js +6 -11
  159. package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.md +2 -2
  160. package/dist/src/migrations/update-24-0-0/enable-legacy-affected.d.ts +4 -0
  161. package/dist/src/migrations/update-24-0-0/enable-legacy-affected.js +15 -0
  162. package/dist/src/migrations/update-24-0-0/enable-legacy-affected.md +30 -0
  163. package/dist/src/migrations/update-24-0-0/find-custom-hashers.d.ts +3 -0
  164. package/dist/src/migrations/update-24-0-0/find-custom-hashers.js +100 -0
  165. package/dist/src/migrations/update-24-0-0/find-custom-hashers.md +63 -0
  166. package/dist/src/migrations/update-24-0-0/move-custom-hashers-to-inputs.md +146 -0
  167. package/dist/src/migrations/update-24-0-0/rename-ultracache-ignore-options.d.ts +3 -0
  168. package/dist/src/migrations/update-24-0-0/rename-ultracache-ignore-options.js +130 -0
  169. package/dist/src/migrations/update-24-0-0/rename-ultracache-ignore-options.md +62 -0
  170. package/dist/src/native/assert-supported-platform.js +1 -1
  171. package/dist/src/native/index.d.ts +238 -18
  172. package/dist/src/native/index.js +6 -1
  173. package/dist/src/native/native-bindings.js +15 -6
  174. package/dist/src/native/nx.openharmony-arm64.node +0 -0
  175. package/dist/src/native/nx.wasi-browser.js +1 -0
  176. package/dist/src/native/nx.wasi.cjs +1 -0
  177. package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
  178. package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
  179. package/dist/src/nx-cloud/update-manager.d.ts +14 -0
  180. package/dist/src/nx-cloud/update-manager.js +237 -50
  181. package/dist/src/plugins/js/lock-file/pnpm-parser.js +3 -4
  182. package/dist/src/plugins/js/lock-file/pruned-output.d.ts +2 -2
  183. package/dist/src/plugins/js/lock-file/pruned-output.js +4 -4
  184. package/dist/src/plugins/js/utils/register.js +9 -4
  185. package/dist/src/project-graph/affected/affected-tasks.d.ts +9 -6
  186. package/dist/src/project-graph/affected/affected-tasks.js +31 -7
  187. package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +7 -0
  188. package/dist/src/project-graph/plugins/loaded-nx-plugin.js +49 -6
  189. package/dist/src/project-graph/utils/project-configuration/target-merging.js +1 -1
  190. package/dist/src/project-graph/utils/project-configuration/target-normalization.js +12 -133
  191. package/dist/src/project-graph/utils/project-configuration-utils.js +2 -2
  192. package/dist/src/project-graph/utils/retrieve-workspace-files.js +27 -6
  193. package/dist/src/tasks-runner/create-task-graph.d.ts +8 -7
  194. package/dist/src/tasks-runner/create-task-graph.js +50 -27
  195. package/dist/src/tasks-runner/default-tasks-runner.js +1 -1
  196. package/dist/src/tasks-runner/init-tasks-runner.js +116 -59
  197. package/dist/src/tasks-runner/life-cycle.d.ts +4 -1
  198. package/dist/src/tasks-runner/life-cycle.js +7 -0
  199. package/dist/src/tasks-runner/life-cycles/performance-analysis.d.ts +5 -2
  200. package/dist/src/tasks-runner/life-cycles/performance-analysis.js +13 -7
  201. package/dist/src/tasks-runner/life-cycles/performance-life-cycle.d.ts +4 -3
  202. package/dist/src/tasks-runner/life-cycles/performance-life-cycle.js +9 -2
  203. package/dist/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.js +5 -2
  204. package/dist/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.js +4 -1
  205. package/dist/src/tasks-runner/life-cycles/summary-terminal-output-life-cycle.js +5 -1
  206. package/dist/src/tasks-runner/pseudo-ipc.d.ts +1 -0
  207. package/dist/src/tasks-runner/pseudo-ipc.js +4 -0
  208. package/dist/src/tasks-runner/pseudo-terminal.d.ts +1 -1
  209. package/dist/src/tasks-runner/pseudo-terminal.js +2 -2
  210. package/dist/src/tasks-runner/readiness/executor-ready-signal.d.ts +7 -0
  211. package/dist/src/tasks-runner/readiness/executor-ready-signal.js +43 -0
  212. package/dist/src/tasks-runner/readiness/probes.d.ts +14 -0
  213. package/dist/src/tasks-runner/readiness/probes.js +101 -0
  214. package/dist/src/tasks-runner/readiness/ready-signal-server.d.ts +18 -0
  215. package/dist/src/tasks-runner/readiness/ready-signal-server.js +72 -0
  216. package/dist/src/tasks-runner/readiness/ready-signal.d.ts +33 -0
  217. package/dist/src/tasks-runner/readiness/ready-signal.js +92 -0
  218. package/dist/src/tasks-runner/readiness/ready-when.d.ts +84 -0
  219. package/dist/src/tasks-runner/readiness/ready-when.js +371 -0
  220. package/dist/src/tasks-runner/readiness/startup-host.d.ts +1 -0
  221. package/dist/src/tasks-runner/readiness/startup-host.js +32 -0
  222. package/dist/src/tasks-runner/run-command.d.ts +6 -2
  223. package/dist/src/tasks-runner/run-command.js +21 -31
  224. package/dist/src/tasks-runner/run-outcome.d.ts +16 -0
  225. package/dist/src/tasks-runner/run-outcome.js +39 -0
  226. package/dist/src/tasks-runner/running-tasks/batch-process.js +6 -0
  227. package/dist/src/tasks-runner/running-tasks/node-child-process.js +5 -4
  228. package/dist/src/tasks-runner/running-tasks/running-task.d.ts +1 -1
  229. package/dist/src/tasks-runner/task-env.d.ts +10 -0
  230. package/dist/src/tasks-runner/task-env.js +37 -5
  231. package/dist/src/tasks-runner/task-graph-utils.d.ts +9 -6
  232. package/dist/src/tasks-runner/task-graph-utils.js +17 -12
  233. package/dist/src/tasks-runner/task-orchestrator.d.ts +62 -18
  234. package/dist/src/tasks-runner/task-orchestrator.js +750 -150
  235. package/dist/src/tasks-runner/tasks-runner.d.ts +1 -1
  236. package/dist/src/tasks-runner/tasks-schedule.d.ts +18 -1
  237. package/dist/src/tasks-runner/tasks-schedule.js +63 -6
  238. package/dist/src/tasks-runner/tokens.d.ts +54 -0
  239. package/dist/src/tasks-runner/tokens.js +161 -0
  240. package/dist/src/tasks-runner/utils.d.ts +35 -6
  241. package/dist/src/tasks-runner/utils.js +149 -68
  242. package/dist/src/ultracache/ci-status.d.ts +24 -0
  243. package/dist/src/ultracache/ci-status.js +87 -0
  244. package/dist/src/ultracache/config.d.ts +3 -3
  245. package/dist/src/ultracache/config.js +4 -4
  246. package/dist/src/ultracache/fetch.d.ts +2 -0
  247. package/dist/src/ultracache/fetch.js +1 -0
  248. package/dist/src/ultracache/overrides.js +4 -0
  249. package/dist/src/utils/acknowledge-build-scripts.d.ts +34 -1
  250. package/dist/src/utils/acknowledge-build-scripts.js +171 -32
  251. package/dist/src/utils/child-process.js +2 -1
  252. package/dist/src/utils/find-matching-projects.js +9 -6
  253. package/dist/src/utils/git-utils.d.ts +12 -5
  254. package/dist/src/utils/git-utils.js +69 -11
  255. package/dist/src/utils/long-running-target.d.ts +1 -3
  256. package/dist/src/utils/long-running-target.js +1 -3
  257. package/dist/src/utils/output.d.ts +4 -3
  258. package/dist/src/utils/output.js +4 -3
  259. package/dist/src/utils/owned-private-dir.d.ts +1 -17
  260. package/dist/src/utils/owned-private-dir.js +10 -62
  261. package/dist/src/utils/package-manager.d.ts +8 -0
  262. package/dist/src/utils/package-manager.js +65 -8
  263. package/dist/src/utils/perf-hooks.d.ts +1 -0
  264. package/dist/src/utils/plugins/core-plugins.js +5 -1
  265. package/dist/src/utils/progress-topics.d.ts +1 -0
  266. package/dist/src/utils/progress-topics.js +1 -0
  267. package/dist/src/utils/safe-spawn.js +1 -5
  268. package/dist/src/utils/shell-quoting.d.ts +8 -1
  269. package/dist/src/utils/shell-quoting.js +12 -1
  270. package/dist/src/utils/spawn-without-terminal.d.ts +27 -0
  271. package/dist/src/utils/spawn-without-terminal.js +110 -0
  272. package/dist/src/utils/string-similarity.d.ts +38 -0
  273. package/dist/src/utils/string-similarity.js +108 -0
  274. package/migrations.json +20 -6
  275. package/package.json +15 -24
  276. package/schemas/migrations-schema.json +11 -0
  277. package/schemas/nx-schema.json +133 -11
  278. package/schemas/project-schema.json +114 -4
  279. package/dist/src/command-line/migrate/agentic/prompts/generic-validation.d.ts +0 -56
  280. package/dist/src/command-line/migrate/agentic/prompts/generic-validation.js +0 -67
  281. package/dist/src/command-line/migrate/agentic/prompts/hybrid-prompt-migration.d.ts +0 -49
  282. package/dist/src/command-line/migrate/agentic/prompts/hybrid-prompt-migration.js +0 -53
  283. package/dist/src/command-line/migrate/agentic/prompts/prompt-migration.d.ts +0 -26
  284. package/dist/src/command-line/migrate/agentic/prompts/prompt-migration.js +0 -27
  285. package/dist/src/command-line/migrate/agentic/prompts/system-prompt.d.ts +0 -70
  286. package/dist/src/command-line/migrate/agentic/prompts/system-prompt.js +0 -113
  287. package/dist/src/command-line/migrate/agentic/run-step.d.ts +0 -68
  288. package/dist/src/command-line/migrate/agentic/run-step.js +0 -148
  289. package/dist/src/command-line/migrate/agentic/runner.d.ts +0 -21
  290. package/dist/src/command-line/migrate/agentic/runner.js +0 -262
  291. package/dist/src/migrations/update-23-0-0/consolidate-release-tag-config.d.ts +0 -9
  292. package/dist/src/migrations/update-23-0-0/consolidate-release-tag-config.js +0 -18
  293. package/dist/src/tasks-runner/legacy-depends-on-warning.d.ts +0 -18
  294. package/dist/src/tasks-runner/legacy-depends-on-warning.js +0 -109
@@ -3,10 +3,8 @@
3
3
  * than via a real package-manager install. Precedence, highest first:
4
4
  *
5
5
  * 1. `NX_MIGRATE_USE_REGISTRY_RESOLUTION` ('true' -> enabled, 'false' -> disabled)
6
- * 2. legacy `NX_MIGRATE_SKIP_REGISTRY_FETCH` (deprecated, removed in Nx 24;
7
- * 'true' -> disabled, 'false' -> enabled)
8
- * 3. nx.json `migrate.useRegistryResolution`
9
- * 4. default: enabled
6
+ * 2. nx.json `migrate.useRegistryResolution`
7
+ * 3. default: enabled
10
8
  */
11
9
  export declare function isRegistryResolutionEnabled(root?: string): boolean;
12
10
  /** Test-only: clear the module-level caches between cases. */
@@ -21,63 +21,30 @@ const text_1 = require("./text");
21
21
  * than via a real package-manager install. Precedence, highest first:
22
22
  *
23
23
  * 1. `NX_MIGRATE_USE_REGISTRY_RESOLUTION` ('true' -> enabled, 'false' -> disabled)
24
- * 2. legacy `NX_MIGRATE_SKIP_REGISTRY_FETCH` (deprecated, removed in Nx 24;
25
- * 'true' -> disabled, 'false' -> enabled)
26
- * 3. nx.json `migrate.useRegistryResolution`
27
- * 4. default: enabled
24
+ * 2. nx.json `migrate.useRegistryResolution`
25
+ * 3. default: enabled
28
26
  */
29
27
  function isRegistryResolutionEnabled(root = workspace_root_1.workspaceRoot) {
30
- warnIfLegacyRegistryEnvVarSet();
31
28
  const explicit = parseBooleanFlag(process.env.NX_MIGRATE_USE_REGISTRY_RESOLUTION);
32
29
  if (explicit !== undefined) {
33
30
  return explicit;
34
31
  }
35
- // Legacy env is inverted: SKIP_REGISTRY_FETCH=true disables resolution.
36
- const legacy = parseBooleanFlag(process.env.NX_MIGRATE_SKIP_REGISTRY_FETCH);
37
- if (legacy !== undefined) {
38
- return !legacy;
39
- }
40
32
  return (0, configuration_1.readNxJson)(root)?.migrate?.useRegistryResolution ?? true;
41
33
  }
42
34
  function parseBooleanFlag(value) {
43
35
  return value === 'true' ? true : value === 'false' ? false : undefined;
44
36
  }
45
- // NX_MIGRATE_SKIP_REGISTRY_FETCH is the inverted, legacy predecessor of
46
- // NX_MIGRATE_USE_REGISTRY_RESOLUTION: deprecated in Nx 23, removed in Nx 24.
47
- // Warn once whenever it is present (even when the new var overrides it) so users
48
- // migrate off it and clean up configs where it lingers - a dormant value would
49
- // silently re-activate if the new var were later removed.
50
- function warnIfLegacyRegistryEnvVarSet() {
51
- if (legacyRegistryEnvVarDeprecationWarned ||
52
- process.env.NX_MIGRATE_SKIP_REGISTRY_FETCH === undefined) {
53
- return;
54
- }
55
- legacyRegistryEnvVarDeprecationWarned = true;
56
- const bodyLines = [
57
- 'Use NX_MIGRATE_USE_REGISTRY_RESOLUTION (or migrate.useRegistryResolution in nx.json) instead, then remove NX_MIGRATE_SKIP_REGISTRY_FETCH from your environment.',
58
- ];
59
- if (process.env.NX_MIGRATE_USE_REGISTRY_RESOLUTION !== undefined) {
60
- bodyLines.push('It is currently being overridden by NX_MIGRATE_USE_REGISTRY_RESOLUTION.');
61
- }
62
- output_1.output.warn({
63
- title: 'NX_MIGRATE_SKIP_REGISTRY_FETCH is deprecated and will be removed in Nx 24.',
64
- bodyLines,
65
- });
66
- }
67
37
  // The cooldown policy is constant for a migrate run; read it once.
68
38
  let cachedPolicyPromise;
69
39
  // Dedup the "resolved X instead of Y" notice across repeated specs.
70
40
  const reportedChangedOutcomes = new Set();
71
41
  // Strict-mode approval is a once-per-run decision (mirrors pnpm prompting once).
72
42
  let strictApprovalGranted = false;
73
- // The deprecated NX_MIGRATE_SKIP_REGISTRY_FETCH heads-up is shown once per run.
74
- let legacyRegistryEnvVarDeprecationWarned = false;
75
43
  /** Test-only: clear the module-level caches between cases. */
76
44
  function resetResolvePackageVersionState() {
77
45
  cachedPolicyPromise = undefined;
78
46
  reportedChangedOutcomes.clear();
79
47
  strictApprovalGranted = false;
80
- legacyRegistryEnvVarDeprecationWarned = false;
81
48
  }
82
49
  function getPolicy() {
83
50
  cachedPolicyPromise ??= (0, policy_1.readMinReleaseAgePolicy)();
@@ -16,6 +16,8 @@ export interface AgentMessage {
16
16
  export declare function safeLines(lines: readonly string[]): string[];
17
17
  export declare function logToAgent(message: AgentMessage): void;
18
18
  export declare function warnToAgent(message: AgentMessage): void;
19
+ export declare function errorToAgent(message: AgentMessage): void;
20
+ export declare function logLineToAgent(line: string): void;
19
21
  export declare function emitStepBlock(runId: string, stepId: string, action: string, payload: object): void;
20
22
  export declare function emitPromptBlock(migrationId: string, payload: object): void;
21
23
  export declare function emitStepPromptBlock(stepId: string, payload: object): void;
@@ -13,10 +13,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
13
13
  exports.safeLines = safeLines;
14
14
  exports.logToAgent = logToAgent;
15
15
  exports.warnToAgent = warnToAgent;
16
+ exports.errorToAgent = errorToAgent;
17
+ exports.logLineToAgent = logLineToAgent;
16
18
  exports.emitStepBlock = emitStepBlock;
17
19
  exports.emitPromptBlock = emitPromptBlock;
18
20
  exports.emitStepPromptBlock = emitStepPromptBlock;
19
21
  exports.emitRunbookBlock = emitRunbookBlock;
22
+ const logger_1 = require("../../../utils/logger");
20
23
  const output_1 = require("../../../utils/output");
21
24
  const print_dropped_agent_context_1 = require("../agentic/print-dropped-agent-context");
22
25
  const text_1 = require("../text");
@@ -40,6 +43,12 @@ function logToAgent(message) {
40
43
  function warnToAgent(message) {
41
44
  output_1.output.warn(safe(message));
42
45
  }
46
+ function errorToAgent(message) {
47
+ output_1.output.error(safe(message));
48
+ }
49
+ function logLineToAgent(line) {
50
+ logger_1.logger.info((0, text_1.singleLine)(line));
51
+ }
43
52
  /**
44
53
  * Serializes a block payload. `<` becomes its JSON unicode escape so a raw one
45
54
  * in a value cannot forge the closing tag, and the result stays valid JSON for
@@ -91,8 +91,8 @@ export declare function acquireTreeOperation(dir: string, request: TreeOperation
91
91
  export declare function releaseTreeOperation(dir: string, owner: string, markedStepId?: string): void;
92
92
  /** The reservation a live process other than `owner` holds, if any. */
93
93
  export declare function liveTreeOperation(state: MigrateRunState, owner?: string): MigrateTreeOperation | undefined;
94
- export declare function treeBusyMessage(held: MigrateTreeOperation): string;
95
- export declare function treeOperationLabel(held: Pick<MigrateTreeOperation, 'kind' | 'stepId'>): string;
94
+ export declare function treeBusyMessage(held: MigrateTreeOperation, stepName?: string): string;
95
+ export declare function treeOperationLabel(held: Pick<MigrateTreeOperation, 'kind' | 'stepId'>, stepName?: string): string;
96
96
  export declare function brokerDir(runDirPath: string): string;
97
97
  /**
98
98
  * Runs the step's install and commit where they can land: in this process
@@ -119,6 +119,15 @@ export declare function resetStepTree(dir: string, step: MigrateStep, resetInPro
119
119
  * reservation it runs with, so the caller writes no transition of its own.
120
120
  */
121
121
  export declare function giveUpStepTree(root: string, dir: string, step: MigrateStep, skipInstall: boolean, reconcileCommand: string, scope: TreeScope): Promise<GiveUpOutcome>;
122
+ export declare const COMMIT_INSTALLS_FIRST = "A commit first installs any dependency changes.";
123
+ export declare function commitsStep(kind: MigrateTreeOperation['kind']): boolean;
124
+ export declare function sessionOperationWayOut(operation: string): string;
125
+ export declare function formatElapsed(ms: number): string;
126
+ export interface InFlightOperation {
127
+ request: BrokerRequest;
128
+ startedAt: number;
129
+ stepName: string;
130
+ }
122
131
  /**
123
132
  * The parent side. Holds one exclusive lock for the session's lifetime so a
124
133
  * waiting step can tell a slow parent from a dead one, answers each request
@@ -138,13 +147,13 @@ export declare class MigrateCommitBroker {
138
147
  private inFlight;
139
148
  private readonly lock;
140
149
  constructor(root: string, dir: string, reconcileCommand: string, policy: MigrateRunPolicy);
141
- /** The request whose operation this process is running right now. */
142
- get requestInFlight(): BrokerRequest | null;
150
+ /** The request whose operation this process is running right now, and since when. */
151
+ get requestInFlight(): InFlightOperation | null;
143
152
  /** Answers this session's unanswered requests, one at a time. */
144
153
  service(): Promise<void>;
145
154
  private record;
146
155
  private answer;
147
- /** Releases the lock; call after the last `service` settled. */
156
+ /** Releases the lock; call after the last `service` settled, or once giving up on it. */
148
157
  close(): void;
149
158
  private notADirectory;
150
159
  }
@@ -8,7 +8,7 @@
8
8
  // every file the parent could consult is writable from the sandbox, so the
9
9
  // parent's own invocation decides what it installs and commits.
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.MigrateCommitBroker = exports.TreeBusyError = exports.BrokerUnavailableError = exports.BrokerStaleRequestError = exports.BROKER_ENV_VAR = void 0;
11
+ exports.MigrateCommitBroker = exports.COMMIT_INSTALLS_FIRST = exports.TreeBusyError = exports.BrokerUnavailableError = exports.BrokerStaleRequestError = exports.BROKER_ENV_VAR = void 0;
12
12
  exports.acquireTreeOperation = acquireTreeOperation;
13
13
  exports.releaseTreeOperation = releaseTreeOperation;
14
14
  exports.liveTreeOperation = liveTreeOperation;
@@ -19,16 +19,21 @@ exports.commitStepTree = commitStepTree;
19
19
  exports.installStepTree = installStepTree;
20
20
  exports.resetStepTree = resetStepTree;
21
21
  exports.giveUpStepTree = giveUpStepTree;
22
+ exports.commitsStep = commitsStep;
23
+ exports.sessionOperationWayOut = sessionOperationWayOut;
24
+ exports.formatElapsed = formatElapsed;
22
25
  const crypto_1 = require("crypto");
23
26
  const fs_1 = require("fs");
24
27
  const path_1 = require("path");
25
28
  const native_1 = require("../../../native");
26
29
  const fileutils_1 = require("../../../utils/fileutils");
27
30
  const json_1 = require("../../../utils/json");
31
+ const pretty_time_1 = require("../../../tasks-runner/life-cycles/pretty-time");
28
32
  const handoff_1 = require("../agentic/handoff");
29
33
  const deferred_output_1 = require("../deferred-output");
30
34
  const execute_migration_1 = require("../execute-migration");
31
35
  const migrate_commits_1 = require("../migrate-commits");
36
+ const agent_output_1 = require("./agent-output");
32
37
  const atomic_write_1 = require("./atomic-write");
33
38
  const give_up_1 = require("./give-up");
34
39
  const run_state_1 = require("./run-state");
@@ -40,6 +45,9 @@ const util_1 = require("./util");
40
45
  exports.BROKER_ENV_VAR = 'NX_MIGRATE_BROKER';
41
46
  const BROKER_DIR_NAME = 'broker';
42
47
  const CHILD_POLL_INTERVAL_MS = 250;
48
+ // The runbook's "Long-running commands" section states both intervals.
49
+ const FIRST_WAITING_LINE_MS = 15_000;
50
+ const WAITING_LINE_INTERVAL_MS = 60_000;
43
51
  /** The request no longer matches the step: another attempt owns it. */
44
52
  class BrokerStaleRequestError extends Error {
45
53
  }
@@ -74,7 +82,7 @@ function acquireTreeOperation(dir, request, owner = (0, crypto_1.randomBytes)(4)
74
82
  if (held)
75
83
  throw new TreeBusyError(treeBusyMessage(held));
76
84
  marks =
77
- (request.kind === 'commit' || request.kind === 'give-up') &&
85
+ commitsStep(request.kind) &&
78
86
  fresh.steps.find((s) => s.id === request.stepId)?.commitStarted !== true;
79
87
  return {
80
88
  ...(marks ? (0, state_machine_1.markCommitStarted)(fresh, request.stepId) : fresh),
@@ -113,22 +121,22 @@ function liveTreeOperation(state, owner) {
113
121
  return undefined;
114
122
  return held;
115
123
  }
116
- function treeBusyMessage(held) {
117
- return `The working tree is held by process ${held.pid} for ${treeOperationLabel(held)}; run the reconcile again once it finishes.`;
124
+ function treeBusyMessage(held, stepName) {
125
+ return `The working tree is held by process ${held.pid} for ${treeOperationLabel(held, stepName)}; run the reconcile again once it finishes.`;
118
126
  }
119
- function treeOperationLabel(held) {
127
+ function treeOperationLabel(held, stepName = `step '${held.stepId}'`) {
120
128
  switch (held.kind) {
121
129
  case 'checkpoint':
122
130
  return 'the checkpoint commit';
123
131
  case 'commit':
124
132
  case 'give-up':
125
- return `the commit of step '${held.stepId}'`;
133
+ return `the commit of ${stepName}`;
126
134
  case 'reset':
127
- return `the reset of step '${held.stepId}'`;
135
+ return `the reset of ${stepName}`;
128
136
  case 'install':
129
137
  case 'fold-install':
130
138
  case 'action-install':
131
- return `the install of step '${held.stepId}'`;
139
+ return `the install of ${stepName}`;
132
140
  default: {
133
141
  const exhaustive = held.kind;
134
142
  throw new Error(`Unhandled tree operation '${exhaustive}'.`);
@@ -204,7 +212,7 @@ async function commitStepTree(dir, step, absorbedStepIds, commitInProcess, scope
204
212
  lease.markedStepId = undefined;
205
213
  return { result, absorbedStepIds, recorded: false };
206
214
  }
207
- const answer = await ask(dir, nonce, request);
215
+ const answer = await ask(dir, nonce, request, (0, state_machine_1.stepLabel)(step));
208
216
  if (answer.kind !== 'commit') {
209
217
  throw new Error(`Unexpected '${answer.kind}' answer to a commit request.`);
210
218
  }
@@ -229,7 +237,7 @@ async function installStepTree(dir, step, seam, installInProcess, scope) {
229
237
  scope.lease = acquireTreeOperation(dir, request);
230
238
  return installInProcess();
231
239
  }
232
- const answer = await ask(dir, nonce, request);
240
+ const answer = await ask(dir, nonce, request, (0, state_machine_1.stepLabel)(step));
233
241
  if (answer.kind !== 'installed') {
234
242
  throw new Error(`Unexpected '${answer.kind}' answer to an install request.`);
235
243
  }
@@ -251,7 +259,7 @@ async function resetStepTree(dir, step, resetInProcess, scope) {
251
259
  scope.lease = acquireTreeOperation(dir, request);
252
260
  return resetInProcess();
253
261
  }
254
- const answer = await ask(dir, nonce, request);
262
+ const answer = await ask(dir, nonce, request, (0, state_machine_1.stepLabel)(step));
255
263
  if (answer.kind !== 'reset') {
256
264
  throw new Error(`Unexpected '${answer.kind}' answer to a reset request.`);
257
265
  }
@@ -280,13 +288,13 @@ async function giveUpStepTree(root, dir, step, skipInstall, reconcileCommand, sc
280
288
  reconcileCommand,
281
289
  });
282
290
  }
283
- const answer = await ask(dir, nonce, request);
291
+ const answer = await ask(dir, nonce, request, (0, state_machine_1.stepLabel)(step));
284
292
  if (answer.kind !== 'give-up') {
285
293
  throw new Error(`Unexpected '${answer.kind}' answer to a give-up request.`);
286
294
  }
287
295
  return answer.outcome;
288
296
  }
289
- async function ask(dir, nonce, request) {
297
+ async function ask(dir, nonce, request, stepName) {
290
298
  const id = `${nonce}-${request.stepId}-${request.attempt}-${request.kind}${request.invocation ? `-${request.invocation}` : ''}${request.commitAs !== undefined ? `-${request.commitAs}` : ''}`;
291
299
  const path = resultPath(dir, id);
292
300
  // A repeat reads the first answer, whatever became of the session since.
@@ -313,6 +321,8 @@ async function ask(dir, nonce, request) {
313
321
  catch (e) {
314
322
  throw notAccepting(e);
315
323
  }
324
+ const askedAt = Date.now();
325
+ let nextWaitingLineAt = askedAt + FIRST_WAITING_LINE_MS;
316
326
  for (;;) {
317
327
  if ((0, fs_1.existsSync)(path)) {
318
328
  return settle((0, fileutils_1.readJsonFile)(path));
@@ -323,9 +333,49 @@ async function ask(dir, nonce, request) {
323
333
  continue;
324
334
  throw new BrokerUnavailableError(`The nx migrate session that started this step ended before its request was answered. The install or the commit may still have landed; check the working tree and git log.`);
325
335
  }
336
+ if (Date.now() >= nextWaitingLineAt) {
337
+ nextWaitingLineAt = Date.now() + WAITING_LINE_INTERVAL_MS;
338
+ (0, agent_output_1.logLineToAgent)(waitingLine(request, stepName, Date.now() - askedAt));
339
+ }
326
340
  await new Promise((resolve) => setTimeout(resolve, CHILD_POLL_INTERVAL_MS));
327
341
  }
328
342
  }
343
+ function waitingLine(request, stepName, waitedMs) {
344
+ return [
345
+ `[nx] Waiting for the nx process that started this session to finish ${treeOperationLabel(request, stepName)} (${formatElapsed(waitedMs)} so far).`,
346
+ ...(commitsStep(request.kind)
347
+ ? [
348
+ exports.COMMIT_INSTALLS_FIRST,
349
+ 'A signing popup or a security key can also hold a commit until the user answers it.',
350
+ ]
351
+ : []),
352
+ `If it seems stuck, the user can ${sessionOperationWayOut('it')}.`,
353
+ ].join(' ');
354
+ }
355
+ exports.COMMIT_INSTALLS_FIRST = 'A commit first installs any dependency changes.';
356
+ function commitsStep(kind) {
357
+ switch (kind) {
358
+ case 'commit':
359
+ case 'give-up':
360
+ return true;
361
+ case 'checkpoint':
362
+ case 'install':
363
+ case 'fold-install':
364
+ case 'action-install':
365
+ case 'reset':
366
+ return false;
367
+ default: {
368
+ const exhaustive = kind;
369
+ throw new Error(`Unhandled tree operation '${exhaustive}'.`);
370
+ }
371
+ }
372
+ }
373
+ function sessionOperationWayOut(operation) {
374
+ return `quit this session, then press Ctrl+C in the terminal to end ${operation}, and resume the run afterwards`;
375
+ }
376
+ function formatElapsed(ms) {
377
+ return (0, pretty_time_1.prettyTime)(Math.max(0, Math.round(ms)) * 1e6, 's');
378
+ }
329
379
  function notAccepting(e) {
330
380
  return new BrokerUnavailableError(`The nx migrate session that started this step is not accepting its request (${e instanceof Error ? e.message : String(e)}).`);
331
381
  }
@@ -387,7 +437,7 @@ class MigrateCommitBroker {
387
437
  this.lock = native_1.IS_WASM ? null : new native_1.FileLock(lockPath(dir, this.nonce));
388
438
  this.lock?.lock();
389
439
  }
390
- /** The request whose operation this process is running right now. */
440
+ /** The request whose operation this process is running right now, and since when. */
391
441
  get requestInFlight() {
392
442
  return this.inFlight;
393
443
  }
@@ -423,8 +473,6 @@ class MigrateCommitBroker {
423
473
  this.handled.add(id);
424
474
  let result;
425
475
  try {
426
- if (lease)
427
- this.inFlight = request;
428
476
  result = lease ? await this.answer(request, lease) : { kind: 'stale' };
429
477
  // Recorded by the process that ran the commit, before the answer: the
430
478
  // step reading it can die with the commit already in history. A failed
@@ -466,13 +514,13 @@ class MigrateCommitBroker {
466
514
  const step = state.steps.find((s) => s.id === request.stepId);
467
515
  if (!Object.hasOwn(SEAM_STATUSES, request.kind) ||
468
516
  !isAtSeam(step, request) ||
469
- ((request.kind === 'commit' ||
470
- request.kind === 'reset' ||
471
- request.kind === 'give-up') &&
517
+ ((commitsStep(request.kind) || request.kind === 'reset') &&
472
518
  !this.policy.createCommits) ||
473
519
  (request.commitAs !== undefined && request.commitAs !== 'adopt')) {
474
520
  return { kind: 'stale' };
475
521
  }
522
+ const stepName = (0, state_machine_1.stepLabel)(step);
523
+ this.inFlight = { request, startedAt: Date.now(), stepName };
476
524
  if (request.kind === 'give-up') {
477
525
  const output = new deferred_output_1.DeferredOutputCollector();
478
526
  const outcome = await (0, give_up_1.giveUpWithCommit)({
@@ -514,7 +562,7 @@ class MigrateCommitBroker {
514
562
  return { kind: 'installed', output: output.render('drop') };
515
563
  }
516
564
  const absorbedStepIds = (0, state_machine_1.uncoveredFailedStepIds)(state).filter((id) => id !== step.id);
517
- const result = await (0, migrate_commits_1.commitMigrationIfRequested)(this.root, { name: (0, state_machine_1.commitNameForStep)(step) }, true, state.commitPrefix, install, (0, state_machine_1.stepsToPendingMigrations)(state, absorbedStepIds), undefined, output);
565
+ const result = await (0, migrate_commits_1.commitMigrationIfRequested)(this.root, { name: (0, state_machine_1.commitNameForStep)(step) }, true, state.commitPrefix, install, (0, state_machine_1.stepsToPendingMigrations)(state, absorbedStepIds), (0, util_1.commitFailureRecovery)(state), output);
518
566
  return {
519
567
  kind: 'commit',
520
568
  result,
@@ -540,7 +588,7 @@ class MigrateCommitBroker {
540
588
  };
541
589
  }
542
590
  }
543
- /** Releases the lock; call after the last `service` settled. */
591
+ /** Releases the lock; call after the last `service` settled, or once giving up on it. */
544
592
  close() {
545
593
  this.lock?.unlock();
546
594
  // A reservation this session still holds would only expire with its pid.
@@ -4,7 +4,7 @@ exports.canOfferCleanRetry = canOfferCleanRetry;
4
4
  exports.cleanRetryUnavailableReason = cleanRetryUnavailableReason;
5
5
  exports.resetForCleanRetry = resetForCleanRetry;
6
6
  const git_utils_1 = require("../../../utils/git-utils");
7
- const types_1 = require("../agentic/types");
7
+ const migrate_commits_1 = require("../migrate-commits");
8
8
  const agent_output_1 = require("./agent-output");
9
9
  const issues_1 = require("./issues");
10
10
  const state_lock_1 = require("./state-lock");
@@ -95,5 +95,7 @@ function resetForCleanRetry(root, dir, stepId) {
95
95
  return reopened.state;
96
96
  });
97
97
  archiveReopenedResolutions(dir, prepared, updates, (0, state_machine_1.stepLabel)(step));
98
- (0, git_utils_1.resetWorkingTree)(step.gitRefBefore, [types_1.MIGRATE_RUNS_RELATIVE_DIR], root);
98
+ // Unlike the commit exclusions, every owned path, committed or not: a failed
99
+ // probe must not let the reset remove the plan or prompt files.
100
+ (0, git_utils_1.resetWorkingTree)(step.gitRefBefore, migrate_commits_1.MIGRATE_OWNED_PATHS, root);
99
101
  }
@@ -41,7 +41,7 @@ export interface ExistingRunCommands {
41
41
  migrationsPath: string;
42
42
  };
43
43
  }
44
- export declare function renderExistingRunCommands(root: string, facts: ExistingRunFacts, migrationsPath: string | undefined, agentId?: string): ExistingRunCommands;
44
+ export declare function renderExistingRunCommands(root: string, facts: ExistingRunFacts, migrationsPath: string | undefined, agentic?: string | false): ExistingRunCommands;
45
45
  /**
46
46
  * Title plus body lines, in the shape the agent-output writers take. Every
47
47
  * body line goes through `singleLine`: branch names and timestamps came from
@@ -108,16 +108,18 @@ function otherActiveRuns(root, runId) {
108
108
  function renderContinueCommand(root, runId, policy, agentId) {
109
109
  return `${(0, util_1.pmExecPrefix)(root)} nx migrate --run-migrations --agentic${agentId === undefined ? '' : `=${agentId}`} --run-id=${runId} ${policy.createCommits ? '--create-commits' : '--no-create-commits'}${policy.skipInstall ? ' --skip-install' : ''}`;
110
110
  }
111
- function renderExistingRunCommands(root, facts, migrationsPath, agentId) {
111
+ // `agentic` echoes the invocation's choice into the start-fresh command; the
112
+ // continue command needs an agent, so it takes only an agent id.
113
+ function renderExistingRunCommands(root, facts, migrationsPath, agentic) {
112
114
  const flag = migrationsPath === undefined
113
115
  ? '--run-migrations'
114
116
  : (0, util_1.runMigrationsFlag)(migrationsPath);
115
117
  return {
116
- continueCommand: renderContinueCommand(root, facts.runId, facts.policy, agentId),
118
+ continueCommand: renderContinueCommand(root, facts.runId, facts.policy, agentic === false ? undefined : agentic),
117
119
  startFresh: flag === null
118
120
  ? { migrationsPath }
119
121
  : {
120
- command: `${(0, util_1.pmExecPrefix)(root)} nx migrate ${flag}${agentId === undefined ? '' : ` --agentic=${agentId}`} --start-fresh --run-id=${facts.runId}`,
122
+ command: `${(0, util_1.pmExecPrefix)(root)} nx migrate ${flag}${agentic === undefined ? '' : ` --agentic=${agentic}`} --start-fresh --run-id=${facts.runId}`,
121
123
  },
122
124
  };
123
125
  }
@@ -153,12 +155,12 @@ function renderExistingRunReport(facts, commands) {
153
155
  lines.push(` other active runs on disk: ${facts.otherActiveRuns.join(', ')}`);
154
156
  }
155
157
  if (facts.appliedStillPlanned !== undefined) {
156
- lines.push(` plan overlap: ${facts.appliedStillPlanned} of the applied migrations ${facts.appliedStillPlanned === 1 ? 'is' : 'are'} still in the plan; a new run applies ${facts.appliedStillPlanned === 1 ? 'it' : 'them'} again`);
158
+ lines.push(` plan overlap: ${facts.appliedStillPlanned} of the applied migrations ${facts.appliedStillPlanned === 1 ? 'is' : 'are'} still in the plan; running the plan applies ${facts.appliedStillPlanned === 1 ? 'it' : 'them'} again`);
157
159
  }
158
160
  if (commands) {
159
161
  lines.push(``, `To continue the run: ${commands.continueCommand}`, `To start fresh (deletes the run record, then runs the whole plan again): ${'command' in commands.startFresh
160
162
  ? commands.startFresh.command
161
- : `re-run this command with --start-fresh --run-id=${facts.runId}, keeping the --run-migrations argument, which names ${displayPath(commands.startFresh.migrationsPath)}; that path cannot be rendered as a command for this shell`}`, `Run either command with NX_MIGRATE_ORCHESTRATOR=true set in the environment.`);
163
+ : `re-run this command with --start-fresh --run-id=${facts.runId}, keeping the --run-migrations argument, which names ${displayPath(commands.startFresh.migrationsPath)}; that path cannot be rendered as a command for this shell`}`);
162
164
  }
163
165
  return {
164
166
  title: `A migrate run is already active: ${facts.runId}`,
@@ -1,4 +1,4 @@
1
- import { type CommitResult } from '../migrate-commits';
1
+ import { type CommitFailureRecovery, type CommitResult } from '../migrate-commits';
2
2
  import type { MigrateOutputSink } from '../deferred-output';
3
3
  import type { TreeLease } from './broker';
4
4
  import { type MigrateRunState, type MigrateStep } from './run-state';
@@ -25,7 +25,8 @@ export interface GiveUpInput {
25
25
  export declare function giveUpWithCommit(input: GiveUpInput): Promise<GiveUpOutcome>;
26
26
  /**
27
27
  * Mints the issue that carries a given-up step's failure and points the step
28
- * at it, on state where the step is already unresolved. The archive file is
28
+ * at it, on state where the step is already unresolved. A single run keeps no
29
+ * issue ledger, so its state comes back unchanged. The archive file is
29
30
  * best-effort: run.json is authoritative, and undoing the transition for a
30
31
  * lost detail file would make the agent re-issue an action the run already
31
32
  * took.
@@ -38,4 +39,4 @@ export declare function warnUnresolvedNotArchived(label: string, archiveError: s
38
39
  /** What the reconcile owes the agent for a give-up that went through. */
39
40
  export declare function warnAboutGiveUp(step: MigrateStep, outcome: Extract<GiveUpOutcome, {
40
41
  kind: 'given-up';
41
- }>): void;
42
+ }>, recovery: CommitFailureRecovery): void;
@@ -36,7 +36,7 @@ async function giveUpWithCommit(input) {
36
36
  let commit;
37
37
  let entry;
38
38
  try {
39
- const result = await (0, migrate_commits_1.commitMigrationIfRequested)(root, { name: (0, state_machine_1.unresolvedCommitName)(step) }, true, state.commitPrefix, () => (0, util_1.installDepsChangedSinceDispense)(root, dir, step, input.skipInstall, input.reconcileCommand, input.output), (0, state_machine_1.stepsToPendingMigrations)(state, absorbedStepIds), undefined, input.output);
39
+ const result = await (0, migrate_commits_1.commitMigrationIfRequested)(root, { name: (0, state_machine_1.unresolvedCommitName)(step) }, true, state.commitPrefix, () => (0, util_1.installDepsChangedSinceDispense)(root, dir, step, input.skipInstall, input.reconcileCommand, input.output), (0, state_machine_1.stepsToPendingMigrations)(state, absorbedStepIds), (0, util_1.commitFailureRecovery)(state), input.output);
40
40
  commit = result;
41
41
  entry = (0, state_machine_1.commitResultToLedgerEntry)(result, step.id, absorbedStepIds);
42
42
  }
@@ -91,12 +91,15 @@ async function giveUpWithCommit(input) {
91
91
  }
92
92
  /**
93
93
  * Mints the issue that carries a given-up step's failure and points the step
94
- * at it, on state where the step is already unresolved. The archive file is
94
+ * at it, on state where the step is already unresolved. A single run keeps no
95
+ * issue ledger, so its state comes back unchanged. The archive file is
95
96
  * best-effort: run.json is authoritative, and undoing the transition for a
96
97
  * lost detail file would make the agent re-issue an action the run already
97
98
  * took.
98
99
  */
99
100
  function recordUnresolvedIssue(dir, state, stepId) {
101
+ if (state.singleMigration === true)
102
+ return { state };
100
103
  // Minted from the transitioned step: a died one only gains its failure in
101
104
  // the transition.
102
105
  const minted = (0, issues_1.mintUnresolvedIssue)(state, state.steps.find((s) => s.id === stepId));
@@ -124,14 +127,14 @@ function warnUnresolvedNotArchived(label, archiveError) {
124
127
  });
125
128
  }
126
129
  /** What the reconcile owes the agent for a give-up that went through. */
127
- function warnAboutGiveUp(step, outcome) {
130
+ function warnAboutGiveUp(step, outcome, recovery) {
128
131
  const name = (0, state_machine_1.unresolvedCommitName)(step);
129
132
  switch (outcome.commit.status) {
130
133
  case 'install-failed':
131
- (0, util_1.warnCommitFailed)(name, outcome.commit.reason);
134
+ (0, util_1.warnCommitFailed)(name, recovery, outcome.commit.reason);
132
135
  break;
133
136
  case 'failed':
134
- (0, util_1.warnCommitFailed)(name);
137
+ (0, util_1.warnCommitFailed)(name, recovery);
135
138
  break;
136
139
  case 'committed':
137
140
  case 'no-changes':
@@ -1,12 +1,14 @@
1
- export { CURRENT_RUN_STATE_FORMAT_VERSION, NewerRunStateFormatError, migrateRunsDir, runDir, runHandoffsDir, readRunState, writeRunState, findActiveRun, createRun, } from './run-state';
2
- export type { MigrateRunStatus, MigrateRunRound, MigrateStepStatus, PromptOutcomeStatus, MigrateStepAwaitingKind, MigrateStepOutcome, MigrateStepPromptOutcome, MigrateStep, MigrateCommitKind, MigrateCommitLedgerEntry, MigrateIssueDisposition, MigrateRunIssue, MigrateRunAnalytics, MigrateRunNoProgress, MigrateRunPolicy, MigrateRunState, } from './run-state';
3
- export { applyStepEvent, completionSummaryLines, hasPendingCommitDebt, latestRound, runTallies, tallySteps, } from './state-machine';
1
+ export { CURRENT_RUN_STATE_FORMAT_VERSION, NewerRunStateFormatError, migrateRunsDir, runDir, runHandoffsDir, readRunState, writeRunState, findActiveRun, createRun, TERMINAL_STEP_STATUSES, migrationIdProblems, } from './run-state';
2
+ export type { MigrateRunStatus, MigrateRunRound, MigrateStepStatus, PromptOutcomeStatus, MigrateStepAwaitingKind, MigrateStepOutcome, MigrateStepPromptOutcome, MigrateStep, MigrateCommitKind, MigrateCommitLedgerEntry, MigrateIssueDisposition, MigrateRunIssue, MigrateRunAnalytics, MigrateRunNoProgress, MigrateRunPolicy, MigrateRunState, MigrationIdProblem, } from './run-state';
3
+ export { applyStepEvent, completionSummaryLines, hasPendingCommitDebt, latestRound, runTallies, stepLabel, tallySteps, } from './state-machine';
4
4
  export { hasUnresolvedIssues } from './issues';
5
5
  export type { StepAction, StepEvent, ApplyStepEventResult, } from './state-machine';
6
6
  export { createRunId } from './run-id';
7
+ export { isHeld } from './state-lock';
8
+ export { pmInstallCommand } from './util';
7
9
  export { runSingleMigrationWorker } from './worker';
8
10
  export type { RunSingleMigrationWorkerInput } from './worker';
9
- export { activeRunToReplace, completionWarnings, holdRunToContinue, releaseRunToHandOff, runOrchestratorInit, runOrchestratorReconcile, runOrchestratorResume, } from './orchestrator';
11
+ export { activeRunForClassic, activeRunToReplace, checkRunForStartFresh, checkRunsForSingleMigration, completionWarnings, deleteRunForStartFresh, holdRunToContinue, refuseNewRunAlongsideLiveRun, releaseRunToHandOff, runOrchestratorInit, runOrchestratorReconcile, runOrchestratorResume, } from './orchestrator';
10
12
  export type { OrchestratorInitResult, RunOrchestratorInitInput, RunOrchestratorReconcileInput, } from './orchestrator';
11
13
  export { renderContinueCommand, renderExistingRunCommands, renderExistingRunReport, } from './existing-run-report';
12
- export { BROKER_ENV_VAR, MigrateCommitBroker, treeOperationLabel, } from './broker';
14
+ export { BROKER_ENV_VAR, COMMIT_INSTALLS_FIRST, formatElapsed, MigrateCommitBroker, commitsStep, treeOperationLabel, } from './broker';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.treeOperationLabel = exports.MigrateCommitBroker = exports.BROKER_ENV_VAR = exports.renderExistingRunReport = exports.renderExistingRunCommands = exports.renderContinueCommand = exports.runOrchestratorResume = exports.runOrchestratorReconcile = exports.runOrchestratorInit = exports.releaseRunToHandOff = exports.holdRunToContinue = exports.completionWarnings = exports.activeRunToReplace = exports.runSingleMigrationWorker = exports.createRunId = exports.hasUnresolvedIssues = exports.tallySteps = exports.runTallies = exports.latestRound = exports.hasPendingCommitDebt = exports.completionSummaryLines = exports.applyStepEvent = exports.createRun = exports.findActiveRun = exports.writeRunState = exports.readRunState = exports.runHandoffsDir = exports.runDir = exports.migrateRunsDir = exports.NewerRunStateFormatError = exports.CURRENT_RUN_STATE_FORMAT_VERSION = void 0;
3
+ exports.treeOperationLabel = exports.commitsStep = exports.MigrateCommitBroker = exports.formatElapsed = exports.COMMIT_INSTALLS_FIRST = exports.BROKER_ENV_VAR = exports.renderExistingRunReport = exports.renderExistingRunCommands = exports.renderContinueCommand = exports.runOrchestratorResume = exports.runOrchestratorReconcile = exports.runOrchestratorInit = exports.releaseRunToHandOff = exports.refuseNewRunAlongsideLiveRun = exports.holdRunToContinue = exports.deleteRunForStartFresh = exports.completionWarnings = exports.checkRunsForSingleMigration = exports.checkRunForStartFresh = exports.activeRunToReplace = exports.activeRunForClassic = exports.runSingleMigrationWorker = exports.pmInstallCommand = exports.isHeld = exports.createRunId = exports.hasUnresolvedIssues = exports.tallySteps = exports.stepLabel = exports.runTallies = exports.latestRound = exports.hasPendingCommitDebt = exports.completionSummaryLines = exports.applyStepEvent = exports.migrationIdProblems = exports.TERMINAL_STEP_STATUSES = exports.createRun = exports.findActiveRun = exports.writeRunState = exports.readRunState = exports.runHandoffsDir = exports.runDir = exports.migrateRunsDir = exports.NewerRunStateFormatError = exports.CURRENT_RUN_STATE_FORMAT_VERSION = void 0;
4
4
  var run_state_1 = require("./run-state");
5
5
  Object.defineProperty(exports, "CURRENT_RUN_STATE_FORMAT_VERSION", { enumerable: true, get: function () { return run_state_1.CURRENT_RUN_STATE_FORMAT_VERSION; } });
6
6
  Object.defineProperty(exports, "NewerRunStateFormatError", { enumerable: true, get: function () { return run_state_1.NewerRunStateFormatError; } });
@@ -11,23 +11,35 @@ Object.defineProperty(exports, "readRunState", { enumerable: true, get: function
11
11
  Object.defineProperty(exports, "writeRunState", { enumerable: true, get: function () { return run_state_1.writeRunState; } });
12
12
  Object.defineProperty(exports, "findActiveRun", { enumerable: true, get: function () { return run_state_1.findActiveRun; } });
13
13
  Object.defineProperty(exports, "createRun", { enumerable: true, get: function () { return run_state_1.createRun; } });
14
+ Object.defineProperty(exports, "TERMINAL_STEP_STATUSES", { enumerable: true, get: function () { return run_state_1.TERMINAL_STEP_STATUSES; } });
15
+ Object.defineProperty(exports, "migrationIdProblems", { enumerable: true, get: function () { return run_state_1.migrationIdProblems; } });
14
16
  var state_machine_1 = require("./state-machine");
15
17
  Object.defineProperty(exports, "applyStepEvent", { enumerable: true, get: function () { return state_machine_1.applyStepEvent; } });
16
18
  Object.defineProperty(exports, "completionSummaryLines", { enumerable: true, get: function () { return state_machine_1.completionSummaryLines; } });
17
19
  Object.defineProperty(exports, "hasPendingCommitDebt", { enumerable: true, get: function () { return state_machine_1.hasPendingCommitDebt; } });
18
20
  Object.defineProperty(exports, "latestRound", { enumerable: true, get: function () { return state_machine_1.latestRound; } });
19
21
  Object.defineProperty(exports, "runTallies", { enumerable: true, get: function () { return state_machine_1.runTallies; } });
22
+ Object.defineProperty(exports, "stepLabel", { enumerable: true, get: function () { return state_machine_1.stepLabel; } });
20
23
  Object.defineProperty(exports, "tallySteps", { enumerable: true, get: function () { return state_machine_1.tallySteps; } });
21
24
  var issues_1 = require("./issues");
22
25
  Object.defineProperty(exports, "hasUnresolvedIssues", { enumerable: true, get: function () { return issues_1.hasUnresolvedIssues; } });
23
26
  var run_id_1 = require("./run-id");
24
27
  Object.defineProperty(exports, "createRunId", { enumerable: true, get: function () { return run_id_1.createRunId; } });
28
+ var state_lock_1 = require("./state-lock");
29
+ Object.defineProperty(exports, "isHeld", { enumerable: true, get: function () { return state_lock_1.isHeld; } });
30
+ var util_1 = require("./util");
31
+ Object.defineProperty(exports, "pmInstallCommand", { enumerable: true, get: function () { return util_1.pmInstallCommand; } });
25
32
  var worker_1 = require("./worker");
26
33
  Object.defineProperty(exports, "runSingleMigrationWorker", { enumerable: true, get: function () { return worker_1.runSingleMigrationWorker; } });
27
34
  var orchestrator_1 = require("./orchestrator");
35
+ Object.defineProperty(exports, "activeRunForClassic", { enumerable: true, get: function () { return orchestrator_1.activeRunForClassic; } });
28
36
  Object.defineProperty(exports, "activeRunToReplace", { enumerable: true, get: function () { return orchestrator_1.activeRunToReplace; } });
37
+ Object.defineProperty(exports, "checkRunForStartFresh", { enumerable: true, get: function () { return orchestrator_1.checkRunForStartFresh; } });
38
+ Object.defineProperty(exports, "checkRunsForSingleMigration", { enumerable: true, get: function () { return orchestrator_1.checkRunsForSingleMigration; } });
29
39
  Object.defineProperty(exports, "completionWarnings", { enumerable: true, get: function () { return orchestrator_1.completionWarnings; } });
40
+ Object.defineProperty(exports, "deleteRunForStartFresh", { enumerable: true, get: function () { return orchestrator_1.deleteRunForStartFresh; } });
30
41
  Object.defineProperty(exports, "holdRunToContinue", { enumerable: true, get: function () { return orchestrator_1.holdRunToContinue; } });
42
+ Object.defineProperty(exports, "refuseNewRunAlongsideLiveRun", { enumerable: true, get: function () { return orchestrator_1.refuseNewRunAlongsideLiveRun; } });
31
43
  Object.defineProperty(exports, "releaseRunToHandOff", { enumerable: true, get: function () { return orchestrator_1.releaseRunToHandOff; } });
32
44
  Object.defineProperty(exports, "runOrchestratorInit", { enumerable: true, get: function () { return orchestrator_1.runOrchestratorInit; } });
33
45
  Object.defineProperty(exports, "runOrchestratorReconcile", { enumerable: true, get: function () { return orchestrator_1.runOrchestratorReconcile; } });
@@ -38,5 +50,8 @@ Object.defineProperty(exports, "renderExistingRunCommands", { enumerable: true,
38
50
  Object.defineProperty(exports, "renderExistingRunReport", { enumerable: true, get: function () { return existing_run_report_1.renderExistingRunReport; } });
39
51
  var broker_1 = require("./broker");
40
52
  Object.defineProperty(exports, "BROKER_ENV_VAR", { enumerable: true, get: function () { return broker_1.BROKER_ENV_VAR; } });
53
+ Object.defineProperty(exports, "COMMIT_INSTALLS_FIRST", { enumerable: true, get: function () { return broker_1.COMMIT_INSTALLS_FIRST; } });
54
+ Object.defineProperty(exports, "formatElapsed", { enumerable: true, get: function () { return broker_1.formatElapsed; } });
41
55
  Object.defineProperty(exports, "MigrateCommitBroker", { enumerable: true, get: function () { return broker_1.MigrateCommitBroker; } });
56
+ Object.defineProperty(exports, "commitsStep", { enumerable: true, get: function () { return broker_1.commitsStep; } });
42
57
  Object.defineProperty(exports, "treeOperationLabel", { enumerable: true, get: function () { return broker_1.treeOperationLabel; } });
@@ -75,9 +75,14 @@ function quoted(value) {
75
75
  */
76
76
  function parseHandoffIssues(extras, state, reportingStep) {
77
77
  if (extras !== undefined) {
78
- const unknown = unknownKey(extras, ['outcome', 'issues', 'issueUpdates']);
78
+ // A single run keeps no issue ledger: nx prints its handoff summary when
79
+ // the run ends, and deletes the run's record.
80
+ const singleMigration = state.singleMigration === true;
81
+ const unknown = unknownKey(extras, singleMigration ? ['outcome'] : ['outcome', 'issues', 'issueUpdates']);
79
82
  if (unknown !== undefined) {
80
- return invalid(`the handoff has an unrecognized field ${quoted(unknown)}; the fields accepted next to "status" and "summary" are "outcome", "issues" and "issueUpdates"`);
83
+ return invalid(`the handoff has an unrecognized field ${quoted(unknown)}; ${singleMigration
84
+ ? `a --run-migration run accepts only "outcome" next to "status" and "summary", and its problems go in "summary"`
85
+ : `the fields accepted next to "status" and "summary" are "outcome", "issues" and "issueUpdates"`}`);
81
86
  }
82
87
  if (extras['outcome'] !== undefined && extras['outcome'] !== 'skipped') {
83
88
  return invalid(`the handoff has an unrecognized "outcome" value ${quoted(extras['outcome'])}; the only accepted value is "skipped"`);