nx 23.1.0 → 23.1.1

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 (126) hide show
  1. package/dist/bin/nx.js +2 -1
  2. package/dist/src/ai/configure-ai-agents-disclaimer.d.ts +5 -0
  3. package/dist/src/ai/configure-ai-agents-disclaimer.js +31 -0
  4. package/dist/src/analytics/analytics.d.ts +6 -0
  5. package/dist/src/analytics/analytics.js +16 -8
  6. package/dist/src/analytics/index.d.ts +1 -1
  7. package/dist/src/analytics/index.js +2 -1
  8. package/dist/src/command-line/add/add.js +8 -1
  9. package/dist/src/command-line/graph/graph.d.ts +1 -0
  10. package/dist/src/command-line/graph/graph.js +15 -6
  11. package/dist/src/command-line/import/import.js +1 -1
  12. package/dist/src/command-line/init/ai-agent-prompts.d.ts +1 -1
  13. package/dist/src/command-line/init/ai-agent-prompts.js +7 -6
  14. package/dist/src/command-line/init/command-object.js +10 -2
  15. package/dist/src/command-line/init/configure-plugins.js +3 -2
  16. package/dist/src/command-line/init/implementation/add-nx-to-monorepo.js +4 -2
  17. package/dist/src/command-line/init/implementation/add-nx-to-nest.js +4 -3
  18. package/dist/src/command-line/init/implementation/add-nx-to-npm-repo.js +4 -3
  19. package/dist/src/command-line/init/implementation/add-nx-to-turborepo.js +4 -3
  20. package/dist/src/command-line/init/implementation/angular/index.js +4 -2
  21. package/dist/src/command-line/init/implementation/angular/integrated-workspace.js +2 -5
  22. package/dist/src/command-line/init/implementation/angular/legacy-angular-versions.js +3 -0
  23. package/dist/src/command-line/init/implementation/dot-nx/add-nx-scripts.js +4 -1
  24. package/dist/src/command-line/init/implementation/utils.d.ts +3 -3
  25. package/dist/src/command-line/init/implementation/utils.js +22 -3
  26. package/dist/src/command-line/migrate/execute-migration.d.ts +72 -0
  27. package/dist/src/command-line/migrate/execute-migration.js +389 -0
  28. package/dist/src/command-line/migrate/migrate-ui-api.js +17 -12
  29. package/dist/src/command-line/migrate/migrate.d.ts +1 -45
  30. package/dist/src/command-line/migrate/migrate.js +33 -376
  31. package/dist/src/command-line/nx-cloud/connect/connect-to-nx-cloud.js +1 -1
  32. package/dist/src/command-line/nx-cloud/connect/view-logs.js +2 -0
  33. package/dist/src/command-line/release/utils/git.js +6 -2
  34. package/dist/src/command-line/release/utils/release-graph.d.ts +2 -2
  35. package/dist/src/command-line/release/utils/remote-release-clients/github.js +1 -1
  36. package/dist/src/command-line/release/utils/remote-release-clients/gitlab.js +1 -1
  37. package/dist/src/command-line/release/utils/shared.d.ts +2 -2
  38. package/dist/src/command-line/show/show-target/info.js +11 -2
  39. package/dist/src/command-line/show/show-target/inputs.js +50 -153
  40. package/dist/src/command-line/show/show-target/outputs.js +48 -173
  41. package/dist/src/command-line/show/show-target/utils.d.ts +28 -0
  42. package/dist/src/command-line/show/show-target/utils.js +83 -3
  43. package/dist/src/command-line/yargs-utils/shared-options.d.ts +1 -1
  44. package/dist/src/commands-runner/create-command-graph.js +5 -0
  45. package/dist/src/config/nx-json.d.ts +5 -3
  46. package/dist/src/core/graph/main.js +1 -1
  47. package/dist/src/daemon/client/client.d.ts +0 -2
  48. package/dist/src/daemon/client/client.js +17 -19
  49. package/dist/src/daemon/server/handle-tasks-execution-hooks.d.ts +1 -1
  50. package/dist/src/daemon/server/server.js +7 -4
  51. package/dist/src/devkit-internals.d.ts +3 -0
  52. package/dist/src/devkit-internals.js +10 -1
  53. package/dist/src/generators/utils/nx-json.js +13 -3
  54. package/dist/src/hasher/check-task-files.d.ts +86 -0
  55. package/dist/src/hasher/check-task-files.js +378 -0
  56. package/dist/src/native/index.d.ts +21 -2
  57. package/dist/src/native/native-bindings.js +2 -0
  58. package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
  59. package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
  60. package/dist/src/plugins/js/lock-file/npm-parser.js +71 -27
  61. package/dist/src/plugins/js/lock-file/pnpm-parser.js +50 -17
  62. package/dist/src/plugins/js/lock-file/project-graph-pruning.js +1 -1
  63. package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.js +3 -0
  64. package/dist/src/plugins/js/lock-file/yarn-parser.js +32 -5
  65. package/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +12 -4
  66. package/dist/src/plugins/js/utils/register.d.ts +18 -0
  67. package/dist/src/plugins/js/utils/register.js +81 -0
  68. package/dist/src/plugins/js/utils/typescript.d.ts +9 -0
  69. package/dist/src/plugins/js/utils/typescript.js +15 -0
  70. package/dist/src/project-graph/build-project-graph.js +7 -1
  71. package/dist/src/project-graph/error-types.js +41 -1
  72. package/dist/src/project-graph/file-utils.js +6 -1
  73. package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +4 -0
  74. package/dist/src/project-graph/plugins/loaded-nx-plugin.js +1 -0
  75. package/dist/src/project-graph/plugins/transpiler.js +4 -0
  76. package/dist/src/project-graph/project-graph.js +3 -0
  77. package/dist/src/project-graph/utils/project-configuration/name-substitution-manager.d.ts +10 -12
  78. package/dist/src/project-graph/utils/project-configuration/name-substitution-manager.js +93 -63
  79. package/dist/src/project-graph/utils/project-configuration/project-nodes-manager.d.ts +5 -8
  80. package/dist/src/project-graph/utils/project-configuration/project-nodes-manager.js +11 -14
  81. package/dist/src/project-graph/utils/project-configuration/source-maps.d.ts +12 -5
  82. package/dist/src/project-graph/utils/project-configuration/source-maps.js +21 -7
  83. package/dist/src/project-graph/utils/project-configuration/target-defaults.d.ts +1 -1
  84. package/dist/src/project-graph/utils/project-configuration/target-defaults.js +26 -27
  85. package/dist/src/project-graph/utils/project-configuration/target-merging.js +50 -8
  86. package/dist/src/project-graph/utils/project-configuration/target-normalization.js +16 -3
  87. package/dist/src/project-graph/utils/project-configuration/utils.d.ts +15 -0
  88. package/dist/src/project-graph/utils/project-configuration/utils.js +42 -6
  89. package/dist/src/project-graph/utils/project-configuration-utils.d.ts +15 -12
  90. package/dist/src/project-graph/utils/project-configuration-utils.js +79 -101
  91. package/dist/src/tasks-runner/life-cycles/performance-analysis.d.ts +11 -4
  92. package/dist/src/tasks-runner/life-cycles/performance-analysis.js +15 -6
  93. package/dist/src/tasks-runner/life-cycles/performance-life-cycle.js +5 -4
  94. package/dist/src/tasks-runner/life-cycles/performance-report.d.ts +18 -8
  95. package/dist/src/tasks-runner/life-cycles/performance-report.js +66 -29
  96. package/dist/src/tasks-runner/run-command.js +4 -2
  97. package/dist/src/tasks-runner/task-env.d.ts +9 -0
  98. package/dist/src/tasks-runner/task-env.js +26 -2
  99. package/dist/src/tasks-runner/task-orchestrator.d.ts +4 -1
  100. package/dist/src/tasks-runner/task-orchestrator.js +23 -10
  101. package/dist/src/utils/acknowledge-build-scripts.d.ts +13 -0
  102. package/dist/src/utils/acknowledge-build-scripts.js +102 -0
  103. package/dist/src/utils/analytics-prompt.d.ts +0 -6
  104. package/dist/src/utils/analytics-prompt.js +0 -51
  105. package/dist/src/utils/catalog/manager-utils.d.ts +1 -2
  106. package/dist/src/utils/catalog/manager-utils.js +22 -5
  107. package/dist/src/utils/catalog/pnpm-manager.d.ts +1 -0
  108. package/dist/src/utils/catalog/pnpm-manager.js +3 -15
  109. package/dist/src/utils/catalog/yarn-manager.d.ts +1 -0
  110. package/dist/src/utils/catalog/yarn-manager.js +3 -15
  111. package/dist/src/utils/command-line-utils.js +30 -20
  112. package/dist/src/utils/git-revision.d.ts +12 -0
  113. package/dist/src/utils/git-revision.js +25 -0
  114. package/dist/src/utils/git-utils.d.ts +16 -3
  115. package/dist/src/utils/git-utils.js +146 -52
  116. package/dist/src/utils/min-release-age/behavior/pnpm.js +9 -7
  117. package/dist/src/utils/package-json.js +11 -7
  118. package/dist/src/utils/package-manager.d.ts +3 -1
  119. package/dist/src/utils/package-manager.js +28 -4
  120. package/dist/src/utils/provenance.js +12 -2
  121. package/dist/src/utils/workspace-id.d.ts +20 -0
  122. package/dist/src/utils/workspace-id.js +54 -0
  123. package/migrations.json +7 -1
  124. package/package.json +22 -17
  125. package/dist/src/migrations/update-17-3-0/nx-release-path.d.ts +0 -3
  126. package/dist/src/migrations/update-17-3-0/nx-release-path.js +0 -47
package/dist/bin/nx.js CHANGED
@@ -5,6 +5,7 @@
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const tslib_1 = require("tslib");
7
7
  if (process.env.FORCE_COLOR === '0') {
8
+ process.env.NX_ORIGINAL_FORCE_COLOR = '0';
8
9
  process.env.NO_COLOR = '1';
9
10
  delete process.env.FORCE_COLOR;
10
11
  }
@@ -258,7 +259,7 @@ function warnIfUsingOutdatedGlobalInstall(globalNxVersion, localNxVersion) {
258
259
  `Your repository uses a higher version of Nx (${localNxVersion}) than your global CLI version (${globalNxVersion})`,
259
260
  ]
260
261
  : [];
261
- bodyLines.push('For more information, see https://nx.dev/more-concepts/global-nx');
262
+ bodyLines.push('For more information, see https://nx.dev/docs/getting-started/installation#global-installation');
262
263
  output_1.output.warn({
263
264
  title: `It's time to update Nx 🎉`,
264
265
  bodyLines,
@@ -0,0 +1,5 @@
1
+ import { AgentStatusInfo } from '../daemon/message-types/configure-ai-agents';
2
+ /**
3
+ * Whether to show the "configure-ai-agents is outdated" banner after a task run.
4
+ */
5
+ export declare function shouldPrintConfigureAiAgentsDisclaimer(outdatedAgents: AgentStatusInfo[], workspaceRoot: string): boolean;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.shouldPrintConfigureAiAgentsDisclaimer = shouldPrintConfigureAiAgentsDisclaimer;
4
+ const fs_1 = require("fs");
5
+ const detect_ai_agent_1 = require("./detect-ai-agent");
6
+ const constants_1 = require("./constants");
7
+ /**
8
+ * Whether to show the "configure-ai-agents is outdated" banner after a task run.
9
+ */
10
+ function shouldPrintConfigureAiAgentsDisclaimer(outdatedAgents, workspaceRoot) {
11
+ if (outdatedAgents.length === 0) {
12
+ return false;
13
+ }
14
+ const detectedAgent = (0, detect_ai_agent_1.detectAiAgent)();
15
+ if (detectedAgent) {
16
+ return outdatedAgents.some((agent) => agent.name === detectedAgent);
17
+ }
18
+ // Unsupported agents (e.g. qwen) cannot be configured via `nx configure-ai-agents`.
19
+ // If the repo already has Nx rules in AGENTS.md, skip the misleading warning.
20
+ const agentsMd = (0, constants_1.agentsMdPath)(workspaceRoot);
21
+ if (!(0, fs_1.existsSync)(agentsMd)) {
22
+ return true;
23
+ }
24
+ try {
25
+ const content = (0, fs_1.readFileSync)(agentsMd, 'utf-8');
26
+ return !constants_1.rulesRegex.test(content);
27
+ }
28
+ catch {
29
+ return true;
30
+ }
31
+ }
@@ -1,6 +1,12 @@
1
1
  import type { EventDimensions } from '../native';
2
2
  export declare const customDimensions: EventDimensions;
3
3
  export type EventParameters = Partial<Record<EventDimensions[keyof EventDimensions], string | number | boolean>>;
4
+ /**
5
+ * Fraction of sessions that report perf spans. Stamping this rate on a
6
+ * measure's detail (as the sampleRate dimension) opts it into sampling; see
7
+ * is_sampled_in in native/telemetry/service.rs. Multiply GA counts by 1/rate.
8
+ */
9
+ export declare const PERF_SPAN_SAMPLE_RATE = 0.1;
4
10
  export declare function startAnalytics(): Promise<void>;
5
11
  export declare function reportNxAddCommand(packageName: string, version: string): void;
6
12
  export declare function reportNxGenerateCommand(generator: string): void;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.customDimensions = void 0;
3
+ exports.PERF_SPAN_SAMPLE_RATE = exports.customDimensions = void 0;
4
4
  exports.startAnalytics = startAnalytics;
5
5
  exports.reportNxAddCommand = reportNxAddCommand;
6
6
  exports.reportNxGenerateCommand = reportNxGenerateCommand;
@@ -19,7 +19,7 @@ const os = tslib_1.__importStar(require("os"));
19
19
  const crypto_1 = require("crypto");
20
20
  const machine_id_cache_1 = require("../utils/machine-id-cache");
21
21
  const is_ci_1 = require("../utils/is-ci");
22
- const analytics_prompt_1 = require("../utils/analytics-prompt");
22
+ const workspace_id_1 = require("../utils/workspace-id");
23
23
  const db_connection_1 = require("../utils/db-connection");
24
24
  // Conditionally import telemetry functions only on non-WASM platforms
25
25
  let initializeTelemetry;
@@ -42,6 +42,12 @@ exports.customDimensions = native_1.IS_WASM
42
42
  ? null
43
43
  : (getEventDimensions?.() ?? null);
44
44
  let _telemetryInitialized = false;
45
+ /**
46
+ * Fraction of sessions that report perf spans. Stamping this rate on a
47
+ * measure's detail (as the sampleRate dimension) opts it into sampling; see
48
+ * is_sampled_in in native/telemetry/service.rs. Multiply GA counts by 1/rate.
49
+ */
50
+ exports.PERF_SPAN_SAMPLE_RATE = 0.1;
45
51
  async function startAnalytics() {
46
52
  // Analytics not supported on WASM
47
53
  if (native_1.IS_WASM) {
@@ -52,17 +58,20 @@ async function startAnalytics() {
52
58
  // detection, machine id, telemetry init) may throw past this boundary -
53
59
  // on any failure, continue without telemetry.
54
60
  try {
55
- if (!isAnalyticsEnabled()) {
61
+ const nxJson = (0, nx_json_1.readNxJson)(workspace_root_1.workspaceRoot);
62
+ if (!isAnalyticsEnabled(nxJson)) {
56
63
  return;
57
64
  }
58
- const nxJson = (0, nx_json_1.readNxJson)(workspace_root_1.workspaceRoot);
59
- const workspaceId = (0, analytics_prompt_1.generateWorkspaceId)();
65
+ const workspaceId = (0, workspace_id_1.generateWorkspaceId)(workspace_root_1.workspaceRoot, nxJson);
60
66
  if (!workspaceId) {
61
67
  // Not a git repo — no telemetry
62
68
  return;
63
69
  }
64
70
  const isNxCloud = !!(nxJson?.nxCloudId ?? nxJson?.nxCloudAccessToken);
65
- const userId = await getTelemetryUserId(workspaceId);
71
+ // A CI fleet is not a user: shared images bake in /etc/machine-id, so a
72
+ // uid would collapse whole fleets into one GA "user" (and trip per-user
73
+ // collection caps). GA falls back to cid = workspace for CI traffic.
74
+ const userId = (0, is_ci_1.isCI)() ? undefined : await getTelemetryUserId(workspaceId);
66
75
  const packageManagerInfo = getPackageManagerInfo();
67
76
  const nodeVersion = (0, semver_1.parse)(process.version);
68
77
  const nodeVersionString = nodeVersion
@@ -226,8 +235,7 @@ function getPackageManagerInfo() {
226
235
  version: (0, package_manager_1.getPackageManagerVersion)(pm),
227
236
  };
228
237
  }
229
- function isAnalyticsEnabled() {
230
- const nxJson = (0, nx_json_1.readNxJson)(workspace_root_1.workspaceRoot);
238
+ function isAnalyticsEnabled(nxJson) {
231
239
  return nxJson?.analytics === true;
232
240
  }
233
241
  // Mix workspace id in: shared Docker images (Gitpod, Cypress, etc.) bake
@@ -1 +1 @@
1
- export { customDimensions, EventParameters, startAnalytics, reportNxAddCommand, reportNxGenerateCommand, reportCommandRunEvent, reportEvent, flushAnalytics, } from './analytics';
1
+ export { customDimensions, EventParameters, PERF_SPAN_SAMPLE_RATE, startAnalytics, reportNxAddCommand, reportNxGenerateCommand, reportCommandRunEvent, reportEvent, flushAnalytics, } from './analytics';
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.flushAnalytics = exports.reportEvent = exports.reportCommandRunEvent = exports.reportNxGenerateCommand = exports.reportNxAddCommand = exports.startAnalytics = exports.customDimensions = void 0;
3
+ exports.flushAnalytics = exports.reportEvent = exports.reportCommandRunEvent = exports.reportNxGenerateCommand = exports.reportNxAddCommand = exports.startAnalytics = exports.PERF_SPAN_SAMPLE_RATE = exports.customDimensions = void 0;
4
4
  var analytics_1 = require("./analytics");
5
5
  Object.defineProperty(exports, "customDimensions", { enumerable: true, get: function () { return analytics_1.customDimensions; } });
6
+ Object.defineProperty(exports, "PERF_SPAN_SAMPLE_RATE", { enumerable: true, get: function () { return analytics_1.PERF_SPAN_SAMPLE_RATE; } });
6
7
  Object.defineProperty(exports, "startAnalytics", { enumerable: true, get: function () { return analytics_1.startAnalytics; } });
7
8
  Object.defineProperty(exports, "reportNxAddCommand", { enumerable: true, get: function () { return analytics_1.reportNxAddCommand; } });
8
9
  Object.defineProperty(exports, "reportNxGenerateCommand", { enumerable: true, get: function () { return analytics_1.reportNxGenerateCommand; } });
@@ -38,9 +38,16 @@ async function installPackage(pkgName, version, nxJson) {
38
38
  const pmv = (0, package_manager_1.getPackageManagerVersion)(pm);
39
39
  const pmc = (0, package_manager_1.getPackageManagerCommand)(pm);
40
40
  // if we explicitly specify latest in yarn berry, it won't resolve the version
41
- const command = pm === 'yarn' && (0, semver_1.gte)(pmv, '2.0.0') && version === 'latest'
41
+ let command = pm === 'yarn' && (0, semver_1.gte)(pmv, '2.0.0') && version === 'latest'
42
42
  ? `${pmc.addDev} ${pkgName}`
43
43
  : `${pmc.addDev} ${pkgName}@${version}`;
44
+ // pnpm 11+ fails the install when the plugin's own dependency tree
45
+ // carries unacknowledged build scripts, and the plugin's generators can
46
+ // only record allowBuilds decisions after this install. Warn and skip
47
+ // for this one install, like pnpm 10 did.
48
+ if (pm === 'pnpm' && (0, semver_1.gte)(pmv, '11.0.0')) {
49
+ command += ' --config.strictDepBuilds=false';
50
+ }
44
51
  await new Promise((resolve) => (0, child_process_1.exec)(command, {
45
52
  windowsHide: true,
46
53
  }, (error, stdout, stderr) => {
@@ -50,6 +50,7 @@ export declare function generateGraph(args: {
50
50
  exclude?: string[];
51
51
  affected?: boolean;
52
52
  }, affectedProjects: string[]): Promise<void>;
53
+ export declare function getExpandedTaskInputs(depGraphClientResponse: ProjectGraphClientResponse, expandedTaskInputsCache: Map<string, Record<string, string[]>>, taskId: string): Promise<Record<string, string[]>>;
53
54
  /**
54
55
  * The data type that `nx graph --file graph.json` or `nx build --graph graph.json` contains
55
56
  */
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generateGraph = generateGraph;
4
+ exports.getExpandedTaskInputs = getExpandedTaskInputs;
4
5
  const tslib_1 = require("tslib");
5
6
  const crypto_1 = require("crypto");
6
7
  const node_child_process_1 = require("node:child_process");
@@ -9,7 +10,6 @@ const daemon_socket_messenger_1 = require("../../daemon/client/daemon-socket-mes
9
10
  const http = tslib_1.__importStar(require("node:http"));
10
11
  const minimatch_1 = require("minimatch");
11
12
  const node_url_1 = require("node:url");
12
- const open_1 = tslib_1.__importDefault(require("open"));
13
13
  const node_path_1 = require("node:path");
14
14
  const net = tslib_1.__importStar(require("node:net"));
15
15
  const node_perf_hooks_1 = require("node:perf_hooks");
@@ -34,6 +34,7 @@ const create_task_hasher_1 = require("../../hasher/create-task-hasher");
34
34
  const task_env_1 = require("../../tasks-runner/task-env");
35
35
  const error_types_1 = require("../../project-graph/error-types");
36
36
  const nx_cloud_utils_1 = require("../../utils/nx-cloud-utils");
37
+ const split_target_1 = require("../../utils/split-target");
37
38
  // maps file extention to MIME types
38
39
  const mimeType = {
39
40
  '.ico': 'image/x-icon',
@@ -349,7 +350,11 @@ async function generateGraph(args, affectedProjects) {
349
350
  title: `Project graph started at ${url.toString()}`,
350
351
  });
351
352
  if (args.open) {
352
- (0, open_1.default)(url.toString());
353
+ new Function('return import("open")')()
354
+ .then((m) => m.default(url.toString()))
355
+ .catch(() => {
356
+ // Ignore errors when opening browser (e.g. no browser available)
357
+ });
353
358
  }
354
359
  return new Promise((res) => {
355
360
  app.once('close', res);
@@ -438,7 +443,7 @@ async function startServer(html, environmentJs, host, port = 4211, watchForChang
438
443
  node_perf_hooks_1.performance.mark('task input generation:start');
439
444
  const taskId = parsedUrl.searchParams.get('taskId');
440
445
  res.writeHead(200, { 'Content-Type': 'application/json' });
441
- const inputs = await getExpandedTaskInputs(taskId);
446
+ const inputs = await getExpandedTaskInputs(currentProjectGraphClientResponse, expandedTaskInputsCache, taskId);
442
447
  node_perf_hooks_1.performance.mark('task input generation:end');
443
448
  res.end(JSON.stringify({ [taskId]: inputs }));
444
449
  node_perf_hooks_1.performance.measure('task input generation', 'task input generation:start', 'task input generation:end');
@@ -823,19 +828,23 @@ async function createTaskGraphForTargetsAndProjects(targetNames, projectNames, c
823
828
  };
824
829
  }
825
830
  }
826
- async function getExpandedTaskInputs(taskId) {
831
+ async function getExpandedTaskInputs(depGraphClientResponse, expandedTaskInputsCache, taskId) {
827
832
  // Check cache first
828
833
  if (expandedTaskInputsCache.has(taskId)) {
829
834
  return expandedTaskInputsCache.get(taskId);
830
835
  }
831
836
  // Use the optimized version that only creates the specific task graph needed
832
- const [projectName, targetName, configuration] = taskId.split(':');
837
+ // Use colon-aware splitting so that target names containing colons
838
+ // (e.g. "test:integration") are parsed correctly instead of being
839
+ // mistaken for a target + configuration pair.
840
+ const projectNodes = Object.fromEntries(depGraphClientResponse.projects.map((p) => [p.name, p]));
841
+ const [projectName, targetName, configuration] = (0, split_target_1.splitTargetFromNodes)(taskId, projectNodes, { silent: true });
833
842
  const taskGraphResponse = await createTaskGraphForTargetsAndProjects([targetName], [projectName], configuration);
834
843
  const allWorkspaceFiles = await (0, all_file_data_1.allFileData)();
835
844
  const inputs = taskGraphResponse.plans?.[taskId];
836
845
  let result = {};
837
846
  if (inputs) {
838
- result = expandInputs(inputs, currentProjectGraphClientResponse.projects.find((p) => p.name === projectName), allWorkspaceFiles, currentProjectGraphClientResponse);
847
+ result = expandInputs(inputs, depGraphClientResponse.projects.find((p) => p.name === projectName), allWorkspaceFiles, depGraphClientResponse);
839
848
  }
840
849
  // Cache the result
841
850
  expandedTaskInputsCache.set(taskId, result);
@@ -489,7 +489,7 @@ async function runInstallDestinationRepo(packageManager, destinationGitClient) {
489
489
  output_1.output.log({
490
490
  title: 'Installing dependencies for imported code',
491
491
  });
492
- (0, utils_1.runInstall)(workspace_root_1.workspaceRoot, (0, package_manager_1.getPackageManagerCommand)(packageManager));
492
+ (0, utils_1.runInstall)(workspace_root_1.workspaceRoot, packageManager, (0, package_manager_1.getPackageManagerCommand)(packageManager));
493
493
  await destinationGitClient.amendCommit();
494
494
  }
495
495
  catch (e) {
@@ -1,2 +1,2 @@
1
1
  import { Agent } from '../../ai/utils';
2
- export declare function determineAiAgents(aiAgents?: Agent[], interactive?: boolean): Promise<Agent[]>;
2
+ export declare function determineAiAgents(aiAgents?: (Agent | 'none')[], interactive?: boolean): Promise<Agent[]>;
@@ -8,16 +8,17 @@ const utils_1 = require("../../ai/utils");
8
8
  const detect_ai_agent_1 = require("../../ai/detect-ai-agent");
9
9
  const pc = tslib_1.__importStar(require("picocolors"));
10
10
  async function determineAiAgents(aiAgents, interactive) {
11
- if (interactive === false || (0, is_ci_1.isCI)()) {
12
- if (aiAgents) {
13
- return aiAgents;
11
+ if (aiAgents) {
12
+ const filtered = aiAgents.filter((a) => a !== 'none');
13
+ if (filtered.length > 0) {
14
+ return filtered;
14
15
  }
16
+ return [];
17
+ }
18
+ if (interactive === false || (0, is_ci_1.isCI)()) {
15
19
  const detected = (0, detect_ai_agent_1.detectAiAgent)();
16
20
  return detected ? [detected] : [];
17
21
  }
18
- if (aiAgents) {
19
- return aiAgents;
20
- }
21
22
  return await aiAgentsPrompt();
22
23
  }
23
24
  async function aiAgentsPrompt() {
@@ -64,8 +64,16 @@ async function withInitOptions(yargs) {
64
64
  .option('aiAgents', {
65
65
  type: 'array',
66
66
  string: true,
67
- description: 'List of AI agents to set up.',
68
- choices: ['claude', 'codex', 'copilot', 'cursor', 'gemini', 'opencode'],
67
+ description: 'List of AI agents to set up. Use "none" to skip.',
68
+ choices: [
69
+ 'claude',
70
+ 'codex',
71
+ 'copilot',
72
+ 'cursor',
73
+ 'gemini',
74
+ 'opencode',
75
+ 'none',
76
+ ],
69
77
  })
70
78
  .option('plugins', {
71
79
  type: 'string',
@@ -25,8 +25,9 @@ function installPluginPackages(repoRoot, pmc = (0, package_manager_1.getPackageM
25
25
  return;
26
26
  }
27
27
  if ((0, fs_1.existsSync)((0, path_1.join)(repoRoot, 'package.json'))) {
28
- (0, utils_1.addDepsToPackageJson)(repoRoot, plugins);
29
- (0, utils_1.runInstall)(repoRoot, pmc);
28
+ const packageManager = (0, package_manager_1.detectPackageManager)(repoRoot);
29
+ (0, utils_1.addDepsToPackageJson)(repoRoot, packageManager, plugins);
30
+ (0, utils_1.runInstall)(repoRoot, packageManager, pmc);
30
31
  }
31
32
  else {
32
33
  const nxJson = (0, configuration_1.readNxJson)(repoRoot);
@@ -7,6 +7,7 @@ const ignore = require("ignore");
7
7
  const path_1 = require("path");
8
8
  const fileutils_1 = require("../../../utils/fileutils");
9
9
  const output_1 = require("../../../utils/output");
10
+ const package_manager_1 = require("../../../utils/package-manager");
10
11
  const utils_1 = require("./utils");
11
12
  const connect_to_nx_cloud_1 = require("../../nx-cloud/connect/connect-to-nx-cloud");
12
13
  async function addNxToMonorepo(options, guided = true) {
@@ -76,9 +77,10 @@ async function addNxToMonorepo(options, guided = true) {
76
77
  }
77
78
  (0, utils_1.createNxJsonFile)(repoRoot, targetDefaults, cacheableOperations, scriptOutputs);
78
79
  (0, utils_1.updateGitIgnore)(repoRoot);
79
- (0, utils_1.addDepsToPackageJson)(repoRoot);
80
+ const packageManager = (0, package_manager_1.detectPackageManager)(repoRoot);
81
+ (0, utils_1.addDepsToPackageJson)(repoRoot, packageManager);
80
82
  output_1.output.log({ title: '📦 Installing dependencies' });
81
- (0, utils_1.runInstall)(repoRoot);
83
+ (0, utils_1.runInstall)(repoRoot, packageManager);
82
84
  if (nxCloudChoice === 'yes') {
83
85
  output_1.output.log({ title: '🛠️ Setting up Nx Cloud' });
84
86
  await (0, utils_1.initCloud)('nx-init-monorepo');
@@ -86,9 +86,10 @@ async function addNxToNest(options, packageJson) {
86
86
  : 'skip';
87
87
  }
88
88
  (0, utils_1.createNxJsonFile)(repoRoot, [], [...cacheableOperations, ...nestCacheableScripts], scriptOutputs);
89
- const pmc = (0, package_manager_1.getPackageManagerCommand)();
89
+ const packageManager = (0, package_manager_1.detectPackageManager)(repoRoot);
90
+ const pmc = (0, package_manager_1.getPackageManagerCommand)(packageManager);
90
91
  (0, utils_1.updateGitIgnore)(repoRoot);
91
- (0, utils_1.addDepsToPackageJson)(repoRoot);
92
+ (0, utils_1.addDepsToPackageJson)(repoRoot, packageManager);
92
93
  addNestPluginToPackageJson(repoRoot);
93
94
  (0, utils_1.markRootPackageJsonAsNxProjectLegacy)(repoRoot, cacheableOperations, pmc);
94
95
  createProjectJson(repoRoot, packageJson, nestCLIConfiguration);
@@ -98,7 +99,7 @@ async function addNxToNest(options, packageJson) {
98
99
  updateTsConfig(repoRoot, nestCLIConfiguration.sourceRoot);
99
100
  }
100
101
  output_1.output.log({ title: '📦 Installing dependencies' });
101
- (0, utils_1.runInstall)(repoRoot);
102
+ (0, utils_1.runInstall)(repoRoot, packageManager, pmc);
102
103
  if (nxCloudChoice === 'yes') {
103
104
  output_1.output.log({ title: '🛠️ Setting up Nx Cloud' });
104
105
  await (0, utils_1.initCloud)('nx-init-nest');
@@ -61,9 +61,10 @@ async function addNxToNpmRepo(options, guided = true) {
61
61
  : 'skip';
62
62
  }
63
63
  (0, utils_1.createNxJsonFile)(repoRoot, [], cacheableOperations, scriptOutputs);
64
- const pmc = (0, package_manager_1.getPackageManagerCommand)();
64
+ const packageManager = (0, package_manager_1.detectPackageManager)(repoRoot);
65
+ const pmc = (0, package_manager_1.getPackageManagerCommand)(packageManager);
65
66
  (0, utils_1.updateGitIgnore)(repoRoot);
66
- (0, utils_1.addDepsToPackageJson)(repoRoot);
67
+ (0, utils_1.addDepsToPackageJson)(repoRoot, packageManager);
67
68
  if (options.legacy) {
68
69
  (0, utils_1.markRootPackageJsonAsNxProjectLegacy)(repoRoot, cacheableOperations, pmc);
69
70
  }
@@ -71,7 +72,7 @@ async function addNxToNpmRepo(options, guided = true) {
71
72
  (0, utils_1.markPackageJsonAsNxProject)((0, path_1.join)(repoRoot, 'package.json'));
72
73
  }
73
74
  output_1.output.log({ title: '📦 Installing dependencies' });
74
- (0, utils_1.runInstall)(repoRoot, pmc);
75
+ (0, utils_1.runInstall)(repoRoot, packageManager, pmc);
75
76
  if (nxCloudChoice === 'yes') {
76
77
  output_1.output.log({ title: '🛠️ Setting up Nx Cloud' });
77
78
  await (0, utils_1.initCloud)('nx-init-npm-repo');
@@ -42,9 +42,10 @@ async function addNxToTurborepo(_options) {
42
42
  // Apply fallback JSON write
43
43
  (0, fileutils_1.writeJsonFile)(nxJsonPath, nxJson);
44
44
  }
45
- const pmc = (0, package_manager_1.getPackageManagerCommand)();
45
+ const packageManager = (0, package_manager_1.detectPackageManager)(repoRoot);
46
+ const pmc = (0, package_manager_1.getPackageManagerCommand)(packageManager);
46
47
  (0, utils_1.updateGitIgnore)(repoRoot);
47
- (0, utils_1.addDepsToPackageJson)(repoRoot);
48
+ (0, utils_1.addDepsToPackageJson)(repoRoot, packageManager);
48
49
  output_1.output.log({ title: '📦 Installing dependencies' });
49
- (0, utils_1.runInstall)(repoRoot, pmc);
50
+ (0, utils_1.runInstall)(repoRoot, packageManager, pmc);
50
51
  }
@@ -7,6 +7,7 @@ const fileutils_1 = require("../../../../utils/fileutils");
7
7
  const versions_1 = require("../../../../utils/versions");
8
8
  const object_sort_1 = require("../../../../utils/object-sort");
9
9
  const output_1 = require("../../../../utils/output");
10
+ const package_manager_1 = require("../../../../utils/package-manager");
10
11
  const package_json_1 = require("../../../../utils/package-json");
11
12
  const utils_1 = require("../utils");
12
13
  const integrated_workspace_1 = require("./integrated-workspace");
@@ -86,9 +87,10 @@ async function collectCacheableOperations(options) {
86
87
  return cacheableOperations;
87
88
  }
88
89
  function installDependencies() {
89
- (0, utils_1.addDepsToPackageJson)(repoRoot);
90
+ const packageManager = (0, package_manager_1.detectPackageManager)(repoRoot);
91
+ (0, utils_1.addDepsToPackageJson)(repoRoot, packageManager);
90
92
  addPluginDependencies();
91
- (0, utils_1.runInstall)(repoRoot);
93
+ (0, utils_1.runInstall)(repoRoot, packageManager);
92
94
  }
93
95
  function addPluginDependencies() {
94
96
  const packageJsonPath = (0, path_1.join)(repoRoot, 'package.json');
@@ -1,12 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.setupIntegratedWorkspace = setupIntegratedWorkspace;
4
- const child_process_1 = require("child_process");
5
- const package_manager_1 = require("../../../../utils/package-manager");
4
+ const child_process_1 = require("../../../../utils/child-process");
6
5
  function setupIntegratedWorkspace() {
7
- const pmc = (0, package_manager_1.getPackageManagerCommand)();
8
- (0, child_process_1.execSync)(`${pmc.exec} nx g @nx/angular:ng-add`, {
6
+ (0, child_process_1.runNxSync)(`g @nx/angular:ng-add`, {
9
7
  stdio: [0, 1, 2],
10
- windowsHide: true,
11
8
  });
12
9
  }
@@ -107,6 +107,9 @@ async function getLegacyMigrationFunctionIfApplicable(repoRoot, options) {
107
107
  unscopedPkgName,
108
108
  }, pmc);
109
109
  output_1.output.log({ title: '📝 Setting up workspace' });
110
+ // Intentionally not runNxSync: legacyMigrationCommand is either the Angular
111
+ // CLI (`ng g ...:ng-add`) or a version-pinned `nx@<version> init`, neither
112
+ // of which is the local nx that runNxSync would resolve.
110
113
  (0, child_process_1.execSync)(`${pmc.exec} ${legacyMigrationCommand}`, {
111
114
  stdio: [0, 1, 2],
112
115
  windowsHide: true,
@@ -69,7 +69,10 @@ function generateDotNxSetup(version) {
69
69
  (0, tree_1.flushChanges)(host.root, changes);
70
70
  // Ensure that the dot-nx installation is available.
71
71
  // This is needed when using a global nx with dot-nx, otherwise running any nx command using global command will fail due to missing modules.
72
- // Pipe stderr so failures surface in telemetry instead of bare "Command failed: ./nx --version".
72
+ // Intentionally not runNxSync: when the repo has a package.json it would run
73
+ // `<pm> exec nx` instead of the wrapper, but this call must run the
74
+ // just-written wrapper itself so it bootstraps .nx/installation.
75
+ // Pipe stderr so failures surface in telemetry instead of bare "Command failed".
73
76
  try {
74
77
  (0, child_process_1.execSync)(getDotNxWrapperVersionCommand(), {
75
78
  stdio: ['ignore', 'ignore', 'pipe'],
@@ -1,6 +1,6 @@
1
1
  import { NxJsonConfiguration, TargetDefaultEntry, TargetDefaults } from '../../../config/nx-json';
2
2
  import { PackageJson } from '../../../utils/package-json';
3
- import { PackageManagerCommands } from '../../../utils/package-manager';
3
+ import { PackageManager, PackageManagerCommands } from '../../../utils/package-manager';
4
4
  export declare function createNxJsonFile(repoRoot: string, topologicalTargets: string[], cacheableOperations: string[], scriptOutputs: {
5
5
  [name: string]: string;
6
6
  }): void;
@@ -13,9 +13,9 @@ export declare function createNxJsonFile(repoRoot: string, topologicalTargets: s
13
13
  */
14
14
  export declare function upsertTargetDefaultEntry(targetDefaults: TargetDefaults, target: string, patch: Partial<TargetDefaultEntry>): void;
15
15
  export declare function createNxJsonFromTurboJson(turboJson: Record<string, any>): NxJsonConfiguration;
16
- export declare function addDepsToPackageJson(repoRoot: string, additionalPackages?: string[]): void;
16
+ export declare function addDepsToPackageJson(repoRoot: string, packageManager: PackageManager, additionalPackages?: string[]): void;
17
17
  export declare function updateGitIgnore(root: string): void;
18
- export declare function runInstall(repoRoot: string, pmc?: PackageManagerCommands): void;
18
+ export declare function runInstall(repoRoot: string, packageManager?: PackageManager, pmc?: PackageManagerCommands): void;
19
19
  /**
20
20
  * Coerce any thrown value into a non-empty telemetry string. The naive
21
21
  * `error.message || String(error)` yields "" for bare `new Error()`.
@@ -18,9 +18,11 @@ exports.printFinalMessage = printFinalMessage;
18
18
  exports.isMonorepo = isMonorepo;
19
19
  const child_process_1 = require("child_process");
20
20
  const path_1 = require("path");
21
+ const semver_1 = require("semver");
21
22
  const fileutils_1 = require("../../../utils/fileutils");
22
23
  const output_1 = require("../../../utils/output");
23
24
  const package_manager_1 = require("../../../utils/package-manager");
25
+ const acknowledge_build_scripts_1 = require("../../../utils/acknowledge-build-scripts");
24
26
  const path_2 = require("../../../utils/path");
25
27
  const versions_1 = require("../../../utils/versions");
26
28
  const fs_1 = require("fs");
@@ -207,7 +209,7 @@ function createNxJsonFromTurboJson(turboJson) {
207
209
  }
208
210
  return nxJson;
209
211
  }
210
- function addDepsToPackageJson(repoRoot, additionalPackages) {
212
+ function addDepsToPackageJson(repoRoot, packageManager, additionalPackages) {
211
213
  const path = (0, path_2.joinPathFragments)(repoRoot, `package.json`);
212
214
  const json = (0, fileutils_1.readJsonFile)(path);
213
215
  if (!json.devDependencies)
@@ -219,6 +221,9 @@ function addDepsToPackageJson(repoRoot, additionalPackages) {
219
221
  }
220
222
  }
221
223
  (0, fileutils_1.writeJsonFile)(path, json);
224
+ // nx has a postinstall script, which pnpm 11+ refuses to install
225
+ // unacknowledged.
226
+ (0, acknowledge_build_scripts_1.acknowledgeBuildScripts)(repoRoot, packageManager, { nx: true });
222
227
  }
223
228
  function updateGitIgnore(root) {
224
229
  const ignorePath = (0, path_1.join)(root, '.gitignore');
@@ -251,9 +256,23 @@ function updateGitIgnore(root) {
251
256
  }
252
257
  catch { }
253
258
  }
254
- function runInstall(repoRoot, pmc = (0, package_manager_1.getPackageManagerCommand)()) {
259
+ function runInstall(repoRoot, packageManager = (0, package_manager_1.detectPackageManager)(repoRoot), pmc = (0, package_manager_1.getPackageManagerCommand)(packageManager)) {
260
+ let command = pmc.install;
261
+ // Plugins added during init can pull build-script deps whose allowBuilds
262
+ // entries are only recorded by their init generators after this install;
263
+ // warn and skip for this one install, like pnpm 10 did.
264
+ if (packageManager === 'pnpm') {
265
+ try {
266
+ if ((0, semver_1.gte)((0, package_manager_1.getPackageManagerVersion)('pnpm', repoRoot), '11.0.0')) {
267
+ command += ' --config.strictDepBuilds=false';
268
+ }
269
+ }
270
+ catch {
271
+ // The version cannot be probed; run the install unmodified.
272
+ }
273
+ }
255
274
  try {
256
- (0, child_process_1.execSync)(pmc.install, {
275
+ (0, child_process_1.execSync)(command, {
257
276
  stdio: ['ignore', 'ignore', 'pipe'],
258
277
  encoding: 'utf8',
259
278
  cwd: repoRoot,
@@ -0,0 +1,72 @@
1
+ import { MigrationsJson } from '../../config/misc-interfaces';
2
+ import { FileChange } from '../../generators/tree';
3
+ import { ArrayPackageGroup, NxMigrationsConfiguration, PackageJson } from '../../utils/package-json';
4
+ interface PackageMigrationConfig extends NxMigrationsConfiguration {
5
+ packageJson: PackageJson;
6
+ packageGroup: ArrayPackageGroup;
7
+ }
8
+ export declare function readPackageMigrationConfig(packageName: string, dir: string): PackageMigrationConfig;
9
+ export declare function runInstall(nxWorkspaceRoot?: string, phase?: MigrationInstallPhase): Promise<void>;
10
+ export type MigrationInstallPhase = 'pre-migration' | 'post-migration';
11
+ export declare class NpmPeerDepsInstallError extends Error {
12
+ constructor();
13
+ }
14
+ /**
15
+ * Detects npm peer-dependency resolution failures. Keyed on the `ERESOLVE`
16
+ * error code, which npm consistently emits for this class of failure across
17
+ * v7+ (`npm ERR! code ERESOLVE` / `npm error code ERESOLVE`). Falls back to a
18
+ * small set of stable phrases in case the code line is missing from the
19
+ * captured output.
20
+ */
21
+ export declare function isNpmPeerDepsError(stderr: string): boolean;
22
+ export declare function logNpmPeerDepsError(phase: MigrationInstallPhase): void;
23
+ export declare class ChangedDepInstaller {
24
+ private readonly root;
25
+ private readonly shouldSkipInstall;
26
+ private initialDeps;
27
+ private _skippedInstall;
28
+ constructor(root: string, shouldSkipInstall?: boolean);
29
+ get skippedInstall(): boolean;
30
+ installDepsIfChanged(): Promise<void>;
31
+ }
32
+ export declare function runNxOrAngularMigration(root: string, migration: {
33
+ package: string;
34
+ name: string;
35
+ description?: string;
36
+ version: string;
37
+ }, isVerbose: boolean, captureGeneratorOutput?: boolean, resolvedCollection?: {
38
+ collection: MigrationsJson;
39
+ collectionPath: string;
40
+ }): Promise<{
41
+ changes: FileChange[];
42
+ nextSteps: string[];
43
+ agentContext: string[];
44
+ logs: string;
45
+ madeChanges: boolean;
46
+ }>;
47
+ export declare function getStringifiedPackageJsonDeps(root: string): string;
48
+ export declare function runNxMigration(root: string, collectionPath: string, collection: MigrationsJson, name: string, migrationVersion: string | undefined, captureGeneratorOutput: boolean): Promise<{
49
+ changes: FileChange[];
50
+ nextSteps: string[];
51
+ agentContext: string[];
52
+ logs: string;
53
+ }>;
54
+ export declare function parseMigrationReturn(value: unknown): {
55
+ nextSteps: string[];
56
+ agentContext: string[];
57
+ };
58
+ export declare function filterStrings(value: unknown): string[];
59
+ export declare function readMigrationCollection(packageName: string, root: string): {
60
+ collection: MigrationsJson;
61
+ collectionPath: string;
62
+ };
63
+ export declare function getImplementationPath(collection: MigrationsJson, collectionPath: string, name: string, migrationVersion?: string): {
64
+ path: string;
65
+ fnSymbol: string;
66
+ };
67
+ export declare class MigrationImplementationMissingError extends Error {
68
+ constructor(baseMessage: string, collectionPath: string, migrationVersion: string | undefined);
69
+ }
70
+ export declare function isAngularMigration(collection: MigrationsJson, name: string): import("../../config/misc-interfaces").MigrationsJsonEntry;
71
+ export declare const getNgCompatLayer: () => Promise<typeof import("../../adapter/ngcli-adapter")>;
72
+ export {};