Skip to content

Commit 6d36fe2

Browse files
Update package versions and add AI tool configuration options
1 parent 2476ed5 commit 6d36fe2

File tree

4 files changed

+68
-7
lines changed

4 files changed

+68
-7
lines changed

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/create-awesome-node-app/src/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ const main = async () => {
3636
)
3737
.option("--use-yarn", "use yarn instead of npm or pnpm")
3838
.option("--use-pnpm", "use pnpm instead of yarn or npm")
39+
.option(
40+
"--ai-tool <tool>",
41+
"specify AI tool configuration (cursor, copilot, none)"
42+
)
3943
.option("--interactive", "run in interactive mode to select options", false)
4044
.option("--list-templates", "list all available templates")
4145
.option("--list-addons", "list all available addons")

packages/create-awesome-node-app/src/options.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,15 @@ const processNonInteractiveOptions = async (
101101
templatesOrExtensions.push(...additionalExtensions);
102102
}
103103

104+
// Set default for aiTool if not provided
105+
if (
106+
options.aiTool &&
107+
!["cursor", "copilot", "none"].includes(options.aiTool)
108+
) {
109+
throw new Error("Invalid --ai-tool option. Use: cursor, copilot, or none");
110+
}
111+
options.aiTool = options.aiTool || "none";
112+
104113
// Set the templatesOrExtensions in the options
105114
options.templatesOrExtensions = templatesOrExtensions;
106115

@@ -164,6 +173,29 @@ const processInteractiveOptions = async (
164173
? PACKAGE_MANAGERS.indexOf(options.packageManager)
165174
: 0,
166175
},
176+
{
177+
type: "select",
178+
name: "aiTool",
179+
message: "Which AI coding tool would you like to configure?",
180+
choices: [
181+
{
182+
title: "Cursor Rules",
183+
value: "cursor",
184+
description: "Add .cursorrules configuration for Cursor IDE",
185+
},
186+
{
187+
title: "GitHub Copilot Instructions",
188+
value: "copilot",
189+
description: "Add .github/copilot-instructions.md for GitHub Copilot",
190+
},
191+
{
192+
title: "None",
193+
value: "none",
194+
description: "Don't add any AI tool configuration",
195+
},
196+
],
197+
initial: 2, // Default to "None"
198+
},
167199
{
168200
type: "select",
169201
name: "category",
@@ -297,6 +329,7 @@ const processInteractiveOptions = async (
297329

298330
const { ...nextAppOptions } = {
299331
extend: [],
332+
aiTool: "none", // Default value
300333
...options,
301334
...baseInput,
302335
...templateInput,

packages/create-node-app-core/loaders.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,23 @@ const batchedAppendFiles = async (
149149
await Promise.all(batchedPromises);
150150
};
151151

152+
const getAiToolFilters = (aiTool: string) => {
153+
const filters = [];
154+
155+
if (aiTool !== "cursor") {
156+
filters.push("!.cursorrules", "!**/.cursorrules");
157+
}
158+
159+
if (aiTool !== "copilot") {
160+
filters.push(
161+
"!.github/copilot-instructions.md",
162+
"!**/.github/copilot-instructions.md"
163+
);
164+
}
165+
166+
return filters;
167+
};
168+
152169
const copyLoader: FileLoader =
153170
({ root, templateDir, verbose, srcDir }) =>
154171
async ({ path }) => {
@@ -335,6 +352,11 @@ export const loadFiles = async ({
335352
fs.existsSync(templateDir) &&
336353
fs.statSync(templateDir).isDirectory()
337354
) {
355+
// Get AI tool filters based on user choice
356+
const aiToolFilters = getAiToolFilters(
357+
String(customOptions.aiTool || "none")
358+
);
359+
338360
for await (const entry of readdirp(templateDir, {
339361
fileFilter: [
340362
"!package.js",
@@ -343,6 +365,8 @@ export const loadFiles = async ({
343365
"!template.json",
344366
"!yarn.lock",
345367
"!pnpm-lock.yaml",
368+
// AI tool filters - exclude files not needed
369+
...aiToolFilters,
346370
// based on the package manager we want to ignore files containing
347371
// the other package as condition.
348372
// For example, if `usePnpm` is true, the we need to ignore

0 commit comments

Comments
 (0)