nx 21.6.3 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "21.6.3",
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.8.3",
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": "21.6.3",
87
- "@nx/nx-darwin-x64": "21.6.3",
88
- "@nx/nx-freebsd-x64": "21.6.3",
89
- "@nx/nx-linux-arm-gnueabihf": "21.6.3",
90
- "@nx/nx-linux-arm64-gnu": "21.6.3",
91
- "@nx/nx-linux-arm64-musl": "21.6.3",
92
- "@nx/nx-linux-x64-gnu": "21.6.3",
93
- "@nx/nx-linux-x64-musl": "21.6.3",
94
- "@nx/nx-win32-arm64-msvc": "21.6.3",
95
- "@nx/nx-win32-x64-msvc": "21.6.3"
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
@@ -67,7 +67,8 @@
67
67
  "production",
68
68
  "^production",
69
69
  {
70
- "dependentTasksOutputFiles": "**/*.node"
70
+ "dependentTasksOutputFiles": "**/*.node",
71
+ "transitive": true
71
72
  }
72
73
  ],
73
74
  "executor": "nx:run-commands",
@@ -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;CACjB;AAED,eAAO,MAAM,6BAA6B,EAAE,aAAa,CACvD,EAAE,EACF,wBAAwB,CA6CzB,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: 'boolean',
22
- description: 'Check if any configured agents are out of date and need to be updated. Does not make any changes.',
23
- default: false,
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 --agents claude gemini --no-interactive', 'Configures and updates Claude and Gemini AI agents without prompts'),
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":"AAeA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAI5D,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,wBAAwB,EAC9B,KAAK,UAAQ,GACZ,OAAO,CAAC,IAAI,CAAC,CA+Bf;AAED,wBAAsB,4BAA4B,CAChD,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,IAAI,CAAC,CA2Mf"}
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"}
@@ -64,38 +64,64 @@ async function configureAiAgentsHandlerImpl(options) {
64
64
  });
65
65
  process.exit(1);
66
66
  }
67
- if (options.check) {
68
- if (fullyConfiguredAgents.length === 0) {
69
- output_1.output.log({
70
- title: 'No AI agents are configured',
71
- bodyLines: [
72
- 'You can configure AI agents by running `nx configure-ai-agents`.',
73
- ],
74
- });
75
- process.exit(0);
76
- }
67
+ // important for wording
68
+ const usingAllAgents = normalizedOptions.agents.length === utils_1.supportedAgents.length;
69
+ if (normalizedOptions.check) {
77
70
  const outOfDateAgents = fullyConfiguredAgents.filter((a) => a?.outdated);
78
- if (outOfDateAgents.length === 0) {
79
- output_1.output.success({
80
- title: 'All configured AI agents are up to date',
81
- bodyLines: fullyConfiguredAgents.map((a) => `- ${a.displayName}`),
82
- });
83
- process.exit(0);
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
84
107
  }
85
- else {
86
- output_1.output.log({
87
- title: 'The following AI agents are out of date:',
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:',
88
120
  bodyLines: [
89
- ...outOfDateAgents.map((a) => {
90
- const rulesPath = a.rulesPath;
91
- const displayPath = rulesPath.startsWith(workspace_root_1.workspaceRoot)
92
- ? (0, path_1.relative)(workspace_root_1.workspaceRoot, rulesPath)
93
- : rulesPath;
94
- return `- ${a.displayName} (${displayPath})`;
95
- }),
96
- '',
97
- 'You can update them by running `nx configure-ai-agents`.',
98
- ],
121
+ ...partiallyConfiguredAgents,
122
+ ...outOfDateAgents,
123
+ ...nonConfiguredAgents,
124
+ ].map((a) => getAgentChoiceForPrompt(a).message),
99
125
  });
100
126
  process.exit(1);
101
127
  }
@@ -123,7 +149,6 @@ async function configureAiAgentsHandlerImpl(options) {
123
149
  currentIndex++;
124
150
  });
125
151
  if (allAgentChoices.length === 0) {
126
- const usingAllAgents = normalizedOptions.agents.length === utils_1.supportedAgents.length;
127
152
  output_1.output.success({
128
153
  title: `No new agents to configure. All ${!usingAllAgents ? 'selected' : 'supported'} AI agents are already configured:`,
129
154
  bodyLines: fullyConfiguredAgents.map((agent) => `- ${agent.displayName}`),
@@ -228,9 +253,11 @@ function getAgentChoiceForPrompt(agent) {
228
253
  }
229
254
  function normalizeOptions(options) {
230
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;
231
258
  return {
232
259
  ...options,
233
260
  agents,
234
- check: options.check ?? false,
261
+ check,
235
262
  };
236
263
  }
@@ -0,0 +1,3 @@
1
+ import { Agent } from '../../ai/utils';
2
+ export declare function determineAiAgents(aiAgents?: Agent[], interactive?: boolean): Promise<Agent[]>;
3
+ //# sourceMappingURL=ai-agent-prompts.d.ts.map
@@ -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;AA4BvE,MAAM,WAAW,QAAQ;IACvB,WAAW,EAAE,OAAO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BAAoB,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: '.',
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' });
@@ -1 +1 @@
1
- {"version":3,"file":"command-object.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/command-line/nx-cloud/login/command-object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGtC,eAAO,MAAM,iBAAiB,EAAE,aAmB/B,CAAC"}
1
+ {"version":3,"file":"command-object.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/command-line/nx-cloud/login/command-object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGtC,eAAO,MAAM,iBAAiB,EAAE,aAkB/B,CAAC"}
@@ -4,9 +4,9 @@ exports.yargsLoginCommand = void 0;
4
4
  const shared_options_1 = require("../../yargs-utils/shared-options");
5
5
  exports.yargsLoginCommand = {
6
6
  command: 'login [nxCloudUrl]',
7
- describe: 'Login to Nx Cloud. This command is an alias for [`nx-cloud login`](/ci/reference/nx-cloud-cli#npx-nxcloud-login).',
7
+ describe: 'Login to Nx Cloud. This command is an alias for `nx-cloud login`.',
8
8
  builder: (yargs) => (0, shared_options_1.withVerbose)(yargs.positional('nxCloudUrl', {
9
- describe: 'The Nx Cloud URL of the instance you are trying to connect to. If no positional argument is provided, this command will connect to https://cloud.nx.app.',
9
+ describe: 'The Nx Cloud URL of the instance you are trying to connect to. If no positional argument is provided, this command will connect to your configured Nx Cloud instance by default.',
10
10
  type: 'string',
11
11
  required: false,
12
12
  }))
@@ -4,7 +4,7 @@ exports.yargsLogoutCommand = void 0;
4
4
  const shared_options_1 = require("../../yargs-utils/shared-options");
5
5
  exports.yargsLogoutCommand = {
6
6
  command: 'logout',
7
- describe: 'Logout from Nx Cloud. This command is an alias for [`nx-cloud logout`](/ci/reference/nx-cloud-cli#npx-nxcloud-logout).',
7
+ describe: 'Logout from Nx Cloud. This command is an alias for `nx-cloud logout`.',
8
8
  builder: (yargs) => (0, shared_options_1.withVerbose)(yargs)
9
9
  .help(false)
10
10
  .showHelpOnFail(false)