@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
package/README.md CHANGED
@@ -13,10 +13,10 @@ npm install @depup/nx
13
13
 
14
14
  | Field | Value |
15
15
  |-------|-------|
16
- | Original | [nx](https://www.npmjs.com/package/nx) @ 23.1.3 |
17
- | Processed | 2026-09-01 |
16
+ | Original | [nx](https://www.npmjs.com/package/nx) @ 23.2.0 |
17
+ | Processed | 2026-09-02 |
18
18
  | Smoke test | failed |
19
- | Deps updated | 70 |
19
+ | Deps updated | 71 |
20
20
 
21
21
  ## Dependency Changes
22
22
 
@@ -52,9 +52,9 @@ npm install @depup/nx
52
52
  | dotenv-expand | 12.0.3 | ^1000.0.0 |
53
53
  | ejs | 5.0.1 | ^6.0.1 |
54
54
  | emoji-regex | 8.0.0 | ^10.6.0 |
55
- | enquirer | 2.3.6 | ^2.4.1 |
56
55
  | es-object-atoms | 1.1.1 | ^1.1.2 |
57
56
  | escape-string-regexp | 1.0.5 | ^5.0.0 |
57
+ | fast-wrap-ansi | 0.2.0 | ^0.2.2 |
58
58
  | figures | 3.2.0 | ^6.1.0 |
59
59
  | flat | 5.0.2 | ^6.0.1 |
60
60
  | has-flag | 4.0.0 | ^5.0.1 |
@@ -82,6 +82,7 @@ npm install @depup/nx
82
82
  | run-applescript | 7.0.0 | ^7.1.0 |
83
83
  | semver | 7.8.4 | ^7.8.5 |
84
84
  | signal-exit | 3.0.7 | ^4.1.0 |
85
+ | sisteransi | 1.0.5 | ^2.0.0 |
85
86
  | smol-toml | 1.6.1 | ^1.8.0 |
86
87
  | string-width | 4.2.3 | ^8.2.2 |
87
88
  | strip-ansi | 6.0.1 | ^7.2.0 |
package/changes.json CHANGED
@@ -120,10 +120,6 @@
120
120
  "from": "8.0.0",
121
121
  "to": "^10.6.0"
122
122
  },
123
- "enquirer": {
124
- "from": "2.3.6",
125
- "to": "^2.4.1"
126
- },
127
123
  "es-object-atoms": {
128
124
  "from": "1.1.1",
129
125
  "to": "^1.1.2"
@@ -132,6 +128,10 @@
132
128
  "from": "1.0.5",
133
129
  "to": "^5.0.0"
134
130
  },
131
+ "fast-wrap-ansi": {
132
+ "from": "0.2.0",
133
+ "to": "^0.2.2"
134
+ },
135
135
  "figures": {
136
136
  "from": "3.2.0",
137
137
  "to": "^6.1.0"
@@ -240,6 +240,10 @@
240
240
  "from": "3.0.7",
241
241
  "to": "^4.1.0"
242
242
  },
243
+ "sisteransi": {
244
+ "from": "1.0.5",
245
+ "to": "^2.0.0"
246
+ },
243
247
  "smol-toml": {
244
248
  "from": "1.6.1",
245
249
  "to": "^1.8.0"
@@ -281,6 +285,6 @@
281
285
  "to": "^22.0.0"
282
286
  }
283
287
  },
284
- "timestamp": "2026-09-01T00:42:01.327Z",
285
- "totalUpdated": 70
288
+ "timestamp": "2026-09-02T16:11:25.939Z",
289
+ "totalUpdated": 71
286
290
  }
@@ -6,7 +6,7 @@ const perf_hooks_1 = require("perf_hooks");
6
6
  const nx_commands_1 = require("../src/command-line/nx-commands");
7
7
  const strip_indents_1 = require("../src/utils/strip-indents");
8
8
  const client_1 = require("../src/daemon/client/client");
9
- const enquirer_1 = require("enquirer");
9
+ const prompt_helpers_1 = require("../src/utils/prompt-helpers");
10
10
  const output_1 = require("../src/utils/output");
11
11
  const analytics_1 = require("../src/analytics");
12
12
  /**
@@ -136,11 +136,9 @@ async function ensureNxConsoleInstalledViaDaemon() {
136
136
  ],
137
137
  });
138
138
  try {
139
- const { shouldInstallNxConsole } = await (0, enquirer_1.prompt)({
140
- type: 'confirm',
141
- name: 'shouldInstallNxConsole',
139
+ const shouldInstallNxConsole = await (0, prompt_helpers_1.confirmationPrompt)({
142
140
  message: 'Install Nx Console? (you can uninstall anytime)',
143
- initial: true,
141
+ onCancel: () => false,
144
142
  });
145
143
  // Set preference and install if user said yes
146
144
  const result = await client_1.daemonClient.setNxConsolePreferenceAndInstall(shouldInstallNxConsole);
package/dist/bin/nx.js CHANGED
@@ -209,6 +209,7 @@ function resolveNx(workspace) {
209
209
  function isNxCloudCommand(command) {
210
210
  const nxCloudCommands = [
211
211
  'start-ci-run',
212
+ 'start-nx-agents',
212
213
  'start-agent',
213
214
  'stop-all-agents',
214
215
  'complete-ci-run',
@@ -31,6 +31,7 @@ const executor_utils_1 = require("../command-line/run/executor-utils");
31
31
  const plugins_1 = require("../project-graph/plugins");
32
32
  const schema_utils_1 = require("../config/schema-utils");
33
33
  const handle_import_1 = require("../utils/handle-import");
34
+ const prompt_helpers_1 = require("../utils/prompt-helpers");
34
35
  const target_merging_1 = require("../project-graph/utils/project-configuration/target-merging");
35
36
  function getProjectGraph() {
36
37
  try {
@@ -653,8 +654,66 @@ function createPromptProvider() {
653
654
  return { ...question, type: definition.type };
654
655
  }
655
656
  });
656
- return require('enquirer').prompt(questions);
657
+ // Angular hands over a whole form at once; clack asks one question at a
658
+ // time, so they are run in order and the answers reassembled.
659
+ return (async () => {
660
+ const answers = {};
661
+ for (const question of questions) {
662
+ answers[question.name] = await askSchematicQuestion(question);
663
+ }
664
+ return answers;
665
+ })();
657
666
  };
667
+ async function askSchematicQuestion(question) {
668
+ const validate = question.validate
669
+ ? (value) => {
670
+ const result = question.validate(value);
671
+ if (result === true)
672
+ return undefined;
673
+ return typeof result === 'string' ? result : 'Invalid value';
674
+ }
675
+ : undefined;
676
+ const choices = (question.choices ?? []).map((c) => typeof c === 'string' ? { value: c } : { value: c.name, label: c.message });
677
+ switch (question.type) {
678
+ case 'confirm':
679
+ return (0, prompt_helpers_1.confirmationPrompt)({
680
+ message: question.message,
681
+ initial: question.initial !== false,
682
+ });
683
+ case 'select':
684
+ return (0, prompt_helpers_1.selectPrompt)({
685
+ message: question.message,
686
+ choices,
687
+ initial: question.initial,
688
+ });
689
+ case 'multiselect':
690
+ return (0, prompt_helpers_1.multiselectPrompt)({
691
+ message: question.message,
692
+ choices,
693
+ initialValues: question.initial,
694
+ });
695
+ case 'numeral': {
696
+ // No numeric prompt; the answer is parsed back so callers still get a
697
+ // number rather than the typed string.
698
+ const answer = await (0, prompt_helpers_1.textPrompt)({
699
+ message: question.message,
700
+ initialValue: question.initial === undefined
701
+ ? undefined
702
+ : String(question.initial),
703
+ validate: (value) => value !== '' && !Number.isNaN(Number(value))
704
+ ? validate?.(value)
705
+ : 'Please enter a number',
706
+ });
707
+ return Number(answer);
708
+ }
709
+ default:
710
+ return (0, prompt_helpers_1.textPrompt)({
711
+ message: question.message,
712
+ initialValue: question.initial,
713
+ validate,
714
+ });
715
+ }
716
+ }
658
717
  }
659
718
  async function runMigration(root, packageName, migrationName, projects, isVerbose, projectGraph) {
660
719
  const logger = (0, exports.getLogger)(isVerbose);
@@ -29,3 +29,18 @@ export declare const nxMcpTomlHeader = "[mcp_servers.\"nx-mcp\"]";
29
29
  * For Nx < 22, uses 'nx-mcp'
30
30
  */
31
31
  export declare function getNxMcpTomlConfig(nxVersion: string): string;
32
+ /**
33
+ * The Nx runtime roots as they belong in a *committed* sandbox allowlist.
34
+ *
35
+ * `~/.nx` is the literal tilde rather than an expanded `NX_HOME_TMP_DIR`: the
36
+ * sandbox expands it per user, which is the property that makes the entry worth
37
+ * committing at all. An absolute home would pin the file to whoever ran the
38
+ * generator.
39
+ *
40
+ * Both are listed because socket resolution walks a chain — `/tmp/.nx` first,
41
+ * `~/.nx` when a peer already owns the shared container. Allowing only the first
42
+ * leaves every user on a machine where someone else got there first silently
43
+ * uncovered. Windows resolves `NX_TMP_DIR` to a machine-specific `%TMP%` and has
44
+ * no sandbox to configure, so the POSIX root is the one that belongs here.
45
+ */
46
+ export declare const NX_ALLOWLIST_ROOTS: readonly ["/tmp/.nx", '~/.nx'];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.nxMcpTomlHeader = exports.analyticsDomain = exports.getAgentRulesWrapped = exports.rulesRegex = exports.nxRulesMarkerCommentEnd = exports.nxRulesMarkerCommentDescription = exports.nxRulesMarkerCommentStart = void 0;
3
+ exports.NX_ALLOWLIST_ROOTS = exports.nxMcpTomlHeader = exports.analyticsDomain = exports.getAgentRulesWrapped = exports.rulesRegex = exports.nxRulesMarkerCommentEnd = exports.nxRulesMarkerCommentDescription = exports.nxRulesMarkerCommentStart = void 0;
4
4
  exports.agentsMdPath = agentsMdPath;
5
5
  exports.geminiMdPath = geminiMdPath;
6
6
  exports.parseGeminiSettings = parseGeminiSettings;
@@ -13,6 +13,7 @@ exports.getNxMcpTomlConfig = getNxMcpTomlConfig;
13
13
  const path_1 = require("path");
14
14
  const semver_1 = require("semver");
15
15
  const fileutils_1 = require("../utils/fileutils");
16
+ const nx_tmp_dir_1 = require("../utils/nx-tmp-dir");
16
17
  const get_agent_rules_1 = require("./set-up-ai-agents/get-agent-rules");
17
18
  function agentsMdPath(root) {
18
19
  return (0, path_1.join)(root, 'AGENTS.md');
@@ -74,3 +75,18 @@ command = "npx"
74
75
  args = ${args}
75
76
  `;
76
77
  }
78
+ /**
79
+ * The Nx runtime roots as they belong in a *committed* sandbox allowlist.
80
+ *
81
+ * `~/.nx` is the literal tilde rather than an expanded `NX_HOME_TMP_DIR`: the
82
+ * sandbox expands it per user, which is the property that makes the entry worth
83
+ * committing at all. An absolute home would pin the file to whoever ran the
84
+ * generator.
85
+ *
86
+ * Both are listed because socket resolution walks a chain — `/tmp/.nx` first,
87
+ * `~/.nx` when a peer already owns the shared container. Allowing only the first
88
+ * leaves every user on a machine where someone else got there first silently
89
+ * uncovered. Windows resolves `NX_TMP_DIR` to a machine-specific `%TMP%` and has
90
+ * no sandbox to configure, so the POSIX root is the one that belongs here.
91
+ */
92
+ exports.NX_ALLOWLIST_ROOTS = [nx_tmp_dir_1.NX_TMP_DIR_POSIX, '~/.nx'];
@@ -7,9 +7,11 @@ const fs_1 = require("fs");
7
7
  const path_1 = require("path");
8
8
  const semver_1 = require("semver");
9
9
  const smol_toml_1 = tslib_1.__importDefault(require("smol-toml"));
10
- const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
10
+ const format_changed_files_1 = require("../../generators/internal-utils/format-changed-files");
11
11
  const generate_files_1 = require("../../generators/utils/generate-files");
12
12
  const json_1 = require("../../generators/utils/json");
13
+ const nx_json_1 = require("../../generators/utils/nx-json");
14
+ const analytics_enabled_1 = require("../../utils/analytics-enabled");
13
15
  const native_1 = require("../../native");
14
16
  const package_json_1 = require("../../utils/package-json");
15
17
  const package_manager_1 = require("../../utils/package-manager");
@@ -71,6 +73,8 @@ function normalizeOptions(options) {
71
73
  async function setupAiAgentsGeneratorImpl(tree, options) {
72
74
  const hasAgent = (agent) => options.agents.includes(agent);
73
75
  const nxVersion = (0, installed_nx_version_1.getInstalledNxVersion)() ?? getDeclaredNxVersionOrDefault();
76
+ const analyticsEnabled = (0, analytics_enabled_1.isAnalyticsEnabled)((0, nx_json_1.readNxJson)(tree));
77
+ let addedAnalyticsDomain = false;
74
78
  const agentsMd = (0, constants_1.agentsMdPath)(options.directory);
75
79
  // write AGENTS.md for most agents
76
80
  if (hasAgent('cursor') ||
@@ -87,6 +91,9 @@ async function setupAiAgentsGeneratorImpl(tree, options) {
87
91
  if (!tree.exists(claudeSettingsPath)) {
88
92
  (0, json_1.writeJson)(tree, claudeSettingsPath, {});
89
93
  }
94
+ const allowedDomains = (0, json_1.readJson)(tree, claudeSettingsPath).sandbox?.network?.allowedDomains;
95
+ addedAnalyticsDomain =
96
+ analyticsEnabled && !allowedDomains?.includes(constants_1.analyticsDomain);
90
97
  (0, json_1.updateJson)(tree, claudeSettingsPath, (json) => ({
91
98
  ...json,
92
99
  extraKnownMarketplaces: {
@@ -103,17 +110,41 @@ async function setupAiAgentsGeneratorImpl(tree, options) {
103
110
  ...json.enabledPlugins,
104
111
  'nx@nx-claude-plugins': true,
105
112
  },
106
- // Allow Nx analytics requests through Claude Code's sandbox network filter
113
+ // Allow Nx unix socket usage (daemon, plugin workers, forked processes)
114
+ // through Claude Code's sandbox, and analytics requests when the
115
+ // workspace has them on. Nx also copies its native binary into a cache
116
+ // under the same fixed tmp root before loading it, so the read/write
117
+ // grants cover that too. The root is a fixed /tmp path on macOS and
118
+ // Linux, so these entries are machine-independent and safe to commit.
107
119
  sandbox: {
108
120
  ...json.sandbox,
121
+ filesystem: {
122
+ ...json.sandbox?.filesystem,
123
+ allowRead: withEntries(json.sandbox?.filesystem?.allowRead, ...constants_1.NX_ALLOWLIST_ROOTS),
124
+ // Covers the whole tmp root, not just the socket dir: the native
125
+ // binary cache lives under it too, and without the cache a running
126
+ // daemon keeps an open handle on the binding inside node_modules,
127
+ // which blocks reinstalling or rebuilding dependencies. What keeps
128
+ // users apart is not this allowlist but the 0700 per-uid directories
129
+ // Nx verifies on every use (see ensureOwnedPrivateDir).
130
+ allowWrite: withEntries(json.sandbox?.filesystem?.allowWrite, ...constants_1.NX_ALLOWLIST_ROOTS),
131
+ },
109
132
  network: {
110
133
  ...json.sandbox?.network,
111
- allowedDomains: json.sandbox?.network?.allowedDomains?.includes(constants_1.analyticsDomain)
112
- ? json.sandbox.network.allowedDomains
113
- : [
114
- ...(json.sandbox?.network?.allowedDomains ?? []),
115
- constants_1.analyticsDomain,
116
- ],
134
+ // Egress follows the workspace's analytics opt-in (#36663). The
135
+ // socket grant does not: Nx needs its sockets either way.
136
+ ...(analyticsEnabled
137
+ ? {
138
+ allowedDomains: withEntries(json.sandbox?.network?.allowedDomains, constants_1.analyticsDomain),
139
+ }
140
+ : {}),
141
+ // Covers binding as well as connecting, so a fresh daemon, a plugin
142
+ // worker and a forked task can each create their own socket under
143
+ // these roots. Deliberately scoped rather than `allowAllUnixSockets`,
144
+ // which grants connect access to every socket on the machine —
145
+ // including the Docker and SSH-agent sockets — and grants nothing
146
+ // extra for creating Nx's own.
147
+ allowUnixSockets: withEntries(json.sandbox?.network?.allowUnixSockets, ...constants_1.NX_ALLOWLIST_ROOTS),
117
148
  },
118
149
  },
119
150
  }));
@@ -234,11 +265,20 @@ async function setupAiAgentsGeneratorImpl(tree, options) {
234
265
  (0, ignore_1.addEntryToGitIgnore)(tree, (0, path_1.join)(options.directory, '.gitignore'), '.nx/polygraph');
235
266
  (0, ignore_1.addEntryToGitIgnore)(tree, (0, path_1.join)(options.directory, '.gitignore'), '.claude/worktrees');
236
267
  (0, ignore_1.addEntryToGitIgnore)(tree, (0, path_1.join)(options.directory, '.gitignore'), '.claude/settings.local.json');
237
- await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree);
268
+ await (0, format_changed_files_1.formatChangedFiles)(tree);
238
269
  // we use the check variable to determine if we should actually make changes or just report what would be changed
239
270
  return async (check = false) => {
240
271
  const messages = [];
241
272
  const errors = [];
273
+ if (addedAnalyticsDomain) {
274
+ messages.push({
275
+ title: `Allowed ${constants_1.analyticsDomain} through Claude Code's sandbox network filter`,
276
+ bodyLines: [
277
+ `Nx sends analytics there because this workspace sets "analytics": true in nx.json.`,
278
+ `Set it to false to opt out, then remove the domain from .claude/settings.json.`,
279
+ ],
280
+ });
281
+ }
242
282
  if (hasAgent('copilot')) {
243
283
  try {
244
284
  if ((await (0, native_1.isEditorInstalled)(0 /* SupportedEditor.VSCode */)) &&
@@ -300,6 +340,14 @@ async function setupAiAgentsGeneratorImpl(tree, options) {
300
340
  };
301
341
  };
302
342
  }
343
+ /**
344
+ * The user's existing entries in their original order, plus any of `values`
345
+ * they do not already have. A Set does the deduping, so re-running the
346
+ * generator is a no-op rather than a growing list.
347
+ */
348
+ function withEntries(existing, ...values) {
349
+ return [...new Set([...(existing ?? []), ...values])];
350
+ }
303
351
  function writeAgentRules(tree, path, writeNxCloudRules) {
304
352
  if (!tree.exists(path)) {
305
353
  // File doesn't exist - create with h1 header (standalone content)
@@ -18,3 +18,16 @@ export declare function getAgentConfigurations(agentsToConsider: Agent[], worksp
18
18
  disabledAgents: AgentConfiguration[];
19
19
  }>;
20
20
  export declare function configureAgents(agents: Agent[], workspaceRoot: string, useLatest?: boolean): Promise<void>;
21
+ /**
22
+ * Explains a permission error thrown while writing agent configuration files.
23
+ *
24
+ * The errno alone does not identify the cause. Agent harnesses (e.g. Claude
25
+ * Code) deny writes to their own settings files from sandboxed shell commands,
26
+ * so `nx configure-ai-agents` run through an agent's bash tool fails with EPERM
27
+ * where the same command succeeds in a terminal — but a root-owned
28
+ * `.claude/settings.json` left by an earlier `sudo nx`, or a read-only
29
+ * checkout, produces the same errno with an unrelated remedy. The sandbox
30
+ * explanation is therefore only offered where a sandbox or an agent is
31
+ * actually detected, and the underlying message is kept either way.
32
+ */
33
+ export declare function agentConfigWriteBlockedLines(error: unknown): string[];
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.agentDisplayMap = exports.supportedAgents = void 0;
4
4
  exports.getAgentConfigurations = getAgentConfigurations;
5
5
  exports.configureAgents = configureAgents;
6
+ exports.agentConfigWriteBlockedLines = agentConfigWriteBlockedLines;
6
7
  const tslib_1 = require("tslib");
7
8
  const fs_1 = require("fs");
8
9
  const path_1 = require("path");
@@ -10,6 +11,7 @@ const configuration_1 = require("../config/configuration");
10
11
  const tree_1 = require("../generators/tree");
11
12
  const native_1 = require("../native");
12
13
  const fileutils_1 = require("../utils/fileutils");
14
+ const is_sandbox_1 = require("../utils/is-sandbox");
13
15
  const nx_cloud_utils_1 = require("../utils/nx-cloud-utils");
14
16
  const output_1 = require("../utils/output");
15
17
  const constants_1 = require("./constants");
@@ -215,3 +217,30 @@ async function configureAgents(agents, workspaceRoot, useLatest) {
215
217
  modificationResults.messages.forEach((message) => output_1.output.log(message));
216
218
  modificationResults.errors.forEach((error) => output_1.output.error(error));
217
219
  }
220
+ /**
221
+ * Explains a permission error thrown while writing agent configuration files.
222
+ *
223
+ * The errno alone does not identify the cause. Agent harnesses (e.g. Claude
224
+ * Code) deny writes to their own settings files from sandboxed shell commands,
225
+ * so `nx configure-ai-agents` run through an agent's bash tool fails with EPERM
226
+ * where the same command succeeds in a terminal — but a root-owned
227
+ * `.claude/settings.json` left by an earlier `sudo nx`, or a read-only
228
+ * checkout, produces the same errno with an unrelated remedy. The sandbox
229
+ * explanation is therefore only offered where a sandbox or an agent is
230
+ * actually detected, and the underlying message is kept either way.
231
+ */
232
+ function agentConfigWriteBlockedLines(error) {
233
+ const err = error;
234
+ const target = err?.path ?? 'an agent configuration file';
235
+ return [
236
+ `Writing ${target} failed: ${err?.message ?? 'permission denied'}`,
237
+ ...((0, is_sandbox_1.isSandbox)() || (0, native_1.isAiAgent)()
238
+ ? [
239
+ "Agent sandboxes protect their own settings files from writes made by sandboxed shell commands, so this command cannot finish when run through an agent's bash tool.",
240
+ 'To complete the AI agent setup, run `nx configure-ai-agents` from a regular terminal and relaunch the agent harness.',
241
+ ]
242
+ : [
243
+ 'Check the ownership and mode of that path: an earlier `sudo nx` run or a read-only checkout produces this.',
244
+ ]),
245
+ ];
246
+ }
@@ -10,6 +10,7 @@ exports.argsToQueryString = argsToQueryString;
10
10
  exports.flushAnalytics = flushAnalytics;
11
11
  const tslib_1 = require("tslib");
12
12
  const nx_json_1 = require("../config/nx-json");
13
+ const analytics_enabled_1 = require("../utils/analytics-enabled");
13
14
  const workspace_root_1 = require("../utils/workspace-root");
14
15
  const versions_1 = require("../utils/versions");
15
16
  const native_1 = require("../native");
@@ -59,7 +60,7 @@ async function startAnalytics() {
59
60
  // on any failure, continue without telemetry.
60
61
  try {
61
62
  const nxJson = (0, nx_json_1.readNxJson)(workspace_root_1.workspaceRoot);
62
- if (!isAnalyticsEnabled(nxJson)) {
63
+ if (!(0, analytics_enabled_1.isAnalyticsEnabled)(nxJson)) {
63
64
  return;
64
65
  }
65
66
  const workspaceId = (0, workspace_id_1.generateWorkspaceId)(workspace_root_1.workspaceRoot, nxJson);
@@ -235,9 +236,6 @@ function getPackageManagerInfo() {
235
236
  version: (0, package_manager_1.getPackageManagerVersion)(pm),
236
237
  };
237
238
  }
238
- function isAnalyticsEnabled(nxJson) {
239
- return nxJson?.analytics === true;
240
- }
241
239
  // Mix workspace id in: shared Docker images (Gitpod, Cypress, etc.) bake
242
240
  // in /etc/machine-id, so machine-id alone collapses many users into one.
243
241
  async function getTelemetryUserId(workspaceId) {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.yargsCompletionCommand = void 0;
4
- const enquirer_1 = require("enquirer");
4
+ const prompt_helpers_1 = require("../../utils/prompt-helpers");
5
5
  const fs_1 = require("fs");
6
6
  const os_1 = require("os");
7
7
  const path_1 = require("path");
@@ -69,18 +69,13 @@ async function pickShellsInteractively() {
69
69
  process.exit(1);
70
70
  }
71
71
  const detected = detectAvailableShells();
72
- const answer = (await (0, enquirer_1.prompt)({
73
- type: 'multiselect',
74
- name: 'shells',
72
+ return await (0, prompt_helpers_1.multiselectPrompt)({
75
73
  message: 'Install nx completion for which shell(s)?',
76
- choices: SHELL_CHOICES.map((name) => ({
77
- name,
78
- value: name,
79
- // Pre-check shells we can detect on this machine.
80
- enabled: detected.has(name),
81
- })),
82
- }));
83
- return answer.shells ?? [];
74
+ choices: SHELL_CHOICES,
75
+ // Pre-select shells we can detect on this machine.
76
+ initialValues: SHELL_CHOICES.filter((name) => detected.has(name)),
77
+ onCancel: () => [],
78
+ });
84
79
  }
85
80
  /** Best-effort detect-which-shells-the-user-has. Pre-checks the multiselect.
86
81
  * Signals: $SHELL basename, presence of conventional rc files, $PSModulePath
@@ -3,13 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.configureAiAgentsHandler = configureAiAgentsHandler;
4
4
  exports.configureAiAgentsHandlerImpl = configureAiAgentsHandlerImpl;
5
5
  const tslib_1 = require("tslib");
6
- const enquirer_1 = require("enquirer");
6
+ const prompt_helpers_1 = require("../../utils/prompt-helpers");
7
7
  const node_fs_1 = require("node:fs");
8
8
  const node_path_1 = require("node:path");
9
9
  const pc = tslib_1.__importStar(require("picocolors"));
10
10
  const constants_1 = require("../../ai/constants");
11
11
  const detect_ai_agent_1 = require("../../ai/detect-ai-agent");
12
12
  const utils_1 = require("../../ai/utils");
13
+ const permission_errors_1 = require("../../utils/permission-errors");
13
14
  const client_1 = require("../../daemon/client/client");
14
15
  const package_json_1 = require("../../utils/package-json");
15
16
  const output_1 = require("../../utils/output");
@@ -63,8 +64,10 @@ async function configureAiAgentsHandler(args, inner = false) {
63
64
  await resetDaemonAgentStatus();
64
65
  }
65
66
  async function configureAiAgentsHandlerImpl(options) {
66
- // Node 24 has stricter readline behavior, and enquirer is not checking for closed state
67
- // when invoking operations, thus you get an ERR_USE_AFTER_CLOSE error.
67
+ // Node 24's stricter readline throws ERR_USE_AFTER_CLOSE when a prompt
68
+ // library operates on a closed interface. Added for enquirer, which nx no
69
+ // longer uses; verify against Node 24 before removing.
70
+ // TODO(v24): drop if @clack/prompts proves not to need it.
68
71
  process.on('uncaughtException', (error) => {
69
72
  if (error &&
70
73
  typeof error === 'object' &&
@@ -158,7 +161,7 @@ async function configureAiAgentsHandlerImpl(options) {
158
161
  ...partiallyConfiguredAgents,
159
162
  ...outOfDateAgents,
160
163
  ...nonConfiguredAgents,
161
- ].map((a) => getAgentChoiceForPrompt(a).message),
164
+ ].map((a) => getAgentChoiceForPrompt(a).label),
162
165
  });
163
166
  process.exit(1);
164
167
  }
@@ -212,10 +215,18 @@ async function configureAiAgentsHandlerImpl(options) {
212
215
  }
213
216
  catch (e) {
214
217
  configSpinner.fail('Failed to configure AI agents');
215
- output_1.output.error({
216
- title: 'Error details:',
217
- bodyLines: [e.message],
218
- });
218
+ if ((0, permission_errors_1.isPermissionDenied)(e)) {
219
+ output_1.output.error({
220
+ title: 'Nx was not permitted to write the AI agent configuration',
221
+ bodyLines: (0, utils_1.agentConfigWriteBlockedLines)(e),
222
+ });
223
+ }
224
+ else {
225
+ output_1.output.error({
226
+ title: 'Error details:',
227
+ bodyLines: [e.message],
228
+ });
229
+ }
219
230
  process.exit(1);
220
231
  }
221
232
  }
@@ -239,26 +250,22 @@ async function configureAiAgentsHandlerImpl(options) {
239
250
  }
240
251
  // Interactive mode (or non-interactive with explicit --agents)
241
252
  const allAgentChoices = [];
242
- const preselectedIndices = [];
243
- let currentIndex = 0;
253
+ const preselectedAgents = [];
244
254
  // Partially configured agents first (highest priority)
245
255
  partiallyConfiguredAgents.forEach((a) => {
246
256
  allAgentChoices.push(getAgentChoiceForPrompt(a));
247
- preselectedIndices.push(currentIndex);
248
- currentIndex++;
257
+ preselectedAgents.push(a.name);
249
258
  });
250
259
  // Outdated agents second
251
260
  for (const a of fullyConfiguredAgents) {
252
261
  if (a.outdated) {
253
262
  allAgentChoices.push(getAgentChoiceForPrompt(a));
254
- preselectedIndices.push(currentIndex);
255
- currentIndex++;
263
+ preselectedAgents.push(a.name);
256
264
  }
257
265
  }
258
266
  // Non-configured agents last
259
267
  nonConfiguredAgents.forEach((a) => {
260
268
  allAgentChoices.push(getAgentChoiceForPrompt(a));
261
- currentIndex++;
262
269
  });
263
270
  if (allAgentChoices.length === 0) {
264
271
  output_1.output.success({
@@ -270,18 +277,13 @@ async function configureAiAgentsHandlerImpl(options) {
270
277
  let selectedAgents;
271
278
  if (options.interactive !== false) {
272
279
  try {
273
- selectedAgents = (await (0, enquirer_1.prompt)({
274
- type: 'multiselect',
275
- name: 'agents',
280
+ selectedAgents = await (0, prompt_helpers_1.multiselectPrompt)({
276
281
  message: 'Which AI agents would you like to configure? (space to select, enter to confirm)',
277
282
  choices: allAgentChoices,
278
- initial: preselectedIndices,
283
+ initialValues: preselectedAgents,
279
284
  required: true,
280
- footer: function () {
281
- const focused = this.focused;
282
- return pc.dim(` ${getAgentFooterDescription(focused.agentConfiguration)}`);
283
- },
284
- })).agents;
285
+ onCancel: () => process.exit(1),
286
+ });
285
287
  }
286
288
  catch {
287
289
  process.exit(1);
@@ -289,7 +291,7 @@ async function configureAiAgentsHandlerImpl(options) {
289
291
  }
290
292
  else {
291
293
  // non-interactive with explicit --agents: configure all requested
292
- selectedAgents = allAgentChoices.map((a) => a.name);
294
+ selectedAgents = allAgentChoices.map((a) => a.value);
293
295
  }
294
296
  if (selectedAgents?.length === 0) {
295
297
  output_1.output.log({
@@ -317,10 +319,18 @@ async function configureAiAgentsHandlerImpl(options) {
317
319
  }
318
320
  catch (e) {
319
321
  configSpinner.fail('Failed to set up AI agents');
320
- output_1.output.error({
321
- title: 'Error details:',
322
- bodyLines: [e.message],
323
- });
322
+ if ((0, permission_errors_1.isPermissionDenied)(e)) {
323
+ output_1.output.error({
324
+ title: 'Nx was not permitted to write the AI agent configuration',
325
+ bodyLines: (0, utils_1.agentConfigWriteBlockedLines)(e),
326
+ });
327
+ }
328
+ else {
329
+ output_1.output.error({
330
+ title: 'Error details:',
331
+ bodyLines: [e.message],
332
+ });
333
+ }
324
334
  process.exit(1);
325
335
  }
326
336
  }
@@ -388,10 +398,11 @@ function getAgentChoiceForPrompt(agent) {
388
398
  const partiallyConfigured = agent.mcp !== agent.rules;
389
399
  const needsUpdate = partiallyConfigured || agent.outdated;
390
400
  return {
391
- name: agent.name,
392
- message: needsUpdate
401
+ value: agent.name,
402
+ label: needsUpdate
393
403
  ? `${agent.displayName} (update available)`
394
404
  : agent.displayName,
405
+ hint: getAgentFooterDescription(agent),
395
406
  agentConfiguration: agent,
396
407
  };
397
408
  }