nx 21.6.1 → 21.6.3

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "21.6.1",
3
+ "version": "21.6.3",
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": {
@@ -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": "21.6.3",
87
+ "@nx/nx-darwin-x64": "21.6.3",
88
+ "@nx/nx-freebsd-x64": "21.6.3",
89
+ "@nx/nx-linux-arm-gnueabihf": "21.6.3",
90
+ "@nx/nx-linux-arm64-gnu": "21.6.3",
91
+ "@nx/nx-linux-arm64-musl": "21.6.3",
92
+ "@nx/nx-linux-x64-gnu": "21.6.3",
93
+ "@nx/nx-linux-x64-musl": "21.6.3",
94
+ "@nx/nx-win32-arm64-msvc": "21.6.3",
95
+ "@nx/nx-win32-x64-msvc": "21.6.3"
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) {
@@ -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) {
@@ -45,7 +45,7 @@ function createGetTouchedProjectsForGroup(nxArgs, projectGraph, changedFiles, fi
45
45
  }
46
46
  else {
47
47
  // We only care about directly touched projects, not implicitly affected ones etc
48
- const touchedProjectsArr = await (0, workspace_projects_1.getTouchedProjects)((0, file_utils_1.calculateFileChanges)(changedFiles, fileData, nxArgs, undefined, ignore), projectGraph.nodes);
48
+ const touchedProjectsArr = await (0, workspace_projects_1.getTouchedProjects)((0, file_utils_1.calculateFileChanges)(changedFiles, nxArgs, undefined, ignore), projectGraph.nodes);
49
49
  touchedProjects = touchedProjectsArr.reduce((acc, project) => ({ ...acc, [project]: true }), {});
50
50
  serializedIgnorePatternsToTouchedProjects.set(serializedIgnorePatterns, touchedProjects);
51
51
  }
@@ -7,7 +7,6 @@ const affected_project_graph_1 = require("../../project-graph/affected/affected-
7
7
  const file_utils_1 = require("../../project-graph/file-utils");
8
8
  const operators_1 = require("../../project-graph/operators");
9
9
  const project_graph_1 = require("../../project-graph/project-graph");
10
- const all_file_data_1 = require("../../utils/all-file-data");
11
10
  const command_line_utils_1 = require("../../utils/command-line-utils");
12
11
  const find_matching_projects_1 = require("../../utils/find-matching-projects");
13
12
  async function showProjectsHandler(args) {
@@ -77,5 +76,5 @@ function getAffectedGraph(touchedFiles, nxJson, graph) {
77
76
  return (0, affected_project_graph_1.filterAffected)(graph, touchedFiles, nxJson);
78
77
  }
79
78
  async function getTouchedFiles(nxArgs) {
80
- return (0, file_utils_1.calculateFileChanges)((0, command_line_utils_1.parseFiles)(nxArgs).files, await (0, all_file_data_1.allFileData)(), nxArgs);
79
+ return (0, file_utils_1.calculateFileChanges)((0, command_line_utils_1.parseFiles)(nxArgs).files, nxArgs);
81
80
  }