feat(ng-schematics): add ai-config schematic for AI/MCP server config…#1624
feat(ng-schematics): add ai-config schematic for AI/MCP server config…#1624Marina-L-Stoyanova wants to merge 7 commits intomasterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new Angular schematic entry to expose the existing addAIConfig rule as a standalone schematic, enabling generation/augmentation of .vscode/mcp.json AI/MCP server configuration via the schematics collection.
Changes:
- Register a new
ai-configschematic in the schematics collection. - Wire
ai-configto./cli-config/index#addAIConfig.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Adds a new Angular schematic entry for generating AI/MCP server configuration and updates the existing config writer to accept JSONC input when updating .vscode/mcp.json.
Changes:
- Register a new
ai-configschematic in the schematics collection. - Update
.vscode/mcp.jsonparsing to usejsonc-parser(JSONC support) when the file already exists.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/ng-schematics/src/collection.json | Adds the ai-config schematic entry pointing to addAIConfig. |
| packages/ng-schematics/src/cli-config/index.ts | Uses JSONC parsing for existing .vscode/mcp.json before merging server entries. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (tree.exists(mcpFilePath)) { | ||
| const content = JSON.parse(tree.read(mcpFilePath)!.toString()); | ||
| const content = parseJsonc(tree.read(mcpFilePath)!.toString()) as any; | ||
| const servers = content.servers ?? {}; | ||
| let modified = false; | ||
| if (!servers["igniteui-cli"]) { |
| @@ -1,5 +1,6 @@ | |||
| import * as ts from "typescript"; | |||
| import { DependencyNotFoundException } from "@angular-devkit/core"; | |||
| import { parse as parseJsonc } from "jsonc-parser"; | |||
| if (tree.exists(mcpFilePath)) { | ||
| const content = JSON.parse(tree.read(mcpFilePath)!.toString()); | ||
| const content = parseJsonc(tree.read(mcpFilePath)!.toString()) as any; | ||
| const servers = content.servers ?? {}; | ||
| let modified = false; |
There was a problem hiding this comment.
Pull request overview
Adds a dedicated ai-config Angular schematic to generate/merge AI/MCP server configuration under .vscode/mcp.json, and expands the generated config to include an angular-cli MCP server.
Changes:
- Register new
ai-configschematic in the schematics collection. - Extend
addAIConfig()to add anangular-cliMCP server entry alongside the existing Ignite UI servers.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/ng-schematics/src/collection.json | Adds a new ai-config schematic entry pointing at addAIConfig. |
| packages/ng-schematics/src/cli-config/index.ts | Updates MCP config generation/merge logic to include an angular-cli server definition. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -133,6 +137,10 @@ export function addAIConfig(): Rule { | |||
| const content = JSON.parse(tree.read(mcpFilePath)!.toString()); | |||
| const servers = content.servers ?? {}; | |||
| let modified = false; | |||
| if (!servers["angular-cli"]) { | |||
| servers["angular-cli"] = angularCliServer; | |||
| modified = true; | |||
| } | |||
| "ai-config": { | ||
| "description": "Adds AI/MCP server configuration to .vscode/mcp.json.", | ||
| "factory": "./cli-config/index#addAIConfig" | ||
| }, |
…o parse json with comments
There was a problem hiding this comment.
Pull request overview
Adds a new Angular schematic entry for generating AI/MCP server configuration and updates the existing CLI config schematic logic to safely merge server entries into .vscode/mcp.json (including JSON-with-comments support).
Changes:
- Adds a new
ai-configschematic to the schematics collection. - Updates
addAIConfig()to merge MCP server entries viajsonc-parseredits (preserving existing formatting/content) and adds anangular-cliserver entry.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
packages/ng-schematics/src/collection.json |
Registers a new ai-config schematic pointing to addAIConfig. |
packages/ng-schematics/src/cli-config/index.ts |
Switches MCP config updates to JSONC-aware parsing/editing and adds the angular-cli MCP server entry. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import * as ts from "typescript"; | ||
| import { DependencyNotFoundException } from "@angular-devkit/core"; | ||
| import { chain, FileDoesNotExistException, Rule, SchematicContext, Tree } from "@angular-devkit/schematics"; | ||
| import * as jsonc from "jsonc-parser"; |
| let text = tree.read(mcpFilePath)!.toString(); | ||
| const content = jsonc.parse(text); | ||
| const servers = content.servers ?? {}; |
| @@ -130,24 +135,31 @@ export function addAIConfig(): Rule { | |||
| }; | |||
|
|
|||
| if (tree.exists(mcpFilePath)) { | |||
| const content = JSON.parse(tree.read(mcpFilePath)!.toString()); | |||
| let text = tree.read(mcpFilePath)!.toString(); | |||
| const content = jsonc.parse(text); | |||
| const servers = content.servers ?? {}; | |||
| let modified = false; | |||
| const formattingOptions: jsonc.FormattingOptions = { tabSize: 2, insertSpaces: true }; | |||
| const newServers: Record<string, object> = {}; | |||
| if (!servers["angular-cli"]) { | |||
| newServers["angular-cli"] = angularCliServer; | |||
| } | |||
| if (!servers["igniteui-cli"]) { | |||
…ervers are present
…uration
Closes # .
Additional information related to this pull request: