Skip to content

Commit c54727d

Browse files
authored
feat(core): add configure-ai-agents command (#32825)
This pull request introduces support for configuring specific AI agents in Nx workspaces, allowing users to select which agents to set up and generating only the relevant configuration files for those agents. It also updates documentation, schemas, and tests to reflect this new, more flexible approach. The most important changes are: **Agent Selection and Configuration:** * Added the ability to specify which AI agents to configure via an `agents` array, both in the setup schema (`schema.json`) and the `CreateWorkspaceOptions` type. The supported agents are: `claude`, `gemini`, `codex`, `cursor`, and `copilot`. The generator only creates configuration files for the selected agents, rather than all by default. [[1]](diffhunk://#diff-f4d0a6778d70986b54028fb1a5a9338ad4db252edd6db4066e7ee87e8d7f28a5R22-R30) [[2]](diffhunk://#diff-8141dbb37440f99a460b1e23d0c7229cd16338984832faf528d0ff23de179766R40-R50) [[3]](diffhunk://#diff-ed4e3e85dbc5d3358491bcef52a8f403a9607df8c874ec9dadef7cd2a1eba6c7R89-R121) * Implemented prompt logic for selecting AI agents interactively during workspace creation, and exposed available agent types for use in prompts and configuration. [[1]](diffhunk://#diff-672af9097acda13d133130b660df34e6ddf6a61a74f9a6d66832255123e8f9b9R16) [[2]](diffhunk://#diff-672af9097acda13d133130b660df34e6ddf6a61a74f9a6d66832255123e8f9b9R75-R119) **File Generation Logic:** * Refactored the `setupAiAgentsGenerator` implementation to generate only the files relevant to the specified agents (e.g., `CLAUDE.md`, `.mcp.json` for Claude; `.gemini/settings.json` for Gemini; `AGENTS.md` for others), and to append to existing files rather than overwrite them. [[1]](diffhunk://#diff-ed4e3e85dbc5d3358491bcef52a8f403a9607df8c874ec9dadef7cd2a1eba6c7R1-R45) [[2]](diffhunk://#diff-ed4e3e85dbc5d3358491bcef52a8f403a9607df8c874ec9dadef7cd2a1eba6c7R89-R121) * Added new utility functions for determining config file paths and reading agent-specific configuration, improving maintainability and clarity of file handling logic.
1 parent 05227d7 commit c54727d

File tree

32 files changed

+1607
-261
lines changed

32 files changed

+1607
-261
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
title: 'configure-ai-agents - CLI command'
3+
description: 'Configure and update AI agent configurations for your workspace.'
4+
---
5+
6+
# configure-ai-agents
7+
8+
Configure and update AI agent configurations for your workspace.
9+
10+
## Usage
11+
12+
```shell
13+
nx configure-ai-agents
14+
```
15+
16+
Install `nx` globally to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpm nx`.
17+
18+
## Options
19+
20+
| Option | Type | Description |
21+
| --------------- | ------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------- |
22+
| `--agents` | `claude`, `codex`, `copilot`, `cursor`, `gemini` | List of AI agents to set up. |
23+
| `--check` | boolean | Check if any configured agents are out of date and need to be updated. Does not make any changes. (Default: `false`) |
24+
| `--help` | boolean | Show help. |
25+
| `--interactive` | boolean | When false disables interactive input prompts for options. (Default: `true`) |
26+
| `--verbose` | boolean | Prints additional information about the commands (e.g., stack traces). |
27+
| `--version` | boolean | Show version number. |

docs/generated/cli/create-nx-workspace.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Install `create-nx-workspace` globally to invoke the command directly, or use `n
1919

2020
| Option | Type | Description |
2121
| -------------------------- | ----------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
22+
| `--aiAgents` | `claude`, `codex`, `copilot`, `cursor`, `gemini` | List of AI agents to configure. |
2223
| `--allPrompts`, `--a` | boolean | Show all prompts. (Default: `false`) |
2324
| `--appName` | string | The name of the app when using a monorepo with certain stacks. |
2425
| `--bundler` | string | Bundler to be used to build the app. |

docs/generated/manifests/menus.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5639,6 +5639,14 @@
56395639
"isExternal": false,
56405640
"disableCollapsible": false
56415641
},
5642+
{
5643+
"id": "configure-ai-agents",
5644+
"path": "/reference/core-api/nx/documents/configure-ai-agents",
5645+
"name": "configure-ai-agents",
5646+
"children": [],
5647+
"isExternal": false,
5648+
"disableCollapsible": false
5649+
},
56425650
{
56435651
"id": "login",
56445652
"path": "/reference/core-api/nx/documents/login",

docs/generated/manifests/new-nx-api.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3611,6 +3611,17 @@
36113611
"tags": ["mcp"],
36123612
"originalFilePath": "generated/cli/mcp"
36133613
},
3614+
"/reference/core-api/nx/documents/configure-ai-agents": {
3615+
"id": "configure-ai-agents",
3616+
"name": "configure-ai-agents",
3617+
"description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
3618+
"file": "generated/packages/nx/documents/configure-ai-agents",
3619+
"itemList": [],
3620+
"isExternal": false,
3621+
"path": "/reference/core-api/nx/documents/configure-ai-agents",
3622+
"tags": ["configure-ai-agents"],
3623+
"originalFilePath": "generated/cli/configure-ai-agents"
3624+
},
36143625
"/reference/core-api/nx/documents/login": {
36153626
"id": "login",
36163627
"name": "login",

docs/generated/manifests/tags.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,6 +1687,15 @@
16871687
"path": "/reference/core-api/nx/documents/mcp"
16881688
}
16891689
],
1690+
"configure-ai-agents": [
1691+
{
1692+
"description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
1693+
"file": "generated/packages/nx/documents/configure-ai-agents",
1694+
"id": "configure-ai-agents",
1695+
"name": "configure-ai-agents",
1696+
"path": "/reference/core-api/nx/documents/configure-ai-agents"
1697+
}
1698+
],
16901699
"nx-cloud": [
16911700
{
16921701
"description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",

docs/generated/packages-metadata.json

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
title: 'configure-ai-agents - CLI command'
3+
description: 'Configure and update AI agent configurations for your workspace.'
4+
---
5+
6+
# configure-ai-agents
7+
8+
Configure and update AI agent configurations for your workspace.
9+
10+
## Usage
11+
12+
```shell
13+
nx configure-ai-agents
14+
```
15+
16+
Install `nx` globally to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpm nx`.
17+
18+
## Options
19+
20+
| Option | Type | Description |
21+
| --------------- | ------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------- |
22+
| `--agents` | `claude`, `codex`, `copilot`, `cursor`, `gemini` | List of AI agents to set up. |
23+
| `--check` | boolean | Check if any configured agents are out of date and need to be updated. Does not make any changes. (Default: `false`) |
24+
| `--help` | boolean | Show help. |
25+
| `--interactive` | boolean | When false disables interactive input prompts for options. (Default: `true`) |
26+
| `--verbose` | boolean | Prints additional information about the commands (e.g., stack traces). |
27+
| `--version` | boolean | Show version number. |

docs/generated/packages/nx/documents/create-nx-workspace.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Install `create-nx-workspace` globally to invoke the command directly, or use `n
1919

2020
| Option | Type | Description |
2121
| -------------------------- | ----------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
22+
| `--aiAgents` | `claude`, `codex`, `copilot`, `cursor`, `gemini` | List of AI agents to configure. |
2223
| `--allPrompts`, `--a` | boolean | Show all prompts. (Default: `false`) |
2324
| `--appName` | string | The name of the app when using a monorepo with certain stacks. |
2425
| `--bundler` | string | Bundler to be used to build the app. |

docs/generated/packages/nx/generators/set-up-ai-agents.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@
2222
"type": "string",
2323
"description": "The version of the package to use",
2424
"default": "latest"
25+
},
26+
"agents": {
27+
"type": "array",
28+
"description": "The agents to setup Nx configuration for.",
29+
"items": {
30+
"type": "string",
31+
"enum": ["claude", "gemini", "codex", "cursor", "copilot"]
32+
},
33+
"default": ["claude", "gemini", "codex", "cursor", "copilot"]
2534
}
2635
},
2736
"required": ["directory"],

docs/map.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3123,6 +3123,12 @@
31233123
"tags": ["mcp"],
31243124
"file": "generated/cli/mcp"
31253125
},
3126+
{
3127+
"name": "configure-ai-agents",
3128+
"id": "configure-ai-agents",
3129+
"tags": ["configure-ai-agents"],
3130+
"file": "generated/cli/configure-ai-agents"
3131+
},
31263132
{
31273133
"name": "login",
31283134
"id": "login",

0 commit comments

Comments
 (0)