@ohos-ports/nx 23.2.0-beta.0 → 23.2.1-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 (1349) hide show
  1. package/README.md +13 -60
  2. package/local-natives.js +59 -0
  3. package/package.json +9 -534
  4. package/LICENSE +0 -22
  5. package/dist/bin/init-local.d.ts +0 -8
  6. package/dist/bin/init-local.js +0 -186
  7. package/dist/bin/nx-cloud.d.ts +0 -3
  8. package/dist/bin/nx-cloud.js +0 -47
  9. package/dist/bin/nx.d.ts +0 -3
  10. package/dist/bin/nx.js +0 -341
  11. package/dist/bin/post-install.d.ts +0 -1
  12. package/dist/bin/post-install.js +0 -52
  13. package/dist/bin/run-executor.d.ts +0 -1
  14. package/dist/bin/run-executor.js +0 -66
  15. package/dist/plugins/package-json.d.ts +0 -4
  16. package/dist/plugins/package-json.js +0 -40
  17. package/dist/presets/core.json +0 -1
  18. package/dist/presets/npm.json +0 -7
  19. package/dist/release/changelog-renderer/index.d.ts +0 -110
  20. package/dist/release/changelog-renderer/index.js +0 -381
  21. package/dist/release/index.d.ts +0 -4
  22. package/dist/release/index.js +0 -13
  23. package/dist/src/adapter/angular-json.d.ts +0 -10
  24. package/dist/src/adapter/angular-json.js +0 -129
  25. package/dist/src/adapter/compat.d.ts +0 -2
  26. package/dist/src/adapter/compat.js +0 -154
  27. package/dist/src/adapter/ngcli-adapter.d.ts +0 -105
  28. package/dist/src/adapter/ngcli-adapter.js +0 -1083
  29. package/dist/src/adapter/rxjs-for-await.d.ts +0 -109
  30. package/dist/src/adapter/rxjs-for-await.js +0 -362
  31. package/dist/src/ai/clone-ai-config-repo.d.ts +0 -11
  32. package/dist/src/ai/clone-ai-config-repo.js +0 -155
  33. package/dist/src/ai/configure-ai-agents-disclaimer.d.ts +0 -5
  34. package/dist/src/ai/configure-ai-agents-disclaimer.js +0 -31
  35. package/dist/src/ai/constants.d.ts +0 -46
  36. package/dist/src/ai/constants.js +0 -92
  37. package/dist/src/ai/detect-ai-agent.d.ts +0 -2
  38. package/dist/src/ai/detect-ai-agent.js +0 -12
  39. package/dist/src/ai/set-up-ai-agents/get-agent-rules.d.ts +0 -5
  40. package/dist/src/ai/set-up-ai-agents/get-agent-rules.js +0 -26
  41. package/dist/src/ai/set-up-ai-agents/schema.d.ts +0 -11
  42. package/dist/src/ai/set-up-ai-agents/schema.json +0 -34
  43. package/dist/src/ai/set-up-ai-agents/set-up-ai-agents.d.ts +0 -10
  44. package/dist/src/ai/set-up-ai-agents/set-up-ai-agents.js +0 -578
  45. package/dist/src/ai/utils.d.ts +0 -33
  46. package/dist/src/ai/utils.js +0 -246
  47. package/dist/src/analytics/analytics.d.ts +0 -16
  48. package/dist/src/analytics/analytics.js +0 -246
  49. package/dist/src/analytics/index.d.ts +0 -1
  50. package/dist/src/analytics/index.js +0 -12
  51. package/dist/src/command-line/add/add.d.ts +0 -3
  52. package/dist/src/command-line/add/add.js +0 -138
  53. package/dist/src/command-line/add/command-object.d.ts +0 -8
  54. package/dist/src/command-line/add/command-object.js +0 -28
  55. package/dist/src/command-line/add/completion.d.ts +0 -1
  56. package/dist/src/command-line/add/completion.js +0 -15
  57. package/dist/src/command-line/affected/affected.d.ts +0 -10
  58. package/dist/src/command-line/affected/affected.js +0 -90
  59. package/dist/src/command-line/affected/command-object.d.ts +0 -6
  60. package/dist/src/command-line/affected/command-object.js +0 -83
  61. package/dist/src/command-line/affected/completion.d.ts +0 -1
  62. package/dist/src/command-line/affected/completion.js +0 -15
  63. package/dist/src/command-line/ai/ai-output.d.ts +0 -46
  64. package/dist/src/command-line/ai/ai-output.js +0 -86
  65. package/dist/src/command-line/completion/argv-layout.d.ts +0 -6
  66. package/dist/src/command-line/completion/argv-layout.js +0 -19
  67. package/dist/src/command-line/completion/command-completions.d.ts +0 -19
  68. package/dist/src/command-line/completion/command-completions.js +0 -120
  69. package/dist/src/command-line/completion/command-handlers.d.ts +0 -30
  70. package/dist/src/command-line/completion/command-handlers.js +0 -69
  71. package/dist/src/command-line/completion/command-object.d.ts +0 -10
  72. package/dist/src/command-line/completion/command-object.js +0 -102
  73. package/dist/src/command-line/completion/completion-providers.d.ts +0 -21
  74. package/dist/src/command-line/completion/completion-providers.js +0 -194
  75. package/dist/src/command-line/completion/infix-targets.d.ts +0 -1
  76. package/dist/src/command-line/completion/infix-targets.js +0 -48
  77. package/dist/src/command-line/completion/metadata.d.ts +0 -22
  78. package/dist/src/command-line/completion/metadata.js +0 -71
  79. package/dist/src/command-line/completion/registrations.d.ts +0 -9
  80. package/dist/src/command-line/completion/registrations.js +0 -16
  81. package/dist/src/command-line/completion/scripts/bash.sh +0 -51
  82. package/dist/src/command-line/completion/scripts/fish.fish +0 -47
  83. package/dist/src/command-line/completion/scripts/powershell.ps1 +0 -52
  84. package/dist/src/command-line/completion/scripts/zsh.zsh +0 -69
  85. package/dist/src/command-line/completion/scripts.d.ts +0 -18
  86. package/dist/src/command-line/completion/scripts.js +0 -140
  87. package/dist/src/command-line/completion/trigger.d.ts +0 -3
  88. package/dist/src/command-line/completion/trigger.js +0 -21
  89. package/dist/src/command-line/completion/value-completions.d.ts +0 -3
  90. package/dist/src/command-line/completion/value-completions.js +0 -21
  91. package/dist/src/command-line/configure-ai-agents/command-object.d.ts +0 -8
  92. package/dist/src/command-line/configure-ai-agents/command-object.js +0 -59
  93. package/dist/src/command-line/configure-ai-agents/configure-ai-agents.d.ts +0 -3
  94. package/dist/src/command-line/configure-ai-agents/configure-ai-agents.js +0 -436
  95. package/dist/src/command-line/daemon/command-object.d.ts +0 -3
  96. package/dist/src/command-line/daemon/command-object.js +0 -29
  97. package/dist/src/command-line/daemon/daemon.d.ts +0 -2
  98. package/dist/src/command-line/daemon/daemon.js +0 -31
  99. package/dist/src/command-line/deprecated/command-objects.d.ts +0 -9
  100. package/dist/src/command-line/deprecated/command-objects.js +0 -48
  101. package/dist/src/command-line/examples.d.ts +0 -12
  102. package/dist/src/command-line/examples.js +0 -403
  103. package/dist/src/command-line/exec/command-object.d.ts +0 -2
  104. package/dist/src/command-line/exec/command-object.js +0 -20
  105. package/dist/src/command-line/exec/exec.d.ts +0 -1
  106. package/dist/src/command-line/exec/exec.js +0 -143
  107. package/dist/src/command-line/format/command-object.d.ts +0 -3
  108. package/dist/src/command-line/format/command-object.js +0 -58
  109. package/dist/src/command-line/format/format.d.ts +0 -2
  110. package/dist/src/command-line/format/format.js +0 -216
  111. package/dist/src/command-line/generate/command-object.d.ts +0 -2
  112. package/dist/src/command-line/generate/command-object.js +0 -67
  113. package/dist/src/command-line/generate/completion.d.ts +0 -1
  114. package/dist/src/command-line/generate/completion.js +0 -9
  115. package/dist/src/command-line/generate/generate.d.ts +0 -21
  116. package/dist/src/command-line/generate/generate.js +0 -281
  117. package/dist/src/command-line/generate/generator-utils.d.ts +0 -18
  118. package/dist/src/command-line/generate/generator-utils.js +0 -91
  119. package/dist/src/command-line/graph/command-object.d.ts +0 -25
  120. package/dist/src/command-line/graph/command-object.js +0 -76
  121. package/dist/src/command-line/graph/completion.d.ts +0 -1
  122. package/dist/src/command-line/graph/completion.js +0 -13
  123. package/dist/src/command-line/graph/graph.d.ts +0 -70
  124. package/dist/src/command-line/graph/graph.js +0 -987
  125. package/dist/src/command-line/import/command-object.d.ts +0 -2
  126. package/dist/src/command-line/import/command-object.js +0 -63
  127. package/dist/src/command-line/import/import.d.ts +0 -26
  128. package/dist/src/command-line/import/import.js +0 -590
  129. package/dist/src/command-line/import/utils/ai-output.d.ts +0 -93
  130. package/dist/src/command-line/import/utils/ai-output.js +0 -209
  131. package/dist/src/command-line/import/utils/merge-remote-source.d.ts +0 -2
  132. package/dist/src/command-line/import/utils/merge-remote-source.js +0 -14
  133. package/dist/src/command-line/import/utils/prepare-source-repo.d.ts +0 -2
  134. package/dist/src/command-line/import/utils/prepare-source-repo.js +0 -27
  135. package/dist/src/command-line/index.d.ts +0 -22
  136. package/dist/src/command-line/index.js +0 -26
  137. package/dist/src/command-line/init/ai-agent-prompts.d.ts +0 -2
  138. package/dist/src/command-line/init/ai-agent-prompts.js +0 -30
  139. package/dist/src/command-line/init/command-object.d.ts +0 -2
  140. package/dist/src/command-line/init/command-object.js +0 -118
  141. package/dist/src/command-line/init/configure-plugins.d.ts +0 -34
  142. package/dist/src/command-line/init/configure-plugins.js +0 -214
  143. package/dist/src/command-line/init/implementation/add-nx-to-monorepo.d.ts +0 -6
  144. package/dist/src/command-line/init/implementation/add-nx-to-monorepo.js +0 -122
  145. package/dist/src/command-line/init/implementation/add-nx-to-nest.d.ts +0 -5
  146. package/dist/src/command-line/init/implementation/add-nx-to-nest.js +0 -353
  147. package/dist/src/command-line/init/implementation/add-nx-to-npm-repo.d.ts +0 -6
  148. package/dist/src/command-line/init/implementation/add-nx-to-npm-repo.js +0 -70
  149. package/dist/src/command-line/init/implementation/add-nx-to-turborepo.d.ts +0 -4
  150. package/dist/src/command-line/init/implementation/add-nx-to-turborepo.js +0 -37
  151. package/dist/src/command-line/init/implementation/angular/index.d.ts +0 -2
  152. package/dist/src/command-line/init/implementation/angular/index.js +0 -130
  153. package/dist/src/command-line/init/implementation/angular/integrated-workspace.d.ts +0 -1
  154. package/dist/src/command-line/init/implementation/angular/integrated-workspace.js +0 -9
  155. package/dist/src/command-line/init/implementation/angular/legacy-angular-versions.d.ts +0 -2
  156. package/dist/src/command-line/init/implementation/angular/legacy-angular-versions.js +0 -155
  157. package/dist/src/command-line/init/implementation/angular/standalone-workspace.d.ts +0 -1
  158. package/dist/src/command-line/init/implementation/angular/standalone-workspace.js +0 -204
  159. package/dist/src/command-line/init/implementation/angular/types.d.ts +0 -20
  160. package/dist/src/command-line/init/implementation/angular/types.js +0 -2
  161. package/dist/src/command-line/init/implementation/check-compatible-with-plugins.d.ts +0 -15
  162. package/dist/src/command-line/init/implementation/check-compatible-with-plugins.js +0 -136
  163. package/dist/src/command-line/init/implementation/deduce-default-base.d.ts +0 -1
  164. package/dist/src/command-line/init/implementation/deduce-default-base.js +0 -53
  165. package/dist/src/command-line/init/implementation/dot-nx/add-nx-scripts.d.ts +0 -11
  166. package/dist/src/command-line/init/implementation/dot-nx/add-nx-scripts.js +0 -151
  167. package/dist/src/command-line/init/implementation/dot-nx/nxw.d.ts +0 -1
  168. package/dist/src/command-line/init/implementation/dot-nx/nxw.js +0 -123
  169. package/dist/src/command-line/init/implementation/format.d.ts +0 -18
  170. package/dist/src/command-line/init/implementation/format.js +0 -114
  171. package/dist/src/command-line/init/implementation/utils.d.ts +0 -35
  172. package/dist/src/command-line/init/implementation/utils.js +0 -422
  173. package/dist/src/command-line/init/init-v1.d.ts +0 -8
  174. package/dist/src/command-line/init/init-v1.js +0 -101
  175. package/dist/src/command-line/init/init-v2.d.ts +0 -23
  176. package/dist/src/command-line/init/init-v2.js +0 -622
  177. package/dist/src/command-line/init/utils/ai-output.d.ts +0 -72
  178. package/dist/src/command-line/init/utils/ai-output.js +0 -180
  179. package/dist/src/command-line/list/command-object.d.ts +0 -2
  180. package/dist/src/command-line/list/command-object.js +0 -21
  181. package/dist/src/command-line/list/list.d.ts +0 -15
  182. package/dist/src/command-line/list/list.js +0 -48
  183. package/dist/src/command-line/mcp/command-object.d.ts +0 -2
  184. package/dist/src/command-line/mcp/command-object.js +0 -29
  185. package/dist/src/command-line/mcp/mcp.d.ts +0 -2
  186. package/dist/src/command-line/mcp/mcp.js +0 -60
  187. package/dist/src/command-line/migrate/agentic/capture-generator-output.d.ts +0 -22
  188. package/dist/src/command-line/migrate/agentic/capture-generator-output.js +0 -100
  189. package/dist/src/command-line/migrate/agentic/cli-args.d.ts +0 -12
  190. package/dist/src/command-line/migrate/agentic/cli-args.js +0 -38
  191. package/dist/src/command-line/migrate/agentic/definitions.d.ts +0 -6
  192. package/dist/src/command-line/migrate/agentic/definitions.js +0 -148
  193. package/dist/src/command-line/migrate/agentic/detect-installed.d.ts +0 -10
  194. package/dist/src/command-line/migrate/agentic/detect-installed.js +0 -68
  195. package/dist/src/command-line/migrate/agentic/handoff-gitignore.d.ts +0 -61
  196. package/dist/src/command-line/migrate/agentic/handoff-gitignore.js +0 -78
  197. package/dist/src/command-line/migrate/agentic/handoff.d.ts +0 -69
  198. package/dist/src/command-line/migrate/agentic/handoff.js +0 -193
  199. package/dist/src/command-line/migrate/agentic/inception.d.ts +0 -9
  200. package/dist/src/command-line/migrate/agentic/inception.js +0 -15
  201. package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.d.ts +0 -17
  202. package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.js +0 -57
  203. package/dist/src/command-line/migrate/agentic/prompts/generic-validation.d.ts +0 -56
  204. package/dist/src/command-line/migrate/agentic/prompts/generic-validation.js +0 -66
  205. package/dist/src/command-line/migrate/agentic/prompts/hybrid-prompt-migration.d.ts +0 -49
  206. package/dist/src/command-line/migrate/agentic/prompts/hybrid-prompt-migration.js +0 -53
  207. package/dist/src/command-line/migrate/agentic/prompts/prompt-migration.d.ts +0 -26
  208. package/dist/src/command-line/migrate/agentic/prompts/prompt-migration.js +0 -27
  209. package/dist/src/command-line/migrate/agentic/prompts/shared-rendering.d.ts +0 -19
  210. package/dist/src/command-line/migrate/agentic/prompts/shared-rendering.js +0 -145
  211. package/dist/src/command-line/migrate/agentic/prompts/system-prompt.d.ts +0 -46
  212. package/dist/src/command-line/migrate/agentic/prompts/system-prompt.js +0 -90
  213. package/dist/src/command-line/migrate/agentic/run-step.d.ts +0 -68
  214. package/dist/src/command-line/migrate/agentic/run-step.js +0 -124
  215. package/dist/src/command-line/migrate/agentic/runner.d.ts +0 -33
  216. package/dist/src/command-line/migrate/agentic/runner.js +0 -444
  217. package/dist/src/command-line/migrate/agentic/select.d.ts +0 -24
  218. package/dist/src/command-line/migrate/agentic/select.js +0 -251
  219. package/dist/src/command-line/migrate/agentic/types.d.ts +0 -132
  220. package/dist/src/command-line/migrate/agentic/types.js +0 -37
  221. package/dist/src/command-line/migrate/command-object.d.ts +0 -53
  222. package/dist/src/command-line/migrate/command-object.js +0 -152
  223. package/dist/src/command-line/migrate/execute-migration.d.ts +0 -91
  224. package/dist/src/command-line/migrate/execute-migration.js +0 -474
  225. package/dist/src/command-line/migrate/migrate-analytics.d.ts +0 -106
  226. package/dist/src/command-line/migrate/migrate-analytics.js +0 -317
  227. package/dist/src/command-line/migrate/migrate-commits.d.ts +0 -80
  228. package/dist/src/command-line/migrate/migrate-commits.js +0 -217
  229. package/dist/src/command-line/migrate/migrate-config.d.ts +0 -29
  230. package/dist/src/command-line/migrate/migrate-config.js +0 -112
  231. package/dist/src/command-line/migrate/migrate-output.d.ts +0 -218
  232. package/dist/src/command-line/migrate/migrate-output.js +0 -302
  233. package/dist/src/command-line/migrate/migrate-ui-api.d.ts +0 -89
  234. package/dist/src/command-line/migrate/migrate-ui-api.js +0 -437
  235. package/dist/src/command-line/migrate/migrate.d.ts +0 -242
  236. package/dist/src/command-line/migrate/migrate.js +0 -2807
  237. package/dist/src/command-line/migrate/migration-shape.d.ts +0 -16
  238. package/dist/src/command-line/migrate/migration-shape.js +0 -13
  239. package/dist/src/command-line/migrate/multi-major.d.ts +0 -37
  240. package/dist/src/command-line/migrate/multi-major.js +0 -215
  241. package/dist/src/command-line/migrate/prompt-files.d.ts +0 -31
  242. package/dist/src/command-line/migrate/prompt-files.js +0 -141
  243. package/dist/src/command-line/migrate/resolve-package-version.d.ts +0 -24
  244. package/dist/src/command-line/migrate/resolve-package-version.js +0 -245
  245. package/dist/src/command-line/migrate/run/agent-output.d.ts +0 -20
  246. package/dist/src/command-line/migrate/run/agent-output.js +0 -65
  247. package/dist/src/command-line/migrate/run/index.d.ts +0 -9
  248. package/dist/src/command-line/migrate/run/index.js +0 -23
  249. package/dist/src/command-line/migrate/run/orchestrator.d.ts +0 -20
  250. package/dist/src/command-line/migrate/run/orchestrator.js +0 -1200
  251. package/dist/src/command-line/migrate/run/run-id.d.ts +0 -16
  252. package/dist/src/command-line/migrate/run/run-id.js +0 -56
  253. package/dist/src/command-line/migrate/run/run-state.d.ts +0 -157
  254. package/dist/src/command-line/migrate/run/run-state.js +0 -438
  255. package/dist/src/command-line/migrate/run/state-lock.d.ts +0 -25
  256. package/dist/src/command-line/migrate/run/state-lock.js +0 -76
  257. package/dist/src/command-line/migrate/run/state-machine.d.ts +0 -84
  258. package/dist/src/command-line/migrate/run/state-machine.js +0 -315
  259. package/dist/src/command-line/migrate/run/util.d.ts +0 -59
  260. package/dist/src/command-line/migrate/run/util.js +0 -148
  261. package/dist/src/command-line/migrate/run/worker.d.ts +0 -16
  262. package/dist/src/command-line/migrate/run/worker.js +0 -682
  263. package/dist/src/command-line/migrate/run-migration-process.js +0 -110
  264. package/dist/src/command-line/migrate/safe-prompt.d.ts +0 -21
  265. package/dist/src/command-line/migrate/safe-prompt.js +0 -47
  266. package/dist/src/command-line/migrate/sort-migrations.d.ts +0 -16
  267. package/dist/src/command-line/migrate/sort-migrations.js +0 -32
  268. package/dist/src/command-line/migrate/step-actions.d.ts +0 -5
  269. package/dist/src/command-line/migrate/step-actions.js +0 -12
  270. package/dist/src/command-line/migrate/text.d.ts +0 -18
  271. package/dist/src/command-line/migrate/text.js +0 -26
  272. package/dist/src/command-line/migrate/update-filters.d.ts +0 -11
  273. package/dist/src/command-line/migrate/update-filters.js +0 -45
  274. package/dist/src/command-line/migrate/version-skew-guard.d.ts +0 -60
  275. package/dist/src/command-line/migrate/version-skew-guard.js +0 -175
  276. package/dist/src/command-line/migrate/version-utils.d.ts +0 -5
  277. package/dist/src/command-line/migrate/version-utils.js +0 -52
  278. package/dist/src/command-line/new/command-object.d.ts +0 -2
  279. package/dist/src/command-line/new/command-object.js +0 -26
  280. package/dist/src/command-line/new/new.d.ts +0 -3
  281. package/dist/src/command-line/new/new.js +0 -30
  282. package/dist/src/command-line/nx-cloud/apply-locally/apply-locally.d.ts +0 -4
  283. package/dist/src/command-line/nx-cloud/apply-locally/apply-locally.js +0 -13
  284. package/dist/src/command-line/nx-cloud/apply-locally/command-object.d.ts +0 -2
  285. package/dist/src/command-line/nx-cloud/apply-locally/command-object.js +0 -16
  286. package/dist/src/command-line/nx-cloud/complete-run/command-object.d.ts +0 -2
  287. package/dist/src/command-line/nx-cloud/complete-run/command-object.js +0 -17
  288. package/dist/src/command-line/nx-cloud/complete-run/stop-all-agents.d.ts +0 -4
  289. package/dist/src/command-line/nx-cloud/complete-run/stop-all-agents.js +0 -13
  290. package/dist/src/command-line/nx-cloud/connect/command-object.d.ts +0 -3
  291. package/dist/src/command-line/nx-cloud/connect/command-object.js +0 -28
  292. package/dist/src/command-line/nx-cloud/connect/connect-to-nx-cloud.d.ts +0 -13
  293. package/dist/src/command-line/nx-cloud/connect/connect-to-nx-cloud.js +0 -266
  294. package/dist/src/command-line/nx-cloud/connect/view-logs.d.ts +0 -1
  295. package/dist/src/command-line/nx-cloud/connect/view-logs.js +0 -55
  296. package/dist/src/command-line/nx-cloud/download-cloud-client/command-object.d.ts +0 -2
  297. package/dist/src/command-line/nx-cloud/download-cloud-client/command-object.js +0 -13
  298. package/dist/src/command-line/nx-cloud/download-cloud-client/download-cloud-client.d.ts +0 -4
  299. package/dist/src/command-line/nx-cloud/download-cloud-client/download-cloud-client.js +0 -32
  300. package/dist/src/command-line/nx-cloud/fix-ci/command-object.d.ts +0 -2
  301. package/dist/src/command-line/nx-cloud/fix-ci/command-object.js +0 -16
  302. package/dist/src/command-line/nx-cloud/fix-ci/fix-ci.d.ts +0 -4
  303. package/dist/src/command-line/nx-cloud/fix-ci/fix-ci.js +0 -13
  304. package/dist/src/command-line/nx-cloud/login/command-object.d.ts +0 -2
  305. package/dist/src/command-line/nx-cloud/login/command-object.js +0 -20
  306. package/dist/src/command-line/nx-cloud/login/login.d.ts +0 -5
  307. package/dist/src/command-line/nx-cloud/login/login.js +0 -10
  308. package/dist/src/command-line/nx-cloud/logout/command-object.d.ts +0 -2
  309. package/dist/src/command-line/nx-cloud/logout/command-object.js +0 -16
  310. package/dist/src/command-line/nx-cloud/logout/logout.d.ts +0 -4
  311. package/dist/src/command-line/nx-cloud/logout/logout.js +0 -7
  312. package/dist/src/command-line/nx-cloud/record/command-object.d.ts +0 -2
  313. package/dist/src/command-line/nx-cloud/record/command-object.js +0 -19
  314. package/dist/src/command-line/nx-cloud/record/record.d.ts +0 -5
  315. package/dist/src/command-line/nx-cloud/record/record.js +0 -33
  316. package/dist/src/command-line/nx-cloud/start-agent/command-object.d.ts +0 -2
  317. package/dist/src/command-line/nx-cloud/start-agent/command-object.js +0 -16
  318. package/dist/src/command-line/nx-cloud/start-agent/start-agent.d.ts +0 -4
  319. package/dist/src/command-line/nx-cloud/start-agent/start-agent.js +0 -13
  320. package/dist/src/command-line/nx-cloud/start-ci-run/command-object.d.ts +0 -2
  321. package/dist/src/command-line/nx-cloud/start-ci-run/command-object.js +0 -16
  322. package/dist/src/command-line/nx-cloud/start-ci-run/start-ci-run.d.ts +0 -4
  323. package/dist/src/command-line/nx-cloud/start-ci-run/start-ci-run.js +0 -13
  324. package/dist/src/command-line/nx-cloud/start-nx-agents/command-object.d.ts +0 -2
  325. package/dist/src/command-line/nx-cloud/start-nx-agents/command-object.js +0 -16
  326. package/dist/src/command-line/nx-cloud/start-nx-agents/start-nx-agents.d.ts +0 -4
  327. package/dist/src/command-line/nx-cloud/start-nx-agents/start-nx-agents.js +0 -13
  328. package/dist/src/command-line/nx-cloud/utils.d.ts +0 -2
  329. package/dist/src/command-line/nx-cloud/utils.js +0 -34
  330. package/dist/src/command-line/nx-commands.d.ts +0 -10
  331. package/dist/src/command-line/nx-commands.js +0 -183
  332. package/dist/src/command-line/register/command-object.d.ts +0 -6
  333. package/dist/src/command-line/register/command-object.js +0 -27
  334. package/dist/src/command-line/register/register.d.ts +0 -2
  335. package/dist/src/command-line/register/register.js +0 -9
  336. package/dist/src/command-line/release/changelog/commit-utils.d.ts +0 -13
  337. package/dist/src/command-line/release/changelog/commit-utils.js +0 -63
  338. package/dist/src/command-line/release/changelog/version-plan-filtering.d.ts +0 -43
  339. package/dist/src/command-line/release/changelog/version-plan-filtering.js +0 -156
  340. package/dist/src/command-line/release/changelog/version-plan-utils.d.ts +0 -31
  341. package/dist/src/command-line/release/changelog/version-plan-utils.js +0 -92
  342. package/dist/src/command-line/release/changelog.d.ts +0 -28
  343. package/dist/src/command-line/release/changelog.js +0 -905
  344. package/dist/src/command-line/release/command-object.d.ts +0 -96
  345. package/dist/src/command-line/release/command-object.js +0 -342
  346. package/dist/src/command-line/release/config/config.d.ts +0 -70
  347. package/dist/src/command-line/release/config/config.js +0 -1204
  348. package/dist/src/command-line/release/config/conventional-commits.d.ts +0 -2
  349. package/dist/src/command-line/release/config/conventional-commits.js +0 -106
  350. package/dist/src/command-line/release/config/deep-merge-json.d.ts +0 -1
  351. package/dist/src/command-line/release/config/deep-merge-json.js +0 -28
  352. package/dist/src/command-line/release/config/filter-release-groups.d.ts +0 -23
  353. package/dist/src/command-line/release/config/filter-release-groups.js +0 -157
  354. package/dist/src/command-line/release/config/use-legacy-versioning.d.ts +0 -2
  355. package/dist/src/command-line/release/config/use-legacy-versioning.js +0 -8
  356. package/dist/src/command-line/release/config/version-plans.d.ts +0 -42
  357. package/dist/src/command-line/release/config/version-plans.js +0 -278
  358. package/dist/src/command-line/release/index.d.ts +0 -49
  359. package/dist/src/command-line/release/index.js +0 -49
  360. package/dist/src/command-line/release/plan-check.d.ts +0 -4
  361. package/dist/src/command-line/release/plan-check.js +0 -170
  362. package/dist/src/command-line/release/plan.d.ts +0 -4
  363. package/dist/src/command-line/release/plan.js +0 -248
  364. package/dist/src/command-line/release/publish.d.ts +0 -9
  365. package/dist/src/command-line/release/publish.js +0 -295
  366. package/dist/src/command-line/release/release.d.ts +0 -5
  367. package/dist/src/command-line/release/release.js +0 -299
  368. package/dist/src/command-line/release/utils/diff.d.ts +0 -21
  369. package/dist/src/command-line/release/utils/diff.js +0 -168
  370. package/dist/src/command-line/release/utils/exec-command.d.ts +0 -1
  371. package/dist/src/command-line/release/utils/exec-command.js +0 -34
  372. package/dist/src/command-line/release/utils/generate-version-plan-content.d.ts +0 -1
  373. package/dist/src/command-line/release/utils/generate-version-plan-content.js +0 -20
  374. package/dist/src/command-line/release/utils/get-touched-projects-for-group.d.ts +0 -7
  375. package/dist/src/command-line/release/utils/get-touched-projects-for-group.js +0 -78
  376. package/dist/src/command-line/release/utils/git.d.ts +0 -126
  377. package/dist/src/command-line/release/utils/git.js +0 -597
  378. package/dist/src/command-line/release/utils/launch-editor.d.ts +0 -1
  379. package/dist/src/command-line/release/utils/launch-editor.js +0 -46
  380. package/dist/src/command-line/release/utils/markdown.d.ts +0 -6
  381. package/dist/src/command-line/release/utils/markdown.js +0 -28
  382. package/dist/src/command-line/release/utils/print-changes.d.ts +0 -6
  383. package/dist/src/command-line/release/utils/print-changes.js +0 -63
  384. package/dist/src/command-line/release/utils/print-config.d.ts +0 -7
  385. package/dist/src/command-line/release/utils/print-config.js +0 -36
  386. package/dist/src/command-line/release/utils/release-graph.d.ts +0 -248
  387. package/dist/src/command-line/release/utils/release-graph.js +0 -769
  388. package/dist/src/command-line/release/utils/remote-release-clients/extract-repo-slug.d.ts +0 -9
  389. package/dist/src/command-line/release/utils/remote-release-clients/extract-repo-slug.js +0 -61
  390. package/dist/src/command-line/release/utils/remote-release-clients/github.d.ts +0 -58
  391. package/dist/src/command-line/release/utils/remote-release-clients/github.js +0 -336
  392. package/dist/src/command-line/release/utils/remote-release-clients/gitlab.d.ts +0 -62
  393. package/dist/src/command-line/release/utils/remote-release-clients/gitlab.js +0 -259
  394. package/dist/src/command-line/release/utils/remote-release-clients/remote-release-client.d.ts +0 -111
  395. package/dist/src/command-line/release/utils/remote-release-clients/remote-release-client.js +0 -138
  396. package/dist/src/command-line/release/utils/repository-git-tags.d.ts +0 -25
  397. package/dist/src/command-line/release/utils/repository-git-tags.js +0 -125
  398. package/dist/src/command-line/release/utils/resolve-changelog-renderer.d.ts +0 -2
  399. package/dist/src/command-line/release/utils/resolve-changelog-renderer.js +0 -22
  400. package/dist/src/command-line/release/utils/resolve-nx-json-error-message.d.ts +0 -1
  401. package/dist/src/command-line/release/utils/resolve-nx-json-error-message.js +0 -53
  402. package/dist/src/command-line/release/utils/resolve-semver-specifier.d.ts +0 -7
  403. package/dist/src/command-line/release/utils/resolve-semver-specifier.js +0 -41
  404. package/dist/src/command-line/release/utils/semver.d.ts +0 -26
  405. package/dist/src/command-line/release/utils/semver.js +0 -111
  406. package/dist/src/command-line/release/utils/shared-legacy.d.ts +0 -25
  407. package/dist/src/command-line/release/utils/shared-legacy.js +0 -2
  408. package/dist/src/command-line/release/utils/shared.d.ts +0 -64
  409. package/dist/src/command-line/release/utils/shared.js +0 -379
  410. package/dist/src/command-line/release/utils/version-plan-utils.d.ts +0 -40
  411. package/dist/src/command-line/release/utils/version-plan-utils.js +0 -111
  412. package/dist/src/command-line/release/version/derive-specifier-from-conventional-commits.d.ts +0 -8
  413. package/dist/src/command-line/release/version/derive-specifier-from-conventional-commits.js +0 -61
  414. package/dist/src/command-line/release/version/deriver-specifier-from-version-plans.d.ts +0 -8
  415. package/dist/src/command-line/release/version/deriver-specifier-from-version-plans.js +0 -59
  416. package/dist/src/command-line/release/version/project-logger.d.ts +0 -8
  417. package/dist/src/command-line/release/version/project-logger.js +0 -47
  418. package/dist/src/command-line/release/version/release-group-processor.d.ts +0 -139
  419. package/dist/src/command-line/release/version/release-group-processor.js +0 -706
  420. package/dist/src/command-line/release/version/resolve-current-version.d.ts +0 -32
  421. package/dist/src/command-line/release/version/resolve-current-version.js +0 -240
  422. package/dist/src/command-line/release/version/topological-sort.d.ts +0 -9
  423. package/dist/src/command-line/release/version/topological-sort.js +0 -41
  424. package/dist/src/command-line/release/version/version-actions.d.ts +0 -224
  425. package/dist/src/command-line/release/version/version-actions.js +0 -255
  426. package/dist/src/command-line/release/version.d.ts +0 -28
  427. package/dist/src/command-line/release/version.js +0 -382
  428. package/dist/src/command-line/repair/command-object.d.ts +0 -2
  429. package/dist/src/command-line/repair/command-object.js +0 -21
  430. package/dist/src/command-line/repair/repair.d.ts +0 -3
  431. package/dist/src/command-line/repair/repair.js +0 -41
  432. package/dist/src/command-line/report/command-object.d.ts +0 -2
  433. package/dist/src/command-line/report/command-object.js +0 -12
  434. package/dist/src/command-line/report/report.d.ts +0 -71
  435. package/dist/src/command-line/report/report.js +0 -405
  436. package/dist/src/command-line/reset/command-object.d.ts +0 -8
  437. package/dist/src/command-line/reset/command-object.js +0 -27
  438. package/dist/src/command-line/reset/reset.d.ts +0 -2
  439. package/dist/src/command-line/reset/reset.js +0 -185
  440. package/dist/src/command-line/run/command-object.d.ts +0 -6
  441. package/dist/src/command-line/run/command-object.js +0 -43
  442. package/dist/src/command-line/run/completion.d.ts +0 -1
  443. package/dist/src/command-line/run/completion.js +0 -7
  444. package/dist/src/command-line/run/executor-utils.d.ts +0 -12
  445. package/dist/src/command-line/run/executor-utils.js +0 -96
  446. package/dist/src/command-line/run/run-one.d.ts +0 -17
  447. package/dist/src/command-line/run/run-one.js +0 -155
  448. package/dist/src/command-line/run/run.d.ts +0 -51
  449. package/dist/src/command-line/run/run.js +0 -179
  450. package/dist/src/command-line/run-many/command-object.d.ts +0 -2
  451. package/dist/src/command-line/run-many/command-object.js +0 -18
  452. package/dist/src/command-line/run-many/completion.d.ts +0 -1
  453. package/dist/src/command-line/run-many/completion.js +0 -13
  454. package/dist/src/command-line/run-many/run-many.d.ts +0 -10
  455. package/dist/src/command-line/run-many/run-many.js +0 -90
  456. package/dist/src/command-line/show/command-object.d.ts +0 -40
  457. package/dist/src/command-line/show/command-object.js +0 -237
  458. package/dist/src/command-line/show/completion.d.ts +0 -1
  459. package/dist/src/command-line/show/completion.js +0 -27
  460. package/dist/src/command-line/show/project.d.ts +0 -2
  461. package/dist/src/command-line/show/project.js +0 -103
  462. package/dist/src/command-line/show/projects.d.ts +0 -2
  463. package/dist/src/command-line/show/projects.js +0 -80
  464. package/dist/src/command-line/show/show-target/index.d.ts +0 -3
  465. package/dist/src/command-line/show/show-target/index.js +0 -9
  466. package/dist/src/command-line/show/show-target/info.d.ts +0 -28
  467. package/dist/src/command-line/show/show-target/info.js +0 -389
  468. package/dist/src/command-line/show/show-target/inputs.d.ts +0 -2
  469. package/dist/src/command-line/show/show-target/inputs.js +0 -83
  470. package/dist/src/command-line/show/show-target/outputs.d.ts +0 -2
  471. package/dist/src/command-line/show/show-target/outputs.js +0 -70
  472. package/dist/src/command-line/show/show-target/utils.d.ts +0 -54
  473. package/dist/src/command-line/show/show-target/utils.js +0 -265
  474. package/dist/src/command-line/sync/command-object.d.ts +0 -6
  475. package/dist/src/command-line/sync/command-object.js +0 -21
  476. package/dist/src/command-line/sync/sync.d.ts +0 -6
  477. package/dist/src/command-line/sync/sync.js +0 -120
  478. package/dist/src/command-line/watch/command-object.d.ts +0 -2
  479. package/dist/src/command-line/watch/command-object.js +0 -91
  480. package/dist/src/command-line/watch/completion.d.ts +0 -1
  481. package/dist/src/command-line/watch/completion.js +0 -10
  482. package/dist/src/command-line/watch/watch.d.ts +0 -31
  483. package/dist/src/command-line/watch/watch.js +0 -211
  484. package/dist/src/command-line/yargs-utils/arguments-of.d.ts +0 -11
  485. package/dist/src/command-line/yargs-utils/arguments-of.js +0 -9
  486. package/dist/src/command-line/yargs-utils/documentation.d.ts +0 -2
  487. package/dist/src/command-line/yargs-utils/documentation.js +0 -12
  488. package/dist/src/command-line/yargs-utils/shared-options.d.ts +0 -91
  489. package/dist/src/command-line/yargs-utils/shared-options.js +0 -397
  490. package/dist/src/commands-runner/command-graph.d.ts +0 -13
  491. package/dist/src/commands-runner/command-graph.js +0 -2
  492. package/dist/src/commands-runner/create-command-graph.d.ts +0 -4
  493. package/dist/src/commands-runner/create-command-graph.js +0 -72
  494. package/dist/src/commands-runner/get-command-projects.d.ts +0 -3
  495. package/dist/src/commands-runner/get-command-projects.js +0 -33
  496. package/dist/src/config/calculate-default-project-name.d.ts +0 -4
  497. package/dist/src/config/calculate-default-project-name.js +0 -41
  498. package/dist/src/config/configuration.d.ts +0 -8
  499. package/dist/src/config/configuration.js +0 -17
  500. package/dist/src/config/misc-interfaces.d.ts +0 -266
  501. package/dist/src/config/misc-interfaces.js +0 -2
  502. package/dist/src/config/nx-json.d.ts +0 -963
  503. package/dist/src/config/nx-json.js +0 -40
  504. package/dist/src/config/project-graph.d.ts +0 -137
  505. package/dist/src/config/project-graph.js +0 -45
  506. package/dist/src/config/schema-utils.d.ts +0 -37
  507. package/dist/src/config/schema-utils.js +0 -199
  508. package/dist/src/config/task-graph.d.ts +0 -6
  509. package/dist/src/config/task-graph.js +0 -2
  510. package/dist/src/config/to-project-name.d.ts +0 -5
  511. package/dist/src/config/to-project-name.js +0 -12
  512. package/dist/src/config/workspace-json-project-json.d.ts +0 -273
  513. package/dist/src/config/workspace-json-project-json.js +0 -2
  514. package/dist/src/core/graph/environment.js +0 -1
  515. package/dist/src/core/graph/favicon.ico +0 -0
  516. package/dist/src/core/graph/index.html +0 -32
  517. package/dist/src/core/graph/main.js +0 -1
  518. package/dist/src/core/graph/runtime.js +0 -1
  519. package/dist/src/core/graph/styles.css +0 -2
  520. package/dist/src/core/graph/styles.js +0 -1
  521. package/dist/src/daemon/cache.d.ts +0 -10
  522. package/dist/src/daemon/cache.js +0 -58
  523. package/dist/src/daemon/client/client.d.ts +0 -161
  524. package/dist/src/daemon/client/client.js +0 -1255
  525. package/dist/src/daemon/client/daemon-environment.d.ts +0 -64
  526. package/dist/src/daemon/client/daemon-environment.js +0 -378
  527. package/dist/src/daemon/client/daemon-socket-messenger.d.ts +0 -12
  528. package/dist/src/daemon/client/daemon-socket-messenger.js +0 -63
  529. package/dist/src/daemon/is-nx-version-mismatch.d.ts +0 -1
  530. package/dist/src/daemon/is-nx-version-mismatch.js +0 -8
  531. package/dist/src/daemon/is-on-daemon.d.ts +0 -1
  532. package/dist/src/daemon/is-on-daemon.js +0 -6
  533. package/dist/src/daemon/is-v8-serializer-enabled.d.ts +0 -5
  534. package/dist/src/daemon/is-v8-serializer-enabled.js +0 -10
  535. package/dist/src/daemon/logger.d.ts +0 -39
  536. package/dist/src/daemon/logger.js +0 -80
  537. package/dist/src/daemon/message-types/configure-ai-agents.d.ts +0 -20
  538. package/dist/src/daemon/message-types/configure-ai-agents.js +0 -19
  539. package/dist/src/daemon/message-types/daemon-message.d.ts +0 -39
  540. package/dist/src/daemon/message-types/daemon-message.js +0 -54
  541. package/dist/src/daemon/message-types/flush-sync-generator-changes-to-disk.d.ts +0 -6
  542. package/dist/src/daemon/message-types/flush-sync-generator-changes-to-disk.js +0 -11
  543. package/dist/src/daemon/message-types/force-shutdown.d.ts +0 -5
  544. package/dist/src/daemon/message-types/force-shutdown.js +0 -11
  545. package/dist/src/daemon/message-types/get-context-file-data.d.ts +0 -5
  546. package/dist/src/daemon/message-types/get-context-file-data.js +0 -11
  547. package/dist/src/daemon/message-types/get-files-in-directory.d.ts +0 -6
  548. package/dist/src/daemon/message-types/get-files-in-directory.js +0 -11
  549. package/dist/src/daemon/message-types/get-nx-workspace-files.d.ts +0 -6
  550. package/dist/src/daemon/message-types/get-nx-workspace-files.js +0 -11
  551. package/dist/src/daemon/message-types/get-registered-sync-generators.d.ts +0 -5
  552. package/dist/src/daemon/message-types/get-registered-sync-generators.js +0 -11
  553. package/dist/src/daemon/message-types/get-sync-generator-changes.d.ts +0 -6
  554. package/dist/src/daemon/message-types/get-sync-generator-changes.js +0 -11
  555. package/dist/src/daemon/message-types/glob.d.ts +0 -14
  556. package/dist/src/daemon/message-types/glob.js +0 -19
  557. package/dist/src/daemon/message-types/hash-glob.d.ts +0 -13
  558. package/dist/src/daemon/message-types/hash-glob.js +0 -19
  559. package/dist/src/daemon/message-types/nx-console.d.ts +0 -17
  560. package/dist/src/daemon/message-types/nx-console.js +0 -19
  561. package/dist/src/daemon/message-types/register-project-graph-listener.d.ts +0 -5
  562. package/dist/src/daemon/message-types/register-project-graph-listener.js +0 -11
  563. package/dist/src/daemon/message-types/run-tasks-execution-hooks.d.ts +0 -13
  564. package/dist/src/daemon/message-types/run-tasks-execution-hooks.js +0 -19
  565. package/dist/src/daemon/message-types/streaming-messages.d.ts +0 -14
  566. package/dist/src/daemon/message-types/streaming-messages.js +0 -19
  567. package/dist/src/daemon/message-types/task-history.d.ts +0 -19
  568. package/dist/src/daemon/message-types/task-history.js +0 -27
  569. package/dist/src/daemon/message-types/update-workspace-context.d.ts +0 -8
  570. package/dist/src/daemon/message-types/update-workspace-context.js +0 -11
  571. package/dist/src/daemon/sandbox-socket-hint.d.ts +0 -27
  572. package/dist/src/daemon/sandbox-socket-hint.js +0 -136
  573. package/dist/src/daemon/server/client-socket-context.d.ts +0 -23
  574. package/dist/src/daemon/server/client-socket-context.js +0 -88
  575. package/dist/src/daemon/server/dotenv-graph-changes.d.ts +0 -97
  576. package/dist/src/daemon/server/dotenv-graph-changes.js +0 -284
  577. package/dist/src/daemon/server/file-watching/changed-projects.d.ts +0 -10
  578. package/dist/src/daemon/server/file-watching/changed-projects.js +0 -53
  579. package/dist/src/daemon/server/file-watching/file-change-events.d.ts +0 -7
  580. package/dist/src/daemon/server/file-watching/file-change-events.js +0 -19
  581. package/dist/src/daemon/server/file-watching/file-watcher-sockets.d.ts +0 -17
  582. package/dist/src/daemon/server/file-watching/file-watcher-sockets.js +0 -82
  583. package/dist/src/daemon/server/file-watching/route-workspace-changes.d.ts +0 -9
  584. package/dist/src/daemon/server/file-watching/route-workspace-changes.js +0 -76
  585. package/dist/src/daemon/server/handle-client-env.d.ts +0 -8
  586. package/dist/src/daemon/server/handle-client-env.js +0 -92
  587. package/dist/src/daemon/server/handle-configure-ai-agents.d.ts +0 -3
  588. package/dist/src/daemon/server/handle-configure-ai-agents.js +0 -101
  589. package/dist/src/daemon/server/handle-context-file-data.d.ts +0 -2
  590. package/dist/src/daemon/server/handle-context-file-data.js +0 -12
  591. package/dist/src/daemon/server/handle-flush-sync-generator-changes-to-disk.d.ts +0 -2
  592. package/dist/src/daemon/server/handle-flush-sync-generator-changes-to-disk.js +0 -11
  593. package/dist/src/daemon/server/handle-force-shutdown.d.ts +0 -5
  594. package/dist/src/daemon/server/handle-force-shutdown.js +0 -18
  595. package/dist/src/daemon/server/handle-get-files-in-directory.d.ts +0 -2
  596. package/dist/src/daemon/server/handle-get-files-in-directory.js +0 -12
  597. package/dist/src/daemon/server/handle-get-registered-sync-generators.d.ts +0 -2
  598. package/dist/src/daemon/server/handle-get-registered-sync-generators.js +0 -11
  599. package/dist/src/daemon/server/handle-get-sync-generator-changes.d.ts +0 -2
  600. package/dist/src/daemon/server/handle-get-sync-generator-changes.js +0 -20
  601. package/dist/src/daemon/server/handle-glob.d.ts +0 -3
  602. package/dist/src/daemon/server/handle-glob.js +0 -20
  603. package/dist/src/daemon/server/handle-hash-glob.d.ts +0 -3
  604. package/dist/src/daemon/server/handle-hash-glob.js +0 -20
  605. package/dist/src/daemon/server/handle-hash-tasks.d.ts +0 -12
  606. package/dist/src/daemon/server/handle-hash-tasks.js +0 -28
  607. package/dist/src/daemon/server/handle-nx-console.d.ts +0 -3
  608. package/dist/src/daemon/server/handle-nx-console.js +0 -54
  609. package/dist/src/daemon/server/handle-nx-workspace-files.d.ts +0 -2
  610. package/dist/src/daemon/server/handle-nx-workspace-files.js +0 -12
  611. package/dist/src/daemon/server/handle-outputs-changes.d.ts +0 -10
  612. package/dist/src/daemon/server/handle-outputs-changes.js +0 -86
  613. package/dist/src/daemon/server/handle-outputs-tracking.d.ts +0 -15
  614. package/dist/src/daemon/server/handle-outputs-tracking.js +0 -35
  615. package/dist/src/daemon/server/handle-process-in-background.d.ts +0 -6
  616. package/dist/src/daemon/server/handle-process-in-background.js +0 -32
  617. package/dist/src/daemon/server/handle-request-project-graph.d.ts +0 -3
  618. package/dist/src/daemon/server/handle-request-project-graph.js +0 -36
  619. package/dist/src/daemon/server/handle-request-shutdown.d.ts +0 -5
  620. package/dist/src/daemon/server/handle-request-shutdown.js +0 -27
  621. package/dist/src/daemon/server/handle-task-history.d.ts +0 -13
  622. package/dist/src/daemon/server/handle-task-history.js +0 -30
  623. package/dist/src/daemon/server/handle-tasks-execution-hooks.d.ts +0 -19
  624. package/dist/src/daemon/server/handle-tasks-execution-hooks.js +0 -35
  625. package/dist/src/daemon/server/handle-update-workspace-context.d.ts +0 -2
  626. package/dist/src/daemon/server/handle-update-workspace-context.js +0 -11
  627. package/dist/src/daemon/server/latest-nx.d.ts +0 -10
  628. package/dist/src/daemon/server/latest-nx.js +0 -56
  629. package/dist/src/daemon/server/nx-console-operations.d.ts +0 -26
  630. package/dist/src/daemon/server/nx-console-operations.js +0 -97
  631. package/dist/src/daemon/server/outputs-tracking.d.ts +0 -23
  632. package/dist/src/daemon/server/outputs-tracking.js +0 -120
  633. package/dist/src/daemon/server/project-graph-incremental-recomputation.d.ts +0 -47
  634. package/dist/src/daemon/server/project-graph-incremental-recomputation.js +0 -660
  635. package/dist/src/daemon/server/project-graph-listener-sockets.d.ts +0 -7
  636. package/dist/src/daemon/server/project-graph-listener-sockets.js +0 -25
  637. package/dist/src/daemon/server/server.d.ts +0 -10
  638. package/dist/src/daemon/server/server.js +0 -465
  639. package/dist/src/daemon/server/shutdown-utils.d.ts +0 -23
  640. package/dist/src/daemon/server/shutdown-utils.js +0 -159
  641. package/dist/src/daemon/server/start.d.ts +0 -1
  642. package/dist/src/daemon/server/start.js +0 -20
  643. package/dist/src/daemon/server/sync-generators.d.ts +0 -14
  644. package/dist/src/daemon/server/sync-generators.js +0 -368
  645. package/dist/src/daemon/server/watcher.d.ts +0 -18
  646. package/dist/src/daemon/server/watcher.js +0 -126
  647. package/dist/src/daemon/socket-utils.d.ts +0 -43
  648. package/dist/src/daemon/socket-utils.js +0 -131
  649. package/dist/src/daemon/tmp-dir.d.ts +0 -62
  650. package/dist/src/daemon/tmp-dir.js +0 -477
  651. package/dist/src/devkit-exports.d.ts +0 -139
  652. package/dist/src/devkit-exports.js +0 -143
  653. package/dist/src/devkit-internals.d.ts +0 -144
  654. package/dist/src/devkit-internals.js +0 -331
  655. package/dist/src/devkit-testing-exports.d.ts +0 -2
  656. package/dist/src/devkit-testing-exports.js +0 -8
  657. package/dist/src/executors/noop/noop.impl.d.ts +0 -3
  658. package/dist/src/executors/noop/noop.impl.js +0 -6
  659. package/dist/src/executors/noop/schema.json +0 -10
  660. package/dist/src/executors/run-commands/run-commands.impl.d.ts +0 -59
  661. package/dist/src/executors/run-commands/run-commands.impl.js +0 -301
  662. package/dist/src/executors/run-commands/running-tasks.d.ts +0 -52
  663. package/dist/src/executors/run-commands/running-tasks.js +0 -603
  664. package/dist/src/executors/run-commands/schema.json +0 -198
  665. package/dist/src/executors/run-script/run-script.impl.d.ts +0 -8
  666. package/dist/src/executors/run-script/run-script.impl.js +0 -86
  667. package/dist/src/executors/run-script/schema.json +0 -28
  668. package/dist/src/executors/utils/convert-nx-executor.d.ts +0 -10
  669. package/dist/src/executors/utils/convert-nx-executor.js +0 -83
  670. package/dist/src/generators/internal-utils/format-changed-files.d.ts +0 -24
  671. package/dist/src/generators/internal-utils/format-changed-files.js +0 -163
  672. package/dist/src/generators/testing-utils/create-tree-with-empty-workspace.d.ts +0 -26
  673. package/dist/src/generators/testing-utils/create-tree-with-empty-workspace.js +0 -70
  674. package/dist/src/generators/testing-utils/create-tree.d.ts +0 -5
  675. package/dist/src/generators/testing-utils/create-tree.js +0 -14
  676. package/dist/src/generators/tree.d.ts +0 -127
  677. package/dist/src/generators/tree.js +0 -310
  678. package/dist/src/generators/utils/generate-files.d.ts +0 -44
  679. package/dist/src/generators/utils/generate-files.js +0 -114
  680. package/dist/src/generators/utils/glob.d.ts +0 -22
  681. package/dist/src/generators/utils/glob.js +0 -51
  682. package/dist/src/generators/utils/json.d.ts +0 -28
  683. package/dist/src/generators/utils/json.js +0 -48
  684. package/dist/src/generators/utils/nx-json.d.ts +0 -10
  685. package/dist/src/generators/utils/nx-json.js +0 -62
  686. package/dist/src/generators/utils/project-configuration.d.ts +0 -51
  687. package/dist/src/generators/utils/project-configuration.js +0 -299
  688. package/dist/src/hasher/check-task-files.d.ts +0 -86
  689. package/dist/src/hasher/check-task-files.js +0 -378
  690. package/dist/src/hasher/create-task-hasher.d.ts +0 -4
  691. package/dist/src/hasher/create-task-hasher.js +0 -15
  692. package/dist/src/hasher/file-hasher.d.ts +0 -3
  693. package/dist/src/hasher/file-hasher.js +0 -23
  694. package/dist/src/hasher/hash-plan-inspector.d.ts +0 -33
  695. package/dist/src/hasher/hash-plan-inspector.js +0 -70
  696. package/dist/src/hasher/hash-task.d.ts +0 -17
  697. package/dist/src/hasher/hash-task.js +0 -191
  698. package/dist/src/hasher/native-task-hasher-impl.d.ts +0 -18
  699. package/dist/src/hasher/native-task-hasher-impl.js +0 -38
  700. package/dist/src/hasher/task-hasher.d.ts +0 -160
  701. package/dist/src/hasher/task-hasher.js +0 -301
  702. package/dist/src/index.d.ts +0 -1
  703. package/dist/src/index.js +0 -2
  704. package/dist/src/migrations/update-15-0-0/prefix-outputs.d.ts +0 -2
  705. package/dist/src/migrations/update-15-0-0/prefix-outputs.js +0 -54
  706. package/dist/src/migrations/update-16-0-0/remove-nrwl-cli.d.ts +0 -2
  707. package/dist/src/migrations/update-16-0-0/remove-nrwl-cli.js +0 -16
  708. package/dist/src/migrations/update-16-0-0/update-depends-on-to-tokens.d.ts +0 -2
  709. package/dist/src/migrations/update-16-0-0/update-depends-on-to-tokens.js +0 -82
  710. package/dist/src/migrations/update-16-0-0/update-nx-cloud-runner.d.ts +0 -2
  711. package/dist/src/migrations/update-16-0-0/update-nx-cloud-runner.js +0 -29
  712. package/dist/src/migrations/update-16-2-0/remove-run-commands-output-path.d.ts +0 -2
  713. package/dist/src/migrations/update-16-2-0/remove-run-commands-output-path.js +0 -50
  714. package/dist/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.d.ts +0 -12
  715. package/dist/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.js +0 -67
  716. package/dist/src/migrations/update-17-0-0/move-cache-directory.d.ts +0 -2
  717. package/dist/src/migrations/update-17-0-0/move-cache-directory.js +0 -35
  718. package/dist/src/migrations/update-17-0-0/move-cache-directory.md +0 -31
  719. package/dist/src/migrations/update-17-0-0/rm-default-collection-npm-scope.d.ts +0 -2
  720. package/dist/src/migrations/update-17-0-0/rm-default-collection-npm-scope.js +0 -72
  721. package/dist/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.d.ts +0 -2
  722. package/dist/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.js +0 -126
  723. package/dist/src/migrations/update-17-2-0/move-default-base.d.ts +0 -5
  724. package/dist/src/migrations/update-17-2-0/move-default-base.js +0 -20
  725. package/dist/src/migrations/update-17-3-0/update-nxw.d.ts +0 -2
  726. package/dist/src/migrations/update-17-3-0/update-nxw.js +0 -7
  727. package/dist/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.d.ts +0 -2
  728. package/dist/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.js +0 -11
  729. package/dist/src/migrations/update-19-2-0/move-workspace-data-directory.d.ts +0 -4
  730. package/dist/src/migrations/update-19-2-0/move-workspace-data-directory.js +0 -33
  731. package/dist/src/migrations/update-19-2-4/set-project-name.d.ts +0 -2
  732. package/dist/src/migrations/update-19-2-4/set-project-name.js +0 -34
  733. package/dist/src/migrations/update-20-0-0/move-use-daemon-process.d.ts +0 -2
  734. package/dist/src/migrations/update-20-0-0/move-use-daemon-process.js +0 -25
  735. package/dist/src/migrations/update-20-0-0/move-use-daemon-process.md +0 -27
  736. package/dist/src/migrations/update-20-0-1/use-legacy-cache.d.ts +0 -2
  737. package/dist/src/migrations/update-20-0-1/use-legacy-cache.js +0 -20
  738. package/dist/src/migrations/update-20-0-1/use-legacy-cache.md +0 -24
  739. package/dist/src/migrations/update-21-0-0/release-changelog-config-changes.d.ts +0 -2
  740. package/dist/src/migrations/update-21-0-0/release-changelog-config-changes.js +0 -38
  741. package/dist/src/migrations/update-21-0-0/release-changelog-config-changes.md +0 -49
  742. package/dist/src/migrations/update-21-0-0/release-version-config-changes.d.ts +0 -2
  743. package/dist/src/migrations/update-21-0-0/release-version-config-changes.js +0 -101
  744. package/dist/src/migrations/update-21-0-0/release-version-config-changes.md +0 -54
  745. package/dist/src/migrations/update-21-0-0/remove-custom-tasks-runner.d.ts +0 -2
  746. package/dist/src/migrations/update-21-0-0/remove-custom-tasks-runner.js +0 -38
  747. package/dist/src/migrations/update-21-0-0/remove-custom-tasks-runner.md +0 -28
  748. package/dist/src/migrations/update-21-0-0/remove-legacy-cache.d.ts +0 -2
  749. package/dist/src/migrations/update-21-0-0/remove-legacy-cache.js +0 -17
  750. package/dist/src/migrations/update-21-0-0/remove-legacy-cache.md +0 -22
  751. package/dist/src/migrations/update-22-0-0/consolidate-release-tag-config.d.ts +0 -2
  752. package/dist/src/migrations/update-22-0-0/consolidate-release-tag-config.js +0 -100
  753. package/dist/src/migrations/update-22-0-0/release-version-config-changes.d.ts +0 -2
  754. package/dist/src/migrations/update-22-0-0/release-version-config-changes.js +0 -101
  755. package/dist/src/migrations/update-22-1-0/update-nx-wrapper.d.ts +0 -2
  756. package/dist/src/migrations/update-22-1-0/update-nx-wrapper.js +0 -7
  757. package/dist/src/migrations/update-22-2-0/add-self-healing-to-gitignore.d.ts +0 -2
  758. package/dist/src/migrations/update-22-2-0/add-self-healing-to-gitignore.js +0 -19
  759. package/dist/src/migrations/update-22-2-0/add-self-healing-to-gitignore.md +0 -11
  760. package/dist/src/migrations/update-22-6-0/add-claude-settings-local-to-git-ignore.d.ts +0 -2
  761. package/dist/src/migrations/update-22-6-0/add-claude-settings-local-to-git-ignore.js +0 -16
  762. package/dist/src/migrations/update-22-6-0/add-claude-worktrees-to-git-ignore.d.ts +0 -2
  763. package/dist/src/migrations/update-22-6-0/add-claude-worktrees-to-git-ignore.js +0 -16
  764. package/dist/src/migrations/update-22-6-0/enable-analytics-prompt.d.ts +0 -2
  765. package/dist/src/migrations/update-22-6-0/enable-analytics-prompt.js +0 -23
  766. package/dist/src/migrations/update-22-7-0/add-polygraph-to-git-ignore.d.ts +0 -2
  767. package/dist/src/migrations/update-22-7-0/add-polygraph-to-git-ignore.js +0 -16
  768. package/dist/src/migrations/update-23-0-0/add-migrate-runs-to-git-ignore.d.ts +0 -2
  769. package/dist/src/migrations/update-23-0-0/add-migrate-runs-to-git-ignore.js +0 -16
  770. package/dist/src/migrations/update-23-0-0/consolidate-release-tag-config.d.ts +0 -9
  771. package/dist/src/migrations/update-23-0-0/consolidate-release-tag-config.js +0 -18
  772. package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.d.ts +0 -12
  773. package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.js +0 -250
  774. package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.md +0 -50
  775. package/dist/src/migrations/utils/target-defaults.d.ts +0 -28
  776. package/dist/src/migrations/utils/target-defaults.js +0 -46
  777. package/dist/src/native/assert-supported-platform.d.ts +0 -1
  778. package/dist/src/native/assert-supported-platform.js +0 -39
  779. package/dist/src/native/browser.js +0 -1
  780. package/dist/src/native/index.d.ts +0 -858
  781. package/dist/src/native/index.js +0 -222
  782. package/dist/src/native/native-bindings.js +0 -642
  783. package/dist/src/native/native-file-cache-location.d.ts +0 -17
  784. package/dist/src/native/native-file-cache-location.js +0 -97
  785. package/dist/src/native/nx.openharmony-arm64.node +0 -0
  786. package/dist/src/native/nx.wasi-browser.js +0 -131
  787. package/dist/src/native/nx.wasi.cjs +0 -161
  788. package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
  789. package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
  790. package/dist/src/native/transform-objects.d.ts +0 -3
  791. package/dist/src/native/transform-objects.js +0 -51
  792. package/dist/src/native/wasi-worker-browser.mjs +0 -30
  793. package/dist/src/native/wasi-worker.mjs +0 -63
  794. package/dist/src/nx-cloud/debug-logger.d.ts +0 -1
  795. package/dist/src/nx-cloud/debug-logger.js +0 -8
  796. package/dist/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.d.ts +0 -14
  797. package/dist/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +0 -159
  798. package/dist/src/nx-cloud/generators/connect-to-nx-cloud/schema.json +0 -41
  799. package/dist/src/nx-cloud/models/onboarding-status.d.ts +0 -1
  800. package/dist/src/nx-cloud/models/onboarding-status.js +0 -2
  801. package/dist/src/nx-cloud/nx-cloud-tasks-runner-shell.d.ts +0 -16
  802. package/dist/src/nx-cloud/nx-cloud-tasks-runner-shell.js +0 -41
  803. package/dist/src/nx-cloud/resolution-helpers.d.ts +0 -1
  804. package/dist/src/nx-cloud/resolution-helpers.js +0 -19
  805. package/dist/src/nx-cloud/update-manager.d.ts +0 -23
  806. package/dist/src/nx-cloud/update-manager.js +0 -267
  807. package/dist/src/nx-cloud/utilities/axios.d.ts +0 -4
  808. package/dist/src/nx-cloud/utilities/axios.js +0 -17
  809. package/dist/src/nx-cloud/utilities/client.d.ts +0 -10
  810. package/dist/src/nx-cloud/utilities/client.js +0 -42
  811. package/dist/src/nx-cloud/utilities/environment.d.ts +0 -3
  812. package/dist/src/nx-cloud/utilities/environment.js +0 -48
  813. package/dist/src/nx-cloud/utilities/get-cloud-options.d.ts +0 -5
  814. package/dist/src/nx-cloud/utilities/get-cloud-options.js +0 -26
  815. package/dist/src/nx-cloud/utilities/is-workspace-claimed.d.ts +0 -1
  816. package/dist/src/nx-cloud/utilities/is-workspace-claimed.js +0 -25
  817. package/dist/src/nx-cloud/utilities/onboarding.d.ts +0 -5
  818. package/dist/src/nx-cloud/utilities/onboarding.js +0 -31
  819. package/dist/src/nx-cloud/utilities/url-shorten.d.ts +0 -2
  820. package/dist/src/nx-cloud/utilities/url-shorten.js +0 -85
  821. package/dist/src/plugins/js/hasher/hasher.d.ts +0 -5
  822. package/dist/src/plugins/js/hasher/hasher.js +0 -51
  823. package/dist/src/plugins/js/index.d.ts +0 -4
  824. package/dist/src/plugins/js/index.js +0 -201
  825. package/dist/src/plugins/js/lock-file/bun-parser.d.ts +0 -14
  826. package/dist/src/plugins/js/lock-file/bun-parser.js +0 -992
  827. package/dist/src/plugins/js/lock-file/lock-file.d.ts +0 -85
  828. package/dist/src/plugins/js/lock-file/lock-file.js +0 -442
  829. package/dist/src/plugins/js/lock-file/npm-parser.d.ts +0 -10
  830. package/dist/src/plugins/js/lock-file/npm-parser.js +0 -595
  831. package/dist/src/plugins/js/lock-file/pnpm-parser.d.ts +0 -10
  832. package/dist/src/plugins/js/lock-file/pnpm-parser.js +0 -1047
  833. package/dist/src/plugins/js/lock-file/project-graph-pruning.d.ts +0 -35
  834. package/dist/src/plugins/js/lock-file/project-graph-pruning.js +0 -290
  835. package/dist/src/plugins/js/lock-file/pruned-output.d.ts +0 -330
  836. package/dist/src/plugins/js/lock-file/pruned-output.js +0 -1441
  837. package/dist/src/plugins/js/lock-file/utils/package-json.d.ts +0 -10
  838. package/dist/src/plugins/js/lock-file/utils/package-json.js +0 -38
  839. package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.d.ts +0 -21
  840. package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.js +0 -875
  841. package/dist/src/plugins/js/lock-file/yarn-parser.d.ts +0 -10
  842. package/dist/src/plugins/js/lock-file/yarn-parser.js +0 -536
  843. package/dist/src/plugins/js/package-json/create-package-json.d.ts +0 -29
  844. package/dist/src/plugins/js/package-json/create-package-json.js +0 -312
  845. package/dist/src/plugins/js/project-graph/affected/lock-file-changes.d.ts +0 -3
  846. package/dist/src/plugins/js/project-graph/affected/lock-file-changes.js +0 -150
  847. package/dist/src/plugins/js/project-graph/affected/npm-packages.d.ts +0 -4
  848. package/dist/src/plugins/js/project-graph/affected/npm-packages.js +0 -124
  849. package/dist/src/plugins/js/project-graph/affected/touched-projects.d.ts +0 -2
  850. package/dist/src/plugins/js/project-graph/affected/touched-projects.js +0 -18
  851. package/dist/src/plugins/js/project-graph/affected/tsconfig-json-changes.d.ts +0 -4
  852. package/dist/src/plugins/js/project-graph/affected/tsconfig-json-changes.js +0 -63
  853. package/dist/src/plugins/js/project-graph/build-dependencies/build-dependencies.d.ts +0 -6
  854. package/dist/src/plugins/js/project-graph/build-dependencies/build-dependencies.js +0 -45
  855. package/dist/src/plugins/js/project-graph/build-dependencies/explicit-package-json-dependencies.d.ts +0 -4
  856. package/dist/src/plugins/js/project-graph/build-dependencies/explicit-package-json-dependencies.js +0 -88
  857. package/dist/src/plugins/js/project-graph/build-dependencies/explicit-project-dependencies.d.ts +0 -4
  858. package/dist/src/plugins/js/project-graph/build-dependencies/explicit-project-dependencies.js +0 -75
  859. package/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.d.ts +0 -81
  860. package/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +0 -464
  861. package/dist/src/plugins/js/project-graph/build-nodes/build-npm-package-nodes.d.ts +0 -2
  862. package/dist/src/plugins/js/project-graph/build-nodes/build-npm-package-nodes.js +0 -31
  863. package/dist/src/plugins/js/utils/config.d.ts +0 -2
  864. package/dist/src/plugins/js/utils/config.js +0 -61
  865. package/dist/src/plugins/js/utils/get-workspace-packages-from-graph.d.ts +0 -2
  866. package/dist/src/plugins/js/utils/get-workspace-packages-from-graph.js +0 -13
  867. package/dist/src/plugins/js/utils/packages.d.ts +0 -8
  868. package/dist/src/plugins/js/utils/packages.js +0 -91
  869. package/dist/src/plugins/js/utils/register.d.ts +0 -350
  870. package/dist/src/plugins/js/utils/register.js +0 -1270
  871. package/dist/src/plugins/js/utils/resolve-relative-to-dir.d.ts +0 -5
  872. package/dist/src/plugins/js/utils/resolve-relative-to-dir.js +0 -17
  873. package/dist/src/plugins/js/utils/typescript.d.ts +0 -32
  874. package/dist/src/plugins/js/utils/typescript.js +0 -157
  875. package/dist/src/plugins/js/versions.d.ts +0 -1
  876. package/dist/src/plugins/js/versions.js +0 -4
  877. package/dist/src/plugins/package-json/create-nodes.d.ts +0 -28
  878. package/dist/src/plugins/package-json/create-nodes.js +0 -243
  879. package/dist/src/plugins/package-json/index.d.ts +0 -2
  880. package/dist/src/plugins/package-json/index.js +0 -6
  881. package/dist/src/plugins/project-json/build-nodes/project-json.d.ts +0 -5
  882. package/dist/src/plugins/project-json/build-nodes/project-json.js +0 -33
  883. package/dist/src/project-graph/affected/affected-project-graph-models.d.ts +0 -11
  884. package/dist/src/project-graph/affected/affected-project-graph-models.js +0 -2
  885. package/dist/src/project-graph/affected/affected-project-graph.d.ts +0 -4
  886. package/dist/src/project-graph/affected/affected-project-graph.js +0 -90
  887. package/dist/src/project-graph/affected/locators/project-glob-changes.d.ts +0 -2
  888. package/dist/src/project-graph/affected/locators/project-glob-changes.js +0 -47
  889. package/dist/src/project-graph/affected/locators/workspace-json-changes.d.ts +0 -4
  890. package/dist/src/project-graph/affected/locators/workspace-json-changes.js +0 -47
  891. package/dist/src/project-graph/affected/locators/workspace-projects.d.ts +0 -3
  892. package/dist/src/project-graph/affected/locators/workspace-projects.js +0 -74
  893. package/dist/src/project-graph/build-project-graph.d.ts +0 -26
  894. package/dist/src/project-graph/build-project-graph.js +0 -309
  895. package/dist/src/project-graph/error-types.d.ts +0 -151
  896. package/dist/src/project-graph/error-types.js +0 -484
  897. package/dist/src/project-graph/file-map-utils.d.ts +0 -18
  898. package/dist/src/project-graph/file-map-utils.js +0 -61
  899. package/dist/src/project-graph/file-utils.d.ts +0 -31
  900. package/dist/src/project-graph/file-utils.js +0 -187
  901. package/dist/src/project-graph/nx-deps-cache.d.ts +0 -62
  902. package/dist/src/project-graph/nx-deps-cache.js +0 -345
  903. package/dist/src/project-graph/operators.d.ts +0 -11
  904. package/dist/src/project-graph/operators.js +0 -70
  905. package/dist/src/project-graph/plugins/get-plugins.d.ts +0 -51
  906. package/dist/src/project-graph/plugins/get-plugins.js +0 -401
  907. package/dist/src/project-graph/plugins/in-process-loader.d.ts +0 -10
  908. package/dist/src/project-graph/plugins/in-process-loader.js +0 -61
  909. package/dist/src/project-graph/plugins/index.d.ts +0 -4
  910. package/dist/src/project-graph/plugins/index.js +0 -12
  911. package/dist/src/project-graph/plugins/isolation/enabled.d.ts +0 -1
  912. package/dist/src/project-graph/plugins/isolation/enabled.js +0 -19
  913. package/dist/src/project-graph/plugins/isolation/index.d.ts +0 -1
  914. package/dist/src/project-graph/plugins/isolation/index.js +0 -5
  915. package/dist/src/project-graph/plugins/isolation/isolated-plugin.d.ts +0 -79
  916. package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +0 -553
  917. package/dist/src/project-graph/plugins/isolation/load-isolated-plugin.d.ts +0 -3
  918. package/dist/src/project-graph/plugins/isolation/load-isolated-plugin.js +0 -24
  919. package/dist/src/project-graph/plugins/isolation/message-types.d.ts +0 -59
  920. package/dist/src/project-graph/plugins/isolation/message-types.js +0 -9
  921. package/dist/src/project-graph/plugins/isolation/messaging.d.ts +0 -155
  922. package/dist/src/project-graph/plugins/isolation/messaging.js +0 -87
  923. package/dist/src/project-graph/plugins/isolation/plugin-lifecycle-manager.d.ts +0 -82
  924. package/dist/src/project-graph/plugins/isolation/plugin-lifecycle-manager.js +0 -188
  925. package/dist/src/project-graph/plugins/isolation/plugin-worker.d.ts +0 -2
  926. package/dist/src/project-graph/plugins/isolation/plugin-worker.js +0 -221
  927. package/dist/src/project-graph/plugins/isolation/worker-streaming.d.ts +0 -14
  928. package/dist/src/project-graph/plugins/isolation/worker-streaming.js +0 -39
  929. package/dist/src/project-graph/plugins/load-resolved-plugin.d.ts +0 -3
  930. package/dist/src/project-graph/plugins/load-resolved-plugin.js +0 -24
  931. package/dist/src/project-graph/plugins/loaded-nx-plugin.d.ts +0 -41
  932. package/dist/src/project-graph/plugins/loaded-nx-plugin.js +0 -104
  933. package/dist/src/project-graph/plugins/public-api.d.ts +0 -139
  934. package/dist/src/project-graph/plugins/public-api.js +0 -4
  935. package/dist/src/project-graph/plugins/resolve-plugin.d.ts +0 -25
  936. package/dist/src/project-graph/plugins/resolve-plugin.js +0 -277
  937. package/dist/src/project-graph/plugins/tasks-execution-hooks.d.ts +0 -3
  938. package/dist/src/project-graph/plugins/tasks-execution-hooks.js +0 -67
  939. package/dist/src/project-graph/plugins/transpiler.d.ts +0 -20
  940. package/dist/src/project-graph/plugins/transpiler.js +0 -99
  941. package/dist/src/project-graph/plugins/utils.d.ts +0 -4
  942. package/dist/src/project-graph/plugins/utils.js +0 -32
  943. package/dist/src/project-graph/project-graph-builder.d.ts +0 -133
  944. package/dist/src/project-graph/project-graph-builder.js +0 -395
  945. package/dist/src/project-graph/project-graph.d.ts +0 -54
  946. package/dist/src/project-graph/project-graph.js +0 -460
  947. package/dist/src/project-graph/utils/build-all-workspace-files.d.ts +0 -2
  948. package/dist/src/project-graph/utils/build-all-workspace-files.js +0 -14
  949. package/dist/src/project-graph/utils/find-project-for-path.d.ts +0 -20
  950. package/dist/src/project-graph/utils/find-project-for-path.js +0 -55
  951. package/dist/src/project-graph/utils/implicit-project-dependencies.d.ts +0 -3
  952. package/dist/src/project-graph/utils/implicit-project-dependencies.js +0 -18
  953. package/dist/src/project-graph/utils/normalize-project-nodes.d.ts +0 -6
  954. package/dist/src/project-graph/utils/normalize-project-nodes.js +0 -117
  955. package/dist/src/project-graph/utils/project-configuration/name-substitution-manager.d.ts +0 -48
  956. package/dist/src/project-graph/utils/project-configuration/name-substitution-manager.js +0 -270
  957. package/dist/src/project-graph/utils/project-configuration/project-nodes-manager.d.ts +0 -49
  958. package/dist/src/project-graph/utils/project-configuration/project-nodes-manager.js +0 -296
  959. package/dist/src/project-graph/utils/project-configuration/source-maps.d.ts +0 -34
  960. package/dist/src/project-graph/utils/project-configuration/source-maps.js +0 -85
  961. package/dist/src/project-graph/utils/project-configuration/target-defaults.d.ts +0 -50
  962. package/dist/src/project-graph/utils/project-configuration/target-defaults.js +0 -466
  963. package/dist/src/project-graph/utils/project-configuration/target-merging.d.ts +0 -32
  964. package/dist/src/project-graph/utils/project-configuration/target-merging.js +0 -507
  965. package/dist/src/project-graph/utils/project-configuration/target-normalization.d.ts +0 -12
  966. package/dist/src/project-graph/utils/project-configuration/target-normalization.js +0 -313
  967. package/dist/src/project-graph/utils/project-configuration/utils.d.ts +0 -38
  968. package/dist/src/project-graph/utils/project-configuration/utils.js +0 -215
  969. package/dist/src/project-graph/utils/project-configuration-utils.d.ts +0 -86
  970. package/dist/src/project-graph/utils/project-configuration-utils.js +0 -325
  971. package/dist/src/project-graph/utils/retrieve-workspace-files.d.ts +0 -35
  972. package/dist/src/project-graph/utils/retrieve-workspace-files.js +0 -110
  973. package/dist/src/tasks-runner/batch/batch-messages.d.ts +0 -35
  974. package/dist/src/tasks-runner/batch/batch-messages.js +0 -9
  975. package/dist/src/tasks-runner/batch/run-batch.d.ts +0 -1
  976. package/dist/src/tasks-runner/batch/run-batch.js +0 -78
  977. package/dist/src/tasks-runner/cache.d.ts +0 -94
  978. package/dist/src/tasks-runner/cache.js +0 -604
  979. package/dist/src/tasks-runner/create-task-graph.d.ts +0 -41
  980. package/dist/src/tasks-runner/create-task-graph.js +0 -305
  981. package/dist/src/tasks-runner/default-tasks-runner.d.ts +0 -25
  982. package/dist/src/tasks-runner/default-tasks-runner.js +0 -74
  983. package/dist/src/tasks-runner/fork.d.ts +0 -1
  984. package/dist/src/tasks-runner/fork.js +0 -73
  985. package/dist/src/tasks-runner/forked-process-task-runner.d.ts +0 -42
  986. package/dist/src/tasks-runner/forked-process-task-runner.js +0 -299
  987. package/dist/src/tasks-runner/init-tasks-runner.d.ts +0 -7
  988. package/dist/src/tasks-runner/init-tasks-runner.js +0 -86
  989. package/dist/src/tasks-runner/is-tui-enabled.d.ts +0 -18
  990. package/dist/src/tasks-runner/is-tui-enabled.js +0 -93
  991. package/dist/src/tasks-runner/legacy-depends-on-warning.d.ts +0 -18
  992. package/dist/src/tasks-runner/legacy-depends-on-warning.js +0 -109
  993. package/dist/src/tasks-runner/life-cycle.d.ts +0 -86
  994. package/dist/src/tasks-runner/life-cycle.js +0 -148
  995. package/dist/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.d.ts +0 -25
  996. package/dist/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.js +0 -366
  997. package/dist/src/tasks-runner/life-cycles/dynamic-run-one-terminal-output-life-cycle.d.ts +0 -24
  998. package/dist/src/tasks-runner/life-cycles/dynamic-run-one-terminal-output-life-cycle.js +0 -238
  999. package/dist/src/tasks-runner/life-cycles/empty-terminal-output-life-cycle.d.ts +0 -5
  1000. package/dist/src/tasks-runner/life-cycles/empty-terminal-output-life-cycle.js +0 -16
  1001. package/dist/src/tasks-runner/life-cycles/formatting-utils.d.ts +0 -3
  1002. package/dist/src/tasks-runner/life-cycles/formatting-utils.js +0 -55
  1003. package/dist/src/tasks-runner/life-cycles/invoke-runner-terminal-output-life-cycle.d.ts +0 -13
  1004. package/dist/src/tasks-runner/life-cycles/invoke-runner-terminal-output-life-cycle.js +0 -67
  1005. package/dist/src/tasks-runner/life-cycles/performance-analysis.d.ts +0 -173
  1006. package/dist/src/tasks-runner/life-cycles/performance-analysis.js +0 -508
  1007. package/dist/src/tasks-runner/life-cycles/performance-life-cycle.d.ts +0 -59
  1008. package/dist/src/tasks-runner/life-cycles/performance-life-cycle.js +0 -193
  1009. package/dist/src/tasks-runner/life-cycles/performance-report.d.ts +0 -77
  1010. package/dist/src/tasks-runner/life-cycles/performance-report.js +0 -428
  1011. package/dist/src/tasks-runner/life-cycles/pretty-time.d.ts +0 -4
  1012. package/dist/src/tasks-runner/life-cycles/pretty-time.js +0 -73
  1013. package/dist/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.d.ts +0 -54
  1014. package/dist/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.js +0 -203
  1015. package/dist/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.d.ts +0 -54
  1016. package/dist/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.js +0 -193
  1017. package/dist/src/tasks-runner/life-cycles/store-run-information-life-cycle.d.ts +0 -17
  1018. package/dist/src/tasks-runner/life-cycles/store-run-information-life-cycle.js +0 -87
  1019. package/dist/src/tasks-runner/life-cycles/task-history-life-cycle-old.d.ts +0 -11
  1020. package/dist/src/tasks-runner/life-cycles/task-history-life-cycle-old.js +0 -91
  1021. package/dist/src/tasks-runner/life-cycles/task-history-life-cycle.d.ts +0 -16
  1022. package/dist/src/tasks-runner/life-cycles/task-history-life-cycle.js +0 -112
  1023. package/dist/src/tasks-runner/life-cycles/task-profiling-life-cycle.d.ts +0 -14
  1024. package/dist/src/tasks-runner/life-cycles/task-profiling-life-cycle.js +0 -73
  1025. package/dist/src/tasks-runner/life-cycles/task-results-life-cycle.d.ts +0 -6
  1026. package/dist/src/tasks-runner/life-cycles/task-results-life-cycle.js +0 -17
  1027. package/dist/src/tasks-runner/life-cycles/task-telemetry-life-cycle.d.ts +0 -9
  1028. package/dist/src/tasks-runner/life-cycles/task-telemetry-life-cycle.js +0 -42
  1029. package/dist/src/tasks-runner/life-cycles/task-timings-life-cycle.d.ts +0 -8
  1030. package/dist/src/tasks-runner/life-cycles/task-timings-life-cycle.js +0 -39
  1031. package/dist/src/tasks-runner/life-cycles/tui-summary-life-cycle.d.ts +0 -19
  1032. package/dist/src/tasks-runner/life-cycles/tui-summary-life-cycle.js +0 -339
  1033. package/dist/src/tasks-runner/life-cycles/view-logs-utils.d.ts +0 -1
  1034. package/dist/src/tasks-runner/life-cycles/view-logs-utils.js +0 -15
  1035. package/dist/src/tasks-runner/process-metrics-service.d.ts +0 -53
  1036. package/dist/src/tasks-runner/process-metrics-service.js +0 -161
  1037. package/dist/src/tasks-runner/pseudo-ipc.d.ts +0 -48
  1038. package/dist/src/tasks-runner/pseudo-ipc.js +0 -157
  1039. package/dist/src/tasks-runner/pseudo-terminal.d.ts +0 -72
  1040. package/dist/src/tasks-runner/pseudo-terminal.js +0 -209
  1041. package/dist/src/tasks-runner/remove-old-cache-records.d.ts +0 -1
  1042. package/dist/src/tasks-runner/remove-old-cache-records.js +0 -60
  1043. package/dist/src/tasks-runner/run-command.d.ts +0 -42
  1044. package/dist/src/tasks-runner/run-command.js +0 -895
  1045. package/dist/src/tasks-runner/running-tasks/batch-process.d.ts +0 -74
  1046. package/dist/src/tasks-runner/running-tasks/batch-process.js +0 -263
  1047. package/dist/src/tasks-runner/running-tasks/node-child-process.d.ts +0 -40
  1048. package/dist/src/tasks-runner/running-tasks/node-child-process.js +0 -175
  1049. package/dist/src/tasks-runner/running-tasks/noop-child-process.d.ts +0 -16
  1050. package/dist/src/tasks-runner/running-tasks/noop-child-process.js +0 -22
  1051. package/dist/src/tasks-runner/running-tasks/output-prefix.d.ts +0 -13
  1052. package/dist/src/tasks-runner/running-tasks/output-prefix.js +0 -63
  1053. package/dist/src/tasks-runner/running-tasks/running-task.d.ts +0 -11
  1054. package/dist/src/tasks-runner/running-tasks/running-task.js +0 -6
  1055. package/dist/src/tasks-runner/running-tasks/shared-running-task.d.ts +0 -14
  1056. package/dist/src/tasks-runner/running-tasks/shared-running-task.js +0 -30
  1057. package/dist/src/tasks-runner/task-env-paths.d.ts +0 -1
  1058. package/dist/src/tasks-runner/task-env-paths.js +0 -45
  1059. package/dist/src/tasks-runner/task-env.d.ts +0 -56
  1060. package/dist/src/tasks-runner/task-env.js +0 -237
  1061. package/dist/src/tasks-runner/task-graph-utils.d.ts +0 -30
  1062. package/dist/src/tasks-runner/task-graph-utils.js +0 -225
  1063. package/dist/src/tasks-runner/task-io-service.d.ts +0 -96
  1064. package/dist/src/tasks-runner/task-io-service.js +0 -122
  1065. package/dist/src/tasks-runner/task-orchestrator.d.ts +0 -260
  1066. package/dist/src/tasks-runner/task-orchestrator.js +0 -1521
  1067. package/dist/src/tasks-runner/tasks-runner.d.ts +0 -24
  1068. package/dist/src/tasks-runner/tasks-runner.js +0 -2
  1069. package/dist/src/tasks-runner/tasks-schedule.d.ts +0 -48
  1070. package/dist/src/tasks-runner/tasks-schedule.js +0 -258
  1071. package/dist/src/tasks-runner/utils.d.ts +0 -61
  1072. package/dist/src/tasks-runner/utils.js +0 -447
  1073. package/dist/src/utils/ab-testing.d.ts +0 -59
  1074. package/dist/src/utils/ab-testing.js +0 -142
  1075. package/dist/src/utils/acknowledge-build-scripts.d.ts +0 -13
  1076. package/dist/src/utils/acknowledge-build-scripts.js +0 -102
  1077. package/dist/src/utils/all-file-data.d.ts +0 -2
  1078. package/dist/src/utils/all-file-data.js +0 -8
  1079. package/dist/src/utils/analytics-enabled.d.ts +0 -7
  1080. package/dist/src/utils/analytics-enabled.js +0 -11
  1081. package/dist/src/utils/analytics-prompt.d.ts +0 -9
  1082. package/dist/src/utils/analytics-prompt.js +0 -81
  1083. package/dist/src/utils/assert-workspace-validity.d.ts +0 -3
  1084. package/dist/src/utils/assert-workspace-validity.js +0 -90
  1085. package/dist/src/utils/async-iterator.d.ts +0 -2
  1086. package/dist/src/utils/async-iterator.js +0 -18
  1087. package/dist/src/utils/binary-extensions.d.ts +0 -1
  1088. package/dist/src/utils/binary-extensions.js +0 -279
  1089. package/dist/src/utils/cache-directory.d.ts +0 -68
  1090. package/dist/src/utils/cache-directory.js +0 -337
  1091. package/dist/src/utils/call-sites.d.ts +0 -14
  1092. package/dist/src/utils/call-sites.js +0 -28
  1093. package/dist/src/utils/catalog/bun-manager-utils.d.ts +0 -8
  1094. package/dist/src/utils/catalog/bun-manager-utils.js +0 -174
  1095. package/dist/src/utils/catalog/bun-manager.d.ts +0 -28
  1096. package/dist/src/utils/catalog/bun-manager.js +0 -130
  1097. package/dist/src/utils/catalog/index.d.ts +0 -22
  1098. package/dist/src/utils/catalog/index.js +0 -87
  1099. package/dist/src/utils/catalog/manager-factory.d.ts +0 -5
  1100. package/dist/src/utils/catalog/manager-factory.js +0 -23
  1101. package/dist/src/utils/catalog/manager-utils.d.ts +0 -15
  1102. package/dist/src/utils/catalog/manager-utils.js +0 -237
  1103. package/dist/src/utils/catalog/manager.d.ts +0 -52
  1104. package/dist/src/utils/catalog/manager.js +0 -43
  1105. package/dist/src/utils/catalog/pnpm-manager.d.ts +0 -23
  1106. package/dist/src/utils/catalog/pnpm-manager.js +0 -142
  1107. package/dist/src/utils/catalog/types.d.ts +0 -15
  1108. package/dist/src/utils/catalog/types.js +0 -2
  1109. package/dist/src/utils/catalog/yarn-manager.d.ts +0 -26
  1110. package/dist/src/utils/catalog/yarn-manager.js +0 -130
  1111. package/dist/src/utils/child-process.d.ts +0 -52
  1112. package/dist/src/utils/child-process.js +0 -194
  1113. package/dist/src/utils/chunkify.d.ts +0 -17
  1114. package/dist/src/utils/chunkify.js +0 -51
  1115. package/dist/src/utils/code-frames.d.ts +0 -14
  1116. package/dist/src/utils/code-frames.js +0 -116
  1117. package/dist/src/utils/collapse-expanded-outputs.d.ts +0 -10
  1118. package/dist/src/utils/collapse-expanded-outputs.js +0 -72
  1119. package/dist/src/utils/command-line-utils.d.ts +0 -57
  1120. package/dist/src/utils/command-line-utils.js +0 -259
  1121. package/dist/src/utils/compile-cache.d.ts +0 -24
  1122. package/dist/src/utils/compile-cache.js +0 -49
  1123. package/dist/src/utils/consume-messages-from-socket.d.ts +0 -44
  1124. package/dist/src/utils/consume-messages-from-socket.js +0 -291
  1125. package/dist/src/utils/db-connection.d.ts +0 -14
  1126. package/dist/src/utils/db-connection.js +0 -56
  1127. package/dist/src/utils/default-base.d.ts +0 -1
  1128. package/dist/src/utils/default-base.js +0 -17
  1129. package/dist/src/utils/delayed-spinner.d.ts +0 -51
  1130. package/dist/src/utils/delayed-spinner.js +0 -88
  1131. package/dist/src/utils/dotenv.d.ts +0 -7
  1132. package/dist/src/utils/dotenv.js +0 -19
  1133. package/dist/src/utils/enable-compile-cache.d.ts +0 -1
  1134. package/dist/src/utils/enable-compile-cache.js +0 -7
  1135. package/dist/src/utils/exit-codes.d.ts +0 -24
  1136. package/dist/src/utils/exit-codes.js +0 -94
  1137. package/dist/src/utils/fileutils.d.ts +0 -72
  1138. package/dist/src/utils/fileutils.js +0 -117
  1139. package/dist/src/utils/find-matching-projects.d.ts +0 -18
  1140. package/dist/src/utils/find-matching-projects.js +0 -222
  1141. package/dist/src/utils/find-workspace-root.d.ts +0 -11
  1142. package/dist/src/utils/find-workspace-root.js +0 -33
  1143. package/dist/src/utils/formatters/index.d.ts +0 -13
  1144. package/dist/src/utils/formatters/index.js +0 -74
  1145. package/dist/src/utils/formatters/oxfmt.d.ts +0 -32
  1146. package/dist/src/utils/formatters/oxfmt.js +0 -764
  1147. package/dist/src/utils/formatters/prettier.d.ts +0 -26
  1148. package/dist/src/utils/formatters/prettier.js +0 -201
  1149. package/dist/src/utils/formatters/shared.d.ts +0 -5
  1150. package/dist/src/utils/formatters/shared.js +0 -8
  1151. package/dist/src/utils/get-package-name-from-import-path.d.ts +0 -1
  1152. package/dist/src/utils/get-package-name-from-import-path.js +0 -17
  1153. package/dist/src/utils/git-revision.d.ts +0 -12
  1154. package/dist/src/utils/git-revision.js +0 -25
  1155. package/dist/src/utils/git-utils.d.ts +0 -106
  1156. package/dist/src/utils/git-utils.index-filter.d.ts +0 -1
  1157. package/dist/src/utils/git-utils.index-filter.js +0 -23
  1158. package/dist/src/utils/git-utils.js +0 -933
  1159. package/dist/src/utils/git-utils.tree-filter.d.ts +0 -1
  1160. package/dist/src/utils/git-utils.tree-filter.js +0 -47
  1161. package/dist/src/utils/git-worktrees.d.ts +0 -30
  1162. package/dist/src/utils/git-worktrees.js +0 -212
  1163. package/dist/src/utils/globs.d.ts +0 -3
  1164. package/dist/src/utils/globs.js +0 -18
  1165. package/dist/src/utils/handle-errors.d.ts +0 -1
  1166. package/dist/src/utils/handle-errors.js +0 -91
  1167. package/dist/src/utils/handle-import.d.ts +0 -15
  1168. package/dist/src/utils/handle-import.js +0 -86
  1169. package/dist/src/utils/has-nx-js-plugin.d.ts +0 -9
  1170. package/dist/src/utils/has-nx-js-plugin.js +0 -24
  1171. package/dist/src/utils/ignore.d.ts +0 -178
  1172. package/dist/src/utils/ignore.js +0 -294
  1173. package/dist/src/utils/installation-directory.d.ts +0 -2
  1174. package/dist/src/utils/installation-directory.js +0 -12
  1175. package/dist/src/utils/installed-nx-version.d.ts +0 -23
  1176. package/dist/src/utils/installed-nx-version.js +0 -113
  1177. package/dist/src/utils/is-ci.d.ts +0 -1
  1178. package/dist/src/utils/is-ci.js +0 -26
  1179. package/dist/src/utils/is-sandbox.d.ts +0 -1
  1180. package/dist/src/utils/is-sandbox.js +0 -11
  1181. package/dist/src/utils/json-diff.d.ts +0 -18
  1182. package/dist/src/utils/json-diff.js +0 -112
  1183. package/dist/src/utils/json.d.ts +0 -44
  1184. package/dist/src/utils/json.js +0 -62
  1185. package/dist/src/utils/kill-child-on-host-exit.d.ts +0 -7
  1186. package/dist/src/utils/kill-child-on-host-exit.js +0 -42
  1187. package/dist/src/utils/legacy-task-history.d.ts +0 -8
  1188. package/dist/src/utils/legacy-task-history.js +0 -87
  1189. package/dist/src/utils/logger.d.ts +0 -23
  1190. package/dist/src/utils/logger.js +0 -74
  1191. package/dist/src/utils/long-running-target.d.ts +0 -10
  1192. package/dist/src/utils/long-running-target.js +0 -19
  1193. package/dist/src/utils/machine-id-cache.d.ts +0 -5
  1194. package/dist/src/utils/machine-id-cache.js +0 -93
  1195. package/dist/src/utils/min-release-age/behavior/bun.d.ts +0 -30
  1196. package/dist/src/utils/min-release-age/behavior/bun.js +0 -274
  1197. package/dist/src/utils/min-release-age/behavior/npm.d.ts +0 -21
  1198. package/dist/src/utils/min-release-age/behavior/npm.js +0 -296
  1199. package/dist/src/utils/min-release-age/behavior/pnpm.d.ts +0 -23
  1200. package/dist/src/utils/min-release-age/behavior/pnpm.js +0 -527
  1201. package/dist/src/utils/min-release-age/behavior/yarn.d.ts +0 -22
  1202. package/dist/src/utils/min-release-age/behavior/yarn.js +0 -314
  1203. package/dist/src/utils/min-release-age/constants.d.ts +0 -3
  1204. package/dist/src/utils/min-release-age/constants.js +0 -8
  1205. package/dist/src/utils/min-release-age/errors.d.ts +0 -28
  1206. package/dist/src/utils/min-release-age/errors.js +0 -22
  1207. package/dist/src/utils/min-release-age/packument.d.ts +0 -13
  1208. package/dist/src/utils/min-release-age/packument.js +0 -34
  1209. package/dist/src/utils/min-release-age/pick.d.ts +0 -72
  1210. package/dist/src/utils/min-release-age/pick.js +0 -206
  1211. package/dist/src/utils/min-release-age/pnpm-exclude-writer.d.ts +0 -12
  1212. package/dist/src/utils/min-release-age/pnpm-exclude-writer.js +0 -58
  1213. package/dist/src/utils/min-release-age/policy.d.ts +0 -38
  1214. package/dist/src/utils/min-release-age/policy.js +0 -59
  1215. package/dist/src/utils/min-release-age/resolve.d.ts +0 -8
  1216. package/dist/src/utils/min-release-age/resolve.js +0 -14
  1217. package/dist/src/utils/nx-cloud-utils.d.ts +0 -4
  1218. package/dist/src/utils/nx-cloud-utils.js +0 -28
  1219. package/dist/src/utils/nx-console-prompt.d.ts +0 -1
  1220. package/dist/src/utils/nx-console-prompt.js +0 -61
  1221. package/dist/src/utils/nx-key.d.ts +0 -6
  1222. package/dist/src/utils/nx-key.js +0 -50
  1223. package/dist/src/utils/nx-package-group.d.ts +0 -8
  1224. package/dist/src/utils/nx-package-group.js +0 -15
  1225. package/dist/src/utils/nx-tmp-dir.d.ts +0 -23
  1226. package/dist/src/utils/nx-tmp-dir.js +0 -45
  1227. package/dist/src/utils/object-sort.d.ts +0 -1
  1228. package/dist/src/utils/object-sort.js +0 -9
  1229. package/dist/src/utils/output.d.ts +0 -232
  1230. package/dist/src/utils/output.js +0 -548
  1231. package/dist/src/utils/owned-private-dir.d.ts +0 -145
  1232. package/dist/src/utils/owned-private-dir.js +0 -362
  1233. package/dist/src/utils/package-json.d.ts +0 -231
  1234. package/dist/src/utils/package-json.js +0 -387
  1235. package/dist/src/utils/package-manager-config/bunfig.d.ts +0 -14
  1236. package/dist/src/utils/package-manager-config/bunfig.js +0 -49
  1237. package/dist/src/utils/package-manager-config/npmrc.d.ts +0 -23
  1238. package/dist/src/utils/package-manager-config/npmrc.js +0 -124
  1239. package/dist/src/utils/package-manager-config/pnpm-config.d.ts +0 -17
  1240. package/dist/src/utils/package-manager-config/pnpm-config.js +0 -60
  1241. package/dist/src/utils/package-manager.d.ts +0 -161
  1242. package/dist/src/utils/package-manager.js +0 -850
  1243. package/dist/src/utils/params.d.ts +0 -146
  1244. package/dist/src/utils/params.js +0 -768
  1245. package/dist/src/utils/path.d.ts +0 -19
  1246. package/dist/src/utils/path.js +0 -38
  1247. package/dist/src/utils/perf-hooks.d.ts +0 -19
  1248. package/dist/src/utils/perf-logging.d.ts +0 -1
  1249. package/dist/src/utils/perf-logging.js +0 -46
  1250. package/dist/src/utils/permission-errors.d.ts +0 -11
  1251. package/dist/src/utils/permission-errors.js +0 -17
  1252. package/dist/src/utils/plugin-cache-utils.d.ts +0 -82
  1253. package/dist/src/utils/plugin-cache-utils.js +0 -212
  1254. package/dist/src/utils/plugin-progress-text.d.ts +0 -1
  1255. package/dist/src/utils/plugin-progress-text.js +0 -15
  1256. package/dist/src/utils/plugins/atomizer-utils.d.ts +0 -11
  1257. package/dist/src/utils/plugins/atomizer-utils.js +0 -23
  1258. package/dist/src/utils/plugins/core-plugins.d.ts +0 -6
  1259. package/dist/src/utils/plugins/core-plugins.js +0 -117
  1260. package/dist/src/utils/plugins/index.d.ts +0 -5
  1261. package/dist/src/utils/plugins/index.js +0 -15
  1262. package/dist/src/utils/plugins/installed-plugins.d.ts +0 -5
  1263. package/dist/src/utils/plugins/installed-plugins.js +0 -76
  1264. package/dist/src/utils/plugins/local-plugins.d.ts +0 -22
  1265. package/dist/src/utils/plugins/local-plugins.js +0 -60
  1266. package/dist/src/utils/plugins/output.d.ts +0 -34
  1267. package/dist/src/utils/plugins/output.js +0 -201
  1268. package/dist/src/utils/plugins/plugin-capabilities.d.ts +0 -15
  1269. package/dist/src/utils/plugins/plugin-capabilities.js +0 -78
  1270. package/dist/src/utils/pnpm-workspace.d.ts +0 -8
  1271. package/dist/src/utils/pnpm-workspace.js +0 -2
  1272. package/dist/src/utils/print-help.d.ts +0 -11
  1273. package/dist/src/utils/print-help.js +0 -259
  1274. package/dist/src/utils/progress-topics.d.ts +0 -19
  1275. package/dist/src/utils/progress-topics.js +0 -21
  1276. package/dist/src/utils/project-graph-utils.d.ts +0 -18
  1277. package/dist/src/utils/project-graph-utils.js +0 -78
  1278. package/dist/src/utils/promised-based-queue.d.ts +0 -6
  1279. package/dist/src/utils/promised-based-queue.js +0 -43
  1280. package/dist/src/utils/prompt-helpers.d.ts +0 -53
  1281. package/dist/src/utils/prompt-helpers.js +0 -111
  1282. package/dist/src/utils/provenance.d.ts +0 -47
  1283. package/dist/src/utils/provenance.js +0 -107
  1284. package/dist/src/utils/registry-config/bun.d.ts +0 -2
  1285. package/dist/src/utils/registry-config/bun.js +0 -257
  1286. package/dist/src/utils/registry-config/index.d.ts +0 -13
  1287. package/dist/src/utils/registry-config/index.js +0 -102
  1288. package/dist/src/utils/registry-config/pnpm.d.ts +0 -2
  1289. package/dist/src/utils/registry-config/pnpm.js +0 -1551
  1290. package/dist/src/utils/registry-config/utils.d.ts +0 -195
  1291. package/dist/src/utils/registry-config/utils.js +0 -496
  1292. package/dist/src/utils/registry-config/yarn-berry.d.ts +0 -2
  1293. package/dist/src/utils/registry-config/yarn-berry.js +0 -612
  1294. package/dist/src/utils/registry-config/yarn-classic.d.ts +0 -2
  1295. package/dist/src/utils/registry-config/yarn-classic.js +0 -1001
  1296. package/dist/src/utils/require-nx-key.d.ts +0 -1
  1297. package/dist/src/utils/require-nx-key.js +0 -23
  1298. package/dist/src/utils/safe-spawn.d.ts +0 -24
  1299. package/dist/src/utils/safe-spawn.js +0 -104
  1300. package/dist/src/utils/serializable-error.d.ts +0 -4
  1301. package/dist/src/utils/serializable-error.js +0 -33
  1302. package/dist/src/utils/serialize-overrides-into-command-line.d.ts +0 -3
  1303. package/dist/src/utils/serialize-overrides-into-command-line.js +0 -41
  1304. package/dist/src/utils/serialize-target.d.ts +0 -1
  1305. package/dist/src/utils/serialize-target.js +0 -6
  1306. package/dist/src/utils/shell-quoting.d.ts +0 -25
  1307. package/dist/src/utils/shell-quoting.js +0 -76
  1308. package/dist/src/utils/socket-refused-exit-code.d.ts +0 -15
  1309. package/dist/src/utils/socket-refused-exit-code.js +0 -18
  1310. package/dist/src/utils/spinner.d.ts +0 -24
  1311. package/dist/src/utils/spinner.js +0 -77
  1312. package/dist/src/utils/split-target.d.ts +0 -15
  1313. package/dist/src/utils/split-target.js +0 -239
  1314. package/dist/src/utils/strip-indents.d.ts +0 -14
  1315. package/dist/src/utils/strip-indents.js +0 -23
  1316. package/dist/src/utils/sync-generators.d.ts +0 -66
  1317. package/dist/src/utils/sync-generators.js +0 -355
  1318. package/dist/src/utils/tar.d.ts +0 -8
  1319. package/dist/src/utils/tar.js +0 -44
  1320. package/dist/src/utils/task-history.d.ts +0 -17
  1321. package/dist/src/utils/task-history.js +0 -51
  1322. package/dist/src/utils/terminal-link.d.ts +0 -20
  1323. package/dist/src/utils/terminal-link.js +0 -85
  1324. package/dist/src/utils/update-nxw.d.ts +0 -2
  1325. package/dist/src/utils/update-nxw.js +0 -22
  1326. package/dist/src/utils/versions.d.ts +0 -1
  1327. package/dist/src/utils/versions.js +0 -4
  1328. package/dist/src/utils/wait-for-socket-connection.d.ts +0 -26
  1329. package/dist/src/utils/wait-for-socket-connection.js +0 -59
  1330. package/dist/src/utils/workspace-context.d.ts +0 -21
  1331. package/dist/src/utils/workspace-context.js +0 -120
  1332. package/dist/src/utils/workspace-id.d.ts +0 -20
  1333. package/dist/src/utils/workspace-id.js +0 -54
  1334. package/dist/src/utils/workspace-root.d.ts +0 -6
  1335. package/dist/src/utils/workspace-root.js +0 -40
  1336. package/dist/src/utils/write-formatted-json-file.d.ts +0 -7
  1337. package/dist/src/utils/write-formatted-json-file.js +0 -24
  1338. package/dist/src/utils/yarn-syml/index.d.ts +0 -23
  1339. package/dist/src/utils/yarn-syml/index.js +0 -151
  1340. package/dist/src/utils/yarn-syml/syml-grammar.js +0 -1911
  1341. package/dist/tasks-runners/default.d.ts +0 -1
  1342. package/dist/tasks-runners/default.js +0 -5
  1343. package/executors.json +0 -19
  1344. package/generators.json +0 -16
  1345. package/migrations.json +0 -195
  1346. package/schemas/migrations-schema.json +0 -186
  1347. package/schemas/nx-schema.json +0 -1615
  1348. package/schemas/project-schema.json +0 -426
  1349. package/schemas/workspace-schema.json +0 -185
@@ -1,2807 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isHybridMigration = exports.isPromptOnlyMigration = exports.filterDowngradedUpdates = exports.Migrator = exports.normalizeVersion = void 0;
4
- exports.formatCommandFailure = formatCommandFailure;
5
- exports.resolveCanonicalNxPackage = resolveCanonicalNxPackage;
6
- exports.resolveInclude = resolveInclude;
7
- exports.parseMigrationsOptions = parseMigrationsOptions;
8
- exports.createFetcher = createFetcher;
9
- exports.generateMigrationsJsonAndUpdatePackageJson = generateMigrationsJsonAndUpdatePackageJson;
10
- exports.formatSkippedPromptsNextStep = formatSkippedPromptsNextStep;
11
- exports.executeMigrations = executeMigrations;
12
- exports.isRunPhaseInvocation = isRunPhaseInvocation;
13
- exports.migrate = migrate;
14
- exports.readLocalNxVersion = readLocalNxVersion;
15
- exports.runMigration = runMigration;
16
- exports.resolveMigrationForRun = resolveMigrationForRun;
17
- exports.nxCliPath = nxCliPath;
18
- const tslib_1 = require("tslib");
19
- const pc = tslib_1.__importStar(require("picocolors"));
20
- const child_process_1 = require("child_process");
21
- const safe_prompt_1 = require("./safe-prompt");
22
- const path_1 = require("path");
23
- const module_1 = require("module");
24
- const path_2 = require("../../utils/path");
25
- const semver_1 = require("semver");
26
- const node_url_1 = require("node:url");
27
- const util_1 = require("util");
28
- const fileutils_1 = require("../../utils/fileutils");
29
- const tar_1 = require("../../utils/tar");
30
- const write_formatted_json_file_1 = require("../../utils/write-formatted-json-file");
31
- const shell_quoting_1 = require("../../utils/shell-quoting");
32
- const logger_1 = require("../../utils/logger");
33
- const git_utils_1 = require("../../utils/git-utils");
34
- const package_json_1 = require("../../utils/package-json");
35
- const package_manager_1 = require("../../utils/package-manager");
36
- const errors_1 = require("../../utils/min-release-age/errors");
37
- const resolve_package_version_1 = require("./resolve-package-version");
38
- const handle_errors_1 = require("../../utils/handle-errors");
39
- const connect_to_nx_cloud_1 = require("../nx-cloud/connect/connect-to-nx-cloud");
40
- const output_1 = require("../../utils/output");
41
- const fs_1 = require("fs");
42
- const workspace_root_1 = require("../../utils/workspace-root");
43
- const is_ci_1 = require("../../utils/is-ci");
44
- const installation_directory_1 = require("../../utils/installation-directory");
45
- const installed_nx_version_1 = require("../../utils/installed-nx-version");
46
- const configuration_1 = require("../../config/configuration");
47
- const child_process_2 = require("../../utils/child-process");
48
- const client_1 = require("../../daemon/client/client");
49
- const nx_cloud_utils_1 = require("../../utils/nx-cloud-utils");
50
- const format_changed_files_1 = require("../../generators/internal-utils/format-changed-files");
51
- const provenance_1 = require("../../utils/provenance");
52
- const catalog_1 = require("../../utils/catalog");
53
- const migrate_analytics_1 = require("./migrate-analytics");
54
- const multi_major_1 = require("./multi-major");
55
- const prompt_files_1 = require("./prompt-files");
56
- const command_object_1 = require("./command-object");
57
- const migrate_config_1 = require("./migrate-config");
58
- const migrate_commits_1 = require("./migrate-commits");
59
- const migrate_output_1 = require("./migrate-output");
60
- const migration_shape_1 = require("./migration-shape");
61
- Object.defineProperty(exports, "isHybridMigration", { enumerable: true, get: function () { return migration_shape_1.isHybridMigration; } });
62
- Object.defineProperty(exports, "isPromptOnlyMigration", { enumerable: true, get: function () { return migration_shape_1.isPromptOnlyMigration; } });
63
- const update_filters_1 = require("./update-filters");
64
- Object.defineProperty(exports, "filterDowngradedUpdates", { enumerable: true, get: function () { return update_filters_1.filterDowngradedUpdates; } });
65
- const version_utils_1 = require("./version-utils");
66
- Object.defineProperty(exports, "normalizeVersion", { enumerable: true, get: function () { return version_utils_1.normalizeVersion; } });
67
- const execute_migration_1 = require("./execute-migration");
68
- const step_actions_1 = require("./step-actions");
69
- const sort_migrations_1 = require("./sort-migrations");
70
- const inception_1 = require("./agentic/inception");
71
- const version_skew_guard_1 = require("./version-skew-guard");
72
- const versions_1 = require("../../utils/versions");
73
- tslib_1.__exportStar(require("./execute-migration"), exports);
74
- const execAsync = (0, util_1.promisify)(child_process_1.exec);
75
- function formatCommandFailure(command, error) {
76
- const normalizeCommandOutput = (output) => {
77
- if (!output) {
78
- return undefined;
79
- }
80
- const normalized = typeof output === 'string' ? output.trim() : output.toString().trim();
81
- return normalized || undefined;
82
- };
83
- const details = normalizeCommandOutput(error.stderr) ||
84
- normalizeCommandOutput(error.stdout) ||
85
- normalizeCommandOutput(error.message)
86
- ?.replace(`Command failed: ${command}`, '')
87
- .trim();
88
- return [`Command failed: ${command}`, ...(details ? [details] : [])].join('\n');
89
- }
90
- function runOrReturnExitCode(run) {
91
- try {
92
- run();
93
- return 0;
94
- }
95
- catch (e) {
96
- if (typeof e === 'object' &&
97
- e !== null &&
98
- 'status' in e &&
99
- typeof e.status === 'number') {
100
- return e.status;
101
- }
102
- throw e;
103
- }
104
- }
105
- function cleanSemver(version) {
106
- return (0, semver_1.clean)(version) ?? (0, semver_1.coerce)(version);
107
- }
108
- function normalizeSlashes(packageName) {
109
- return packageName.replace(/\\/g, '/');
110
- }
111
- class Migrator {
112
- constructor(opts) {
113
- this.packageUpdates = {};
114
- this.collectedVersions = {};
115
- this.promptAnswers = {};
116
- this.pendingPackageJsonUpdates = new Map();
117
- this.appliedPackageJsonUpdates = new Set();
118
- if ((opts.include === 'required' || opts.include === 'optional') &&
119
- !opts.requiredPackages) {
120
- throw new Error(`Error: 'requiredPackages' is required when 'include' is '${opts.include}'.`);
121
- }
122
- this.packageJson = opts.packageJson;
123
- this.nxInstallation = opts.nxInstallation;
124
- this.getInstalledPackageVersion = opts.getInstalledPackageVersion;
125
- this.fetch = opts.fetch;
126
- this.installedPkgVersionOverrides = opts.from;
127
- this.to = opts.to;
128
- this.interactive = opts.interactive;
129
- this.excludeAppliedMigrations = opts.excludeAppliedMigrations;
130
- this.include = opts.include;
131
- this.requiredPackages = opts.requiredPackages;
132
- }
133
- async fetchMigrationConfig(packageName, packageVersion) {
134
- const migrationConfig = await this.fetch(packageName, packageVersion);
135
- if (!migrationConfig.version) {
136
- throw new Error(`Fetched migration metadata for ${packageName} is invalid: the target version is missing.`);
137
- }
138
- return migrationConfig;
139
- }
140
- async migrate(targetPackage, targetVersion) {
141
- await this.buildPackageJsonUpdates(targetPackage, {
142
- version: targetVersion,
143
- addToPackageJson: false,
144
- });
145
- await this.applyPendingPackageJsonUpdates();
146
- this.applyIncludeFilter();
147
- const { migrations, promptContents } = await this.createMigrateJson();
148
- return {
149
- packageUpdates: this.packageUpdates,
150
- migrations,
151
- ...(Object.keys(promptContents).length > 0 ? { promptContents } : {}),
152
- minVersionWithSkippedUpdates: this.minVersionWithSkippedUpdates,
153
- };
154
- }
155
- async createMigrateJson() {
156
- const promptContents = {};
157
- const migrations = await Promise.all(Object.keys(this.packageUpdates).map(async (packageName) => {
158
- if (this.packageUpdates[packageName].ignoreMigrations) {
159
- return [];
160
- }
161
- const currentVersion = this.getPkgVersion(packageName);
162
- if (currentVersion === null)
163
- return [];
164
- const { version } = this.packageUpdates[packageName];
165
- const { generators: migrationEntries, resolvedPromptFiles } = await this.fetchMigrationConfig(packageName, version);
166
- if (!migrationEntries)
167
- return [];
168
- if (resolvedPromptFiles) {
169
- for (const [promptPath, content] of Object.entries(resolvedPromptFiles)) {
170
- promptContents[(0, prompt_files_1.promptContentKey)(packageName, promptPath)] = content;
171
- }
172
- }
173
- return Object.entries(migrationEntries)
174
- .filter(([, migration]) => migration.version &&
175
- this.gt(migration.version, currentVersion) &&
176
- this.lte(migration.version, version) &&
177
- this.areMigrationRequirementsMet(packageName, migration))
178
- .map(([migrationName, migration]) => ({
179
- ...migration,
180
- package: packageName,
181
- name: migrationName,
182
- }));
183
- }));
184
- return { migrations: migrations.flat(), promptContents };
185
- }
186
- async buildPackageJsonUpdates(targetPackage, target) {
187
- const packagesToCheck = await this.populatePackageJsonUpdatesAndGetPackagesToCheck(targetPackage, target);
188
- for (const packageToCheck of packagesToCheck) {
189
- const filteredUpdates = {};
190
- for (const [packageUpdateKey, packageUpdate] of Object.entries(packageToCheck.updates)) {
191
- Object.assign(filteredUpdates, await this.applyPackageJsonUpdate(packageToCheck.package, packageUpdateKey, packageUpdate));
192
- }
193
- await Promise.all(Object.entries(filteredUpdates).map(([name, update]) => this.buildPackageJsonUpdates(name, update)));
194
- }
195
- }
196
- async applyPackageJsonUpdate(sourcePackage, packageUpdateKey, packageUpdate) {
197
- const appliedKey = JSON.stringify([sourcePackage, packageUpdateKey]);
198
- if (this.appliedPackageJsonUpdates.has(appliedKey)) {
199
- this.pendingPackageJsonUpdates.delete(appliedKey);
200
- return {};
201
- }
202
- if (!this.areRequirementsMet(packageUpdate.requires) ||
203
- this.areIncompatiblePackagesPresent(packageUpdate.incompatibleWith)) {
204
- this.pendingPackageJsonUpdates.set(appliedKey, {
205
- package: sourcePackage,
206
- key: packageUpdateKey,
207
- update: packageUpdate,
208
- });
209
- return {};
210
- }
211
- this.pendingPackageJsonUpdates.delete(appliedKey);
212
- if (this.interactive &&
213
- !(await this.runPackageJsonUpdatesConfirmationPrompt(packageUpdate, packageUpdateKey, sourcePackage))) {
214
- return {};
215
- }
216
- this.appliedPackageJsonUpdates.add(appliedKey);
217
- const updateEntries = Object.entries(packageUpdate.packages);
218
- // Validate all up front so invalid metadata fails fast, before any
219
- // resolution does I/O.
220
- for (const [name, update] of updateEntries) {
221
- this.validatePackageUpdateVersion(sourcePackage, name, update);
222
- }
223
- const filteredUpdates = {};
224
- // Resolve serially: resolution can prompt (pnpm strict cooldown) and append
225
- // to minimumReleaseAgeExclude, so a serial loop avoids overlapping prompts
226
- // and keeps packageUpdates ordering stable.
227
- for (const [name, update] of updateEntries) {
228
- const resolvedUpdate = {
229
- ...update,
230
- version: await this.resolveVersionForCascade(name, update.version),
231
- };
232
- this.addPackageUpdate(name, resolvedUpdate);
233
- filteredUpdates[name] = this.packageUpdates[name];
234
- }
235
- return filteredUpdates;
236
- }
237
- async applyPendingPackageJsonUpdates() {
238
- while (this.pendingPackageJsonUpdates.size) {
239
- let applied = false;
240
- const filteredUpdates = {};
241
- for (const pending of [...this.pendingPackageJsonUpdates.values()]) {
242
- const updates = await this.applyPackageJsonUpdate(pending.package, pending.key, pending.update);
243
- if (Object.keys(updates).length) {
244
- applied = true;
245
- Object.assign(filteredUpdates, updates);
246
- }
247
- }
248
- if (!applied) {
249
- return;
250
- }
251
- await Promise.all(Object.entries(filteredUpdates).map(([name, update]) => this.buildPackageJsonUpdates(name, update)));
252
- }
253
- }
254
- async resolveVersionForCascade(packageName, version) {
255
- // Already a fully-qualified semver (incl. prereleases) - nothing to resolve.
256
- if ((0, semver_1.valid)(version)) {
257
- return version;
258
- }
259
- // Otherwise resolve the spec (range/tag) through the min-release-age policy,
260
- // which also honors any configured minimumReleaseAgeExclude entries.
261
- return (0, resolve_package_version_1.resolvePackageVersionRespectingMinReleaseAge)(packageName, version);
262
- }
263
- async populatePackageJsonUpdatesAndGetPackagesToCheck(targetPackage, target) {
264
- let targetVersion = target.version;
265
- if (this.to[targetPackage]) {
266
- targetVersion = this.to[targetPackage];
267
- }
268
- if (!this.getPkgVersion(targetPackage)) {
269
- this.addPackageUpdate(targetPackage, {
270
- version: target.version,
271
- addToPackageJson: target.addToPackageJson || false,
272
- ...(target.ignoreMigrations && { ignoreMigrations: true }),
273
- });
274
- return [];
275
- }
276
- let migrationConfig;
277
- try {
278
- migrationConfig = await this.fetchMigrationConfig(targetPackage, targetVersion);
279
- }
280
- catch (e) {
281
- // A cooldown violation must keep its type so the top-level handler can
282
- // surface its remediation; only a generic "no matching version" earns the
283
- // --to hint.
284
- if (!(e instanceof errors_1.MinReleaseAgeViolationError) &&
285
- e?.message?.includes('No matching version')) {
286
- throw new Error(`${e.message}\nRun migrate with --to="package1@version1,package2@version2"`);
287
- }
288
- else {
289
- throw e;
290
- }
291
- }
292
- targetVersion = migrationConfig.version;
293
- if (this.collectedVersions[targetPackage] &&
294
- (0, semver_1.gte)(this.collectedVersions[targetPackage], targetVersion)) {
295
- return [];
296
- }
297
- this.collectedVersions[targetPackage] = targetVersion;
298
- this.addPackageUpdate(targetPackage, {
299
- version: migrationConfig.version,
300
- addToPackageJson: target.addToPackageJson || false,
301
- ...(target.ignoreMigrations && { ignoreMigrations: true }),
302
- });
303
- const { packageJsonUpdates, packageGroupOrder } = this.getPackageJsonUpdatesFromMigrationConfig(targetPackage, targetVersion, migrationConfig, target.ignorePackageGroup);
304
- if (!Object.keys(packageJsonUpdates).length) {
305
- return [];
306
- }
307
- const shouldCheckUpdates = Object.values(packageJsonUpdates).some((packageJsonUpdate) => (this.interactive && packageJsonUpdate['x-prompt']) ||
308
- Object.keys(packageJsonUpdate.requires ?? {}).length ||
309
- Object.keys(packageJsonUpdate.incompatibleWith ?? {}).length);
310
- if (shouldCheckUpdates) {
311
- return [{ package: targetPackage, updates: packageJsonUpdates }];
312
- }
313
- const packageUpdatesToApply = Object.values(packageJsonUpdates).reduce((m, c) => ({ ...m, ...c.packages }), {});
314
- return (await Promise.all(Object.entries(packageUpdatesToApply).map(([packageName, packageUpdate]) => {
315
- this.validatePackageUpdateVersion(targetPackage, packageName, packageUpdate);
316
- return this.populatePackageJsonUpdatesAndGetPackagesToCheck(packageName, packageUpdate);
317
- })))
318
- .filter((pkgs) => pkgs.length)
319
- .flat()
320
- .sort((pkgUpdate1, pkgUpdate2) => packageGroupOrder.indexOf(pkgUpdate1.package) -
321
- packageGroupOrder.indexOf(pkgUpdate2.package));
322
- }
323
- getPackageJsonUpdatesFromMigrationConfig(packageName, targetVersion, migrationConfig, ignorePackageGroup) {
324
- const packageGroupOrder = this.getPackageJsonUpdatesFromPackageGroup(packageName, targetVersion, migrationConfig, ignorePackageGroup);
325
- if (!migrationConfig.packageJsonUpdates ||
326
- !this.getPkgVersion(packageName)) {
327
- return { packageJsonUpdates: {}, packageGroupOrder };
328
- }
329
- const packageJsonUpdates = this.filterPackageJsonUpdates(migrationConfig.packageJsonUpdates, packageName, targetVersion);
330
- return { packageJsonUpdates, packageGroupOrder };
331
- }
332
- /**
333
- * Mutates migrationConfig, adding package group updates into packageJsonUpdates section
334
- *
335
- * @param packageName Package which is being migrated
336
- * @param targetVersion Version which is being migrated to
337
- * @param migrationConfig Configuration which is mutated to contain package json updates
338
- * @returns Order of package groups
339
- */
340
- getPackageJsonUpdatesFromPackageGroup(packageName, targetVersion, migrationConfig, ignorePackageGroup) {
341
- if (ignorePackageGroup) {
342
- return [];
343
- }
344
- const packageGroup = packageName === '@nrwl/workspace' && (0, version_utils_1.isLegacyEra)(targetVersion)
345
- ? LEGACY_NRWL_PACKAGE_GROUP
346
- : (migrationConfig.packageGroup ?? []);
347
- let packageGroupOrder = [];
348
- if (packageGroup.length) {
349
- packageGroupOrder = packageGroup.map((packageConfig) => packageConfig.package);
350
- migrationConfig.packageJsonUpdates ??= {};
351
- const packages = {};
352
- migrationConfig.packageJsonUpdates[targetVersion + '--PackageGroup'] = {
353
- version: targetVersion,
354
- packages,
355
- };
356
- for (const packageConfig of packageGroup) {
357
- packages[packageConfig.package] = {
358
- version: packageConfig.version === '*'
359
- ? targetVersion
360
- : packageConfig.version,
361
- alwaysAddToPackageJson: false,
362
- };
363
- if (packageConfig.version === '*' &&
364
- this.installedPkgVersionOverrides[packageName]) {
365
- this.installedPkgVersionOverrides[packageConfig.package] ??=
366
- this.installedPkgVersionOverrides[packageName];
367
- }
368
- }
369
- }
370
- return packageGroupOrder;
371
- }
372
- filterPackageJsonUpdates(packageJsonUpdates, packageName, targetVersion) {
373
- const filteredPackageJsonUpdates = {};
374
- for (const [packageJsonUpdateKey, packageJsonUpdate] of Object.entries(packageJsonUpdates)) {
375
- if (!packageJsonUpdate.packages ||
376
- this.lt(packageJsonUpdate.version, this.getPkgVersion(packageName)) ||
377
- this.gt(packageJsonUpdate.version, targetVersion)) {
378
- continue;
379
- }
380
- const dependencies = {
381
- ...this.packageJson?.dependencies,
382
- ...this.packageJson?.devDependencies,
383
- ...this.nxInstallation?.plugins,
384
- ...(this.nxInstallation && { nx: this.nxInstallation.version }),
385
- };
386
- const filtered = {};
387
- for (const [packageName, packageUpdate] of Object.entries(packageJsonUpdate.packages)) {
388
- if (this.shouldExcludePackage(packageName)) {
389
- continue;
390
- }
391
- if (this.shouldApplyPackageUpdate(packageUpdate, packageName, dependencies)) {
392
- filtered[packageName] = {
393
- version: packageUpdate.version,
394
- addToPackageJson: packageUpdate.alwaysAddToPackageJson
395
- ? typeof packageUpdate.alwaysAddToPackageJson === 'string'
396
- ? packageUpdate.alwaysAddToPackageJson
397
- : 'dependencies'
398
- : packageUpdate.addToPackageJson || false,
399
- ...(packageUpdate.ignorePackageGroup && {
400
- ignorePackageGroup: true,
401
- }),
402
- ...(packageUpdate.ignoreMigrations && {
403
- ignoreMigrations: true,
404
- }),
405
- };
406
- }
407
- }
408
- if (Object.keys(filtered).length) {
409
- packageJsonUpdate.packages = filtered;
410
- filteredPackageJsonUpdates[packageJsonUpdateKey] = packageJsonUpdate;
411
- }
412
- }
413
- return filteredPackageJsonUpdates;
414
- }
415
- shouldExcludePackage(packageName) {
416
- if (!this.requiredPackages) {
417
- return false;
418
- }
419
- if (this.include === 'required') {
420
- return !this.requiredPackages.has(packageName);
421
- }
422
- return false;
423
- }
424
- applyIncludeFilter() {
425
- if (this.include !== 'optional') {
426
- return;
427
- }
428
- // Cascade walks through the required packages so cross-plugin optional
429
- // deps (e.g. typescript managed by @nx/js but used by @nx/angular) get
430
- // surfaced. Drop the required set from the final result here so only
431
- // optional updates land in package.json.
432
- for (const name of Object.keys(this.packageUpdates)) {
433
- if (this.requiredPackages.has(name)) {
434
- delete this.packageUpdates[name];
435
- }
436
- }
437
- }
438
- shouldApplyPackageUpdate(packageUpdate, packageName, dependencies) {
439
- return ((!packageUpdate.ifPackageInstalled ||
440
- this.getPkgVersion(packageUpdate.ifPackageInstalled)) &&
441
- (packageUpdate.alwaysAddToPackageJson ||
442
- packageUpdate.addToPackageJson ||
443
- !!dependencies?.[packageName]) &&
444
- (!this.collectedVersions[packageName] ||
445
- this.gt(packageUpdate.version, this.collectedVersions[packageName])));
446
- }
447
- validatePackageUpdateVersion(sourcePackageName, packageName, packageUpdate) {
448
- if (!packageUpdate.version) {
449
- throw new Error(`Fetched migration metadata for ${sourcePackageName} is invalid: the target version for ${packageName} is missing.`);
450
- }
451
- }
452
- addPackageUpdate(name, packageUpdate) {
453
- if (!this.packageUpdates[name] ||
454
- !this.lt(packageUpdate.version, this.packageUpdates[name].version)) {
455
- this.packageUpdates[name] = packageUpdate;
456
- }
457
- }
458
- areRequirementsMet(requirements) {
459
- if (!requirements || !Object.keys(requirements).length) {
460
- return true;
461
- }
462
- return Object.entries(requirements).every(([pkgName, versionRange]) => {
463
- if (this.packageUpdates[pkgName]) {
464
- return (0, semver_1.satisfies)(cleanSemver(this.packageUpdates[pkgName].version), versionRange, { includePrerelease: true });
465
- }
466
- return (this.getPkgVersion(pkgName) &&
467
- (0, semver_1.satisfies)(this.getPkgVersion(pkgName), versionRange, {
468
- includePrerelease: true,
469
- }));
470
- });
471
- }
472
- areIncompatiblePackagesPresent(incompatibleWith) {
473
- if (!incompatibleWith || !Object.keys(incompatibleWith).length) {
474
- return false;
475
- }
476
- return Object.entries(incompatibleWith).some(([pkgName, versionRange]) => {
477
- if (this.packageUpdates[pkgName]) {
478
- return (0, semver_1.satisfies)(cleanSemver(this.packageUpdates[pkgName].version), versionRange, { includePrerelease: true });
479
- }
480
- return (this.getPkgVersion(pkgName) &&
481
- (0, semver_1.satisfies)(this.getPkgVersion(pkgName), versionRange, {
482
- includePrerelease: true,
483
- }));
484
- });
485
- }
486
- areMigrationRequirementsMet(packageName, migration) {
487
- if (!this.excludeAppliedMigrations) {
488
- return this.areRequirementsMet(migration.requires);
489
- }
490
- return ((this.wasMigrationSkipped(migration.requires) ||
491
- this.isMigrationForHigherVersionThanWhatIsInstalled(packageName, migration)) &&
492
- this.areRequirementsMet(migration.requires));
493
- }
494
- isMigrationForHigherVersionThanWhatIsInstalled(packageName, migration) {
495
- const installedVersion = this.getInstalledPackageVersion(packageName);
496
- return (migration.version &&
497
- (!installedVersion || this.gt(migration.version, installedVersion)) &&
498
- this.lte(migration.version, this.packageUpdates[packageName].version));
499
- }
500
- wasMigrationSkipped(requirements) {
501
- // no requiremets, so it ran before
502
- if (!requirements || !Object.keys(requirements).length) {
503
- return false;
504
- }
505
- // at least a requirement was not met, it was skipped
506
- return Object.entries(requirements).some(([pkgName, versionRange]) => !this.getInstalledPackageVersion(pkgName) ||
507
- !(0, semver_1.satisfies)(this.getInstalledPackageVersion(pkgName), versionRange, {
508
- includePrerelease: true,
509
- }));
510
- }
511
- async runPackageJsonUpdatesConfirmationPrompt(packageUpdate, packageUpdateKey, packageName) {
512
- if (!packageUpdate['x-prompt']) {
513
- return Promise.resolve(true);
514
- }
515
- const promptKey = this.getPackageUpdatePromptKey(packageUpdate);
516
- if (this.promptAnswers[promptKey] !== undefined) {
517
- // a same prompt was already answered, skip
518
- return Promise.resolve(false);
519
- }
520
- // No footer slot, so the docs link is appended to the message.
521
- const detailsLink = packageName.startsWith('@nx/')
522
- ? pc.dim(`\n View migration details at https://nx.dev/nx-api/${packageName.replace('@nx/', '')}#${packageUpdateKey.replace(/[-\.]/g, '')}packageupdates`)
523
- : '';
524
- return await (0, safe_prompt_1.migrateConfirm)({
525
- message: `${packageUpdate['x-prompt']}${detailsLink}`,
526
- initial: true,
527
- }).then((shouldApply) => {
528
- this.promptAnswers[promptKey] = shouldApply;
529
- if (!shouldApply &&
530
- (!this.minVersionWithSkippedUpdates ||
531
- (0, semver_1.lt)(packageUpdate.version, this.minVersionWithSkippedUpdates))) {
532
- this.minVersionWithSkippedUpdates = packageUpdate.version;
533
- }
534
- return shouldApply;
535
- });
536
- }
537
- getPackageUpdatePromptKey(packageUpdate) {
538
- return Object.entries(packageUpdate.packages)
539
- .map(([name, update]) => `${name}:${JSON.stringify(update)}`)
540
- .join('|');
541
- }
542
- getPkgVersion(pkg) {
543
- return this.getInstalledPackageVersion(pkg, this.installedPkgVersionOverrides);
544
- }
545
- gt(v1, v2) {
546
- return (0, semver_1.gt)((0, version_utils_1.normalizeVersion)(v1), (0, version_utils_1.normalizeVersion)(v2));
547
- }
548
- lt(v1, v2) {
549
- return (0, semver_1.lt)((0, version_utils_1.normalizeVersion)(v1), (0, version_utils_1.normalizeVersion)(v2));
550
- }
551
- lte(v1, v2) {
552
- return (0, semver_1.lte)((0, version_utils_1.normalizeVersion)(v1), (0, version_utils_1.normalizeVersion)(v2));
553
- }
554
- }
555
- exports.Migrator = Migrator;
556
- const LEGACY_NRWL_PACKAGE_GROUP = [
557
- { package: '@nrwl/workspace', version: '*' },
558
- { package: '@nrwl/angular', version: '*' },
559
- { package: '@nrwl/cypress', version: '*' },
560
- { package: '@nrwl/devkit', version: '*' },
561
- { package: '@nrwl/eslint-plugin-nx', version: '*' },
562
- { package: '@nrwl/express', version: '*' },
563
- { package: '@nrwl/jest', version: '*' },
564
- { package: '@nrwl/linter', version: '*' },
565
- { package: '@nrwl/nest', version: '*' },
566
- { package: '@nrwl/next', version: '*' },
567
- { package: '@nrwl/node', version: '*' },
568
- { package: '@nrwl/nx-plugin', version: '*' },
569
- { package: '@nrwl/react', version: '*' },
570
- { package: '@nrwl/storybook', version: '*' },
571
- { package: '@nrwl/web', version: '*' },
572
- { package: '@nrwl/js', version: '*' },
573
- { package: 'nx-cloud', version: 'latest' },
574
- { package: '@nrwl/react-native', version: '*' },
575
- { package: '@nrwl/detox', version: '*' },
576
- { package: '@nrwl/expo', version: '*' },
577
- { package: '@nrwl/tao', version: '*' },
578
- ];
579
- function resolveRequiredPackages(targetPackage, packageGroup) {
580
- const set = new Set([targetPackage]);
581
- for (const { package: name } of packageGroup ?? []) {
582
- set.add(name);
583
- }
584
- return set;
585
- }
586
- /**
587
- * The canonical Nx package for a given target version: `@nrwl/workspace` for
588
- * legacy (`< 14.0.0-beta.0`), `nx` otherwise. Non-semver inputs (e.g. the
589
- * literal `'latest'` sentinel before tag resolution) resolve to modern era.
590
- */
591
- function resolveCanonicalNxPackage(targetVersion) {
592
- return (0, version_utils_1.isLegacyEra)(targetVersion) ? '@nrwl/workspace' : 'nx';
593
- }
594
- /**
595
- * `@nx/workspace` is version-synced with `nx` but declares an intentionally
596
- * narrow `packageGroup`; resolve eligibility, bounds, and the optional walk
597
- * against `nx`'s full closure so they match what the cascade actually walks.
598
- */
599
- function toNxClosurePackage(packageName) {
600
- return packageName === '@nx/workspace' ? 'nx' : packageName;
601
- }
602
- async function resolveInclude(include, context, configuredInclude) {
603
- // An explicit `--include` is validated against the target's `supportsOptionalMigrations` in
604
- // `resolveTargetAndInclude`, so honor it directly here.
605
- if (include) {
606
- (0, migrate_analytics_1.setMigrateIncludeSource)('flag');
607
- return include;
608
- }
609
- // Targets that don't declare `supportsOptionalMigrations` only ever run the full
610
- // migration; there is nothing to pick between.
611
- if (!context.targetSupportsOptionalUpdates) {
612
- if (configuredInclude && configuredInclude !== 'all') {
613
- output_1.output.warn({
614
- title: `The configured nx.json migrate.include '${configuredInclude}' is not available for this migration; falling back to 'all'.`,
615
- bodyLines: [`The target package does not support optional updates.`],
616
- });
617
- }
618
- (0, migrate_analytics_1.setMigrateIncludeSource)('default');
619
- return 'all';
620
- }
621
- // nx.json `migrate.include` pre-selects the answer the prompt would ask for.
622
- if (configuredInclude) {
623
- (0, migrate_analytics_1.setMigrateIncludeSource)('nx-json');
624
- return configuredInclude;
625
- }
626
- const choices = [
627
- {
628
- value: 'required',
629
- label: 'Required only (the target package and the packages it ships with)',
630
- },
631
- ];
632
- // `--interactive` keeps the legacy x-prompt flow, which the `optional` value
633
- // supersedes and is incompatible with, so omit it when interactive.
634
- if (!context.hasFrom &&
635
- !context.hasExcludeAppliedMigrations &&
636
- context.interactive !== true) {
637
- choices.push({
638
- value: 'optional',
639
- label: 'Optional only (the dependency updates those packages recommend)',
640
- });
641
- }
642
- if (!(0, safe_prompt_1.canPrompt)(context.interactive)) {
643
- (0, migrate_analytics_1.setMigrateIncludeSource)('default');
644
- return 'all';
645
- }
646
- choices.push({
647
- value: 'all',
648
- label: 'All (required and optional)',
649
- });
650
- const selected = await (0, safe_prompt_1.migrateChoice)({
651
- message: 'Which packages would you like to migrate?',
652
- choices,
653
- });
654
- (0, migrate_analytics_1.reportMigratePrompt)('include', selected);
655
- (0, migrate_analytics_1.setMigrateIncludeSource)('prompt');
656
- return selected;
657
- }
658
- async function versionOverrides(overrides, param) {
659
- const res = {};
660
- const promises = overrides.split(',').map((p) => {
661
- const split = p.lastIndexOf('@');
662
- if (split === -1 || split === 0) {
663
- throw new Error(`Incorrect '${param}' section. Use --${param}="package@version"`);
664
- }
665
- const selectedPackage = p.substring(0, split).trim();
666
- const selectedVersion = p.substring(split + 1).trim();
667
- if (!selectedPackage || !selectedVersion) {
668
- throw new Error(`Incorrect '${param}' section. Use --${param}="package@version"`);
669
- }
670
- return (0, version_utils_1.normalizeVersionWithTagCheck)(selectedPackage, selectedVersion).then((version) => {
671
- res[normalizeSlashes(selectedPackage)] = version;
672
- });
673
- });
674
- await Promise.all(promises);
675
- return res;
676
- }
677
- async function parseTargetPackageAndVersion(args) {
678
- if (!args) {
679
- throw new Error(`Provide the correct package name and version. E.g., my-package@9.0.0.`);
680
- }
681
- if (args.indexOf('@') > -1) {
682
- const i = args.lastIndexOf('@');
683
- if (i === 0) {
684
- return { targetPackage: args.trim(), targetVersion: 'latest' };
685
- }
686
- const targetPackage = args.substring(0, i);
687
- const maybeVersion = args.substring(i + 1);
688
- if (!targetPackage || !maybeVersion) {
689
- throw new Error(`Provide the correct package name and version. E.g., my-package@9.0.0.`);
690
- }
691
- const targetVersion = await (0, version_utils_1.normalizeVersionWithTagCheck)(targetPackage, maybeVersion);
692
- return { targetPackage, targetVersion };
693
- }
694
- if (version_utils_1.DIST_TAGS.includes(args) ||
695
- (0, semver_1.valid)(args) ||
696
- args.match(/^\d+(?:\.\d+)?(?:\.\d+)?$/)) {
697
- // Passing `nx` here may seem wrong, but nx and @nrwl/workspace are synced in version.
698
- // We could duplicate the ternary below, but its not necessary since they are equivalent
699
- // on the registry
700
- const targetVersion = await (0, version_utils_1.normalizeVersionWithTagCheck)('nx', args);
701
- const isDistTag = version_utils_1.DIST_TAGS.includes(args);
702
- const targetPackage = isDistTag
703
- ? 'nx'
704
- : resolveCanonicalNxPackage(targetVersion);
705
- return { targetPackage, targetVersion };
706
- }
707
- return { targetPackage: args, targetVersion: 'latest' };
708
- }
709
- async function parseMigrationsOptions(options, fetch) {
710
- // A run recorded or reconciled via `--run-id` is driven by the outer agent;
711
- // spawning another agent from it would double-drive the run. Only the
712
- // explicit "on" values conflict; the nx.json default is ignored for
713
- // `--run-id` invocations instead.
714
- if (options.runId !== undefined &&
715
- options.agentic !== undefined &&
716
- options.agentic !== false) {
717
- throw new Error(`Error: '--agentic' cannot be combined with '--run-id'.`);
718
- }
719
- if (options.runMigration !== undefined) {
720
- if (options.runMigration === '') {
721
- throw new Error(`Error: '--run-migration' requires a migration id, e.g. '--run-migration=@nx/js:my-migration'.`);
722
- }
723
- if (options.runId === '') {
724
- throw new Error(`Error: '--run-id' requires the id of the migrate run to record into.`);
725
- }
726
- if (options.stepAction !== undefined) {
727
- throw new Error(`Error: '--step-action' cannot be combined with '--run-migration'. It applies to an orchestrated reconcile ('--run-id' without '--run-migration').`);
728
- }
729
- if (options.runMigrations !== undefined) {
730
- throw new Error(`Error: '--run-migration' (run a single migration) cannot be combined with '--run-migrations' (run the whole migrations file).`);
731
- }
732
- if (options.include) {
733
- throw new Error(`Error: '--run-migration' cannot be combined with '--include'.`);
734
- }
735
- if (options.multiMajorMode) {
736
- throw new Error(`Error: '--run-migration' cannot be combined with '--multi-major-mode'.`);
737
- }
738
- // `--if-exists` only applies to a whole-file run, so an explicit "on"
739
- // conflicts. Its yargs default (false) is always present and is tolerated.
740
- if (options.ifExists === true) {
741
- throw new Error(`Error: '--run-migration' cannot be combined with '--if-exists'.`);
742
- }
743
- return {
744
- type: 'runSingleMigration',
745
- runMigration: options.runMigration,
746
- runId: options.runId,
747
- agentic: options.agentic,
748
- validate: options.validate,
749
- interactive: options.interactive,
750
- };
751
- }
752
- if (options.runId !== undefined) {
753
- // Empty '--run-id' is an error on every path.
754
- if (options.runId === '') {
755
- throw new Error(`Error: '--run-id' requires the id of the migrate run to record into.`);
756
- }
757
- if (options.runMigrations !== undefined) {
758
- throw new Error(`Error: '--run-id' (reconcile an orchestrated run) cannot be combined with '--run-migrations' (run the whole migrations file).`);
759
- }
760
- // A bare '--run-id' reconciles the run it names. Ungated, unlike init:
761
- // the id has to name a run directory that exists, and only a gated init
762
- // ever creates one.
763
- // yargs' choices already reject bad CLI values; this guards programmatic
764
- // callers, where silently dropping the action would reconcile without it.
765
- if (options.stepAction !== undefined && !(0, step_actions_1.isStepAction)(options.stepAction)) {
766
- throw new Error(`Error: '--step-action' must be one of ${step_actions_1.STEP_ACTIONS.join(', ')}.`);
767
- }
768
- return {
769
- type: 'orchestratorReconcile',
770
- runId: options.runId,
771
- ...(options.stepAction !== undefined
772
- ? { stepAction: options.stepAction }
773
- : {}),
774
- };
775
- }
776
- if (options.stepAction !== undefined) {
777
- throw new Error(`Error: '--step-action' requires '--run-id'.`);
778
- }
779
- if (options.runMigrations === '') {
780
- options.runMigrations = 'migrations.json';
781
- }
782
- if (options.include && options.runMigrations) {
783
- throw new Error(`Error: '--include' cannot be combined with '--run-migrations'.`);
784
- }
785
- if (options.multiMajorMode && options.runMigrations) {
786
- throw new Error(`Error: '--multi-major-mode' cannot be combined with '--run-migrations'.`);
787
- }
788
- if (options.runMigrations) {
789
- return {
790
- type: 'runMigrations',
791
- runMigrations: options.runMigrations,
792
- ifExists: options.ifExists,
793
- agentic: options.agentic,
794
- validate: options.validate,
795
- interactive: options.interactive,
796
- };
797
- }
798
- assertOptionalIncludeFlagCompatibility(options);
799
- const [from, to] = await Promise.all([
800
- options.from
801
- ? versionOverrides(options.from, 'from')
802
- : Promise.resolve({}),
803
- options.to
804
- ? await versionOverrides(options.to, 'to')
805
- : Promise.resolve({}),
806
- ]);
807
- // The gate reads `supportsOptionalMigrations` through this fetcher (registry-first, install
808
- // fallback) so private registries don't fail closed. In production the caller
809
- // shares its fetcher; standalone callers (tests) get a fresh one.
810
- const resolvedFetch = fetch ?? createFetcher((0, package_manager_1.getPackageManagerCommand)());
811
- const positional = options['packageAndVersion'];
812
- const resolved = await resolveTargetAndInclude({
813
- positional,
814
- from,
815
- options,
816
- fetch: resolvedFetch,
817
- });
818
- const { include, installedTargetVersion } = resolved;
819
- let { targetPackage, targetVersion } = resolved;
820
- // Crossing more than one major can silently skip migrations: each
821
- // major's metadata may have pruned entries from much-older versions.
822
- const multiMajorResult = await (0, multi_major_1.maybePromptOrWarnMultiMajorMigration)({
823
- include,
824
- options,
825
- targetPackage,
826
- targetVersion,
827
- });
828
- targetVersion = multiMajorResult.chosen;
829
- if (include === 'optional') {
830
- // `include` can resolve to optional via nx.json, which bypasses the early
831
- // CLI-only check above; re-assert against the resolved value.
832
- assertOptionalIncludeFlagCompatibility({
833
- include,
834
- from: options.from,
835
- excludeAppliedMigrations: options.excludeAppliedMigrations,
836
- interactive: options.interactive,
837
- });
838
- assertOptionalTargetBounds({
839
- targetPackage,
840
- targetVersion,
841
- to,
842
- // `resolveTargetAndInclude` always resolves the installed bounds version for
843
- // the `optional` value (or throws), so it is present here.
844
- installedTargetVersion: installedTargetVersion,
845
- });
846
- }
847
- return {
848
- type: 'generateMigrations',
849
- targetPackage,
850
- targetVersion,
851
- from,
852
- to,
853
- interactive: options.interactive,
854
- excludeAppliedMigrations: options.excludeAppliedMigrations,
855
- include,
856
- originalTargetVersion: multiMajorResult.originalTarget,
857
- multiMajorMode: multiMajorResult.gradual ? 'gradual' : undefined,
858
- multiMajorChoice: multiMajorResult.decision,
859
- };
860
- }
861
- function assertOptionalIncludeFlagCompatibility(options) {
862
- if (options.include !== 'optional')
863
- return;
864
- if (options.from) {
865
- throw new Error(`Error: '--include=optional' cannot be combined with '--from'.`);
866
- }
867
- if (options.excludeAppliedMigrations === true) {
868
- throw new Error(`Error: '--include=optional' cannot be combined with '--exclude-applied-migrations'.`);
869
- }
870
- if (options.interactive === true) {
871
- throw new Error(`Error: '--include=optional' cannot be combined with '--interactive'.`);
872
- }
873
- }
874
- // Resolves the target package/version up front (the `optional` value anchors to
875
- // the installed target; otherwise dist-tags resolve to a concrete version), then
876
- // resolves the include value and rejects `--include` when the target doesn't support it.
877
- // Bare invocations require an explicit target on older installs rather than
878
- // defaulting to `latest` across a large major gap.
879
- async function resolveTargetAndInclude(args) {
880
- const { positional, from, options, fetch } = args;
881
- let targetPackage;
882
- let targetVersion;
883
- if (positional) {
884
- const parsed = await parseTargetPackageAndVersion(positional);
885
- targetPackage = normalizeSlashes(parsed.targetPackage);
886
- targetVersion = parsed.targetVersion;
887
- }
888
- const installed = resolveInstalledCanonical();
889
- const installedMajor = installed && (0, semver_1.valid)(installed.version) ? (0, semver_1.major)(installed.version) : null;
890
- // `--include=optional` anchors the target to the installed version below, so
891
- // it never needs a target or dist-tag resolved up front.
892
- const isExplicitOptional = options.include === 'optional';
893
- // Bare `nx migrate` defaults to `nx@latest`. Only do so from a recent-enough
894
- // install (v22+); an unknown or far-behind version would otherwise silently
895
- // run a large multi-major jump, so require an explicit target there instead.
896
- if (!positional && !isExplicitOptional) {
897
- if (installedMajor === null || installedMajor < 22) {
898
- throw new Error(`Provide the package and version to migrate to. E.g., \`nx migrate nx@<version>\`.`);
899
- }
900
- targetPackage = 'nx';
901
- targetVersion = 'latest';
902
- }
903
- // Resolve dist-tags to a concrete version so the `supportsOptionalMigrations` gate and the
904
- // downstream cascade read a real semver. Explicit dist-tags arrive already
905
- // resolved from `parseTargetPackageAndVersion`; only bare invocations and
906
- // bare package names (`nx migrate nx`) reach here unresolved.
907
- if (!isExplicitOptional &&
908
- targetPackage &&
909
- targetVersion &&
910
- !(0, semver_1.valid)(targetVersion)) {
911
- try {
912
- targetVersion = await (0, version_utils_1.normalizeVersionWithTagCheck)(targetPackage, targetVersion);
913
- }
914
- catch {
915
- // Registry unavailable: keep the tag. The sentinel degrades gracefully
916
- // downstream (multi-major and the cascade tolerate it).
917
- }
918
- }
919
- // `--include` is only available for targets that opt in via `supportsOptionalMigrations`.
920
- // required/all/prompt/nx.json read the flag at the version being migrated
921
- // to. Skipped when the include value can't depend on it (no `--include`, no nx.json
922
- // default, no interactive prompt) and for the explicit `optional` value, which
923
- // anchors to the installed target and reads at that version below.
924
- let targetSupportsOptionalUpdates = false;
925
- // The package/version whose `supportsOptionalMigrations` flag the gate actually read,
926
- // surfaced verbatim in the rejection message below.
927
- let eligibilityPackage = targetPackage;
928
- let eligibilityVersion = targetVersion;
929
- if (!isExplicitOptional &&
930
- targetPackage &&
931
- (options.include ||
932
- options.includeFromConfig ||
933
- (0, safe_prompt_1.canPrompt)(options.interactive))) {
934
- // Read at the canonical closure package so the gate shares the cascade's
935
- // cached fetch (the walk normalizes `@nx/workspace` -> `nx` too).
936
- eligibilityPackage = toNxClosurePackage(targetPackage);
937
- targetSupportsOptionalUpdates = await fetchSupportsOptionalUpdates(fetch, eligibilityPackage, targetVersion);
938
- }
939
- // Recorded before the interactive prompts (include, multi-major) so runs
940
- // abandoned at a prompt still register a start.
941
- (0, migrate_analytics_1.reportMigrateGenerateStart)({
942
- targetPackage: targetPackage ?? 'nx',
943
- interactive: options.interactive,
944
- excludeAppliedMigrations: options.excludeAppliedMigrations,
945
- });
946
- const include = await resolveInclude(options.include, {
947
- hasFrom: Object.keys(from).length > 0,
948
- hasExcludeAppliedMigrations: options.excludeAppliedMigrations === true,
949
- interactive: options.interactive,
950
- targetSupportsOptionalUpdates,
951
- }, options.includeFromConfig);
952
- let installedTargetVersion;
953
- // The `optional` value catches up the deps the target manages for the version
954
- // you are already on, capped at the installed version. `@nx/workspace` is
955
- // version-synced with `nx` but declares a narrower group, so resolve the
956
- // installed bounds against `nx`'s full closure.
957
- if (include === 'optional') {
958
- if (!positional) {
959
- // Bare `--include=optional`: catch up the deps Nx manages for installed Nx.
960
- if (!installed) {
961
- throw new Error(`Error: '--include=optional' requires 'nx' (or '@nrwl/workspace' on Nx <14) to be installed in your workspace. Install dependencies first, then re-run.`);
962
- }
963
- targetPackage = installed.canonical;
964
- installedTargetVersion = installed.version;
965
- targetVersion = installedTargetVersion;
966
- }
967
- else {
968
- const boundsPackage = toNxClosurePackage(targetPackage);
969
- installedTargetVersion = (0, installed_nx_version_1.getInstalledVersion)(boundsPackage);
970
- if (!installedTargetVersion) {
971
- throw new Error(`Error: '--include=optional' requires '${boundsPackage}' to be installed in your workspace. Install dependencies first, then re-run.`);
972
- }
973
- // A bare package name (no semver, surfaced as the literal `'latest'`)
974
- // anchors the catch-up walk to installed; an explicit version is kept and
975
- // bounded against installed downstream.
976
- if (!(0, semver_1.valid)(targetVersion)) {
977
- targetVersion = installedTargetVersion;
978
- }
979
- }
980
- // An explicit `--include=optional` is gated on the INSTALLED version's flag:
981
- // you catch up the deps you already have, so eligibility follows the
982
- // installed package, not the (possibly older) explicit target. Config /
983
- // prompt-derived `optional` value was already vetted via the to-target read.
984
- if (options.include === 'optional') {
985
- eligibilityPackage = toNxClosurePackage(targetPackage);
986
- eligibilityVersion = installedTargetVersion;
987
- targetSupportsOptionalUpdates = await fetchSupportsOptionalUpdates(fetch, eligibilityPackage, installedTargetVersion);
988
- }
989
- }
990
- if (options.include && !targetSupportsOptionalUpdates) {
991
- throw new Error(`Error: '--include' requires the target package to support optional updates, but '${eligibilityPackage}@${eligibilityVersion}' does not.`);
992
- }
993
- return {
994
- targetPackage: targetPackage,
995
- targetVersion: targetVersion,
996
- include,
997
- installedTargetVersion,
998
- };
999
- }
1000
- // `--include` is opt-in per package via `supportsOptionalMigrations` in the target's
1001
- // `nx-migrations`/`ng-update` config. Read it through the shared fetcher
1002
- // (registry-first, install fallback) so registries that can't serve metadata
1003
- // via `npm view` resolve it from an install rather than failing the gate.
1004
- async function fetchSupportsOptionalUpdates(fetch, packageName, packageVersion) {
1005
- const config = await fetch(packageName, packageVersion);
1006
- return config.supportsOptionalMigrations === true;
1007
- }
1008
- // `--include=optional` upper-bound gate. The optional walk catches up from
1009
- // zero, so a target or `--to` above the installed version would surface
1010
- // optional bumps that only exist in the newer package's history. The
1011
- // required set is the target package's declared `packageGroup`; the legacy
1012
- // era falls back to the hardcoded `LEGACY_NRWL_PACKAGE_GROUP`. `installed` is
1013
- // the installed bounds version already resolved by `resolveTargetAndInclude`.
1014
- function assertOptionalTargetBounds(args) {
1015
- const { targetPackage, targetVersion, to, installedTargetVersion: installed, } = args;
1016
- const boundsPackage = toNxClosurePackage(targetPackage);
1017
- if ((0, semver_1.gt)(targetVersion, installed)) {
1018
- throw new Error(`Error: '--include=optional' cannot migrate to a version higher than what is currently installed (got '${targetPackage}@${targetVersion}', installed '${boundsPackage}@${installed}'). Either drop '--include=optional' or lower the target.`);
1019
- }
1020
- const requiredSet = (0, version_utils_1.isLegacyEra)(targetVersion)
1021
- ? new Set([
1022
- boundsPackage,
1023
- ...LEGACY_NRWL_PACKAGE_GROUP.map((p) => p.package),
1024
- ])
1025
- : (0, installed_nx_version_1.getInstalledPackageGroup)(boundsPackage);
1026
- for (const [pkg, version] of Object.entries(to)) {
1027
- if (requiredSet.has(pkg) && (0, semver_1.gt)(version, installed)) {
1028
- throw new Error(`Error: '--include=optional' cannot migrate to a version higher than what is currently installed (got '--to ${pkg}@${version}', installed '${boundsPackage}@${installed}'). Either drop '--include=optional' or lower the '--to' value.`);
1029
- }
1030
- }
1031
- }
1032
- /**
1033
- * Pick the canonical Nx package + version for `--include=optional` when the
1034
- * user didn't supply an explicit version. Returns `'nx'` for modern era,
1035
- * falls back to `'@nrwl/workspace'` (legacy era) when only that is installed
1036
- * or when the installed `nx` itself is `<14`.
1037
- */
1038
- function resolveInstalledCanonical() {
1039
- const installedNx = (0, installed_nx_version_1.getInstalledNxVersion)();
1040
- if (installedNx) {
1041
- return {
1042
- canonical: resolveCanonicalNxPackage(installedNx),
1043
- version: installedNx,
1044
- };
1045
- }
1046
- const installedLegacy = (0, installed_nx_version_1.getInstalledLegacyNrwlWorkspaceVersion)();
1047
- if (installedLegacy) {
1048
- return { canonical: '@nrwl/workspace', version: installedLegacy };
1049
- }
1050
- return null;
1051
- }
1052
- function createInstalledPackageVersionsResolver(root) {
1053
- const cache = {};
1054
- const nxRequires = (0, installation_directory_1.getNxRequirePaths)(root).map((path) => (0, module_1.createRequire)((0, path_1.join)(path, 'package.json')));
1055
- function getInstalledPackageVersion(packageName, overrides) {
1056
- if (overrides?.[packageName]) {
1057
- return overrides[packageName];
1058
- }
1059
- if (packageName === 'nx') {
1060
- const nxVersion = cache[packageName] ??
1061
- (() => {
1062
- for (const req of nxRequires) {
1063
- try {
1064
- const packageJsonPath = req.resolve('nx/package.json');
1065
- if (packageJsonPath.startsWith(workspace_root_1.workspaceRoot)) {
1066
- return (0, fileutils_1.readJsonFile)(packageJsonPath).version;
1067
- }
1068
- }
1069
- catch { }
1070
- }
1071
- return getInstalledPackageVersion('@nrwl/workspace', overrides);
1072
- })();
1073
- if (nxVersion) {
1074
- cache[packageName] = nxVersion;
1075
- }
1076
- return nxVersion;
1077
- }
1078
- try {
1079
- if (!cache[packageName]) {
1080
- const { packageJson, path } = (0, package_json_1.readModulePackageJson)(packageName, (0, installation_directory_1.getNxRequirePaths)(root));
1081
- // old workspaces would have the temp installation of nx in the cache,
1082
- // so the resolved package is not the one we need
1083
- if (!path.startsWith(workspace_root_1.workspaceRoot)) {
1084
- throw new Error('Resolved a package outside the workspace root.');
1085
- }
1086
- cache[packageName] = packageJson.version;
1087
- }
1088
- return cache[packageName];
1089
- }
1090
- catch {
1091
- return null;
1092
- }
1093
- }
1094
- return getInstalledPackageVersion;
1095
- }
1096
- // testing-fetch-start
1097
- function createFetcher(pmc) {
1098
- const migrationsCache = {};
1099
- const resolvedVersionCache = {};
1100
- const stats = { registryCount: 0, installCount: 0 };
1101
- function recordInstallFetch(reason) {
1102
- stats.installCount++;
1103
- stats.fallbackReason ??= reason;
1104
- }
1105
- function fetchMigrations(packageName, packageVersion, setCache) {
1106
- if (!(0, resolve_package_version_1.isRegistryResolutionEnabled)()) {
1107
- // Skip registry fetch and use installation method directly
1108
- logger_1.logger.info(`Fetching ${packageName}@${packageVersion}`);
1109
- recordInstallFetch('env-skip');
1110
- return getPackageMigrationsUsingInstall(packageName, packageVersion, pmc);
1111
- }
1112
- const cacheKey = packageName + '-' + packageVersion;
1113
- return Promise.resolve(resolvedVersionCache[cacheKey])
1114
- .then((cachedResolvedVersion) => {
1115
- if (cachedResolvedVersion) {
1116
- return cachedResolvedVersion;
1117
- }
1118
- resolvedVersionCache[cacheKey] =
1119
- (0, resolve_package_version_1.resolvePackageVersionRespectingMinReleaseAge)(packageName, packageVersion);
1120
- return resolvedVersionCache[cacheKey];
1121
- })
1122
- .then((resolvedVersion) => {
1123
- if (resolvedVersion !== packageVersion &&
1124
- migrationsCache[`${packageName}-${resolvedVersion}`]) {
1125
- return migrationsCache[`${packageName}-${resolvedVersion}`];
1126
- }
1127
- setCache(packageName, resolvedVersion);
1128
- return getPackageMigrationsUsingRegistry(packageName, resolvedVersion).then((result) => {
1129
- stats.registryCount++;
1130
- return result;
1131
- });
1132
- })
1133
- .catch((e) => {
1134
- // A cooldown violation would fail an install identically (only slower),
1135
- // so surface it instead of retrying through the package manager.
1136
- if (e instanceof errors_1.MinReleaseAgeViolationError) {
1137
- throw e;
1138
- }
1139
- logger_1.logger.verbose(`Failed to get migrations from registry for ${packageName}@${packageVersion}: ${e.message}. Falling back to install.`);
1140
- logger_1.logger.info(`Fetching ${packageName}@${packageVersion}`);
1141
- recordInstallFetch((0, migrate_analytics_1.classifyMigrateFetchFallback)(e));
1142
- return getPackageMigrationsUsingInstall(packageName, packageVersion, pmc);
1143
- });
1144
- }
1145
- const nxMigrateFetcher = (packageName, packageVersion) => {
1146
- if (migrationsCache[`${packageName}-${packageVersion}`]) {
1147
- return migrationsCache[`${packageName}-${packageVersion}`];
1148
- }
1149
- let resolvedVersion = packageVersion;
1150
- let migrations;
1151
- function setCache(packageName, packageVersion) {
1152
- migrationsCache[packageName + '-' + packageVersion] = migrations;
1153
- }
1154
- migrations = fetchMigrations(packageName, packageVersion, setCache).then((result) => {
1155
- // An exact requested version must come back verbatim; a mismatch means
1156
- // a config surface (registry proxy, override, cooldown gate) silently
1157
- // substituted another version, which would corrupt the whole plan.
1158
- if ((0, semver_1.valid)(packageVersion) &&
1159
- result.version &&
1160
- result.version !== packageVersion) {
1161
- throw new Error(`Fetching ${packageName}@${packageVersion} resolved to version ${result.version}. ` +
1162
- `Check for registry, override, or minimum-release-age configuration that hides the requested version.`);
1163
- }
1164
- if (result.schematics) {
1165
- result.generators = { ...result.schematics, ...result.generators };
1166
- delete result.schematics;
1167
- }
1168
- resolvedVersion = result.version;
1169
- return result;
1170
- });
1171
- setCache(packageName, packageVersion);
1172
- return migrations;
1173
- };
1174
- nxMigrateFetcher.stats = stats;
1175
- return nxMigrateFetcher;
1176
- }
1177
- // testing-fetch-end
1178
- async function getPackageMigrationsUsingRegistry(packageName, packageVersion) {
1179
- if ((0, provenance_1.getNxPackageGroup)().includes(packageName)) {
1180
- await (0, provenance_1.ensurePackageHasProvenance)(packageName, packageVersion);
1181
- }
1182
- // check if there are migrations in the packages by looking at the
1183
- // registry directly
1184
- const migrationsConfig = await getPackageMigrationsConfigFromRegistry(packageName, packageVersion);
1185
- if (!migrationsConfig) {
1186
- return {
1187
- name: packageName,
1188
- version: packageVersion,
1189
- };
1190
- }
1191
- if (!migrationsConfig.migrations) {
1192
- return {
1193
- name: packageName,
1194
- version: packageVersion,
1195
- packageGroup: migrationsConfig.packageGroup,
1196
- supportsOptionalMigrations: migrationsConfig.supportsOptionalMigrations,
1197
- };
1198
- }
1199
- logger_1.logger.info(`Fetching ${packageName}@${packageVersion}`);
1200
- // try to obtain the migrations from the registry directly
1201
- return await downloadPackageMigrationsFromRegistry(packageName, packageVersion, migrationsConfig);
1202
- }
1203
- // Matched exactly: a hostname that merely contains one of these is a different
1204
- // registry. registry.yarnpkg.com is npmjs' CNAME, so it serves the same
1205
- // metadata; the two loopback literals are the spellings of a local registry
1206
- // that the substring below cannot reach, since neither contains "localhost".
1207
- const FULL_METADATA_REGISTRIES = [
1208
- 'registry.npmjs.org',
1209
- 'registry.yarnpkg.com',
1210
- '127.0.0.1',
1211
- '[::1]',
1212
- ];
1213
- // Matched as substrings, since neither names a single host: a local registry
1214
- // can sit on a subdomain of localhost, and an Artifactory instance is
1215
- // identified only by that word appearing somewhere in its hostname.
1216
- const FULL_METADATA_REGISTRY_MARKERS = [
1217
- 'localhost',
1218
- 'artifactory',
1219
- ];
1220
- async function getPackageMigrationsConfigFromRegistry(packageName, packageVersion) {
1221
- const result = await (0, package_manager_1.packageRegistryView)(packageName, packageVersion, [
1222
- 'nx-migrations',
1223
- 'ng-update',
1224
- 'dist',
1225
- '--json',
1226
- ]);
1227
- if (!result) {
1228
- return null;
1229
- }
1230
- const json = JSON.parse(result);
1231
- if (!json['nx-migrations'] && !json['ng-update']) {
1232
- const registry = new node_url_1.URL('dist' in json ? json.dist.tarball : json.tarball)
1233
- .hostname;
1234
- // Other registries may not support full metadata via npm view; throw to
1235
- // trigger the install fallback.
1236
- if (!FULL_METADATA_REGISTRIES.includes(registry) &&
1237
- !FULL_METADATA_REGISTRY_MARKERS.some((v) => registry.includes(v))) {
1238
- throw new Error(`Getting migration config from registry is not supported from ${registry}`);
1239
- }
1240
- }
1241
- return (0, package_json_1.readNxMigrateConfig)(json);
1242
- }
1243
- async function downloadPackageMigrationsFromRegistry(packageName, packageVersion, { migrations: migrationsFilePath, packageGroup, supportsOptionalMigrations, }) {
1244
- const { dir, cleanup } = (0, package_manager_1.createTempNpmDirectory)();
1245
- let result;
1246
- try {
1247
- const { tarballPath } = await (0, package_manager_1.packageRegistryPack)(dir, packageName, packageVersion,
1248
- // packageVersion is exact and already resolved through the workspace
1249
- // package manager's min-release-age policy by the fetcher. In an npm
1250
- // workspace the pack gate IS that policy, so leave it enforcing; for
1251
- // other package managers npm's gate is foreign config with no
1252
- // exclusions and would wrongly re-judge the vetted version.
1253
- { bypassMinReleaseAge: (0, package_manager_1.detectPackageManager)() !== 'npm' });
1254
- const fullTarballPath = (0, path_1.join)(dir, tarballPath);
1255
- let migrations;
1256
- try {
1257
- migrations = await (0, tar_1.extractFileFromTarball)(fullTarballPath, (0, path_2.joinPathFragments)('package', migrationsFilePath), (0, path_1.join)(dir, migrationsFilePath)).then((path) => (0, fileutils_1.readJsonFile)(path));
1258
- }
1259
- catch {
1260
- throw new Error(`Failed to find migrations file "${migrationsFilePath}" in package "${packageName}@${packageVersion}".`);
1261
- }
1262
- (0, prompt_files_1.validateMigrationEntries)(packageName, packageVersion, migrations);
1263
- const resolvedPromptFiles = await (0, prompt_files_1.extractPromptFilesFromTarball)(packageName, packageVersion, migrations, migrationsFilePath, fullTarballPath, dir);
1264
- result = {
1265
- ...migrations,
1266
- packageGroup,
1267
- supportsOptionalMigrations,
1268
- version: packageVersion,
1269
- ...(resolvedPromptFiles ? { resolvedPromptFiles } : {}),
1270
- };
1271
- }
1272
- finally {
1273
- await cleanup();
1274
- }
1275
- return result;
1276
- }
1277
- function createConcurrencyLimiter(concurrency) {
1278
- const queue = [];
1279
- let active = 0;
1280
- function next() {
1281
- while (queue.length > 0 && active < concurrency) {
1282
- active++;
1283
- queue.shift()();
1284
- }
1285
- }
1286
- return function limit(fn) {
1287
- return new Promise((resolve, reject) => {
1288
- queue.push(() => {
1289
- fn()
1290
- .then(resolve, reject)
1291
- .finally(() => {
1292
- active--;
1293
- next();
1294
- });
1295
- });
1296
- next();
1297
- });
1298
- };
1299
- }
1300
- const installConcurrencyLimit = process.env.NX_MIGRATE_INSTALL_CONCURRENCY
1301
- ? createConcurrencyLimiter(Math.max(1, Math.floor(Number(process.env.NX_MIGRATE_INSTALL_CONCURRENCY)) || 1))
1302
- : null;
1303
- async function getPackageMigrationsUsingInstall(packageName, packageVersion, pmc) {
1304
- const run = () => getPackageMigrationsUsingInstallImpl(packageName, packageVersion, pmc);
1305
- return installConcurrencyLimit ? installConcurrencyLimit(run) : run();
1306
- }
1307
- async function getPackageMigrationsUsingInstallImpl(packageName, packageVersion, pmc) {
1308
- const { dir, cleanup } = (0, package_manager_1.createTempNpmDirectory)();
1309
- let result;
1310
- if ((0, provenance_1.getNxPackageGroup)().includes(packageName)) {
1311
- await (0, provenance_1.ensurePackageHasProvenance)(packageName, packageVersion);
1312
- }
1313
- try {
1314
- const addCommand = `${pmc.add} ${packageName}@${packageVersion}`;
1315
- try {
1316
- await execAsync(addCommand, {
1317
- cwd: dir,
1318
- env: {
1319
- ...process.env,
1320
- npm_config_legacy_peer_deps: 'true',
1321
- },
1322
- });
1323
- }
1324
- catch (e) {
1325
- // Only the install command failed; format it as a command failure so the
1326
- // user sees the package manager's stderr. Errors from the later steps
1327
- // (reading/validating migrations, resolving prompt files) are surfaced
1328
- // as-is by the outer catch instead of being mislabeled as install failures.
1329
- throw new Error(formatCommandFailure(addCommand, e));
1330
- }
1331
- const { migrations: migrationsFilePath, packageGroup, supportsOptionalMigrations, packageJson, } = (0, execute_migration_1.readPackageMigrationConfig)(packageName, dir);
1332
- let migrations = undefined;
1333
- let resolvedPromptFiles;
1334
- if (migrationsFilePath) {
1335
- migrations = (0, fileutils_1.readJsonFile)(migrationsFilePath);
1336
- (0, prompt_files_1.validateMigrationEntries)(packageName, packageVersion, migrations);
1337
- resolvedPromptFiles = await (0, prompt_files_1.readPromptFilesFromInstall)(packageName, packageVersion, migrations, migrationsFilePath);
1338
- }
1339
- result = {
1340
- ...migrations,
1341
- packageGroup,
1342
- supportsOptionalMigrations,
1343
- version: packageJson.version,
1344
- ...(resolvedPromptFiles ? { resolvedPromptFiles } : {}),
1345
- };
1346
- }
1347
- catch (e) {
1348
- throw new Error([
1349
- `Failed to fetch migrations for ${packageName}@${packageVersion}`,
1350
- e instanceof Error ? e.message : String(e),
1351
- ].join('\n'));
1352
- }
1353
- finally {
1354
- await cleanup();
1355
- }
1356
- return result;
1357
- }
1358
- async function createMigrationsFile(root, migrations) {
1359
- await (0, write_formatted_json_file_1.writeFormattedJsonFile)((0, path_1.join)(root, 'migrations.json'), { migrations });
1360
- }
1361
- async function updatePackageJson(root, updatedPackages) {
1362
- const packageJsonPath = (0, path_1.join)(root, 'package.json');
1363
- if (!(0, fs_1.existsSync)(packageJsonPath)) {
1364
- return false;
1365
- }
1366
- const parseOptions = {};
1367
- const json = (0, fileutils_1.readJsonFile)(packageJsonPath, parseOptions);
1368
- const manager = (0, catalog_1.getCatalogManager)(root);
1369
- const catalogUpdates = [];
1370
- let modified = false;
1371
- Object.keys(updatedPackages).forEach((p) => {
1372
- const existingVersion = json.dependencies?.[p] ?? json.devDependencies?.[p];
1373
- if (existingVersion && manager?.isCatalogReference(existingVersion)) {
1374
- const { catalogName } = manager.parseCatalogReference(existingVersion);
1375
- catalogUpdates.push({
1376
- packageName: p,
1377
- version: updatedPackages[p].version,
1378
- catalogName,
1379
- });
1380
- // don't overwrite the catalog reference with the new version
1381
- return;
1382
- }
1383
- // Update non-catalog packages in package.json
1384
- if (json.devDependencies?.[p]) {
1385
- if (json.devDependencies[p] !== updatedPackages[p].version) {
1386
- json.devDependencies[p] = updatedPackages[p].version;
1387
- modified = true;
1388
- }
1389
- return;
1390
- }
1391
- if (json.dependencies?.[p]) {
1392
- if (json.dependencies[p] !== updatedPackages[p].version) {
1393
- json.dependencies[p] = updatedPackages[p].version;
1394
- modified = true;
1395
- }
1396
- return;
1397
- }
1398
- const dependencyType = updatedPackages[p].addToPackageJson;
1399
- if (typeof dependencyType === 'string') {
1400
- json[dependencyType] ??= {};
1401
- if (json[dependencyType][p] !== updatedPackages[p].version) {
1402
- json[dependencyType][p] = updatedPackages[p].version;
1403
- modified = true;
1404
- }
1405
- }
1406
- });
1407
- if (modified) {
1408
- await (0, write_formatted_json_file_1.writeFormattedJsonFile)(packageJsonPath, json, {
1409
- appendNewLine: parseOptions.endsWithNewline,
1410
- });
1411
- }
1412
- // Update catalog definitions
1413
- if (catalogUpdates.length) {
1414
- // manager is guaranteed to be defined when there are catalog updates
1415
- manager.updateCatalogVersions(root, catalogUpdates);
1416
- await formatCatalogDefinitionFiles(manager, root);
1417
- }
1418
- return modified || catalogUpdates.length > 0;
1419
- }
1420
- async function formatCatalogDefinitionFiles(manager, root) {
1421
- const catalogDefinitionFilePaths = manager.getCatalogDefinitionFilePaths();
1422
- const catalogDefinitionFiles = catalogDefinitionFilePaths.map((filePath) => {
1423
- const absolutePath = (0, path_1.join)(root, filePath);
1424
- return {
1425
- path: filePath,
1426
- absolutePath,
1427
- content: (0, fs_1.readFileSync)(absolutePath, 'utf-8'),
1428
- };
1429
- });
1430
- const results = await (0, format_changed_files_1.formatFileContents)(catalogDefinitionFiles.map(({ path, content }) => ({ path, content })), root, { silent: true });
1431
- for (const { path, absolutePath, content } of catalogDefinitionFiles) {
1432
- (0, fs_1.writeFileSync)(absolutePath, results.has(path) ? results.get(path) : content, { encoding: 'utf-8' });
1433
- }
1434
- }
1435
- async function updateInstallationDetails(root, updatedPackages) {
1436
- const nxJsonPath = (0, path_1.join)(root, 'nx.json');
1437
- const parseOptions = {};
1438
- const nxJson = (0, fileutils_1.readJsonFile)(nxJsonPath, parseOptions);
1439
- if (!nxJson.installation) {
1440
- return false;
1441
- }
1442
- let modified = false;
1443
- const nxVersion = updatedPackages.nx?.version;
1444
- if (nxVersion && nxJson.installation.version !== nxVersion) {
1445
- nxJson.installation.version = nxVersion;
1446
- modified = true;
1447
- }
1448
- if (nxJson.installation.plugins) {
1449
- for (const dep in nxJson.installation.plugins) {
1450
- const update = updatedPackages[dep];
1451
- if (update) {
1452
- const newVersion = (0, semver_1.valid)(update.version)
1453
- ? update.version
1454
- : await (0, resolve_package_version_1.resolvePackageVersionRespectingMinReleaseAge)(dep, update.version);
1455
- if (nxJson.installation.plugins[dep] !== newVersion) {
1456
- nxJson.installation.plugins[dep] = newVersion;
1457
- modified = true;
1458
- }
1459
- }
1460
- }
1461
- }
1462
- if (modified) {
1463
- await (0, write_formatted_json_file_1.writeFormattedJsonFile)(nxJsonPath, nxJson, {
1464
- appendNewLine: parseOptions.endsWithNewline,
1465
- });
1466
- }
1467
- return modified;
1468
- }
1469
- async function isMigratingToNewMajor(from, to) {
1470
- from = (0, version_utils_1.normalizeVersion)(from);
1471
- to = ['latest', 'next', 'canary'].includes(to) ? to : (0, version_utils_1.normalizeVersion)(to);
1472
- if (!(0, semver_1.valid)(from)) {
1473
- from = await (0, resolve_package_version_1.resolvePackageVersionRespectingMinReleaseAge)('nx', from);
1474
- }
1475
- if (!(0, semver_1.valid)(to)) {
1476
- to = await (0, resolve_package_version_1.resolvePackageVersionRespectingMinReleaseAge)('nx', to);
1477
- }
1478
- return (0, semver_1.major)(from) < (0, semver_1.major)(to);
1479
- }
1480
- function readNxVersion(packageJson, root) {
1481
- return ((0, package_json_1.getDependencyVersionFromPackageJson)('nx', root, packageJson) ??
1482
- (0, package_json_1.getDependencyVersionFromPackageJson)('@nx/workspace', root, packageJson) ??
1483
- (0, package_json_1.getDependencyVersionFromPackageJson)('@nrwl/workspace', root, packageJson));
1484
- }
1485
- // Exported for testing the optional-include orchestration seam (see NXC-4590).
1486
- async function generateMigrationsJsonAndUpdatePackageJson(root, opts, fetch) {
1487
- const pmc = (0, package_manager_1.getPackageManagerCommand)();
1488
- let phase = 'fetch_migrations';
1489
- try {
1490
- const rootPkgJsonPath = (0, path_1.join)(root, 'package.json');
1491
- let originalPackageJson = (0, fs_1.existsSync)(rootPkgJsonPath)
1492
- ? (0, fileutils_1.readJsonFile)(rootPkgJsonPath)
1493
- : null;
1494
- const originalNxJson = (0, configuration_1.readNxJson)();
1495
- const from = originalNxJson.installation?.version ??
1496
- readNxVersion(originalPackageJson, root);
1497
- const include = opts.include;
1498
- (0, migrate_analytics_1.setMigrateInclude)(include);
1499
- let walkedTargetPackage = opts.targetPackage;
1500
- let fromOverrides = opts.from;
1501
- let excludeApplied = opts.excludeAppliedMigrations;
1502
- if (include === 'optional') {
1503
- // The `optional` value catches up the deps the target manages, so walk the
1504
- // target from zero, against `nx`'s full managed-deps closure.
1505
- walkedTargetPackage = toNxClosurePackage(opts.targetPackage);
1506
- fromOverrides = { [walkedTargetPackage]: '0.0.0' };
1507
- excludeApplied = true;
1508
- }
1509
- logger_1.logger.info(`Fetching meta data about packages.`);
1510
- logger_1.logger.info(`It may take a few minutes.`);
1511
- const resolvedFetch = fetch ?? createFetcher(pmc);
1512
- let requiredPackages;
1513
- if (include === 'required' || include === 'optional') {
1514
- // `@nx/workspace` declares an intentionally narrow `packageGroup`
1515
- // ({ nx, nx-cloud }) in its migrations config, whereas `nx` declares the
1516
- // full @nx/* plugin fan-out. Their transitive required closures are
1517
- // equivalent, so resolve the closure against `nx`.
1518
- const sourcePackage = toNxClosurePackage(walkedTargetPackage);
1519
- const rootMetadata = await resolvedFetch(sourcePackage, opts.targetVersion);
1520
- // Legacy `@nrwl/workspace<14` doesn't ship a complete `packageGroup`
1521
- // in its metadata; the Migrator's cascade injects
1522
- // `LEGACY_NRWL_PACKAGE_GROUP` for that case, and the post-build
1523
- // optional filter must mirror that set or required `@nrwl/*`
1524
- // plugins slip past it.
1525
- const packageGroup = sourcePackage === '@nrwl/workspace' && (0, version_utils_1.isLegacyEra)(opts.targetVersion)
1526
- ? LEGACY_NRWL_PACKAGE_GROUP
1527
- : rootMetadata.packageGroup;
1528
- requiredPackages = resolveRequiredPackages(sourcePackage, packageGroup);
1529
- }
1530
- const installedPackageVersions = createInstalledPackageVersionsResolver(root);
1531
- const migrator = new Migrator({
1532
- packageJson: originalPackageJson,
1533
- nxInstallation: originalNxJson.installation,
1534
- getInstalledPackageVersion: installedPackageVersions,
1535
- fetch: resolvedFetch,
1536
- from: fromOverrides,
1537
- to: opts.to,
1538
- interactive: opts.interactive && !(0, is_ci_1.isCI)(),
1539
- excludeAppliedMigrations: excludeApplied,
1540
- include,
1541
- requiredPackages,
1542
- });
1543
- const { migrations, packageUpdates, promptContents, minVersionWithSkippedUpdates, } = await migrator.migrate(walkedTargetPackage, opts.targetVersion);
1544
- // The cascade collects packageJsonUpdates entries against the cascade
1545
- // root's installed version, but inner per-package pins are only gated
1546
- // against the in-flight cascade tally — not against each inner package's
1547
- // installed version. A from-zero walk (e.g. `--include=optional`) can
1548
- // surface a stale historical pin that would write a lower version than
1549
- // the user already has. Drop those before writing; nx migrate is
1550
- // forward-only, never a downgrade.
1551
- phase = 'package_updates';
1552
- // Resolve catalog: specifiers first so the filter compares real versions.
1553
- const writableUpdates = (0, update_filters_1.filterDowngradedUpdates)(packageUpdates, (0, catalog_1.resolveCatalogSpecifiers)(originalPackageJson), installedPackageVersions);
1554
- const wrotePackageJson = await updatePackageJson(root, writableUpdates);
1555
- const wroteNxJsonInstallation = await updateInstallationDetails(root, writableUpdates);
1556
- // Under `--include=optional` the target's own entry is filtered out of
1557
- // `packageUpdates` (it's a required package), so resolve the version
1558
- // defensively. Also reused by the completion analytics below.
1559
- const resolvedTargetVersion = packageUpdates[walkedTargetPackage]?.version ?? opts.targetVersion;
1560
- const promptMigrationFiles = (0, prompt_files_1.writePromptMigrationFiles)(root, migrations, promptContents ?? {}, resolvedTargetVersion);
1561
- if (migrations.length > 0) {
1562
- await createMigrationsFile(root, [
1563
- ...addSplitConfigurationMigrationIfAvailable(from, writableUpdates),
1564
- ...migrations,
1565
- ]);
1566
- }
1567
- const includeLine = include === 'required'
1568
- ? `- Processed required updates only (skipped optional dependency bumps).`
1569
- : include === 'optional'
1570
- ? `- Processed optional dependency updates only (skipped required package updates).`
1571
- : null;
1572
- // The param expressions below evaluate before the report function is
1573
- // entered; `safeReport` keeps them inside the analytics boundary so a
1574
- // param-building throw can't surface here and convert an already
1575
- // successful migrate into a reported failure.
1576
- const recordCompletion = () => (0, migrate_analytics_1.safeReport)(() => (0, migrate_analytics_1.reportMigrateGenerateComplete)({
1577
- targetVersion: resolvedTargetVersion,
1578
- requestedTargetVersion: opts.originalTargetVersion ?? resolvedTargetVersion,
1579
- installedTargetVersion: (0, multi_major_1.isNxTarget)(opts.targetPackage, opts.targetVersion)
1580
- ? from
1581
- : installedPackageVersions(opts.targetPackage),
1582
- include,
1583
- multiMajorChoice: opts.multiMajorChoice,
1584
- fetchStats: resolvedFetch.stats,
1585
- }));
1586
- const noChanges = !wrotePackageJson && !wroteNxJsonInstallation && migrations.length === 0;
1587
- if (noChanges) {
1588
- output_1.output.success({
1589
- title: `No updates were applied.`,
1590
- bodyLines: [
1591
- ...(includeLine ? [includeLine] : []),
1592
- include === 'optional'
1593
- ? `- No optional dependency updates were found for the installed version. Either your dependencies are already up to date, or this workspace doesn't manage them in a place 'nx migrate' writes to (e.g. non-JS workspaces).`
1594
- : `- No package updates or migrations were found.`,
1595
- ],
1596
- });
1597
- // Nothing was applied; skip the "Next steps" guidance below — it would
1598
- // tell the user to inspect package.json changes that don't exist.
1599
- recordCompletion();
1600
- return;
1601
- }
1602
- output_1.output.success({
1603
- title: `The migrate command has run successfully.`,
1604
- bodyLines: [
1605
- ...(includeLine ? [includeLine] : []),
1606
- ...(wrotePackageJson ? [`- package.json has been updated.`] : []),
1607
- ...(wroteNxJsonInstallation
1608
- ? [`- nx.json (installation) has been updated.`]
1609
- : []),
1610
- migrations.length > 0
1611
- ? `- migrations.json has been generated.`
1612
- : `- There are no migrations to run, so migrations.json has not been created.`,
1613
- ...(promptMigrationFiles.length > 0
1614
- ? [
1615
- `- ${promptMigrationFiles.length} AI migration prompt(s) have been written to ${prompt_files_1.AI_MIGRATIONS_DIR}/.`,
1616
- ]
1617
- : []),
1618
- ],
1619
- });
1620
- try {
1621
- if (opts.interactive !== false &&
1622
- ['nx', '@nrwl/workspace'].includes(opts.targetPackage) &&
1623
- (await isMigratingToNewMajor(from, opts.targetVersion)) &&
1624
- !(0, is_ci_1.isCI)() &&
1625
- !(0, nx_cloud_utils_1.isNxCloudDisabled)(originalNxJson) &&
1626
- !(0, nx_cloud_utils_1.isNxCloudUsed)(originalNxJson)) {
1627
- output_1.output.success({
1628
- title: 'Connect to Nx Cloud',
1629
- bodyLines: [
1630
- 'Nx Cloud is a first-party CI companion for Nx projects. It improves critical aspects of CI:',
1631
- '- Speed: 30% - 70% faster CI',
1632
- '- Cost: 40% - 75% reduction in CI costs',
1633
- '- Reliability: by automatically identifying flaky tasks and re-running them',
1634
- ],
1635
- });
1636
- await (0, connect_to_nx_cloud_1.connectToNxCloudWithPrompt)('migrate');
1637
- originalPackageJson = (0, fileutils_1.readJsonFile)((0, path_1.join)(root, 'package.json'));
1638
- }
1639
- }
1640
- catch {
1641
- // The above code is to remind folks when updating to a new major and not currently using Nx cloud.
1642
- // If for some reason it fails, it shouldn't affect the overall migration process
1643
- }
1644
- const bodyLines = process.env['NX_CONSOLE']
1645
- ? [
1646
- '- Inspect the package.json changes in the built-in diff editor [Click to open]',
1647
- '- Confirm the changes to install the new dependencies and continue the migration',
1648
- ]
1649
- : [
1650
- `- Make sure package.json changes make sense and then run '${pmc.install}',`,
1651
- ...(promptMigrationFiles.length > 0
1652
- ? [
1653
- `- Review and tweak the AI migration prompts in ${prompt_files_1.AI_MIGRATIONS_DIR}/ as needed.`,
1654
- ]
1655
- : []),
1656
- ...(migrations.length > 0
1657
- ? [`- Run '${pmc.exec} nx migrate --run-migrations'`]
1658
- : []),
1659
- ...(opts.originalTargetVersion
1660
- ? [
1661
- `- After applying these migrations, run '${pmc.exec} nx migrate ${opts.targetPackage}@${opts.originalTargetVersion} --include=${opts.include}${opts.multiMajorMode === 'gradual'
1662
- ? ` ${multi_major_1.MULTI_MAJOR_MODE_FLAG}=gradual`
1663
- : ''}' to continue toward your original target.`,
1664
- ]
1665
- : []),
1666
- ...(opts.interactive && minVersionWithSkippedUpdates
1667
- ? [
1668
- `- You opted out of some migrations for now. Write the following command down somewhere to apply these migrations later:`,
1669
- ` nx migrate ${opts.targetVersion} --from ${opts.targetPackage}@${minVersionWithSkippedUpdates} --exclude-applied-migrations`,
1670
- `- To learn more go to https://nx.dev/recipes/tips-n-tricks/advanced-update`,
1671
- ]
1672
- : [
1673
- `- To learn more go to https://nx.dev/features/automate-updating-dependencies`,
1674
- ]),
1675
- ...(showConnectToCloudMessage()
1676
- ? [
1677
- `- You may run '${pmc.run('nx', 'connect-to-nx-cloud')}' to get faster builds, GitHub integration, and more. Check out https://nx.app`,
1678
- ]
1679
- : []),
1680
- ];
1681
- output_1.output.log({
1682
- title: 'Next steps:',
1683
- bodyLines,
1684
- });
1685
- recordCompletion();
1686
- }
1687
- catch (e) {
1688
- (0, migrate_analytics_1.reportMigrateGenerateError)(phase, e);
1689
- output_1.output.error({
1690
- title: `The migrate command failed.`,
1691
- });
1692
- throw e;
1693
- }
1694
- }
1695
- function addSplitConfigurationMigrationIfAvailable(from, packageJson) {
1696
- if (!packageJson['@nrwl/workspace'])
1697
- return [];
1698
- if ((0, semver_1.gte)(packageJson['@nrwl/workspace'].version, '15.7.0-beta.0') &&
1699
- (0, semver_1.lt)((0, version_utils_1.normalizeVersion)(from), '15.7.0-beta.0')) {
1700
- return [
1701
- {
1702
- version: '15.7.0-beta.0',
1703
- description: 'Split global configuration files into individual project.json files. This migration has been added automatically to the beginning of your migration set to retroactively make them work with the new version of Nx.',
1704
- implementation: './src/migrations/update-15-7-0/split-configuration-into-project-json-files',
1705
- package: '@nrwl/workspace',
1706
- name: '15-7-0-split-configuration-into-project-json-files',
1707
- },
1708
- ];
1709
- }
1710
- else {
1711
- return [];
1712
- }
1713
- }
1714
- function showConnectToCloudMessage() {
1715
- try {
1716
- const nxJson = (0, configuration_1.readNxJson)();
1717
- const defaultRunnerIsUsed = (0, connect_to_nx_cloud_1.onlyDefaultRunnerIsUsed)(nxJson);
1718
- return !!defaultRunnerIsUsed;
1719
- }
1720
- catch {
1721
- return false;
1722
- }
1723
- }
1724
- function formatSkippedPromptsNextStep(skipped) {
1725
- return [
1726
- 'Some prompt migrations were skipped. Review and apply each of the following prompt files to the workspace, in the listed order:',
1727
- ...skipped.map((m) => ` - ${m.prompt}`),
1728
- ].join('\n');
1729
- }
1730
- async function executeMigrations(root, migrations, isVerbose, shouldCreateCommits, commitPrefix, shouldSkipInstall = false, agentic, agenticHasDiffContext = false, shouldRunValidation = false) {
1731
- const changedDepInstaller = new execute_migration_1.ChangedDepInstaller(root, shouldSkipInstall);
1732
- const migrationsWithNoChanges = [];
1733
- const sortedMigrations = (0, sort_migrations_1.sortMigrations)(migrations, {
1734
- hoistHandoffGitignore: agentic?.kind === 'enabled',
1735
- });
1736
- // Lazy-load the agentic chain so non-agentic runs don't pay its startup cost.
1737
- let agenticRun;
1738
- if (agentic?.kind === 'enabled' && sortedMigrations.length > 0) {
1739
- const { initRunDir, resolveAgenticRunId } = require('./agentic/handoff');
1740
- const { runAgenticPromptStep } = require('./agentic/run-step');
1741
- agenticRun = {
1742
- agentic,
1743
- runDir: initRunDir(root, resolveAgenticRunId(sortedMigrations)),
1744
- runStep: runAgenticPromptStep,
1745
- };
1746
- }
1747
- const printDroppedAgentContext = agentic?.kind === 'inside-agent'
1748
- ? require('./agentic/print-dropped-agent-context').printDroppedAgentContextForOuterAgent
1749
- : undefined;
1750
- logger_1.logger.info(`Running the following migrations:`);
1751
- sortedMigrations.forEach((m) => logger_1.logger.info(m.description
1752
- ? `- ${m.package}: ${m.name} — ${m.description}`
1753
- : `- ${m.package}: ${m.name}`));
1754
- logger_1.logger.info('');
1755
- // Tracked separately from `skippedPrompts` so the end-of-run logic can
1756
- // render them distinctly per resolution mode.
1757
- const migrationEmittedNextSteps = [];
1758
- const skippedPrompts = [];
1759
- // One record per migration the loop touched. `status: 'completed'` records
1760
- // are pushed at the end of each successful iteration; `status: 'aborted'`
1761
- // is pushed by the catch block when a migration throws mid-iteration, so
1762
- // `outcomes` is the single source of truth for the recap and tally — no
1763
- // parallel "pending" list. `outcomes.length` always equals `migrationIndex`
1764
- // after the loop body runs.
1765
- const outcomes = [];
1766
- // Prompt-only migrations whose agent never ran. Hybrid migrations with a
1767
- // skipped prompt are NOT counted here — their deterministic half still ran.
1768
- let notRunMigrationsCount = 0;
1769
- const skipReason = agentic?.kind === 'inside-agent'
1770
- ? 'deferred to the AI agent driving this run'
1771
- : 'agentic flow disabled';
1772
- const installDepsIfChanged = () => changedDepInstaller.installDepsIfChanged();
1773
- // Returns the migrations whose own commits failed and whose diffs are
1774
- // still sitting in the working tree — derived live from `outcomes`. The
1775
- // next successful commit absorbs them via `git add -A`; its commit body
1776
- // lists them so a reader of `git log -p` can see which prior migrations'
1777
- // diffs got pulled in.
1778
- const pendingForCommitBody = () => outcomes
1779
- .filter((o) => o.commit.kind === 'failed')
1780
- .map((o) => ({ package: o.migration.package, name: o.migration.name }));
1781
- // True while at least one prior migration's commit has failed and its
1782
- // diff hasn't been absorbed yet. While true, the working tree carries
1783
- // prior-migration state, so the `hasDiffContext` flag in the hybrid-
1784
- // agentic and validation-agentic prompt branches is suppressed (the
1785
- // prompt-only-with-agentic branch doesn't use `hasDiffContext`).
1786
- const hasPendingCommitDebt = () => outcomes.some((o) => o.commit.kind === 'failed');
1787
- // Single funnel for per-migration commit attempts. Returns the
1788
- // `CommitState` to record on the migration's outcome. On `committed`,
1789
- // back-annotates any prior failed-commit outcomes to `kind: 'absorbed'`
1790
- // (their diffs were just rolled into this commit via `git add -A`).
1791
- async function attemptMigrationCommit(m) {
1792
- const pending = pendingForCommitBody();
1793
- const result = await (0, migrate_commits_1.commitMigrationIfRequested)(root, m, shouldCreateCommits, commitPrefix, installDepsIfChanged, pending);
1794
- if (result.status === 'committed') {
1795
- // This commit absorbed every pending failed-commit migration's diff.
1796
- // Transition their `commit.kind: 'failed'` records to `'absorbed'` so
1797
- // the failure recap (if a later migration throws) can anchor them
1798
- // and the retained-state filter no longer counts them as
1799
- // uncommitted.
1800
- //
1801
- // The key is `package:name`; matching on `name` alone would conflate
1802
- // across packages. Guard the kind check so a subsequent absorption-
1803
- // of-same-name cannot overwrite an earlier annotation.
1804
- if (pending.length > 0) {
1805
- const absorbedKeys = new Set(pending.map((p) => `${p.package}:${p.name}`));
1806
- for (const o of outcomes) {
1807
- const key = `${o.migration.package}:${o.migration.name}`;
1808
- if (absorbedKeys.has(key) && o.commit.kind === 'failed') {
1809
- o.commit = {
1810
- kind: 'absorbed',
1811
- into: { name: m.name, sha: result.sha },
1812
- };
1813
- }
1814
- }
1815
- }
1816
- return { kind: 'landed', sha: result.sha };
1817
- }
1818
- if (result.status === 'failed') {
1819
- // Diff is still in WT. Subsequent prompts cannot claim git-isolation
1820
- // until a later commit absorbs the backlog.
1821
- return { kind: 'failed' };
1822
- }
1823
- // `no-changes` and `disabled` — no commit attempted, nothing to record
1824
- // as a commit failure.
1825
- return { kind: 'none' };
1826
- }
1827
- // Records what a migration's deterministic phase produced. A migration that
1828
- // changed nothing must not attempt a commit: the absorbing `git add -A`
1829
- // would build a commit subject naming this no-op migration even though its
1830
- // content is entirely prior pending diffs, confusing `git log` / `git blame`
1831
- // attribution. Pending stays pending and the next change-producing migration
1832
- // absorbs it.
1833
- async function commitOrRecordNoChanges(m, madeChanges) {
1834
- if (!madeChanges) {
1835
- migrationsWithNoChanges.push(m);
1836
- return { kind: 'none' };
1837
- }
1838
- const commit = await attemptMigrationCommit(m);
1839
- if (commit.kind === 'landed' && commit.sha) {
1840
- logger_1.logger.info(pc.dim(`Committed as ${commit.sha}`));
1841
- }
1842
- return commit;
1843
- }
1844
- const totalMigrations = sortedMigrations.length;
1845
- let migrationIndex = 0;
1846
- for (const m of sortedMigrations) {
1847
- migrationIndex++;
1848
- (0, migrate_output_1.logMigrationBoundary)(migrationIndex, totalMigrations, m.package, m.name);
1849
- // Snapshot the WT for before/after comparison in the catch block.
1850
- // Content-sensitive so a dirty→dirty case (this migration mutating an
1851
- // already-dirty shared file like `package.json`) doesn't collapse.
1852
- const baselineWorkingTreeSnapshot = (0, git_utils_1.getUncommittedChangesSnapshot)(root);
1853
- // Tracks whether a failure originated in the agentic step so the error
1854
- // event classifies it as 'agentic' rather than 'migration_exec'.
1855
- let inAgenticStep = false;
1856
- try {
1857
- // Read this migration's collection once and derive everything from it:
1858
- // the implementation context (passed to runNxOrAngularMigration) and the
1859
- // documentation path (passed to the agent). Read fresh per iteration so a
1860
- // prior migration's reinstall is reflected.
1861
- const { resolvedCollection, documentationPath } = resolveMigrationForRun(root, m, !!agenticRun);
1862
- let outcome;
1863
- let commit = { kind: 'none' };
1864
- // Set when the migration returned `skipAgentic: true` and something was
1865
- // actually waived, so the end-of-run recaps can report it. A hybrid's
1866
- // prompt is owed in every agentic mode, so waiving it always counts; a
1867
- // generator-only migration only counts when validation would have run.
1868
- let waivedAgenticStep = false;
1869
- if ((0, migration_shape_1.isPromptOnlyMigration)(m)) {
1870
- if (agenticRun) {
1871
- inAgenticStep = true;
1872
- const stepResult = await agenticRun.runStep({
1873
- root,
1874
- migration: m,
1875
- agentic: agenticRun.agentic,
1876
- runDir: agenticRun.runDir,
1877
- installDepsIfChanged,
1878
- documentationPath,
1879
- });
1880
- inAgenticStep = false;
1881
- commit = await attemptMigrationCommit(m);
1882
- (0, migrate_output_1.logAgenticSuccessOutcome)(stepResult.ambiguous ? 'Marked complete by user' : 'Applied', commit.kind === 'landed' ? commit.sha : null, stepResult.summary);
1883
- outcome = 'applied';
1884
- }
1885
- else {
1886
- logger_1.logger.info(pc.dim(`↷ Skipped — ${skipReason}. Listed in next steps.`));
1887
- skippedPrompts.push(m);
1888
- notRunMigrationsCount++;
1889
- outcome = 'deferred';
1890
- }
1891
- }
1892
- else if ((0, migration_shape_1.isHybridMigration)(m)) {
1893
- const { changes, nextSteps, agentContext, skipAgentic, logs, madeChanges, } = await (0, execute_migration_1.runNxOrAngularMigration)(root, m, isVerbose,
1894
- /* captureGeneratorOutput: */ !!agenticRun, resolvedCollection);
1895
- migrationEmittedNextSteps.push(...nextSteps);
1896
- if (skipAgentic) {
1897
- // The generator reported the prompt half unnecessary, so nothing is
1898
- // owed: no agent run, and no next-steps entry telling the user to
1899
- // run the prompt themselves. Runs in all three agentic modes.
1900
- (0, migrate_output_1.logWaivedAgenticStep)(m, agentContext);
1901
- waivedAgenticStep = true;
1902
- commit = await commitOrRecordNoChanges(m, madeChanges);
1903
- outcome = madeChanges ? 'applied' : 'no-changes';
1904
- }
1905
- else if (agenticRun) {
1906
- // Install any deps the deterministic phase added/bumped before the
1907
- // agent runs — the prompt half may depend on them being present in
1908
- // node_modules.
1909
- await installDepsIfChanged();
1910
- inAgenticStep = true;
1911
- const stepResult = await agenticRun.runStep({
1912
- root,
1913
- migration: m,
1914
- agentic: agenticRun.agentic,
1915
- runDir: agenticRun.runDir,
1916
- installDepsIfChanged,
1917
- documentationPath,
1918
- implContext: {
1919
- logs,
1920
- changes,
1921
- agentContext,
1922
- // When prior commits failed, the working tree carries their
1923
- // diff. The git-inspect path of the prompt would mislead the
1924
- // agent in that case; fall back to embedded `<files_changed>`.
1925
- hasDiffContext: agenticHasDiffContext && !hasPendingCommitDebt(),
1926
- },
1927
- });
1928
- inAgenticStep = false;
1929
- commit = await attemptMigrationCommit(m);
1930
- (0, migrate_output_1.logAgenticSuccessOutcome)(stepResult.ambiguous ? 'Marked complete by user' : 'Applied', commit.kind === 'landed' ? commit.sha : null, stepResult.summary);
1931
- outcome = 'applied';
1932
- }
1933
- else {
1934
- // The inner prompt step doesn't run here (agentic disabled, or
1935
- // running inside an outer agent). Under `inside-agent`, surface the
1936
- // generator-emitted `agentContext` to stdout so the outer driving
1937
- // agent can ingest it. Under `disabled` the run is human-driven;
1938
- // agent-targeted context would only add noise — drop.
1939
- logger_1.logger.info(pc.dim(`↷ Prompt phase skipped — ${skipReason}. Listed in next steps.`));
1940
- if (printDroppedAgentContext && agentContext.length > 0) {
1941
- printDroppedAgentContext({ migration: m, agentContext });
1942
- }
1943
- skippedPrompts.push(m);
1944
- commit = await commitOrRecordNoChanges(m, madeChanges);
1945
- outcome = 'deferred';
1946
- }
1947
- }
1948
- else {
1949
- // Defer commit until validation succeeds; failed validation leaves
1950
- // changes uncommitted in the working tree for the user to review.
1951
- const validationRun = agenticRun && shouldRunValidation ? agenticRun : undefined;
1952
- const { changes, nextSteps, agentContext, skipAgentic, logs, madeChanges, } = await (0, execute_migration_1.runNxOrAngularMigration)(root, m, isVerbose,
1953
- /* captureGeneratorOutput: */ !!validationRun, resolvedCollection);
1954
- migrationEmittedNextSteps.push(...nextSteps);
1955
- // Whether a validation step was on the table at all. `skipAgentic`
1956
- // waives nothing when it wasn't, so the whole waived path hangs off
1957
- // this, not just the log line.
1958
- const validationApplies = !!validationRun && changes.length > 0;
1959
- const canRunValidation = validationApplies && !skipAgentic;
1960
- if (canRunValidation) {
1961
- // Install any deps the deterministic phase added/bumped before the
1962
- // validation agent runs — the agent may run tasks that need them.
1963
- await installDepsIfChanged();
1964
- inAgenticStep = true;
1965
- const stepResult = await validationRun.runStep({
1966
- root,
1967
- migration: m,
1968
- agentic: validationRun.agentic,
1969
- runDir: validationRun.runDir,
1970
- installDepsIfChanged,
1971
- documentationPath,
1972
- implContext: {
1973
- logs,
1974
- changes,
1975
- agentContext,
1976
- // See the hybrid agentic branch above for the rationale on
1977
- // why pending commit debt gates git-inspect context.
1978
- hasDiffContext: agenticHasDiffContext && !hasPendingCommitDebt(),
1979
- },
1980
- mode: 'generic-validation',
1981
- });
1982
- inAgenticStep = false;
1983
- commit = await attemptMigrationCommit(m);
1984
- (0, migrate_output_1.logAgenticSuccessOutcome)(stepResult.ambiguous
1985
- ? 'Marked complete by user'
1986
- : 'Validation passed', commit.kind === 'landed' ? commit.sha : null, stepResult.summary);
1987
- outcome = 'applied';
1988
- }
1989
- else {
1990
- if (skipAgentic && validationApplies) {
1991
- (0, migrate_output_1.logWaivedAgenticStep)(m, agentContext);
1992
- waivedAgenticStep = true;
1993
- }
1994
- else if (printDroppedAgentContext && agentContext.length > 0) {
1995
- // Inner validation step didn't run. Surface `agentContext` under
1996
- // `inside-agent` so the outer driving agent can ingest it.
1997
- printDroppedAgentContext({ migration: m, agentContext });
1998
- }
1999
- commit = await commitOrRecordNoChanges(m, madeChanges);
2000
- outcome = madeChanges ? 'applied' : 'no-changes';
2001
- }
2002
- }
2003
- outcomes.push({
2004
- migration: { package: m.package, name: m.name },
2005
- status: 'completed',
2006
- kind: outcome,
2007
- commit,
2008
- waivedAgenticStep,
2009
- });
2010
- logger_1.logger.info('');
2011
- }
2012
- catch (e) {
2013
- // Record the in-flight migration as `aborted` so the recap and tally
2014
- // see it. `commit: 'failed'` requires both: (1) commits were
2015
- // requested — otherwise the "could not be created" recap line is
2016
- // false; (2) the WT snapshot diverged from the iteration baseline —
2017
- // net-new state, not the pre-existing pending diff. Else `'none'`.
2018
- const leftNewDiff = (0, git_utils_1.getUncommittedChangesSnapshot)(root) !== baselineWorkingTreeSnapshot;
2019
- outcomes.push({
2020
- migration: { package: m.package, name: m.name },
2021
- status: 'aborted',
2022
- commit: shouldCreateCommits && leftNewDiff
2023
- ? { kind: 'failed' }
2024
- : { kind: 'none' },
2025
- });
2026
- // `nx repair` reuses executeMigrations; only record for migrate runs.
2027
- if ((0, migrate_analytics_1.hasMigrateRunStarted)()) {
2028
- (0, migrate_analytics_1.reportMigrateRunError)({
2029
- code: e instanceof execute_migration_1.NpmPeerDepsInstallError
2030
- ? 'npm_install'
2031
- : inAgenticStep
2032
- ? 'agentic'
2033
- : 'migration_exec',
2034
- migrationPackage: m.package,
2035
- migrationName: m.name,
2036
- migrationCount: totalMigrations,
2037
- error: e,
2038
- });
2039
- }
2040
- if (!(e instanceof execute_migration_1.NpmPeerDepsInstallError)) {
2041
- // `withGeneratorOutputCapture` attaches the generator's `console.*`
2042
- // output as `capturedLogs` (best-effort; may be absent). Surface it
2043
- // so the user sees what the generator printed before it crashed.
2044
- const capturedLogs = e?.capturedLogs;
2045
- const bodyLines = typeof capturedLogs === 'string' && capturedLogs.length > 0
2046
- ? [
2047
- 'Output from the generator before it failed:',
2048
- '',
2049
- ...capturedLogs.split('\n'),
2050
- ]
2051
- : undefined;
2052
- output_1.output.error({
2053
- title: `Failed to run ${m.name} from ${m.package}. This workspace is NOT up to date!`,
2054
- bodyLines,
2055
- });
2056
- (0, migrate_output_1.logFailureRecap)({
2057
- migrationIndex,
2058
- totalMigrations,
2059
- outcomes,
2060
- migrationEmittedNextSteps,
2061
- insideAgent: agentic?.kind === 'inside-agent',
2062
- });
2063
- }
2064
- throw e;
2065
- }
2066
- }
2067
- if (!shouldCreateCommits) {
2068
- await installDepsIfChanged();
2069
- }
2070
- if (changedDepInstaller.skippedInstall) {
2071
- (0, execute_migration_1.logSkippedPostMigrationInstall)(root);
2072
- }
2073
- // Combined-view next-steps array kept for back-compat with repair.ts, which
2074
- // consumes the single `nextSteps` field.
2075
- const combinedNextSteps = [...migrationEmittedNextSteps];
2076
- if (skippedPrompts.length > 0) {
2077
- combinedNextSteps.push(formatSkippedPromptsNextStep(skippedPrompts));
2078
- }
2079
- return {
2080
- migrationsWithNoChanges,
2081
- skippedPromptsCount: skippedPrompts.length,
2082
- notRunMigrationsCount,
2083
- nextSteps: combinedNextSteps,
2084
- skippedPrompts,
2085
- migrationEmittedNextSteps,
2086
- committedShasCount: (0, migrate_output_1.countLandedCommits)(outcomes),
2087
- waivedAgenticStepsCount: (0, migrate_output_1.countWaivedAgenticSteps)(outcomes),
2088
- // Migrations whose commits failed and never got absorbed by a later
2089
- // commit. The caller surfaces them so a successful run doesn't claim
2090
- // "up to date" while leaving uncommitted diffs in the working tree.
2091
- // Formatted as `package: name` for direct display.
2092
- retainedAtSuccess: (0, migrate_output_1.retainedMigrations)(outcomes).map((p) => `${p.package}: ${p.name}`),
2093
- };
2094
- }
2095
- // nx is located at spawn time, after the gated pre-install, so the child runs
2096
- // the bytes that install put in place.
2097
- function handOffToLocalNx(args) {
2098
- const exitCode = runOrReturnExitCode(() => (0, child_process_2.runNxArgvSync)(['migrate', ...args], {
2099
- stdio: ['inherit', 'inherit', 'inherit'],
2100
- env: {
2101
- ...process.env,
2102
- NX_MIGRATE_SKIP_INSTALL: 'true',
2103
- NX_MIGRATE_USE_LOCAL: 'true',
2104
- },
2105
- }));
2106
- return exitCode !== 0 ? exitCode : undefined;
2107
- }
2108
- async function runMigrations(root, opts, args, isVerbose, shouldCreateCommits, commitPrefix, shouldSkipInstall = false) {
2109
- if (!shouldSkipInstall && !process.env.NX_MIGRATE_SKIP_INSTALL) {
2110
- await (0, execute_migration_1.runInstall)();
2111
- }
2112
- if (!__dirname.startsWith(workspace_root_1.workspaceRoot)) {
2113
- // we are running from a temp installation with nx latest, switch to running
2114
- // from local installation
2115
- return handOffToLocalNx(args);
2116
- }
2117
- const migrationsExists = (0, fileutils_1.fileExists)(opts.runMigrations);
2118
- if (opts.ifExists && !migrationsExists) {
2119
- output_1.output.log({
2120
- title: `Migrations file '${opts.runMigrations}' doesn't exist`,
2121
- });
2122
- return;
2123
- }
2124
- else if (!opts.ifExists && !migrationsExists) {
2125
- throw new Error(`File '${opts.runMigrations}' doesn't exist, can't run migrations. Use flag --if-exists to run migrations only if the file exists`);
2126
- }
2127
- const migrationsJson = (0, fileutils_1.readJsonFile)((0, path_1.join)(root, opts.runMigrations));
2128
- const migrations = migrationsJson.migrations;
2129
- // An outer agent drives the loop, so hand off to the orchestrator instead of
2130
- // the classic loop: init either starts a fresh run or resumes an already-
2131
- // active one. `--run-id` reconciles are dispatched separately and never
2132
- // reach here.
2133
- if (process.env.NX_MIGRATE_ORCHESTRATOR === 'true' && (0, inception_1.isInsideAgent)()) {
2134
- // Orchestrated runs are agent-driven, so commits default on exactly as they
2135
- // do under `--agentic=enabled`; the orchestrator replaces `resolveAgentic`.
2136
- const { effective: effectiveCreateCommits, warning: createCommitsWarning, error: createCommitsError, } = (0, migrate_commits_1.resolveCreateCommits)({
2137
- createCommits: shouldCreateCommits,
2138
- mode: 'orchestrated',
2139
- isGitRepo: (0, git_utils_1.isGitRepository)(root),
2140
- commitPrefixIsCustom: commitPrefix !== command_object_1.DEFAULT_MIGRATION_COMMIT_PREFIX,
2141
- });
2142
- if (createCommitsError) {
2143
- throw new Error(createCommitsError);
2144
- }
2145
- if (createCommitsWarning) {
2146
- output_1.output.warn({ title: createCommitsWarning });
2147
- }
2148
- // The run commits on the user's behalf across many invocations, so the
2149
- // default-branch confirmation belongs here, once, before any of them.
2150
- if (effectiveCreateCommits &&
2151
- (0, safe_prompt_1.canPrompt)(opts.interactive) &&
2152
- !(await (0, migrate_commits_1.confirmMigrationCommitsOnDefaultBranch)(root, 'running migrations'))) {
2153
- return;
2154
- }
2155
- const { packageJson: orchestratorNxPackageJson } = (0, package_json_1.readModulePackageJson)('nx', (0, installation_directory_1.getNxRequirePaths)(root));
2156
- const { runOrchestratorInit } = require('./run');
2157
- return await runOrchestratorInit({
2158
- root,
2159
- migrationsJson,
2160
- createCommits: effectiveCreateCommits,
2161
- commitPrefix,
2162
- // The flag only, never NX_MIGRATE_SKIP_INSTALL: the wrapper's local
2163
- // re-exec sets that env var for its own hop, and it says nothing about
2164
- // what the user asked for.
2165
- skipInstall: shouldSkipInstall,
2166
- installedNxVersion: orchestratorNxPackageJson.version,
2167
- });
2168
- }
2169
- (0, migrate_analytics_1.reportMigrateRunStart)({
2170
- createCommits: shouldCreateCommits ?? false,
2171
- migrationCount: migrations.length,
2172
- });
2173
- const { resolveAgentic, resolveShouldRunValidation } = require('./agentic/select');
2174
- let agentic;
2175
- try {
2176
- agentic = await resolveAgentic({
2177
- agentic: opts.agentic,
2178
- migrations,
2179
- interactive: opts.interactive,
2180
- });
2181
- }
2182
- catch (e) {
2183
- (0, migrate_analytics_1.reportMigrateRunError)({ code: 'agentic', error: e });
2184
- throw e;
2185
- }
2186
- const { effective: effectiveCreateCommits, agenticHasDiffContext, warning: createCommitsWarning, error: createCommitsError, } = (0, migrate_commits_1.resolveCreateCommits)({
2187
- createCommits: shouldCreateCommits,
2188
- mode: agentic.kind,
2189
- isGitRepo: (0, git_utils_1.isGitRepository)(root),
2190
- commitPrefixIsCustom: commitPrefix !== command_object_1.DEFAULT_MIGRATION_COMMIT_PREFIX,
2191
- });
2192
- if (createCommitsError) {
2193
- throw new Error(createCommitsError);
2194
- }
2195
- if (createCommitsWarning) {
2196
- output_1.output.warn({ title: createCommitsWarning });
2197
- }
2198
- if (effectiveCreateCommits &&
2199
- (0, safe_prompt_1.canPrompt)(opts.interactive) &&
2200
- !(await (0, migrate_commits_1.confirmMigrationCommitsOnDefaultBranch)(root, 'running migrations'))) {
2201
- return;
2202
- }
2203
- const shouldRunValidation = resolveShouldRunValidation({
2204
- validate: opts.validate,
2205
- agenticKind: agentic.kind,
2206
- });
2207
- output_1.output.log({
2208
- title: `Running migrations from '${opts.runMigrations}'` +
2209
- (effectiveCreateCommits
2210
- ? ', with each applied in a dedicated commit'
2211
- : ''),
2212
- });
2213
- if (effectiveCreateCommits) {
2214
- (0, migrate_commits_1.commitCheckpointBeforeMigrations)(root, commitPrefix);
2215
- }
2216
- if (agentic.kind === 'enabled') {
2217
- const { applyAgenticHandoffGitignoreFallback } = require('./agentic/handoff-gitignore');
2218
- const { packageJson: nxPackageJson } = (0, package_json_1.readModulePackageJson)('nx', (0, installation_directory_1.getNxRequirePaths)(root));
2219
- await applyAgenticHandoffGitignoreFallback({
2220
- migrations,
2221
- installedNxVersion: nxPackageJson.version,
2222
- effectiveCreateCommits,
2223
- commitPrefix,
2224
- root,
2225
- });
2226
- }
2227
- const { migrationsWithNoChanges, skippedPromptsCount, notRunMigrationsCount, skippedPrompts, migrationEmittedNextSteps, committedShasCount, waivedAgenticStepsCount, retainedAtSuccess, } = await executeMigrations(root, migrations, isVerbose, effectiveCreateCommits, commitPrefix, shouldSkipInstall, agentic, agenticHasDiffContext, shouldRunValidation);
2228
- const ranWithChangesCount = migrations.length - notRunMigrationsCount - migrationsWithNoChanges.length;
2229
- // The "applied" tally counts fully-completed migrations — those that
2230
- // left no deferred work behind. Hybrid migrations whose prompt half was
2231
- // deferred count as "deferred", not "applied".
2232
- const appliedCount = migrations.length - skippedPrompts.length;
2233
- const insideAgent = agentic.kind === 'inside-agent';
2234
- const tallyLine = (0, migrate_output_1.buildTallyBodyLine)({
2235
- appliedCount,
2236
- committedShasCount,
2237
- skippedPromptsCount,
2238
- waivedAgenticStepsCount,
2239
- insideAgent,
2240
- });
2241
- const tallyBody = tallyLine ? [tallyLine] : undefined;
2242
- // Only claim "up to date" when there's nothing pending: no deferred
2243
- // prompts AND no migrations whose commits failed without being absorbed.
2244
- const upToDateSuffix = skippedPromptsCount > 0 || retainedAtSuccess.length > 0
2245
- ? ''
2246
- : ' This workspace is up to date!';
2247
- // Demote `output.success` to `output.warn` when there's uncommitted state
2248
- // retained from failed commits — the run did its work, but it would be
2249
- // misleading to lead with a green "Successfully finished" before the
2250
- // retained-state block. `.bind(output)` is required: assigning the method
2251
- // reference to a local would otherwise call it with `this === undefined`.
2252
- const completionLog = (retainedAtSuccess.length > 0 ? output_1.output.warn : output_1.output.success).bind(output_1.output);
2253
- const completionTitlePrefix = retainedAtSuccess.length > 0
2254
- ? 'Finished running migrations with uncommitted state retained'
2255
- : 'Successfully finished running migrations';
2256
- if (notRunMigrationsCount === migrations.length && migrations.length > 0) {
2257
- const remediation = insideAgent
2258
- ? 'The AI agent driving this run should apply each prompt — see next steps below.'
2259
- : 'Re-run with --agentic to apply them. See next steps below.';
2260
- output_1.output.warn({
2261
- title: `No migrations from '${opts.runMigrations}' were applied — every entry is a prompt-only migration. ${remediation}`,
2262
- bodyLines: tallyBody,
2263
- });
2264
- }
2265
- else if (ranWithChangesCount > 0) {
2266
- completionLog({
2267
- title: `${completionTitlePrefix} from '${opts.runMigrations}'.${upToDateSuffix}`,
2268
- bodyLines: tallyBody,
2269
- });
2270
- }
2271
- else {
2272
- // Pathological-but-possible: a no-op run that still has retained state
2273
- // (e.g. pre-existing pending diffs that no commit absorbed). Demote
2274
- // explicitly rather than rely on the implicit invariant.
2275
- completionLog({
2276
- title: `No changes were made from running '${opts.runMigrations}'.${upToDateSuffix}`,
2277
- bodyLines: tallyBody,
2278
- });
2279
- }
2280
- if (retainedAtSuccess.length > 0) {
2281
- output_1.output.warn({
2282
- title: `Working-tree state retained from ${retainedAtSuccess.length} migration${retainedAtSuccess.length === 1 ? '' : 's'} whose commits could not be created`,
2283
- bodyLines: (0, migrate_output_1.buildRetainedAtSuccessBody)(retainedAtSuccess),
2284
- });
2285
- }
2286
- if (insideAgent) {
2287
- // Under inside-agent, emit a directive block so the outer agent has
2288
- // explicit instructions to act on, not just relay.
2289
- const directiveLines = (0, migrate_output_1.buildDirectiveBlockBodyLines)({
2290
- skippedPrompts,
2291
- migrationEmittedNextSteps,
2292
- });
2293
- if (directiveLines.length > 0) {
2294
- output_1.output.log({
2295
- title: 'Next steps for the AI agent driving this run',
2296
- bodyLines: directiveLines,
2297
- });
2298
- }
2299
- }
2300
- else if (skippedPromptsCount > 0 || migrationEmittedNextSteps.length > 0) {
2301
- // Non-inside-agent path keeps the legacy "additional information" shape —
2302
- // the consumer is the human user.
2303
- const bodyLines = [];
2304
- if (skippedPromptsCount > 0) {
2305
- bodyLines.push(formatSkippedPromptsNextStep(skippedPrompts));
2306
- }
2307
- bodyLines.push(...migrationEmittedNextSteps);
2308
- output_1.output.log({
2309
- title: `Some migrations have additional information, see below.`,
2310
- bodyLines: bodyLines.map((line) => `- ${line}`),
2311
- });
2312
- }
2313
- (0, migrate_analytics_1.reportMigrateRunComplete)({
2314
- agenticOutcome: agentic.kind,
2315
- agentUsed: agentic.kind === 'enabled' ? agentic.selectedAgent.id : undefined,
2316
- migrationCount: migrations.length,
2317
- appliedCount,
2318
- });
2319
- }
2320
- function isRunPhaseInvocation(args) {
2321
- return (args.runMigration !== undefined ||
2322
- args.runId !== undefined ||
2323
- args.stepAction !== undefined);
2324
- }
2325
- async function migrate(root, args, rawArgs) {
2326
- await client_1.daemonClient.stop();
2327
- return (0, handle_errors_1.handleErrors)(process.env.NX_VERBOSE_LOGGING === 'true', async () => {
2328
- const mergedArgs = (0, migrate_config_1.applyNxJsonMigrateDefaults)(args, (0, configuration_1.readNxJson)().migrate);
2329
- // Run-phase invocations resolve their commit config downstream (run.json
2330
- // for recorded runs, resolveCreateCommits for standalone), so this assert
2331
- // must not fire for them; otherwise an nx.json prefix the whole-file run
2332
- // legitimately uses would wedge every dispensed command.
2333
- const runPhase = isRunPhaseInvocation(mergedArgs);
2334
- if (!runPhase) {
2335
- (0, migrate_config_1.assertCommitPrefixHasCommits)(mergedArgs);
2336
- }
2337
- // One fetcher (registry-first, install fallback) shared by the `--include`
2338
- // eligibility gate and the migration cascade so package metadata is fetched
2339
- // at most once per package/version.
2340
- const fetch = createFetcher((0, package_manager_1.getPackageManagerCommand)());
2341
- // `--run-migrations` without a value parses as '', so only undefined (and
2342
- // no run-phase flag) means the generate phase.
2343
- const isGenerateInvocation = mergedArgs['runMigrations'] === undefined && !runPhase;
2344
- let opts;
2345
- try {
2346
- opts = await parseMigrationsOptions(mergedArgs, fetch);
2347
- }
2348
- catch (e) {
2349
- if (isGenerateInvocation) {
2350
- (0, migrate_analytics_1.reportMigrateGenerateError)('resolve_version', e);
2351
- }
2352
- else if (runPhase) {
2353
- (0, migrate_analytics_1.reportMigrateRunError)({ code: 'other', error: e });
2354
- }
2355
- throw e;
2356
- }
2357
- switch (opts.type) {
2358
- case 'generateMigrations':
2359
- await generateMigrationsJsonAndUpdatePackageJson(root, opts, fetch);
2360
- return;
2361
- case 'runSingleMigration':
2362
- try {
2363
- return await runSingleMigrationFromCli(root, opts, rawArgs, mergedArgs);
2364
- }
2365
- catch (e) {
2366
- // `runInstall` already logged the remediation; returning instead of
2367
- // rethrowing keeps `handleErrors` from printing a stack over it.
2368
- if (e instanceof execute_migration_1.NpmPeerDepsInstallError) {
2369
- (0, migrate_analytics_1.reportMigrateRunError)({ code: 'npm_install', error: e });
2370
- return 1;
2371
- }
2372
- (0, migrate_analytics_1.reportMigrateRunError)({ code: 'other', error: e });
2373
- throw e;
2374
- }
2375
- case 'orchestratorReconcile':
2376
- return await runOrchestratorReconcileFromCli(root, opts, rawArgs);
2377
- case 'runMigrations':
2378
- try {
2379
- return await runMigrations(root, opts, rawArgs, mergedArgs['verbose'], mergedArgs['createCommits'], mergedArgs['commitPrefix'] ?? command_object_1.DEFAULT_MIGRATION_COMMIT_PREFIX, mergedArgs['skipInstall']);
2380
- }
2381
- catch (e) {
2382
- if (e instanceof execute_migration_1.NpmPeerDepsInstallError) {
2383
- (0, migrate_analytics_1.reportMigrateRunError)({ code: 'npm_install', error: e });
2384
- return 1;
2385
- }
2386
- (0, migrate_analytics_1.reportMigrateRunError)({ code: 'other', error: e });
2387
- throw e;
2388
- }
2389
- default: {
2390
- // `unhandled: never` makes a new invocation type a compile error here
2391
- // rather than a silent fall-through.
2392
- const unhandled = opts;
2393
- throw new Error(`Unhandled migrate invocation type: ${JSON.stringify(unhandled)}`);
2394
- }
2395
- }
2396
- });
2397
- }
2398
- // Evaluated manifest code can throw any value: a null-prototype object defeats
2399
- // String() (the Object.prototype.toString rung catches it), and a revoked
2400
- // proxy defeats that too. Interpolating either in a catch would throw again
2401
- // and escape the catch.
2402
- function stringifyCaught(e) {
2403
- try {
2404
- return String(e);
2405
- }
2406
- catch {
2407
- try {
2408
- return Object.prototype.toString.call(e);
2409
- }
2410
- catch {
2411
- return '<unprintable value>';
2412
- }
2413
- }
2414
- }
2415
- // A resolver-based lookup (including `resolvePackageJsonWithoutCachePollution`,
2416
- // which does defeat Node's package self-reference) is the wrong tool here:
2417
- // resolvers fall back to NODE_PATH after the explicit paths, and NODE_PATH
2418
- // names the temp installation when this runs there. The scan below reads its
2419
- // candidate directories itself, so neither NODE_PATH nor self-reference can
2420
- // reach it; `getNxBin` (utils/child-process.ts), which locates the nx the
2421
- // hand-off spawns, avoids resolvers for the same reason, over a narrower set
2422
- // of directories: it skips `.nx/installation`, declines a root without a
2423
- // package.json, and stops at the nearest install rather than reading past an
2424
- // unusable one. The PnP branch below stays bespoke either way: a resolver
2425
- // cannot see into the zip cache without the PnP runtime.
2426
- function readLocalNxVersion(root) {
2427
- // A PnP manifest is consulted only when yarn drives the hand-off:
2428
- // `getRunNxBaseCommand` builds the hand-off command through this same
2429
- // detectPackageManager call (which answers from nx.json's
2430
- // cli.packageManager first, before any lockfile), and yarn is the one
2431
- // package manager that executes the manifest's nx. That mirror alone
2432
- // cannot see a switch off yarn, because yarn.lock survives one and
2433
- // outranks all but bun's lockfiles in the detection order, while .pnp.cjs
2434
- // lingers only on a switch to another package manager (yarn removes it
2435
- // when moving to node_modules linking). A rival lockfile beside the
2436
- // manifest is therefore read as evidence of such a switch, though not
2437
- // proof, since `pnpm install --lockfile-only` writes one without
2438
- // installing: on a scan miss the manifest still answers rather than
2439
- // failing the guards, and a rival install over a still-live PnP
2440
- // workspace is read over the PnP nx the yarn spawn executes, because
2441
- // preferring the manifest would judge the dead install that a completed
2442
- // switch leaves behind and refuse persistently. The known misread left
2443
- // is yarn classic driving a workspace with a leftover Berry manifest
2444
- // and no other lockfile; telling the two yarns apart from disk is not
2445
- // worth the fragility, and a `yarn node` runtime probe was rejected
2446
- // because its stdout is forgeable through an inherited NODE_OPTIONS
2447
- // preload and a hung descendant holding the output pipe outlives a
2448
- // subprocess timeout on this synchronous path.
2449
- const pnpManifest = ['.pnp.cjs', '.pnp.js']
2450
- .map((f) => (0, path_1.join)(root, f))
2451
- .find((f) => (0, fs_1.existsSync)(f));
2452
- if (pnpManifest) {
2453
- const competingLockfile = [
2454
- 'package-lock.json',
2455
- 'npm-shrinkwrap.json',
2456
- 'pnpm-lock.yaml',
2457
- 'bun.lockb',
2458
- 'bun.lock',
2459
- ].some((f) => (0, fs_1.existsSync)((0, path_1.join)(root, f)));
2460
- if (competingLockfile) {
2461
- const version = scanNodeModulesForNxVersion(root);
2462
- if (version) {
2463
- return version;
2464
- }
2465
- }
2466
- try {
2467
- if ((0, package_manager_1.detectPackageManager)(root) === 'yarn') {
2468
- // Compiled manually rather than required: a require would serve the
2469
- // stale cached copy the runtime loaded at startup. new Function does
2470
- // not strip a leading shebang like the CJS loader, so drop it here.
2471
- const manifestModule = {
2472
- exports: {},
2473
- };
2474
- new Function('module', 'exports', 'require', '__dirname', '__filename', (0, fs_1.readFileSync)(pnpManifest, 'utf-8').replace(/^#!.*/, ''))(manifestModule, manifestModule.exports, require, root, pnpManifest);
2475
- const packageJsonPath = manifestModule.exports.resolveRequest('nx/package.json', (0, path_1.join)(root, 'package.json'));
2476
- if (packageJsonPath) {
2477
- // A resolving manifest names the install the yarn spawn runs, so
2478
- // every branch below returns rather than falling through to the
2479
- // ancestor scan.
2480
- try {
2481
- const { version } = (0, fileutils_1.readJsonFile)(packageJsonPath);
2482
- if (typeof version === 'string') {
2483
- logger_1.logger.verbose(`Read the workspace's nx version ${version} from '${packageJsonPath}'.`);
2484
- return version;
2485
- }
2486
- logger_1.logger.verbose(`'${packageJsonPath}' does not declare a usable version.`);
2487
- return undefined;
2488
- }
2489
- catch (readError) {
2490
- // A zip-served path (installs with scripts disabled keep nx
2491
- // zipped) cannot be read without the PnP runtime's zip fs, but
2492
- // the manifest's own locator still names the version (e.g.
2493
- // 'virtual:<hash>#npm:23.1.0').
2494
- let version;
2495
- try {
2496
- const reference = manifestModule.exports.findPackageLocator?.(packageJsonPath)?.reference;
2497
- version =
2498
- typeof reference === 'string'
2499
- ? reference.match(/npm:([^#:]+)/)?.[1]
2500
- : undefined;
2501
- }
2502
- catch (locatorError) {
2503
- logger_1.logger.verbose(`Could not read the nx locator from the PnP manifest '${pnpManifest}': ${stringifyCaught(locatorError)}`);
2504
- }
2505
- if (version && (0, semver_1.valid)(version)) {
2506
- logger_1.logger.verbose(`Read the workspace's nx version ${version} from the locator in the PnP manifest '${pnpManifest}'.`);
2507
- return version;
2508
- }
2509
- logger_1.logger.verbose(`Could not read the workspace's nx version through the PnP manifest '${pnpManifest}': ${stringifyCaught(readError)}`);
2510
- return undefined;
2511
- }
2512
- }
2513
- }
2514
- }
2515
- catch (e) {
2516
- // Degrade to the full scan: neither a failed detection nor an
2517
- // unevaluable manifest can name the spawn's nx.
2518
- logger_1.logger.verbose(`Could not read the workspace's nx version through the PnP manifest '${pnpManifest}': ${stringifyCaught(e)}`);
2519
- }
2520
- }
2521
- return scanNodeModulesForNxVersion(root);
2522
- }
2523
- // The workspace's own install locations first (.nx/installation, root), then
2524
- // ancestor directories: package-manager executable lookup ascends (npx and
2525
- // bun always, pnpm and yarn inside an outer workspace) and hoisted layouts
2526
- // install nx above the workspace root. `getNxBin` ascends too, so an ancestor
2527
- // read here is usually the one the hand-off spawns. They diverge for a
2528
- // `.nx/installation` workspace, which `getNxBin` declines, and where the only
2529
- // nx found sits past the package manager's own lookup boundary and the spawn
2530
- // has fallen back to that manager: yarn then reports "command not found"
2531
- // while pnpm exec lands on an nx on PATH. The version read here is therefore
2532
- // the readable answer, not necessarily the executed one.
2533
- function scanNodeModulesForNxVersion(root) {
2534
- const searchPaths = [...(0, installation_directory_1.getNxRequirePaths)(root)];
2535
- for (let dir = (0, path_1.dirname)(root);; dir = (0, path_1.dirname)(dir)) {
2536
- searchPaths.push(dir);
2537
- if (dir === (0, path_1.dirname)(dir)) {
2538
- break;
2539
- }
2540
- }
2541
- return readNxVersionFromNodeModules(searchPaths);
2542
- }
2543
- function readNxVersionFromNodeModules(searchPaths) {
2544
- for (const searchPath of searchPaths) {
2545
- const packageJsonPath = (0, path_1.join)(searchPath, 'node_modules', 'nx', 'package.json');
2546
- try {
2547
- if ((0, fs_1.existsSync)(packageJsonPath)) {
2548
- const { version } = (0, fileutils_1.readJsonFile)(packageJsonPath);
2549
- if (typeof version === 'string') {
2550
- logger_1.logger.verbose(`Resolved nx version ${version} from '${packageJsonPath}'.`);
2551
- return version;
2552
- }
2553
- logger_1.logger.verbose(`'${packageJsonPath}' does not declare a usable version; continuing the search.`);
2554
- }
2555
- }
2556
- catch (e) {
2557
- logger_1.logger.verbose(`Could not read the workspace's installed nx version from '${packageJsonPath}': ${e}`);
2558
- }
2559
- }
2560
- return undefined;
2561
- }
2562
- // Mirrors the local-nx hand-off of the other run paths so a reconcile always
2563
- // executes against the workspace-local nx that owns the run state, never the
2564
- // temp installation. Reconciles only read state and commit, so no install.
2565
- async function runOrchestratorReconcileFromCli(root, opts, args) {
2566
- if (!__dirname.startsWith(workspace_root_1.workspaceRoot)) {
2567
- // The workspace-local nx we are about to hand off to must be new enough to
2568
- // understand the new flags we forward to it.
2569
- (0, version_skew_guard_1.assertWorkspaceNxSupportsNewMigrateFlags)({
2570
- argv: args,
2571
- readLocalNxVersion: () => readLocalNxVersion(root),
2572
- });
2573
- return handOffToLocalNx(args);
2574
- }
2575
- const { runOrchestratorReconcile } = require('./run');
2576
- return runOrchestratorReconcile({
2577
- root,
2578
- runId: opts.runId,
2579
- stepAction: opts.stepAction,
2580
- });
2581
- }
2582
- // Keeps `--run-migration` behaving like `--run-migrations` when invoked from
2583
- // a temp `nx@latest` install: same pre-install, same local-nx hand-off.
2584
- async function runSingleMigrationFromCli(root, opts, args, mergedArgs) {
2585
- const shouldSkipInstall = mergedArgs['skipInstall'] ?? false;
2586
- // A recorded execution skips the pre-install: the run carries its own
2587
- // install policy and its worker installs what the migration changed, so
2588
- // paying for a full install ahead of every dispensed command would be
2589
- // redundant.
2590
- if (opts.runId === undefined &&
2591
- !shouldSkipInstall &&
2592
- !process.env.NX_MIGRATE_SKIP_INSTALL) {
2593
- await (0, execute_migration_1.runInstall)(undefined, 'pre-migration', (0, execute_migration_1.formatSingleMigrationRerunCommand)(opts.runMigration));
2594
- }
2595
- if (!__dirname.startsWith(workspace_root_1.workspaceRoot)) {
2596
- // Must stay after the pre-install: it reads the version that install may
2597
- // have just updated, so checking earlier would falsely refuse a workspace
2598
- // whose package.json bump was not installed yet.
2599
- (0, version_skew_guard_1.assertWorkspaceNxSupportsNewMigrateFlags)({
2600
- argv: args,
2601
- // `workspaceRoot`, not `root`: the migrate flow's `root` is the
2602
- // invocation directory, which may sit below the workspace the hand-off
2603
- // resolves nx in.
2604
- readLocalNxVersion: () => readLocalNxVersion(workspace_root_1.workspaceRoot),
2605
- });
2606
- return handOffToLocalNx(args);
2607
- }
2608
- // The worker resolves the agentic flow, the effective commit config, and
2609
- // the default-branch confirmation itself; hand it the raw flags. Recorded
2610
- // runs (--run-id) take their commit config from run.json instead.
2611
- // Lazy-load run/ so plain migrate and repair runs don't pay for the agentic
2612
- // selection chain its barrel pulls in eagerly.
2613
- const { runSingleMigrationWorker } = require('./run');
2614
- await runSingleMigrationWorker({
2615
- root,
2616
- runMigration: opts.runMigration,
2617
- runId: opts.runId,
2618
- agentic: opts.agentic,
2619
- validate: opts.validate,
2620
- createCommits: mergedArgs['createCommits'],
2621
- commitPrefix: mergedArgs['commitPrefix'] ??
2622
- command_object_1.DEFAULT_MIGRATION_COMMIT_PREFIX,
2623
- interactive: opts.interactive,
2624
- skipInstall: shouldSkipInstall,
2625
- isVerbose: mergedArgs['verbose'] ?? false,
2626
- });
2627
- }
2628
- async function runMigration() {
2629
- return (0, handle_errors_1.handleErrors)(process.env.NX_VERBOSE_LOGGING === 'true', async () => {
2630
- // Spawning `nx _migrate` re-resolves the workspace's nx, normally the
2631
- // very installation running this code: bin/nx.ts delegated the outer
2632
- // `migrate` command to it, while `_migrate` skips that delegation. A
2633
- // new-flag invocation reaching this fallback therefore lands on an nx
2634
- // that parsed the flags, so it needs no capability check. Two lookups
2635
- // can still diverge from the running install, both properties of the
2636
- // spawn machinery rather than of this fallback: a `.nx/installation`
2637
- // beside a root package.json, and, once the spawn falls back to the
2638
- // package manager, a lookup that misses the workspace install and lands
2639
- // on an nx on PATH (pnpm exec).
2640
- const forwardedArgv = process.argv.slice(3);
2641
- const runLocalMigrate = () => runOrReturnExitCode(() => (0, child_process_2.runNxArgvSync)(['_migrate', ...forwardedArgv], {
2642
- stdio: ['inherit', 'inherit', 'inherit'],
2643
- }));
2644
- if (!(0, version_skew_guard_1.targetsExistingRun)(process.argv.slice(3)) &&
2645
- process.env.NX_USE_LOCAL !== 'true' &&
2646
- process.env.NX_MIGRATE_USE_LOCAL === undefined) {
2647
- // The version spec mirrors nxCliPath's; keep the two in sync.
2648
- const cliVersionSpec = process.env.NX_MIGRATE_CLI_VERSION || 'latest';
2649
- const target = await (0, version_skew_guard_1.resolveNewMigrateFlagsRunTarget)({
2650
- argv: process.argv.slice(3),
2651
- cliVersionSpec,
2652
- fromEnvOverride: !!process.env.NX_MIGRATE_CLI_VERSION,
2653
- ownNxVersion: versions_1.nxVersion,
2654
- resolveVersion: (spec) =>
2655
- // A probe must not prompt, write pnpm excludes, or install; a
2656
- // minimum-release-age violation surfaces as a rejection and
2657
- // routes local.
2658
- (0, resolve_package_version_1.resolvePackageVersionRespectingMinReleaseAge)('nx', spec, {
2659
- applySideEffects: false,
2660
- }),
2661
- readLocalNxVersion: () => readLocalNxVersion(workspace_root_1.workspaceRoot),
2662
- });
2663
- if (target === 'local-nx') {
2664
- return runLocalMigrate();
2665
- }
2666
- const p = await nxCliPath();
2667
- if (p === null) {
2668
- return runLocalMigrate();
2669
- }
2670
- // ensure local registry from process is not interfering with the install
2671
- // when we start the process from temp folder the local registry would override the custom registry
2672
- if (process.env.npm_config_registry &&
2673
- process.env.npm_config_registry.match(/^https:\/\/registry\.(npmjs\.org|yarnpkg\.com)/)) {
2674
- delete process.env.npm_config_registry;
2675
- }
2676
- // Intentionally not the workspace's nx: `p` is an nx CLI freshly
2677
- // installed into a temp dir by nxCliPath() (latest, or
2678
- // NX_MIGRATE_CLI_VERSION), so migrations run with an up-to-date migrate
2679
- // implementation. `p` is <tmpDir>/node_modules/.bin/nx, a shell shim;
2680
- // spawning the entry point that install's own manifest names instead
2681
- // keeps the forwarded argv out of a shell. That install declares nx
2682
- // itself, so it is read without ascending: an nx above the temp dir is
2683
- // one nothing asked for, and the shim below is the answer instead.
2684
- const tempNxEntry = (0, child_process_2.readInstalledNxBin)((0, path_1.dirname)((0, path_1.dirname)((0, path_1.dirname)(p))));
2685
- return runOrReturnExitCode(() => tempNxEntry
2686
- ? (0, child_process_2.runNxArgvSync)(['_migrate', ...forwardedArgv], {
2687
- stdio: ['inherit', 'inherit', 'inherit'],
2688
- nxBin: tempNxEntry,
2689
- })
2690
- : (0, child_process_1.execSync)(`${(0, shell_quoting_1.quoteShellArg)(p)} _migrate ${forwardedArgv
2691
- .map(shell_quoting_1.quoteShellArg)
2692
- .join(' ')}`, {
2693
- stdio: ['inherit', 'inherit', 'inherit'],
2694
- windowsHide: true,
2695
- }));
2696
- }
2697
- return runLocalMigrate();
2698
- });
2699
- }
2700
- /**
2701
- * Resolves a migration's collection once and derives everything the run loop
2702
- * needs from that single read: the implementation context (`collection` +
2703
- * `collectionPath`, handed to `runNxOrAngularMigration`) and, for agentic runs,
2704
- * the workspace-relative documentation path handed to the agent.
2705
- *
2706
- * Read fresh per migration (not cached across the loop) so a prior migration's
2707
- * reinstall is reflected, exactly as before. Error handling matches each field's
2708
- * role:
2709
- * - Migrations that run an implementation REQUIRE the collection; an unreadable
2710
- * collection throws and aborts that migration (caught by the run loop).
2711
- * - Prompt-only migrations don't run an implementation, so the collection is
2712
- * read only to resolve documentation - a failure there is non-fatal: the
2713
- * prompt still runs and the supplementary doc is skipped with a warning.
2714
- */
2715
- function resolveMigrationForRun(root, migration, resolveDocumentation) {
2716
- let resolvedCollection;
2717
- if (!(0, migration_shape_1.isPromptOnlyMigration)(migration)) {
2718
- resolvedCollection = (0, execute_migration_1.readMigrationCollection)(migration.package, root);
2719
- }
2720
- else if (resolveDocumentation && migration.documentation) {
2721
- try {
2722
- resolvedCollection = (0, execute_migration_1.readMigrationCollection)(migration.package, root);
2723
- }
2724
- catch {
2725
- // Non-fatal: documentation is supplementary; the warning below fires.
2726
- }
2727
- }
2728
- let documentationPath;
2729
- if (resolveDocumentation && migration.documentation) {
2730
- documentationPath = resolvedCollection
2731
- ? (0, execute_migration_1.resolveDocumentationFileToWorkspacePath)(root, (0, path_1.dirname)(resolvedCollection.collectionPath), migration.documentation)
2732
- : undefined;
2733
- if (!documentationPath) {
2734
- logger_1.logger.warn(`Could not resolve the "documentation" file "${migration.documentation}" declared for migration "${migration.package}: ${migration.name}". It will be skipped as additional context for the AI agent.`);
2735
- }
2736
- }
2737
- return { resolvedCollection, documentationPath };
2738
- }
2739
- async function nxCliPath(nxWorkspaceRoot) {
2740
- const version = process.env.NX_MIGRATE_CLI_VERSION || 'latest';
2741
- const isVerbose = process.env.NX_VERBOSE_LOGGING === 'true';
2742
- await (0, provenance_1.ensurePackageHasProvenance)('nx', version);
2743
- try {
2744
- const packageManager = (0, package_manager_1.detectPackageManager)();
2745
- const pmc = (0, package_manager_1.getPackageManagerCommand)(packageManager);
2746
- const { dirSync } = require('tmp');
2747
- const tmpDir = dirSync().name;
2748
- (0, fileutils_1.writeJsonFile)((0, path_1.join)(tmpDir, 'package.json'), {
2749
- dependencies: {
2750
- nx: version,
2751
- },
2752
- license: 'MIT',
2753
- });
2754
- const root = nxWorkspaceRoot ?? workspace_root_1.workspaceRoot;
2755
- const isNonJs = !(0, fs_1.existsSync)((0, path_1.join)(root, 'package.json'));
2756
- (0, package_manager_1.copyPackageManagerConfigurationFiles)(isNonJs ? (0, installation_directory_1.getNxInstallationPath)(root) : root, tmpDir);
2757
- // Let's print the output of the install process to the console when verbose
2758
- // is enabled, so it's easier to debug issues with the installation process
2759
- const stdio = isVerbose
2760
- ? ['ignore', 'inherit', 'inherit']
2761
- : 'ignore';
2762
- if (pmc.preInstall) {
2763
- // ensure package.json and repo in tmp folder is set to a proper package manager state
2764
- (0, child_process_1.execSync)(pmc.preInstall, {
2765
- cwd: tmpDir,
2766
- stdio,
2767
- windowsHide: true,
2768
- });
2769
- // if it's berry ensure we set the node_linker to node-modules
2770
- if (packageManager === 'yarn' && pmc.ciInstall.includes('immutable')) {
2771
- (0, child_process_1.execSync)('yarn config set nodeLinker node-modules', {
2772
- cwd: tmpDir,
2773
- stdio,
2774
- windowsHide: true,
2775
- });
2776
- }
2777
- }
2778
- (0, child_process_1.execSync)(`${pmc.install} ${pmc.ignoreScriptsFlag ?? ''}`, {
2779
- cwd: tmpDir,
2780
- stdio,
2781
- windowsHide: true,
2782
- });
2783
- // Set NODE_PATH so that these modules can be used for module resolution
2784
- addToNodePath((0, path_1.join)(tmpDir, 'node_modules'));
2785
- addToNodePath((0, path_1.join)(nxWorkspaceRoot ?? workspace_root_1.workspaceRoot, 'node_modules'));
2786
- return (0, path_1.join)(tmpDir, `node_modules`, '.bin', 'nx');
2787
- }
2788
- catch (e) {
2789
- console.error(`Failed to install the ${version} version of the migration script. Falling back to the workspace's installed nx.`);
2790
- if (isVerbose) {
2791
- console.error(e);
2792
- }
2793
- return null;
2794
- }
2795
- }
2796
- function addToNodePath(dir) {
2797
- // NODE_PATH is a delimited list of paths.
2798
- // The delimiter is different for windows.
2799
- const delimiter = require('os').platform() === 'win32' ? ';' : ':';
2800
- const paths = process.env.NODE_PATH
2801
- ? process.env.NODE_PATH.split(delimiter)
2802
- : [];
2803
- // Add the tmp path
2804
- paths.push(dir);
2805
- // Update the env variable.
2806
- process.env.NODE_PATH = paths.join(delimiter);
2807
- }