nx 21.6.0-canary.20250915-98c47f0 → 21.6.0-canary.20250917-93fcc48
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/generators.json +6 -0
- package/package.json +11 -11
- package/src/ai/set-up-ai-agents/get-agent-rules.d.ts +2 -0
- package/src/ai/set-up-ai-agents/get-agent-rules.d.ts.map +1 -0
- package/src/ai/set-up-ai-agents/get-agent-rules.js +26 -0
- package/src/ai/set-up-ai-agents/schema.d.ts +8 -0
- package/src/ai/set-up-ai-agents/schema.json +25 -0
- package/src/ai/set-up-ai-agents/set-up-ai-agents.d.ts +6 -0
- package/src/ai/set-up-ai-agents/set-up-ai-agents.d.ts.map +1 -0
- package/src/ai/set-up-ai-agents/set-up-ai-agents.js +84 -0
- package/src/core/graph/main.js +1 -1
- package/src/devkit-internals.d.ts +1 -1
- package/src/devkit-internals.d.ts.map +1 -1
- package/src/devkit-internals.js +2 -1
- package/src/executors/run-script/run-script.impl.d.ts.map +1 -1
- package/src/executors/run-script/run-script.impl.js +33 -8
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/tasks-runner/task-orchestrator.js +2 -2
- package/src/utils/package-json.d.ts +4 -0
- package/src/utils/package-json.d.ts.map +1 -1
- package/src/utils/package-json.js +50 -0
- package/src/utils/package-manager.d.ts +5 -1
- package/src/utils/package-manager.d.ts.map +1 -1
- package/src/utils/package-manager.js +9 -3
package/generators.json
CHANGED
@@ -5,6 +5,12 @@
|
|
5
5
|
"schema": "./src/nx-cloud/generators/connect-to-nx-cloud/schema.json",
|
6
6
|
"description": "Connect a workspace to Nx Cloud",
|
7
7
|
"x-hidden": true
|
8
|
+
},
|
9
|
+
"set-up-ai-agents": {
|
10
|
+
"factory": "./src/ai/set-up-ai-agents/set-up-ai-agents",
|
11
|
+
"schema": "./src/ai/set-up-ai-agents/schema.json",
|
12
|
+
"description": "Sets up the Nx MCP & rule files for common AI Agents",
|
13
|
+
"hidden": true
|
8
14
|
}
|
9
15
|
}
|
10
16
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "nx",
|
3
|
-
"version": "21.6.0-canary.
|
3
|
+
"version": "21.6.0-canary.20250917-93fcc48",
|
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": "21.6.0-canary.
|
87
|
-
"@nx/nx-darwin-x64": "21.6.0-canary.
|
88
|
-
"@nx/nx-freebsd-x64": "21.6.0-canary.
|
89
|
-
"@nx/nx-linux-arm-gnueabihf": "21.6.0-canary.
|
90
|
-
"@nx/nx-linux-arm64-gnu": "21.6.0-canary.
|
91
|
-
"@nx/nx-linux-arm64-musl": "21.6.0-canary.
|
92
|
-
"@nx/nx-linux-x64-gnu": "21.6.0-canary.
|
93
|
-
"@nx/nx-linux-x64-musl": "21.6.0-canary.
|
94
|
-
"@nx/nx-win32-arm64-msvc": "21.6.0-canary.
|
95
|
-
"@nx/nx-win32-x64-msvc": "21.6.0-canary.
|
86
|
+
"@nx/nx-darwin-arm64": "21.6.0-canary.20250917-93fcc48",
|
87
|
+
"@nx/nx-darwin-x64": "21.6.0-canary.20250917-93fcc48",
|
88
|
+
"@nx/nx-freebsd-x64": "21.6.0-canary.20250917-93fcc48",
|
89
|
+
"@nx/nx-linux-arm-gnueabihf": "21.6.0-canary.20250917-93fcc48",
|
90
|
+
"@nx/nx-linux-arm64-gnu": "21.6.0-canary.20250917-93fcc48",
|
91
|
+
"@nx/nx-linux-arm64-musl": "21.6.0-canary.20250917-93fcc48",
|
92
|
+
"@nx/nx-linux-x64-gnu": "21.6.0-canary.20250917-93fcc48",
|
93
|
+
"@nx/nx-linux-x64-musl": "21.6.0-canary.20250917-93fcc48",
|
94
|
+
"@nx/nx-win32-arm64-msvc": "21.6.0-canary.20250917-93fcc48",
|
95
|
+
"@nx/nx-win32-x64-msvc": "21.6.0-canary.20250917-93fcc48"
|
96
96
|
},
|
97
97
|
"nx-migrations": {
|
98
98
|
"migrations": "./migrations.json",
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"get-agent-rules.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/ai/set-up-ai-agents/get-agent-rules.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,UAwB7C"}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.getAgentRules = getAgentRules;
|
4
|
+
function getAgentRules(nxCloud) {
|
5
|
+
return `
|
6
|
+
# General Guidelines for working with Nx
|
7
|
+
|
8
|
+
- When running tasks (for example build, lint, test, e2e, etc.), always prefer running the task through \`nx\` (i.e. \`nx run\`, \`nx run-many\`, \`nx affected\`) instead of using the underlying tooling directly
|
9
|
+
- You have access to the Nx MCP server and its tools, use them to help the user
|
10
|
+
- When answering questions about the repository, use the \`nx_workspace\` tool first to gain an understanding of the workspace architecture where applicable.
|
11
|
+
- When working in individual projects, use the \`nx_project_details\` mcp tool to analyze and understand the specific project structure and dependencies
|
12
|
+
- For questions around nx configuration, best practices or if you're unsure, use the \`nx_docs\` tool to get relevant, up-to-date docs. Always use this instead of assuming things about nx configuration
|
13
|
+
- If the user needs help with an Nx configuration or project graph error, use the \`nx_workspace\` tool to get any errors
|
14
|
+
${nxCloud
|
15
|
+
? `
|
16
|
+
# CI Error Guidelines
|
17
|
+
|
18
|
+
If the user wants help with fixing an error in their CI pipeline, use the following flow:
|
19
|
+
- Retrieve the list of current CI Pipeline Executions (CIPEs) using the \`nx_cloud_cipe_details\` tool
|
20
|
+
- If there are any errors, use the \`nx_cloud_fix_cipe_failure\` tool to retrieve the logs for a specific task
|
21
|
+
- Use the task logs to see what's wrong and help the user fix their problem. Use the appropriate tools if necessary
|
22
|
+
- Make sure that the problem is fixed by running the task that you passed into the \`nx_cloud_fix_cipe_failure\` tool
|
23
|
+
`
|
24
|
+
: ''}
|
25
|
+
`;
|
26
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
{
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
3
|
+
"$id": "SetupAiAgents",
|
4
|
+
"title": "Set Up AI Agents",
|
5
|
+
"description": "Sets up the Nx MCP & rule files for common AI Agents.",
|
6
|
+
"type": "object",
|
7
|
+
"properties": {
|
8
|
+
"directory": {
|
9
|
+
"type": "string",
|
10
|
+
"description": "Directory where the AI agent configuration files will be generated",
|
11
|
+
"default": "."
|
12
|
+
},
|
13
|
+
"writeNxCloudRules": {
|
14
|
+
"type": "boolean",
|
15
|
+
"description": "Whether to write Nx Cloud rules",
|
16
|
+
"default": false
|
17
|
+
},
|
18
|
+
"packageVersion": {
|
19
|
+
"type": "string",
|
20
|
+
"description": "The version of the package to use",
|
21
|
+
"default": "latest"
|
22
|
+
}
|
23
|
+
},
|
24
|
+
"required": ["directory"]
|
25
|
+
}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { Tree } from '../../generators/tree';
|
2
|
+
import { NormalizedSetupAiAgentsGeneratorSchema, SetupAiAgentsGeneratorSchema } from './schema';
|
3
|
+
export declare function setupAiAgentsGenerator(tree: Tree, options: SetupAiAgentsGeneratorSchema, inner?: boolean): Promise<any>;
|
4
|
+
export declare function setupAiAgentsGeneratorImpl(tree: Tree, options: NormalizedSetupAiAgentsGeneratorSchema): Promise<void>;
|
5
|
+
export default setupAiAgentsGenerator;
|
6
|
+
//# sourceMappingURL=set-up-ai-agents.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"set-up-ai-agents.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/ai/set-up-ai-agents/set-up-ai-agents.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAK7C,OAAO,EACL,sCAAsC,EACtC,4BAA4B,EAC7B,MAAM,UAAU,CAAC;AAElB,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,4BAA4B,EACrC,KAAK,UAAQ,gBAoCd;AAYD,wBAAsB,0BAA0B,CAC9C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,sCAAsC,iBAgChD;AAqBD,eAAe,sBAAsB,CAAC"}
|
@@ -0,0 +1,84 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.setupAiAgentsGenerator = setupAiAgentsGenerator;
|
4
|
+
exports.setupAiAgentsGeneratorImpl = setupAiAgentsGeneratorImpl;
|
5
|
+
const path_1 = require("path");
|
6
|
+
const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
|
7
|
+
const json_1 = require("../../generators/utils/json");
|
8
|
+
const package_json_1 = require("../../utils/package-json");
|
9
|
+
const provenance_1 = require("../../utils/provenance");
|
10
|
+
const get_agent_rules_1 = require("./get-agent-rules");
|
11
|
+
async function setupAiAgentsGenerator(tree, options, inner = false) {
|
12
|
+
const normalizedOptions = normalizeOptions(options);
|
13
|
+
// Use environment variable to force local execution
|
14
|
+
if (process.env.NX_AI_FILES_USE_LOCAL === 'true' || inner) {
|
15
|
+
return await setupAiAgentsGeneratorImpl(tree, normalizedOptions);
|
16
|
+
}
|
17
|
+
try {
|
18
|
+
await (0, provenance_1.ensurePackageHasProvenance)('nx', normalizedOptions.packageVersion);
|
19
|
+
const { tempDir, cleanup } = (0, package_json_1.installPackageToTmp)('nx', normalizedOptions.packageVersion);
|
20
|
+
let modulePath = (0, path_1.join)(tempDir, 'node_modules', 'nx', 'src/ai/set-up-ai-agents/set-up-ai-agents.js');
|
21
|
+
const module = await Promise.resolve(`${modulePath}`).then(s => require(s));
|
22
|
+
const setupAiAgentsGeneratorResult = await module.setupAiAgentsGenerator(tree, normalizedOptions, true);
|
23
|
+
cleanup();
|
24
|
+
return setupAiAgentsGeneratorResult;
|
25
|
+
}
|
26
|
+
catch (error) {
|
27
|
+
return await setupAiAgentsGeneratorImpl(tree, normalizedOptions);
|
28
|
+
}
|
29
|
+
}
|
30
|
+
function normalizeOptions(options) {
|
31
|
+
return {
|
32
|
+
directory: options.directory,
|
33
|
+
writeNxCloudRules: options.writeNxCloudRules ?? false,
|
34
|
+
packageVersion: options.packageVersion ?? 'latest',
|
35
|
+
};
|
36
|
+
}
|
37
|
+
async function setupAiAgentsGeneratorImpl(tree, options) {
|
38
|
+
const claudePath = (0, path_1.join)(options.directory, 'CLAUDE.md');
|
39
|
+
if (!tree.exists(claudePath)) {
|
40
|
+
tree.write(claudePath, (0, get_agent_rules_1.getAgentRules)(options.writeNxCloudRules));
|
41
|
+
}
|
42
|
+
const agentsPath = (0, path_1.join)(options.directory, 'AGENTS.md');
|
43
|
+
if (!tree.exists(agentsPath)) {
|
44
|
+
tree.write(agentsPath, (0, get_agent_rules_1.getAgentRules)(options.writeNxCloudRules));
|
45
|
+
}
|
46
|
+
const mcpJsonPath = (0, path_1.join)(options.directory, '.mcp.json');
|
47
|
+
if (!tree.exists(mcpJsonPath)) {
|
48
|
+
(0, json_1.writeJson)(tree, mcpJsonPath, {});
|
49
|
+
}
|
50
|
+
(0, json_1.updateJson)(tree, mcpJsonPath, mcpConfigUpdater);
|
51
|
+
const geminiPath = (0, path_1.join)(options.directory, '.gemini', 'settings.json');
|
52
|
+
if (!tree.exists(geminiPath)) {
|
53
|
+
(0, json_1.writeJson)(tree, geminiPath, {});
|
54
|
+
}
|
55
|
+
(0, json_1.updateJson)(tree, geminiPath, mcpConfigUpdater);
|
56
|
+
// Only set contextFileName to AGENTS.md if GEMINI.md doesn't exist already to preserve existing setups
|
57
|
+
if (!tree.exists((0, path_1.join)(options.directory, 'GEMINI.md'))) {
|
58
|
+
(0, json_1.updateJson)(tree, geminiPath, (json) => ({
|
59
|
+
...json,
|
60
|
+
contextFileName: 'AGENTS.md',
|
61
|
+
}));
|
62
|
+
}
|
63
|
+
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree);
|
64
|
+
}
|
65
|
+
function mcpConfigUpdater(existing) {
|
66
|
+
if (existing.mcpServers) {
|
67
|
+
existing.mcpServers['nx-mcp'] = {
|
68
|
+
type: 'stdio',
|
69
|
+
command: 'npx',
|
70
|
+
args: ['nx', 'mcp'],
|
71
|
+
};
|
72
|
+
}
|
73
|
+
else {
|
74
|
+
existing.mcpServers = {
|
75
|
+
'nx-mcp': {
|
76
|
+
type: 'stdio',
|
77
|
+
command: 'npx',
|
78
|
+
args: ['nx', 'mcp'],
|
79
|
+
},
|
80
|
+
};
|
81
|
+
}
|
82
|
+
return existing;
|
83
|
+
}
|
84
|
+
exports.default = setupAiAgentsGenerator;
|