From 713827a02a526e8ee2c622ab2869871c7197d59e Mon Sep 17 00:00:00 2001 From: Charles Lyding <19598772+clydin@users.noreply.github.com> Date: Tue, 30 Sep 2025 11:00:58 -0400 Subject: [PATCH] feat(@schematics/angular): add AGENTS.md support to ai-config schematic This change introduces support for generating an `AGENTS.md` file via the `ng generate ai-config` schematic. The `AGENTS.md` standard is an emerging convention for providing instructions to AI agents that operate within a codebase. By adding this option, users can easily create a root-level `AGENTS.md` file, helping to configure AI agents with project-specific guidelines and best practices. The implementation includes: - Updating the schematic's `schema.json` to include `agents` as a selectable tool. - Extending the logic in `index.ts` to handle the creation and placement of the file. - Adding a unit test to ensure the file is generated correctly. --- packages/schematics/angular/ai-config/index.ts | 4 ++++ packages/schematics/angular/ai-config/index_spec.ts | 5 +++++ packages/schematics/angular/ai-config/schema.json | 6 +++++- packages/schematics/angular/ng-new/schema.json | 2 +- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/packages/schematics/angular/ai-config/index.ts b/packages/schematics/angular/ai-config/index.ts index 4d234b35e5d4..dab01f2d40bc 100644 --- a/packages/schematics/angular/ai-config/index.ts +++ b/packages/schematics/angular/ai-config/index.ts @@ -20,6 +20,10 @@ import { import { Schema as ConfigOptions, Tool } from './schema'; const AI_TOOLS: { [key in Exclude]: ContextFileInfo } = { + agents: { + rulesName: 'AGENTS.md', + directory: '.', + }, gemini: { rulesName: 'GEMINI.md', directory: '.gemini', diff --git a/packages/schematics/angular/ai-config/index_spec.ts b/packages/schematics/angular/ai-config/index_spec.ts index d21186be408a..1163fabab7ad 100644 --- a/packages/schematics/angular/ai-config/index_spec.ts +++ b/packages/schematics/angular/ai-config/index_spec.ts @@ -31,6 +31,11 @@ describe('Ai Config Schematic', () => { workspaceTree = await schematicRunner.runSchematic('workspace', workspaceOptions); }); + it('should create an AGENTS.md file', async () => { + const tree = await runConfigSchematic([ConfigTool.Agents]); + expect(tree.exists('AGENTS.md')).toBeTruthy(); + }); + it('should create a GEMINI.MD file', async () => { const tree = await runConfigSchematic([ConfigTool.Gemini]); expect(tree.exists('.gemini/GEMINI.md')).toBeTruthy(); diff --git a/packages/schematics/angular/ai-config/schema.json b/packages/schematics/angular/ai-config/schema.json index cf89108f2cd0..bbfc21028c9f 100644 --- a/packages/schematics/angular/ai-config/schema.json +++ b/packages/schematics/angular/ai-config/schema.json @@ -18,6 +18,10 @@ "value": "none", "label": "None" }, + { + "value": "agents", + "label": "Agents.md [ https://agents.md/ ]" + }, { "value": "claude", "label": "Claude [ https://docs.anthropic.com/en/docs/claude-code/memory ]" @@ -47,7 +51,7 @@ "description": "Specifies which AI tools to generate configuration files for. These file are used to improve the outputs of AI tools by following the best practices.", "items": { "type": "string", - "enum": ["none", "gemini", "copilot", "claude", "cursor", "jetbrains", "windsurf"] + "enum": ["none", "gemini", "copilot", "claude", "cursor", "jetbrains", "windsurf", "agents"] } } } diff --git a/packages/schematics/angular/ng-new/schema.json b/packages/schematics/angular/ng-new/schema.json index 5f13e4b26d70..afdef38e88da 100644 --- a/packages/schematics/angular/ng-new/schema.json +++ b/packages/schematics/angular/ng-new/schema.json @@ -149,7 +149,7 @@ "description": "Specifies which AI tools to generate configuration files for. These file are used to improve the outputs of AI tools by following the best practices.", "items": { "type": "string", - "enum": ["none", "gemini", "copilot", "claude", "cursor", "jetbrains", "windsurf"] + "enum": ["none", "gemini", "copilot", "claude", "cursor", "jetbrains", "windsurf", "agents"] } }, "fileNameStyleGuide": {