nx 22.6.0-beta.1 → 22.6.0-beta.11
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/.eslintrc.json +2 -2
- package/bin/init-local.d.ts.map +1 -1
- package/bin/init-local.js +3 -0
- package/bin/nx.js +17 -1
- package/migrations.json +18 -0
- package/package.json +15 -12
- package/plugins/package-json.d.ts +2 -3
- package/plugins/package-json.d.ts.map +1 -1
- package/plugins/package-json.js +9 -9
- package/schemas/nx-schema.json +4 -0
- package/src/adapter/compat.d.ts +1 -1
- package/src/adapter/compat.d.ts.map +1 -1
- package/src/adapter/compat.js +1 -0
- package/src/ai/set-up-ai-agents/set-up-ai-agents.d.ts.map +1 -1
- package/src/ai/set-up-ai-agents/set-up-ai-agents.js +137 -24
- package/src/analytics/analytics.d.ts +8 -0
- package/src/analytics/analytics.d.ts.map +1 -0
- package/src/analytics/analytics.js +307 -0
- package/src/analytics/index.d.ts +2 -0
- package/src/analytics/index.d.ts.map +1 -0
- package/src/analytics/index.js +10 -0
- package/src/command-line/add/add.d.ts.map +1 -1
- package/src/command-line/add/add.js +2 -0
- package/src/command-line/ai/ai-output.d.ts +47 -0
- package/src/command-line/ai/ai-output.d.ts.map +1 -0
- package/src/command-line/ai/ai-output.js +86 -0
- 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 +77 -1
- package/src/command-line/generate/generate.d.ts.map +1 -1
- package/src/command-line/generate/generate.js +2 -0
- package/src/command-line/import/command-object.d.ts.map +1 -1
- package/src/command-line/import/command-object.js +21 -3
- package/src/command-line/import/import.d.ts +1 -0
- package/src/command-line/import/import.d.ts.map +1 -1
- package/src/command-line/import/import.js +264 -40
- package/src/command-line/import/utils/ai-output.d.ts +94 -0
- package/src/command-line/import/utils/ai-output.d.ts.map +1 -0
- package/src/command-line/import/utils/ai-output.js +209 -0
- package/src/command-line/init/init-v2.d.ts +5 -0
- package/src/command-line/init/init-v2.d.ts.map +1 -1
- package/src/command-line/init/init-v2.js +1 -0
- package/src/command-line/init/utils/ai-output.d.ts +4 -43
- package/src/command-line/init/utils/ai-output.d.ts.map +1 -1
- package/src/command-line/init/utils/ai-output.js +7 -81
- package/src/command-line/list/command-object.d.ts.map +1 -1
- package/src/command-line/list/command-object.js +6 -1
- package/src/command-line/list/list.d.ts +2 -0
- package/src/command-line/list/list.d.ts.map +1 -1
- package/src/command-line/list/list.js +5 -1
- package/src/command-line/nx-cloud/apply-locally/apply-locally.d.ts +5 -0
- package/src/command-line/nx-cloud/apply-locally/apply-locally.d.ts.map +1 -0
- package/src/command-line/nx-cloud/apply-locally/apply-locally.js +13 -0
- package/src/command-line/nx-cloud/apply-locally/command-object.d.ts +3 -0
- package/src/command-line/nx-cloud/apply-locally/command-object.d.ts.map +1 -0
- package/src/command-line/nx-cloud/apply-locally/command-object.js +15 -0
- package/src/command-line/nx-cloud/download-cloud-client/download-cloud-client.d.ts.map +1 -1
- package/src/command-line/nx-cloud/download-cloud-client/download-cloud-client.js +12 -6
- package/src/command-line/nx-cloud/login/login.d.ts.map +1 -1
- package/src/command-line/nx-cloud/login/login.js +0 -6
- package/src/command-line/nx-cloud/logout/logout.d.ts.map +1 -1
- package/src/command-line/nx-cloud/logout/logout.js +0 -6
- package/src/command-line/nx-cloud/polygraph/command-object.d.ts +3 -0
- package/src/command-line/nx-cloud/polygraph/command-object.d.ts.map +1 -0
- package/src/command-line/nx-cloud/polygraph/command-object.js +15 -0
- package/src/command-line/nx-cloud/polygraph/polygraph.d.ts +5 -0
- package/src/command-line/nx-cloud/polygraph/polygraph.d.ts.map +1 -0
- package/src/command-line/nx-cloud/polygraph/polygraph.js +7 -0
- package/src/command-line/nx-cloud/utils.d.ts.map +1 -1
- package/src/command-line/nx-cloud/utils.js +9 -2
- package/src/command-line/nx-commands.d.ts.map +1 -1
- package/src/command-line/nx-commands.js +18 -7
- package/src/command-line/release/config/config.d.ts.map +1 -1
- package/src/command-line/release/config/config.js +11 -2
- package/src/command-line/release/utils/remote-release-clients/extract-repo-slug.d.ts +10 -0
- package/src/command-line/release/utils/remote-release-clients/extract-repo-slug.d.ts.map +1 -0
- package/src/command-line/release/utils/remote-release-clients/extract-repo-slug.js +61 -0
- package/src/command-line/release/utils/remote-release-clients/github.d.ts.map +1 -1
- package/src/command-line/release/utils/remote-release-clients/github.js +8 -13
- package/src/command-line/release/utils/remote-release-clients/gitlab.d.ts.map +1 -1
- package/src/command-line/release/utils/remote-release-clients/gitlab.js +4 -9
- package/src/command-line/release/utils/shared.d.ts +1 -1
- package/src/command-line/release/utils/shared.d.ts.map +1 -1
- package/src/command-line/release/utils/shared.js +23 -15
- package/src/command-line/run/executor-utils.d.ts.map +1 -1
- package/src/command-line/run/executor-utils.js +1 -0
- package/src/command-line/show/command-object.d.ts +15 -1
- package/src/command-line/show/command-object.d.ts.map +1 -1
- package/src/command-line/show/command-object.js +116 -2
- package/src/command-line/show/target.d.ts +5 -0
- package/src/command-line/show/target.d.ts.map +1 -0
- package/src/command-line/show/target.js +724 -0
- package/src/command-line/watch/watch.js +4 -4
- package/src/command-line/yargs-utils/shared-options.d.ts.map +1 -1
- package/src/command-line/yargs-utils/shared-options.js +6 -2
- package/src/config/misc-interfaces.d.ts +2 -0
- package/src/config/misc-interfaces.d.ts.map +1 -1
- package/src/config/nx-json.d.ts +4 -0
- package/src/config/nx-json.d.ts.map +1 -1
- package/src/core/graph/main.js +1 -1
- package/src/daemon/client/client.d.ts.map +1 -1
- package/src/daemon/client/client.js +6 -1
- package/src/daemon/server/project-graph-incremental-recomputation.d.ts.map +1 -1
- package/src/daemon/server/project-graph-incremental-recomputation.js +13 -5
- package/src/daemon/server/server.d.ts.map +1 -1
- package/src/daemon/server/server.js +3 -0
- package/src/daemon/server/shutdown-utils.d.ts.map +1 -1
- package/src/daemon/server/shutdown-utils.js +3 -0
- package/src/devkit-internals.d.ts +1 -0
- package/src/devkit-internals.d.ts.map +1 -1
- package/src/devkit-internals.js +4 -1
- package/src/executors/run-commands/running-tasks.d.ts.map +1 -1
- package/src/executors/run-commands/running-tasks.js +7 -1
- package/src/hasher/hash-plan-inspector.d.ts +11 -3
- package/src/hasher/hash-plan-inspector.d.ts.map +1 -1
- package/src/hasher/hash-plan-inspector.js +19 -3
- package/src/migrations/update-22-6-0/add-claude-worktrees-to-git-ignore.d.ts +3 -0
- package/src/migrations/update-22-6-0/add-claude-worktrees-to-git-ignore.d.ts.map +1 -0
- package/src/migrations/update-22-6-0/add-claude-worktrees-to-git-ignore.js +14 -0
- package/src/migrations/update-22-6-0/enable-analytics-prompt.d.ts +3 -0
- package/src/migrations/update-22-6-0/enable-analytics-prompt.d.ts.map +1 -0
- package/src/migrations/update-22-6-0/enable-analytics-prompt.js +23 -0
- package/src/migrations/update-22-7-0/add-polygraph-to-git-ignore.d.ts +3 -0
- package/src/migrations/update-22-7-0/add-polygraph-to-git-ignore.d.ts.map +1 -0
- package/src/migrations/update-22-7-0/add-polygraph-to-git-ignore.js +14 -0
- package/src/native/native-bindings.js +336 -116
- package/src/native/nx.wasi.cjs +45 -57
- package/src/nx-cloud/update-manager.d.ts +4 -1
- package/src/nx-cloud/update-manager.d.ts.map +1 -1
- package/src/nx-cloud/update-manager.js +7 -6
- package/src/nx-cloud/utilities/axios.d.ts +4 -2
- package/src/nx-cloud/utilities/axios.d.ts.map +1 -1
- package/src/nx-cloud/utilities/axios.js +2 -9
- package/src/plugins/js/index.d.ts.map +1 -1
- package/src/plugins/js/index.js +42 -6
- package/src/plugins/js/lock-file/project-graph-pruning.d.ts.map +1 -1
- package/src/plugins/js/lock-file/project-graph-pruning.js +3 -1
- package/src/plugins/js/lock-file/utils/pnpm-normalizer.js +1 -0
- package/src/plugins/js/project-graph/build-dependencies/target-project-locator.d.ts.map +1 -1
- package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +6 -3
- package/src/plugins/package-json/create-nodes.js +2 -2
- package/src/project-graph/nx-deps-cache.d.ts +11 -1
- package/src/project-graph/nx-deps-cache.d.ts.map +1 -1
- package/src/project-graph/nx-deps-cache.js +53 -3
- package/src/project-graph/plugins/isolation/isolated-plugin.d.ts.map +1 -1
- package/src/project-graph/plugins/isolation/isolated-plugin.js +42 -35
- package/src/project-graph/project-graph.d.ts.map +1 -1
- package/src/project-graph/project-graph.js +34 -11
- package/src/project-graph/utils/project-configuration/name-substitution-manager.d.ts +70 -0
- package/src/project-graph/utils/project-configuration/name-substitution-manager.d.ts.map +1 -0
- package/src/project-graph/utils/project-configuration/name-substitution-manager.js +427 -0
- package/src/project-graph/utils/project-configuration/source-maps.d.ts +70 -0
- package/src/project-graph/utils/project-configuration/source-maps.d.ts.map +1 -0
- package/src/project-graph/utils/project-configuration/source-maps.js +94 -0
- package/src/project-graph/utils/project-configuration-utils.d.ts +5 -3
- package/src/project-graph/utils/project-configuration-utils.d.ts.map +1 -1
- package/src/project-graph/utils/project-configuration-utils.js +56 -39
- package/src/tasks-runner/cache.d.ts +0 -2
- package/src/tasks-runner/cache.d.ts.map +1 -1
- package/src/tasks-runner/cache.js +3 -18
- package/src/tasks-runner/forked-process-task-runner.d.ts.map +1 -1
- package/src/tasks-runner/forked-process-task-runner.js +1 -19
- package/src/tasks-runner/life-cycles/task-history-life-cycle-old.d.ts +1 -2
- package/src/tasks-runner/life-cycles/task-history-life-cycle-old.d.ts.map +1 -1
- package/src/tasks-runner/life-cycles/task-history-life-cycle-old.js +13 -12
- package/src/tasks-runner/life-cycles/task-history-life-cycle.d.ts +1 -0
- package/src/tasks-runner/life-cycles/task-history-life-cycle.d.ts.map +1 -1
- package/src/tasks-runner/life-cycles/task-history-life-cycle.js +10 -5
- package/src/tasks-runner/life-cycles/tui-summary-life-cycle.d.ts.map +1 -1
- package/src/tasks-runner/life-cycles/tui-summary-life-cycle.js +32 -23
- package/src/tasks-runner/pseudo-terminal.js +1 -22
- package/src/tasks-runner/run-command.d.ts.map +1 -1
- package/src/tasks-runner/run-command.js +7 -18
- package/src/tasks-runner/running-tasks/batch-process.d.ts +0 -3
- package/src/tasks-runner/running-tasks/batch-process.d.ts.map +1 -1
- package/src/tasks-runner/running-tasks/batch-process.js +0 -7
- package/src/tasks-runner/running-tasks/node-child-process.d.ts.map +1 -1
- package/src/tasks-runner/running-tasks/node-child-process.js +6 -37
- package/src/tasks-runner/running-tasks/output-prefix.d.ts +14 -0
- package/src/tasks-runner/running-tasks/output-prefix.d.ts.map +1 -0
- package/src/tasks-runner/running-tasks/output-prefix.js +62 -0
- package/src/tasks-runner/task-orchestrator.d.ts +18 -1
- package/src/tasks-runner/task-orchestrator.d.ts.map +1 -1
- package/src/tasks-runner/task-orchestrator.js +362 -139
- package/src/tasks-runner/tasks-runner.d.ts +1 -1
- package/src/tasks-runner/tasks-runner.d.ts.map +1 -1
- package/src/tasks-runner/tasks-schedule.d.ts.map +1 -1
- package/src/tasks-runner/tasks-schedule.js +13 -2
- package/src/utils/analytics-prompt.d.ts +13 -0
- package/src/utils/analytics-prompt.d.ts.map +1 -0
- package/src/utils/analytics-prompt.js +136 -0
- package/src/utils/catalog/manager-factory.d.ts.map +1 -1
- package/src/utils/catalog/manager-factory.js +3 -0
- package/src/utils/catalog/manager.d.ts +4 -4
- package/src/utils/catalog/manager.d.ts.map +1 -1
- package/src/utils/catalog/manager.js +11 -0
- package/src/utils/catalog/pnpm-manager.d.ts +3 -4
- package/src/utils/catalog/pnpm-manager.d.ts.map +1 -1
- package/src/utils/catalog/pnpm-manager.js +57 -68
- package/src/utils/catalog/types.d.ts +7 -0
- package/src/utils/catalog/types.d.ts.map +1 -1
- package/src/utils/catalog/yarn-manager.d.ts +22 -0
- package/src/utils/catalog/yarn-manager.d.ts.map +1 -0
- package/src/utils/catalog/yarn-manager.js +249 -0
- package/src/utils/child-process.d.ts.map +1 -1
- package/src/utils/child-process.js +2 -22
- package/src/utils/exit-codes.d.ts +6 -0
- package/src/utils/exit-codes.d.ts.map +1 -1
- package/src/utils/exit-codes.js +40 -0
- package/src/utils/ignore.d.ts +5 -0
- package/src/utils/ignore.d.ts.map +1 -1
- package/src/utils/ignore.js +16 -0
- package/src/utils/machine-id-cache.d.ts +6 -0
- package/src/utils/machine-id-cache.d.ts.map +1 -0
- package/src/utils/machine-id-cache.js +23 -0
- package/src/utils/output.d.ts.map +1 -1
- package/src/utils/package-manager.d.ts.map +1 -1
- package/src/utils/package-manager.js +22 -1
- package/src/utils/params.d.ts +4 -1
- package/src/utils/params.d.ts.map +1 -1
- package/src/utils/params.js +30 -3
- package/src/utils/plugin-cache-utils.d.ts +74 -0
- package/src/utils/plugin-cache-utils.d.ts.map +1 -0
- package/src/utils/plugin-cache-utils.js +202 -0
- package/src/utils/plugins/output.d.ts +29 -1
- package/src/utils/plugins/output.d.ts.map +1 -1
- package/src/utils/plugins/output.js +90 -1
- package/src/utils/plugins/plugin-capabilities.d.ts +1 -0
- package/src/utils/plugins/plugin-capabilities.d.ts.map +1 -1
- package/src/utils/plugins/plugin-capabilities.js +2 -0
- package/src/utils/split-target.d.ts +2 -1
- package/src/utils/split-target.d.ts.map +1 -1
- package/src/utils/split-target.js +11 -9
- package/src/native/index.d.ts +0 -561
- package/src/native/nx.wasm32-wasi.wasm +0 -0
package/.eslintrc.json
CHANGED
|
@@ -144,8 +144,8 @@
|
|
|
144
144
|
"@nx/conformance",
|
|
145
145
|
// Nx Docker plugin conditionally available dynamically at runtime
|
|
146
146
|
"@nx/docker",
|
|
147
|
-
//
|
|
148
|
-
"@
|
|
147
|
+
// Used in WASI browser implementation (nx.wasi-browser.js)
|
|
148
|
+
"@napi-rs/wasm-runtime"
|
|
149
149
|
]
|
|
150
150
|
}
|
|
151
151
|
]
|
package/bin/init-local.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-local.d.ts","sourceRoot":"","sources":["../../../../packages/nx/bin/init-local.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"init-local.d.ts","sourceRoot":"","sources":["../../../../packages/nx/bin/init-local.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAOxE;;;;GAIG;AACH,wBAAsB,SAAS,CAAC,SAAS,EAAE,oBAAoB,iBA+C9D;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,YA6BvD"}
|
package/bin/init-local.js
CHANGED
|
@@ -8,6 +8,7 @@ const strip_indents_1 = require("../src/utils/strip-indents");
|
|
|
8
8
|
const client_1 = require("../src/daemon/client/client");
|
|
9
9
|
const enquirer_1 = require("enquirer");
|
|
10
10
|
const output_1 = require("../src/utils/output");
|
|
11
|
+
const analytics_1 = require("../src/analytics");
|
|
11
12
|
/**
|
|
12
13
|
* Nx is being run inside a workspace.
|
|
13
14
|
*
|
|
@@ -44,6 +45,7 @@ async function initLocal(workspace) {
|
|
|
44
45
|
const split = newArgs.indexOf('--');
|
|
45
46
|
if (help > -1 && (split === -1 || split > help)) {
|
|
46
47
|
nx_commands_1.commandsObject.showHelp();
|
|
48
|
+
process.exit(0);
|
|
47
49
|
}
|
|
48
50
|
else {
|
|
49
51
|
nx_commands_1.commandsObject.parse(newArgs);
|
|
@@ -55,6 +57,7 @@ async function initLocal(workspace) {
|
|
|
55
57
|
}
|
|
56
58
|
catch (e) {
|
|
57
59
|
console.error(e.message);
|
|
60
|
+
(0, analytics_1.flushAnalytics)();
|
|
58
61
|
process.exit(1);
|
|
59
62
|
}
|
|
60
63
|
}
|
package/bin/nx.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
// TODO: Remove this workaround once picocolors handles FORCE_COLOR=0 correctly
|
|
5
|
+
// See: https://github.com/alexeyraspopov/picocolors/issues/100
|
|
6
|
+
if (process.env.FORCE_COLOR === '0') {
|
|
7
|
+
process.env.NO_COLOR = '1';
|
|
8
|
+
delete process.env.FORCE_COLOR;
|
|
9
|
+
}
|
|
4
10
|
const find_workspace_root_1 = require("../src/utils/find-workspace-root");
|
|
5
11
|
const pc = require("picocolors");
|
|
6
12
|
const dotenv_1 = require("../src/utils/dotenv");
|
|
@@ -17,6 +23,8 @@ const perf_hooks_1 = require("perf_hooks");
|
|
|
17
23
|
const workspace_context_1 = require("../src/utils/workspace-context");
|
|
18
24
|
const client_1 = require("../src/daemon/client/client");
|
|
19
25
|
const db_connection_1 = require("../src/utils/db-connection");
|
|
26
|
+
const analytics_prompt_1 = require("../src/utils/analytics-prompt");
|
|
27
|
+
const analytics_1 = require("../src/analytics");
|
|
20
28
|
async function main() {
|
|
21
29
|
if (process.argv[2] !== 'report' &&
|
|
22
30
|
process.argv[2] !== '--version' &&
|
|
@@ -62,12 +70,18 @@ async function main() {
|
|
|
62
70
|
if (process.argv[2] === '--version') {
|
|
63
71
|
handleNxVersionCommand(LOCAL_NX_VERSION, GLOBAL_NX_VERSION);
|
|
64
72
|
}
|
|
65
|
-
if (!workspace) {
|
|
73
|
+
if (!workspace && !isNxCloudCommand(process.argv[2])) {
|
|
66
74
|
handleNoWorkspace(GLOBAL_NX_VERSION);
|
|
67
75
|
}
|
|
68
76
|
if (!localNx && !isNxCloudCommand(process.argv[2])) {
|
|
69
77
|
handleMissingLocalInstallation(workspace ? workspace.dir : null);
|
|
70
78
|
}
|
|
79
|
+
// Prompt for analytics preference if not set
|
|
80
|
+
try {
|
|
81
|
+
await (0, analytics_prompt_1.ensureAnalyticsPreferenceSet)();
|
|
82
|
+
}
|
|
83
|
+
catch { }
|
|
84
|
+
await (0, analytics_1.startAnalytics)();
|
|
71
85
|
// this file is already in the local workspace
|
|
72
86
|
if (isNxCloudCommand(process.argv[2])) {
|
|
73
87
|
// nx-cloud commands can run without local Nx installation
|
|
@@ -150,6 +164,7 @@ function isNxCloudCommand(command) {
|
|
|
150
164
|
'view-logs',
|
|
151
165
|
'fix-ci',
|
|
152
166
|
'record',
|
|
167
|
+
'polygraph',
|
|
153
168
|
];
|
|
154
169
|
return nxCloudCommands.includes(command);
|
|
155
170
|
}
|
|
@@ -242,5 +257,6 @@ process.on('exit', () => {
|
|
|
242
257
|
});
|
|
243
258
|
main().catch((error) => {
|
|
244
259
|
console.error(error);
|
|
260
|
+
(0, analytics_1.flushAnalytics)();
|
|
245
261
|
process.exit(1);
|
|
246
262
|
});
|
package/migrations.json
CHANGED
|
@@ -136,6 +136,24 @@
|
|
|
136
136
|
"version": "22.1.0-beta.5",
|
|
137
137
|
"description": "Updates the nx wrapper.",
|
|
138
138
|
"implementation": "./src/migrations/update-22-1-0/update-nx-wrapper"
|
|
139
|
+
},
|
|
140
|
+
"22-6-1-add-claude-worktrees-to-git-ignore": {
|
|
141
|
+
"cli": "nx",
|
|
142
|
+
"version": "22.6.0-beta.10",
|
|
143
|
+
"description": "Adds .claude/worktrees to .gitignore",
|
|
144
|
+
"implementation": "./src/migrations/update-22-6-0/add-claude-worktrees-to-git-ignore"
|
|
145
|
+
},
|
|
146
|
+
"22-7-0-add-polygraph-to-git-ignore": {
|
|
147
|
+
"cli": "nx",
|
|
148
|
+
"version": "22.7.0-beta.0",
|
|
149
|
+
"description": "Adds .nx/polygraph to .gitignore",
|
|
150
|
+
"implementation": "./src/migrations/update-22-7-0/add-polygraph-to-git-ignore"
|
|
151
|
+
},
|
|
152
|
+
"22-6-0-enable-analytics-prompt": {
|
|
153
|
+
"cli": "nx",
|
|
154
|
+
"version": "22.6.0-beta.11",
|
|
155
|
+
"description": "Prompts to enable usage analytics",
|
|
156
|
+
"implementation": "./src/migrations/update-22-6-0/enable-analytics-prompt"
|
|
139
157
|
}
|
|
140
158
|
}
|
|
141
159
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nx",
|
|
3
|
-
"version": "22.6.0-beta.
|
|
3
|
+
"version": "22.6.0-beta.11",
|
|
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": {
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"homepage": "https://nx.dev",
|
|
36
36
|
"dependencies": {
|
|
37
|
+
"@ltd/j-toml": "^1.38.0",
|
|
37
38
|
"@napi-rs/wasm-runtime": "0.2.4",
|
|
38
39
|
"@yarnpkg/lockfile": "^1.1.0",
|
|
39
40
|
"@yarnpkg/parsers": "3.0.2",
|
|
@@ -54,7 +55,7 @@
|
|
|
54
55
|
"jest-diff": "^30.0.2",
|
|
55
56
|
"jsonc-parser": "3.2.0",
|
|
56
57
|
"lines-and-columns": "2.0.3",
|
|
57
|
-
"minimatch": "10.
|
|
58
|
+
"minimatch": "10.2.4",
|
|
58
59
|
"node-machine-id": "1.1.12",
|
|
59
60
|
"npm-run-path": "^4.0.1",
|
|
60
61
|
"open": "^8.4.0",
|
|
@@ -84,16 +85,16 @@
|
|
|
84
85
|
}
|
|
85
86
|
},
|
|
86
87
|
"optionalDependencies": {
|
|
87
|
-
"@nx/nx-darwin-arm64": "22.6.0-beta.
|
|
88
|
-
"@nx/nx-darwin-x64": "22.6.0-beta.
|
|
89
|
-
"@nx/nx-freebsd-x64": "22.6.0-beta.
|
|
90
|
-
"@nx/nx-linux-arm-gnueabihf": "22.6.0-beta.
|
|
91
|
-
"@nx/nx-linux-arm64-gnu": "22.6.0-beta.
|
|
92
|
-
"@nx/nx-linux-arm64-musl": "22.6.0-beta.
|
|
93
|
-
"@nx/nx-linux-x64-gnu": "22.6.0-beta.
|
|
94
|
-
"@nx/nx-linux-x64-musl": "22.6.0-beta.
|
|
95
|
-
"@nx/nx-win32-arm64-msvc": "22.6.0-beta.
|
|
96
|
-
"@nx/nx-win32-x64-msvc": "22.6.0-beta.
|
|
88
|
+
"@nx/nx-darwin-arm64": "22.6.0-beta.11",
|
|
89
|
+
"@nx/nx-darwin-x64": "22.6.0-beta.11",
|
|
90
|
+
"@nx/nx-freebsd-x64": "22.6.0-beta.11",
|
|
91
|
+
"@nx/nx-linux-arm-gnueabihf": "22.6.0-beta.11",
|
|
92
|
+
"@nx/nx-linux-arm64-gnu": "22.6.0-beta.11",
|
|
93
|
+
"@nx/nx-linux-arm64-musl": "22.6.0-beta.11",
|
|
94
|
+
"@nx/nx-linux-x64-gnu": "22.6.0-beta.11",
|
|
95
|
+
"@nx/nx-linux-x64-musl": "22.6.0-beta.11",
|
|
96
|
+
"@nx/nx-win32-arm64-msvc": "22.6.0-beta.11",
|
|
97
|
+
"@nx/nx-win32-x64-msvc": "22.6.0-beta.11"
|
|
97
98
|
},
|
|
98
99
|
"nx-migrations": {
|
|
99
100
|
"migrations": "./migrations.json",
|
|
@@ -103,6 +104,8 @@
|
|
|
103
104
|
"@nx/eslint",
|
|
104
105
|
"@nx/workspace",
|
|
105
106
|
"@nx/angular",
|
|
107
|
+
"@nx/angular-rspack",
|
|
108
|
+
"@nx/angular-rspack-compiler",
|
|
106
109
|
"@nx/jest",
|
|
107
110
|
"@nx/cypress",
|
|
108
111
|
"@nx/detox",
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ProjectConfiguration } from '../src/config/workspace-json-project-json';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
2
|
+
import { PluginCache } from '../src/utils/plugin-cache-utils';
|
|
3
|
+
export type PackageJsonConfigurationCache = PluginCache<ProjectConfiguration>;
|
|
5
4
|
export declare function readPackageJsonConfigurationCache(): PackageJsonConfigurationCache;
|
|
6
5
|
//# sourceMappingURL=package-json.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-json.d.ts","sourceRoot":"","sources":["../../../../packages/nx/plugins/package-json.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"package-json.d.ts","sourceRoot":"","sources":["../../../../packages/nx/plugins/package-json.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,MAAM,MAAM,6BAA6B,GAAG,WAAW,CAAC,oBAAoB,CAAC,CAAC;AAM9E,wBAAgB,iCAAiC,IAAI,6BAA6B,CAGjF"}
|
package/plugins/package-json.js
CHANGED
|
@@ -7,17 +7,17 @@ const package_json_1 = require("../src/plugins/package-json");
|
|
|
7
7
|
const cache_directory_1 = require("../src/utils/cache-directory");
|
|
8
8
|
const path_1 = require("path");
|
|
9
9
|
const fileutils_1 = require("../src/utils/fileutils");
|
|
10
|
+
const plugin_cache_utils_1 = require("../src/utils/plugin-cache-utils");
|
|
10
11
|
const cachePath = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, 'package-json.hash');
|
|
12
|
+
let packageJsonPluginCache = null;
|
|
11
13
|
function readPackageJsonConfigurationCache() {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
catch (e) {
|
|
16
|
-
return {};
|
|
17
|
-
}
|
|
14
|
+
packageJsonPluginCache = new plugin_cache_utils_1.PluginCache(cachePath);
|
|
15
|
+
return packageJsonPluginCache;
|
|
18
16
|
}
|
|
19
|
-
function writeCache(
|
|
20
|
-
(
|
|
17
|
+
function writeCache() {
|
|
18
|
+
if (packageJsonPluginCache) {
|
|
19
|
+
packageJsonPluginCache.writeToDisk(cachePath);
|
|
20
|
+
}
|
|
21
21
|
}
|
|
22
22
|
const plugin = {
|
|
23
23
|
name: 'nx-all-package-jsons-plugin',
|
|
@@ -28,7 +28,7 @@ const plugin = {
|
|
|
28
28
|
const patterns = (0, package_json_1.buildPackageJsonPatterns)(context.workspaceRoot, (f) => (0, fileutils_1.readJsonFile)((0, path_1.join)(context.workspaceRoot, f)));
|
|
29
29
|
const isInPackageJsonWorkspaces = (0, package_json_1.buildPackageJsonWorkspacesMatcher)(patterns);
|
|
30
30
|
const result = (0, plugins_1.createNodesFromFiles)((packageJsonPath) => (0, package_json_1.createNodeFromPackageJson)(packageJsonPath, workspace_root_1.workspaceRoot, cache, isInPackageJsonWorkspaces(packageJsonPath)), configFiles, options, context);
|
|
31
|
-
writeCache(
|
|
31
|
+
writeCache();
|
|
32
32
|
return result;
|
|
33
33
|
},
|
|
34
34
|
],
|
package/schemas/nx-schema.json
CHANGED
|
@@ -142,6 +142,10 @@
|
|
|
142
142
|
"type": "boolean",
|
|
143
143
|
"description": "Specifies whether to add inference plugins when generating new projects."
|
|
144
144
|
},
|
|
145
|
+
"analytics": {
|
|
146
|
+
"type": "boolean",
|
|
147
|
+
"description": "Set this to true to allow Nx to collect usage analytics."
|
|
148
|
+
},
|
|
145
149
|
"release": {
|
|
146
150
|
"type": "object",
|
|
147
151
|
"description": "Configuration for the nx release commands.",
|
package/src/adapter/compat.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare const allowedProjectExtensions: readonly ["tags", "implicitDependencies", "configFilePath", "$schema", "generators", "namedInputs", "name", "files", "root", "sourceRoot", "projectType", "release", "includedScripts", "metadata", "owners", "nxCloudImplicitDependencies"];
|
|
2
|
-
export declare const allowedWorkspaceExtensions: readonly ["$schema", "implicitDependencies", "affected", "defaultBase", "tasksRunnerOptions", "workspaceLayout", "plugins", "targetDefaults", "files", "generators", "namedInputs", "extends", "cli", "pluginsConfig", "defaultProject", "installation", "release", "nxCloudAccessToken", "nxCloudId", "nxCloudUrl", "nxCloudEncryptionKey", "parallel", "cacheDirectory", "useDaemonProcess", "useInferencePlugins", "neverConnectToCloud", "sync", "useLegacyCache", "maxCacheSize", "tui", "owners"];
|
|
2
|
+
export declare const allowedWorkspaceExtensions: readonly ["$schema", "implicitDependencies", "affected", "defaultBase", "tasksRunnerOptions", "workspaceLayout", "plugins", "targetDefaults", "files", "generators", "namedInputs", "extends", "cli", "pluginsConfig", "defaultProject", "installation", "release", "nxCloudAccessToken", "nxCloudId", "nxCloudUrl", "nxCloudEncryptionKey", "parallel", "cacheDirectory", "useDaemonProcess", "useInferencePlugins", "neverConnectToCloud", "analytics", "sync", "useLegacyCache", "maxCacheSize", "tui", "owners"];
|
|
3
3
|
//# sourceMappingURL=compat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compat.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/adapter/compat.ts"],"names":[],"mappings":"AAgCA,eAAO,MAAM,wBAAwB,8OAiB3B,CAAC;AAQX,eAAO,MAAM,0BAA0B,
|
|
1
|
+
{"version":3,"file":"compat.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/adapter/compat.ts"],"names":[],"mappings":"AAgCA,eAAO,MAAM,wBAAwB,8OAiB3B,CAAC;AAQX,eAAO,MAAM,0BAA0B,sfAiC7B,CAAC"}
|
package/src/adapter/compat.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-up-ai-agents.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/ai/set-up-ai-agents/set-up-ai-agents.ts"],"names":[],"mappings":"
|
|
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":"AAKA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAS7C,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,oBAAoB,CAAC;AAuB5B,OAAO,EACL,sCAAsC,EACtC,4BAA4B,EAC7B,MAAM,UAAU,CAAC;AAElB,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,oBAAoB,EAAE,CAAC;IACjC,MAAM,EAAE,qBAAqB,EAAE,CAAC;CACjC,CAAC;AAmCF,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,4BAA4B,EACrC,KAAK,UAAQ,GACZ,OAAO,CAAC,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAmC5D;AAaD,wBAAsB,0BAA0B,CAC9C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,sCAAsC,GAC9C,OAAO,CAAC,MAAM,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAoP7C;AAuRD,eAAe,sBAAsB,CAAC"}
|
|
@@ -5,17 +5,18 @@ exports.setupAiAgentsGeneratorImpl = setupAiAgentsGeneratorImpl;
|
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
6
|
const path_1 = require("path");
|
|
7
7
|
const semver_1 = require("semver");
|
|
8
|
+
const j_toml_1 = require("@ltd/j-toml");
|
|
8
9
|
const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
|
|
9
10
|
const generate_files_1 = require("../../generators/utils/generate-files");
|
|
10
11
|
const json_1 = require("../../generators/utils/json");
|
|
11
12
|
const native_1 = require("../../native");
|
|
12
13
|
const package_json_1 = require("../../utils/package-json");
|
|
14
|
+
const ignore_1 = require("../../utils/ignore");
|
|
13
15
|
const provenance_1 = require("../../utils/provenance");
|
|
14
16
|
const workspace_root_1 = require("../../utils/workspace-root");
|
|
15
17
|
const constants_1 = require("../constants");
|
|
16
18
|
const clone_ai_config_repo_1 = require("../clone-ai-config-repo");
|
|
17
19
|
const utils_1 = require("../utils");
|
|
18
|
-
const constants_2 = require("../constants");
|
|
19
20
|
/**
|
|
20
21
|
* Get the installed Nx version, with fallback to workspace package.json or default version.
|
|
21
22
|
*/
|
|
@@ -97,6 +98,7 @@ async function setupAiAgentsGeneratorImpl(tree, options) {
|
|
|
97
98
|
...json.extraKnownMarketplaces,
|
|
98
99
|
'nx-claude-plugins': {
|
|
99
100
|
source: {
|
|
101
|
+
...json.extraKnownMarketplaces?.['nx-claude-plugins']?.source,
|
|
100
102
|
source: 'github',
|
|
101
103
|
repo: 'nrwl/nx-ai-agents-config',
|
|
102
104
|
},
|
|
@@ -137,19 +139,25 @@ async function setupAiAgentsGeneratorImpl(tree, options) {
|
|
|
137
139
|
}
|
|
138
140
|
(0, json_1.updateJson)(tree, opencodeMcpJsonPath, (json) => opencodeMcpConfigUpdater(json, nxVersion));
|
|
139
141
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
142
|
+
// Get the ai-config repo path once for all non-Claude agents that need it
|
|
143
|
+
const needsAiConfigRepo = hasAgent('codex') ||
|
|
144
|
+
hasAgent('opencode') ||
|
|
145
|
+
hasAgent('copilot') ||
|
|
146
|
+
hasAgent('cursor') ||
|
|
147
|
+
hasAgent('gemini');
|
|
148
|
+
let aiConfigRepoPath;
|
|
149
|
+
if (needsAiConfigRepo) {
|
|
150
|
+
try {
|
|
151
|
+
aiConfigRepoPath = (0, clone_ai_config_repo_1.getAiConfigRepoPath)();
|
|
145
152
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
if (!existing.includes(constants_2.nxMcpTomlHeader)) {
|
|
149
|
-
tree.write(codexTomlPath, existing + '\n' + tomlConfig);
|
|
150
|
-
}
|
|
153
|
+
catch {
|
|
154
|
+
// Network/clone failure — individual consumers handle fallback
|
|
151
155
|
}
|
|
152
156
|
}
|
|
157
|
+
if (hasAgent('codex')) {
|
|
158
|
+
const codexTomlPath = (0, path_1.join)(options.directory, '.codex', 'config.toml');
|
|
159
|
+
writeCodexConfig(tree, codexTomlPath, nxVersion, aiConfigRepoPath);
|
|
160
|
+
}
|
|
153
161
|
if (hasAgent('gemini')) {
|
|
154
162
|
const geminiSettingsPath = (0, path_1.join)(options.directory, '.gemini', 'settings.json');
|
|
155
163
|
if (!tree.exists(geminiSettingsPath)) {
|
|
@@ -171,17 +179,18 @@ async function setupAiAgentsGeneratorImpl(tree, options) {
|
|
|
171
179
|
}
|
|
172
180
|
}
|
|
173
181
|
// Copy extensibility artifacts (commands, skills, subagents) for non-Claude agents
|
|
174
|
-
if (
|
|
175
|
-
|
|
176
|
-
hasAgent('cursor') ||
|
|
177
|
-
hasAgent('codex') ||
|
|
178
|
-
hasAgent('gemini')) {
|
|
179
|
-
const repoPath = (0, clone_ai_config_repo_1.getAiConfigRepoPath)();
|
|
182
|
+
if (aiConfigRepoPath) {
|
|
183
|
+
const repoPath = aiConfigRepoPath;
|
|
180
184
|
const agentDirs = [
|
|
181
185
|
{ agent: 'opencode', src: 'generated/.opencode', dest: '.opencode' },
|
|
182
186
|
{ agent: 'copilot', src: 'generated/.github', dest: '.github' },
|
|
183
187
|
{ agent: 'cursor', src: 'generated/.cursor', dest: '.cursor' },
|
|
184
188
|
{ agent: 'codex', src: 'generated/.agents', dest: '.agents' },
|
|
189
|
+
{
|
|
190
|
+
agent: 'codex',
|
|
191
|
+
src: 'generated/.codex/agents',
|
|
192
|
+
dest: '.codex/agents',
|
|
193
|
+
},
|
|
185
194
|
{ agent: 'gemini', src: 'generated/.gemini', dest: '.gemini' },
|
|
186
195
|
];
|
|
187
196
|
for (const { agent, src, dest } of agentDirs) {
|
|
@@ -193,6 +202,8 @@ async function setupAiAgentsGeneratorImpl(tree, options) {
|
|
|
193
202
|
}
|
|
194
203
|
}
|
|
195
204
|
}
|
|
205
|
+
(0, ignore_1.addEntryToGitIgnore)(tree, (0, path_1.join)(options.directory, '.gitignore'), '.nx/polygraph');
|
|
206
|
+
(0, ignore_1.addEntryToGitIgnore)(tree, (0, path_1.join)(options.directory, '.gitignore'), '.claude/worktrees');
|
|
196
207
|
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree);
|
|
197
208
|
// we use the check variable to determine if we should actually make changes or just report what would be changed
|
|
198
209
|
return async (check = false) => {
|
|
@@ -262,7 +273,7 @@ async function setupAiAgentsGeneratorImpl(tree, options) {
|
|
|
262
273
|
function writeAgentRules(tree, path, writeNxCloudRules) {
|
|
263
274
|
if (!tree.exists(path)) {
|
|
264
275
|
// File doesn't exist - create with h1 header (standalone content)
|
|
265
|
-
const expectedRules = (0,
|
|
276
|
+
const expectedRules = (0, constants_1.getAgentRulesWrapped)({
|
|
266
277
|
writeNxCloudRules,
|
|
267
278
|
useH1: true,
|
|
268
279
|
});
|
|
@@ -270,21 +281,21 @@ function writeAgentRules(tree, path, writeNxCloudRules) {
|
|
|
270
281
|
return;
|
|
271
282
|
}
|
|
272
283
|
const existing = tree.read(path, 'utf-8');
|
|
273
|
-
const regex =
|
|
284
|
+
const regex = constants_1.rulesRegex;
|
|
274
285
|
const existingNxConfiguration = existing.match(regex);
|
|
275
286
|
if (existingNxConfiguration) {
|
|
276
287
|
// Check the rest of the file (outside nx block) for an h1 header
|
|
277
288
|
// to ensure only one h1 exists in the document
|
|
278
289
|
const contentWithoutNxBlock = existing.replace(regex, '');
|
|
279
290
|
const hasExternalH1 = /^# /m.test(contentWithoutNxBlock);
|
|
280
|
-
const expectedRules = (0,
|
|
291
|
+
const expectedRules = (0, constants_1.getAgentRulesWrapped)({
|
|
281
292
|
writeNxCloudRules,
|
|
282
293
|
useH1: !hasExternalH1,
|
|
283
294
|
});
|
|
284
295
|
const contentOnly = (str) => str
|
|
285
|
-
.replace(
|
|
286
|
-
.replace(
|
|
287
|
-
.replace(
|
|
296
|
+
.replace(constants_1.nxRulesMarkerCommentStart, '')
|
|
297
|
+
.replace(constants_1.nxRulesMarkerCommentEnd, '')
|
|
298
|
+
.replace(constants_1.nxRulesMarkerCommentDescription, '')
|
|
288
299
|
.replace(/\s/g, '');
|
|
289
300
|
// we don't want to make updates on whitespace-only changes
|
|
290
301
|
if (contentOnly(existingNxConfiguration[0]) === contentOnly(expectedRules)) {
|
|
@@ -298,13 +309,115 @@ function writeAgentRules(tree, path, writeNxCloudRules) {
|
|
|
298
309
|
// Appending to existing content - use h2 only if the file already has an h1 header
|
|
299
310
|
// This prevents unnecessary changes when users add content without their own h1
|
|
300
311
|
const hasExistingH1 = /^# /m.test(existing);
|
|
301
|
-
const expectedRules = (0,
|
|
312
|
+
const expectedRules = (0, constants_1.getAgentRulesWrapped)({
|
|
302
313
|
writeNxCloudRules,
|
|
303
314
|
useH1: !hasExistingH1,
|
|
304
315
|
});
|
|
305
316
|
tree.write(path, existing + '\n\n' + expectedRules);
|
|
306
317
|
}
|
|
307
318
|
}
|
|
319
|
+
/**
|
|
320
|
+
* Write or merge the Codex config.toml.
|
|
321
|
+
*
|
|
322
|
+
* Reads the generated config.toml from the nx-ai-agents-config repo (which
|
|
323
|
+
* contains MCP servers, agent definitions, and feature flags) and deep-merges
|
|
324
|
+
* it into the user's existing config.toml using proper TOML parsing.
|
|
325
|
+
*
|
|
326
|
+
* Merge rules:
|
|
327
|
+
* - [mcp_servers."nx-mcp"] — upsert with version-adjusted args, preserving extra user args
|
|
328
|
+
* - [features] multi_agent — set to true unless user has explicitly set it to false
|
|
329
|
+
* - [agents.*] — upsert each agent definition
|
|
330
|
+
* - All other user config is preserved untouched
|
|
331
|
+
*
|
|
332
|
+
* Falls back to a minimal hardcoded MCP config if the generated file is unavailable.
|
|
333
|
+
*/
|
|
334
|
+
function writeCodexConfig(tree, codexTomlPath, nxVersion, aiConfigRepoPath) {
|
|
335
|
+
let generated = null;
|
|
336
|
+
if (aiConfigRepoPath) {
|
|
337
|
+
const generatedConfigPath = (0, path_1.join)(aiConfigRepoPath, 'generated', '.codex', 'config.toml');
|
|
338
|
+
if ((0, fs_1.existsSync)(generatedConfigPath)) {
|
|
339
|
+
const generatedConfig = (0, fs_1.readFileSync)(generatedConfigPath, 'utf-8');
|
|
340
|
+
generated = j_toml_1.default.parse(generatedConfig);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
if (!generated) {
|
|
344
|
+
// Fallback: use hardcoded MCP-only config (no agents/features)
|
|
345
|
+
const tomlConfig = (0, constants_1.getNxMcpTomlConfig)(nxVersion);
|
|
346
|
+
if (!tree.exists(codexTomlPath)) {
|
|
347
|
+
tree.write(codexTomlPath, tomlConfig);
|
|
348
|
+
}
|
|
349
|
+
else {
|
|
350
|
+
const existing = tree.read(codexTomlPath, 'utf-8');
|
|
351
|
+
if (!existing.includes(constants_1.nxMcpTomlHeader)) {
|
|
352
|
+
tree.write(codexTomlPath, existing + '\n' + tomlConfig);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
// Parse existing config (or start empty)
|
|
358
|
+
let config = {};
|
|
359
|
+
if (tree.exists(codexTomlPath)) {
|
|
360
|
+
try {
|
|
361
|
+
config = j_toml_1.default.parse(tree.read(codexTomlPath, 'utf-8'));
|
|
362
|
+
}
|
|
363
|
+
catch {
|
|
364
|
+
// If existing file can't be parsed, start fresh
|
|
365
|
+
config = {};
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
// ── Merge MCP servers ──
|
|
369
|
+
const majorVersion = (0, semver_1.major)(nxVersion);
|
|
370
|
+
const mcpArgs = majorVersion >= 22 ? ['nx', 'mcp'] : ['nx-mcp'];
|
|
371
|
+
// Preserve extra user args from existing config
|
|
372
|
+
const existingArgs = config.mcp_servers?.['nx-mcp']?.args ?? [];
|
|
373
|
+
const extraArgs = stripKnownMcpBaseArgs(existingArgs);
|
|
374
|
+
mcpArgs.push(...extraArgs);
|
|
375
|
+
config.mcp_servers ??= {};
|
|
376
|
+
config.mcp_servers['nx-mcp'] = {
|
|
377
|
+
command: 'npx',
|
|
378
|
+
args: mcpArgs,
|
|
379
|
+
};
|
|
380
|
+
// ── Merge features ──
|
|
381
|
+
// Only set multi_agent = true if user hasn't explicitly set it to false
|
|
382
|
+
const userSetMultiAgentFalse = config.features?.multi_agent === false;
|
|
383
|
+
if (!userSetMultiAgentFalse && generated.features) {
|
|
384
|
+
config.features ??= {};
|
|
385
|
+
Object.assign(config.features, generated.features);
|
|
386
|
+
}
|
|
387
|
+
// ── Merge agents ──
|
|
388
|
+
if (generated.agents) {
|
|
389
|
+
config.agents ??= {};
|
|
390
|
+
for (const [name, def] of Object.entries(generated.agents)) {
|
|
391
|
+
config.agents[name] = def;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
// ── Serialize and write ──
|
|
395
|
+
const tomlString = j_toml_1.default.stringify(config, {
|
|
396
|
+
newlineAround: 'section',
|
|
397
|
+
});
|
|
398
|
+
tree.write(codexTomlPath, Array.isArray(tomlString) ? tomlString.join('\n') : tomlString);
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Strip known MCP base command args (["nx", "mcp"] or ["nx-mcp"]) from an
|
|
402
|
+
* args array, returning only the extra user-added args.
|
|
403
|
+
*/
|
|
404
|
+
function stripKnownMcpBaseArgs(args) {
|
|
405
|
+
const knownBasePatterns = [['nx', 'mcp'], ['nx-mcp']];
|
|
406
|
+
for (const pattern of knownBasePatterns) {
|
|
407
|
+
if (args.length < pattern.length)
|
|
408
|
+
continue;
|
|
409
|
+
const matches = pattern.every((baseArg, i) => {
|
|
410
|
+
if (baseArg === 'nx-mcp') {
|
|
411
|
+
return args[i] === 'nx-mcp' || args[i].startsWith('nx-mcp@');
|
|
412
|
+
}
|
|
413
|
+
return args[i] === baseArg;
|
|
414
|
+
});
|
|
415
|
+
if (matches) {
|
|
416
|
+
return args.slice(pattern.length);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
return [];
|
|
420
|
+
}
|
|
308
421
|
/**
|
|
309
422
|
* Extract user-added extra args/flags from an existing MCP config args array
|
|
310
423
|
* by stripping the known base command prefix.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function startAnalytics(): Promise<void>;
|
|
2
|
+
export declare function reportNxAddCommand(packageName: string, version: string): void;
|
|
3
|
+
export declare function reportNxGenerateCommand(generator: string): void;
|
|
4
|
+
export declare function reportCommandRunEvent(command: string, parameters?: Record<string, any>, args?: Record<string, any>): void;
|
|
5
|
+
export declare function reportProjectGraphCreationEvent(duration: number): void;
|
|
6
|
+
export declare function argsToQueryString(args: Record<string, any>): string;
|
|
7
|
+
export declare function flushAnalytics(): void;
|
|
8
|
+
//# sourceMappingURL=analytics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/analytics/analytics.ts"],"names":[],"mappings":"AA0CA,wBAAsB,cAAc,kBAoDnC;AAED,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,QAKtE;AAED,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,QAIxD;AAED,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,EACf,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAChC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAW3B;AAED,wBAAgB,+BAA+B,CAAC,QAAQ,EAAE,MAAM,QAI/D;AAuID,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAkBnE;AAmDD,wBAAgB,cAAc,SAW7B"}
|