nx 24.0.2 → 24.0.4

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 (94) hide show
  1. package/dist/bin/nx-cloud.js +9 -0
  2. package/dist/release/changelog-renderer/index.js +12 -5
  3. package/dist/src/ai/clone-ai-config-repo.d.ts +2 -1
  4. package/dist/src/ai/clone-ai-config-repo.js +48 -11
  5. package/dist/src/ai/set-up-ai-agents/set-up-ai-agents.js +37 -8
  6. package/dist/src/analytics/analytics.js +7 -2
  7. package/dist/src/command-line/ai/ai-output.js +3 -3
  8. package/dist/src/command-line/configure-ai-agents/configure-ai-agents.js +2 -2
  9. package/dist/src/command-line/graph/graph.d.ts +10 -0
  10. package/dist/src/command-line/graph/graph.js +61 -2
  11. package/dist/src/command-line/import/import.js +18 -30
  12. package/dist/src/command-line/import/utils/merge-remote-source.d.ts +1 -0
  13. package/dist/src/command-line/import/utils/merge-remote-source.js +10 -1
  14. package/dist/src/command-line/init/implementation/angular/legacy-angular-versions.js +17 -5
  15. package/dist/src/command-line/init/init-v1.js +2 -2
  16. package/dist/src/command-line/init/init-v2.js +4 -4
  17. package/dist/src/command-line/migrate/migrate-analytics.js +2 -2
  18. package/dist/src/command-line/migrate/migrate.d.ts +3 -0
  19. package/dist/src/command-line/migrate/migrate.js +40 -22
  20. package/dist/src/command-line/migrate/workspace-installation.d.ts +15 -0
  21. package/dist/src/command-line/migrate/workspace-installation.js +73 -0
  22. package/dist/src/command-line/nx-cloud/complete-run/command-object.js +1 -1
  23. package/dist/src/command-line/nx-cloud/fix-ci/command-object.js +1 -1
  24. package/dist/src/command-line/nx-cloud/logout/command-object.js +11 -2
  25. package/dist/src/command-line/nx-cloud/record/command-object.js +1 -1
  26. package/dist/src/command-line/nx-cloud/record/record.js +3 -2
  27. package/dist/src/command-line/nx-cloud/start-ci-run/command-object.js +1 -1
  28. package/dist/src/command-line/nx-cloud/start-nx-agents/command-object.js +1 -1
  29. package/dist/src/command-line/nx-commands.js +3 -1
  30. package/dist/src/command-line/release/changelog/version-plan-filtering.js +4 -1
  31. package/dist/src/command-line/release/changelog.js +8 -3
  32. package/dist/src/command-line/release/config/version-plans.js +29 -29
  33. package/dist/src/command-line/release/utils/git.d.ts +2 -0
  34. package/dist/src/command-line/release/utils/git.js +49 -26
  35. package/dist/src/command-line/release/utils/markdown.js +4 -1
  36. package/dist/src/command-line/release/utils/remote-release-clients/github.js +18 -7
  37. package/dist/src/command-line/release/utils/remote-release-clients/gitlab.js +3 -1
  38. package/dist/src/command-line/release/version/derive-specifier-from-conventional-commits.js +1 -1
  39. package/dist/src/command-line/release/version/version-actions.js +2 -1
  40. package/dist/src/command-line/release/version.js +2 -1
  41. package/dist/src/command-line/show/show-target/info.d.ts +1 -1
  42. package/dist/src/command-line/show/show-target/info.js +4 -4
  43. package/dist/src/core/graph/favicon.ico +0 -0
  44. package/dist/src/core/graph/main.js +1 -1
  45. package/dist/src/core/graph/styles.js +1 -1
  46. package/dist/src/daemon/server/latest-nx.js +2 -2
  47. package/dist/src/daemon/server/project-graph-incremental-recomputation.js +3 -1
  48. package/dist/src/executors/run-commands/running-tasks.js +7 -0
  49. package/dist/src/executors/run-commands/schema.json +1 -1
  50. package/dist/src/hasher/native-task-hasher-impl.js +5 -2
  51. package/dist/src/native/index.d.ts +11 -1
  52. package/dist/src/native/index.js +12 -17
  53. package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
  54. package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
  55. package/dist/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +5 -6
  56. package/dist/src/nx-cloud/update-manager.d.ts +2 -0
  57. package/dist/src/nx-cloud/utilities/client.d.ts +1 -0
  58. package/dist/src/nx-cloud/utilities/client.js +5 -0
  59. package/dist/src/nx-cloud/utilities/get-cloud-options.d.ts +1 -1
  60. package/dist/src/nx-cloud/utilities/get-cloud-options.js +5 -2
  61. package/dist/src/nx-cloud/utilities/is-workspace-claimed.js +1 -1
  62. package/dist/src/nx-cloud/utilities/url-shorten.d.ts +1 -1
  63. package/dist/src/nx-cloud/utilities/url-shorten.js +4 -4
  64. package/dist/src/plugins/js/lock-file/yarn-parser.js +49 -2
  65. package/dist/src/plugins/js/project-graph/build-dependencies/build-dependencies.js +2 -1
  66. package/dist/src/plugins/js/utils/register.js +3 -2
  67. package/dist/src/plugins/js/utils/typescript.js +3 -2
  68. package/dist/src/project-graph/utils/retrieve-workspace-files.js +2 -2
  69. package/dist/src/tasks-runner/cache.js +24 -8
  70. package/dist/src/tasks-runner/default-tasks-runner.js +21 -13
  71. package/dist/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.js +34 -13
  72. package/dist/src/tasks-runner/life-cycles/dynamic-run-one-terminal-output-life-cycle.js +26 -5
  73. package/dist/src/tasks-runner/life-cycles/performance-report.js +2 -2
  74. package/dist/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.js +1 -1
  75. package/dist/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.js +1 -1
  76. package/dist/src/tasks-runner/life-cycles/summary-terminal-output-life-cycle.js +3 -3
  77. package/dist/src/tasks-runner/life-cycles/tui-summary-life-cycle.js +76 -39
  78. package/dist/src/tasks-runner/running-tasks/batch-process.d.ts +2 -2
  79. package/dist/src/tasks-runner/running-tasks/batch-process.js +1 -1
  80. package/dist/src/tasks-runner/task-orchestrator.d.ts +6 -3
  81. package/dist/src/tasks-runner/task-orchestrator.js +61 -29
  82. package/dist/src/utils/git-utils.js +3 -3
  83. package/dist/src/utils/git-utils.tree-filter.js +102 -24
  84. package/dist/src/utils/installation-directory.d.ts +8 -0
  85. package/dist/src/utils/installation-directory.js +13 -0
  86. package/dist/src/utils/package-manager.d.ts +9 -3
  87. package/dist/src/utils/package-manager.js +64 -34
  88. package/dist/src/utils/provenance.d.ts +14 -1
  89. package/dist/src/utils/provenance.js +44 -13
  90. package/dist/src/utils/redact-url-credentials.d.ts +1 -0
  91. package/dist/src/utils/redact-url-credentials.js +7 -0
  92. package/dist/src/utils/workspace-id.d.ts +4 -3
  93. package/dist/src/utils/workspace-id.js +4 -3
  94. package/package.json +12 -12
@@ -41,10 +41,15 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
41
41
  clearInterval(renderIntervalId);
42
42
  }
43
43
  }
44
+ let stoppedBySignal = false;
45
+ const onSignal = () => {
46
+ stoppedBySignal = true;
47
+ clearRenderInterval();
48
+ };
44
49
  process.on('exit', () => clearRenderInterval());
45
- process.on('SIGINT', () => clearRenderInterval());
46
- process.on('SIGTERM', () => clearRenderInterval());
47
- process.on('SIGHUP', () => clearRenderInterval());
50
+ process.on('SIGINT', onSignal);
51
+ process.on('SIGTERM', onSignal);
52
+ process.on('SIGHUP', onSignal);
48
53
  const lifeCycle = {};
49
54
  const isVerbose = overrides.verbose === true;
50
55
  const start = process.hrtime();
@@ -58,6 +63,7 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
58
63
  };
59
64
  });
60
65
  const failedTasks = new Set();
66
+ const stoppedTasks = new Set();
61
67
  const tasksToTerminalOutputs = {};
62
68
  const tasksToProcessStartTimes = {};
63
69
  let hasTaskOutput = false;
@@ -273,20 +279,32 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
273
279
  }
274
280
  const numFailedToPrint = 5;
275
281
  const failedTasksForPrinting = Array.from(failedTasks).slice(0, numFailedToPrint);
282
+ const taskIdRows = (taskIds) => taskIds
283
+ .map((t) => `${EXTENDED_LEFT_PAD}${output_1.output.colors.red('-')} ${output_1.output.formatCommand(t)}`)
284
+ .join('\n');
276
285
  const failureSummaryRows = [
277
286
  output_1.output.applyNxPrefix('red', output_1.output.colors.red(text) + pc.dim(pc.white(` (${timeTakenText})`))),
278
287
  ...taskOverridesRows,
279
- '',
280
- output_1.output.dim(`${LEFT_PAD}${output_1.output.dim(figures.tick)}${SPACER}${totalSuccessfulTasks}${`/${totalCompletedTasks}`} succeeded ${output_1.output.dim(`[${totalCachedTasks} read from cache]`)}`),
281
- '',
282
- `${LEFT_PAD}${output_1.output.colors.red(figures.cross)}${SPACER}${totalFailedTasks}${`/${totalCompletedTasks}`} targets failed, including the following:`,
283
- '',
284
- `${failedTasksForPrinting
285
- .map((t) => `${EXTENDED_LEFT_PAD}${output_1.output.colors.red('-')} ${output_1.output.formatCommand(t.toString())}`)
286
- .join('\n')}`,
287
288
  ];
288
- if (failedTasks.size > numFailedToPrint) {
289
- failureSummaryRows.push(output_1.output.dim(`${EXTENDED_LEFT_PAD}...and ${failedTasks.size - numFailedToPrint} more...`));
289
+ if (totalSuccessfulTasks > 0) {
290
+ failureSummaryRows.push('', output_1.output.dim(`${LEFT_PAD}${output_1.output.dim(figures.tick)}${SPACER}${totalSuccessfulTasks}${`/${totalTasks}`} succeeded ${output_1.output.dim(`[${totalCachedTasks} read from cache]`)}`));
291
+ }
292
+ if (totalFailedTasks > 0) {
293
+ failureSummaryRows.push('', `${LEFT_PAD}${output_1.output.colors.red(figures.cross)}${SPACER}${totalFailedTasks}${`/${totalTasks}`} targets failed, including the following:`, '', taskIdRows(failedTasksForPrinting));
294
+ if (failedTasks.size > numFailedToPrint) {
295
+ failureSummaryRows.push(output_1.output.dim(`${EXTENDED_LEFT_PAD}...and ${failedTasks.size - numFailedToPrint} more...`));
296
+ }
297
+ }
298
+ if (stoppedTasks.size > 0) {
299
+ failureSummaryRows.push('', `${LEFT_PAD}${output_1.output.colors.red(figures.ellipsis)}${SPACER}${stoppedTasks.size}/${totalTasks} targets were in progress, including the following:`, '', taskIdRows(Array.from(stoppedTasks)));
300
+ }
301
+ const notRunTasks = totalTasks - totalCompletedTasks;
302
+ // After a signal, the tasks that never ran include ones the run
303
+ // stopped before reaching, which "skipped" would mislabel
304
+ if (notRunTasks > 0) {
305
+ failureSummaryRows.push('', output_1.output.dim(stoppedBySignal
306
+ ? `${LEFT_PAD}${output_1.output.colors.red(figures.ellipsis)}${SPACER}${notRunTasks}/${totalTasks} targets had not started.`
307
+ : `${LEFT_PAD}${pc.yellow('⏭')}${SPACER}${notRunTasks}/${totalTasks} targets were skipped.`));
290
308
  }
291
309
  failureSummaryRows.push(...(0, view_logs_utils_1.viewLogsFooterRows)(failedTasks.size));
292
310
  renderPinnedFooter(failureSummaryRows, 'red');
@@ -330,6 +348,9 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
330
348
  totalFailedTasks++;
331
349
  failedTasks.add(t.task.id);
332
350
  break;
351
+ case 'stopped':
352
+ stoppedTasks.add(t.task.id);
353
+ break;
333
354
  }
334
355
  printTaskResult(t.task, t.status);
335
356
  }
@@ -41,10 +41,15 @@ async function createRunOneDynamicOutputRenderer({ initiatingProject, tasks, arg
41
41
  clearInterval(renderDependentTargetsIntervalId);
42
42
  }
43
43
  }
44
+ let stoppedBySignal = false;
45
+ const onSignal = () => {
46
+ stoppedBySignal = true;
47
+ clearRenderInterval();
48
+ };
44
49
  process.on('exit', () => clearRenderInterval());
45
- process.on('SIGINT', () => clearRenderInterval());
46
- process.on('SIGTERM', () => clearRenderInterval());
47
- process.on('SIGHUP', () => clearRenderInterval());
50
+ process.on('SIGINT', onSignal);
51
+ process.on('SIGTERM', onSignal);
52
+ process.on('SIGHUP', onSignal);
48
53
  const lifeCycle = {};
49
54
  const start = process.hrtime();
50
55
  const figures = await (0, handle_import_1.handleImport)('figures');
@@ -60,6 +65,7 @@ async function createRunOneDynamicOutputRenderer({ initiatingProject, tasks, arg
60
65
  let totalCompletedTasks = 0;
61
66
  let totalSuccessfulTasks = 0;
62
67
  let totalFailedTasks = 0;
68
+ let totalStoppedTasks = 0;
63
69
  let totalCachedTasks = 0;
64
70
  // Used to control the rendering of the spinner
65
71
  let dependentTargetsCurrentFrame = 0;
@@ -175,6 +181,9 @@ async function createRunOneDynamicOutputRenderer({ initiatingProject, tasks, arg
175
181
  output_1.output.logCommandOutput(t.task.id, t.status, tasksToTerminalOutputs[t.task.id]);
176
182
  }
177
183
  break;
184
+ case 'stopped':
185
+ totalStoppedTasks++;
186
+ break;
178
187
  }
179
188
  delete tasksToTerminalOutputs[t.task.id];
180
189
  }
@@ -223,12 +232,24 @@ async function createRunOneDynamicOutputRenderer({ initiatingProject, tasks, arg
223
232
  .forEach((arg) => taskOverridesLines.push(arg));
224
233
  }
225
234
  const viewLogs = (0, view_logs_utils_1.viewLogsFooterRows)(totalFailedTasks);
235
+ const notRunTasks = totalTasks - totalCompletedTasks;
236
+ // After a signal, the tasks that never ran include ones the run
237
+ // stopped before reaching, which "skipped" would mislabel
238
+ const notRunLine = stoppedBySignal
239
+ ? `${LEFT_PAD}${output_1.output.colors.red(figures.ellipsis)}${SPACER}${notRunTasks}/${totalTasks} had not started`
240
+ : `${LEFT_PAD}${pc.yellow('⏭')}${SPACER}${notRunTasks}/${totalTasks} skipped`;
226
241
  renderLines([
227
242
  output_1.output.applyNxPrefix('red', output_1.output.colors.red(text) + output_1.output.dim(` (${timeTakenText})`)),
228
243
  ...taskOverridesLines,
229
244
  '',
230
- `${LEFT_PAD}${output_1.output.colors.red(figures.cross)}${SPACER}${totalFailedTasks}${`/${totalCompletedTasks}`} failed`,
231
- `${LEFT_PAD}${output_1.output.dim(figures.tick)}${SPACER}${totalSuccessfulTasks}${`/${totalCompletedTasks}`} succeeded ${output_1.output.dim(`[${totalCachedTasks} read from cache]`)}`,
245
+ `${LEFT_PAD}${output_1.output.colors.red(figures.cross)}${SPACER}${totalFailedTasks}${`/${totalTasks}`} failed`,
246
+ `${LEFT_PAD}${output_1.output.dim(figures.tick)}${SPACER}${totalSuccessfulTasks}${`/${totalTasks}`} succeeded ${output_1.output.dim(`[${totalCachedTasks} read from cache]`)}`,
247
+ ...(totalStoppedTasks > 0
248
+ ? [
249
+ `${LEFT_PAD}${output_1.output.colors.red(figures.ellipsis)}${SPACER}${totalStoppedTasks}/${totalTasks} were in progress`,
250
+ ]
251
+ : []),
252
+ ...(notRunTasks > 0 ? [notRunLine] : []),
232
253
  ...viewLogs,
233
254
  ], 'red');
234
255
  }
@@ -62,8 +62,8 @@ async function prefetchRemoteCacheOnboardingUrl(nxJson) {
62
62
  }, ONBOARDING_URL_TIMEOUT).unref();
63
63
  }),
64
64
  ]);
65
- // createNxCloudOnboardingURL never throws - on an unreachable API it returns a
66
- // paste-a-token URL (accessToken=undefined). Only accept a real short link.
65
+ // On an unreachable API createNxCloudOnboardingURL returns a paste-a-token
66
+ // URL. Only accept a real short link.
67
67
  if (url?.startsWith(`${(0, get_cloud_options_1.getCloudUrl)()}/connect/`)) {
68
68
  remoteCacheLink = url;
69
69
  }
@@ -84,7 +84,7 @@ class StaticRunManyTerminalOutputLifeCycle {
84
84
  const bodyLines = [];
85
85
  const skippedTasks = this.skippedTasks();
86
86
  if (skippedTasks.length > 0) {
87
- bodyLines.push(output_1.output.dim('Tasks not run because their dependencies failed or --nx-bail=true:'), '', ...skippedTasks.map((task) => `${output_1.output.dim('-')} ${task.id}`), '');
87
+ bodyLines.push(output_1.output.dim('Tasks not run because their dependencies failed, --nx-bail=true, or their batch ended before reaching them:'), '', ...skippedTasks.map((task) => `${output_1.output.dim('-')} ${task.id}`), '');
88
88
  }
89
89
  if (this.stoppedTasks.length > 0) {
90
90
  bodyLines.push(output_1.output.dim('Tasks stopped before they finished:'), '', ...this.stoppedTasks.map((task) => `${output_1.output.dim('-')} ${task.id}`), '');
@@ -93,7 +93,7 @@ class StaticRunOneTerminalOutputLifeCycle {
93
93
  const bodyLines = [];
94
94
  const skippedTasks = this.skippedTasks();
95
95
  if (skippedTasks.length > 0) {
96
- bodyLines.push(output_1.output.dim('Tasks not run because their dependencies failed or --nx-bail=true:'), '', ...skippedTasks.map((task) => `${output_1.output.dim('-')} ${task.id}`), '');
96
+ bodyLines.push(output_1.output.dim('Tasks not run because their dependencies failed, --nx-bail=true, or their batch ended before reaching them:'), '', ...skippedTasks.map((task) => `${output_1.output.dim('-')} ${task.id}`), '');
97
97
  }
98
98
  if (this.stoppedTasks.length > 0) {
99
99
  bodyLines.push(output_1.output.dim('Tasks stopped before they finished:'), '', ...this.stoppedTasks.map((task) => `${output_1.output.dim('-')} ${task.id}`), '');
@@ -22,13 +22,13 @@ class SummaryTerminalOutputLifeCycle {
22
22
  this.completed = new Set();
23
23
  this.succeeded = 0;
24
24
  this.cached = 0;
25
- this.batchLogs = new Map();
25
+ this.batchLogs = [];
26
26
  }
27
27
  setCloudLink(label, url) {
28
28
  this.cloudLink = { label, url };
29
29
  }
30
30
  batchOutputAvailable(batchId, path) {
31
- this.batchLogs.set(batchId, path);
31
+ this.batchLogs.push([batchId, path]);
32
32
  }
33
33
  /**
34
34
  * Nothing is printed as tasks complete. A summary that interleaved with
@@ -87,7 +87,7 @@ class SummaryTerminalOutputLifeCycle {
87
87
  : [line];
88
88
  }));
89
89
  }
90
- if (this.batchLogs.size > 0) {
90
+ if (this.batchLogs.length > 0) {
91
91
  // One line per worker, not per task: a batch's log explains the whole
92
92
  // batch, and no task's own output file contains it.
93
93
  bodyLines.push('', output_1.output.dim('Batch worker logs:'));
@@ -25,6 +25,7 @@ function getTuiTerminalSummaryLifeCycle({ projectNames, tasks, taskGraph, args,
25
25
  let totalCompletedTasks = 0;
26
26
  let timeTakenText;
27
27
  const failedTasks = new Set();
28
+ const skippedTasks = new Set();
28
29
  const inProgressTasks = new Set();
29
30
  // Tasks ended with 'stopped' status (interrupted, didn't finish — counts as failure)
30
31
  const stoppedTasks = new Set();
@@ -35,12 +36,13 @@ function getTuiTerminalSummaryLifeCycle({ projectNames, tasks, taskGraph, args,
35
36
  // Finalized output strings set on task completion — read by summary print functions
36
37
  const tasksToTerminalOutputs = {};
37
38
  const tasksToTaskStatus = {};
38
- const taskIdsInTheOrderTheyStart = [];
39
+ const batchWorkerLogs = [];
40
+ const taskIdsInTheOrderTheyStart = new Set();
39
41
  const getTerminalOutput = (taskId) => tasksToTerminalOutputs[taskId] ?? taskOutputChunks[taskId]?.join('') ?? '';
40
42
  lifeCycle.startTasks = (tasks) => {
41
43
  for (let t of tasks) {
42
44
  taskOutputChunks[t.id] ??= [];
43
- taskIdsInTheOrderTheyStart.push(t.id);
45
+ taskIdsInTheOrderTheyStart.add(t.id);
44
46
  inProgressTasks.add(t.id);
45
47
  }
46
48
  };
@@ -71,6 +73,7 @@ function getTuiTerminalSummaryLifeCycle({ projectNames, tasks, taskGraph, args,
71
73
  // Skipped tasks don't get an endTasks() call; clear them here so the run
72
74
  // summary doesn't treat them as still-in-progress and report Cancelled.
73
75
  tasksToTaskStatus[taskId] = 'skipped';
76
+ skippedTasks.add(taskId);
74
77
  inProgressTasks.delete(taskId);
75
78
  }
76
79
  };
@@ -78,6 +81,9 @@ function getTuiTerminalSummaryLifeCycle({ projectNames, tasks, taskGraph, args,
78
81
  for (const { task, status, terminalOutput } of taskResults) {
79
82
  totalCompletedTasks++;
80
83
  inProgressTasks.delete(task.id);
84
+ // A batch that crashes after reporting the task skipped still ends it
85
+ // here, as failed or stopped
86
+ skippedTasks.delete(task.id);
81
87
  tasksToTaskStatus[task.id] = status;
82
88
  if (status === 'stopped') {
83
89
  stoppedTasks.add(task.id);
@@ -107,10 +113,18 @@ function getTuiTerminalSummaryLifeCycle({ projectNames, tasks, taskGraph, args,
107
113
  }
108
114
  }
109
115
  };
116
+ lifeCycle.batchOutputAvailable = (batchId, path) => {
117
+ batchWorkerLogs.push([batchId, path]);
118
+ };
110
119
  lifeCycle.endCommand = () => {
111
120
  timeTakenText = (0, pretty_time_1.prettyTime)(process.hrtime(start));
112
121
  resolveRenderIsDonePromise();
113
122
  };
123
+ const batchWorkerLogRows = () => [
124
+ `${LEFT_PAD}${output_1.output.dim('Batch worker logs:')}`,
125
+ '',
126
+ ...batchWorkerLogs.map(([batchId, path]) => `${EXTENDED_LEFT_PAD}${output_1.output.dim(`- ${batchId}: ${path}`)}`),
127
+ ];
114
128
  const printSummary = () => {
115
129
  const isRunOne = initiatingProject && targets?.length === 1;
116
130
  // Handles when the user interrupts the process
@@ -138,7 +152,7 @@ function getTuiTerminalSummaryLifeCycle({ projectNames, tasks, taskGraph, args,
138
152
  (0, task_history_life_cycle_1.getTasksHistoryLifeCycle)().printFlakyTasksMessage();
139
153
  };
140
154
  const printRunOneSummary = ({ failure, cancelled, }) => {
141
- // Print task outputs in completion order above the summary.
155
+ // Print task outputs in start order above the summary.
142
156
  for (const taskId of taskIdsInTheOrderTheyStart) {
143
157
  const taskStatus = tasksToTaskStatus[taskId];
144
158
  // Skipped tasks never ran; don't print a misleading `> nx run` header.
@@ -195,15 +209,27 @@ function getTuiTerminalSummaryLifeCycle({ projectNames, tasks, taskGraph, args,
195
209
  .forEach((arg) => messageLines.push(arg));
196
210
  }
197
211
  messageLines.push('');
198
- messageLines.push(`${LEFT_PAD}${output_1.output.colors.red(figures.cross)}${SPACER}${totalFailedTasks}${`/${totalCompletedTasks}`} failed`);
199
- messageLines.push(`${LEFT_PAD}${output_1.output.dim(figures.tick)}${SPACER}${totalSuccessfulTasks}${`/${totalCompletedTasks}`} succeeded ${output_1.output.dim(`[${totalCachedTasks} read from cache]`)}`);
212
+ messageLines.push(`${LEFT_PAD}${output_1.output.colors.red(figures.cross)}${SPACER}${totalFailedTasks}${`/${totalTasks}`} failed`);
213
+ messageLines.push(`${LEFT_PAD}${output_1.output.dim(figures.tick)}${SPACER}${totalSuccessfulTasks}${`/${totalTasks}`} succeeded ${output_1.output.dim(`[${totalCachedTasks} read from cache]`)}`);
214
+ if (skippedTasks.size > 0) {
215
+ messageLines.push(`${LEFT_PAD}${pc.yellow('⏭')}${SPACER}${skippedTasks.size}/${totalTasks} skipped`);
216
+ }
217
+ if (batchWorkerLogs.length > 0) {
218
+ messageLines.push('', ...batchWorkerLogRows());
219
+ }
200
220
  const viewLogs = (0, view_logs_utils_1.viewLogsFooterRows)(totalFailedTasks);
201
221
  messageLines.push(...viewLogs);
202
222
  // Print the entire failure message block with red color
203
223
  console.log(output_1.output.colors.red(messageLines.join(node_os_1.EOL)));
204
224
  }
205
225
  else {
206
- console.log(output_1.output.applyNxPrefix('red', output_1.output.colors.red(`Cancelled running target ${output_1.output.bold(targets[0])} for project ${output_1.output.bold(initiatingProject)}`) + output_1.output.dim(` (${timeTakenText})`)));
226
+ const messageLines = [
227
+ output_1.output.applyNxPrefix('red', output_1.output.colors.red(`Cancelled running target ${output_1.output.bold(targets[0])} for project ${output_1.output.bold(initiatingProject)}`) + output_1.output.dim(` (${timeTakenText})`)),
228
+ ];
229
+ if (batchWorkerLogs.length > 0) {
230
+ messageLines.push('', ...batchWorkerLogRows());
231
+ }
232
+ console.log(messageLines.join(node_os_1.EOL));
207
233
  }
208
234
  // adds some vertical space after the summary to avoid bunching against terminal
209
235
  console.log('');
@@ -212,8 +238,11 @@ function getTuiTerminalSummaryLifeCycle({ projectNames, tasks, taskGraph, args,
212
238
  console.log('');
213
239
  // Collect checklist lines to print after task outputs
214
240
  const checklistLines = [];
215
- // Sort tasks by status: successful tasks first, failed tasks at the end
216
- const sortedTaskIds = [...taskIdsInTheOrderTheyStart].sort((a, b) => {
241
+ // Sort tasks by status: successful tasks first, failed tasks at the end.
242
+ // A task skipped before it started never reached startTasks.
243
+ const sortedTaskIds = [
244
+ ...new Set([...taskIdsInTheOrderTheyStart, ...skippedTasks]),
245
+ ].sort((a, b) => {
217
246
  const statusA = tasksToTaskStatus[a];
218
247
  const statusB = tasksToTaskStatus[b];
219
248
  const isFailureA = statusA === 'failure' || !statusA ? 1 : 0;
@@ -224,7 +253,9 @@ function getTuiTerminalSummaryLifeCycle({ projectNames, tasks, taskGraph, args,
224
253
  for (const taskId of sortedTaskIds) {
225
254
  const taskStatus = tasksToTaskStatus[taskId];
226
255
  const terminalOutput = getTerminalOutput(taskId);
227
- if (displayStoppedTasks.has(taskId) || !taskStatus) {
256
+ if (displayStoppedTasks.has(taskId) ||
257
+ !taskStatus ||
258
+ taskStatus === 'stopped') {
228
259
  output_1.output.logCommandOutput(taskId, taskStatus, terminalOutput);
229
260
  output_1.output.addNewline();
230
261
  checklistLines.push(`${LEFT_PAD}${output_1.output.colors.cyan(figures.squareSmallFilled)}${SPACER}${output_1.output.colors.gray('nx run ')}${taskId}`);
@@ -246,8 +277,13 @@ function getTuiTerminalSummaryLifeCycle({ projectNames, tasks, taskGraph, args,
246
277
  else if (taskStatus === 'success') {
247
278
  checklistLines.push(`${LEFT_PAD}${output_1.output.colors.green(figures.tick)}${SPACER}${output_1.output.colors.gray('nx run ')}${taskId}`);
248
279
  }
280
+ else if (taskStatus === 'skipped') {
281
+ checklistLines.push(`${LEFT_PAD}${pc.yellow('⏭')}${SPACER}${output_1.output.colors.gray('nx run ')}${taskId}`);
282
+ }
249
283
  else {
250
- checklistLines.push(`${LEFT_PAD}${output_1.output.colors.green(figures.tick)}${SPACER}${output_1.output.colors.gray('nx run ')}${taskId}`);
284
+ const unhandled = taskStatus;
285
+ void unhandled;
286
+ checklistLines.push(`${LEFT_PAD}${output_1.output.colors.cyan(figures.squareSmallFilled)}${SPACER}${output_1.output.colors.gray('nx run ')}${taskId}`);
251
287
  }
252
288
  }
253
289
  // Print all checklist lines together
@@ -296,40 +332,41 @@ function getTuiTerminalSummaryLifeCycle({ projectNames, tasks, taskGraph, args,
296
332
  .forEach((arg) => failureSummaryRows.push(arg));
297
333
  }
298
334
  failureSummaryRows.push('');
299
- if (totalCompletedTasks > 0) {
300
- // For display purposes, treat stopped tasks as in-progress
301
- // (they were running when the process was interrupted)
302
- const displayCompleted = totalCompletedTasks - stoppedTasks.size;
303
- const displayInProgress = new Set([
304
- ...inProgressTasks,
305
- ...stoppedTasks,
306
- ]);
307
- if (totalSuccessfulTasks > 0) {
308
- failureSummaryRows.push(output_1.output.dim(`${LEFT_PAD}${output_1.output.dim(figures.tick)}${SPACER}${totalSuccessfulTasks}${`/${displayCompleted}`} succeeded ${output_1.output.dim(`[${totalCachedTasks} read from cache]`)}`), '');
335
+ // For display purposes, treat stopped tasks as in-progress
336
+ // (they were running when the process was interrupted)
337
+ const displayCompleted = totalCompletedTasks - stoppedTasks.size;
338
+ const displayInProgress = new Set([...inProgressTasks, ...stoppedTasks]);
339
+ if (totalSuccessfulTasks > 0) {
340
+ failureSummaryRows.push(output_1.output.dim(`${LEFT_PAD}${output_1.output.dim(figures.tick)}${SPACER}${totalSuccessfulTasks}${`/${totalTasks}`} succeeded ${output_1.output.dim(`[${totalCachedTasks} read from cache]`)}`), '');
341
+ }
342
+ if (totalFailedTasks > 0) {
343
+ const numFailedToPrint = 5;
344
+ const failedTasksForPrinting = Array.from(failedTasks).slice(0, numFailedToPrint);
345
+ failureSummaryRows.push(`${LEFT_PAD}${output_1.output.colors.red(figures.cross)}${SPACER}${totalFailedTasks}${`/${totalTasks}`} targets failed, including the following:`, '', `${failedTasksForPrinting
346
+ .map((t) => `${EXTENDED_LEFT_PAD}${output_1.output.colors.red('-')} ${output_1.output.formatCommand(t.toString())}`)
347
+ .join('\n')}`, '');
348
+ if (failedTasks.size > numFailedToPrint) {
349
+ failureSummaryRows.push(output_1.output.dim(`${EXTENDED_LEFT_PAD}...and ${failedTasks.size - numFailedToPrint} more...`));
309
350
  }
310
- if (totalFailedTasks > 0) {
311
- const numFailedToPrint = 5;
312
- const failedTasksForPrinting = Array.from(failedTasks).slice(0, numFailedToPrint);
313
- failureSummaryRows.push(`${LEFT_PAD}${output_1.output.colors.red(figures.cross)}${SPACER}${totalFailedTasks}${`/${displayCompleted}`} targets failed, including the following:`, '', `${failedTasksForPrinting
351
+ }
352
+ if (skippedTasks.size > 0) {
353
+ failureSummaryRows.push(output_1.output.dim(`${LEFT_PAD}${pc.yellow('⏭')}${SPACER}${skippedTasks.size}/${totalTasks} targets were skipped.`), '');
354
+ }
355
+ if (displayCompleted !== totalTasks) {
356
+ const remainingTasks = totalTasks - displayCompleted - skippedTasks.size;
357
+ if (displayInProgress.size) {
358
+ failureSummaryRows.push(`${LEFT_PAD}${output_1.output.colors.red(figures.ellipsis)}${SPACER}${displayInProgress.size}${`/${totalTasks}`} targets were in progress, including the following:`, '', `${Array.from(displayInProgress)
314
359
  .map((t) => `${EXTENDED_LEFT_PAD}${output_1.output.colors.red('-')} ${output_1.output.formatCommand(t.toString())}`)
315
- .join('\n')}`, '');
316
- if (failedTasks.size > numFailedToPrint) {
317
- failureSummaryRows.push(output_1.output.dim(`${EXTENDED_LEFT_PAD}...and ${failedTasks.size - numFailedToPrint} more...`));
318
- }
360
+ .join(node_os_1.EOL)}`, '');
319
361
  }
320
- if (displayCompleted !== totalTasks) {
321
- const remainingTasks = totalTasks - displayCompleted;
322
- if (displayInProgress.size) {
323
- failureSummaryRows.push(`${LEFT_PAD}${output_1.output.colors.red(figures.ellipsis)}${SPACER}${displayInProgress.size}${`/${totalTasks}`} targets were in progress, including the following:`, '', `${Array.from(displayInProgress)
324
- .map((t) => `${EXTENDED_LEFT_PAD}${output_1.output.colors.red('-')} ${output_1.output.formatCommand(t.toString())}`)
325
- .join(node_os_1.EOL)}`, '');
326
- }
327
- if (remainingTasks - displayInProgress.size > 0) {
328
- failureSummaryRows.push(output_1.output.dim(`${LEFT_PAD}${output_1.output.colors.red(figures.ellipsis)}${SPACER}${remainingTasks - displayInProgress.size}${`/${totalTasks}`} targets had not started.`), '');
329
- }
362
+ if (remainingTasks - displayInProgress.size > 0) {
363
+ failureSummaryRows.push(output_1.output.dim(`${LEFT_PAD}${output_1.output.colors.red(figures.ellipsis)}${SPACER}${remainingTasks - displayInProgress.size}${`/${totalTasks}`} targets had not started.`), '');
330
364
  }
331
- failureSummaryRows.push(...(0, view_logs_utils_1.viewLogsFooterRows)(failedTasks.size));
332
365
  }
366
+ if (batchWorkerLogs.length > 0) {
367
+ failureSummaryRows.push(...batchWorkerLogRows(), '');
368
+ }
369
+ failureSummaryRows.push(...(0, view_logs_utils_1.viewLogsFooterRows)(failedTasks.size));
333
370
  console.log(output_1.output.colors.red(failureSummaryRows.join(node_os_1.EOL)));
334
371
  }
335
372
  // adds some vertical space after the summary to avoid bunching against terminal
@@ -5,7 +5,7 @@ export declare class BatchProcess {
5
5
  private childProcess;
6
6
  private executorName;
7
7
  /**
8
- * Whether the active output style puts task bytes on the terminal at all.
8
+ * Whether the worker's output is written to the terminal as it streams.
9
9
  * `summary` does not, and its life cycle cannot enforce that here: this
10
10
  * class writes to `output` directly from a stream handler, so without being
11
11
  * told it would print a whole batch into a run that asked for log paths.
@@ -79,7 +79,7 @@ export declare class BatchProcess {
79
79
  private readonly captureNonce;
80
80
  constructor(childProcess: ChildProcess, executorName: string,
81
81
  /**
82
- * Whether the active output style puts task bytes on the terminal at all.
82
+ * Whether the worker's output is written to the terminal as it streams.
83
83
  * `summary` does not, and its life cycle cannot enforce that here: this
84
84
  * class writes to `output` directly from a stream handler, so without being
85
85
  * told it would print a whole batch into a run that asked for log paths.
@@ -12,7 +12,7 @@ const batch_messages_1 = require("../batch/batch-messages");
12
12
  class BatchProcess {
13
13
  constructor(childProcess, executorName,
14
14
  /**
15
- * Whether the active output style puts task bytes on the terminal at all.
15
+ * Whether the worker's output is written to the terminal as it streams.
16
16
  * `summary` does not, and its life cycle cannot enforce that here: this
17
17
  * class writes to `output` directly from a stream handler, so without being
18
18
  * told it would print a whole batch into a run that asked for log paths.
@@ -73,8 +73,6 @@ export declare class TaskOrchestrator {
73
73
  private cleanupPromise;
74
74
  private signalHandlers;
75
75
  private tasksWithPersistedOutput;
76
- /** Batches whose worker log was handed to the life cycle, so it must survive. */
77
- private announcedBatchLogs;
78
76
  constructor(hasher: TaskHasher, initiatingProject: string | undefined, initiatingTasks: Task[], projectGraph: ProjectGraph, taskGraph: TaskGraph, nxJson: NxJsonConfiguration, options: NxArgs & DefaultTasksRunnerOptions, bail: boolean, daemon: DaemonClient,
79
77
  /** What the user named; undefined means they named nothing. */
80
78
  specifiedOutputStyle: OutputStyle | undefined,
@@ -162,9 +160,14 @@ export declare class TaskOrchestrator {
162
160
  applyFromCacheOrRunBatch(doNotSkipCache: boolean, batch: Batch, groupId: number): Promise<TaskResult[]>;
163
161
  private runBatchWave;
164
162
  private runBatch;
163
+ /**
164
+ * Under the TUI, batch worker output reaches only the batch's pane, which
165
+ * closes with the batch (or the TUI, if pinned), so it is captured instead.
166
+ */
167
+ private printsBatchOutput;
165
168
  /**
166
169
  * Tells the life cycle where the batch worker's own log is, when something
167
- * failed and a style that prints nothing would otherwise leave it unread.
170
+ * failed and its output was not printed as it streamed.
168
171
  *
169
172
  * The path is announced rather than the bytes copied into a task: one worker
170
173
  * produces one log, it explains the batch rather than any single task, and a