nx 22.5.0 → 22.5.2

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 (64) hide show
  1. package/LICENSE +1 -1
  2. package/bin/init-local.d.ts.map +1 -1
  3. package/bin/init-local.js +1 -0
  4. package/package.json +13 -13
  5. package/src/ai/constants.d.ts +7 -1
  6. package/src/ai/constants.d.ts.map +1 -1
  7. package/src/ai/constants.js +4 -3
  8. package/src/ai/set-up-ai-agents/get-agent-rules.d.ts +5 -1
  9. package/src/ai/set-up-ai-agents/get-agent-rules.d.ts.map +1 -1
  10. package/src/ai/set-up-ai-agents/get-agent-rules.js +4 -3
  11. package/src/ai/set-up-ai-agents/set-up-ai-agents.d.ts.map +1 -1
  12. package/src/ai/set-up-ai-agents/set-up-ai-agents.js +59 -1
  13. package/src/command-line/configure-ai-agents/configure-ai-agents.d.ts.map +1 -1
  14. package/src/command-line/configure-ai-agents/configure-ai-agents.js +22 -0
  15. package/src/command-line/release/index.d.ts +1 -1
  16. package/src/command-line/release/index.d.ts.map +1 -1
  17. package/src/command-line/release/release.d.ts +1 -1
  18. package/src/command-line/release/release.d.ts.map +1 -1
  19. package/src/core/graph/main.js +1 -1
  20. package/src/daemon/client/client.d.ts.map +1 -1
  21. package/src/daemon/client/client.js +8 -2
  22. package/src/daemon/server/project-graph-incremental-recomputation.d.ts.map +1 -1
  23. package/src/daemon/server/project-graph-incremental-recomputation.js +38 -10
  24. package/src/executors/run-commands/running-tasks.d.ts +1 -1
  25. package/src/executors/run-commands/running-tasks.d.ts.map +1 -1
  26. package/src/executors/run-commands/running-tasks.js +23 -17
  27. package/src/native/nx.wasm32-wasi.wasm +0 -0
  28. package/src/plugins/js/utils/register.d.ts.map +1 -1
  29. package/src/plugins/js/utils/register.js +14 -0
  30. package/src/project-graph/plugins/isolation/enabled.d.ts.map +1 -1
  31. package/src/project-graph/plugins/isolation/enabled.js +4 -1
  32. package/src/project-graph/utils/project-configuration-utils.d.ts.map +1 -1
  33. package/src/project-graph/utils/project-configuration-utils.js +47 -10
  34. package/src/tasks-runner/forked-process-task-runner.d.ts +1 -1
  35. package/src/tasks-runner/forked-process-task-runner.d.ts.map +1 -1
  36. package/src/tasks-runner/forked-process-task-runner.js +4 -9
  37. package/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.d.ts.map +1 -1
  38. package/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.js +1 -0
  39. package/src/tasks-runner/life-cycles/dynamic-run-one-terminal-output-life-cycle.d.ts.map +1 -1
  40. package/src/tasks-runner/life-cycles/dynamic-run-one-terminal-output-life-cycle.js +1 -0
  41. package/src/tasks-runner/life-cycles/tui-summary-life-cycle.d.ts.map +1 -1
  42. package/src/tasks-runner/life-cycles/tui-summary-life-cycle.js +15 -5
  43. package/src/tasks-runner/pseudo-ipc.d.ts.map +1 -1
  44. package/src/tasks-runner/pseudo-ipc.js +16 -0
  45. package/src/tasks-runner/pseudo-terminal.d.ts +2 -2
  46. package/src/tasks-runner/pseudo-terminal.d.ts.map +1 -1
  47. package/src/tasks-runner/pseudo-terminal.js +7 -5
  48. package/src/tasks-runner/run-command.d.ts.map +1 -1
  49. package/src/tasks-runner/run-command.js +3 -1
  50. package/src/tasks-runner/running-tasks/batch-process.d.ts +2 -1
  51. package/src/tasks-runner/running-tasks/batch-process.d.ts.map +1 -1
  52. package/src/tasks-runner/running-tasks/batch-process.js +5 -4
  53. package/src/tasks-runner/running-tasks/node-child-process.d.ts +2 -1
  54. package/src/tasks-runner/running-tasks/node-child-process.d.ts.map +1 -1
  55. package/src/tasks-runner/running-tasks/node-child-process.js +8 -5
  56. package/src/tasks-runner/task-graph-utils.d.ts.map +1 -1
  57. package/src/tasks-runner/task-graph-utils.js +8 -2
  58. package/src/tasks-runner/task-orchestrator.d.ts.map +1 -1
  59. package/src/tasks-runner/task-orchestrator.js +5 -17
  60. package/src/utils/is-sandbox.d.ts +2 -0
  61. package/src/utils/is-sandbox.d.ts.map +1 -0
  62. package/src/utils/is-sandbox.js +9 -0
  63. package/src/utils/output.d.ts.map +1 -1
  64. package/src/utils/output.js +6 -1
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  (The MIT License)
2
2
 
3
- Copyright (c) 2017-2025 Narwhal Technologies Inc.
3
+ Copyright (c) 2017-2026 Narwhal Technologies Inc.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
@@ -1 +1 @@
1
- {"version":3,"file":"init-local.d.ts","sourceRoot":"","sources":["../../../../packages/nx/bin/init-local.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAMxE;;;;GAIG;AACH,wBAAsB,SAAS,CAAC,SAAS,EAAE,oBAAoB,iBA6C9D;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,YA6BvD"}
1
+ {"version":3,"file":"init-local.d.ts","sourceRoot":"","sources":["../../../../packages/nx/bin/init-local.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAMxE;;;;GAIG;AACH,wBAAsB,SAAS,CAAC,SAAS,EAAE,oBAAoB,iBA8C9D;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,YA6BvD"}
package/bin/init-local.js CHANGED
@@ -44,6 +44,7 @@ async function initLocal(workspace) {
44
44
  const split = newArgs.indexOf('--');
45
45
  if (help > -1 && (split === -1 || split > help)) {
46
46
  nx_commands_1.commandsObject.showHelp();
47
+ process.exit(0);
47
48
  }
48
49
  else {
49
50
  nx_commands_1.commandsObject.parse(newArgs);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "22.5.0",
3
+ "version": "22.5.2",
4
4
  "private": false,
5
5
  "description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
6
6
  "repository": {
@@ -72,8 +72,8 @@
72
72
  "yargs-parser": "21.1.1"
73
73
  },
74
74
  "peerDependencies": {
75
- "@swc-node/register": "1.11.1",
76
- "@swc/core": "1.15.8"
75
+ "@swc-node/register": "^1.11.1",
76
+ "@swc/core": "^1.15.8"
77
77
  },
78
78
  "peerDependenciesMeta": {
79
79
  "@swc-node/register": {
@@ -84,16 +84,16 @@
84
84
  }
85
85
  },
86
86
  "optionalDependencies": {
87
- "@nx/nx-darwin-arm64": "22.5.0",
88
- "@nx/nx-darwin-x64": "22.5.0",
89
- "@nx/nx-freebsd-x64": "22.5.0",
90
- "@nx/nx-linux-arm-gnueabihf": "22.5.0",
91
- "@nx/nx-linux-arm64-gnu": "22.5.0",
92
- "@nx/nx-linux-arm64-musl": "22.5.0",
93
- "@nx/nx-linux-x64-gnu": "22.5.0",
94
- "@nx/nx-linux-x64-musl": "22.5.0",
95
- "@nx/nx-win32-arm64-msvc": "22.5.0",
96
- "@nx/nx-win32-x64-msvc": "22.5.0"
87
+ "@nx/nx-darwin-arm64": "22.5.2",
88
+ "@nx/nx-darwin-x64": "22.5.2",
89
+ "@nx/nx-freebsd-x64": "22.5.2",
90
+ "@nx/nx-linux-arm-gnueabihf": "22.5.2",
91
+ "@nx/nx-linux-arm64-gnu": "22.5.2",
92
+ "@nx/nx-linux-arm64-musl": "22.5.2",
93
+ "@nx/nx-linux-x64-gnu": "22.5.2",
94
+ "@nx/nx-linux-x64-musl": "22.5.2",
95
+ "@nx/nx-win32-arm64-msvc": "22.5.2",
96
+ "@nx/nx-win32-x64-msvc": "22.5.2"
97
97
  },
98
98
  "nx-migrations": {
99
99
  "migrations": "./migrations.json",
@@ -1,3 +1,5 @@
1
+ import { AgentRulesOptions } from './set-up-ai-agents/get-agent-rules';
2
+ export type { AgentRulesOptions };
1
3
  export declare function agentsMdPath(root: string): string;
2
4
  export declare function geminiMdPath(root: string): string;
3
5
  export declare function parseGeminiSettings(root: string): any | undefined;
@@ -10,7 +12,11 @@ export declare const nxRulesMarkerCommentStart = "<!-- nx configuration start-->
10
12
  export declare const nxRulesMarkerCommentDescription = "<!-- Leave the start & end comments to automatically receive updates. -->";
11
13
  export declare const nxRulesMarkerCommentEnd = "<!-- nx configuration end-->";
12
14
  export declare const rulesRegex: RegExp;
13
- export declare const getAgentRulesWrapped: (writeNxCloudRules: boolean) => string;
15
+ export interface AgentRulesWrappedOptions {
16
+ writeNxCloudRules: boolean;
17
+ useH1?: boolean;
18
+ }
19
+ export declare const getAgentRulesWrapped: (options: AgentRulesWrappedOptions) => string;
14
20
  export declare const nxMcpTomlHeader = "[mcp_servers.\"nx-mcp\"]";
15
21
  /**
16
22
  * Get the MCP TOML configuration based on the Nx version.
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/ai/constants.ts"],"names":[],"mappings":"AAMA,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,CAOjE;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED,eAAO,MAAM,mBAAmB,QAA2C,CAAC;AAE5E,eAAO,MAAM,yBAAyB,mCAAmC,CAAC;AAC1E,eAAO,MAAM,+BAA+B,8EAA8E,CAAC;AAC3H,eAAO,MAAM,uBAAuB,iCAAiC,CAAC;AACtE,eAAO,MAAM,UAAU,QAGtB,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,mBAAmB,OAAO,WAG9D,CAAC;AAEF,eAAO,MAAM,eAAe,6BAA2B,CAAC;AAExD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAQ5D"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/ai/constants.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,iBAAiB,EAClB,MAAM,oCAAoC,CAAC;AAE5C,YAAY,EAAE,iBAAiB,EAAE,CAAC;AAElC,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,CAOjE;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED,eAAO,MAAM,mBAAmB,QAA2C,CAAC;AAE5E,eAAO,MAAM,yBAAyB,mCAAmC,CAAC;AAC1E,eAAO,MAAM,+BAA+B,8EAA8E,CAAC;AAC3H,eAAO,MAAM,uBAAuB,iCAAiC,CAAC;AACtE,eAAO,MAAM,UAAU,QAGtB,CAAC;AAEF,MAAM,WAAW,wBAAwB;IACvC,iBAAiB,EAAE,OAAO,CAAC;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,eAAO,MAAM,oBAAoB,GAAI,SAAS,wBAAwB,WAIrE,CAAC;AAEF,eAAO,MAAM,eAAe,6BAA2B,CAAC;AAExD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAQ5D"}
@@ -46,9 +46,10 @@ exports.nxRulesMarkerCommentStart = `<!-- nx configuration start-->`;
46
46
  exports.nxRulesMarkerCommentDescription = `<!-- Leave the start & end comments to automatically receive updates. -->`;
47
47
  exports.nxRulesMarkerCommentEnd = `<!-- nx configuration end-->`;
48
48
  exports.rulesRegex = new RegExp(`${exports.nxRulesMarkerCommentStart}[\\s\\S]*?${exports.nxRulesMarkerCommentEnd}`, 'm');
49
- const getAgentRulesWrapped = (writeNxCloudRules) => {
50
- const agentRulesString = (0, get_agent_rules_1.getAgentRules)(writeNxCloudRules);
51
- return `${exports.nxRulesMarkerCommentStart}\n${exports.nxRulesMarkerCommentDescription}\n${agentRulesString}\n${exports.nxRulesMarkerCommentEnd}`;
49
+ const getAgentRulesWrapped = (options) => {
50
+ const { writeNxCloudRules, useH1 = true } = options;
51
+ const agentRulesString = (0, get_agent_rules_1.getAgentRules)({ nxCloud: writeNxCloudRules, useH1 });
52
+ return `${exports.nxRulesMarkerCommentStart}\n${exports.nxRulesMarkerCommentDescription}\n\n${agentRulesString}\n\n${exports.nxRulesMarkerCommentEnd}`;
52
53
  };
53
54
  exports.getAgentRulesWrapped = getAgentRulesWrapped;
54
55
  exports.nxMcpTomlHeader = `[mcp_servers."nx-mcp"]`;
@@ -1,2 +1,6 @@
1
- export declare function getAgentRules(nxCloud: boolean): string;
1
+ export interface AgentRulesOptions {
2
+ nxCloud: boolean;
3
+ useH1?: boolean;
4
+ }
5
+ export declare function getAgentRules(options: AgentRulesOptions): string;
2
6
  //# sourceMappingURL=get-agent-rules.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-agent-rules.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/ai/set-up-ai-agents/get-agent-rules.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,UAqB7C"}
1
+ {"version":3,"file":"get-agent-rules.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/ai/set-up-ai-agents/get-agent-rules.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,iBAAiB,UAsBvD"}
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getAgentRules = getAgentRules;
4
- function getAgentRules(nxCloud) {
5
- return `
6
- # General Guidelines for working with Nx
4
+ function getAgentRules(options) {
5
+ const { nxCloud, useH1 = true } = options;
6
+ const header = useH1 ? '#' : '##';
7
+ return `${header} General Guidelines for working with Nx
7
8
 
8
9
  - For navigating/exploring the workspace, invoke the \`nx-workspace\` skill first - it has patterns for querying projects, targets, and dependencies
9
10
  - When running tasks (for example build, lint, test, e2e, etc.), always prefer running the task through \`nx\` (i.e. \`nx run\`, \`nx run-many\`, \`nx affected\`) instead of using the underlying tooling directly
@@ -1 +1 @@
1
- {"version":3,"file":"set-up-ai-agents.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/ai/set-up-ai-agents/set-up-ai-agents.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAS7C,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,oBAAoB,CAAC;AAyB5B,OAAO,EACL,sCAAsC,EACtC,4BAA4B,EAC7B,MAAM,UAAU,CAAC;AAElB,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,oBAAoB,EAAE,CAAC;IACjC,MAAM,EAAE,qBAAqB,EAAE,CAAC;CACjC,CAAC;AAmCF,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,4BAA4B,EACrC,KAAK,UAAQ,GACZ,OAAO,CAAC,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAmC5D;AAaD,wBAAsB,0BAA0B,CAC9C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,sCAAsC,GAC9C,OAAO,CAAC,MAAM,OAAO,CAAC,mBAAmB,CAAC,CAAC,CA4O7C;AAkFD,eAAe,sBAAsB,CAAC"}
1
+ {"version":3,"file":"set-up-ai-agents.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/ai/set-up-ai-agents/set-up-ai-agents.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAS7C,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,oBAAoB,CAAC;AAyB5B,OAAO,EACL,sCAAsC,EACtC,4BAA4B,EAC7B,MAAM,UAAU,CAAC;AAElB,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,oBAAoB,EAAE,CAAC;IACjC,MAAM,EAAE,qBAAqB,EAAE,CAAC;CACjC,CAAC;AAmCF,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,4BAA4B,EACrC,KAAK,UAAQ,GACZ,OAAO,CAAC,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAmC5D;AAaD,wBAAsB,0BAA0B,CAC9C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,sCAAsC,GAC9C,OAAO,CAAC,MAAM,OAAO,CAAC,mBAAmB,CAAC,CAAC,CA4O7C;AAqJD,eAAe,sBAAsB,CAAC"}
@@ -270,8 +270,12 @@ async function setupAiAgentsGeneratorImpl(tree, options) {
270
270
  };
271
271
  }
272
272
  function writeAgentRules(tree, path, writeNxCloudRules) {
273
- const expectedRules = (0, constants_2.getAgentRulesWrapped)(writeNxCloudRules);
274
273
  if (!tree.exists(path)) {
274
+ // File doesn't exist - create with h1 header (standalone content)
275
+ const expectedRules = (0, constants_2.getAgentRulesWrapped)({
276
+ writeNxCloudRules,
277
+ useH1: true,
278
+ });
275
279
  tree.write(path, expectedRules);
276
280
  return;
277
281
  }
@@ -279,6 +283,14 @@ function writeAgentRules(tree, path, writeNxCloudRules) {
279
283
  const regex = constants_2.rulesRegex;
280
284
  const existingNxConfiguration = existing.match(regex);
281
285
  if (existingNxConfiguration) {
286
+ // Check the rest of the file (outside nx block) for an h1 header
287
+ // to ensure only one h1 exists in the document
288
+ const contentWithoutNxBlock = existing.replace(regex, '');
289
+ const hasExternalH1 = /^# /m.test(contentWithoutNxBlock);
290
+ const expectedRules = (0, constants_2.getAgentRulesWrapped)({
291
+ writeNxCloudRules,
292
+ useH1: !hasExternalH1,
293
+ });
282
294
  const contentOnly = (str) => str
283
295
  .replace(constants_2.nxRulesMarkerCommentStart, '')
284
296
  .replace(constants_2.nxRulesMarkerCommentEnd, '')
@@ -293,12 +305,52 @@ function writeAgentRules(tree, path, writeNxCloudRules) {
293
305
  tree.write(path, updatedContent);
294
306
  }
295
307
  else {
308
+ // Appending to existing content - use h2 only if the file already has an h1 header
309
+ // This prevents unnecessary changes when users add content without their own h1
310
+ const hasExistingH1 = /^# /m.test(existing);
311
+ const expectedRules = (0, constants_2.getAgentRulesWrapped)({
312
+ writeNxCloudRules,
313
+ useH1: !hasExistingH1,
314
+ });
296
315
  tree.write(path, existing + '\n\n' + expectedRules);
297
316
  }
298
317
  }
318
+ /**
319
+ * Extract user-added extra args/flags from an existing MCP config args array
320
+ * by stripping the known base command prefix.
321
+ *
322
+ * Known base patterns (matched in order, first wins):
323
+ * ['nx', 'mcp'] or ['nx-mcp'] (possibly with @version suffix like nx-mcp@latest)
324
+ * For opencode the caller prepends 'npx' to these patterns.
325
+ */
326
+ function getExtraMcpArgs(existingArgs, knownBasePatterns) {
327
+ if (!Array.isArray(existingArgs) || existingArgs.length === 0)
328
+ return [];
329
+ for (const pattern of knownBasePatterns) {
330
+ if (existingArgs.length < pattern.length)
331
+ continue;
332
+ const matches = pattern.every((baseArg, i) => {
333
+ if (baseArg === 'nx-mcp') {
334
+ // Also match versioned variants like nx-mcp@latest
335
+ return (existingArgs[i] === 'nx-mcp' || existingArgs[i].startsWith('nx-mcp@'));
336
+ }
337
+ return existingArgs[i] === baseArg;
338
+ });
339
+ if (matches) {
340
+ return existingArgs.slice(pattern.length);
341
+ }
342
+ }
343
+ return [];
344
+ }
299
345
  function mcpConfigUpdater(existing, nxVersion) {
300
346
  const majorVersion = (0, semver_1.major)(nxVersion);
301
347
  const mcpArgs = majorVersion >= 22 ? ['nx', 'mcp'] : ['nx-mcp'];
348
+ // Preserve any extra args (e.g. --experimental-polygraph, --transport http) from existing config
349
+ const extraArgs = getExtraMcpArgs(existing.mcpServers?.['nx-mcp']?.args, [
350
+ ['nx', 'mcp'],
351
+ ['nx-mcp'],
352
+ ]);
353
+ mcpArgs.push(...extraArgs);
302
354
  if (existing.mcpServers) {
303
355
  existing.mcpServers['nx-mcp'] = {
304
356
  type: 'stdio',
@@ -320,6 +372,12 @@ function mcpConfigUpdater(existing, nxVersion) {
320
372
  function opencodeMcpConfigUpdater(existing, nxVersion) {
321
373
  const majorVersion = (0, semver_1.major)(nxVersion);
322
374
  const mcpCommand = majorVersion >= 22 ? ['npx', 'nx', 'mcp'] : ['npx', 'nx-mcp'];
375
+ // Preserve any extra args (e.g. --experimental-polygraph, --transport http) from existing config
376
+ const extraArgs = getExtraMcpArgs(existing.mcp?.['nx-mcp']?.command, [
377
+ ['npx', 'nx', 'mcp'],
378
+ ['npx', 'nx-mcp'],
379
+ ]);
380
+ mcpCommand.push(...extraArgs);
323
381
  if (existing.mcp) {
324
382
  existing.mcp['nx-mcp'] = {
325
383
  type: 'local',
@@ -1 +1 @@
1
- {"version":3,"file":"configure-ai-agents.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/configure-ai-agents/configure-ai-agents.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAG5D,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,wBAAwB,EAC9B,KAAK,UAAQ,GACZ,OAAO,CAAC,IAAI,CAAC,CAmCf;AAED,wBAAsB,4BAA4B,CAChD,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,IAAI,CAAC,CA4Nf"}
1
+ {"version":3,"file":"configure-ai-agents.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/configure-ai-agents/configure-ai-agents.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAG5D,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,wBAAwB,EAC9B,KAAK,UAAQ,GACZ,OAAO,CAAC,IAAI,CAAC,CAgDf;AAED,wBAAsB,4BAA4B,CAChD,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,IAAI,CAAC,CAyOf"}
@@ -10,7 +10,9 @@ const constants_1 = require("../../ai/constants");
10
10
  const utils_1 = require("../../ai/utils");
11
11
  const devkit_internals_1 = require("../../devkit-internals");
12
12
  const output_1 = require("../../utils/output");
13
+ const package_manager_1 = require("../../utils/package-manager");
13
14
  const provenance_1 = require("../../utils/provenance");
15
+ const versions_1 = require("../../utils/versions");
14
16
  const workspace_root_1 = require("../../utils/workspace-root");
15
17
  const ora = require("ora");
16
18
  async function configureAiAgentsHandler(args, inner = false) {
@@ -20,6 +22,16 @@ async function configureAiAgentsHandler(args, inner = false) {
20
22
  inner) {
21
23
  return await configureAiAgentsHandlerImpl(args);
22
24
  }
25
+ // Skip downloading latest if the current version is already the latest
26
+ try {
27
+ const latestVersion = await (0, package_manager_1.resolvePackageVersionUsingRegistry)('nx', 'latest');
28
+ if (latestVersion === versions_1.nxVersion) {
29
+ return await configureAiAgentsHandlerImpl(args);
30
+ }
31
+ }
32
+ catch {
33
+ // If we can't check, proceed with download
34
+ }
23
35
  let cleanup;
24
36
  try {
25
37
  await (0, provenance_1.ensurePackageHasProvenance)('nx', 'latest');
@@ -40,6 +52,16 @@ async function configureAiAgentsHandler(args, inner = false) {
40
52
  }
41
53
  }
42
54
  async function configureAiAgentsHandlerImpl(options) {
55
+ // Node 24 has stricter readline behavior, and enquirer is not checking for closed state
56
+ // when invoking operations, thus you get an ERR_USE_AFTER_CLOSE error.
57
+ process.on('uncaughtException', (error) => {
58
+ if (error &&
59
+ typeof error === 'object' &&
60
+ 'code' in error &&
61
+ error['code'] === 'ERR_USE_AFTER_CLOSE')
62
+ return;
63
+ throw error;
64
+ });
43
65
  const normalizedOptions = normalizeOptions(options);
44
66
  const { nonConfiguredAgents, partiallyConfiguredAgents, fullyConfiguredAgents, disabledAgents, } = await (0, utils_1.getAgentConfigurations)(normalizedOptions.agents, workspace_root_1.workspaceRoot);
45
67
  if (disabledAgents.length > 0) {
@@ -13,7 +13,7 @@ export declare class ReleaseClient {
13
13
  releaseChangelog: (args: import("./command-object").ChangelogOptions) => Promise<import("./changelog").NxReleaseChangelogResult>;
14
14
  releasePublish: (args: import("./command-object").PublishOptions) => Promise<import("./publish").PublishProjectsResult>;
15
15
  releaseVersion: (args: import("./command-object").VersionOptions) => Promise<import("./version").NxReleaseVersionResult>;
16
- release: (args: import("./command-object").ReleaseOptions) => Promise<import("./version").NxReleaseVersionResult | number>;
16
+ release: (args: import("./command-object").ReleaseOptions) => Promise<import("./version").NxReleaseVersionResult>;
17
17
  constructor(
18
18
  /**
19
19
  * Nx release configuration to use for the current release client. By default, it will be combined with any
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/release/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAMnE;;GAEG;AACH,qBAAa,aAAa;IAgBtB;;;;OAIG;IACH,OAAO,CAAC,eAAe;IACvB,OAAO,CAAC,kBAAkB;IArB5B,gBAAgB,iHAGd;IACF,cAAc,0GAGZ;IACF,cAAc,2GAGZ;IACF,OAAO,oHAAmE;;IAGxE;;;;OAIG;IACK,eAAe,EAAE,sBAAsB,EACvC,kBAAkB,GAAE,OAAe;CAE9C;AAED,QAAA,MAAM,aAAa,eAAkD,CAAC;AAEtE;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAExB,OAAO,aAAa,CAAC,gBAAgB,CAAC;AAE3C;;GAEG;AACH,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD;;GAEG;AACH,eAAO,MAAM,cAAc,EAEtB,OAAO,aAAa,CAAC,cAAc,CAAC;AAEzC;;GAEG;AACH,eAAO,MAAM,cAAc,EAEtB,OAAO,aAAa,CAAC,cAAc,CAAC;AAEzC;;GAEG;AACH,eAAO,MAAM,OAAO,EAEf,OAAO,aAAa,CAAC,OAAO,CAAC;AAElC;;GAEG;AACH,OAAO,EACL,yBAAyB,EACzB,cAAc,GACf,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/release/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAMnE;;GAEG;AACH,qBAAa,aAAa;IAgBtB;;;;OAIG;IACH,OAAO,CAAC,eAAe;IACvB,OAAO,CAAC,kBAAkB;IArB5B,gBAAgB,iHAGd;IACF,cAAc,0GAGZ;IACF,cAAc,2GAGZ;IACF,OAAO,2GAAmE;;IAGxE;;;;OAIG;IACK,eAAe,EAAE,sBAAsB,EACvC,kBAAkB,GAAE,OAAe;CAE9C;AAED,QAAA,MAAM,aAAa,eAAkD,CAAC;AAEtE;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAExB,OAAO,aAAa,CAAC,gBAAgB,CAAC;AAE3C;;GAEG;AACH,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD;;GAEG;AACH,eAAO,MAAM,cAAc,EAEtB,OAAO,aAAa,CAAC,cAAc,CAAC;AAEzC;;GAEG;AACH,eAAO,MAAM,cAAc,EAEtB,OAAO,aAAa,CAAC,cAAc,CAAC;AAEzC;;GAEG;AACH,eAAO,MAAM,OAAO,EAEf,OAAO,aAAa,CAAC,OAAO,CAAC;AAElC;;GAEG;AACH,OAAO,EACL,yBAAyB,EACzB,cAAc,GACf,MAAM,2BAA2B,CAAC"}
@@ -2,5 +2,5 @@ import { NxReleaseConfiguration } from '../../config/nx-json';
2
2
  import { ReleaseOptions, VersionOptions } from './command-object';
3
3
  import { NxReleaseVersionResult } from './version';
4
4
  export declare const releaseCLIHandler: (args: VersionOptions) => Promise<number>;
5
- export declare function createAPI(overrideReleaseConfig: NxReleaseConfiguration, ignoreNxJsonConfig: boolean): (args: ReleaseOptions) => Promise<NxReleaseVersionResult | number>;
5
+ export declare function createAPI(overrideReleaseConfig: NxReleaseConfiguration, ignoreNxJsonConfig: boolean): (args: ReleaseOptions) => Promise<NxReleaseVersionResult>;
6
6
  //# sourceMappingURL=release.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/release/release.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAc,MAAM,sBAAsB,CAAC;AAM1E,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AA2BlE,OAAO,EACL,sBAAsB,EAEvB,MAAM,WAAW,CAAC;AAEnB,eAAO,MAAM,iBAAiB,GAAI,MAAM,cAAc,oBACQ,CAAC;AAE/D,wBAAgB,SAAS,CACvB,qBAAqB,EAAE,sBAAsB,EAC7C,kBAAkB,EAAE,OAAO,IAgBzB,MAAM,cAAc,KACnB,OAAO,CAAC,sBAAsB,GAAG,MAAM,CAAC,CA0W5C"}
1
+ {"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/release/release.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAc,MAAM,sBAAsB,CAAC;AAM1E,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AA2BlE,OAAO,EACL,sBAAsB,EAEvB,MAAM,WAAW,CAAC;AAEnB,eAAO,MAAM,iBAAiB,GAAI,MAAM,cAAc,oBACQ,CAAC;AAE/D,wBAAgB,SAAS,CACvB,qBAAqB,EAAE,sBAAsB,EAC7C,kBAAkB,EAAE,OAAO,IAgBzB,MAAM,cAAc,KACnB,OAAO,CAAC,sBAAsB,CAAC,CA0WnC"}