Skip to content

Commit b0b8fd0

Browse files
committed
feat: add AI agent skills suggestion after project creation
Add multi-select prompt to install AI agent skills after project creation. Users can select which agents to configure (Cursor, Claude Code) with all agents selected by default. - Interactive mode: shows multi-select with all agents pre-selected - Non-interactive mode: use --skills flag to install for all agents - Uses `npx add-skill base44/skills -a <agent>` for selected agents Closes #91
1 parent 71e2622 commit b0b8fd0

1 file changed

Lines changed: 52 additions & 1 deletion

File tree

src/cli/commands/project/create.ts

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { resolve, join } from "node:path";
22
import { execa } from "execa";
33
import { Command } from "commander";
4-
import { log, group, text, select, confirm, isCancel } from "@clack/prompts";
4+
import { log, group, text, select, multiselect, isCancel } from "@clack/prompts";
55
import type { Option } from "@clack/prompts";
66
import kebabCase from "lodash.kebabcase";
77
import { createProjectFiles, listTemplates, readProjectConfig, setAppConfig } from "@core/project/index.js";
@@ -18,12 +18,18 @@ import type { RunCommandResult } from "../../utils/runCommand.js";
1818

1919
const DEFAULT_TEMPLATE_ID = "backend-only";
2020

21+
const SUPPORTED_AGENTS = [
22+
{ value: "cursor", label: "Cursor" },
23+
{ value: "claude-code", label: "Claude Code" },
24+
] as const;
25+
2126
interface CreateOptions {
2227
name?: string;
2328
description?: string;
2429
path?: string;
2530
template?: string;
2631
deploy?: boolean;
32+
skills?: boolean;
2733
}
2834

2935
async function getTemplateById(templateId: string): Promise<Template> {
@@ -105,6 +111,7 @@ async function createInteractive(options: CreateOptions): Promise<RunCommandResu
105111
description: result.description || undefined,
106112
projectPath: result.projectPath as string,
107113
deploy: options.deploy,
114+
skills: options.skills,
108115
isInteractive: true,
109116
});
110117
}
@@ -118,6 +125,7 @@ async function createNonInteractive(options: CreateOptions): Promise<RunCommandR
118125
description: options.description,
119126
projectPath: options.path!,
120127
deploy: options.deploy,
128+
skills: options.skills,
121129
isInteractive: false,
122130
});
123131
}
@@ -128,13 +136,15 @@ async function executeCreate({
128136
description,
129137
projectPath,
130138
deploy,
139+
skills,
131140
isInteractive,
132141
}: {
133142
template: Template;
134143
name: string;
135144
description?: string;
136145
projectPath: string;
137146
deploy?: boolean;
147+
skills?: boolean;
138148
isInteractive: boolean;
139149
}): Promise<RunCommandResult> {
140150
const name = rawName.trim();
@@ -224,6 +234,46 @@ async function executeCreate({
224234
}
225235
}
226236

237+
// Add AI agent skills
238+
let selectedAgents: string[] = [];
239+
240+
if (isInteractive) {
241+
const result = await multiselect({
242+
message: "Add AI agent skills? (Select agents to configure)",
243+
options: SUPPORTED_AGENTS.map((agent) => ({
244+
value: agent.value,
245+
label: agent.label,
246+
})),
247+
initialValues: SUPPORTED_AGENTS.map((agent) => agent.value),
248+
required: false,
249+
});
250+
251+
if (!isCancel(result)) {
252+
selectedAgents = result as string[];
253+
}
254+
} else if (skills) {
255+
selectedAgents = SUPPORTED_AGENTS.map((agent) => agent.value);
256+
}
257+
258+
if (selectedAgents.length > 0) {
259+
const agentArgs = selectedAgents.flatMap((agent) => ["-a", agent]);
260+
log.message("Installing skills for: " + selectedAgents.join(", "));
261+
try {
262+
await execa("npx", [
263+
"-y", "add-skill", "base44/skills",
264+
"-y", // Skip add-skill prompts (use defaults: project scope, symlink)
265+
"-s", "base44-cli", "-s", "base44-sdk",
266+
...agentArgs
267+
], {
268+
cwd: resolvedPath,
269+
stdio: "inherit",
270+
});
271+
log.message(theme.colors.base44Orange("AI agent skills added successfully"));
272+
} catch (error) {
273+
log.message("Failed to add AI agent skills - you can add them later with: npx add-skill base44/skills");
274+
}
275+
}
276+
227277
log.message(`${theme.styles.header("Project")}: ${theme.colors.base44Orange(name)}`);
228278
log.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl(projectId))}`);
229279

@@ -241,6 +291,7 @@ export const createCommand = new Command("create")
241291
.option("-p, --path <path>", "Path where to create the project")
242292
.option("-t, --template <id>", "Template ID (e.g., backend-only, backend-and-client)")
243293
.option("--deploy", "Build and deploy the site")
294+
.option("--skills", "Add AI agent skills (Cursor, Claude Code)")
244295
.hook("preAction", validateNonInteractiveFlags)
245296
.action(async (options: CreateOptions) => {
246297
await chooseCreate(options);

0 commit comments

Comments
 (0)