Skip to content

Commit d1544ec

Browse files
committed
Move agent ignore composition to composer module
1 parent 53339a8 commit d1544ec

4 files changed

Lines changed: 64 additions & 72 deletions

File tree

src/agent/composer.ts

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,64 @@ export function composeChangeProtocol(config: ProjectConfig): string[] {
477477
return base;
478478
}
479479

480+
export function composeAgentIgnore(config: ProjectConfig): string {
481+
const lines = [
482+
"# Files and directories AI agents should avoid editing unless explicitly requested.",
483+
"# Generated by start-it.",
484+
"",
485+
"# Secrets and local environment state",
486+
".env",
487+
".env.*",
488+
"!.env.example",
489+
"",
490+
"# Dependency locks",
491+
"package-lock.json",
492+
"pnpm-lock.yaml",
493+
"yarn.lock",
494+
"poetry.lock",
495+
"Pipfile.lock",
496+
"",
497+
"# Generated dependencies and caches",
498+
"node_modules/",
499+
".next/",
500+
"dist/",
501+
"build/",
502+
"coverage/",
503+
".turbo/",
504+
".cache/",
505+
".venv/",
506+
"venv/",
507+
"__pycache__/",
508+
".pytest_cache/",
509+
"",
510+
"# IDE and OS artifacts",
511+
".idea/",
512+
".vscode/",
513+
".DS_Store",
514+
];
515+
516+
if (config.appType === "backend") {
517+
lines.push("", "# Backend runtime artifacts", "*.log");
518+
}
519+
520+
if (config.appType === "ai-ml") {
521+
lines.push(
522+
"",
523+
"# Model and experiment artifacts",
524+
"models/",
525+
"artifacts/",
526+
"mlruns/",
527+
"wandb/"
528+
);
529+
}
530+
531+
if (config.stack === "cpp-inference" || config.stack === "dsa-cpp") {
532+
lines.push("", "# Native build outputs", "*.o", "*.out", "*.exe");
533+
}
534+
535+
return `${lines.join("\n")}\n`;
536+
}
537+
480538
export function composeCursorPrinciples(config: ProjectConfig): string[] {
481539
return [
482540
`# cursorrules for ${config.framework} - ${config.options?.template || config.stack}`,

src/ai/generator.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import * as fs from "fs-extra";
66
import * as path from "path";
77
import chalk from "chalk";
88
import ora from "ora";
9-
import { buildAgentIgnore, buildLegacyAiGuidance } from "../utils/agentRules";
9+
import { composeAgentIgnore } from "../agent/composer";
10+
import { buildLegacyAiGuidance } from "../utils/agentRules";
1011

1112
export class AIProjectGenerator {
1213
private aiProvider: SmartAIProvider;
@@ -50,7 +51,7 @@ export class AIProjectGenerator {
5051
await fs.writeFile(path.join(projectDir, ".cursorrules"), guidance.cursorRules);
5152
await fs.writeFile(
5253
path.join(projectDir, ".agentignore"),
53-
buildAgentIgnore({
54+
composeAgentIgnore({
5455
appType: "backend",
5556
framework: recommendation.framework,
5657
stack: recommendation.framework === "Node.js" ? "node-ts-express" : recommendation.template,

src/generator.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import { getTemplate } from "./templates";
77
import { scaffoldFrontendProject } from "./frontend/scaffold";
88
import { scaffoldAiMlProject } from "./aiml/scaffold";
99
import { scaffoldDsaProject } from "./dsa/scaffold";
10-
import { buildAgentIgnore, buildAiGuidance } from "./utils/agentRules";
10+
import { composeAgentIgnore } from "./agent/composer";
11+
import { buildAiGuidance } from "./utils/agentRules";
1112

1213
export class ProjectGenerator {
1314
private config: ProjectConfig;
@@ -56,7 +57,7 @@ export class ProjectGenerator {
5657
// Add agentic AI guidelines for token efficiency
5758
const guidance = buildAiGuidance(this.config);
5859
await fs.writeFile(path.join(projectPath, ".cursorrules"), guidance.cursorRules);
59-
await fs.writeFile(path.join(projectPath, ".agentignore"), buildAgentIgnore(this.config));
60+
await fs.writeFile(path.join(projectPath, ".agentignore"), composeAgentIgnore(this.config));
6061

6162
// Create docs directory and write default instruction files
6263
const docsDir = path.join(projectPath, "docs");

src/utils/agentRules.ts

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -18,74 +18,6 @@ export interface AiGuidanceSet {
1818
instructions: string;
1919
}
2020

21-
export function buildAgentIgnore(config: ProjectConfig): string {
22-
const lines = [
23-
"# Files and directories AI agents should avoid editing unless explicitly requested.",
24-
"# Generated by start-it.",
25-
"",
26-
"# Secrets and local environment state",
27-
".env",
28-
".env.*",
29-
"!.env.example",
30-
"",
31-
"# Dependency locks",
32-
"package-lock.json",
33-
"pnpm-lock.yaml",
34-
"yarn.lock",
35-
"poetry.lock",
36-
"Pipfile.lock",
37-
"",
38-
"# Generated dependencies and caches",
39-
"node_modules/",
40-
".next/",
41-
"dist/",
42-
"build/",
43-
"coverage/",
44-
".turbo/",
45-
".cache/",
46-
".venv/",
47-
"venv/",
48-
"__pycache__/",
49-
".pytest_cache/",
50-
"",
51-
"# IDE and OS artifacts",
52-
".idea/",
53-
".vscode/",
54-
".DS_Store",
55-
];
56-
57-
if (config.appType === "backend") {
58-
lines.push(
59-
"",
60-
"# Backend runtime artifacts",
61-
"*.log"
62-
);
63-
}
64-
65-
if (config.appType === "ai-ml") {
66-
lines.push(
67-
"",
68-
"# Model and experiment artifacts",
69-
"models/",
70-
"artifacts/",
71-
"mlruns/",
72-
"wandb/"
73-
);
74-
}
75-
76-
if (config.stack === "cpp-inference" || config.stack === "dsa-cpp") {
77-
lines.push(
78-
"",
79-
"# Native build outputs",
80-
"*.o",
81-
"*.out",
82-
"*.exe"
83-
);
84-
}
85-
86-
return `${lines.join("\n")}\n`;
87-
}
88-
8921
export function buildAiGuidance(config: ProjectConfig): AiGuidanceSet {
9022
return {
9123
cursorRules: buildCursorRules(config),

0 commit comments

Comments
 (0)