nx 22.0.0-beta.0 → 22.0.0-beta.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 (40) hide show
  1. package/package.json +12 -12
  2. package/src/ai/utils.d.ts +6 -5
  3. package/src/ai/utils.d.ts.map +1 -1
  4. package/src/ai/utils.js +14 -13
  5. package/src/command-line/affected/affected.d.ts.map +1 -1
  6. package/src/command-line/affected/affected.js +1 -2
  7. package/src/command-line/configure-ai-agents/configure-ai-agents.d.ts.map +1 -1
  8. package/src/command-line/configure-ai-agents/configure-ai-agents.js +79 -74
  9. package/src/command-line/format/command-object.js +2 -6
  10. package/src/command-line/format/format.js +1 -1
  11. package/src/command-line/init/implementation/add-nx-to-monorepo.js +2 -2
  12. package/src/command-line/release/changelog.d.ts.map +1 -1
  13. package/src/command-line/release/changelog.js +18 -32
  14. package/src/command-line/release/utils/get-touched-projects-for-group.js +1 -1
  15. package/src/command-line/release/utils/git.d.ts +5 -1
  16. package/src/command-line/release/utils/git.d.ts.map +1 -1
  17. package/src/command-line/release/utils/git.js +8 -19
  18. package/src/command-line/show/projects.js +1 -2
  19. package/src/core/graph/main.js +1 -1
  20. package/src/core/graph/styles.js +1 -1
  21. package/src/devkit-internals.d.ts +1 -0
  22. package/src/devkit-internals.d.ts.map +1 -1
  23. package/src/devkit-internals.js +3 -1
  24. package/src/migrations/update-17-0-0/move-cache-directory.js +2 -2
  25. package/src/migrations/update-21-1-0/add-gitignore-entry.js +2 -2
  26. package/src/native/index.d.ts +2 -2
  27. package/src/native/nx.wasm32-wasi.wasm +0 -0
  28. package/src/project-graph/file-utils.d.ts +5 -2
  29. package/src/project-graph/file-utils.d.ts.map +1 -1
  30. package/src/project-graph/file-utils.js +1 -5
  31. package/src/utils/ignore.d.ts +3 -1
  32. package/src/utils/ignore.d.ts.map +1 -1
  33. package/src/utils/ignore.js +16 -2
  34. package/src/utils/nx-console-prompt.d.ts.map +1 -1
  35. package/src/utils/nx-console-prompt.js +4 -1
  36. package/src/utils/provenance.d.ts.map +1 -1
  37. package/src/utils/provenance.js +28 -7
  38. package/src/adapter/decorate-cli.d.ts +0 -2
  39. package/src/adapter/decorate-cli.d.ts.map +0 -1
  40. package/src/adapter/decorate-cli.js +0 -25
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "22.0.0-beta.0",
3
+ "version": "22.0.0-beta.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": {
@@ -49,7 +49,7 @@
49
49
  "figures": "3.2.0",
50
50
  "flat": "^5.0.2",
51
51
  "front-matter": "^4.0.2",
52
- "ignore": "^5.0.4",
52
+ "ignore": "^7.0.5",
53
53
  "jest-diff": "^30.0.2",
54
54
  "jsonc-parser": "3.2.0",
55
55
  "lines-and-columns": "2.0.3",
@@ -83,16 +83,16 @@
83
83
  }
84
84
  },
85
85
  "optionalDependencies": {
86
- "@nx/nx-darwin-arm64": "*",
87
- "@nx/nx-darwin-x64": "*",
88
- "@nx/nx-freebsd-x64": "*",
89
- "@nx/nx-linux-arm-gnueabihf": "*",
90
- "@nx/nx-linux-arm64-gnu": "*",
91
- "@nx/nx-linux-arm64-musl": "*",
92
- "@nx/nx-linux-x64-gnu": "*",
93
- "@nx/nx-linux-x64-musl": "*",
94
- "@nx/nx-win32-arm64-msvc": "*",
95
- "@nx/nx-win32-x64-msvc": "*"
86
+ "@nx/nx-darwin-arm64": "22.0.0-beta.2",
87
+ "@nx/nx-darwin-x64": "22.0.0-beta.2",
88
+ "@nx/nx-freebsd-x64": "22.0.0-beta.2",
89
+ "@nx/nx-linux-arm-gnueabihf": "22.0.0-beta.2",
90
+ "@nx/nx-linux-arm64-gnu": "22.0.0-beta.2",
91
+ "@nx/nx-linux-arm64-musl": "22.0.0-beta.2",
92
+ "@nx/nx-linux-x64-gnu": "22.0.0-beta.2",
93
+ "@nx/nx-linux-x64-musl": "22.0.0-beta.2",
94
+ "@nx/nx-win32-arm64-msvc": "22.0.0-beta.2",
95
+ "@nx/nx-win32-x64-msvc": "22.0.0-beta.2"
96
96
  },
97
97
  "nx-migrations": {
98
98
  "migrations": "./migrations.json",
package/src/ai/utils.d.ts CHANGED
@@ -2,6 +2,8 @@ export declare const supportedAgents: readonly ["claude", "codex", "copilot", "c
2
2
  export type Agent = (typeof supportedAgents)[number];
3
3
  export declare const agentDisplayMap: Record<Agent, string>;
4
4
  export type AgentConfiguration = {
5
+ name: Agent;
6
+ displayName: string;
5
7
  rules: boolean;
6
8
  mcp: boolean;
7
9
  rulesPath: string;
@@ -10,11 +12,10 @@ export type AgentConfiguration = {
10
12
  disabled?: boolean;
11
13
  };
12
14
  export declare function getAgentConfigurations(agentsToConsider: Agent[], workspaceRoot: string): Promise<{
13
- nonConfiguredAgents: Agent[];
14
- partiallyConfiguredAgents: Agent[];
15
- fullyConfiguredAgents: Agent[];
16
- disabledAgents: Agent[];
17
- agentConfigurations: Map<Agent, AgentConfiguration>;
15
+ nonConfiguredAgents: AgentConfiguration[];
16
+ partiallyConfiguredAgents: AgentConfiguration[];
17
+ fullyConfiguredAgents: AgentConfiguration[];
18
+ disabledAgents: AgentConfiguration[];
18
19
  }>;
19
20
  export declare function configureAgents(agents: Agent[], workspaceRoot: string, useLatest?: boolean): Promise<void>;
20
21
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/ai/utils.ts"],"names":[],"mappings":"AA0BA,eAAO,MAAM,eAAe,6DAMlB,CAAC;AACX,MAAM,MAAM,KAAK,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AACrD,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAMjD,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,OAAO,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,wBAAsB,sBAAsB,CAC1C,gBAAgB,EAAE,KAAK,EAAE,EACzB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC;IACT,mBAAmB,EAAE,KAAK,EAAE,CAAC;IAC7B,yBAAyB,EAAE,KAAK,EAAE,CAAC;IACnC,qBAAqB,EAAE,KAAK,EAAE,CAAC;IAC/B,cAAc,EAAE,KAAK,EAAE,CAAC;IACxB,mBAAmB,EAAE,GAAG,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC;CACrD,CAAC,CA8BD;AA8ID,wBAAsB,eAAe,CACnC,MAAM,EAAE,KAAK,EAAE,EACf,aAAa,EAAE,MAAM,EACrB,SAAS,CAAC,EAAE,OAAO,GAClB,OAAO,CAAC,IAAI,CAAC,CAoBf"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/ai/utils.ts"],"names":[],"mappings":"AA0BA,eAAO,MAAM,eAAe,6DAMlB,CAAC;AACX,MAAM,MAAM,KAAK,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AACrD,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAMjD,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,KAAK,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,OAAO,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,wBAAsB,sBAAsB,CAC1C,gBAAgB,EAAE,KAAK,EAAE,EACzB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC;IACT,mBAAmB,EAAE,kBAAkB,EAAE,CAAC;IAC1C,yBAAyB,EAAE,kBAAkB,EAAE,CAAC;IAChD,qBAAqB,EAAE,kBAAkB,EAAE,CAAC;IAC5C,cAAc,EAAE,kBAAkB,EAAE,CAAC;CACtC,CAAC,CA2BD;AAsJD,wBAAsB,eAAe,CACnC,MAAM,EAAE,KAAK,EAAE,EACf,aAAa,EAAE,MAAM,EACrB,SAAS,CAAC,EAAE,OAAO,GAClB,OAAO,CAAC,IAAI,CAAC,CAoBf"}
package/src/ai/utils.js CHANGED
@@ -34,22 +34,20 @@ async function getAgentConfigurations(agentsToConsider, workspaceRoot) {
34
34
  const partiallyConfiguredAgents = [];
35
35
  const fullyConfiguredAgents = [];
36
36
  const disabledAgents = [];
37
- const agentConfigurations = new Map();
38
37
  for (const agent of agentsToConsider) {
39
- const configured = await getAgentConfiguration(agent, workspaceRoot);
40
- if (configured.disabled) {
41
- disabledAgents.push(agent);
38
+ const configuration = await getAgentConfiguration(agent, workspaceRoot);
39
+ if (configuration.disabled) {
40
+ disabledAgents.push(configuration);
42
41
  continue;
43
42
  }
44
- agentConfigurations.set(agent, configured);
45
- if (configured.mcp && configured.rules) {
46
- fullyConfiguredAgents.push(agent);
43
+ if (configuration.mcp && configuration.rules) {
44
+ fullyConfiguredAgents.push(configuration);
47
45
  }
48
- else if (!configured.mcp && !configured.rules) {
49
- nonConfiguredAgents.push(agent);
46
+ else if (!configuration.mcp && !configuration.rules) {
47
+ nonConfiguredAgents.push(configuration);
50
48
  }
51
49
  else {
52
- partiallyConfiguredAgents.push(agent);
50
+ partiallyConfiguredAgents.push(configuration);
53
51
  }
54
52
  }
55
53
  return {
@@ -57,7 +55,6 @@ async function getAgentConfigurations(agentsToConsider, workspaceRoot) {
57
55
  partiallyConfiguredAgents,
58
56
  fullyConfiguredAgents,
59
57
  disabledAgents,
60
- agentConfigurations,
61
58
  };
62
59
  }
63
60
  async function getAgentConfiguration(agent, workspaceRoot) {
@@ -158,10 +155,14 @@ async function getAgentConfiguration(agent, workspaceRoot) {
158
155
  }
159
156
  return {
160
157
  ...agentConfiguration,
161
- outdated: await isAgentOutdated(agent, workspaceRoot),
158
+ outdated: agentConfiguration.mcp &&
159
+ agentConfiguration.rules &&
160
+ (await agentWouldChangeWithGenerator(agent, workspaceRoot)),
161
+ name: agent,
162
+ displayName: exports.agentDisplayMap[agent],
162
163
  };
163
164
  }
164
- async function isAgentOutdated(agent, workspaceRoot) {
165
+ async function agentWouldChangeWithGenerator(agent, workspaceRoot) {
165
166
  const tree = new tree_1.FsTree(workspaceRoot, false);
166
167
  const callback = await (0, set_up_ai_agents_1.default)(tree, {
167
168
  directory: '.',
@@ -1 +1 @@
1
- {"version":3,"file":"affected.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/affected/affected.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAQ7D,OAAO,EACL,YAAY,EACZ,uBAAuB,EACxB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAMlF,wBAAsB,QAAQ,CAC5B,OAAO,EAAE,OAAO,GAAG,gBAAgB,GAAG,UAAU,EAChD,IAAI,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,EAC1B,uBAAuB,GAAE,MAAM,CAC7B,MAAM,EACN,CAAC,sBAAsB,GAAG,MAAM,CAAC,EAAE,CAC/B,EACN,YAAY,GAGP;IACH,uBAAuB,EAAE,OAAO,CAAC;IACjC,eAAe,EAAE,OAAO,CAAC;CAC1B,GACA,OAAO,CAAC,IAAI,CAAC,CAiEf;AAED,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,YAAY,GACzB,OAAO,CAAC,uBAAuB,EAAE,CAAC,CAuBpC"}
1
+ {"version":3,"file":"affected.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/affected/affected.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAQ7D,OAAO,EACL,YAAY,EACZ,uBAAuB,EACxB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAMlF,wBAAsB,QAAQ,CAC5B,OAAO,EAAE,OAAO,GAAG,gBAAgB,GAAG,UAAU,EAChD,IAAI,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,EAC1B,uBAAuB,GAAE,MAAM,CAC7B,MAAM,EACN,CAAC,sBAAsB,GAAG,MAAM,CAAC,EAAE,CAC/B,EACN,YAAY,GAGP;IACH,uBAAuB,EAAE,OAAO,CAAC;IACjC,eAAe,EAAE,OAAO,CAAC;CAC1B,GACA,OAAO,CAAC,IAAI,CAAC,CAiEf;AAED,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,YAAY,GACzB,OAAO,CAAC,uBAAuB,EAAE,CAAC,CAmBpC"}
@@ -14,7 +14,6 @@ const affected_project_graph_1 = require("../../project-graph/affected/affected-
14
14
  const configuration_1 = require("../../config/configuration");
15
15
  const find_matching_projects_1 = require("../../utils/find-matching-projects");
16
16
  const graph_1 = require("../graph/graph");
17
- const all_file_data_1 = require("../../utils/all-file-data");
18
17
  async function affected(command, args, extraTargetDependencies = {}, extraOptions = {
19
18
  excludeTaskDependencies: args.excludeTaskDependencies,
20
19
  loadDotEnvFiles: process.env.NX_LOAD_DOT_ENV_FILES !== 'false',
@@ -65,7 +64,7 @@ async function affected(command, args, extraTargetDependencies = {}, extraOption
65
64
  async function getAffectedGraphNodes(nxArgs, projectGraph) {
66
65
  let affectedGraph = nxArgs.all
67
66
  ? projectGraph
68
- : await (0, affected_project_graph_1.filterAffected)(projectGraph, (0, file_utils_1.calculateFileChanges)((0, command_line_utils_1.parseFiles)(nxArgs).files, await (0, all_file_data_1.allFileData)(), nxArgs));
67
+ : await (0, affected_project_graph_1.filterAffected)(projectGraph, (0, file_utils_1.calculateFileChanges)((0, command_line_utils_1.parseFiles)(nxArgs).files, nxArgs));
69
68
  if (nxArgs.exclude) {
70
69
  const excludedProjects = new Set((0, find_matching_projects_1.findMatchingProjects)(nxArgs.exclude, affectedGraph.nodes));
71
70
  return Object.entries(affectedGraph.nodes)
@@ -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":"AAcA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAI5D,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,wBAAwB,EAC9B,KAAK,UAAQ,GACZ,OAAO,CAAC,IAAI,CAAC,CA+Bf;AAED,wBAAsB,4BAA4B,CAChD,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,IAAI,CAAC,CAgNf"}
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":"AAeA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAI5D,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,wBAAwB,EAC9B,KAAK,UAAQ,GACZ,OAAO,CAAC,IAAI,CAAC,CA+Bf;AAED,wBAAsB,4BAA4B,CAChD,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,IAAI,CAAC,CA2Mf"}
@@ -37,12 +37,12 @@ async function configureAiAgentsHandler(args, inner = false) {
37
37
  }
38
38
  async function configureAiAgentsHandlerImpl(options) {
39
39
  const normalizedOptions = normalizeOptions(options);
40
- const { nonConfiguredAgents, partiallyConfiguredAgents, fullyConfiguredAgents, disabledAgents, agentConfigurations, } = await (0, utils_1.getAgentConfigurations)(normalizedOptions.agents, workspace_root_1.workspaceRoot);
40
+ const { nonConfiguredAgents, partiallyConfiguredAgents, fullyConfiguredAgents, disabledAgents, } = await (0, utils_1.getAgentConfigurations)(normalizedOptions.agents, workspace_root_1.workspaceRoot);
41
41
  if (disabledAgents.length > 0) {
42
42
  const commandNames = disabledAgents.map((a) => {
43
- if (a === 'cursor')
43
+ if (a.name === 'cursor')
44
44
  return '"cursor"';
45
- if (a === 'copilot')
45
+ if (a.name === 'copilot')
46
46
  return '"code"/"code-insiders"';
47
47
  return a;
48
48
  });
@@ -58,8 +58,7 @@ async function configureAiAgentsHandlerImpl(options) {
58
58
  ],
59
59
  });
60
60
  }
61
- if (normalizedOptions.agents.filter((a) => !disabledAgents.includes(a))
62
- .length === 0) {
61
+ if (normalizedOptions.agents.filter((agentName) => !disabledAgents.find((a) => a.name === agentName)).length === 0) {
63
62
  output_1.output.error({
64
63
  title: 'Please select at least one AI agent to configure.',
65
64
  });
@@ -75,11 +74,11 @@ async function configureAiAgentsHandlerImpl(options) {
75
74
  });
76
75
  process.exit(0);
77
76
  }
78
- const outOfDateAgents = fullyConfiguredAgents.filter((a) => agentConfigurations.get(a)?.outdated);
77
+ const outOfDateAgents = fullyConfiguredAgents.filter((a) => a?.outdated);
79
78
  if (outOfDateAgents.length === 0) {
80
79
  output_1.output.success({
81
80
  title: 'All configured AI agents are up to date',
82
- bodyLines: fullyConfiguredAgents.map((a) => `- ${utils_1.agentDisplayMap[a]}`),
81
+ bodyLines: fullyConfiguredAgents.map((a) => `- ${a.displayName}`),
83
82
  });
84
83
  process.exit(0);
85
84
  }
@@ -88,11 +87,11 @@ async function configureAiAgentsHandlerImpl(options) {
88
87
  title: 'The following AI agents are out of date:',
89
88
  bodyLines: [
90
89
  ...outOfDateAgents.map((a) => {
91
- const rulesPath = agentConfigurations.get(a).rulesPath;
90
+ const rulesPath = a.rulesPath;
92
91
  const displayPath = rulesPath.startsWith(workspace_root_1.workspaceRoot)
93
92
  ? (0, path_1.relative)(workspace_root_1.workspaceRoot, rulesPath)
94
93
  : rulesPath;
95
- return `- ${utils_1.agentDisplayMap[a]} (${displayPath})`;
94
+ return `- ${a.displayName} (${displayPath})`;
96
95
  }),
97
96
  '',
98
97
  'You can update them by running `nx configure-ai-agents`.',
@@ -101,74 +100,61 @@ async function configureAiAgentsHandlerImpl(options) {
101
100
  process.exit(1);
102
101
  }
103
102
  }
104
- // first, prompt for partially configured agents and out of date agents
105
- const agentsToUpdate = [];
103
+ const allAgentChoices = [];
104
+ const preselectedIndices = [];
105
+ let currentIndex = 0;
106
+ // Partially configured agents first (highest priority)
106
107
  partiallyConfiguredAgents.forEach((a) => {
107
- agentsToUpdate.push(getAgentChoiceForPrompt(a, true, false));
108
+ allAgentChoices.push(getAgentChoiceForPrompt(a));
109
+ preselectedIndices.push(currentIndex);
110
+ currentIndex++;
108
111
  });
112
+ // Outdated agents second
109
113
  for (const a of fullyConfiguredAgents) {
110
- if (agentConfigurations.get(a).outdated) {
111
- agentsToUpdate.push(getAgentChoiceForPrompt(a, false, true));
114
+ if (a.outdated) {
115
+ allAgentChoices.push(getAgentChoiceForPrompt(a));
116
+ preselectedIndices.push(currentIndex);
117
+ currentIndex++;
112
118
  }
113
119
  }
114
- let updateResult = [];
115
- let updateSucceeded = true;
116
- if (agentsToUpdate.length > 0) {
117
- if (options.interactive !== false) {
118
- try {
119
- updateResult = (await (0, enquirer_1.prompt)({
120
- type: 'multiselect',
121
- name: 'agents',
122
- message: 'The following agents are not configured completely or are out of date. Which would you like to update?',
123
- choices: agentsToUpdate,
124
- initial: agentsToUpdate.map((_, i) => i),
125
- required: true,
126
- })).agents;
127
- }
128
- catch {
129
- process.exit(1);
130
- }
131
- }
132
- else {
133
- // in non-interactive mode, update all
134
- updateResult = agentsToUpdate.map((a) => a.name);
135
- }
136
- if (updateResult?.length > 0) {
137
- const updateSpinner = ora(`Updating agent configurations...`).start();
138
- try {
139
- await (0, utils_1.configureAgents)(updateResult, workspace_root_1.workspaceRoot, false);
140
- updateSpinner.succeed('Agent configurations updated.');
141
- }
142
- catch {
143
- updateSpinner.fail('Failed to update agent configurations.');
144
- updateSucceeded = false;
145
- }
146
- }
147
- }
148
- // then prompt for non-configured agents
149
- if (nonConfiguredAgents.length === 0) {
120
+ // Non-configured agents last
121
+ nonConfiguredAgents.forEach((a) => {
122
+ allAgentChoices.push(getAgentChoiceForPrompt(a));
123
+ currentIndex++;
124
+ });
125
+ if (allAgentChoices.length === 0) {
150
126
  const usingAllAgents = normalizedOptions.agents.length === utils_1.supportedAgents.length;
151
- const configuredOrUpdatedAgents = [
152
- ...new Set([
153
- ...fullyConfiguredAgents,
154
- ...(updateSucceeded ? updateResult : []),
155
- ]),
156
- ];
157
127
  output_1.output.success({
158
128
  title: `No new agents to configure. All ${!usingAllAgents ? 'selected' : 'supported'} AI agents are already configured:`,
159
- bodyLines: configuredOrUpdatedAgents.map((agent) => `- ${utils_1.agentDisplayMap[agent]}`),
129
+ bodyLines: fullyConfiguredAgents.map((agent) => `- ${agent.displayName}`),
160
130
  });
161
131
  process.exit(0);
162
132
  }
163
- let configurationResult;
133
+ let selectedAgents;
164
134
  if (options.interactive !== false) {
165
135
  try {
166
- configurationResult = (await (0, enquirer_1.prompt)({
136
+ selectedAgents = (await (0, enquirer_1.prompt)({
167
137
  type: 'multiselect',
168
138
  name: 'agents',
169
139
  message: 'Which AI agents would you like to configure? (space to select, enter to confirm)',
170
- choices: nonConfiguredAgents.map((a) => getAgentChoiceForPrompt(a, false, false)),
140
+ choices: allAgentChoices,
141
+ initial: preselectedIndices,
171
142
  required: true,
143
+ footer: function () {
144
+ const focused = this.focused;
145
+ if (focused.partial) {
146
+ return chalk.dim(focused.partialReason);
147
+ }
148
+ if (focused.agentConfiguration.outdated) {
149
+ return chalk.dim(` The rules file at ${focused.rulesDisplayPath} can be updated with the latest Nx recommendations`);
150
+ }
151
+ if (!focused.agentConfiguration.mcp &&
152
+ !focused.agentConfiguration.rules) {
153
+ return chalk.dim(` Configures agent rules at ${focused.rulesDisplayPath} and the Nx MCP server ${focused.mcpDisplayPath
154
+ ? `at ${focused.mcpDisplayPath}`
155
+ : 'via Nx Console'}`);
156
+ }
157
+ },
172
158
  })).agents;
173
159
  }
174
160
  catch {
@@ -177,48 +163,67 @@ async function configureAiAgentsHandlerImpl(options) {
177
163
  }
178
164
  else {
179
165
  // in non-interactive mode, configure all
180
- configurationResult = nonConfiguredAgents;
166
+ selectedAgents = allAgentChoices.map((a) => a.name);
181
167
  }
182
- if (configurationResult?.length === 0) {
168
+ if (selectedAgents?.length === 0) {
183
169
  output_1.output.log({
184
170
  title: 'No agents selected',
185
171
  });
186
172
  process.exit(0);
187
173
  }
174
+ const configSpinner = ora(`Configuring agent(s)...`).start();
188
175
  try {
189
- await (0, utils_1.configureAgents)(configurationResult, workspace_root_1.workspaceRoot, false);
176
+ await (0, utils_1.configureAgents)(selectedAgents, workspace_root_1.workspaceRoot, false);
190
177
  const configuredOrUpdatedAgents = [
191
178
  ...new Set([
192
- ...fullyConfiguredAgents,
193
- ...(updateSucceeded ? updateResult : []),
194
- ...configurationResult,
179
+ ...fullyConfiguredAgents.map((a) => a.name),
180
+ ...selectedAgents,
195
181
  ]),
196
182
  ];
197
- output_1.output.success({
198
- title: 'AI agents set up successfully. Configured agents:',
183
+ configSpinner.stop();
184
+ output_1.output.log({
185
+ title: 'AI agents set up successfully. Configured Agents:',
199
186
  bodyLines: configuredOrUpdatedAgents.map((agent) => `- ${utils_1.agentDisplayMap[agent]}`),
200
187
  });
201
188
  return;
202
189
  }
203
190
  catch (e) {
191
+ configSpinner.fail('Failed to set up AI agents');
204
192
  output_1.output.error({
205
- title: 'Failed to set up AI agents',
193
+ title: 'Error details:',
206
194
  bodyLines: [e.message],
207
195
  });
208
196
  process.exit(1);
209
197
  }
210
198
  }
211
- function getAgentChoiceForPrompt(agent, partiallyConfigured, outdated) {
212
- let message = utils_1.agentDisplayMap[agent];
199
+ function getAgentChoiceForPrompt(agent) {
200
+ const partiallyConfigured = agent.mcp !== agent.rules;
201
+ let message = agent.displayName;
213
202
  if (partiallyConfigured) {
214
- message += ' (partially configured)';
203
+ message += ` (${agent.rules ? 'MCP missing' : 'rules missing'})`;
215
204
  }
216
- else if (outdated) {
205
+ else if (agent.outdated) {
217
206
  message += ' (out of date)';
218
207
  }
208
+ const rulesDisplayPath = agent.rulesPath.startsWith(workspace_root_1.workspaceRoot)
209
+ ? (0, path_1.relative)(workspace_root_1.workspaceRoot, agent.rulesPath)
210
+ : agent.rulesPath;
211
+ const mcpDisplayPath = agent.mcpPath?.startsWith(workspace_root_1.workspaceRoot)
212
+ ? (0, path_1.relative)(workspace_root_1.workspaceRoot, agent.mcpPath)
213
+ : agent.mcpPath;
214
+ const partialReason = partiallyConfigured
215
+ ? agent.rules
216
+ ? ` Partially configured: MCP missing ${agent.mcpPath ? `at ${mcpDisplayPath}` : 'via Nx Console'}`
217
+ : ` Partially configured: rules file missing at ${rulesDisplayPath}`
218
+ : undefined;
219
219
  return {
220
- name: agent,
220
+ name: agent.name,
221
221
  message,
222
+ partial: partiallyConfigured,
223
+ partialReason,
224
+ agentConfiguration: agent,
225
+ rulesDisplayPath,
226
+ mcpDisplayPath,
222
227
  };
223
228
  }
224
229
  function normalizeOptions(options) {
@@ -37,7 +37,7 @@ function withFormatOptions(yargs) {
37
37
  coerce: shared_options_1.parseCSV,
38
38
  })
39
39
  .option('sort-root-tsconfig-paths', {
40
- describe: `Ensure the workspace's tsconfig compilerOptions.paths are sorted. Warning: This will cause comments in the tsconfig to be lost. The default value is "true" unless NX_FORMAT_SORT_TSCONFIG_PATHS is set to "false".`,
40
+ describe: `Ensure the workspace's tsconfig compilerOptions.paths are sorted. Warning: This will cause comments in the tsconfig to be lost. The default value is "false" unless NX_FORMAT_SORT_TSCONFIG_PATHS is set to "true".`,
41
41
  type: 'boolean',
42
42
  })
43
43
  .option('all', {
@@ -48,12 +48,8 @@ function withFormatOptions(yargs) {
48
48
  all: 'projects',
49
49
  })
50
50
  .middleware((args) => {
51
- /**
52
- * TODO(v22): Stop sorting tsconfig paths by default, paths are now less common/important
53
- * in Nx workspace setups, and the sorting causes comments to be lost.
54
- */
55
51
  args.sortRootTsconfigPaths ??=
56
- process.env.NX_FORMAT_SORT_TSCONFIG_PATHS !== 'false';
52
+ process.env.NX_FORMAT_SORT_TSCONFIG_PATHS === 'true';
57
53
  // If NX_FORMAT_SORT_TSCONFIG_PATHS=false and --sort-root-tsconfig-paths is passed, we want to set it to true favoring the arg
58
54
  process.env.NX_FORMAT_SORT_TSCONFIG_PATHS =
59
55
  args.sortRootTsconfigPaths.toString();
@@ -113,7 +113,7 @@ async function getPatternsFromApps(affectedFiles, allWorkspaceFiles, projectGrap
113
113
  const graph = await (0, project_graph_1.createProjectGraphAsync)({
114
114
  exitOnError: true,
115
115
  });
116
- const affectedGraph = await (0, affected_project_graph_1.filterAffected)(graph, (0, file_utils_1.calculateFileChanges)(affectedFiles, allWorkspaceFiles));
116
+ const affectedGraph = await (0, affected_project_graph_1.filterAffected)(graph, (0, file_utils_1.calculateFileChanges)(affectedFiles));
117
117
  return getPatternsFromProjects(Object.keys(affectedGraph.nodes), projectGraph);
118
118
  }
119
119
  function addRootConfigFiles(chunkList, nxArgs) {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addNxToMonorepo = addNxToMonorepo;
4
4
  const enquirer_1 = require("enquirer");
5
5
  const fs_1 = require("fs");
6
- const ignore_1 = require("ignore");
6
+ 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");
@@ -113,7 +113,7 @@ function allPackageJsonFiles(repoRoot, dirName) {
113
113
  return res;
114
114
  }
115
115
  function getIgnoredGlobs(repoRoot) {
116
- const ig = (0, ignore_1.default)();
116
+ const ig = ignore();
117
117
  try {
118
118
  ig.add((0, fs_1.readFileSync)(`${repoRoot}/.gitignore`, 'utf-8'));
119
119
  }
@@ -1 +1 @@
1
- {"version":3,"file":"changelog.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/release/changelog.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,sBAAsB,EAAc,MAAM,sBAAsB,CAAC;AAkB1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAmBpD,OAAO,EAEL,SAAS,EAUV,MAAM,aAAa,CAAC;AAYrB,OAAO,EACL,cAAc,EASf,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,wBAAwB;IACvC,kBAAkB,CAAC,EAAE;QACnB,cAAc,EAAE,cAAc,CAAC;QAC/B,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;KACjC,CAAC;IACF,iBAAiB,CAAC,EAAE;QAClB,CAAC,WAAW,EAAE,MAAM,GAAG;YACrB,cAAc,EAAE,cAAc,CAAC;YAC/B,QAAQ,EAAE,MAAM,CAAC;YACjB,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;SACjC,CAAC;KACH,CAAC;CACH;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gBAAgB,CAAC,EAAE,SAAS,EAAE,CAAC;IAC/B,OAAO,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,MAAM,WAAW,GAAG,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAElE,eAAO,MAAM,0BAA0B,GAAI,MAAM,gBAAgB,oBACV,CAAC;AAExD,wBAAgB,SAAS,CAAC,qBAAqB,EAAE,sBAAsB,IAOnE,MAAM,gBAAgB,KACrB,OAAO,CAAC,wBAAwB,CAAC,CAisBrC"}
1
+ {"version":3,"file":"changelog.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/release/changelog.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,sBAAsB,EAAc,MAAM,sBAAsB,CAAC;AAkB1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAmBpD,OAAO,EAEL,SAAS,EAWV,MAAM,aAAa,CAAC;AAYrB,OAAO,EACL,cAAc,EASf,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,wBAAwB;IACvC,kBAAkB,CAAC,EAAE;QACnB,cAAc,EAAE,cAAc,CAAC;QAC/B,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;KACjC,CAAC;IACF,iBAAiB,CAAC,EAAE;QAClB,CAAC,WAAW,EAAE,MAAM,GAAG;YACrB,cAAc,EAAE,cAAc,CAAC;YAC/B,QAAQ,EAAE,MAAM,CAAC;YACjB,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;SACjC,CAAC;KACH,CAAC;CACH;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gBAAgB,CAAC,EAAE,SAAS,EAAE,CAAC;IAC/B,OAAO,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,MAAM,WAAW,GAAG,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAElE,eAAO,MAAM,0BAA0B,GAAI,MAAM,gBAAgB,oBACV,CAAC;AAExD,wBAAgB,SAAS,CAAC,qBAAqB,EAAE,sBAAsB,IAOnE,MAAM,gBAAgB,KACrB,OAAO,CAAC,wBAAwB,CAAC,CA+qBrC"}
@@ -155,8 +155,6 @@ function createAPI(overrideReleaseConfig) {
155
155
  (0, shared_1.handleDuplicateGitTags)(gitTagValues);
156
156
  const postGitTasks = [];
157
157
  let workspaceChangelogChanges = [];
158
- // TODO(v22): remove this after the changelog renderer is refactored to remove coupling with git commits
159
- let workspaceChangelogCommits = [];
160
158
  // If there are multiple release groups, we'll just skip the workspace changelog anyway.
161
159
  const versionPlansEnabledForWorkspaceChangelog = releaseGroups[0].resolvedVersionPlans;
162
160
  if (versionPlansEnabledForWorkspaceChangelog) {
@@ -168,13 +166,13 @@ function createAPI(overrideReleaseConfig) {
168
166
  .flatMap((vp) => {
169
167
  const releaseType = versionPlanSemverReleaseTypeToChangelogType(vp.groupVersionBump);
170
168
  let githubReferences = [];
171
- let author = undefined;
169
+ let authors = undefined;
172
170
  const parsedCommit = vp.commit
173
- ? (0, git_1.parseGitCommit)(vp.commit, true)
171
+ ? (0, git_1.parseVersionPlanCommit)(vp.commit)
174
172
  : null;
175
173
  if (parsedCommit) {
176
174
  githubReferences = parsedCommit.references;
177
- author = parsedCommit.author;
175
+ authors = parsedCommit.authors;
178
176
  }
179
177
  const changes = !vp.triggeredByProjects
180
178
  ? {
@@ -184,8 +182,7 @@ function createAPI(overrideReleaseConfig) {
184
182
  body: '',
185
183
  isBreaking: releaseType.isBreaking,
186
184
  githubReferences,
187
- // TODO(JamesHenry): Implement support for Co-authored-by and adding multiple authors
188
- authors: [author],
185
+ authors,
189
186
  affectedProjects: '*',
190
187
  }
191
188
  : vp.triggeredByProjects.map((project) => {
@@ -196,8 +193,7 @@ function createAPI(overrideReleaseConfig) {
196
193
  body: '',
197
194
  isBreaking: releaseType.isBreaking,
198
195
  githubReferences,
199
- // TODO(JamesHenry): Implement support for Co-authored-by and adding multiple authors
200
- authors: [author],
196
+ authors,
201
197
  affectedProjects: [project],
202
198
  };
203
199
  });
@@ -229,8 +225,7 @@ function createAPI(overrideReleaseConfig) {
229
225
  }
230
226
  // Make sure that the fromRef is actually resolvable
231
227
  const workspaceChangelogFromSHA = await (0, git_1.getCommitHash)(workspaceChangelogFromRef);
232
- workspaceChangelogCommits = await getCommits(workspaceChangelogFromSHA, toSHA);
233
- workspaceChangelogChanges = filterHiddenChanges(workspaceChangelogCommits.map((c) => {
228
+ workspaceChangelogChanges = filterHiddenChanges((await getCommits(workspaceChangelogFromSHA, toSHA)).map((c) => {
234
229
  return {
235
230
  type: c.type,
236
231
  scope: c.scope,
@@ -238,7 +233,7 @@ function createAPI(overrideReleaseConfig) {
238
233
  body: c.body,
239
234
  isBreaking: c.isBreaking,
240
235
  githubReferences: c.references,
241
- authors: [c.author],
236
+ authors: c.authors,
242
237
  shortHash: c.shortHash,
243
238
  revertedHashes: c.revertedHashes,
244
239
  affectedProjects: '*',
@@ -312,8 +307,6 @@ function createAPI(overrideReleaseConfig) {
312
307
  if (releaseGroup.projectsRelationship === 'independent') {
313
308
  for (const project of projectNodes) {
314
309
  let changes = null;
315
- // TODO(v22): remove this after the changelog renderer is refactored to remove coupling with git commits
316
- let commits;
317
310
  if (releaseGroup.resolvedVersionPlans) {
318
311
  changes = releaseGroup.resolvedVersionPlans
319
312
  .map((vp) => {
@@ -325,12 +318,11 @@ function createAPI(overrideReleaseConfig) {
325
318
  let githubReferences = [];
326
319
  let authors = [];
327
320
  const parsedCommit = vp.commit
328
- ? (0, git_1.parseGitCommit)(vp.commit, true)
321
+ ? (0, git_1.parseVersionPlanCommit)(vp.commit)
329
322
  : null;
330
323
  if (parsedCommit) {
331
324
  githubReferences = parsedCommit.references;
332
- // TODO(JamesHenry): Implement support for Co-authored-by and adding multiple authors
333
- authors = [parsedCommit.author];
325
+ authors = parsedCommit.authors;
334
326
  }
335
327
  return {
336
328
  type: releaseType.type,
@@ -356,6 +348,7 @@ function createAPI(overrideReleaseConfig) {
356
348
  releaseTagPatternRequireSemver: releaseGroup.releaseTagPatternRequireSemver,
357
349
  releaseTagPatternStrictPreid: releaseGroup.releaseTagPatternStrictPreid,
358
350
  }))?.tag;
351
+ let commits;
359
352
  if (!fromRef && useAutomaticFromRef) {
360
353
  const firstCommit = await (0, git_1.getFirstGitCommit)();
361
354
  commits = await filterProjectCommits({
@@ -387,8 +380,7 @@ function createAPI(overrideReleaseConfig) {
387
380
  body: c.body,
388
381
  isBreaking: c.isBreaking,
389
382
  githubReferences: c.references,
390
- // TODO(JamesHenry): Implement support for Co-authored-by and adding multiple authors
391
- authors: [c.author],
383
+ authors: c.authors,
392
384
  shortHash: c.shortHash,
393
385
  revertedHashes: c.revertedHashes,
394
386
  affectedProjects: commitChangesNonProjectFiles(c, fileMap.nonProjectFiles)
@@ -419,20 +411,18 @@ function createAPI(overrideReleaseConfig) {
419
411
  }
420
412
  else {
421
413
  let changes = [];
422
- // TODO(v22): remove this after the changelog renderer is refactored to remove coupling with git commits
423
- let commits = [];
424
414
  if (releaseGroup.resolvedVersionPlans) {
425
415
  changes = releaseGroup.resolvedVersionPlans
426
416
  .flatMap((vp) => {
427
417
  const releaseType = versionPlanSemverReleaseTypeToChangelogType(vp.groupVersionBump);
428
418
  let githubReferences = [];
429
- let author = undefined;
419
+ let authors = undefined;
430
420
  const parsedCommit = vp.commit
431
- ? (0, git_1.parseGitCommit)(vp.commit, true)
421
+ ? (0, git_1.parseVersionPlanCommit)(vp.commit)
432
422
  : null;
433
423
  if (parsedCommit) {
434
424
  githubReferences = parsedCommit.references;
435
- author = parsedCommit.author;
425
+ authors = parsedCommit.authors;
436
426
  }
437
427
  const changes = !vp.triggeredByProjects
438
428
  ? {
@@ -442,8 +432,7 @@ function createAPI(overrideReleaseConfig) {
442
432
  body: '',
443
433
  isBreaking: releaseType.isBreaking,
444
434
  githubReferences,
445
- // TODO(JamesHenry): Implement support for Co-authored-by and adding multiple authors
446
- authors: [author],
435
+ authors,
447
436
  affectedProjects: '*',
448
437
  }
449
438
  : vp.triggeredByProjects.map((project) => {
@@ -454,8 +443,7 @@ function createAPI(overrideReleaseConfig) {
454
443
  body: '',
455
444
  isBreaking: releaseType.isBreaking,
456
445
  githubReferences,
457
- // TODO(JamesHenry): Implement support for Co-authored-by and adding multiple authors
458
- authors: [author],
446
+ authors,
459
447
  affectedProjects: [project],
460
448
  };
461
449
  });
@@ -487,16 +475,14 @@ function createAPI(overrideReleaseConfig) {
487
475
  const fromSHA = await (0, git_1.getCommitHash)(fromRef);
488
476
  const { fileMap } = await (0, file_map_utils_1.createFileMapUsingProjectGraph)(projectGraph);
489
477
  const fileToProjectMap = createFileToProjectMap(fileMap.projectFileMap);
490
- commits = await getCommits(fromSHA, toSHA);
491
- changes = filterHiddenChanges(commits.map((c) => ({
478
+ changes = filterHiddenChanges((await getCommits(fromSHA, toSHA)).map((c) => ({
492
479
  type: c.type,
493
480
  scope: c.scope,
494
481
  description: c.description,
495
482
  body: c.body,
496
483
  isBreaking: c.isBreaking,
497
484
  githubReferences: c.references,
498
- // TODO(JamesHenry): Implement support for Co-authored-by and adding multiple authors
499
- authors: [c.author],
485
+ authors: c.authors,
500
486
  shortHash: c.shortHash,
501
487
  revertedHashes: c.revertedHashes,
502
488
  affectedProjects: commitChangesNonProjectFiles(c, fileMap.nonProjectFiles)