Skip to content

Commit 8e8fb45

Browse files
feat: update AI configuration to include assistant selection and modify related commands
1 parent 11b80bb commit 8e8fb45

4 files changed

Lines changed: 21 additions & 14 deletions

File tree

.vscode/launch.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,11 @@
8080
"program": "${workspaceRoot}/packages/cli/bin/execute.js",
8181
"console": "externalTerminal",
8282
"preLaunchTask": "build",
83-
"outFiles": [ "${workspaceRoot}/lib/**/*.js",
84-
"${workspaceRoot}/spec/**/*.js" ],
8583
"args": [
8684
"new",
8785
"angularproj",
88-
"--framework=angular"
86+
"--framework=angular",
87+
"--skip-install"
8988
]
9089
},
9190
{
@@ -298,7 +297,7 @@
298297
"preLaunchTask": "build",
299298
"outFiles": ["${workspaceFolder}/**/*.js"],
300299
"args": [
301-
"list"
300+
"ai-config"
302301
]
303302
}, {
304303
"type": "node",

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,22 @@ export function configureSkills(agents: AIAgentTarget[]): void {
2929
}
3030
}
3131

32-
export async function configure(agents?: AIAgentTarget[], skills = true, assistants: AiCodingAssistant[] = ["vscode"]): Promise<void> {
32+
export async function configure(agents?: AIAgentTarget[], skills = true, assistants?: AiCodingAssistant[]): Promise<void> {
33+
if (!agents?.length) {
34+
agents = await promptForAgents();
35+
}
36+
37+
if (!assistants?.length) {
38+
assistants = await promptForAssistant();
39+
}
3340
configureMCP(assistants);
34-
if (!agents?.length) return;
41+
3542
if (skills) {
3643
configureSkills(agents);
3744
}
3845
copyAgentInstructionFiles(agents);
3946
}
47+
4048
const AI_AGENT_CHECKBOX_DEFAULTS: AIAgentTarget[] = ["generic", "claude"];
4149

4250
const AI_ASSISTANT_CHECKBOX_DEFAULTS: AiCodingAssistant[] = ["vscode", "claude-code"];

packages/cli/lib/commands/new.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AI_AGENT_CHOICES, AIAgentTarget, GoogleAnalytics, PackageManager, ProjectConfig, ProjectLibrary, Util } from "@igniteui/cli-core";
1+
import { AI_AGENT_CHOICES, AIAgentTarget, AiCodingAssistant, GoogleAnalytics, PackageManager, ProjectConfig, ProjectLibrary, Util } from "@igniteui/cli-core";
22
import * as path from "path";
33
import { PromptSession } from "./../PromptSession";
44
import { NewCommandType, PositionalArgs } from "./types";
@@ -166,7 +166,7 @@ const command: NewCommandType = {
166166
}
167167

168168
process.chdir(argv.name);
169-
await configure(argv.agents as AIAgentTarget[] | undefined);
169+
await configure(argv.agents as AIAgentTarget[] | undefined, true, argv.assistants as AiCodingAssistant[] | undefined);
170170
process.chdir("..");
171171

172172
if (!argv["skip-git"] && !ProjectConfig.getConfig().skipGit) {

spec/unit/ai-config-spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ describe("Unit - ai-config command", () => {
289289
required: true
290290
}));
291291
expect(GoogleAnalytics.post).toHaveBeenCalledWith(jasmine.objectContaining({ t: "screenview", cd: "Ai Config" }));
292-
expect(GoogleAnalytics.post).toHaveBeenCalledWith(jasmine.objectContaining({ t: "event", ea: "agent: claude" }));
292+
expect(GoogleAnalytics.post).toHaveBeenCalledWith(jasmine.objectContaining({ t: "event", ea: "agent: claude; assistant: vscode" }));
293293
});
294294

295295
it("uses defaults without prompting when canPrompt returns false", async () => {
@@ -300,7 +300,7 @@ describe("Unit - ai-config command", () => {
300300
await aiConfig.default.handler({ _: ["ai-config"], $0: "ig" });
301301

302302
expect(InquirerWrapper.checkbox).not.toHaveBeenCalled();
303-
expect(GoogleAnalytics.post).toHaveBeenCalledWith(jasmine.objectContaining({ t: "event", ea: "agent: generic, claude" }));
303+
expect(GoogleAnalytics.post).toHaveBeenCalledWith(jasmine.objectContaining({ t: "event", ea: "agent: generic, claude; assistant: vscode, claude-code" }));
304304
});
305305

306306
it("logs skipping and does not post analytics when none is selected", async () => {
@@ -313,7 +313,7 @@ describe("Unit - ai-config command", () => {
313313

314314
expect(Util.log).toHaveBeenCalledWith(jasmine.stringContaining("Skipping"));
315315
expect(GoogleAnalytics.post).toHaveBeenCalledWith(jasmine.objectContaining({ t: "screenview", cd: "Ai Config" }));
316-
expect(GoogleAnalytics.post).toHaveBeenCalledWith(jasmine.objectContaining({ t: "event", ea: "agent: none" }));
316+
expect(GoogleAnalytics.post).toHaveBeenCalledWith(jasmine.objectContaining({ t: "event", ea: "agent: none; assistant: none" }));
317317
});
318318

319319
it("still configures MCP when none is selected for skills", async () => {
@@ -329,7 +329,7 @@ describe("Unit - ai-config command", () => {
329329
expect(mockFs.writeFile).toHaveBeenCalled();
330330
// TODO: toHaveBeenCalledWith check for mcp.json
331331
expect(GoogleAnalytics.post).toHaveBeenCalledWith(jasmine.objectContaining({ t: "screenview", cd: "Ai Config" }));
332-
expect(GoogleAnalytics.post).toHaveBeenCalledWith(jasmine.objectContaining({ ea: "agent: none" }));
332+
expect(GoogleAnalytics.post).toHaveBeenCalledWith(jasmine.objectContaining({ ea: "agent: none; assistant: none" }));
333333
});
334334

335335
it("configures multiple agents when selected interactively", async () => {
@@ -345,7 +345,7 @@ describe("Unit - ai-config command", () => {
345345
expect(InquirerWrapper.checkbox).toHaveBeenCalledWith(jasmine.objectContaining({
346346
message: "Which AI agents do you want to generate skills and instructions for?"
347347
}));
348-
expect(GoogleAnalytics.post).toHaveBeenCalledWith(jasmine.objectContaining({ ea: "agent: claude, cursor" }));
348+
expect(GoogleAnalytics.post).toHaveBeenCalledWith(jasmine.objectContaining({ ea: "agent: claude, cursor; assistant: vscode" }));
349349
});
350350

351351
it("skips prompt when --agent is provided", async () => {
@@ -357,7 +357,7 @@ describe("Unit - ai-config command", () => {
357357
expect(InquirerWrapper.checkbox).not.toHaveBeenCalledWith(jasmine.objectContaining({
358358
message: "Which AI agents do you want to generate skills and instructions for?"
359359
}));
360-
expect(GoogleAnalytics.post).toHaveBeenCalledWith(jasmine.objectContaining({ ea: "agent: cursor" }));
360+
expect(GoogleAnalytics.post).toHaveBeenCalledWith(jasmine.objectContaining({ ea: "agent: cursor; assistant: vscode" }));
361361
});
362362

363363
it("skips assistant prompt when --assistant is provided", async () => {

0 commit comments

Comments
 (0)