nx 21.6.2 → 21.7.0-canary.20250930-e144408
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 +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/hasher/hash-task.js +1 -1
- package/src/tasks-runner/cache.js +1 -1
- 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 +3 -4
- package/src/utils/task-history.js +1 -1
package/package.json
CHANGED
@@ -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"}
|
@@ -14,6 +14,9 @@ const versions_1 = require("../../utils/versions");
|
|
14
14
|
const workspace_context_1 = require("../../utils/workspace-context");
|
15
15
|
const connect_to_nx_cloud_1 = require("../nx-cloud/connect/connect-to-nx-cloud");
|
16
16
|
const configure_plugins_1 = require("./configure-plugins");
|
17
|
+
const ai_agent_prompts_1 = require("./ai-agent-prompts");
|
18
|
+
const set_up_ai_agents_1 = require("../../ai/set-up-ai-agents/set-up-ai-agents");
|
19
|
+
const tree_1 = require("../../generators/tree");
|
17
20
|
const add_nx_to_monorepo_1 = require("./implementation/add-nx-to-monorepo");
|
18
21
|
const add_nx_to_npm_repo_1 = require("./implementation/add-nx-to-npm-repo");
|
19
22
|
const add_nx_to_turborepo_1 = require("./implementation/add-nx-to-turborepo");
|
@@ -120,6 +123,23 @@ async function initHandler(options) {
|
|
120
123
|
(0, configure_plugins_1.installPluginPackages)(repoRoot, pmc, plugins);
|
121
124
|
await (0, configure_plugins_1.configurePlugins)(plugins, updatePackageScripts, pmc, repoRoot, options.verbose);
|
122
125
|
}
|
126
|
+
const selectedAgents = await (0, ai_agent_prompts_1.determineAiAgents)(options.aiAgents, options.interactive && guided);
|
127
|
+
if (selectedAgents && selectedAgents.length > 0) {
|
128
|
+
const tree = new tree_1.FsTree(repoRoot, false);
|
129
|
+
const aiAgentsCallback = await (0, set_up_ai_agents_1.setupAiAgentsGenerator)(tree, {
|
130
|
+
directory: repoRoot,
|
131
|
+
writeNxCloudRules: options.nxCloud !== false,
|
132
|
+
packageVersion: 'latest',
|
133
|
+
agents: [...selectedAgents],
|
134
|
+
});
|
135
|
+
const changes = tree.listChanges();
|
136
|
+
(0, tree_1.flushChanges)(repoRoot, changes);
|
137
|
+
if (aiAgentsCallback) {
|
138
|
+
const results = await aiAgentsCallback();
|
139
|
+
results.messages.forEach((m) => output_1.output.log(m));
|
140
|
+
results.errors.forEach((e) => output_1.output.error(e));
|
141
|
+
}
|
142
|
+
}
|
123
143
|
let useNxCloud = options.nxCloud;
|
124
144
|
if (useNxCloud === undefined) {
|
125
145
|
output_1.output.log({ title: '🛠️ Setting up Self-Healing CI and Remote Caching' });
|
package/src/hasher/hash-task.js
CHANGED
@@ -12,7 +12,7 @@ const db_connection_1 = require("../utils/db-connection");
|
|
12
12
|
let taskDetails;
|
13
13
|
function getTaskDetails() {
|
14
14
|
// TODO: Remove when wasm supports sqlite
|
15
|
-
if (
|
15
|
+
if (native_1.IS_WASM) {
|
16
16
|
return null;
|
17
17
|
}
|
18
18
|
if (!taskDetails) {
|
@@ -56,7 +56,7 @@ class DbCache {
|
|
56
56
|
constructor(options) {
|
57
57
|
this.options = options;
|
58
58
|
this.nxJson = (0, nx_json_1.readNxJson)();
|
59
|
-
this.cache = new native_1.NxCache(workspace_root_1.workspaceRoot, cache_directory_1.cacheDir, (0, db_connection_1.getDbConnection)(),
|
59
|
+
this.cache = new native_1.NxCache(workspace_root_1.workspaceRoot, cache_directory_1.cacheDir, (0, db_connection_1.getDbConnection)(), undefined, resolveMaxCacheSize(this.nxJson));
|
60
60
|
this.isVerbose = process.env.NX_VERBOSE_LOGGING === 'true';
|
61
61
|
}
|
62
62
|
async init() {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"task-history-life-cycle.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/tasks-runner/life-cycles/task-history-life-cycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAM/C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAQ3E,wBAAgB,wBAAwB,IACpC,oBAAoB,GACpB,0BAA0B,
|
1
|
+
{"version":3,"file":"task-history-life-cycle.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/tasks-runner/life-cycles/task-history-life-cycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAM/C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAQ3E,wBAAgB,wBAAwB,IACpC,oBAAoB,GACpB,0BAA0B,CAQ7B;AAED,qBAAa,oBAAqB,YAAW,SAAS;IACpD,OAAO,CAAC,YAAY,CAA8B;IAClD,OAAO,CAAC,QAAQ,CAA8B;IAC9C,OAAO,CAAC,WAAW,CAAwC;IAC3D,OAAO,CAAC,UAAU,CAAW;;IAW7B,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI;IAMzB,QAAQ,CAAC,WAAW,EAAE,UAAU,EAAE;IAgBlC,UAAU;IAgBhB,sBAAsB;CAsBvB"}
|
@@ -11,10 +11,9 @@ const task_history_life_cycle_old_1 = require("./task-history-life-cycle-old");
|
|
11
11
|
let tasksHistoryLifeCycle;
|
12
12
|
function getTasksHistoryLifeCycle() {
|
13
13
|
if (!tasksHistoryLifeCycle) {
|
14
|
-
tasksHistoryLifeCycle =
|
15
|
-
|
16
|
-
|
17
|
-
: new task_history_life_cycle_old_1.LegacyTaskHistoryLifeCycle();
|
14
|
+
tasksHistoryLifeCycle = !native_1.IS_WASM
|
15
|
+
? new TaskHistoryLifeCycle()
|
16
|
+
: new task_history_life_cycle_old_1.LegacyTaskHistoryLifeCycle();
|
18
17
|
}
|
19
18
|
return tasksHistoryLifeCycle;
|
20
19
|
}
|
@@ -41,7 +41,7 @@ let taskHistory;
|
|
41
41
|
* @returns singleton instance of TaskHistory, null if database is disabled or WASM is enabled
|
42
42
|
*/
|
43
43
|
function getTaskHistory() {
|
44
|
-
if (
|
44
|
+
if (native_1.IS_WASM) {
|
45
45
|
return null;
|
46
46
|
}
|
47
47
|
if (!taskHistory) {
|