nx 21.6.2 → 21.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +12 -12
- package/project.json +2 -1
- package/src/ai/utils.d.ts +6 -5
- package/src/ai/utils.d.ts.map +1 -1
- package/src/ai/utils.js +14 -13
- package/src/command-line/affected/affected.d.ts.map +1 -1
- package/src/command-line/affected/affected.js +1 -2
- package/src/command-line/configure-ai-agents/command-object.d.ts +1 -1
- package/src/command-line/configure-ai-agents/command-object.d.ts.map +1 -1
- package/src/command-line/configure-ai-agents/command-object.js +18 -4
- package/src/command-line/configure-ai-agents/configure-ai-agents.d.ts.map +1 -1
- package/src/command-line/configure-ai-agents/configure-ai-agents.js +134 -102
- package/src/command-line/format/format.js +1 -1
- package/src/command-line/init/ai-agent-prompts.d.ts +3 -0
- package/src/command-line/init/ai-agent-prompts.d.ts.map +1 -0
- package/src/command-line/init/ai-agent-prompts.js +28 -0
- package/src/command-line/init/command-object.js +6 -0
- package/src/command-line/init/init-v2.d.ts +2 -0
- package/src/command-line/init/init-v2.d.ts.map +1 -1
- package/src/command-line/init/init-v2.js +20 -0
- package/src/command-line/nx-cloud/login/command-object.d.ts.map +1 -1
- package/src/command-line/nx-cloud/login/command-object.js +2 -2
- package/src/command-line/nx-cloud/logout/command-object.js +1 -1
- package/src/command-line/release/utils/get-touched-projects-for-group.js +1 -1
- package/src/command-line/show/projects.js +1 -2
- package/src/core/graph/main.js +1 -1
- package/src/core/graph/styles.js +1 -1
- package/src/native/index.d.ts +2 -2
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +1 -1
- package/src/project-graph/file-utils.d.ts +5 -2
- package/src/project-graph/file-utils.d.ts.map +1 -1
- package/src/project-graph/file-utils.js +1 -5
- package/src/tasks-runner/run-command.js +2 -2
- package/src/utils/nx-console-prompt.d.ts.map +1 -1
- package/src/utils/nx-console-prompt.js +4 -1
- package/src/utils/provenance.d.ts.map +1 -1
- package/src/utils/provenance.js +28 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nx",
|
|
3
|
-
"version": "21.6.
|
|
3
|
+
"version": "21.6.4",
|
|
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": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@yarnpkg/lockfile": "^1.1.0",
|
|
39
39
|
"@yarnpkg/parsers": "3.0.2",
|
|
40
40
|
"@zkochan/js-yaml": "0.0.7",
|
|
41
|
-
"axios": "^1.
|
|
41
|
+
"axios": "^1.12.0",
|
|
42
42
|
"chalk": "^4.1.0",
|
|
43
43
|
"cli-cursor": "3.1.0",
|
|
44
44
|
"cli-spinners": "2.6.1",
|
|
@@ -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.4",
|
|
87
|
+
"@nx/nx-darwin-x64": "21.6.4",
|
|
88
|
+
"@nx/nx-freebsd-x64": "21.6.4",
|
|
89
|
+
"@nx/nx-linux-arm-gnueabihf": "21.6.4",
|
|
90
|
+
"@nx/nx-linux-arm64-gnu": "21.6.4",
|
|
91
|
+
"@nx/nx-linux-arm64-musl": "21.6.4",
|
|
92
|
+
"@nx/nx-linux-x64-gnu": "21.6.4",
|
|
93
|
+
"@nx/nx-linux-x64-musl": "21.6.4",
|
|
94
|
+
"@nx/nx-win32-arm64-msvc": "21.6.4",
|
|
95
|
+
"@nx/nx-win32-x64-msvc": "21.6.4"
|
|
96
96
|
},
|
|
97
97
|
"nx-migrations": {
|
|
98
98
|
"migrations": "./migrations.json",
|
package/project.json
CHANGED
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:
|
|
14
|
-
partiallyConfiguredAgents:
|
|
15
|
-
fullyConfiguredAgents:
|
|
16
|
-
disabledAgents:
|
|
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
|
package/src/ai/utils.d.ts.map
CHANGED
|
@@ -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,
|
|
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
|
|
40
|
-
if (
|
|
41
|
-
disabledAgents.push(
|
|
38
|
+
const configuration = await getAgentConfiguration(agent, workspaceRoot);
|
|
39
|
+
if (configuration.disabled) {
|
|
40
|
+
disabledAgents.push(configuration);
|
|
42
41
|
continue;
|
|
43
42
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
fullyConfiguredAgents.push(agent);
|
|
43
|
+
if (configuration.mcp && configuration.rules) {
|
|
44
|
+
fullyConfiguredAgents.push(configuration);
|
|
47
45
|
}
|
|
48
|
-
else if (!
|
|
49
|
-
nonConfiguredAgents.push(
|
|
46
|
+
else if (!configuration.mcp && !configuration.rules) {
|
|
47
|
+
nonConfiguredAgents.push(configuration);
|
|
50
48
|
}
|
|
51
49
|
else {
|
|
52
|
-
partiallyConfiguredAgents.push(
|
|
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:
|
|
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
|
|
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,
|
|
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,
|
|
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)
|
|
@@ -3,7 +3,7 @@ export interface ConfigureAiAgentsOptions {
|
|
|
3
3
|
agents?: string[];
|
|
4
4
|
interactive?: boolean;
|
|
5
5
|
verbose?: boolean;
|
|
6
|
-
check?: boolean;
|
|
6
|
+
check?: boolean | 'outdated' | 'all';
|
|
7
7
|
}
|
|
8
8
|
export declare const yargsConfigureAiAgentsCommand: CommandModule<{}, ConfigureAiAgentsOptions>;
|
|
9
9
|
//# sourceMappingURL=command-object.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-object.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/configure-ai-agents/command-object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGtC,MAAM,WAAW,wBAAwB;IACvC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"command-object.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/configure-ai-agents/command-object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGtC,MAAM,WAAW,wBAAwB;IACvC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,KAAK,CAAC;CACtC;AAED,eAAO,MAAM,6BAA6B,EAAE,aAAa,CACvD,EAAE,EACF,wBAAwB,CA2DzB,CAAC"}
|
|
@@ -18,14 +18,28 @@ exports.yargsConfigureAiAgentsCommand = {
|
|
|
18
18
|
default: true,
|
|
19
19
|
})
|
|
20
20
|
.option('check', {
|
|
21
|
-
type: '
|
|
22
|
-
description: 'Check
|
|
23
|
-
|
|
21
|
+
type: 'string',
|
|
22
|
+
description: 'Check agent configurations. Use --check or --check=outdated to check only configured agents, or --check=all to include unconfigured/partial configurations. Does not make any changes.',
|
|
23
|
+
coerce: (value) => {
|
|
24
|
+
// --check (no value)
|
|
25
|
+
if (value === '')
|
|
26
|
+
return 'outdated';
|
|
27
|
+
// --check=true
|
|
28
|
+
if (value === 'true')
|
|
29
|
+
return 'outdated';
|
|
30
|
+
// --no-check or --check=false
|
|
31
|
+
if (value === 'false')
|
|
32
|
+
return false;
|
|
33
|
+
// --check=all or --check=outdated
|
|
34
|
+
return value;
|
|
35
|
+
},
|
|
36
|
+
choices: ['outdated', 'all'],
|
|
24
37
|
})
|
|
25
38
|
.example('$0 configure-ai-agents', 'Interactively select AI agents to update and configure')
|
|
26
39
|
.example('$0 configure-ai-agents --agents claude gemini', 'Prompts for updates and and configuration of Claude and Gemini AI agents')
|
|
27
40
|
.example('$0 configure-ai-agents --check', 'Checks if any configured agents are out of date and need to be updated')
|
|
28
|
-
.example('$0 configure-ai-agents --
|
|
41
|
+
.example('$0 configure-ai-agents --check=all', 'Checks if any agents are not configured, out of date or partially configured')
|
|
42
|
+
.example('$0 configure-ai-agents --agents claude gemini --no-interactive', 'Configures and updates Claude and Gemini AI agents without prompts'), // because of the coerce function
|
|
29
43
|
handler: async (args) => {
|
|
30
44
|
await (await Promise.resolve().then(() => require('./configure-ai-agents'))).configureAiAgentsHandler(args);
|
|
31
45
|
},
|
|
@@ -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":"
|
|
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,CAyOf"}
|
|
@@ -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,
|
|
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,117 +58,128 @@ async function configureAiAgentsHandlerImpl(options) {
|
|
|
58
58
|
],
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
|
-
if (normalizedOptions.agents.filter((
|
|
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
|
});
|
|
66
65
|
process.exit(1);
|
|
67
66
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
67
|
+
// important for wording
|
|
68
|
+
const usingAllAgents = normalizedOptions.agents.length === utils_1.supportedAgents.length;
|
|
69
|
+
if (normalizedOptions.check) {
|
|
70
|
+
const outOfDateAgents = fullyConfiguredAgents.filter((a) => a?.outdated);
|
|
71
|
+
// only error if something is fully configured but outdated
|
|
72
|
+
if (normalizedOptions.check === 'outdated') {
|
|
73
|
+
if (fullyConfiguredAgents.length === 0) {
|
|
74
|
+
output_1.output.log({
|
|
75
|
+
title: 'No AI agents are configured',
|
|
76
|
+
bodyLines: [
|
|
77
|
+
'You can configure AI agents by running `nx configure-ai-agents`.',
|
|
78
|
+
],
|
|
79
|
+
});
|
|
80
|
+
process.exit(0);
|
|
81
|
+
}
|
|
82
|
+
if (outOfDateAgents.length === 0) {
|
|
83
|
+
output_1.output.success({
|
|
84
|
+
title: 'All configured AI agents are up to date',
|
|
85
|
+
bodyLines: fullyConfiguredAgents.map((a) => `- ${a.displayName}`),
|
|
86
|
+
});
|
|
87
|
+
process.exit(0);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
output_1.output.log({
|
|
91
|
+
title: 'The following AI agents are out of date:',
|
|
92
|
+
bodyLines: [
|
|
93
|
+
...outOfDateAgents.map((a) => {
|
|
94
|
+
const rulesPath = a.rulesPath;
|
|
95
|
+
const displayPath = rulesPath.startsWith(workspace_root_1.workspaceRoot)
|
|
96
|
+
? (0, path_1.relative)(workspace_root_1.workspaceRoot, rulesPath)
|
|
97
|
+
: rulesPath;
|
|
98
|
+
return `- ${a.displayName} (${displayPath})`;
|
|
99
|
+
}),
|
|
100
|
+
'',
|
|
101
|
+
'You can update them by running `nx configure-ai-agents`.',
|
|
102
|
+
],
|
|
103
|
+
});
|
|
104
|
+
process.exit(1);
|
|
105
|
+
}
|
|
106
|
+
// error on any partial, outdated or non-configured agent
|
|
85
107
|
}
|
|
86
|
-
else {
|
|
87
|
-
|
|
88
|
-
|
|
108
|
+
else if (normalizedOptions.check === 'all') {
|
|
109
|
+
if (partiallyConfiguredAgents.length === 0 &&
|
|
110
|
+
outOfDateAgents.length === 0 &&
|
|
111
|
+
nonConfiguredAgents.length === 0) {
|
|
112
|
+
output_1.output.success({
|
|
113
|
+
title: `All ${!usingAllAgents ? 'selected' : 'supported'} AI agents are fully configured and up to date`,
|
|
114
|
+
bodyLines: fullyConfiguredAgents.map((a) => `- ${a.displayName}`),
|
|
115
|
+
});
|
|
116
|
+
process.exit(0);
|
|
117
|
+
}
|
|
118
|
+
output_1.output.error({
|
|
119
|
+
title: 'The following agents are not fully configured or up to date:',
|
|
89
120
|
bodyLines: [
|
|
90
|
-
...
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
: rulesPath;
|
|
95
|
-
return `- ${utils_1.agentDisplayMap[a]} (${displayPath})`;
|
|
96
|
-
}),
|
|
97
|
-
'',
|
|
98
|
-
'You can update them by running `nx configure-ai-agents`.',
|
|
99
|
-
],
|
|
121
|
+
...partiallyConfiguredAgents,
|
|
122
|
+
...outOfDateAgents,
|
|
123
|
+
...nonConfiguredAgents,
|
|
124
|
+
].map((a) => getAgentChoiceForPrompt(a).message),
|
|
100
125
|
});
|
|
101
126
|
process.exit(1);
|
|
102
127
|
}
|
|
103
128
|
}
|
|
104
|
-
|
|
105
|
-
const
|
|
129
|
+
const allAgentChoices = [];
|
|
130
|
+
const preselectedIndices = [];
|
|
131
|
+
let currentIndex = 0;
|
|
132
|
+
// Partially configured agents first (highest priority)
|
|
106
133
|
partiallyConfiguredAgents.forEach((a) => {
|
|
107
|
-
|
|
134
|
+
allAgentChoices.push(getAgentChoiceForPrompt(a));
|
|
135
|
+
preselectedIndices.push(currentIndex);
|
|
136
|
+
currentIndex++;
|
|
108
137
|
});
|
|
138
|
+
// Outdated agents second
|
|
109
139
|
for (const a of fullyConfiguredAgents) {
|
|
110
|
-
if (
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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
|
-
}
|
|
140
|
+
if (a.outdated) {
|
|
141
|
+
allAgentChoices.push(getAgentChoiceForPrompt(a));
|
|
142
|
+
preselectedIndices.push(currentIndex);
|
|
143
|
+
currentIndex++;
|
|
146
144
|
}
|
|
147
145
|
}
|
|
148
|
-
//
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
...(updateSucceeded ? updateResult : []),
|
|
155
|
-
]),
|
|
156
|
-
];
|
|
146
|
+
// Non-configured agents last
|
|
147
|
+
nonConfiguredAgents.forEach((a) => {
|
|
148
|
+
allAgentChoices.push(getAgentChoiceForPrompt(a));
|
|
149
|
+
currentIndex++;
|
|
150
|
+
});
|
|
151
|
+
if (allAgentChoices.length === 0) {
|
|
157
152
|
output_1.output.success({
|
|
158
153
|
title: `No new agents to configure. All ${!usingAllAgents ? 'selected' : 'supported'} AI agents are already configured:`,
|
|
159
|
-
bodyLines:
|
|
154
|
+
bodyLines: fullyConfiguredAgents.map((agent) => `- ${agent.displayName}`),
|
|
160
155
|
});
|
|
161
156
|
process.exit(0);
|
|
162
157
|
}
|
|
163
|
-
let
|
|
158
|
+
let selectedAgents;
|
|
164
159
|
if (options.interactive !== false) {
|
|
165
160
|
try {
|
|
166
|
-
|
|
161
|
+
selectedAgents = (await (0, enquirer_1.prompt)({
|
|
167
162
|
type: 'multiselect',
|
|
168
163
|
name: 'agents',
|
|
169
164
|
message: 'Which AI agents would you like to configure? (space to select, enter to confirm)',
|
|
170
|
-
choices:
|
|
165
|
+
choices: allAgentChoices,
|
|
166
|
+
initial: preselectedIndices,
|
|
171
167
|
required: true,
|
|
168
|
+
footer: function () {
|
|
169
|
+
const focused = this.focused;
|
|
170
|
+
if (focused.partial) {
|
|
171
|
+
return chalk.dim(focused.partialReason);
|
|
172
|
+
}
|
|
173
|
+
if (focused.agentConfiguration.outdated) {
|
|
174
|
+
return chalk.dim(` The rules file at ${focused.rulesDisplayPath} can be updated with the latest Nx recommendations`);
|
|
175
|
+
}
|
|
176
|
+
if (!focused.agentConfiguration.mcp &&
|
|
177
|
+
!focused.agentConfiguration.rules) {
|
|
178
|
+
return chalk.dim(` Configures agent rules at ${focused.rulesDisplayPath} and the Nx MCP server ${focused.mcpDisplayPath
|
|
179
|
+
? `at ${focused.mcpDisplayPath}`
|
|
180
|
+
: 'via Nx Console'}`);
|
|
181
|
+
}
|
|
182
|
+
},
|
|
172
183
|
})).agents;
|
|
173
184
|
}
|
|
174
185
|
catch {
|
|
@@ -177,55 +188,76 @@ async function configureAiAgentsHandlerImpl(options) {
|
|
|
177
188
|
}
|
|
178
189
|
else {
|
|
179
190
|
// in non-interactive mode, configure all
|
|
180
|
-
|
|
191
|
+
selectedAgents = allAgentChoices.map((a) => a.name);
|
|
181
192
|
}
|
|
182
|
-
if (
|
|
193
|
+
if (selectedAgents?.length === 0) {
|
|
183
194
|
output_1.output.log({
|
|
184
195
|
title: 'No agents selected',
|
|
185
196
|
});
|
|
186
197
|
process.exit(0);
|
|
187
198
|
}
|
|
199
|
+
const configSpinner = ora(`Configuring agent(s)...`).start();
|
|
188
200
|
try {
|
|
189
|
-
await (0, utils_1.configureAgents)(
|
|
201
|
+
await (0, utils_1.configureAgents)(selectedAgents, workspace_root_1.workspaceRoot, false);
|
|
190
202
|
const configuredOrUpdatedAgents = [
|
|
191
203
|
...new Set([
|
|
192
|
-
...fullyConfiguredAgents,
|
|
193
|
-
...
|
|
194
|
-
...configurationResult,
|
|
204
|
+
...fullyConfiguredAgents.map((a) => a.name),
|
|
205
|
+
...selectedAgents,
|
|
195
206
|
]),
|
|
196
207
|
];
|
|
197
|
-
|
|
198
|
-
|
|
208
|
+
configSpinner.stop();
|
|
209
|
+
output_1.output.log({
|
|
210
|
+
title: 'AI agents set up successfully. Configured Agents:',
|
|
199
211
|
bodyLines: configuredOrUpdatedAgents.map((agent) => `- ${utils_1.agentDisplayMap[agent]}`),
|
|
200
212
|
});
|
|
201
213
|
return;
|
|
202
214
|
}
|
|
203
215
|
catch (e) {
|
|
216
|
+
configSpinner.fail('Failed to set up AI agents');
|
|
204
217
|
output_1.output.error({
|
|
205
|
-
title: '
|
|
218
|
+
title: 'Error details:',
|
|
206
219
|
bodyLines: [e.message],
|
|
207
220
|
});
|
|
208
221
|
process.exit(1);
|
|
209
222
|
}
|
|
210
223
|
}
|
|
211
|
-
function getAgentChoiceForPrompt(agent
|
|
212
|
-
|
|
224
|
+
function getAgentChoiceForPrompt(agent) {
|
|
225
|
+
const partiallyConfigured = agent.mcp !== agent.rules;
|
|
226
|
+
let message = agent.displayName;
|
|
213
227
|
if (partiallyConfigured) {
|
|
214
|
-
message +=
|
|
228
|
+
message += ` (${agent.rules ? 'MCP missing' : 'rules missing'})`;
|
|
215
229
|
}
|
|
216
|
-
else if (outdated) {
|
|
230
|
+
else if (agent.outdated) {
|
|
217
231
|
message += ' (out of date)';
|
|
218
232
|
}
|
|
233
|
+
const rulesDisplayPath = agent.rulesPath.startsWith(workspace_root_1.workspaceRoot)
|
|
234
|
+
? (0, path_1.relative)(workspace_root_1.workspaceRoot, agent.rulesPath)
|
|
235
|
+
: agent.rulesPath;
|
|
236
|
+
const mcpDisplayPath = agent.mcpPath?.startsWith(workspace_root_1.workspaceRoot)
|
|
237
|
+
? (0, path_1.relative)(workspace_root_1.workspaceRoot, agent.mcpPath)
|
|
238
|
+
: agent.mcpPath;
|
|
239
|
+
const partialReason = partiallyConfigured
|
|
240
|
+
? agent.rules
|
|
241
|
+
? ` Partially configured: MCP missing ${agent.mcpPath ? `at ${mcpDisplayPath}` : 'via Nx Console'}`
|
|
242
|
+
: ` Partially configured: rules file missing at ${rulesDisplayPath}`
|
|
243
|
+
: undefined;
|
|
219
244
|
return {
|
|
220
|
-
name: agent,
|
|
245
|
+
name: agent.name,
|
|
221
246
|
message,
|
|
247
|
+
partial: partiallyConfigured,
|
|
248
|
+
partialReason,
|
|
249
|
+
agentConfiguration: agent,
|
|
250
|
+
rulesDisplayPath,
|
|
251
|
+
mcpDisplayPath,
|
|
222
252
|
};
|
|
223
253
|
}
|
|
224
254
|
function normalizeOptions(options) {
|
|
225
255
|
const agents = (options.agents ?? utils_1.supportedAgents).filter((a) => utils_1.supportedAgents.includes(a));
|
|
256
|
+
// it used to be just --check which was implicitly 'outdated'
|
|
257
|
+
const check = (options.check === true ? 'outdated' : options.check) ?? false;
|
|
226
258
|
return {
|
|
227
259
|
...options,
|
|
228
260
|
agents,
|
|
229
|
-
check
|
|
261
|
+
check,
|
|
230
262
|
};
|
|
231
263
|
}
|
|
@@ -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
|
|
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) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-agent-prompts.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/init/ai-agent-prompts.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAoC,MAAM,gBAAgB,CAAC;AAEzE,wBAAsB,iBAAiB,CACrC,QAAQ,CAAC,EAAE,KAAK,EAAE,EAClB,WAAW,CAAC,EAAE,OAAO,GACpB,OAAO,CAAC,KAAK,EAAE,CAAC,CASlB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.determineAiAgents = determineAiAgents;
|
|
4
|
+
const enquirer_1 = require("enquirer");
|
|
5
|
+
const is_ci_1 = require("../../utils/is-ci");
|
|
6
|
+
const utils_1 = require("../../ai/utils");
|
|
7
|
+
async function determineAiAgents(aiAgents, interactive) {
|
|
8
|
+
if (interactive === false || (0, is_ci_1.isCI)()) {
|
|
9
|
+
return aiAgents ?? [];
|
|
10
|
+
}
|
|
11
|
+
if (aiAgents) {
|
|
12
|
+
return aiAgents;
|
|
13
|
+
}
|
|
14
|
+
return await aiAgentsPrompt();
|
|
15
|
+
}
|
|
16
|
+
async function aiAgentsPrompt() {
|
|
17
|
+
return (await (0, enquirer_1.prompt)([
|
|
18
|
+
{
|
|
19
|
+
name: 'agents',
|
|
20
|
+
message: 'Which AI agents would you like to set up? (space to select, enter to confirm)',
|
|
21
|
+
type: 'multiselect',
|
|
22
|
+
choices: utils_1.supportedAgents.map((a) => ({
|
|
23
|
+
name: a,
|
|
24
|
+
message: utils_1.agentDisplayMap[a],
|
|
25
|
+
})),
|
|
26
|
+
},
|
|
27
|
+
])).agents;
|
|
28
|
+
}
|
|
@@ -51,6 +51,12 @@ async function withInitOptions(yargs) {
|
|
|
51
51
|
describe: 'Force the migration to continue and ignore custom webpack setup or uncommitted changes. Only for CRA projects.',
|
|
52
52
|
type: 'boolean',
|
|
53
53
|
default: false,
|
|
54
|
+
})
|
|
55
|
+
.option('aiAgents', {
|
|
56
|
+
type: 'array',
|
|
57
|
+
string: true,
|
|
58
|
+
description: 'List of AI agents to set up.',
|
|
59
|
+
choices: ['claude', 'codex', 'copilot', 'cursor', 'gemini'],
|
|
54
60
|
});
|
|
55
61
|
}
|
|
56
62
|
else {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { NxJsonConfiguration } from '../../config/nx-json';
|
|
2
|
+
import { Agent } from '../../ai/utils';
|
|
2
3
|
export interface InitArgs {
|
|
3
4
|
interactive: boolean;
|
|
4
5
|
nxCloud?: boolean;
|
|
@@ -6,6 +7,7 @@ export interface InitArgs {
|
|
|
6
7
|
integrated?: boolean;
|
|
7
8
|
verbose?: boolean;
|
|
8
9
|
force?: boolean;
|
|
10
|
+
aiAgents?: Agent[];
|
|
9
11
|
}
|
|
10
12
|
export declare function initHandler(options: InitArgs): Promise<void>;
|
|
11
13
|
export declare function detectPlugins(nxJson: NxJsonConfiguration, interactive: boolean, includeAngularCli?: boolean): Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-v2.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/init/init-v2.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAc,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"init-v2.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/init/init-v2.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAc,MAAM,sBAAsB,CAAC;AAavE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAgBvC,MAAM,WAAW,QAAQ;IACvB,WAAW,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC;CACpB;AAED,wBAAsB,WAAW,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAyKlE;AA2BD,wBAAsB,aAAa,CACjC,MAAM,EAAE,mBAAmB,EAC3B,WAAW,EAAE,OAAO,EACpB,iBAAiB,CAAC,EAAE,OAAO,GAC1B,OAAO,CAAC;IACT,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,oBAAoB,EAAE,OAAO,CAAC;CAC/B,CAAC,CAgID"}
|