@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.
Files changed (350) hide show
  1. package/README.md +7 -18
  2. package/changes.json +9 -53
  3. package/dist/bin/init-local.js +7 -1
  4. package/dist/nx-cloud-internals.d.ts +1 -0
  5. package/dist/nx-cloud-internals.js +9 -0
  6. package/dist/plugins/package-json.js +1 -1
  7. package/dist/src/command-line/add/add.js +5 -1
  8. package/dist/src/command-line/affected/affected.js +70 -9
  9. package/dist/src/command-line/affected/command-object.js +1 -1
  10. package/dist/src/command-line/format/format.js +2 -18
  11. package/dist/src/command-line/graph/graph.d.ts +31 -0
  12. package/dist/src/command-line/graph/graph.js +113 -20
  13. package/dist/src/command-line/init/implementation/add-nx-to-monorepo.js +0 -3
  14. package/dist/src/command-line/init/implementation/add-nx-to-nest.js +0 -3
  15. package/dist/src/command-line/init/implementation/add-nx-to-npm-repo.js +0 -3
  16. package/dist/src/command-line/init/implementation/angular/index.js +0 -3
  17. package/dist/src/command-line/init/implementation/angular/legacy-angular-versions.js +0 -3
  18. package/dist/src/command-line/init/implementation/format.js +2 -3
  19. package/dist/src/command-line/init/implementation/utils.d.ts +0 -1
  20. package/dist/src/command-line/init/implementation/utils.js +6 -9
  21. package/dist/src/command-line/init/init-v2.js +0 -3
  22. package/dist/src/command-line/migrate/agentic/capture-generator-output.d.ts +25 -0
  23. package/dist/src/command-line/migrate/agentic/capture-generator-output.js +121 -5
  24. package/dist/src/command-line/migrate/agentic/close-agent-session.d.ts +21 -0
  25. package/dist/src/command-line/migrate/agentic/close-agent-session.js +126 -0
  26. package/dist/src/command-line/migrate/agentic/definitions.d.ts +24 -0
  27. package/dist/src/command-line/migrate/agentic/definitions.js +79 -20
  28. package/dist/src/command-line/migrate/agentic/format-command.d.ts +14 -0
  29. package/dist/src/command-line/migrate/agentic/format-command.js +44 -0
  30. package/dist/src/command-line/migrate/agentic/handoff-gitignore.d.ts +3 -3
  31. package/dist/src/command-line/migrate/agentic/handoff-gitignore.js +3 -3
  32. package/dist/src/command-line/migrate/agentic/handoff.d.ts +50 -17
  33. package/dist/src/command-line/migrate/agentic/handoff.js +166 -24
  34. package/dist/src/command-line/migrate/agentic/instruction-files.d.ts +23 -0
  35. package/dist/src/command-line/migrate/agentic/instruction-files.js +41 -0
  36. package/dist/src/command-line/migrate/agentic/master/invocations.d.ts +12 -0
  37. package/dist/src/command-line/migrate/agentic/master/invocations.js +54 -0
  38. package/dist/src/command-line/migrate/agentic/master/run-master-session.d.ts +16 -0
  39. package/dist/src/command-line/migrate/agentic/master/run-master-session.js +175 -0
  40. package/dist/src/command-line/migrate/agentic/master/spawn-master.d.ts +31 -0
  41. package/dist/src/command-line/migrate/agentic/master/spawn-master.js +222 -0
  42. package/dist/src/command-line/migrate/agentic/prompts/final-validation.d.ts +13 -0
  43. package/dist/src/command-line/migrate/agentic/prompts/final-validation.js +41 -0
  44. package/dist/src/command-line/migrate/agentic/prompts/fragments.d.ts +17 -0
  45. package/dist/src/command-line/migrate/agentic/prompts/fragments.js +90 -0
  46. package/dist/src/command-line/migrate/agentic/prompts/generic-validation.js +4 -3
  47. package/dist/src/command-line/migrate/agentic/prompts/system-prompt.d.ts +25 -1
  48. package/dist/src/command-line/migrate/agentic/prompts/system-prompt.js +57 -34
  49. package/dist/src/command-line/migrate/agentic/run-step.js +28 -4
  50. package/dist/src/command-line/migrate/agentic/runner.d.ts +3 -15
  51. package/dist/src/command-line/migrate/agentic/runner.js +57 -239
  52. package/dist/src/command-line/migrate/agentic/terminal-repair.d.ts +1 -0
  53. package/dist/src/command-line/migrate/agentic/terminal-repair.js +27 -0
  54. package/dist/src/command-line/migrate/agentic/types.d.ts +23 -8
  55. package/dist/src/command-line/migrate/agentic/types.js +10 -7
  56. package/dist/src/command-line/migrate/agentic/windows-cmd.d.ts +33 -0
  57. package/dist/src/command-line/migrate/agentic/windows-cmd.js +88 -0
  58. package/dist/src/command-line/migrate/command-object.d.ts +2 -0
  59. package/dist/src/command-line/migrate/command-object.js +11 -1
  60. package/dist/src/command-line/migrate/deferred-output.d.ts +44 -0
  61. package/dist/src/command-line/migrate/deferred-output.js +92 -0
  62. package/dist/src/command-line/migrate/execute-migration.d.ts +9 -3
  63. package/dist/src/command-line/migrate/execute-migration.js +53 -16
  64. package/dist/src/command-line/migrate/migrate-analytics.d.ts +34 -9
  65. package/dist/src/command-line/migrate/migrate-analytics.js +71 -10
  66. package/dist/src/command-line/migrate/migrate-commits.d.ts +5 -4
  67. package/dist/src/command-line/migrate/migrate-commits.js +16 -6
  68. package/dist/src/command-line/migrate/migrate-config.d.ts +5 -2
  69. package/dist/src/command-line/migrate/migrate-config.js +19 -11
  70. package/dist/src/command-line/migrate/migrate-output.d.ts +3 -7
  71. package/dist/src/command-line/migrate/migrate-output.js +3 -7
  72. package/dist/src/command-line/migrate/migrate.d.ts +3 -0
  73. package/dist/src/command-line/migrate/migrate.js +183 -46
  74. package/dist/src/command-line/migrate/resolve-package-version.js +2 -19
  75. package/dist/src/command-line/migrate/run/agent-output.d.ts +11 -0
  76. package/dist/src/command-line/migrate/run/agent-output.js +21 -2
  77. package/dist/src/command-line/migrate/run/agent-work-payload.d.ts +37 -0
  78. package/dist/src/command-line/migrate/run/agent-work-payload.js +156 -0
  79. package/dist/src/command-line/migrate/run/atomic-write.d.ts +8 -0
  80. package/dist/src/command-line/migrate/run/atomic-write.js +17 -0
  81. package/dist/src/command-line/migrate/run/broker.d.ts +150 -0
  82. package/dist/src/command-line/migrate/run/broker.js +568 -0
  83. package/dist/src/command-line/migrate/run/clean-retry.d.ts +12 -0
  84. package/dist/src/command-line/migrate/run/clean-retry.js +99 -0
  85. package/dist/src/command-line/migrate/run/existing-run-report.d.ts +55 -0
  86. package/dist/src/command-line/migrate/run/existing-run-report.js +227 -0
  87. package/dist/src/command-line/migrate/run/give-up.d.ts +41 -0
  88. package/dist/src/command-line/migrate/run/give-up.js +148 -0
  89. package/dist/src/command-line/migrate/run/index.d.ts +9 -6
  90. package/dist/src/command-line/migrate/run/index.js +21 -2
  91. package/dist/src/command-line/migrate/run/issues.d.ts +127 -0
  92. package/dist/src/command-line/migrate/run/issues.js +1121 -0
  93. package/dist/src/command-line/migrate/run/orchestrator.d.ts +59 -1
  94. package/dist/src/command-line/migrate/run/orchestrator.js +1529 -457
  95. package/dist/src/command-line/migrate/run/run-id.d.ts +0 -8
  96. package/dist/src/command-line/migrate/run/run-id.js +0 -30
  97. package/dist/src/command-line/migrate/run/run-state.d.ts +77 -17
  98. package/dist/src/command-line/migrate/run/run-state.js +263 -32
  99. package/dist/src/command-line/migrate/run/runbook.d.ts +18 -0
  100. package/dist/src/command-line/migrate/run/runbook.js +118 -0
  101. package/dist/src/command-line/migrate/run/state-lock.d.ts +33 -2
  102. package/dist/src/command-line/migrate/run/state-lock.js +128 -2
  103. package/dist/src/command-line/migrate/run/state-machine.d.ts +50 -1
  104. package/dist/src/command-line/migrate/run/state-machine.js +339 -26
  105. package/dist/src/command-line/migrate/run/util.d.ts +3 -1
  106. package/dist/src/command-line/migrate/run/util.js +24 -3
  107. package/dist/src/command-line/migrate/run/worker.js +290 -129
  108. package/dist/src/command-line/migrate/step-actions.d.ts +1 -1
  109. package/dist/src/command-line/migrate/step-actions.js +7 -1
  110. package/dist/src/command-line/migrate/text.d.ts +6 -0
  111. package/dist/src/command-line/migrate/text.js +25 -0
  112. package/dist/src/command-line/migrate/version-skew-guard.js +2 -0
  113. package/dist/src/command-line/nx-cloud/connect/connect-to-nx-cloud.js +5 -11
  114. package/dist/src/command-line/release/publish.js +11 -8
  115. package/dist/src/command-line/release/utils/get-touched-projects-for-group.js +3 -3
  116. package/dist/src/command-line/release/utils/release-graph.js +1 -1
  117. package/dist/src/command-line/release/utils/remote-release-clients/github.js +5 -8
  118. package/dist/src/command-line/release/utils/remote-release-clients/gitlab.js +3 -3
  119. package/dist/src/command-line/release/utils/remote-release-clients/remote-release-client.d.ts +4 -2
  120. package/dist/src/command-line/release/utils/remote-release-clients/remote-release-client.js +37 -3
  121. package/dist/src/command-line/release/version/version-actions.d.ts +3 -0
  122. package/dist/src/command-line/reset/reset.js +10 -4
  123. package/dist/src/command-line/run/run-one.js +5 -1
  124. package/dist/src/command-line/run-many/run-many.js +6 -12
  125. package/dist/src/command-line/show/command-object.js +1 -1
  126. package/dist/src/command-line/show/projects.js +52 -1
  127. package/dist/src/command-line/yargs-utils/shared-options.d.ts +5 -1
  128. package/dist/src/command-line/yargs-utils/shared-options.js +38 -4
  129. package/dist/src/config/task-graph.d.ts +1 -1
  130. package/dist/src/config/workspace-json-project-json.d.ts +23 -1
  131. package/dist/src/core/graph/main.js +1 -1
  132. package/dist/src/core/graph/runtime.js +1 -1
  133. package/dist/src/core/graph/styles.js +1 -1
  134. package/dist/src/daemon/client/client.d.ts +14 -8
  135. package/dist/src/daemon/client/client.js +41 -12
  136. package/dist/src/daemon/message-types/get-plugin-capabilities.d.ts +5 -0
  137. package/dist/src/daemon/message-types/get-plugin-capabilities.js +11 -0
  138. package/dist/src/daemon/message-types/run-tasks-execution-hooks.d.ts +3 -2
  139. package/dist/src/daemon/message-types/select-affected-tasks.d.ts +21 -0
  140. package/dist/src/daemon/message-types/select-affected-tasks.js +11 -0
  141. package/dist/src/daemon/message-types/ultracache-configuration-version.d.ts +8 -0
  142. package/dist/src/daemon/message-types/ultracache-configuration-version.js +2 -0
  143. package/dist/src/daemon/server/dotenv-graph-changes.d.ts +1 -1
  144. package/dist/src/daemon/server/dotenv-graph-changes.js +2 -2
  145. package/dist/src/daemon/server/handle-get-plugin-capabilities.d.ts +2 -0
  146. package/dist/src/daemon/server/handle-get-plugin-capabilities.js +13 -0
  147. package/dist/src/daemon/server/handle-hash-tasks.d.ts +10 -2
  148. package/dist/src/daemon/server/handle-hash-tasks.js +18 -3
  149. package/dist/src/daemon/server/handle-select-affected-tasks.d.ts +3 -0
  150. package/dist/src/daemon/server/handle-select-affected-tasks.js +26 -0
  151. package/dist/src/daemon/server/handle-tasks-execution-hooks.d.ts +3 -2
  152. package/dist/src/daemon/server/{handle-outputs-changes.d.ts → handle-watch-events.d.ts} +4 -4
  153. package/dist/src/daemon/server/{handle-outputs-changes.js → handle-watch-events.js} +36 -37
  154. package/dist/src/daemon/server/outputs-tracking.d.ts +7 -19
  155. package/dist/src/daemon/server/outputs-tracking.js +7 -107
  156. package/dist/src/daemon/server/planning-context.d.ts +8 -0
  157. package/dist/src/daemon/server/planning-context.js +18 -0
  158. package/dist/src/daemon/server/project-graph-incremental-recomputation.d.ts +22 -7
  159. package/dist/src/daemon/server/project-graph-incremental-recomputation.js +104 -74
  160. package/dist/src/daemon/server/restart-checks.d.ts +22 -0
  161. package/dist/src/daemon/server/restart-checks.js +77 -0
  162. package/dist/src/daemon/server/server.d.ts +1 -0
  163. package/dist/src/daemon/server/server.js +54 -30
  164. package/dist/src/daemon/server/shutdown-utils.d.ts +0 -5
  165. package/dist/src/daemon/server/shutdown-utils.js +3 -26
  166. package/dist/src/daemon/server/ultracache-configuration-state.d.ts +7 -0
  167. package/dist/src/daemon/server/ultracache-configuration-state.js +36 -0
  168. package/dist/src/devkit-internals.d.ts +3 -1
  169. package/dist/src/devkit-internals.js +8 -3
  170. package/dist/src/executors/run-commands/run-commands.impl.d.ts +2 -1
  171. package/dist/src/executors/run-commands/run-commands.impl.js +19 -5
  172. package/dist/src/executors/run-commands/running-tasks.d.ts +5 -4
  173. package/dist/src/executors/run-commands/running-tasks.js +13 -13
  174. package/dist/src/hasher/create-task-hasher.d.ts +8 -1
  175. package/dist/src/hasher/create-task-hasher.js +13 -3
  176. package/dist/src/hasher/hash-plan-inspector.js +2 -2
  177. package/dist/src/hasher/hash-task.d.ts +2 -2
  178. package/dist/src/hasher/hash-task.js +28 -17
  179. package/dist/src/hasher/native-task-hasher-impl.d.ts +20 -4
  180. package/dist/src/hasher/native-task-hasher-impl.js +75 -9
  181. package/dist/src/hasher/task-hasher.d.ts +24 -7
  182. package/dist/src/hasher/task-hasher.js +27 -8
  183. package/dist/src/hasher/task-planning-context.d.ts +13 -0
  184. package/dist/src/hasher/task-planning-context.js +12 -0
  185. package/dist/src/native/index.d.ts +582 -21
  186. package/dist/src/native/index.js +3 -3
  187. package/dist/src/native/native-bindings.js +13 -1
  188. package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
  189. package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
  190. package/dist/src/native/transform-objects.d.ts +11 -2
  191. package/dist/src/native/transform-objects.js +46 -0
  192. package/dist/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +15 -8
  193. package/dist/src/nx-cloud/update-manager.d.ts +3 -0
  194. package/dist/src/nx-cloud/update-manager.js +19 -13
  195. package/dist/src/nx-cloud/utilities/client.d.ts +1 -1
  196. package/dist/src/nx-cloud/utilities/client.js +1 -1
  197. package/dist/src/nx-cloud/utilities/is-workspace-claimed.js +2 -1
  198. package/dist/src/nx-cloud/utilities/nx-cloud-http-client.d.ts +5 -0
  199. package/dist/src/nx-cloud/utilities/nx-cloud-http-client.js +16 -0
  200. package/dist/src/nx-cloud/utilities/url-shorten.js +17 -10
  201. package/dist/src/plugins/js/index.js +45 -64
  202. package/dist/src/plugins/js/lock-file/lock-file.d.ts +4 -4
  203. package/dist/src/plugins/js/lock-file/lock-file.js +6 -7
  204. package/dist/src/plugins/js/lock-file/pnpm-parser.js +1 -1
  205. package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.d.ts +2 -0
  206. package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.js +22 -0
  207. package/dist/src/plugins/js/project-graph/affected/lock-file-changes.d.ts +10 -2
  208. package/dist/src/plugins/js/project-graph/affected/lock-file-changes.js +51 -29
  209. package/dist/src/plugins/js/project-graph/affected/npm-packages.d.ts +10 -2
  210. package/dist/src/plugins/js/project-graph/affected/npm-packages.js +32 -11
  211. package/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +22 -18
  212. package/dist/src/plugins/js/utils/register.js +13 -4
  213. package/dist/src/plugins/package-json/create-nodes.d.ts +2 -2
  214. package/dist/src/plugins/package-json/create-nodes.js +13 -13
  215. package/dist/src/project-graph/affected/affected-project-graph-models.d.ts +14 -0
  216. package/dist/src/project-graph/affected/affected-project-graph.js +5 -18
  217. package/dist/src/project-graph/affected/affected-projects.d.ts +7 -0
  218. package/dist/src/project-graph/affected/affected-projects.js +42 -0
  219. package/dist/src/project-graph/affected/affected-reasons.d.ts +116 -0
  220. package/dist/src/project-graph/affected/affected-reasons.js +459 -0
  221. package/dist/src/project-graph/affected/affected-tasks.d.ts +103 -0
  222. package/dist/src/project-graph/affected/affected-tasks.js +386 -0
  223. package/dist/src/project-graph/affected/print-explanation.d.ts +11 -0
  224. package/dist/src/project-graph/affected/print-explanation.js +44 -0
  225. package/dist/src/project-graph/error-types.d.ts +5 -0
  226. package/dist/src/project-graph/error-types.js +44 -5
  227. package/dist/src/project-graph/file-utils.d.ts +2 -0
  228. package/dist/src/project-graph/file-utils.js +12 -3
  229. package/dist/src/project-graph/nx-deps-cache.d.ts +5 -2
  230. package/dist/src/project-graph/nx-deps-cache.js +4 -4
  231. package/dist/src/project-graph/plugins/get-plugins.d.ts +3 -1
  232. package/dist/src/project-graph/plugins/get-plugins.js +60 -82
  233. package/dist/src/project-graph/plugins/in-process-loader.d.ts +1 -1
  234. package/dist/src/project-graph/plugins/in-process-loader.js +1 -4
  235. package/dist/src/project-graph/plugins/isolation/index.d.ts +1 -1
  236. package/dist/src/project-graph/plugins/isolation/index.js +3 -1
  237. package/dist/src/project-graph/plugins/isolation/isolated-plugin.d.ts +8 -0
  238. package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +42 -6
  239. package/dist/src/project-graph/plugins/isolation/load-isolated-plugin.d.ts +10 -1
  240. package/dist/src/project-graph/plugins/isolation/load-isolated-plugin.js +67 -17
  241. package/dist/src/project-graph/plugins/isolation/messaging.d.ts +3 -2
  242. package/dist/src/project-graph/plugins/isolation/plugin-worker.js +5 -1
  243. package/dist/src/project-graph/plugins/loaded-nx-plugin.d.ts +5 -2
  244. package/dist/src/project-graph/plugins/loaded-nx-plugin.js +14 -1
  245. package/dist/src/project-graph/plugins/nx-plugin-capabilities.d.ts +6 -0
  246. package/dist/src/project-graph/plugins/nx-plugin-capabilities.js +28 -0
  247. package/dist/src/project-graph/plugins/task-results-stub.d.ts +50 -0
  248. package/dist/src/project-graph/plugins/task-results-stub.js +111 -0
  249. package/dist/src/project-graph/plugins/tasks-execution-hooks.d.ts +3 -2
  250. package/dist/src/project-graph/plugins/tasks-execution-hooks.js +14 -1
  251. package/dist/src/project-graph/project-graph.js +43 -42
  252. package/dist/src/project-graph/utils/project-configuration/target-merging.js +67 -0
  253. package/dist/src/project-graph/utils/project-configuration/target-normalization.js +83 -0
  254. package/dist/src/project-graph/utils/project-configuration/utils.d.ts +1 -0
  255. package/dist/src/project-graph/utils/project-configuration/utils.js +1 -0
  256. package/dist/src/tasks-runner/batch/run-batch.js +15 -0
  257. package/dist/src/tasks-runner/cache.d.ts +37 -2
  258. package/dist/src/tasks-runner/cache.js +42 -1
  259. package/dist/src/tasks-runner/create-task-graph.d.ts +24 -1
  260. package/dist/src/tasks-runner/create-task-graph.js +57 -2
  261. package/dist/src/tasks-runner/default-tasks-runner.js +1 -1
  262. package/dist/src/tasks-runner/forked-process-task-runner.d.ts +1 -1
  263. package/dist/src/tasks-runner/forked-process-task-runner.js +11 -10
  264. package/dist/src/tasks-runner/init-tasks-runner.d.ts +7 -2
  265. package/dist/src/tasks-runner/init-tasks-runner.js +15 -7
  266. package/dist/src/tasks-runner/is-tui-enabled.js +4 -3
  267. package/dist/src/tasks-runner/life-cycle.d.ts +7 -0
  268. package/dist/src/tasks-runner/life-cycle.js +7 -0
  269. package/dist/src/tasks-runner/life-cycles/summary-terminal-output-life-cycle.d.ts +35 -0
  270. package/dist/src/tasks-runner/life-cycles/summary-terminal-output-life-cycle.js +146 -0
  271. package/dist/src/tasks-runner/prune-task-graph.d.ts +17 -0
  272. package/dist/src/tasks-runner/prune-task-graph.js +45 -0
  273. package/dist/src/tasks-runner/run-command.d.ts +41 -5
  274. package/dist/src/tasks-runner/run-command.js +98 -22
  275. package/dist/src/tasks-runner/running-tasks/batch-process.d.ts +93 -19
  276. package/dist/src/tasks-runner/running-tasks/batch-process.js +184 -88
  277. package/dist/src/tasks-runner/task-io-service.d.ts +11 -3
  278. package/dist/src/tasks-runner/task-io-service.js +14 -5
  279. package/dist/src/tasks-runner/task-orchestrator.d.ts +71 -4
  280. package/dist/src/tasks-runner/task-orchestrator.js +266 -66
  281. package/dist/src/tasks-runner/tasks-runner.d.ts +2 -0
  282. package/dist/src/tasks-runner/terminal-output-path.d.ts +11 -0
  283. package/dist/src/tasks-runner/terminal-output-path.js +18 -0
  284. package/dist/src/tasks-runner/utils.d.ts +5 -0
  285. package/dist/src/tasks-runner/utils.js +14 -2
  286. package/dist/src/ultracache/config.d.ts +21 -0
  287. package/dist/src/ultracache/config.js +29 -0
  288. package/dist/src/ultracache/fetch.d.ts +21 -0
  289. package/dist/src/ultracache/fetch.js +43 -0
  290. package/dist/src/ultracache/overrides.d.ts +17 -0
  291. package/dist/src/ultracache/overrides.js +61 -0
  292. package/dist/src/ultracache/report.d.ts +13 -0
  293. package/dist/src/ultracache/report.js +62 -0
  294. package/dist/src/ultracache/store.d.ts +41 -0
  295. package/dist/src/ultracache/store.js +158 -0
  296. package/dist/src/utils/ab-testing.d.ts +4 -1
  297. package/dist/src/utils/ab-testing.js +22 -19
  298. package/dist/src/utils/chunkify.d.ts +1 -7
  299. package/dist/src/utils/chunkify.js +2 -8
  300. package/dist/src/utils/command-line-utils.d.ts +20 -0
  301. package/dist/src/utils/command-line-utils.js +10 -3
  302. package/dist/src/utils/create-cli-options.d.ts +6 -0
  303. package/dist/src/utils/create-cli-options.js +29 -0
  304. package/dist/src/utils/db-connection.d.ts +2 -0
  305. package/dist/src/utils/db-connection.js +2 -0
  306. package/dist/src/utils/formatters/index.d.ts +6 -0
  307. package/dist/src/utils/formatters/index.js +5 -0
  308. package/dist/src/utils/formatters/prettier.d.ts +0 -8
  309. package/dist/src/utils/formatters/prettier.js +4 -26
  310. package/dist/src/utils/git-utils.d.ts +19 -0
  311. package/dist/src/utils/git-utils.js +97 -39
  312. package/dist/src/utils/handle-errors.js +5 -43
  313. package/dist/src/utils/http-client.d.ts +27 -0
  314. package/dist/src/utils/http-client.js +193 -0
  315. package/dist/src/utils/installed-nx-version.js +2 -48
  316. package/dist/src/utils/json-diff.d.ts +4 -2
  317. package/dist/src/utils/json-diff.js +6 -94
  318. package/dist/src/utils/min-release-age/packument.js +1 -1
  319. package/dist/src/utils/nx-cloud-utils.d.ts +2 -0
  320. package/dist/src/utils/nx-cloud-utils.js +6 -1
  321. package/dist/src/utils/output.d.ts +22 -3
  322. package/dist/src/utils/output.js +28 -5
  323. package/dist/src/utils/package-json.d.ts +25 -0
  324. package/dist/src/utils/package-json.js +49 -6
  325. package/dist/src/utils/package-manager.d.ts +6 -0
  326. package/dist/src/utils/package-manager.js +10 -0
  327. package/dist/src/utils/plugins/plugin-capabilities.js +7 -2
  328. package/dist/src/utils/project-graph-utils.d.ts +2 -0
  329. package/dist/src/utils/project-graph-utils.js +12 -0
  330. package/dist/src/utils/provenance.js +20 -4
  331. package/dist/src/utils/serialize-overrides-into-command-line.js +2 -4
  332. package/dist/src/utils/workspace-context.d.ts +51 -3
  333. package/dist/src/utils/workspace-context.js +174 -10
  334. package/package.json +36 -98
  335. package/schemas/nx-schema.json +38 -0
  336. package/schemas/project-schema.json +35 -0
  337. package/dist/src/daemon/server/file-watching/route-workspace-changes.d.ts +0 -9
  338. package/dist/src/daemon/server/file-watching/route-workspace-changes.js +0 -76
  339. package/dist/src/daemon/server/watcher.d.ts +0 -18
  340. package/dist/src/daemon/server/watcher.js +0 -126
  341. package/dist/src/nx-cloud/utilities/axios.d.ts +0 -4
  342. package/dist/src/nx-cloud/utilities/axios.js +0 -17
  343. package/dist/src/project-graph/affected/locators/project-glob-changes.d.ts +0 -2
  344. package/dist/src/project-graph/affected/locators/project-glob-changes.js +0 -47
  345. package/dist/src/project-graph/affected/locators/workspace-json-changes.d.ts +0 -4
  346. package/dist/src/project-graph/affected/locators/workspace-json-changes.js +0 -47
  347. package/dist/src/project-graph/affected/locators/workspace-projects.d.ts +0 -3
  348. package/dist/src/project-graph/affected/locators/workspace-projects.js +0 -74
  349. package/dist/src/utils/collapse-expanded-outputs.d.ts +0 -10
  350. package/dist/src/utils/collapse-expanded-outputs.js +0 -72
@@ -0,0 +1,37 @@
1
+ import type { MigrateStepAwaitingKind } from './run-state';
2
+ export declare function agentWorkPayloadPath(runDirPath: string, stepId: string, attempt: number): string;
3
+ export interface ExpectedAgentWorkPayload {
4
+ migrationId: string;
5
+ kind: MigrateStepAwaitingKind;
6
+ promptPath?: string;
7
+ }
8
+ /**
9
+ * Failures propagate: the runbook promises a parked step's block is
10
+ * re-emitted, so a caller that cannot store the payload must fail the attempt
11
+ * rather than park.
12
+ */
13
+ export declare function persistAgentWorkPayload(filePath: string, payload: object): void;
14
+ /**
15
+ * The stored payload, or null when nothing usable is on disk: the file is
16
+ * missing (the park predates this mechanism), does not parse to a plain
17
+ * object, or does not match what the step awaits. Null is undifferentiated on
18
+ * purpose: every caller's remediation is the same freshly derived payload.
19
+ * The returned object is never re-emitted as text; both re-emission sites go
20
+ * back through the block writer's escaping, so a tampered file cannot break
21
+ * the framing.
22
+ */
23
+ export declare function readAgentWorkPayload(filePath: string, expected: ExpectedAgentWorkPayload): Record<string, unknown> | null;
24
+ /**
25
+ * Returns the newest payload from the current generator lineage, or null.
26
+ * `fromAttempt` excludes generator runs discarded by reset-backed retries; an
27
+ * absent boundary fails closed for states written by older Nx.
28
+ */
29
+ export declare function latestStoredAgentWorkPayload(runDirPath: string, stepId: string, beforeAttempt: number, fromAttempt: number | undefined, expected: ExpectedAgentWorkPayload): Record<string, unknown> | null;
30
+ /**
31
+ * Best effort per file: the callers run after the outcome or rearm is already
32
+ * decided, so an entry that cannot be removed (a permission failure, a
33
+ * directory planted at the path) is left to whole-run pruning rather than
34
+ * failing the reconcile. A planted directory is never re-handed either way:
35
+ * reading it fails, which the reader treats as no stored copy.
36
+ */
37
+ export declare function removeAgentWorkPayloads(runDirPath: string, stepId: string, throughAttempt: number): void;
@@ -0,0 +1,156 @@
1
+ "use strict";
2
+ // Internal to run/: deliberately not re-exported from ./index.
3
+ //
4
+ // Persists each parked payload by step and attempt, so a reconcile can re-emit
5
+ // it after a compaction or restart without reusing payloads from discarded
6
+ // attempts.
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.agentWorkPayloadPath = agentWorkPayloadPath;
9
+ exports.persistAgentWorkPayload = persistAgentWorkPayload;
10
+ exports.readAgentWorkPayload = readAgentWorkPayload;
11
+ exports.latestStoredAgentWorkPayload = latestStoredAgentWorkPayload;
12
+ exports.removeAgentWorkPayloads = removeAgentWorkPayloads;
13
+ const fs_1 = require("fs");
14
+ const path_1 = require("path");
15
+ const atomic_write_1 = require("./atomic-write");
16
+ const AGENT_WORK_DIR_NAME = 'agent-work';
17
+ // Both segments are Nx-issued (`step-<n>` and the attempt counter), so the
18
+ // name never carries untrusted path segments.
19
+ function agentWorkPayloadPath(runDirPath, stepId, attempt) {
20
+ return (0, path_1.join)(runDirPath, AGENT_WORK_DIR_NAME, `${stepId}-attempt-${attempt}.json`);
21
+ }
22
+ /**
23
+ * Failures propagate: the runbook promises a parked step's block is
24
+ * re-emitted, so a caller that cannot store the payload must fail the attempt
25
+ * rather than park.
26
+ */
27
+ function persistAgentWorkPayload(filePath, payload) {
28
+ (0, fs_1.mkdirSync)((0, path_1.dirname)(filePath), { recursive: true });
29
+ (0, atomic_write_1.publishFileAtomically)(filePath, (tmpPath) => (0, fs_1.writeFileSync)(tmpPath, JSON.stringify(payload, null, 2)));
30
+ }
31
+ /**
32
+ * The stored payload, or null when nothing usable is on disk: the file is
33
+ * missing (the park predates this mechanism), does not parse to a plain
34
+ * object, or does not match what the step awaits. Null is undifferentiated on
35
+ * purpose: every caller's remediation is the same freshly derived payload.
36
+ * The returned object is never re-emitted as text; both re-emission sites go
37
+ * back through the block writer's escaping, so a tampered file cannot break
38
+ * the framing.
39
+ */
40
+ function readAgentWorkPayload(filePath, expected) {
41
+ let content;
42
+ try {
43
+ content = (0, fs_1.readFileSync)(filePath, 'utf-8');
44
+ }
45
+ catch {
46
+ return null;
47
+ }
48
+ let parsed;
49
+ try {
50
+ parsed = JSON.parse(content);
51
+ }
52
+ catch {
53
+ return null;
54
+ }
55
+ if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
56
+ return null;
57
+ }
58
+ const payload = parsed;
59
+ if (payload.migrationId !== expected.migrationId) {
60
+ return null;
61
+ }
62
+ let matchesKind;
63
+ switch (expected.kind) {
64
+ case 'generator-validation':
65
+ matchesKind = payload.kind === 'generator-validation';
66
+ break;
67
+ case 'migration-prompt':
68
+ matchesKind =
69
+ payload.kind === undefined &&
70
+ expected.promptPath !== undefined &&
71
+ payload.prompt === expected.promptPath;
72
+ break;
73
+ case 'final-validation':
74
+ // Derived from run state at every dispense; nothing is stored.
75
+ throw new Error('The final validation pass stores no agent-work payload.');
76
+ default: {
77
+ const exhaustive = expected.kind;
78
+ throw new Error(`Unhandled awaiting kind '${exhaustive}'.`);
79
+ }
80
+ }
81
+ return matchesKind ? payload : null;
82
+ }
83
+ /**
84
+ * Returns the newest payload from the current generator lineage, or null.
85
+ * `fromAttempt` excludes generator runs discarded by reset-backed retries; an
86
+ * absent boundary fails closed for states written by older Nx.
87
+ */
88
+ function latestStoredAgentWorkPayload(runDirPath, stepId, beforeAttempt, fromAttempt, expected) {
89
+ if (fromAttempt === undefined) {
90
+ return null;
91
+ }
92
+ // Enumerated from disk rather than counted down from `beforeAttempt`:
93
+ // attempts are persisted numbers, and a loop spanning their range would
94
+ // let a tampered-but-valid counter drive that many synchronous reads.
95
+ const candidates = storedAttemptsForStep(runDirPath, stepId)
96
+ .filter((attempt) => attempt >= fromAttempt && attempt < beforeAttempt)
97
+ .sort((a, b) => b - a);
98
+ for (const attempt of candidates) {
99
+ const payload = readAgentWorkPayload(agentWorkPayloadPath(runDirPath, stepId, attempt), expected);
100
+ if (payload) {
101
+ return payload;
102
+ }
103
+ }
104
+ return null;
105
+ }
106
+ // An unreadable directory reads as empty: the lookup falls back to a freshly
107
+ // derived payload, and removal is best effort. The `-attempt-` infix keeps
108
+ // `step-1` from matching `step-12`'s files.
109
+ function storedAttemptsForStep(runDirPath, stepId) {
110
+ let entries;
111
+ try {
112
+ entries = (0, fs_1.readdirSync)((0, path_1.join)(runDirPath, AGENT_WORK_DIR_NAME));
113
+ }
114
+ catch {
115
+ return [];
116
+ }
117
+ const prefix = `${stepId}-attempt-`;
118
+ const suffix = '.json';
119
+ const attempts = [];
120
+ for (const name of entries) {
121
+ if (!name.startsWith(prefix) || !name.endsWith(suffix)) {
122
+ continue;
123
+ }
124
+ const middle = name.slice(prefix.length, -suffix.length);
125
+ if (!/^[1-9]\d*$/.test(middle)) {
126
+ continue;
127
+ }
128
+ const attempt = Number(middle);
129
+ if (Number.isSafeInteger(attempt)) {
130
+ attempts.push(attempt);
131
+ }
132
+ }
133
+ return attempts;
134
+ }
135
+ /**
136
+ * Best effort per file: the callers run after the outcome or rearm is already
137
+ * decided, so an entry that cannot be removed (a permission failure, a
138
+ * directory planted at the path) is left to whole-run pruning rather than
139
+ * failing the reconcile. A planted directory is never re-handed either way:
140
+ * reading it fails, which the reader treats as no stored copy.
141
+ */
142
+ function removeAgentWorkPayloads(runDirPath, stepId, throughAttempt) {
143
+ // Enumerated for the same reason as the lookup: a tampered-but-valid attempt
144
+ // would otherwise drive that many synchronous removals.
145
+ for (const attempt of storedAttemptsForStep(runDirPath, stepId)) {
146
+ if (attempt > throughAttempt) {
147
+ continue;
148
+ }
149
+ try {
150
+ (0, fs_1.rmSync)(agentWorkPayloadPath(runDirPath, stepId, attempt), {
151
+ force: true,
152
+ });
153
+ }
154
+ catch { }
155
+ }
156
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Runs `write` against a unique sibling temp path, then renames it over
3
+ * `filePath`: a crash mid-write can only leave a stale temp file, never a
4
+ * half-written artifact, and rename replaces whatever sits at the destination
5
+ * without following it. The random suffix keeps concurrent writers apart; a
6
+ * pid would collide across PID namespaces sharing the workspace.
7
+ */
8
+ export declare function publishFileAtomically(filePath: string, write: (tmpPath: string) => void): void;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.publishFileAtomically = publishFileAtomically;
4
+ const crypto_1 = require("crypto");
5
+ const fs_1 = require("fs");
6
+ /**
7
+ * Runs `write` against a unique sibling temp path, then renames it over
8
+ * `filePath`: a crash mid-write can only leave a stale temp file, never a
9
+ * half-written artifact, and rename replaces whatever sits at the destination
10
+ * without following it. The random suffix keeps concurrent writers apart; a
11
+ * pid would collide across PID namespaces sharing the workspace.
12
+ */
13
+ function publishFileAtomically(filePath, write) {
14
+ const tmpPath = `${filePath}~${(0, crypto_1.randomBytes)(4).toString('hex')}`;
15
+ write(tmpPath);
16
+ (0, fs_1.renameSync)(tmpPath, filePath);
17
+ }
@@ -0,0 +1,150 @@
1
+ import { type DeferredOutputRecord } from '../deferred-output';
2
+ import { type CommitResult } from '../migrate-commits';
3
+ import { type GiveUpOutcome } from './give-up';
4
+ import { type MigrateRunPolicy, type MigrateRunState, type MigrateStep, type MigrateTreeOperation } from './run-state';
5
+ export declare const BROKER_ENV_VAR = "NX_MIGRATE_BROKER";
6
+ export type BrokerRequestKind = 'commit' | 'install' | 'fold-install' | 'action-install' | 'reset' | 'give-up';
7
+ export type InstallSeam = 'install' | 'fold-install' | 'action-install';
8
+ export interface BrokerRequest {
9
+ kind: BrokerRequestKind;
10
+ stepId: string;
11
+ attempt: number;
12
+ invocation?: string;
13
+ commitAs?: 'adopt';
14
+ }
15
+ export type BrokerResult = {
16
+ kind: 'commit';
17
+ result: CommitResult;
18
+ absorbedStepIds: string[];
19
+ output: DeferredOutputRecord[];
20
+ } | {
21
+ kind: 'installed';
22
+ output: DeferredOutputRecord[];
23
+ } | {
24
+ kind: 'install-failed';
25
+ message: string;
26
+ peerDeps: boolean;
27
+ output: DeferredOutputRecord[];
28
+ } | {
29
+ kind: 'reset';
30
+ error?: string;
31
+ } | {
32
+ kind: 'give-up';
33
+ outcome: GiveUpOutcome;
34
+ output: DeferredOutputRecord[];
35
+ } | {
36
+ kind: 'stale';
37
+ };
38
+ export interface BrokeredCommit {
39
+ result: CommitResult;
40
+ absorbedStepIds: string[];
41
+ /**
42
+ * True when the session's parent ran the commit and recorded whatever it
43
+ * produced before answering, so the caller appends nothing. False for an
44
+ * in-process commit, which the caller records.
45
+ */
46
+ recorded: boolean;
47
+ }
48
+ /** The request no longer matches the step: another attempt owns it. */
49
+ export declare class BrokerStaleRequestError extends Error {
50
+ }
51
+ /**
52
+ * The advertised parent could not accept the request, or went away before
53
+ * answering it. It may have landed the install or the commit; the tree and
54
+ * the run state say.
55
+ */
56
+ export declare class BrokerUnavailableError extends Error {
57
+ }
58
+ /** Another live process holds the working tree for an operation of its own. */
59
+ export declare class TreeBusyError extends Error {
60
+ }
61
+ export interface TreeOperationRequest {
62
+ kind: BrokerRequestKind | 'checkpoint';
63
+ stepId?: string;
64
+ attempt?: number;
65
+ }
66
+ export interface TreeLease {
67
+ readonly owner: string;
68
+ markedStepId?: string;
69
+ release(): void;
70
+ }
71
+ /**
72
+ * Owned by the scope that runs an operation and its state write: a seam that
73
+ * acquires in process writes the lease here before its fallible callback
74
+ * runs, and the scope releases it in a `finally` once the write landed or
75
+ * failed. A brokered call leaves it empty; the parent holds its own.
76
+ */
77
+ export interface TreeScope {
78
+ lease?: TreeLease;
79
+ }
80
+ /**
81
+ * Reserves the working tree for one operation in a single fresh-state write:
82
+ * the request must still be at its seam (else the attempt moved on and the
83
+ * request is stale), and no other live process may hold a reservation.
84
+ * A reservation whose owner process is gone holds nothing.
85
+ */
86
+ export declare function acquireTreeOperation(dir: string, request: TreeOperationRequest, owner?: string): TreeLease;
87
+ /**
88
+ * Owner-checked: a lease released late never drops a newer reservation, nor
89
+ * the mark it set.
90
+ */
91
+ export declare function releaseTreeOperation(dir: string, owner: string, markedStepId?: string): void;
92
+ /** The reservation a live process other than `owner` holds, if any. */
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;
96
+ export declare function brokerDir(runDirPath: string): string;
97
+ /**
98
+ * Runs the step's install and commit where they can land: in this process
99
+ * unless a parent session advertised its broker, in which case the request
100
+ * goes to the parent and the answer comes back with the output the parent
101
+ * collected, printed here. The absorbed step ids come from whichever side
102
+ * ran the commit, so the ledger entry names what its `git add -A` took.
103
+ */
104
+ export declare function commitStepTree(dir: string, step: MigrateStep, absorbedStepIds: string[], commitInProcess: () => Promise<CommitResult>, scope: TreeScope, commitAs?: 'adopt'): Promise<BrokeredCommit>;
105
+ /**
106
+ * The same for a step that owes only its install: no commit is due, or the
107
+ * commit waits for a fold.
108
+ */
109
+ export declare function installStepTree(dir: string, step: MigrateStep, seam: InstallSeam, installInProcess: () => Promise<void>, scope: TreeScope): Promise<void>;
110
+ /**
111
+ * The same for the reset a clean retry of a failed or died step needs. Runs
112
+ * `resetInProcess` under the reservation, or asks the parent, which resets
113
+ * against the state it reads then; a reset that could not run throws.
114
+ */
115
+ export declare function resetStepTree(dir: string, step: MigrateStep, resetInProcess: () => void, scope: TreeScope): Promise<void>;
116
+ /**
117
+ * The same for giving a failed or died step up while the run commits. Unlike
118
+ * the seams above, the operation settles the step itself, under the
119
+ * reservation it runs with, so the caller writes no transition of its own.
120
+ */
121
+ export declare function giveUpStepTree(root: string, dir: string, step: MigrateStep, skipInstall: boolean, reconcileCommand: string, scope: TreeScope): Promise<GiveUpOutcome>;
122
+ /**
123
+ * The parent side. Holds one exclusive lock for the session's lifetime so a
124
+ * waiting step can tell a slow parent from a dead one, answers each request
125
+ * once, and removes its own requests on close; its answers stay for the steps
126
+ * still reading them. Requests carrying another session's nonce belong to
127
+ * that session and are never touched. Whether to install or commit comes from
128
+ * the policy the session started with, never from run state, which the
129
+ * agent's sandbox can write.
130
+ */
131
+ export declare class MigrateCommitBroker {
132
+ private readonly root;
133
+ private readonly dir;
134
+ private readonly reconcileCommand;
135
+ private readonly policy;
136
+ readonly nonce: string;
137
+ private readonly handled;
138
+ private inFlight;
139
+ private readonly lock;
140
+ 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;
143
+ /** Answers this session's unanswered requests, one at a time. */
144
+ service(): Promise<void>;
145
+ private record;
146
+ private answer;
147
+ /** Releases the lock; call after the last `service` settled. */
148
+ close(): void;
149
+ private notADirectory;
150
+ }