@depup/nx 23.1.3-depup.0 → 23.2.0-depup.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (294) hide show
  1. package/README.md +5 -4
  2. package/changes.json +10 -6
  3. package/dist/bin/init-local.js +3 -5
  4. package/dist/bin/nx.js +1 -0
  5. package/dist/src/adapter/ngcli-adapter.js +60 -1
  6. package/dist/src/ai/constants.d.ts +15 -0
  7. package/dist/src/ai/constants.js +17 -1
  8. package/dist/src/ai/set-up-ai-agents/set-up-ai-agents.js +57 -9
  9. package/dist/src/ai/utils.d.ts +13 -0
  10. package/dist/src/ai/utils.js +29 -0
  11. package/dist/src/analytics/analytics.js +2 -4
  12. package/dist/src/command-line/completion/command-object.js +7 -12
  13. package/dist/src/command-line/configure-ai-agents/configure-ai-agents.js +42 -31
  14. package/dist/src/command-line/format/format.js +84 -101
  15. package/dist/src/command-line/generate/generate.js +35 -35
  16. package/dist/src/command-line/import/import.js +29 -38
  17. package/dist/src/command-line/init/ai-agent-prompts.js +5 -11
  18. package/dist/src/command-line/init/command-object.js +4 -2
  19. package/dist/src/command-line/init/configure-plugins.js +4 -1
  20. package/dist/src/command-line/init/implementation/add-nx-to-monorepo.js +12 -32
  21. package/dist/src/command-line/init/implementation/add-nx-to-nest.js +17 -21
  22. package/dist/src/command-line/init/implementation/add-nx-to-npm-repo.js +8 -21
  23. package/dist/src/command-line/init/implementation/add-nx-to-turborepo.js +3 -17
  24. package/dist/src/command-line/init/implementation/angular/index.js +10 -15
  25. package/dist/src/command-line/init/implementation/angular/legacy-angular-versions.js +2 -0
  26. package/dist/src/command-line/init/implementation/angular/standalone-workspace.js +8 -2
  27. package/dist/src/command-line/init/implementation/check-compatible-with-plugins.js +2 -0
  28. package/dist/src/command-line/init/implementation/dot-nx/add-nx-scripts.js +5 -0
  29. package/dist/src/command-line/init/implementation/format.d.ts +18 -0
  30. package/dist/src/command-line/init/implementation/format.js +114 -0
  31. package/dist/src/command-line/init/implementation/utils.js +8 -8
  32. package/dist/src/command-line/init/init-v1.js +15 -18
  33. package/dist/src/command-line/init/init-v2.js +77 -66
  34. package/dist/src/command-line/migrate/agentic/definitions.js +36 -9
  35. package/dist/src/command-line/migrate/agentic/handoff-gitignore.d.ts +37 -22
  36. package/dist/src/command-line/migrate/agentic/handoff-gitignore.js +30 -39
  37. package/dist/src/command-line/migrate/agentic/handoff.d.ts +7 -7
  38. package/dist/src/command-line/migrate/agentic/handoff.js +13 -10
  39. package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.d.ts +7 -12
  40. package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.js +7 -0
  41. package/dist/src/command-line/migrate/agentic/run-step.d.ts +10 -0
  42. package/dist/src/command-line/migrate/agentic/run-step.js +1 -0
  43. package/dist/src/command-line/migrate/agentic/runner.js +24 -24
  44. package/dist/src/command-line/migrate/agentic/select.d.ts +10 -2
  45. package/dist/src/command-line/migrate/agentic/select.js +30 -32
  46. package/dist/src/command-line/migrate/agentic/types.d.ts +33 -3
  47. package/dist/src/command-line/migrate/agentic/types.js +35 -0
  48. package/dist/src/command-line/migrate/command-object.d.ts +6 -0
  49. package/dist/src/command-line/migrate/command-object.js +19 -1
  50. package/dist/src/command-line/migrate/execute-migration.d.ts +28 -9
  51. package/dist/src/command-line/migrate/execute-migration.js +112 -27
  52. package/dist/src/command-line/migrate/migrate-analytics.d.ts +35 -0
  53. package/dist/src/command-line/migrate/migrate-analytics.js +64 -0
  54. package/dist/src/command-line/migrate/migrate-commits.d.ts +38 -8
  55. package/dist/src/command-line/migrate/migrate-commits.js +130 -15
  56. package/dist/src/command-line/migrate/migrate-config.d.ts +13 -12
  57. package/dist/src/command-line/migrate/migrate-config.js +22 -14
  58. package/dist/src/command-line/migrate/migrate-output.d.ts +45 -7
  59. package/dist/src/command-line/migrate/migrate-output.js +52 -8
  60. package/dist/src/command-line/migrate/migrate-ui-api.d.ts +2 -1
  61. package/dist/src/command-line/migrate/migrate-ui-api.js +16 -7
  62. package/dist/src/command-line/migrate/migrate.d.ts +24 -55
  63. package/dist/src/command-line/migrate/migrate.js +553 -226
  64. package/dist/src/command-line/migrate/migration-shape.d.ts +8 -0
  65. package/dist/src/command-line/migrate/multi-major.js +7 -10
  66. package/dist/src/command-line/migrate/resolve-package-version.js +4 -8
  67. package/dist/src/command-line/migrate/run/agent-output.d.ts +20 -0
  68. package/dist/src/command-line/migrate/run/agent-output.js +65 -0
  69. package/dist/src/command-line/migrate/run/index.d.ts +9 -0
  70. package/dist/src/command-line/migrate/run/index.js +23 -0
  71. package/dist/src/command-line/migrate/run/orchestrator.d.ts +20 -0
  72. package/dist/src/command-line/migrate/run/orchestrator.js +1200 -0
  73. package/dist/src/command-line/migrate/run/run-id.d.ts +16 -0
  74. package/dist/src/command-line/migrate/run/run-id.js +56 -0
  75. package/dist/src/command-line/migrate/run/run-state.d.ts +157 -0
  76. package/dist/src/command-line/migrate/run/run-state.js +438 -0
  77. package/dist/src/command-line/migrate/run/state-lock.d.ts +25 -0
  78. package/dist/src/command-line/migrate/run/state-lock.js +76 -0
  79. package/dist/src/command-line/migrate/run/state-machine.d.ts +84 -0
  80. package/dist/src/command-line/migrate/run/state-machine.js +315 -0
  81. package/dist/src/command-line/migrate/run/util.d.ts +59 -0
  82. package/dist/src/command-line/migrate/run/util.js +148 -0
  83. package/dist/src/command-line/migrate/run/worker.d.ts +16 -0
  84. package/dist/src/command-line/migrate/run/worker.js +682 -0
  85. package/dist/src/command-line/migrate/run-migration-process.js +6 -5
  86. package/dist/src/command-line/migrate/safe-prompt.d.ts +14 -26
  87. package/dist/src/command-line/migrate/safe-prompt.js +32 -43
  88. package/dist/src/command-line/migrate/sort-migrations.d.ts +16 -0
  89. package/dist/src/command-line/migrate/sort-migrations.js +32 -0
  90. package/dist/src/command-line/migrate/step-actions.d.ts +5 -0
  91. package/dist/src/command-line/migrate/step-actions.js +12 -0
  92. package/dist/src/command-line/migrate/text.d.ts +18 -0
  93. package/dist/src/command-line/migrate/text.js +26 -0
  94. package/dist/src/command-line/migrate/version-skew-guard.d.ts +60 -0
  95. package/dist/src/command-line/migrate/version-skew-guard.js +175 -0
  96. package/dist/src/command-line/nx-cloud/connect/connect-to-nx-cloud.js +16 -20
  97. package/dist/src/command-line/nx-cloud/start-nx-agents/command-object.d.ts +2 -0
  98. package/dist/src/command-line/nx-cloud/start-nx-agents/command-object.js +16 -0
  99. package/dist/src/command-line/nx-cloud/start-nx-agents/start-nx-agents.d.ts +4 -0
  100. package/dist/src/command-line/nx-cloud/start-nx-agents/start-nx-agents.js +13 -0
  101. package/dist/src/command-line/nx-commands.js +26 -24
  102. package/dist/src/command-line/release/changelog.js +6 -17
  103. package/dist/src/command-line/release/plan.js +15 -28
  104. package/dist/src/command-line/release/publish.js +5 -0
  105. package/dist/src/command-line/release/release.js +6 -17
  106. package/dist/src/command-line/release/utils/release-graph.d.ts +1 -0
  107. package/dist/src/command-line/release/utils/release-graph.js +10 -2
  108. package/dist/src/command-line/release/utils/remote-release-clients/github.js +10 -22
  109. package/dist/src/command-line/release/utils/remote-release-clients/gitlab.js +13 -22
  110. package/dist/src/command-line/release/utils/resolve-semver-specifier.js +19 -41
  111. package/dist/src/command-line/release/version/resolve-current-version.js +7 -10
  112. package/dist/src/command-line/release/version.js +2 -2
  113. package/dist/src/command-line/reset/reset.js +17 -15
  114. package/dist/src/command-line/yargs-utils/shared-options.d.ts +1 -1
  115. package/dist/src/command-line/yargs-utils/shared-options.js +3 -1
  116. package/dist/src/config/misc-interfaces.d.ts +19 -7
  117. package/dist/src/core/graph/main.js +1 -1
  118. package/dist/src/core/graph/styles.js +1 -1
  119. package/dist/src/daemon/client/client.d.ts +2 -7
  120. package/dist/src/daemon/client/client.js +113 -28
  121. package/dist/src/daemon/client/daemon-environment.d.ts +35 -0
  122. package/dist/src/daemon/client/daemon-environment.js +106 -6
  123. package/dist/src/daemon/client/daemon-socket-messenger.d.ts +1 -1
  124. package/dist/src/daemon/client/daemon-socket-messenger.js +8 -3
  125. package/dist/src/daemon/is-v8-serializer-enabled.d.ts +2 -2
  126. package/dist/src/daemon/is-v8-serializer-enabled.js +2 -2
  127. package/dist/src/daemon/sandbox-socket-hint.d.ts +27 -0
  128. package/dist/src/daemon/sandbox-socket-hint.js +136 -0
  129. package/dist/src/daemon/server/client-socket-context.d.ts +1 -1
  130. package/dist/src/daemon/server/client-socket-context.js +2 -3
  131. package/dist/src/daemon/server/dotenv-graph-changes.d.ts +97 -0
  132. package/dist/src/daemon/server/dotenv-graph-changes.js +284 -0
  133. package/dist/src/daemon/server/handle-client-env.d.ts +8 -0
  134. package/dist/src/daemon/server/handle-client-env.js +92 -0
  135. package/dist/src/daemon/server/handle-outputs-changes.d.ts +10 -0
  136. package/dist/src/daemon/server/handle-outputs-changes.js +86 -0
  137. package/dist/src/daemon/server/project-graph-incremental-recomputation.d.ts +21 -0
  138. package/dist/src/daemon/server/project-graph-incremental-recomputation.js +159 -6
  139. package/dist/src/daemon/server/server.js +36 -72
  140. package/dist/src/daemon/server/shutdown-utils.d.ts +1 -1
  141. package/dist/src/daemon/server/shutdown-utils.js +2 -2
  142. package/dist/src/daemon/socket-utils.d.ts +26 -7
  143. package/dist/src/daemon/socket-utils.js +45 -31
  144. package/dist/src/daemon/tmp-dir.d.ts +10 -0
  145. package/dist/src/daemon/tmp-dir.js +21 -37
  146. package/dist/src/devkit-internals.d.ts +19 -8
  147. package/dist/src/devkit-internals.js +47 -6
  148. package/dist/src/executors/run-commands/running-tasks.js +46 -29
  149. package/dist/src/generators/internal-utils/{format-changed-files-with-prettier-if-available.d.ts → format-changed-files.d.ts} +6 -6
  150. package/dist/src/generators/internal-utils/format-changed-files.js +163 -0
  151. package/dist/src/generators/testing-utils/create-tree-with-empty-workspace.d.ts +15 -0
  152. package/dist/src/generators/testing-utils/create-tree-with-empty-workspace.js +21 -3
  153. package/dist/src/migrations/update-15-0-0/prefix-outputs.js +2 -2
  154. package/dist/src/migrations/update-16-0-0/remove-nrwl-cli.js +2 -2
  155. package/dist/src/migrations/update-16-0-0/update-depends-on-to-tokens.js +2 -2
  156. package/dist/src/migrations/update-16-0-0/update-nx-cloud-runner.js +2 -2
  157. package/dist/src/migrations/update-16-2-0/remove-run-commands-output-path.js +2 -2
  158. package/dist/src/migrations/update-17-0-0/rm-default-collection-npm-scope.js +2 -2
  159. package/dist/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.js +2 -2
  160. package/dist/src/migrations/update-17-2-0/move-default-base.js +2 -2
  161. package/dist/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.js +2 -2
  162. package/dist/src/migrations/update-19-2-4/set-project-name.js +2 -2
  163. package/dist/src/migrations/update-20-0-0/move-use-daemon-process.js +2 -2
  164. package/dist/src/migrations/update-20-0-1/use-legacy-cache.js +2 -2
  165. package/dist/src/migrations/update-21-0-0/release-changelog-config-changes.js +2 -2
  166. package/dist/src/migrations/update-21-0-0/release-version-config-changes.js +2 -2
  167. package/dist/src/migrations/update-21-0-0/remove-custom-tasks-runner.js +2 -2
  168. package/dist/src/migrations/update-21-0-0/remove-legacy-cache.js +2 -2
  169. package/dist/src/migrations/update-22-0-0/consolidate-release-tag-config.js +2 -2
  170. package/dist/src/migrations/update-22-0-0/release-version-config-changes.js +2 -2
  171. package/dist/src/migrations/update-22-2-0/add-self-healing-to-gitignore.js +2 -2
  172. package/dist/src/migrations/update-22-6-0/add-claude-settings-local-to-git-ignore.js +2 -2
  173. package/dist/src/migrations/update-22-6-0/add-claude-worktrees-to-git-ignore.js +2 -2
  174. package/dist/src/migrations/update-22-7-0/add-polygraph-to-git-ignore.js +2 -2
  175. package/dist/src/migrations/update-23-0-0/add-migrate-runs-to-git-ignore.js +2 -2
  176. package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.js +2 -2
  177. package/dist/src/native/index.d.ts +7 -3
  178. package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
  179. package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
  180. package/dist/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +3 -3
  181. package/dist/src/nx-cloud/utilities/url-shorten.d.ts +1 -4
  182. package/dist/src/nx-cloud/utilities/url-shorten.js +9 -8
  183. package/dist/src/plugins/js/lock-file/lock-file.d.ts +46 -4
  184. package/dist/src/plugins/js/lock-file/lock-file.js +192 -15
  185. package/dist/src/plugins/js/lock-file/npm-parser.js +10 -3
  186. package/dist/src/plugins/js/lock-file/pnpm-parser.js +356 -62
  187. package/dist/src/plugins/js/lock-file/project-graph-pruning.d.ts +25 -1
  188. package/dist/src/plugins/js/lock-file/project-graph-pruning.js +78 -4
  189. package/dist/src/plugins/js/lock-file/pruned-output.d.ts +330 -0
  190. package/dist/src/plugins/js/lock-file/pruned-output.js +1441 -0
  191. package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.d.ts +1 -0
  192. package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.js +6 -5
  193. package/dist/src/plugins/js/utils/register.d.ts +11 -0
  194. package/dist/src/plugins/js/utils/register.js +40 -6
  195. package/dist/src/project-graph/plugins/get-plugins.d.ts +27 -1
  196. package/dist/src/project-graph/plugins/get-plugins.js +110 -5
  197. package/dist/src/project-graph/plugins/isolation/enabled.js +1 -4
  198. package/dist/src/project-graph/plugins/isolation/isolated-plugin.d.ts +16 -0
  199. package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +69 -11
  200. package/dist/src/project-graph/plugins/isolation/messaging.js +1 -3
  201. package/dist/src/project-graph/plugins/isolation/plugin-worker.js +23 -2
  202. package/dist/src/project-graph/project-graph.js +27 -2
  203. package/dist/src/project-graph/utils/project-configuration/project-nodes-manager.d.ts +7 -0
  204. package/dist/src/project-graph/utils/project-configuration/project-nodes-manager.js +14 -6
  205. package/dist/src/project-graph/utils/project-configuration/target-defaults.js +47 -21
  206. package/dist/src/tasks-runner/is-tui-enabled.js +3 -1
  207. package/dist/src/tasks-runner/life-cycle.d.ts +2 -2
  208. package/dist/src/tasks-runner/life-cycle.js +2 -2
  209. package/dist/src/tasks-runner/life-cycles/performance-report.d.ts +12 -0
  210. package/dist/src/tasks-runner/life-cycles/performance-report.js +62 -3
  211. package/dist/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.d.ts +26 -1
  212. package/dist/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.js +99 -5
  213. package/dist/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.d.ts +26 -0
  214. package/dist/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.js +113 -17
  215. package/dist/src/tasks-runner/pseudo-ipc.js +14 -13
  216. package/dist/src/tasks-runner/pseudo-terminal.d.ts +17 -3
  217. package/dist/src/tasks-runner/pseudo-terminal.js +22 -10
  218. package/dist/src/tasks-runner/run-command.js +32 -39
  219. package/dist/src/tasks-runner/running-tasks/batch-process.d.ts +55 -0
  220. package/dist/src/tasks-runner/running-tasks/batch-process.js +161 -8
  221. package/dist/src/tasks-runner/task-env.d.ts +25 -0
  222. package/dist/src/tasks-runner/task-env.js +39 -0
  223. package/dist/src/tasks-runner/task-orchestrator.d.ts +68 -0
  224. package/dist/src/tasks-runner/task-orchestrator.js +159 -8
  225. package/dist/src/utils/analytics-enabled.d.ts +7 -0
  226. package/dist/src/utils/analytics-enabled.js +11 -0
  227. package/dist/src/utils/analytics-prompt.js +4 -7
  228. package/dist/src/utils/cache-directory.d.ts +62 -3
  229. package/dist/src/utils/cache-directory.js +276 -25
  230. package/dist/src/utils/catalog/bun-manager-utils.d.ts +8 -0
  231. package/dist/src/utils/catalog/bun-manager-utils.js +174 -0
  232. package/dist/src/utils/catalog/bun-manager.d.ts +28 -0
  233. package/dist/src/utils/catalog/bun-manager.js +130 -0
  234. package/dist/src/utils/catalog/index.d.ts +1 -1
  235. package/dist/src/utils/catalog/index.js +1 -1
  236. package/dist/src/utils/catalog/manager-factory.js +3 -0
  237. package/dist/src/utils/catalog/manager-utils.d.ts +8 -1
  238. package/dist/src/utils/catalog/manager-utils.js +9 -4
  239. package/dist/src/utils/catalog/manager.d.ts +13 -1
  240. package/dist/src/utils/catalog/manager.js +30 -0
  241. package/dist/src/utils/catalog/pnpm-manager.d.ts +2 -1
  242. package/dist/src/utils/catalog/pnpm-manager.js +3 -0
  243. package/dist/src/utils/catalog/types.d.ts +4 -0
  244. package/dist/src/utils/catalog/yarn-manager.d.ts +6 -2
  245. package/dist/src/utils/catalog/yarn-manager.js +23 -32
  246. package/dist/src/utils/child-process.d.ts +31 -1
  247. package/dist/src/utils/child-process.js +103 -0
  248. package/dist/src/utils/chunkify.d.ts +7 -1
  249. package/dist/src/utils/chunkify.js +10 -3
  250. package/dist/src/utils/consume-messages-from-socket.d.ts +42 -7
  251. package/dist/src/utils/consume-messages-from-socket.js +273 -38
  252. package/dist/src/utils/db-connection.js +8 -16
  253. package/dist/src/utils/exit-codes.d.ts +9 -0
  254. package/dist/src/utils/exit-codes.js +19 -0
  255. package/dist/src/utils/formatters/index.d.ts +13 -0
  256. package/dist/src/utils/formatters/index.js +74 -0
  257. package/dist/src/utils/formatters/oxfmt.d.ts +32 -0
  258. package/dist/src/utils/formatters/oxfmt.js +764 -0
  259. package/dist/src/utils/formatters/prettier.d.ts +26 -0
  260. package/dist/src/utils/formatters/prettier.js +201 -0
  261. package/dist/src/utils/formatters/shared.d.ts +5 -0
  262. package/dist/src/utils/formatters/shared.js +8 -0
  263. package/dist/src/utils/git-utils.d.ts +38 -2
  264. package/dist/src/utils/git-utils.js +422 -19
  265. package/dist/src/utils/has-nx-js-plugin.d.ts +1 -1
  266. package/dist/src/utils/has-nx-js-plugin.js +1 -1
  267. package/dist/src/utils/ignore.d.ts +47 -5
  268. package/dist/src/utils/ignore.js +93 -11
  269. package/dist/src/utils/kill-child-on-host-exit.d.ts +7 -0
  270. package/dist/src/utils/kill-child-on-host-exit.js +42 -0
  271. package/dist/src/utils/nx-console-prompt.js +3 -6
  272. package/dist/src/utils/nx-tmp-dir.d.ts +5 -0
  273. package/dist/src/utils/nx-tmp-dir.js +7 -2
  274. package/dist/src/utils/output.d.ts +153 -0
  275. package/dist/src/utils/output.js +289 -5
  276. package/dist/src/utils/owned-private-dir.d.ts +13 -0
  277. package/dist/src/utils/owned-private-dir.js +39 -0
  278. package/dist/src/utils/package-json.d.ts +2 -0
  279. package/dist/src/utils/package-manager.js +17 -7
  280. package/dist/src/utils/params.d.ts +7 -1
  281. package/dist/src/utils/params.js +64 -6
  282. package/dist/src/utils/permission-errors.d.ts +11 -0
  283. package/dist/src/utils/permission-errors.js +17 -0
  284. package/dist/src/utils/plugins/core-plugins.js +4 -0
  285. package/dist/src/utils/prompt-helpers.d.ts +53 -0
  286. package/dist/src/utils/prompt-helpers.js +111 -0
  287. package/dist/src/utils/socket-refused-exit-code.d.ts +15 -0
  288. package/dist/src/utils/socket-refused-exit-code.js +18 -0
  289. package/dist/src/utils/write-formatted-json-file.d.ts +3 -2
  290. package/dist/src/utils/write-formatted-json-file.js +5 -4
  291. package/package.json +29 -20
  292. package/dist/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +0 -88
  293. package/dist/src/utils/is-using-prettier.d.ts +0 -3
  294. package/dist/src/utils/is-using-prettier.js +0 -62
@@ -20,6 +20,41 @@ class StaticRunOneTerminalOutputLifeCycle {
20
20
  this.args = args;
21
21
  this.failedTasks = [];
22
22
  this.cachedTasks = [];
23
+ this.stoppedTasks = [];
24
+ this.allCompletedTasks = new Map();
25
+ this.collapsedTasks = 0;
26
+ /** Stopped tasks that produced output; a batch-stopped task has none. */
27
+ this.stoppedTasksWithOutput = 0;
28
+ }
29
+ /**
30
+ * Whether this run prints every task's output in full rather than collapsing
31
+ * the ones that succeeded.
32
+ */
33
+ get printsFullOutput() {
34
+ return (0, output_1.printsFullTaskOutput)(this.args);
35
+ }
36
+ /**
37
+ * Tells the reader that output was withheld, so a task that succeeded while
38
+ * printing something worth reading is not silently swallowed.
39
+ */
40
+ hiddenOutputHint() {
41
+ const withheld = [];
42
+ if (this.collapsedTasks > 0) {
43
+ withheld.push(`${this.collapsedTasks} successful ${this.collapsedTasks === 1 ? 'task' : 'tasks'}`);
44
+ }
45
+ // A stopped task's partial output is what diagnoses a hang, and it is
46
+ // dropped by default, so say so even when nothing collapsed.
47
+ if (this.stoppedTasksWithOutput > 0) {
48
+ withheld.push(`${this.stoppedTasksWithOutput} stopped ${this.stoppedTasksWithOutput === 1 ? 'task' : 'tasks'}`);
49
+ }
50
+ if (this.printsFullOutput || withheld.length === 0) {
51
+ return [];
52
+ }
53
+ const total = this.collapsedTasks + this.stoppedTasksWithOutput;
54
+ return [
55
+ '',
56
+ `${output_1.output.dim(`Output of ${withheld.join(' and ')} ${total === 1 && withheld.length === 1 ? 'was' : 'were'} not shown. Run with`)} --verbose ${output_1.output.dim('or')} --output-style=static ${output_1.output.dim('to see it.')}`,
57
+ ];
23
58
  }
24
59
  startCommand() {
25
60
  const numberOfDeps = this.tasks.length - 1;
@@ -34,13 +69,17 @@ class StaticRunOneTerminalOutputLifeCycle {
34
69
  }
35
70
  endCommand() {
36
71
  output_1.output.addNewline();
37
- if (this.failedTasks.length === 0) {
72
+ // A stopped task was killed mid-flight, so the run did not complete even
73
+ // though nothing outright failed — matching run-many and didCommandComplete.
74
+ if (this.failedTasks.length === 0 && this.stoppedTasks.length === 0) {
38
75
  output_1.output.addVerticalSeparatorWithoutNewLines('green');
39
76
  const bodyLines = this.cachedTasks.length > 0
40
77
  ? [
41
78
  output_1.output.dim(`Nx read the output from the cache instead of running the command for ${this.cachedTasks.length} out of ${this.tasks.length} tasks.`),
42
79
  ]
43
80
  : [];
81
+ bodyLines.push(...this.tasksNotRunSummary());
82
+ bodyLines.push(...this.hiddenOutputHint());
44
83
  output_1.output.success({
45
84
  title: `Successfully ran ${(0, formatting_utils_1.formatTargetsAndProjects)(this.projectNames, this.args.targets, this.tasks)}`,
46
85
  bodyLines,
@@ -48,24 +87,71 @@ class StaticRunOneTerminalOutputLifeCycle {
48
87
  }
49
88
  else {
50
89
  output_1.output.addVerticalSeparatorWithoutNewLines('red');
51
- const bodyLines = [
52
- output_1.output.dim('Failed tasks:'),
53
- '',
54
- ...this.failedTasks.map((task) => `${output_1.output.dim('-')} ${task.id}`),
55
- '',
56
- `${output_1.output.dim('Hint: run the command with')} --verbose ${output_1.output.dim('for more details.')}`,
57
- ];
90
+ const bodyLines = [];
91
+ const skippedTasks = this.skippedTasks();
92
+ if (skippedTasks.length > 0) {
93
+ bodyLines.push(output_1.output.dim('Tasks not run because their dependencies failed or --nx-bail=true:'), '', ...skippedTasks.map((task) => `${output_1.output.dim('-')} ${task.id}`), '');
94
+ }
95
+ if (this.stoppedTasks.length > 0) {
96
+ bodyLines.push(output_1.output.dim('Tasks stopped before they finished:'), '', ...this.stoppedTasks.map((task) => `${output_1.output.dim('-')} ${task.id}`), '');
97
+ }
98
+ if (this.failedTasks.length > 0) {
99
+ bodyLines.push(output_1.output.dim('Failed tasks:'), '', ...this.failedTasks.map((task) => `${output_1.output.dim('-')} ${task.id}`), '');
100
+ }
101
+ bodyLines.push(...this.hiddenOutputHint());
102
+ bodyLines.push(`${output_1.output.dim('Hint: run the command with')} --verbose ${output_1.output.dim('for more details.')}`);
103
+ const targets = (0, formatting_utils_1.formatTargetsAndProjects)(this.projectNames, this.args.targets, this.tasks);
58
104
  output_1.output.error({
59
- title: `Running ${(0, formatting_utils_1.formatTargetsAndProjects)(this.projectNames, this.args.targets, this.tasks)} failed`,
105
+ title: this.failedTasks.length > 0
106
+ ? `Running ${targets} failed`
107
+ : `Running ${targets} did not complete`,
60
108
  bodyLines,
61
109
  });
62
110
  }
63
111
  }
112
+ /**
113
+ * Tasks with a `skipped` status are never reported through `endTasks`, so
114
+ * they are derived by subtracting everything that did complete.
115
+ */
116
+ skippedTasks() {
117
+ return this.tasks.filter((t) => !this.allCompletedTasks.has(t.id));
118
+ }
119
+ /**
120
+ * Tasks that never produced output worth printing are summarized as counts,
121
+ * with their names available behind --verbose.
122
+ */
123
+ tasksNotRunSummary() {
124
+ const skippedTasks = this.skippedTasks();
125
+ const counts = [];
126
+ if (skippedTasks.length > 0) {
127
+ counts.push(`${skippedTasks.length} skipped`);
128
+ }
129
+ if (this.stoppedTasks.length > 0) {
130
+ counts.push(`${this.stoppedTasks.length} stopped`);
131
+ }
132
+ if (counts.length === 0) {
133
+ return [];
134
+ }
135
+ const lines = [output_1.output.dim(counts.join(', '))];
136
+ if (this.printsFullOutput) {
137
+ lines.push('', ...[...skippedTasks, ...this.stoppedTasks].map((task) => `${output_1.output.dim('-')} ${task.id}`));
138
+ }
139
+ return lines;
140
+ }
64
141
  endTasks(taskResults) {
65
142
  for (let t of taskResults) {
143
+ this.allCompletedTasks.set(t.task.id, t.task);
66
144
  if (t.status === 'failure') {
67
145
  this.failedTasks.push(t.task);
68
146
  }
147
+ else if (t.status === 'stopped') {
148
+ this.stoppedTasks.push(t.task);
149
+ // A batch-stopped task is reported with no output at all, so counting
150
+ // it would have the hint promise something --verbose cannot show.
151
+ if (t.terminalOutput) {
152
+ this.stoppedTasksWithOutput++;
153
+ }
154
+ }
69
155
  else if (t.status === 'local-cache') {
70
156
  this.cachedTasks.push(t.task);
71
157
  }
@@ -79,19 +165,29 @@ class StaticRunOneTerminalOutputLifeCycle {
79
165
  }
80
166
  printTaskTerminalOutput(task, status, terminalOutput) {
81
167
  const args = (0, utils_1.getPrintableCommandArgsForTask)(task);
82
- if (this.args.verbose ||
83
- status === 'success' ||
168
+ if (this.printsFullOutput ||
84
169
  status === 'failure' ||
85
170
  task.target.project === this.initiatingProject) {
86
- output_1.output.logCommandOutput(args.join(' '), status, terminalOutput);
87
- }
88
- else {
89
171
  /**
90
- * Do not show the terminal output in the case where it is not the initiating project and verbose is not set,
91
- * but still print the command that was run and its status (so that cache hits can still be traced).
172
+ * The task that was actually asked for always shows its full output, even
173
+ * on success — printing nothing for `nx build myapp` would be surprising.
174
+ * A stopped task's partial output is shown under --verbose or
175
+ * --output-style=static (what diagnoses a hang); it is dropped on the
176
+ * default path below.
92
177
  */
93
- output_1.output.logCommandOutput(args.join(' '), status, '');
178
+ output_1.output.logCommandOutput(args.join(' '), status, terminalOutput);
179
+ return;
180
+ }
181
+ // Named in the end of run summary instead; output not shown by default.
182
+ if (status === 'skipped' || status === 'stopped') {
183
+ return;
94
184
  }
185
+ /**
186
+ * Dependency tasks collapse to a single line, so that a cache hit or a
187
+ * success can still be traced without carrying its whole log.
188
+ */
189
+ this.collapsedTasks++;
190
+ output_1.output.logCommandSummary(args.join(' '), status);
95
191
  }
96
192
  }
97
193
  exports.StaticRunOneTerminalOutputLifeCycle = StaticRunOneTerminalOutputLifeCycle;
@@ -77,6 +77,14 @@ class PseudoIPCServer {
77
77
  this.childReadyMap.get(childId)();
78
78
  }
79
79
  }
80
+ },
81
+ // Nothing resynchronizes a length-prefixed stream, so report it the
82
+ // same way a socket error is reported and let the peer see the close.
83
+ (err) => {
84
+ for (const childMessage of this.childMessages) {
85
+ childMessage.onError?.(err);
86
+ }
87
+ socket.destroy();
80
88
  }));
81
89
  socket.on('close', () => {
82
90
  for (const childMessage of this.childMessages) {
@@ -91,15 +99,12 @@ class PseudoIPCServer {
91
99
  }
92
100
  sendMessageToChildren(message) {
93
101
  this.sockets.forEach((socket) => {
94
- socket.write((0, socket_utils_1.serialize)({ type: 'TO_CHILDREN_FROM_PARENT', message }));
95
- // send EOT to indicate that the message has been fully written
96
- socket.write(consume_messages_from_socket_1.MESSAGE_END_SEQ);
102
+ (0, socket_utils_1.sendMessage)(socket, { type: 'TO_CHILDREN_FROM_PARENT', message });
97
103
  });
98
104
  }
99
105
  sendMessageToChild(id, message) {
100
106
  this.sockets.forEach((socket) => {
101
- socket.write((0, socket_utils_1.serialize)({ type: 'TO_CHILDREN_FROM_PARENT', id, message }));
102
- socket.write(consume_messages_from_socket_1.MESSAGE_END_SEQ);
107
+ (0, socket_utils_1.sendMessage)(socket, { type: 'TO_CHILDREN_FROM_PARENT', id, message });
103
108
  });
104
109
  }
105
110
  onMessageFromChildren(onMessage, onClose = () => { }, onError = (err) => { }) {
@@ -121,17 +126,13 @@ class PseudoIPCClient {
121
126
  this.socket = (0, net_1.connect)(this.path);
122
127
  }
123
128
  sendMessageToParent(message) {
124
- this.socket.write((0, socket_utils_1.serialize)({ type: 'TO_PARENT_FROM_CHILDREN', message }));
125
- // send EOT to indicate that the message has been fully written
126
- this.socket.write(consume_messages_from_socket_1.MESSAGE_END_SEQ);
129
+ (0, socket_utils_1.sendMessage)(this.socket, { type: 'TO_PARENT_FROM_CHILDREN', message });
127
130
  }
128
131
  notifyChildIsReady(id) {
129
- this.socket.write((0, socket_utils_1.serialize)({
132
+ (0, socket_utils_1.sendMessage)(this.socket, {
130
133
  type: 'CHILD_READY',
131
134
  message: id,
132
- }));
133
- // send EOT to indicate that the message has been fully written
134
- this.socket.write(consume_messages_from_socket_1.MESSAGE_END_SEQ);
135
+ });
135
136
  }
136
137
  onMessageFromParent(forkId, onMessage, onClose = () => { }, onError = (err) => { }) {
137
138
  this.socket.on('data', (0, consume_messages_from_socket_1.consumeMessagesFromSocket)(async (rawMessage) => {
@@ -144,7 +145,7 @@ class PseudoIPCClient {
144
145
  onMessage(message);
145
146
  }
146
147
  }
147
- }));
148
+ }, onError));
148
149
  this.socket.on('close', onClose);
149
150
  this.socket.on('error', onError);
150
151
  return this;
@@ -34,11 +34,25 @@ export declare class PseudoTerminal {
34
34
  export declare class PseudoTtyProcess implements RunningTask {
35
35
  rustPseudoTerminal: RustPseudoTerminal;
36
36
  private childProcess;
37
+ /**
38
+ * Whether the native side is suppressing this task's output. When it is
39
+ * not, Rust writes each chunk straight to our stdout, so `CLIOutput` has to
40
+ * be told - it never sees those writes and would otherwise assume the
41
+ * cursor is still at a line start.
42
+ */
43
+ private readonly quiet;
37
44
  isAlive: boolean;
38
45
  private exitCallbacks;
39
46
  private outputCallbacks;
40
47
  private terminalOutputChunks;
41
- constructor(rustPseudoTerminal: RustPseudoTerminal, childProcess: ChildProcess);
48
+ constructor(rustPseudoTerminal: RustPseudoTerminal, childProcess: ChildProcess,
49
+ /**
50
+ * Whether the native side is suppressing this task's output. When it is
51
+ * not, Rust writes each chunk straight to our stdout, so `CLIOutput` has to
52
+ * be told - it never sees those writes and would otherwise assume the
53
+ * cursor is still at a line start.
54
+ */
55
+ quiet?: boolean);
42
56
  getResults(): Promise<{
43
57
  code: number;
44
58
  terminalOutput: string;
@@ -47,12 +61,12 @@ export declare class PseudoTtyProcess implements RunningTask {
47
61
  onOutput(callback: (message: string) => void): void;
48
62
  getPid(): number | undefined;
49
63
  kill(s?: NodeJS.Signals): Promise<void>;
50
- getParserAndWriter(): import("../native").ExternalObject<[import("../native").ParserArc, import("../native").WriterArc]>;
64
+ getPtyHandles(): import("../native").ExternalObject<[import("../native").ParserArc, import("../native").WriterArc, import("../native").MasterArc]>;
51
65
  }
52
66
  export declare class PseudoTtyProcessWithSend extends PseudoTtyProcess {
53
67
  rustPseudoTerminal: RustPseudoTerminal;
54
68
  private id;
55
69
  private pseudoIpc;
56
- constructor(rustPseudoTerminal: RustPseudoTerminal, _childProcess: ChildProcess, id: string, pseudoIpc: PseudoIPCServer);
70
+ constructor(rustPseudoTerminal: RustPseudoTerminal, _childProcess: ChildProcess, id: string, pseudoIpc: PseudoIPCServer, quiet?: boolean);
57
71
  send(message: Serializable): void;
58
72
  }
@@ -6,6 +6,7 @@ const tslib_1 = require("tslib");
6
6
  const os = tslib_1.__importStar(require("os"));
7
7
  const socket_utils_1 = require("../daemon/socket-utils");
8
8
  const native_1 = require("../native");
9
+ const output_1 = require("../utils/output");
9
10
  const pseudo_ipc_1 = require("./pseudo-ipc");
10
11
  const exit_codes_1 = require("../utils/exit-codes");
11
12
  // Kill any children still alive when Nx exits. Terminals remove themselves once
@@ -69,7 +70,7 @@ class PseudoTerminal {
69
70
  }
70
71
  }
71
72
  runCommand(command, { cwd, execArgv, jsEnv, quiet, tty, } = {}) {
72
- const cp = new PseudoTtyProcess(this.rustPseudoTerminal, this.rustPseudoTerminal.runCommand(command, cwd, jsEnv, execArgv, quiet, tty));
73
+ const cp = new PseudoTtyProcess(this.rustPseudoTerminal, this.rustPseudoTerminal.runCommand(command, cwd, jsEnv, execArgv, quiet, tty), quiet);
73
74
  this.childProcesses.add(cp);
74
75
  cp.onExit(() => this.releaseChild(cp));
75
76
  return cp;
@@ -78,7 +79,7 @@ class PseudoTerminal {
78
79
  if (!this.initialized) {
79
80
  throw new Error('Call init() before forking processes');
80
81
  }
81
- const cp = new PseudoTtyProcessWithSend(this.rustPseudoTerminal, this.rustPseudoTerminal.fork(id, script, this.pseudoIPCPath, cwd, jsEnv, execArgv, quiet, commandLabel), id, this.pseudoIPC);
82
+ const cp = new PseudoTtyProcessWithSend(this.rustPseudoTerminal, this.rustPseudoTerminal.fork(id, script, this.pseudoIPCPath, cwd, jsEnv, execArgv, quiet, commandLabel), id, this.pseudoIPC, quiet);
82
83
  this.childProcesses.add(cp);
83
84
  cp.onExit(() => this.releaseChild(cp));
84
85
  await this.pseudoIPC.waitForChildReady(id);
@@ -93,16 +94,27 @@ class PseudoTerminal {
93
94
  }
94
95
  exports.PseudoTerminal = PseudoTerminal;
95
96
  class PseudoTtyProcess {
96
- constructor(rustPseudoTerminal, childProcess) {
97
+ constructor(rustPseudoTerminal, childProcess,
98
+ /**
99
+ * Whether the native side is suppressing this task's output. When it is
100
+ * not, Rust writes each chunk straight to our stdout, so `CLIOutput` has to
101
+ * be told - it never sees those writes and would otherwise assume the
102
+ * cursor is still at a line start.
103
+ */
104
+ quiet = false) {
97
105
  this.rustPseudoTerminal = rustPseudoTerminal;
98
106
  this.childProcess = childProcess;
107
+ this.quiet = quiet;
99
108
  this.isAlive = true;
100
109
  this.exitCallbacks = [];
101
110
  this.outputCallbacks = [];
102
111
  this.terminalOutputChunks = [];
103
- childProcess.onOutput((output) => {
104
- this.terminalOutputChunks.push(output);
105
- this.outputCallbacks.forEach((cb) => cb(output));
112
+ childProcess.onOutput((chunk) => {
113
+ if (!this.quiet) {
114
+ output_1.output.noteExternalWrite(chunk);
115
+ }
116
+ this.terminalOutputChunks.push(chunk);
117
+ this.outputCallbacks.forEach((cb) => cb(chunk));
106
118
  });
107
119
  childProcess.onExit((message) => {
108
120
  this.isAlive = false;
@@ -150,14 +162,14 @@ class PseudoTtyProcess {
150
162
  }
151
163
  }
152
164
  }
153
- getParserAndWriter() {
154
- return this.childProcess.getParserAndWriter();
165
+ getPtyHandles() {
166
+ return this.childProcess.getPtyHandles();
155
167
  }
156
168
  }
157
169
  exports.PseudoTtyProcess = PseudoTtyProcess;
158
170
  class PseudoTtyProcessWithSend extends PseudoTtyProcess {
159
- constructor(rustPseudoTerminal, _childProcess, id, pseudoIpc) {
160
- super(rustPseudoTerminal, _childProcess);
171
+ constructor(rustPseudoTerminal, _childProcess, id, pseudoIpc, quiet = false) {
172
+ super(rustPseudoTerminal, _childProcess, quiet);
161
173
  this.rustPseudoTerminal = rustPseudoTerminal;
162
174
  this.id = id;
163
175
  this.pseudoIpc = pseudoIpc;
@@ -8,7 +8,7 @@ exports.constructLifeCycles = constructLifeCycles;
8
8
  exports.getRunner = getRunner;
9
9
  exports.getRunnerOptions = getRunnerOptions;
10
10
  const tslib_1 = require("tslib");
11
- const enquirer_1 = require("enquirer");
11
+ const prompt_helpers_1 = require("../utils/prompt-helpers");
12
12
  const node_util_1 = require("node:util");
13
13
  const nx_json_1 = require("../config/nx-json");
14
14
  const client_1 = require("../daemon/client/client");
@@ -39,6 +39,7 @@ const store_run_information_life_cycle_1 = require("./life-cycles/store-run-info
39
39
  const task_history_life_cycle_1 = require("./life-cycles/task-history-life-cycle");
40
40
  const task_profiling_life_cycle_1 = require("./life-cycles/task-profiling-life-cycle");
41
41
  const performance_life_cycle_1 = require("./life-cycles/performance-life-cycle");
42
+ const performance_report_1 = require("./life-cycles/performance-report");
42
43
  const task_results_life_cycle_1 = require("./life-cycles/task-results-life-cycle");
43
44
  const task_telemetry_life_cycle_1 = require("./life-cycles/task-telemetry-life-cycle");
44
45
  const task_timings_life_cycle_1 = require("./life-cycles/task-timings-life-cycle");
@@ -80,12 +81,15 @@ async function getTerminalOutputLifeCycle(initiatingProject, initiatingTasks, pr
80
81
  if (tasks.length === 1 && !is_tui_enabled_1.ORIGINAL_TUI_ENV_VALUE) {
81
82
  process.env.NX_TUI = 'false';
82
83
  }
84
+ // Kick off in the background so the URL is ready by the exit report. A brief
85
+ // sync preamble (git remote + axios load) runs here; the network call does not.
86
+ (0, performance_report_1.prefetchRemoteCacheOnboardingUrl)(nxJson);
83
87
  if ((0, is_tui_enabled_1.isTuiEnabled)()) {
84
88
  const interceptedNxCloudLogs = [];
85
89
  // Resolve where the Nx Cloud client bundle actually loads from so the
86
- // stack-trace check below matches its frames. It is NOT always
87
- // `{workspaceRoot}/.nx/cache/cloud`: in a git worktree the cache dir is
88
- // shared with the main repo, and it can also be relocated via
90
+ // stack-trace check below matches its frames. It is essentially never
91
+ // `{workspaceRoot}/.nx/cache/cloud`: the cache normally lives in the shared
92
+ // per-user `~/.nx/<hash>/cache`, and it can also be relocated via
89
93
  // NX_CACHE_DIRECTORY, a custom `cacheDirectory` in nx.json, or the lerna
90
94
  // `node_modules/.cache` location. Using the client's own resolver keeps the
91
95
  // interception working in all of those cases.
@@ -169,7 +173,7 @@ async function getTerminalOutputLifeCycle(initiatingProject, initiatingTasks, pr
169
173
  const lifeCycles = [tsLifeCycle];
170
174
  // Only run the TUI if there are tasks to run
171
175
  if (tasks.length > 0) {
172
- appLifeCycle = new AppLifeCycle(tasks, initiatingTasks.map((t) => t.id), isRunOne ? 0 /* RunMode.RunOne */ : 1 /* RunMode.RunMany */, pinnedTasks, nxArgs ?? {}, nxJson.tui ?? {}, titleText, workspace_root_1.workspaceRoot, taskGraph);
176
+ appLifeCycle = new AppLifeCycle(tasks, initiatingTasks.map((t) => t.id), isRunOne ? 0 /* RunMode.RunOne */ : 1 /* RunMode.RunMany */, pinnedTasks, nxArgs ?? {}, nxJson.tui ?? {}, titleText, workspace_root_1.workspaceRoot, taskGraph, (0, nx_cloud_utils_1.isNxCloudUsed)(nxJson));
173
177
  // The native endCommand renders the perf report in the exit popup; the runner
174
178
  // sources the payload and CompositeLifeCycle forwards it here.
175
179
  lifeCycles.unshift(appLifeCycle);
@@ -595,23 +599,19 @@ async function ensureWorkspaceIsInSyncAndGetGraphs(projectGraph, nxJson, project
595
599
  }
596
600
  async function promptForApplyingSyncGeneratorChanges() {
597
601
  try {
598
- const promptConfig = {
599
- name: 'applyChanges',
600
- type: 'autocomplete',
601
- message: 'Would you like to sync the identified changes to get your workspace up to date?',
602
+ // No footer slot, so the opt-out note is part of the message.
603
+ const applyChanges = await (0, prompt_helpers_1.selectPrompt)({
604
+ message: `Would you like to sync the identified changes to get your workspace up to date?${pc.dim('\nYou can skip this prompt by setting the `sync.applyChanges` option to `true` in your `nx.json`.\nFor more information, refer to the docs: https://nx.dev/concepts/sync-generators.')}`,
602
605
  choices: [
606
+ { value: 'yes', label: 'Yes, sync the changes and run the tasks' },
603
607
  {
604
- name: 'yes',
605
- message: 'Yes, sync the changes and run the tasks',
606
- },
607
- {
608
- name: 'no',
609
- message: 'No, run the tasks without syncing the changes',
608
+ value: 'no',
609
+ label: 'No, run the tasks without syncing the changes',
610
610
  },
611
611
  ],
612
- footer: () => pc.dim('\nYou can skip this prompt by setting the `sync.applyChanges` option to `true` in your `nx.json`.\nFor more information, refer to the docs: https://nx.dev/concepts/sync-generators.'),
613
- };
614
- return await (0, enquirer_1.prompt)([promptConfig]).then(({ applyChanges }) => applyChanges === 'yes');
612
+ onCancel: () => process.exit(1),
613
+ });
614
+ return applyChanges === 'yes';
615
615
  }
616
616
  catch {
617
617
  process.exit(1);
@@ -619,26 +619,15 @@ async function promptForApplyingSyncGeneratorChanges() {
619
619
  }
620
620
  async function confirmRunningTasksWithSyncFailures() {
621
621
  try {
622
- const promptConfig = {
623
- name: 'runTasks',
624
- type: 'autocomplete',
625
- message: 'Would you like to ignore the sync failures and continue running the tasks?',
622
+ const runTasks = await (0, prompt_helpers_1.selectPrompt)({
623
+ message: `Would you like to ignore the sync failures and continue running the tasks?${pc.dim(`\nWhen running in CI and there are sync failures, the tasks won't run. Addressing the errors above is highly recommended to prevent failures in CI.`)}`,
626
624
  choices: [
627
- {
628
- name: 'yes',
629
- message: 'Yes, ignore the failures and run the tasks',
630
- },
631
- {
632
- name: 'no',
633
- message: `No, don't run the tasks`,
634
- },
625
+ { value: 'yes', label: 'Yes, ignore the failures and run the tasks' },
626
+ { value: 'no', label: `No, don't run the tasks` },
635
627
  ],
636
- footer: () => pc.dim(`\nWhen running in CI and there are sync failures, the tasks won't run. Addressing the errors above is highly recommended to prevent failures in CI.`),
637
- };
638
- const runTasks = await (0, enquirer_1.prompt)([
639
- promptConfig,
640
- ]).then(({ runTasks }) => runTasks === 'yes');
641
- if (!runTasks) {
628
+ onCancel: () => process.exit(1),
629
+ });
630
+ if (runTasks !== 'yes') {
642
631
  process.exit(1);
643
632
  }
644
633
  }
@@ -647,9 +636,13 @@ async function confirmRunningTasksWithSyncFailures() {
647
636
  }
648
637
  }
649
638
  function setEnvVarsBasedOnArgs(nxArgs, loadDotEnvFiles) {
639
+ // Batch mode turns on streaming implicitly, but streamed output interleaves
640
+ // between tasks and so cannot be wrapped in collapsible log groups. Where
641
+ // grouping applies, let it win over the implicit request; an output style the
642
+ // user asked for explicitly still wins over grouping.
643
+ const batchMode = process.env.NX_BATCH_MODE === 'true' || nxArgs.batch;
650
644
  if (nxArgs.outputStyle == 'stream' ||
651
- process.env.NX_BATCH_MODE === 'true' ||
652
- nxArgs.batch) {
645
+ (batchMode && !(0, output_1.isLogGroupingEnabled)())) {
653
646
  process.env.NX_STREAM_OUTPUT = 'true';
654
647
  process.env.NX_PREFIX_OUTPUT = 'true';
655
648
  }
@@ -795,7 +788,7 @@ function shouldUseDynamicLifeCycle(tasks, options, outputStyle) {
795
788
  return false;
796
789
  if ((0, is_ci_1.isCI)())
797
790
  return false;
798
- if (outputStyle === 'static' ||
791
+ if ((0, output_1.isStaticOutputStyle)(outputStyle) ||
799
792
  outputStyle === 'stream' ||
800
793
  outputStyle === 'stream-without-prefixes')
801
794
  return false;
@@ -8,11 +8,66 @@ export declare class BatchProcess {
8
8
  private batchResultsCallbacks;
9
9
  private taskResultsCallbacks;
10
10
  private outputCallbacks;
11
+ /**
12
+ * File holding all stdout/stderr held back from the live stream under log
13
+ * grouping. It is rendered as a fold by a full-output run and by any batch
14
+ * that reported a failed or stopped task (alongside per-task rendering), and
15
+ * by any batch that crashed or was stopped before reporting (with redirect
16
+ * lines — no per-task blocks exist there), so that a diagnostic no task
17
+ * claimed — a crash, a config-phase error, a runner's summary — is not lost.
18
+ * Only a batch whose every task succeeded on the default style discards it
19
+ * unread. Crashiness is unknowable while capturing, so it is always written.
20
+ *
21
+ * It goes to disk rather than a string because a batch is long-lived (Gradle
22
+ * runs one for the whole command) and its output has no bound. Accumulating
23
+ * that in memory grows without limit and eventually exceeds the maximum
24
+ * length of a JS string.
25
+ */
26
+ private capturedOutputPath;
27
+ private capturedOutputFd;
28
+ /**
29
+ * Set once the capture is released. A chunk can still arrive after that —
30
+ * stdout delivers past the exit event — and reopening then would mint a
31
+ * second numbered file that nothing ever cleans up.
32
+ */
33
+ private capturedOutputDiscarded;
34
+ /**
35
+ * Set when writing the capture failed. Distinct from discarded: the bytes
36
+ * already on disk are still the best record of the batch, so the file is kept
37
+ * and rendered, while everything after the failure goes live to the terminal.
38
+ */
39
+ private capturedOutputFailed;
40
+ private static capturedOutputCount;
11
41
  constructor(childProcess: ChildProcess, executorName: string);
12
42
  onExit(cb: (code: number) => void): void;
13
43
  onBatchResults(cb: (results: BatchResults) => void): void;
14
44
  onTaskResults(cb: (task: string, result: TaskResult) => void): void;
15
45
  onOutput(cb: (output: string) => void): void;
46
+ private capture;
47
+ /**
48
+ * Path to the file holding everything held back from the live stream under
49
+ * log grouping, or undefined if nothing was captured. Used to render the whole
50
+ * batch as one fold, so output no task claimed is not lost.
51
+ *
52
+ * The file is deliberately left open rather than closed here. A worker's
53
+ * stdout can deliver after its exit event — which is what `getResults()`
54
+ * settles on — and leaving the fd open keeps such a chunk appending to this
55
+ * same file instead of minting a second numbered one that nothing cleans up.
56
+ * The caller reads the file once, synchronously, while rendering the fold, so
57
+ * anything arriving after that read is not shown; writes are unbuffered, so
58
+ * the read always sees a complete prefix of what has arrived by then.
59
+ */
60
+ getCapturedOutputPath(): string | undefined;
61
+ /** Releases the capture file. Safe to call more than once. */
62
+ discardCapturedOutput(): void;
63
+ /**
64
+ * Closes the fd and unlinks the file, leaving no path behind for a caller to
65
+ * read. Tolerates a partially-initialized capture, since it also runs when
66
+ * opening or writing the file is what failed.
67
+ */
68
+ private releaseCapturedOutput;
69
+ /** Closes the fd, keeping the file and its path readable. */
70
+ private closeCapturedOutput;
16
71
  getResults(): Promise<BatchResults>;
17
72
  send(message: Serializable): void;
18
73
  kill(signal?: NodeJS.Signals): Promise<void>;