Skip to content

Commit 5ae1e91

Browse files
feat: enhance AI configuration by adding assistant labels and improving agent selection logic
1 parent 322523e commit 5ae1e91

3 files changed

Lines changed: 34 additions & 33 deletions

File tree

packages/cli/lib/commands/ai-config.ts

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { addMcpServers, AI_AGENT_LABELS, AI_AGENT_CHOICES, AIAgentTarget, copyAgentInstructionFiles, copyAISkillsToProject, GoogleAnalytics, InquirerWrapper, Util, AiCodingAssistant, AI_ASSISTANT_MCP_CONFIGS } from "@igniteui/cli-core";
1+
import { addMcpServers, AI_AGENT_LABELS, AI_AGENT_CHOICES, AIAgentTarget, copyAgentInstructionFiles, copyAISkillsToProject, GoogleAnalytics, InquirerWrapper, Util, AiCodingAssistant, AI_ASSISTANT_MCP_CONFIGS, AI_ASSISTANT_CHOICES, AI_ASSISTANT_LABELS } from "@igniteui/cli-core";
22
import { ArgumentsCamelCase, CommandModule } from "yargs";
33

44
export function configureMCP(assistants: AiCodingAssistant[] = ["vscode"]): void {
@@ -30,27 +30,16 @@ export function configureSkills(agents: AIAgentTarget[]): void {
3030
}
3131

3232
export async function configure(agents?: AIAgentTarget[], skills = true, assistants: AiCodingAssistant[] = ["vscode"]): Promise<void> {
33-
if (!agents?.length) {
34-
agents = await promptForAgents();
35-
}
36-
if (!agents.length) return;
3733
configureMCP(assistants);
34+
if (!agents?.length) return;
3835
if (skills) {
3936
configureSkills(agents);
4037
}
4138
copyAgentInstructionFiles(agents);
4239
}
4340
const AI_AGENT_CHECKBOX_DEFAULTS: AIAgentTarget[] = ["generic", "claude"];
4441

45-
const AI_ASSISTANT_CHOICES = Object.keys(AI_ASSISTANT_MCP_CONFIGS) as AiCodingAssistant[];
46-
47-
const AI_ASSISTANT_LABELS: Record<AiCodingAssistant, string> = {
48-
"vscode": "VS Code (GitHub Copilot)",
49-
"cursor": "Cursor",
50-
"claude-code": "Claude Code",
51-
"gemini": "Gemini",
52-
"junie": "JetBrains Junie",
53-
};
42+
const AI_ASSISTANT_CHECKBOX_DEFAULTS: AiCodingAssistant[] = ["vscode", "claude-code"];
5443

5544
const AI_AGENT_CHECKBOX_CHOICES = [
5645
{ value: "none", name: "None (skip skills and instructions)" },
@@ -66,7 +55,7 @@ const AI_ASSISTANT_CHECKBOX_CHOICES = [
6655
...AI_ASSISTANT_CHOICES.map(a => ({
6756
value: a,
6857
name: AI_ASSISTANT_LABELS[a],
69-
checked: a === "vscode"
58+
checked: AI_ASSISTANT_CHECKBOX_DEFAULTS.includes(a)
7059
}))
7160
];
7261

@@ -84,13 +73,16 @@ export async function promptForAgents(): Promise<AIAgentTarget[]> {
8473
}
8574

8675
export async function promptForAssistant(): Promise<AiCodingAssistant[]> {
87-
// TODO: check Util.canPrompt() and assign defaults
88-
const selected = await InquirerWrapper.checkbox({
89-
message: "Which coding assistants should MCP servers be configured for?",
90-
required: true,
91-
choices: AI_ASSISTANT_CHECKBOX_CHOICES
92-
});
93-
return selected.includes("none") ? [] : selected as AiCodingAssistant[];
76+
let selected: AiCodingAssistant[] = AI_ASSISTANT_CHECKBOX_DEFAULTS;
77+
if (Util.canPrompt()) {
78+
const result = await InquirerWrapper.checkbox({
79+
message: "Which coding assistants should MCP servers be configured for?",
80+
required: true,
81+
choices: AI_ASSISTANT_CHECKBOX_CHOICES
82+
});
83+
selected = result.includes("none") ? [] : result as AiCodingAssistant[];
84+
}
85+
return selected;
9486
}
9587

9688
const command: CommandModule = {
@@ -112,34 +104,34 @@ const command: CommandModule = {
112104
async handler(argv: ArgumentsCamelCase) {
113105
let agents = argv.agent as AIAgentTarget[] | undefined;
114106
let assistants = argv.assistant as AiCodingAssistant[] | undefined;
115-
116107
GoogleAnalytics.post({
117108
t: "screenview",
118109
cd: "Ai Config"
119110
});
120111

121-
if (!assistants?.length) {
122-
assistants = await promptForAssistant();
123-
}
124112
if (!agents?.length) {
125113
agents = await promptForAgents();
126114
}
115+
if (!assistants?.length) {
116+
assistants = await promptForAssistant();
117+
}
127118

128119
GoogleAnalytics.post({
129120
t: "event",
130121
ec: "$ig ai-config",
131-
ea: `agent: ${agents.join(", ") || "none"}`
122+
ea: `agent: ${agents?.join(", ") || "none"}; assistant: ${assistants?.join(", ") || "none"}`
132123
});
133124

134-
if (assistants.length) {
135-
configureMCP(assistants);
125+
if (!assistants.length) {
126+
Util.log("No MCP configuration selected. Skipping.");
127+
return;
136128
}
137129

138130
if (!agents.length) {
139131
Util.log("No AI configuration selected. Skipping.");
140132
return;
141133
}
142-
await configure(agents);
134+
await configure(agents, true, assistants);
143135
}
144136
};
145137

packages/core/util/mcp-config.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,26 @@ export interface McpServerEntry {
77
args: string[];
88
}
99

10-
export type AiCodingAssistant = "vscode" | "cursor" | "claude-code" | "gemini" | "junie";
10+
export const AI_ASSISTANT_CHOICES = ["vscode", "claude-code", "cursor", "gemini", "junie"] as const;
11+
export type AiCodingAssistant = typeof AI_ASSISTANT_CHOICES[number];
1112

1213
interface AssistantMcpConfig {
1314
mcpFilePath: string;
1415
rootKey: "servers" | "mcpServers";
1516
}
1617

18+
export const AI_ASSISTANT_LABELS: Record<AiCodingAssistant, string> = {
19+
"vscode": "VS Code (GitHub Copilot)",
20+
"claude-code": "Claude Code",
21+
"cursor": "Cursor",
22+
"gemini": "Gemini",
23+
"junie": "JetBrains Junie",
24+
};
25+
1726
export const AI_ASSISTANT_MCP_CONFIGS: Record<AiCodingAssistant, AssistantMcpConfig> = {
1827
"vscode": { mcpFilePath: ".vscode/mcp.json", rootKey: "servers" },
19-
"cursor": { mcpFilePath: ".cursor/mcp.json", rootKey: "mcpServers" },
2028
"claude-code": { mcpFilePath: ".mcp.json", rootKey: "mcpServers" },
29+
"cursor": { mcpFilePath: ".cursor/mcp.json", rootKey: "mcpServers" },
2130
"gemini": { mcpFilePath: ".gemini/settings.json", rootKey: "mcpServers" },
2231
"junie": { mcpFilePath: ".junie/mcp/mcp.json", rootKey: "mcpServers" },
2332
};

packages/ng-schematics/src/cli-config/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as ts from "typescript";
22
import { DependencyNotFoundException } from "@angular-devkit/core";
33
import { chain, FileDoesNotExistException, Rule, SchematicContext, Tree } from "@angular-devkit/schematics";
44
import { RunSchematicTask } from "@angular-devkit/schematics/tasks";
5-
import { addClassToBody, addMcpServers, AIAgentTarget, AiCodingAssistant, App, copyAgentInstructionFiles, copyAISkillsToProject, FormatSettings, McpServerEntry, NPM_ANGULAR, resolvePackage, TEMPLATE_MANAGER, TypeScriptAstTransformer, TypeScriptUtils, VS_CODE_MCP_PATH } from "@igniteui/cli-core";
5+
import { addClassToBody, addMcpServers, AIAgentTarget, AiCodingAssistant, App, copyAgentInstructionFiles, copyAISkillsToProject, FormatSettings, McpServerEntry, NPM_ANGULAR, resolvePackage, TEMPLATE_MANAGER, TypeScriptAstTransformer, TypeScriptUtils } from "@igniteui/cli-core";
66
import { AngularTypeScriptFileUpdate } from "@igniteui/angular-templates";
77
import { createCliConfig } from "../utils/cli-config";
88
import { setVirtual } from "../utils/NgFileSystem";

0 commit comments

Comments
 (0)