nx 23.0.0-beta.2 → 23.0.0-beta.21

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 (274) hide show
  1. package/dist/bin/init-local.js +11 -20
  2. package/dist/bin/nx.d.ts +1 -0
  3. package/dist/bin/nx.js +28 -2
  4. package/dist/plugins/package-json.js +4 -2
  5. package/dist/src/adapter/ngcli-adapter.d.ts +2 -1
  6. package/dist/src/adapter/ngcli-adapter.js +25 -2
  7. package/dist/src/ai/clone-ai-config-repo.js +20 -3
  8. package/dist/src/analytics/analytics.js +10 -1
  9. package/dist/src/command-line/add/completion.d.ts +1 -0
  10. package/dist/src/command-line/add/completion.js +15 -0
  11. package/dist/src/command-line/affected/completion.d.ts +1 -0
  12. package/dist/src/command-line/affected/completion.js +15 -0
  13. package/dist/src/command-line/completion/argv-layout.d.ts +6 -0
  14. package/dist/src/command-line/completion/argv-layout.js +19 -0
  15. package/dist/src/command-line/completion/command-completions.d.ts +19 -0
  16. package/dist/src/command-line/completion/command-completions.js +120 -0
  17. package/dist/src/command-line/completion/command-handlers.d.ts +30 -0
  18. package/dist/src/command-line/completion/command-handlers.js +69 -0
  19. package/dist/src/command-line/completion/command-object.d.ts +10 -0
  20. package/dist/src/command-line/completion/command-object.js +95 -0
  21. package/dist/src/command-line/completion/completion-providers.d.ts +21 -0
  22. package/dist/src/command-line/completion/completion-providers.js +194 -0
  23. package/dist/src/command-line/completion/infix-targets.d.ts +1 -0
  24. package/dist/src/command-line/completion/infix-targets.js +48 -0
  25. package/dist/src/command-line/completion/metadata.d.ts +22 -0
  26. package/dist/src/command-line/completion/metadata.js +71 -0
  27. package/dist/src/command-line/completion/registrations.d.ts +9 -0
  28. package/dist/src/command-line/completion/registrations.js +16 -0
  29. package/dist/src/command-line/completion/scripts/bash.sh +51 -0
  30. package/dist/src/command-line/completion/scripts/fish.fish +47 -0
  31. package/dist/src/command-line/completion/scripts/powershell.ps1 +52 -0
  32. package/dist/src/command-line/completion/scripts/zsh.zsh +69 -0
  33. package/dist/src/command-line/completion/scripts.d.ts +18 -0
  34. package/dist/src/command-line/completion/scripts.js +140 -0
  35. package/dist/src/command-line/completion/trigger.d.ts +3 -0
  36. package/dist/src/command-line/completion/trigger.js +21 -0
  37. package/dist/src/command-line/completion/value-completions.d.ts +3 -0
  38. package/dist/src/command-line/completion/value-completions.js +21 -0
  39. package/dist/src/command-line/examples.js +1 -1
  40. package/dist/src/command-line/format/format.js +15 -5
  41. package/dist/src/command-line/generate/completion.d.ts +1 -0
  42. package/dist/src/command-line/generate/completion.js +9 -0
  43. package/dist/src/command-line/graph/completion.d.ts +1 -0
  44. package/dist/src/command-line/graph/completion.js +13 -0
  45. package/dist/src/command-line/init/implementation/angular/standalone-workspace.js +14 -18
  46. package/dist/src/command-line/init/implementation/dot-nx/add-nx-scripts.js +1 -0
  47. package/dist/src/command-line/init/implementation/utils.d.ts +7 -1
  48. package/dist/src/command-line/init/implementation/utils.js +51 -14
  49. package/dist/src/command-line/migrate/agentic/capture-generator-output.d.ts +22 -0
  50. package/dist/src/command-line/migrate/agentic/capture-generator-output.js +100 -0
  51. package/dist/src/command-line/migrate/agentic/cli-args.d.ts +12 -0
  52. package/dist/src/command-line/migrate/agentic/cli-args.js +38 -0
  53. package/dist/src/command-line/migrate/agentic/definitions.d.ts +6 -0
  54. package/dist/src/command-line/migrate/agentic/definitions.js +98 -0
  55. package/dist/src/command-line/migrate/agentic/detect-installed.d.ts +10 -0
  56. package/dist/src/command-line/migrate/agentic/detect-installed.js +68 -0
  57. package/dist/src/command-line/migrate/agentic/handoff-gitignore.d.ts +46 -0
  58. package/dist/src/command-line/migrate/agentic/handoff-gitignore.js +87 -0
  59. package/dist/src/command-line/migrate/agentic/handoff.d.ts +63 -0
  60. package/dist/src/command-line/migrate/agentic/handoff.js +183 -0
  61. package/dist/src/command-line/migrate/agentic/inception.d.ts +9 -0
  62. package/dist/src/command-line/migrate/agentic/inception.js +15 -0
  63. package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.d.ts +22 -0
  64. package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.js +50 -0
  65. package/dist/src/command-line/migrate/agentic/prompts/generic-validation.d.ts +51 -0
  66. package/dist/src/command-line/migrate/agentic/prompts/generic-validation.js +65 -0
  67. package/dist/src/command-line/migrate/agentic/prompts/hybrid-prompt-migration.d.ts +44 -0
  68. package/dist/src/command-line/migrate/agentic/prompts/hybrid-prompt-migration.js +52 -0
  69. package/dist/src/command-line/migrate/agentic/prompts/prompt-migration.d.ts +21 -0
  70. package/dist/src/command-line/migrate/agentic/prompts/prompt-migration.js +26 -0
  71. package/dist/src/command-line/migrate/agentic/prompts/shared-rendering.d.ts +18 -0
  72. package/dist/src/command-line/migrate/agentic/prompts/shared-rendering.js +130 -0
  73. package/dist/src/command-line/migrate/agentic/prompts/system-prompt.d.ts +46 -0
  74. package/dist/src/command-line/migrate/agentic/prompts/system-prompt.js +88 -0
  75. package/dist/src/command-line/migrate/agentic/run-step.d.ts +51 -0
  76. package/dist/src/command-line/migrate/agentic/run-step.js +121 -0
  77. package/dist/src/command-line/migrate/agentic/runner.d.ts +33 -0
  78. package/dist/src/command-line/migrate/agentic/runner.js +442 -0
  79. package/dist/src/command-line/migrate/agentic/select.d.ts +14 -0
  80. package/dist/src/command-line/migrate/agentic/select.js +150 -0
  81. package/dist/src/command-line/migrate/agentic/types.d.ts +102 -0
  82. package/dist/src/command-line/migrate/agentic/types.js +2 -0
  83. package/dist/src/command-line/migrate/command-object.d.ts +1 -0
  84. package/dist/src/command-line/migrate/command-object.js +32 -7
  85. package/dist/src/command-line/migrate/migrate-commits.d.ts +50 -0
  86. package/dist/src/command-line/migrate/migrate-commits.js +102 -0
  87. package/dist/src/command-line/migrate/migrate-output.d.ts +180 -0
  88. package/dist/src/command-line/migrate/migrate-output.js +258 -0
  89. package/dist/src/command-line/migrate/migrate.d.ts +122 -12
  90. package/dist/src/command-line/migrate/migrate.js +1036 -217
  91. package/dist/src/command-line/migrate/migration-shape.d.ts +8 -0
  92. package/dist/src/command-line/migrate/migration-shape.js +13 -0
  93. package/dist/src/command-line/migrate/multi-major.d.ts +30 -0
  94. package/dist/src/command-line/migrate/multi-major.js +185 -0
  95. package/dist/src/command-line/migrate/prompt-files.d.ts +31 -0
  96. package/dist/src/command-line/migrate/prompt-files.js +141 -0
  97. package/dist/src/command-line/migrate/run-migration-process.js +28 -6
  98. package/dist/src/command-line/migrate/safe-prompt.d.ts +28 -0
  99. package/dist/src/command-line/migrate/safe-prompt.js +49 -0
  100. package/dist/src/command-line/migrate/update-filters.d.ts +11 -0
  101. package/dist/src/command-line/migrate/update-filters.js +44 -0
  102. package/dist/src/command-line/migrate/version-utils.d.ts +6 -0
  103. package/dist/src/command-line/migrate/version-utils.js +59 -0
  104. package/dist/src/command-line/nx-commands.js +9 -0
  105. package/dist/src/command-line/release/config/config.d.ts +3 -6
  106. package/dist/src/command-line/release/config/config.js +77 -45
  107. package/dist/src/command-line/release/config/use-legacy-versioning.d.ts +2 -0
  108. package/dist/src/command-line/release/config/use-legacy-versioning.js +8 -0
  109. package/dist/src/command-line/release/utils/release-graph.js +2 -3
  110. package/dist/src/command-line/release/utils/repository-git-tags.js +1 -1
  111. package/dist/src/command-line/release/utils/resolve-changelog-renderer.js +7 -19
  112. package/dist/src/command-line/release/version/resolve-current-version.js +1 -1
  113. package/dist/src/command-line/release/version/version-actions.js +3 -7
  114. package/dist/src/command-line/report/report.js +2 -2
  115. package/dist/src/command-line/run/completion.d.ts +1 -0
  116. package/dist/src/command-line/run/completion.js +7 -0
  117. package/dist/src/command-line/run-many/completion.d.ts +1 -0
  118. package/dist/src/command-line/run-many/completion.js +13 -0
  119. package/dist/src/command-line/show/completion.d.ts +1 -0
  120. package/dist/src/command-line/show/completion.js +27 -0
  121. package/dist/src/command-line/show/show-target/info.d.ts +1 -0
  122. package/dist/src/command-line/show/show-target/info.js +100 -19
  123. package/dist/src/command-line/watch/command-object.js +24 -4
  124. package/dist/src/command-line/watch/completion.d.ts +1 -0
  125. package/dist/src/command-line/watch/completion.js +10 -0
  126. package/dist/src/command-line/watch/watch.d.ts +7 -0
  127. package/dist/src/command-line/watch/watch.js +1 -1
  128. package/dist/src/config/misc-interfaces.d.ts +25 -2
  129. package/dist/src/config/nx-json.d.ts +43 -56
  130. package/dist/src/config/schema-utils.d.ts +21 -0
  131. package/dist/src/config/schema-utils.js +92 -18
  132. package/dist/src/config/task-graph.d.ts +4 -107
  133. package/dist/src/core/graph/main.js +1 -1
  134. package/dist/src/core/graph/styles.css +2 -3
  135. package/dist/src/core/graph/styles.js +1 -1
  136. package/dist/src/daemon/client/client.d.ts +1 -1
  137. package/dist/src/daemon/server/file-watching/file-watcher-sockets.d.ts +1 -1
  138. package/dist/src/daemon/server/file-watching/file-watcher-sockets.js +1 -1
  139. package/dist/src/daemon/server/file-watching/route-workspace-changes.d.ts +9 -0
  140. package/dist/src/daemon/server/file-watching/route-workspace-changes.js +76 -0
  141. package/dist/src/daemon/server/project-graph-incremental-recomputation.js +45 -11
  142. package/dist/src/daemon/server/server.js +4 -43
  143. package/dist/src/daemon/server/start.d.ts +1 -1
  144. package/dist/src/daemon/server/start.js +2 -0
  145. package/dist/src/devkit-exports.d.ts +2 -2
  146. package/dist/src/devkit-internals.d.ts +5 -1
  147. package/dist/src/devkit-internals.js +17 -1
  148. package/dist/src/executors/run-commands/running-tasks.d.ts +7 -0
  149. package/dist/src/executors/run-commands/running-tasks.js +178 -105
  150. package/dist/src/executors/run-script/run-script.impl.js +3 -10
  151. package/dist/src/executors/utils/convert-nx-executor.js +1 -1
  152. package/dist/src/hasher/hash-plan-inspector.d.ts +1 -1
  153. package/dist/src/hasher/task-hasher.js +6 -4
  154. package/dist/src/index.d.ts +1 -1
  155. package/dist/src/index.js +0 -3
  156. package/dist/src/migrations/update-16-2-0/remove-run-commands-output-path.js +6 -2
  157. package/dist/src/migrations/update-17-0-0/move-cache-directory.md +31 -0
  158. package/dist/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.js +20 -4
  159. package/dist/src/migrations/update-20-0-0/move-use-daemon-process.md +27 -0
  160. package/dist/src/migrations/update-20-0-1/use-legacy-cache.md +24 -0
  161. package/dist/src/migrations/update-21-0-0/release-changelog-config-changes.md +49 -0
  162. package/dist/src/migrations/update-21-0-0/release-version-config-changes.md +54 -0
  163. package/dist/src/migrations/update-21-0-0/remove-custom-tasks-runner.md +28 -0
  164. package/dist/src/migrations/update-21-0-0/remove-legacy-cache.md +22 -0
  165. package/dist/src/migrations/update-22-2-0/add-self-healing-to-gitignore.md +11 -0
  166. package/dist/src/migrations/update-23-0-0/add-migrate-runs-to-git-ignore.d.ts +2 -0
  167. package/dist/src/migrations/update-23-0-0/add-migrate-runs-to-git-ignore.js +16 -0
  168. package/dist/src/migrations/update-23-0-0/consolidate-release-tag-config.d.ts +9 -0
  169. package/dist/src/migrations/update-23-0-0/consolidate-release-tag-config.js +18 -0
  170. package/dist/src/migrations/update-23-0-0/convert-target-defaults-to-array.d.ts +35 -0
  171. package/dist/src/migrations/update-23-0-0/convert-target-defaults-to-array.js +139 -0
  172. package/dist/src/migrations/update-23-0-0/convert-target-defaults-to-array.md +66 -0
  173. package/dist/src/native/index.d.ts +79 -2
  174. package/dist/src/native/native-bindings.js +3 -0
  175. package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
  176. package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
  177. package/dist/src/plugins/js/lock-file/npm-parser.js +37 -19
  178. package/dist/src/plugins/js/lock-file/pnpm-parser.js +51 -4
  179. package/dist/src/plugins/js/lock-file/project-graph-pruning.js +12 -4
  180. package/dist/src/plugins/js/utils/packages.js +1 -1
  181. package/dist/src/plugins/js/utils/register.d.ts +103 -14
  182. package/dist/src/plugins/js/utils/register.js +434 -39
  183. package/dist/src/plugins/js/utils/typescript.d.ts +7 -0
  184. package/dist/src/plugins/js/utils/typescript.js +39 -0
  185. package/dist/src/plugins/package-json/create-nodes.d.ts +3 -2
  186. package/dist/src/plugins/package-json/create-nodes.js +7 -5
  187. package/dist/src/project-graph/affected/locators/project-glob-changes.js +2 -1
  188. package/dist/src/project-graph/build-project-graph.d.ts +5 -0
  189. package/dist/src/project-graph/build-project-graph.js +6 -2
  190. package/dist/src/project-graph/file-map-utils.d.ts +5 -0
  191. package/dist/src/project-graph/file-map-utils.js +10 -1
  192. package/dist/src/project-graph/plugins/get-plugins.d.ts +7 -2
  193. package/dist/src/project-graph/plugins/get-plugins.js +8 -5
  194. package/dist/src/project-graph/plugins/isolation/plugin-worker.d.ts +1 -0
  195. package/dist/src/project-graph/plugins/isolation/plugin-worker.js +2 -0
  196. package/dist/src/project-graph/plugins/resolve-plugin.d.ts +7 -4
  197. package/dist/src/project-graph/plugins/resolve-plugin.js +152 -33
  198. package/dist/src/project-graph/plugins/tasks-execution-hooks.js +4 -2
  199. package/dist/src/project-graph/plugins/transpiler.d.ts +12 -0
  200. package/dist/src/project-graph/plugins/transpiler.js +37 -0
  201. package/dist/src/project-graph/plugins/utils.js +13 -7
  202. package/dist/src/project-graph/project-graph.js +1 -1
  203. package/dist/src/project-graph/utils/project-configuration/target-defaults.d.ts +95 -4
  204. package/dist/src/project-graph/utils/project-configuration/target-defaults.js +515 -68
  205. package/dist/src/project-graph/utils/project-configuration-utils.d.ts +13 -5
  206. package/dist/src/project-graph/utils/project-configuration-utils.js +14 -6
  207. package/dist/src/project-graph/utils/retrieve-workspace-files.js +1 -1
  208. package/dist/src/tasks-runner/create-task-graph.d.ts +4 -4
  209. package/dist/src/tasks-runner/create-task-graph.js +1 -1
  210. package/dist/src/tasks-runner/default-tasks-runner.d.ts +0 -2
  211. package/dist/src/tasks-runner/forked-process-task-runner.d.ts +1 -1
  212. package/dist/src/tasks-runner/forked-process-task-runner.js +11 -6
  213. package/dist/src/tasks-runner/init-tasks-runner.d.ts +0 -15
  214. package/dist/src/tasks-runner/init-tasks-runner.js +0 -63
  215. package/dist/src/tasks-runner/legacy-depends-on-warning.d.ts +18 -0
  216. package/dist/src/tasks-runner/legacy-depends-on-warning.js +109 -0
  217. package/dist/src/tasks-runner/life-cycle.d.ts +7 -8
  218. package/dist/src/tasks-runner/life-cycles/invoke-runner-terminal-output-life-cycle.js +6 -6
  219. package/dist/src/tasks-runner/life-cycles/task-history-life-cycle-old.js +13 -2
  220. package/dist/src/tasks-runner/life-cycles/task-history-life-cycle.js +16 -5
  221. package/dist/src/tasks-runner/life-cycles/tui-summary-life-cycle.js +11 -2
  222. package/dist/src/tasks-runner/pseudo-terminal.d.ts +1 -1
  223. package/dist/src/tasks-runner/pseudo-terminal.js +22 -10
  224. package/dist/src/tasks-runner/run-command.js +8 -11
  225. package/dist/src/tasks-runner/running-tasks/batch-process.d.ts +1 -1
  226. package/dist/src/tasks-runner/running-tasks/batch-process.js +3 -5
  227. package/dist/src/tasks-runner/running-tasks/node-child-process.d.ts +2 -2
  228. package/dist/src/tasks-runner/running-tasks/node-child-process.js +5 -7
  229. package/dist/src/tasks-runner/task-env.d.ts +1 -1
  230. package/dist/src/tasks-runner/task-env.js +6 -1
  231. package/dist/src/tasks-runner/task-orchestrator.d.ts +11 -1
  232. package/dist/src/tasks-runner/task-orchestrator.js +112 -38
  233. package/dist/src/tasks-runner/tasks-schedule.js +3 -3
  234. package/dist/src/tasks-runner/utils.d.ts +7 -8
  235. package/dist/src/tasks-runner/utils.js +23 -27
  236. package/dist/src/utils/child-process.js +2 -2
  237. package/dist/src/utils/compile-cache.d.ts +24 -0
  238. package/dist/src/utils/compile-cache.js +49 -0
  239. package/dist/src/utils/enable-compile-cache.d.ts +1 -0
  240. package/dist/src/utils/enable-compile-cache.js +7 -0
  241. package/dist/src/utils/fileutils.d.ts +0 -8
  242. package/dist/src/utils/fileutils.js +0 -40
  243. package/dist/src/utils/git-utils.d.ts +15 -0
  244. package/dist/src/utils/git-utils.js +138 -0
  245. package/dist/src/utils/handle-import.d.ts +4 -1
  246. package/dist/src/utils/handle-import.js +56 -2
  247. package/dist/src/utils/has-nx-js-plugin.d.ts +9 -0
  248. package/dist/src/utils/has-nx-js-plugin.js +24 -0
  249. package/dist/src/utils/installed-nx-version.d.ts +14 -4
  250. package/dist/src/utils/installed-nx-version.js +54 -7
  251. package/dist/src/utils/logger.d.ts +12 -1
  252. package/dist/src/utils/logger.js +57 -36
  253. package/dist/src/utils/nx-key.d.ts +0 -1
  254. package/dist/src/utils/nx-key.js +20 -23
  255. package/dist/src/utils/nx-package-group.d.ts +8 -0
  256. package/dist/src/utils/nx-package-group.js +15 -0
  257. package/dist/src/utils/output.d.ts +3 -2
  258. package/dist/src/utils/output.js +29 -28
  259. package/dist/src/utils/package-json.d.ts +14 -1
  260. package/dist/src/utils/package-json.js +20 -21
  261. package/dist/src/utils/perf-logging.js +3 -1
  262. package/dist/src/utils/plugin-cache-utils.d.ts +13 -4
  263. package/dist/src/utils/plugin-cache-utils.js +23 -13
  264. package/dist/src/utils/plugins/local-plugins.d.ts +18 -0
  265. package/dist/src/utils/plugins/local-plugins.js +30 -0
  266. package/dist/src/utils/tar.d.ts +8 -0
  267. package/dist/src/utils/tar.js +44 -0
  268. package/migrations.json +16 -0
  269. package/package.json +28 -28
  270. package/schemas/nx-schema.json +114 -80
  271. package/dist/src/plugins/js/project-graph/build-dependencies/strip-source-code.d.ts +0 -7
  272. package/dist/src/plugins/js/project-graph/build-dependencies/strip-source-code.js +0 -155
  273. package/dist/src/plugins/js/project-graph/build-dependencies/typescript-import-locator.d.ts +0 -16
  274. package/dist/src/plugins/js/project-graph/build-dependencies/typescript-import-locator.js +0 -121
@@ -0,0 +1,258 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resetSgrAfterAgent = resetSgrAfterAgent;
4
+ exports.logMigrationBoundary = logMigrationBoundary;
5
+ exports.logAgenticSuccessOutcome = logAgenticSuccessOutcome;
6
+ exports.countLandedCommits = countLandedCommits;
7
+ exports.retainedMigrations = retainedMigrations;
8
+ exports.logFailureRecap = logFailureRecap;
9
+ exports.buildTallyBodyLine = buildTallyBodyLine;
10
+ exports.buildRetainedAtSuccessBody = buildRetainedAtSuccessBody;
11
+ exports.buildDirectiveBlockBodyLines = buildDirectiveBlockBodyLines;
12
+ const tslib_1 = require("tslib");
13
+ const pc = tslib_1.__importStar(require("picocolors"));
14
+ const logger_1 = require("../../utils/logger");
15
+ const migration_shape_1 = require("./migration-shape");
16
+ /**
17
+ * Presentation layer for `nx migrate --run-migrations`. Pure helpers — every
18
+ * function maps (state) → (terminal output or string lines). Shared visual
19
+ * vocabulary across the migrate run:
20
+ * `→` start · `✓` success · `✗` failure · `↷` skipped · `ℹ` info · `─` boundary
21
+ *
22
+ * Inputs are typed structurally (e.g. `{ name: string }[]`) so this module
23
+ * stays decoupled from `ExecutableMigration` and the executor in migrate.ts.
24
+ */
25
+ /**
26
+ * Some agent TUIs (codex, opencode) don't fully reset their cursor / SGR state
27
+ * when they exit, which corrupts subsequent orchestrator output. Emit an SGR
28
+ * reset + newline so our log lines land on a clean row instead of being
29
+ * overlaid by leftover status bars.
30
+ */
31
+ function resetSgrAfterAgent() {
32
+ process.stdout.write('\x1b[0m\n');
33
+ }
34
+ /**
35
+ * Per-migration boundary header. Anchors the orchestrator log at the start of
36
+ * each migration with the migration index and identity.
37
+ */
38
+ function logMigrationBoundary(index, total, pkg, name) {
39
+ const label = `── Migration ${index} of ${total} · ${pkg}:${name} `;
40
+ const targetWidth = 73;
41
+ const dashes = Math.max(3, targetWidth - label.length);
42
+ logger_1.logger.info(`${label}${'─'.repeat(dashes)}`);
43
+ }
44
+ /**
45
+ * Logs the outcome line that closes an agentic phase. Vocabulary:
46
+ * ✓ <label>[ (<sha>)]: <summary>
47
+ */
48
+ function logAgenticSuccessOutcome(label, sha, summary) {
49
+ const shaPart = sha ? ` (${sha})` : '';
50
+ logger_1.logger.info(`${pc.green('✓')} ${label}${shaPart}: ${summary}`);
51
+ }
52
+ /**
53
+ * Counts the migrations whose own commit actually landed — including the
54
+ * HEAD-resolve-race case (`commit: { kind: 'landed', sha: null }`). Used by
55
+ * the end-of-run "<K> commits created" tally and by the success-path
56
+ * accounting in `executeMigrations`. Counts landed-commit *records* rather
57
+ * than distinct shas; absorbed predecessors (`kind: 'absorbed'`) are not
58
+ * counted because the absorbing commit's record already contributes one.
59
+ */
60
+ function countLandedCommits(outcomes) {
61
+ return outcomes.filter((o) => o.commit.kind === 'landed').length;
62
+ }
63
+ /**
64
+ * Migrations whose own commit attempt failed and whose diff was never
65
+ * absorbed by a later commit. Surfaces what the user has to commit or
66
+ * revert after the run. Filters on `commit.kind === 'failed'` exactly —
67
+ * `'absorbed'` means the diff cleared into a later commit, `'none'` means
68
+ * no commit was attempted (intentional `--no-create-commits` or no-op).
69
+ */
70
+ function retainedMigrations(outcomes) {
71
+ return outcomes
72
+ .filter((o) => o.commit.kind === 'failed')
73
+ .map((o) => ({ package: o.migration.package, name: o.migration.name }));
74
+ }
75
+ /**
76
+ * Logs a structured recap when a migration throws mid-loop. Inserted between
77
+ * the "Failed to run X" error block and the re-throw so the user (or AI agent
78
+ * driving the run) can see what completed before the failure without scrolling
79
+ * back through the per-migration log to count shas.
80
+ *
81
+ * Counts-based rather than full migration lists so a 24-migration run that
82
+ * fails at #12 doesn't dump 24 names into the recap — readers scroll up to
83
+ * see specifics in the per-migration log. The "last applied" anchor pairs the
84
+ * most recent fully-applied migration with the sha its commit actually
85
+ * produced, so a skipped/deferred step trailing an applied one can't borrow
86
+ * the earlier sha.
87
+ */
88
+ function logFailureRecap(opts) {
89
+ const { migrationIndex, totalMigrations, outcomes, migrationEmittedNextSteps, insideAgent, } = opts;
90
+ const appliedCount = outcomes.filter((o) => o.status === 'completed' &&
91
+ (o.kind === 'applied' || o.kind === 'no-changes')).length;
92
+ const deferredCount = outcomes.filter((o) => o.status === 'completed' && o.kind === 'deferred').length;
93
+ const notAttempted = totalMigrations - migrationIndex;
94
+ // Walk back to the most recent completed record whose work is anchored to
95
+ // a sha — either its own commit (`landed`), or a later commit that
96
+ // absorbed it (`absorbed`). Both `applied` AND `deferred` outcomes can
97
+ // carry a successful commit (hybrid-without-agentic produces `deferred`
98
+ // with a sha from its deterministic half). Skipped and uncommitted
99
+ // records don't anchor.
100
+ let lastApplied;
101
+ for (let i = outcomes.length - 1; i >= 0; i--) {
102
+ const o = outcomes[i];
103
+ if (o.status !== 'completed')
104
+ continue;
105
+ if ((o.kind === 'applied' || o.kind === 'deferred') &&
106
+ (o.commit.kind === 'landed' || o.commit.kind === 'absorbed')) {
107
+ lastApplied = o;
108
+ break;
109
+ }
110
+ }
111
+ // Migrations whose own commit attempt errored AND whose diff was never
112
+ // absorbed by a later commit. Surfaces what the user has to inspect or
113
+ // clean up in the working tree. Single iteration over `outcomes` —
114
+ // `outcomes` is the sole source of truth (including the in-flight
115
+ // migration recorded by the executor's catch block), so no dedupe is
116
+ // needed. `kind: 'failed'` excludes `kind: 'none'` (intentional no-commit:
117
+ // `--no-create-commits` runs and no-op steps).
118
+ const uncommittedAtFailure = [];
119
+ for (const o of outcomes) {
120
+ if (o.commit.kind !== 'failed')
121
+ continue;
122
+ uncommittedAtFailure.push({ migration: o.migration });
123
+ }
124
+ logger_1.logger.info('');
125
+ logger_1.logger.info(`Run halted at migration ${migrationIndex} of ${totalMigrations}.`);
126
+ if (appliedCount === 0 && deferredCount === 0) {
127
+ logger_1.logger.info(`0 migrations completed. ${notAttempted} not attempted.`);
128
+ }
129
+ else {
130
+ const anchorSha = lastApplied === undefined
131
+ ? undefined
132
+ : lastApplied.commit.kind === 'landed'
133
+ ? lastApplied.commit.sha
134
+ : lastApplied.commit.kind === 'absorbed'
135
+ ? lastApplied.commit.into.sha
136
+ : undefined;
137
+ // When the anchoring commit hit a HEAD-resolve race, the sha is null;
138
+ // render the migration name alone (without "→ null") so the recap
139
+ // never displays the literal word "null" to the user.
140
+ const anchor = lastApplied
141
+ ? anchorSha
142
+ ? ` (last: ${lastApplied.migration.name} → ${anchorSha})`
143
+ : ` (last: ${lastApplied.migration.name})`
144
+ : '';
145
+ const parts = [`${appliedCount} applied${anchor}`];
146
+ if (deferredCount > 0) {
147
+ parts.push(`${deferredCount} deferred`);
148
+ }
149
+ logger_1.logger.info(`${parts.join(', ')}. ${notAttempted} not attempted.`);
150
+ logger_1.logger.info(`See the per-migration log above for full details.`);
151
+ }
152
+ if (uncommittedAtFailure.length > 0) {
153
+ logger_1.logger.info('');
154
+ logger_1.logger.info(`Working-tree state retained from ${uncommittedAtFailure.length} migration${uncommittedAtFailure.length === 1 ? '' : 's'} whose commits could not be created:`);
155
+ for (const o of uncommittedAtFailure) {
156
+ logger_1.logger.info(` - ${o.migration.package}: ${o.migration.name}`);
157
+ }
158
+ logger_1.logger.info('');
159
+ logger_1.logger.info('Inspect with `git status` / `git diff` and either commit them manually or revert before re-running.');
160
+ }
161
+ if (migrationEmittedNextSteps.length > 0) {
162
+ logger_1.logger.info('');
163
+ logger_1.logger.info(`Notes from migrations that completed before the failure:`);
164
+ for (const step of migrationEmittedNextSteps) {
165
+ logger_1.logger.info(` - ${step}`);
166
+ }
167
+ }
168
+ logger_1.logger.info('');
169
+ if (insideAgent) {
170
+ logger_1.logger.info(`Report the failure and the recap above to the user. They'll need to fix the failing migration and re-run \`nx migrate --run-migrations\` themselves.`);
171
+ }
172
+ else {
173
+ logger_1.logger.info(`Fix the failing migration and re-run \`nx migrate --run-migrations\` to resume.`);
174
+ }
175
+ logger_1.logger.info('');
176
+ }
177
+ /**
178
+ * Builds the tally body line shown under the top end-of-run NX block. Returns
179
+ * `null` when there is nothing meaningful to tally (e.g. an empty
180
+ * migrations.json), so the caller can omit the body entirely instead of
181
+ * emitting a misleading `0 prompt migrations skipped.` line.
182
+ *
183
+ * Rule (kept coherent across every scenario):
184
+ * - When at least one migration was applied: `<N> migrations applied, <K> commits created[, <D> prompt migrations <skipped|deferred>]`.
185
+ * The `<K> commits created` part stays even at 0 — it tells the reader work
186
+ * was applied but not committed (the J4/J8 information made explicit).
187
+ * - When zero migrations were applied but some prompt halves were
188
+ * skipped/deferred: `<D> prompt migrations <skipped|deferred>` only.
189
+ * - When zero of either: no body line.
190
+ */
191
+ function buildTallyBodyLine(opts) {
192
+ const { appliedCount, committedShasCount, skippedPromptsCount, insideAgent } = opts;
193
+ const skipVerb = insideAgent ? 'deferred' : 'skipped';
194
+ if (appliedCount === 0) {
195
+ if (skippedPromptsCount === 0)
196
+ return null;
197
+ return `${skippedPromptsCount} prompt migration${skippedPromptsCount === 1 ? '' : 's'} ${skipVerb}.`;
198
+ }
199
+ const parts = [
200
+ `${appliedCount} migration${appliedCount === 1 ? '' : 's'} applied`,
201
+ `${committedShasCount} commit${committedShasCount === 1 ? '' : 's'} created`,
202
+ ];
203
+ if (skippedPromptsCount > 0) {
204
+ parts.push(`${skippedPromptsCount} prompt migration${skippedPromptsCount === 1 ? '' : 's'} ${skipVerb}`);
205
+ }
206
+ return `${parts.join(', ')}.`;
207
+ }
208
+ /**
209
+ * Body lines for the end-of-run retained-state warning. Fires on the success
210
+ * path — the run completed but one or more migrations' own commits failed
211
+ * and were never absorbed.
212
+ */
213
+ function buildRetainedAtSuccessBody(retainedNames) {
214
+ return [
215
+ ...retainedNames.map((name) => ` - ${name}`),
216
+ '',
217
+ 'Their changes are in the working tree. Inspect with `git status` / `git diff` and either commit them manually or revert.',
218
+ ];
219
+ }
220
+ /**
221
+ * Builds the body lines for the inside-agent directive block. Sub-sections
222
+ * drop independently when empty. Returns an empty array when the block has
223
+ * nothing actionable (no deferred prompts AND no migration-emitted notes) —
224
+ * the caller skips emitting the block entirely in that case.
225
+ */
226
+ function buildDirectiveBlockBodyLines(opts) {
227
+ const { skippedPrompts, migrationEmittedNextSteps } = opts;
228
+ const hasDeferred = skippedPrompts.length > 0;
229
+ const hasNotes = migrationEmittedNextSteps.length > 0;
230
+ if (!hasDeferred && !hasNotes)
231
+ return [];
232
+ const lines = [];
233
+ if (hasDeferred) {
234
+ lines.push('Apply the deferred prompts below, in order:');
235
+ skippedPrompts.forEach((m, i) => {
236
+ const kindHint = (0, migration_shape_1.isHybridMigration)(m)
237
+ ? ' — hybrid prompt phase'
238
+ : ' — prompt-only migration';
239
+ lines.push(` ${i + 1}. ${m.prompt}`);
240
+ lines.push(` (${m.name}${kindHint})`);
241
+ });
242
+ }
243
+ if (hasNotes) {
244
+ if (hasDeferred)
245
+ lines.push('');
246
+ lines.push(hasDeferred
247
+ ? 'Then relay these migration-emitted notes to the user:'
248
+ : 'Relay these migration-emitted notes to the user:');
249
+ for (const step of migrationEmittedNextSteps) {
250
+ lines.push(` - ${step}`);
251
+ }
252
+ }
253
+ lines.push('');
254
+ lines.push(hasDeferred && hasNotes
255
+ ? 'Finally, summarize what was done across the run and commit the changes per workspace conventions.'
256
+ : 'Then summarize what was done across the run and commit the changes per workspace conventions.');
257
+ return lines;
258
+ }
@@ -2,8 +2,17 @@ import { MigrationsJson, PackageJsonUpdateForPackage as PackageUpdate } from '..
2
2
  import { NxJsonConfiguration } from '../../config/nx-json';
3
3
  import { FileChange } from '../../generators/tree';
4
4
  import { ArrayPackageGroup, PackageJson } from '../../utils/package-json';
5
+ import { type MultiMajorMode } from './multi-major';
6
+ import type { AgenticArg } from './agentic/select';
7
+ import type { ResolvedAgentic } from './agentic/types';
8
+ import { isHybridMigration, isPromptOnlyMigration } from './migration-shape';
9
+ import { filterDowngradedUpdates } from './update-filters';
10
+ import { normalizeVersion } from './version-utils';
11
+ export { normalizeVersion };
5
12
  export interface ResolvedMigrationConfiguration extends MigrationsJson {
6
13
  packageGroup?: ArrayPackageGroup;
14
+ /** Prompt file contents keyed by the `prompt` value as it appears on the migration entry. */
15
+ resolvedPromptFiles?: Record<string, string>;
7
16
  }
8
17
  type CommandFailure = {
9
18
  message?: string;
@@ -11,7 +20,7 @@ type CommandFailure = {
11
20
  stdout?: string | Buffer;
12
21
  };
13
22
  export declare function formatCommandFailure(command: string, error: CommandFailure): string;
14
- export declare function normalizeVersion(version: string): string;
23
+ export type MigrateMode = 'first-party' | 'third-party' | 'all';
15
24
  export interface MigratorOptions {
16
25
  packageJson?: PackageJson;
17
26
  nxInstallation?: NxJsonConfiguration['installation'];
@@ -25,6 +34,15 @@ export interface MigratorOptions {
25
34
  };
26
35
  interactive?: boolean;
27
36
  excludeAppliedMigrations?: boolean;
37
+ /**
38
+ * Restricts `packageJsonUpdates` filtering based on the value:
39
+ * - 'first-party' keeps only packages in `firstPartyPackages`
40
+ * - 'third-party' keeps only packages NOT in `firstPartyPackages`
41
+ * - 'all' / undefined keeps all packages (no filtering)
42
+ */
43
+ mode?: MigrateMode;
44
+ /** First-party package names used by `mode` for filtering. */
45
+ firstPartyPackages?: ReadonlySet<string>;
28
46
  }
29
47
  export declare class Migrator {
30
48
  private readonly packageJson?;
@@ -34,6 +52,8 @@ export declare class Migrator {
34
52
  private readonly to;
35
53
  private readonly interactive;
36
54
  private readonly excludeAppliedMigrations;
55
+ private readonly mode;
56
+ private readonly firstPartyPackages;
37
57
  private readonly packageUpdates;
38
58
  private readonly collectedVersions;
39
59
  private readonly promptAnswers;
@@ -42,6 +62,8 @@ export declare class Migrator {
42
62
  constructor(opts: MigratorOptions);
43
63
  private fetchMigrationConfig;
44
64
  migrate(targetPackage: string, targetVersion: string): Promise<{
65
+ minVersionWithSkippedUpdates: string;
66
+ promptContents?: Record<string, string>;
45
67
  packageUpdates: Record<string, PackageUpdate>;
46
68
  migrations: {
47
69
  package: string;
@@ -50,9 +72,9 @@ export declare class Migrator {
50
72
  description?: string;
51
73
  implementation?: string;
52
74
  factory?: string;
75
+ prompt?: string;
53
76
  requires?: Record<string, string>;
54
77
  }[];
55
- minVersionWithSkippedUpdates: string;
56
78
  }>;
57
79
  private createMigrateJson;
58
80
  private buildPackageJsonUpdates;
@@ -68,6 +90,8 @@ export declare class Migrator {
68
90
  */
69
91
  private getPackageJsonUpdatesFromPackageGroup;
70
92
  private filterPackageJsonUpdates;
93
+ private shouldExcludePackage;
94
+ private applyModeFilter;
71
95
  private shouldApplyPackageUpdate;
72
96
  private validatePackageUpdateVersion;
73
97
  private addPackageUpdate;
@@ -83,6 +107,18 @@ export declare class Migrator {
83
107
  private lt;
84
108
  private lte;
85
109
  }
110
+ /**
111
+ * The canonical Nx package for a given target version: `@nrwl/workspace` for
112
+ * legacy (`< 14.0.0-beta.0`), `nx` otherwise. Non-semver inputs (e.g. the
113
+ * literal `'latest'` sentinel before tag resolution) resolve to modern era.
114
+ * Used by `--mode=third-party` to silently swap `@nx/workspace` → `nx` when
115
+ * walking the cascade.
116
+ */
117
+ export declare function resolveCanonicalNxPackage(targetVersion: string): 'nx' | '@nrwl/workspace';
118
+ export declare function resolveMode(mode: MigrateMode | undefined, targetPackage: string, targetVersion: string, context?: {
119
+ hasFrom: boolean;
120
+ hasExcludeAppliedMigrations: boolean;
121
+ }): Promise<MigrateMode>;
86
122
  type GenerateMigrations = {
87
123
  type: 'generateMigrations';
88
124
  targetPackage: string;
@@ -95,15 +131,31 @@ type GenerateMigrations = {
95
131
  };
96
132
  interactive?: boolean;
97
133
  excludeAppliedMigrations?: boolean;
134
+ mode: MigrateMode;
135
+ /**
136
+ * Set when multi-major redirected `targetVersion` to an incremental step
137
+ * (gradual mode or the interactive prompt picking a smaller jump). Holds
138
+ * the concrete resolved target so Next Steps can suggest re-running toward
139
+ * it.
140
+ */
141
+ originalTargetVersion?: string;
142
+ /**
143
+ * The `--multi-major-mode` value to propagate to a continuation command,
144
+ * or undefined to omit it. See `MultiMajorResult.gradual` for when it's set.
145
+ */
146
+ multiMajorMode?: MultiMajorMode;
98
147
  };
99
148
  type RunMigrations = {
100
149
  type: 'runMigrations';
101
150
  runMigrations: string;
102
151
  ifExists: boolean;
152
+ agentic: AgenticArg;
153
+ validate?: boolean;
103
154
  };
104
155
  export declare function parseMigrationsOptions(options: {
105
156
  [k: string]: any;
106
157
  }): Promise<GenerateMigrations | RunMigrations>;
158
+ export { filterDowngradedUpdates };
107
159
  /**
108
160
  * Detects npm peer-dependency resolution failures. Keyed on the `ERESOLVE`
109
161
  * error code, which npm consistently emits for this class of failure across
@@ -112,29 +164,88 @@ export declare function parseMigrationsOptions(options: {
112
164
  * captured output.
113
165
  */
114
166
  export declare function isNpmPeerDepsError(stderr: string): boolean;
115
- export declare function executeMigrations(root: string, migrations: {
167
+ type ExecutableMigration = {
116
168
  package: string;
117
169
  name: string;
118
170
  description?: string;
119
171
  version: string;
120
- }[], isVerbose: boolean, shouldCreateCommits: boolean, commitPrefix: string, shouldSkipInstall?: boolean): Promise<{
121
- migrationsWithNoChanges: {
122
- package: string;
123
- name: string;
124
- description?: string;
125
- version: string;
126
- }[];
172
+ implementation?: string;
173
+ factory?: string;
174
+ prompt?: string;
175
+ };
176
+ export { isPromptOnlyMigration, isHybridMigration };
177
+ export declare function resolveAgenticRunId(migrations: ExecutableMigration[]): string;
178
+ export declare function formatSkippedPromptsNextStep(skipped: ExecutableMigration[]): string;
179
+ /**
180
+ * Resolves the effective `--create-commits` state once the agentic flow has
181
+ * been resolved. The agent's outer prompt only embeds the impl-phase file list
182
+ * when per-migration commits isolate each migration's diff, so the diff-context
183
+ * flag returned here gates that section.
184
+ */
185
+ export declare function resolveCreateCommits(args: {
186
+ createCommits: boolean | undefined;
187
+ agenticKind: ResolvedAgentic['kind'];
188
+ isGitRepo: boolean;
189
+ /**
190
+ * Whether `--commit-prefix` was given a non-default value. When commits
191
+ * end up disabled, the prefix has no effect — the warning copy below
192
+ * surfaces that so the user isn't silently misled.
193
+ */
194
+ commitPrefixIsCustom?: boolean;
195
+ }): {
196
+ effective: boolean;
197
+ agenticHasDiffContext: boolean;
198
+ warning?: string;
199
+ error?: string;
200
+ };
201
+ /**
202
+ * Resolves whether the framework-owned generic-validation agent step should run
203
+ * after generator-only migrations.
204
+ *
205
+ * Default-on when the agentic flow resolved to `enabled`; silently ignored
206
+ * otherwise (no warning emitted) — `--validate` requires an active agent
207
+ * session by definition. An explicit `--no-validate` (`validate === false`)
208
+ * opts out even when agentic is enabled.
209
+ */
210
+ export declare function resolveShouldRunValidation(args: {
211
+ validate: boolean | undefined;
212
+ agenticKind: ResolvedAgentic['kind'];
213
+ }): boolean;
214
+ export declare function executeMigrations(root: string, migrations: ExecutableMigration[], isVerbose: boolean, shouldCreateCommits: boolean, commitPrefix: string, shouldSkipInstall?: boolean, agentic?: ResolvedAgentic, agenticHasDiffContext?: boolean, shouldRunValidation?: boolean): Promise<{
215
+ migrationsWithNoChanges: ExecutableMigration[];
216
+ skippedPromptsCount: number;
217
+ notRunMigrationsCount: number;
127
218
  nextSteps: string[];
219
+ skippedPrompts: ExecutableMigration[];
220
+ migrationEmittedNextSteps: string[];
221
+ committedShasCount: number;
222
+ retainedAtSuccess: string[];
128
223
  }>;
224
+ export declare class ChangedDepInstaller {
225
+ private readonly root;
226
+ private readonly shouldSkipInstall;
227
+ private initialDeps;
228
+ private _skippedInstall;
229
+ constructor(root: string, shouldSkipInstall?: boolean);
230
+ get skippedInstall(): boolean;
231
+ installDepsIfChanged(): Promise<void>;
232
+ }
129
233
  export declare function runNxOrAngularMigration(root: string, migration: {
130
234
  package: string;
131
235
  name: string;
132
236
  description?: string;
133
237
  version: string;
134
- }, isVerbose: boolean, shouldCreateCommits: boolean, commitPrefix: string, installDepsIfChanged?: () => Promise<void>, handleInstallDeps?: boolean): Promise<{
238
+ }, isVerbose: boolean, captureGeneratorOutput?: boolean): Promise<{
135
239
  changes: FileChange[];
136
240
  nextSteps: string[];
241
+ agentContext: string[];
242
+ logs: string;
243
+ madeChanges: boolean;
137
244
  }>;
245
+ export declare function parseMigrationReturn(value: unknown): {
246
+ nextSteps: string[];
247
+ agentContext: string[];
248
+ };
138
249
  export declare function migrate(root: string, args: {
139
250
  [k: string]: any;
140
251
  }, rawArgs: string[]): Promise<number>;
@@ -148,4 +259,3 @@ export declare function getImplementationPath(collection: MigrationsJson, collec
148
259
  fnSymbol: string;
149
260
  };
150
261
  export declare function nxCliPath(nxWorkspaceRoot?: string): Promise<string>;
151
- export {};