docforagents 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -0
- package/dist/index.js +151 -42
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# docforagents
|
|
2
|
+
|
|
3
|
+
> Scaffold AI-native knowledge specifications in software repositories. Make your codebase instantly machine-readable for AI Coding Agents.
|
|
4
|
+
|
|
5
|
+
`docforagents` is a platform-agnostic developer tool designed to bridge the gap between human developers and AI Coding Agents (such as Claude, GPT-4, Cursor, Copilot, or Antigravity). By generating standard `AGENTS.md` and project architecture maps, it ensures AI agents work with 100% context alignment, obey directory-specific rules, and avoid making costly breaking changes.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## ⚡️ Quick Start
|
|
10
|
+
|
|
11
|
+
No installation required. Run it directly inside any project folder:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx docforagents init
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 🚀 Key Features
|
|
20
|
+
|
|
21
|
+
* **🔍 Auto-Detection Stack:** Automatically scans your project's languages, frameworks, infrastructure, and package files.
|
|
22
|
+
* **📂 Marker-File Heuristic:** Intelligently discovers sub-project roots (like `apps/web/package.json` in a monorepo) using marker-file heuristics.
|
|
23
|
+
* **🛠 Escape Hatch:** Explicitly target specific folders to bypass auto-detection.
|
|
24
|
+
* **📝 Zero-Pollution Policy:** Only places local rules files (`AGENTS.md`) at project or sub-project roots, avoiding directory pollution.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## 💻 CLI Commands
|
|
29
|
+
|
|
30
|
+
### 1. Initialize repository
|
|
31
|
+
Scaffold the entire knowledge layer (`knowledge/` folder) and local `AGENTS.md` sub-project rules.
|
|
32
|
+
```bash
|
|
33
|
+
npx docforagents init [path]
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
* **Options:**
|
|
37
|
+
* `-y, --yes`: Skip interactive prompts and use detected stack defaults.
|
|
38
|
+
* `-f, --force`: Overwrite existing files.
|
|
39
|
+
* `--folders <dirs>`: Comma-separated list of target folders (e.g. `src,test`) to bypass marker-file heuristics and place `AGENTS.md` rules directly inside them.
|
|
40
|
+
|
|
41
|
+
### 2. Generate a local rule file
|
|
42
|
+
Generate a single, standalone `AGENTS.md` file anywhere in your codebase using the local rules template.
|
|
43
|
+
```bash
|
|
44
|
+
npx docforagents gen [path]
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
* **Options:**
|
|
48
|
+
* `-f, --force`: Overwrite existing local rules.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## 📂 The Knowledge Specification Structure
|
|
53
|
+
|
|
54
|
+
After initialization, your project will have a structured knowledge base:
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
├── .docforagents/
|
|
58
|
+
│ └── config.json # Machine-readable project configuration
|
|
59
|
+
├── AGENTS.md # Entry point landing page for AI agents
|
|
60
|
+
├── knowledge/
|
|
61
|
+
│ ├── architecture/ # System diagrams and pattern descriptions
|
|
62
|
+
│ ├── api/ # Endpoint specifications and headers
|
|
63
|
+
│ ├── decisions/ # Architecture Decision Records (ADRs)
|
|
64
|
+
│ ├── glossary/ # Domain-specific terms
|
|
65
|
+
│ └── testing/ # Testing execution guides
|
|
66
|
+
└── apps/web/AGENTS.md # Local folder rule files (monorepos)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## ⚖️ License
|
|
72
|
+
|
|
73
|
+
[Apache-2.0](LICENSE)
|
package/dist/index.js
CHANGED
|
@@ -37,14 +37,6 @@ async function readText(filePath) {
|
|
|
37
37
|
return null;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
async function getTopLevelDirectories(targetPath, ignoredDirs = ["node_modules", ".git", "dist", "build", "target", "venv", ".venv", "__pycache__", ".docforagents", "knowledge"]) {
|
|
41
|
-
try {
|
|
42
|
-
const items = await fs.readdir(targetPath, { withFileTypes: true });
|
|
43
|
-
return items.filter((item) => item.isDirectory() && !ignoredDirs.includes(item.name)).map((item) => item.name);
|
|
44
|
-
} catch {
|
|
45
|
-
return [];
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
40
|
|
|
49
41
|
// src/core/detector.ts
|
|
50
42
|
async function detectProject(targetPath) {
|
|
@@ -150,7 +142,7 @@ async function detectProject(targetPath) {
|
|
|
150
142
|
}
|
|
151
143
|
if (pythonDeps.includes("sqlalchemy")) tools.push("SQLAlchemy ORM");
|
|
152
144
|
if (pythonDeps.includes("tortoise-orm")) tools.push("Tortoise ORM");
|
|
153
|
-
const directories = await
|
|
145
|
+
const directories = await findSubProjects(absolutePath);
|
|
154
146
|
return {
|
|
155
147
|
projectName,
|
|
156
148
|
languages: Array.from(new Set(languages)),
|
|
@@ -159,12 +151,72 @@ async function detectProject(targetPath) {
|
|
|
159
151
|
directories
|
|
160
152
|
};
|
|
161
153
|
}
|
|
154
|
+
var projectMarkers = [
|
|
155
|
+
"package.json",
|
|
156
|
+
// Node/JS/TS
|
|
157
|
+
"requirements.txt",
|
|
158
|
+
// Python
|
|
159
|
+
"pyproject.toml",
|
|
160
|
+
// Python
|
|
161
|
+
"pom.xml",
|
|
162
|
+
// Java
|
|
163
|
+
"go.mod",
|
|
164
|
+
// Go
|
|
165
|
+
"Cargo.toml",
|
|
166
|
+
// Rust
|
|
167
|
+
".git"
|
|
168
|
+
// Generic fallback
|
|
169
|
+
];
|
|
170
|
+
var blackholeDirs = [
|
|
171
|
+
"node_modules",
|
|
172
|
+
".git",
|
|
173
|
+
"dist",
|
|
174
|
+
"build",
|
|
175
|
+
"target",
|
|
176
|
+
"venv",
|
|
177
|
+
".venv",
|
|
178
|
+
"__pycache__",
|
|
179
|
+
".docforagents",
|
|
180
|
+
"knowledge"
|
|
181
|
+
];
|
|
182
|
+
async function findSubProjects(basePath, currentPath = basePath, depth = 0, maxDepth = 3) {
|
|
183
|
+
if (depth > maxDepth) {
|
|
184
|
+
return [];
|
|
185
|
+
}
|
|
186
|
+
const results = [];
|
|
187
|
+
try {
|
|
188
|
+
const items = await fs2.readdir(currentPath, { withFileTypes: true });
|
|
189
|
+
if (currentPath !== basePath) {
|
|
190
|
+
let hasMarker = false;
|
|
191
|
+
for (const item of items) {
|
|
192
|
+
if (item.isFile() && projectMarkers.includes(item.name)) {
|
|
193
|
+
hasMarker = true;
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
if (hasMarker) {
|
|
198
|
+
const relative = path.relative(basePath, currentPath).replace(/\\/g, "/");
|
|
199
|
+
results.push(relative);
|
|
200
|
+
return results;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
for (const item of items) {
|
|
204
|
+
if (item.isDirectory() && !blackholeDirs.includes(item.name) && !item.name.startsWith(".")) {
|
|
205
|
+
const subPath = path.join(currentPath, item.name);
|
|
206
|
+
const subResults = await findSubProjects(basePath, subPath, depth + 1, maxDepth);
|
|
207
|
+
results.push(...subResults);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
} catch (error) {
|
|
211
|
+
}
|
|
212
|
+
return results;
|
|
213
|
+
}
|
|
162
214
|
|
|
163
215
|
// src/core/generator.ts
|
|
164
216
|
import fs3 from "fs/promises";
|
|
165
217
|
import path2 from "path";
|
|
166
218
|
|
|
167
|
-
// src/
|
|
219
|
+
// src/templates/configJson.ts
|
|
168
220
|
function generateConfigJson(metadata) {
|
|
169
221
|
const config = {
|
|
170
222
|
$schema: "https://docforagents.org/schemas/v1/config.json",
|
|
@@ -194,6 +246,8 @@ function generateConfigJson(metadata) {
|
|
|
194
246
|
};
|
|
195
247
|
return JSON.stringify(config, null, 2);
|
|
196
248
|
}
|
|
249
|
+
|
|
250
|
+
// src/templates/rootAgents.ts
|
|
197
251
|
function generateRootAgentsMd(metadata) {
|
|
198
252
|
const languagesList = metadata.languages.map((l) => `- ${l}`).join("\n") || "- (None detected)";
|
|
199
253
|
const frameworksList = metadata.frameworks.map((f) => `- ${f}`).join("\n") || "- (None detected)";
|
|
@@ -248,6 +302,8 @@ ${directoryList}
|
|
|
248
302
|
- Always execute tests according to [Testing Guidelines](file://./knowledge/testing/overview.md) before declaring a task complete.
|
|
249
303
|
`;
|
|
250
304
|
}
|
|
305
|
+
|
|
306
|
+
// src/templates/folderAgents.ts
|
|
251
307
|
function generateFolderAgentsMd(folderName) {
|
|
252
308
|
return `# AGENTS.md \u2014 Local Directory Rules for \`${folderName}/\`
|
|
253
309
|
|
|
@@ -271,6 +327,8 @@ function generateFolderAgentsMd(folderName) {
|
|
|
271
327
|
4. **Security**: *e.g., Ensure JWT middleware is applied to all new route configurations.*
|
|
272
328
|
`;
|
|
273
329
|
}
|
|
330
|
+
|
|
331
|
+
// src/templates/architectureOverview.ts
|
|
274
332
|
function generateArchitectureOverviewMd(projectName) {
|
|
275
333
|
return `# Architecture Overview \u2014 ${projectName}
|
|
276
334
|
|
|
@@ -298,6 +356,8 @@ graph TD
|
|
|
298
356
|
2. **Background Processes**: *Describe queues, cron jobs, event-driven pipelines if applicable.*
|
|
299
357
|
`;
|
|
300
358
|
}
|
|
359
|
+
|
|
360
|
+
// src/templates/apiOverview.ts
|
|
301
361
|
function generateApiOverviewMd(projectName) {
|
|
302
362
|
return `# API Reference \u2014 ${projectName}
|
|
303
363
|
|
|
@@ -344,6 +404,8 @@ Authorization: Bearer <token>
|
|
|
344
404
|
\`\`\`
|
|
345
405
|
`;
|
|
346
406
|
}
|
|
407
|
+
|
|
408
|
+
// src/templates/decisionsReadme.ts
|
|
347
409
|
function generateDecisionsReadmeMd(projectName) {
|
|
348
410
|
return `# Architectural Decision Records (ADR)
|
|
349
411
|
|
|
@@ -361,6 +423,8 @@ An Architectural Decision Record (ADR) is a document that captures an important
|
|
|
361
423
|
*To create a new ADR, copy the template format and name it sequentially (e.g. \`002-use-redis-caching.md\`).*
|
|
362
424
|
`;
|
|
363
425
|
}
|
|
426
|
+
|
|
427
|
+
// src/templates/glossary.ts
|
|
364
428
|
function generateGlossaryMd() {
|
|
365
429
|
return `# Domain Glossary
|
|
366
430
|
|
|
@@ -373,6 +437,8 @@ Define the core business terms and domain models used in this repository. This r
|
|
|
373
437
|
| **Knowledge Layer** | The directory containing machine-readable code specification and guidelines. | Standard repo structure |
|
|
374
438
|
`;
|
|
375
439
|
}
|
|
440
|
+
|
|
441
|
+
// src/templates/testingOverview.ts
|
|
376
442
|
function generateTestingOverviewMd(metadata) {
|
|
377
443
|
return `# Testing Guidelines
|
|
378
444
|
|
|
@@ -574,40 +640,47 @@ async function handleInit(targetDir = ".", options = {}) {
|
|
|
574
640
|
console.log(` Directories: ${chalk2.blue(metadata.directories.join(", ") || "None detected")}
|
|
575
641
|
`);
|
|
576
642
|
let projectName = metadata.projectName;
|
|
577
|
-
let selectedFolders
|
|
643
|
+
let selectedFolders;
|
|
578
644
|
let proceed = true;
|
|
579
|
-
if (
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
645
|
+
if (options.folders) {
|
|
646
|
+
selectedFolders = options.folders.split(",").map((f) => f.trim()).filter(Boolean);
|
|
647
|
+
console.log(chalk2.gray(`Using custom subdirectories: ${selectedFolders.join(", ")}
|
|
648
|
+
`));
|
|
649
|
+
} else {
|
|
650
|
+
selectedFolders = metadata.directories.filter((dir) => !dir.startsWith("."));
|
|
651
|
+
if (!options.yes) {
|
|
652
|
+
const nameResponse = await prompts2(
|
|
653
|
+
{
|
|
654
|
+
type: "text",
|
|
655
|
+
name: "projectName",
|
|
656
|
+
message: "Customize project name:",
|
|
657
|
+
initial: projectName
|
|
658
|
+
},
|
|
659
|
+
{
|
|
660
|
+
onCancel: () => {
|
|
661
|
+
console.log(chalk2.yellow("\nInitialization cancelled."));
|
|
662
|
+
process.exit(0);
|
|
663
|
+
}
|
|
591
664
|
}
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
665
|
+
);
|
|
666
|
+
projectName = nameResponse.projectName ?? projectName;
|
|
667
|
+
selectedFolders = await configureFolderAgentsCreation(projectName, metadata.directories);
|
|
668
|
+
const proceedResponse = await prompts2(
|
|
669
|
+
{
|
|
670
|
+
type: "confirm",
|
|
671
|
+
name: "proceed",
|
|
672
|
+
message: "Proceed to write standard knowledge layer?",
|
|
673
|
+
initial: true
|
|
674
|
+
},
|
|
675
|
+
{
|
|
676
|
+
onCancel: () => {
|
|
677
|
+
console.log(chalk2.yellow("\nInitialization cancelled."));
|
|
678
|
+
process.exit(0);
|
|
679
|
+
}
|
|
607
680
|
}
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
681
|
+
);
|
|
682
|
+
proceed = proceedResponse.proceed ?? proceed;
|
|
683
|
+
}
|
|
611
684
|
}
|
|
612
685
|
if (!proceed) {
|
|
613
686
|
console.log(chalk2.yellow("\nInitialization aborted."));
|
|
@@ -638,11 +711,47 @@ Skipped ${result.filesSkipped.length} existing files (use --force or -f to overw
|
|
|
638
711
|
}
|
|
639
712
|
}
|
|
640
713
|
|
|
714
|
+
// src/commands/generate.ts
|
|
715
|
+
import path4 from "path";
|
|
716
|
+
import fs4 from "fs/promises";
|
|
717
|
+
import chalk3 from "chalk";
|
|
718
|
+
async function handleGenerate(targetDir = ".", options = {}) {
|
|
719
|
+
const resolvedPath = path4.resolve(targetDir);
|
|
720
|
+
let writePath = resolvedPath;
|
|
721
|
+
if (!resolvedPath.endsWith("AGENTS.md")) {
|
|
722
|
+
writePath = path4.join(resolvedPath, "AGENTS.md");
|
|
723
|
+
}
|
|
724
|
+
const folderPath = path4.dirname(writePath);
|
|
725
|
+
const folderName = path4.basename(folderPath);
|
|
726
|
+
const fileExists = await exists(writePath);
|
|
727
|
+
if (fileExists && !options.force) {
|
|
728
|
+
console.error(chalk3.red(`
|
|
729
|
+
Error: AGENTS.md already exists at ${writePath}`));
|
|
730
|
+
console.error(chalk3.yellow("Use -f or --force to overwrite it.\n"));
|
|
731
|
+
process.exit(1);
|
|
732
|
+
}
|
|
733
|
+
try {
|
|
734
|
+
await fs4.mkdir(folderPath, { recursive: true });
|
|
735
|
+
const content = generateFolderAgentsMd(folderName);
|
|
736
|
+
await fs4.writeFile(writePath, content, "utf-8");
|
|
737
|
+
const relativePath = path4.relative(process.cwd(), writePath);
|
|
738
|
+
console.log(chalk3.bold.green(`
|
|
739
|
+
\u2713 Successfully generated ${relativePath}
|
|
740
|
+
`));
|
|
741
|
+
} catch (error) {
|
|
742
|
+
console.error(chalk3.red("\nError generating AGENTS.md file:"), error);
|
|
743
|
+
process.exit(1);
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
|
|
641
747
|
// src/index.ts
|
|
642
748
|
var program = new Command();
|
|
643
749
|
program.name("docforagents").description("Open-source AI-native knowledge specification and tooling for software repositories").version("0.1.0");
|
|
644
|
-
program.command("init").description("Scaffold the AI-native knowledge specification in a repository").argument("[path]", "Path to the project directory", ".").option("-y, --yes", "Skip interactive prompts and use detected defaults").option("-f, --force", "Overwrite existing knowledge specification files if they exist").action(async (targetDir, options) => {
|
|
750
|
+
program.command("init").description("Scaffold the AI-native knowledge specification in a repository").argument("[path]", "Path to the project directory", ".").option("-y, --yes", "Skip interactive prompts and use detected defaults").option("-f, --force", "Overwrite existing knowledge specification files if they exist").option("--folders <folders>", "Comma-separated list of custom subdirectories to create AGENTS.md in (bypasses auto-detection)").action(async (targetDir, options) => {
|
|
645
751
|
await handleInit(targetDir, options);
|
|
646
752
|
});
|
|
753
|
+
program.command("generate").alias("gen").description("Generate a local AGENTS.md template in a directory").argument("[path]", "Path to the directory or AGENTS.md file", ".").option("-f, --force", "Overwrite existing AGENTS.md file if it exists").action(async (targetDir, options) => {
|
|
754
|
+
await handleGenerate(targetDir, options);
|
|
755
|
+
});
|
|
647
756
|
program.parse(process.argv);
|
|
648
757
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/commands/init.ts","../src/core/detector.ts","../src/utils/files.ts","../src/core/generator.ts","../src/core/templates.ts","../src/utils/prompts.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { handleInit } from \"./commands/init\";\n// import { handleAnalyze } from \"./commands/analyze\";\n\nconst program = new Command();\n\nprogram\n .name(\"docforagents\")\n .description(\"Open-source AI-native knowledge specification and tooling for software repositories\")\n .version(\"0.1.0\");\n\nprogram\n .command(\"init\")\n .description(\"Scaffold the AI-native knowledge specification in a repository\")\n .argument(\"[path]\", \"Path to the project directory\", \".\")\n .option(\"-y, --yes\", \"Skip interactive prompts and use detected defaults\")\n .option(\"-f, --force\", \"Overwrite existing knowledge specification files if they exist\")\n .action(async (targetDir, options) => {\n await handleInit(targetDir, options);\n });\n\n// program\n// .command(\"analyze\")\n// .description(\"Scan the repository codebase and generate AI documentation files\")\n// .argument(\"[path]\", \"Path to the project directory\", \".\")\n// .option(\"-y, --yes\", \"Skip interactive prompts and generate for all recommended folders\")\n// .option(\"--skip-folders\", \"Skip generating folder-level AGENTS.md rule files\")\n// .action(async (targetDir, options) => {\n// await handleAnalyze(targetDir, options);\n// });\n\nprogram.parse(process.argv);\n","import path from \"path\";\nimport chalk from \"chalk\";\nimport prompts from \"prompts\";\nimport { detectProject } from \"../core/detector\";\nimport { generateKnowledgeBase } from \"../core/generator\";\nimport { configureFolderAgentsCreation } from \"../utils/prompts\";\n\nexport interface InitOptions {\n yes?: boolean;\n force?: boolean;\n}\n\n/**\n * Handle the 'init' command.\n */\nexport async function handleInit(targetDir: string = \".\", options: InitOptions = {}): Promise<void> {\n const resolvedPath = path.resolve(targetDir);\n \n console.log(chalk.bold.cyan(\"\\n🔍 Scanning repository for docforagents initialization...\"));\n console.log(chalk.gray(`Path: ${resolvedPath}\\n`));\n\n // 1. Detect project details\n let metadata;\n try {\n metadata = await detectProject(resolvedPath);\n } catch (error) {\n console.error(chalk.red(\"Error scanning project:\"), error);\n process.exit(1);\n }\n\n // Log detected items\n console.log(chalk.bold(\"Detected stack:\"));\n console.log(` Project Name: ${chalk.green(metadata.projectName)}`);\n console.log(` Languages: ${chalk.blue(metadata.languages.join(\", \") || \"None detected\")}`);\n console.log(` Frameworks: ${chalk.blue(metadata.frameworks.join(\", \") || \"None detected\")}`);\n console.log(` Tools/Infra: ${chalk.blue(metadata.tools.join(\", \") || \"None detected\")}`);\n console.log(` Directories: ${chalk.blue(metadata.directories.join(\", \") || \"None detected\")}\\n`);\n\n let projectName = metadata.projectName;\n let selectedFolders: string[] = metadata.directories.filter(dir => !dir.startsWith(\".\"));\n let proceed = true;\n\n // 2. Interactive Prompts (unless --yes flag is passed)\n if (!options.yes) {\n const nameResponse = await prompts(\n {\n type: \"text\",\n name: \"projectName\",\n message: \"Customize project name:\",\n initial: projectName,\n },\n {\n onCancel: () => {\n console.log(chalk.yellow(\"\\nInitialization cancelled.\"));\n process.exit(0);\n }\n }\n );\n\n projectName = nameResponse.projectName ?? projectName;\n\n // Use interactive folder config helper\n selectedFolders = await configureFolderAgentsCreation(projectName, metadata.directories);\n\n const proceedResponse = await prompts(\n {\n type: \"confirm\",\n name: \"proceed\",\n message: \"Proceed to write standard knowledge layer?\",\n initial: true,\n },\n {\n onCancel: () => {\n console.log(chalk.yellow(\"\\nInitialization cancelled.\"));\n process.exit(0);\n }\n }\n );\n\n proceed = proceedResponse.proceed ?? proceed;\n }\n\n if (!proceed) {\n console.log(chalk.yellow(\"\\nInitialization aborted.\"));\n return;\n }\n\n // Update metadata with customized project name\n metadata.projectName = projectName;\n\n // 3. Generate files\n console.log(chalk.cyan(\"\\n✍️ Writing knowledge base...\"));\n \n try {\n const result = await generateKnowledgeBase(resolvedPath, metadata, {\n forceOverwrite: options.force,\n folderAgents: selectedFolders,\n });\n\n // 4. Summarize results\n if (result.filesCreated.length > 0) {\n console.log(chalk.bold.green(`\\nSuccessfully created ${result.filesCreated.length} files:`));\n result.filesCreated.forEach(f => console.log(` ${chalk.green(\"✓\")} ${f}`));\n }\n\n if (result.filesSkipped.length > 0) {\n console.log(chalk.bold.yellow(`\\nSkipped ${result.filesSkipped.length} existing files (use --force or -f to overwrite):`));\n result.filesSkipped.forEach(f => console.log(` ${chalk.yellow(\"-\")} ${f}`));\n }\n\n console.log(chalk.bold.cyan(\"\\n🎉 Knowledge Layer Scaffolded successfully!\"));\n console.log(\"Your repository is now machine-readable for AI agents. Open root \" + chalk.bold.green(\"AGENTS.md\") + \" to get started.\\n\");\n\n } catch (error) {\n console.error(chalk.red(\"\\nError generating files:\"), error);\n process.exit(1);\n }\n}\n","import path from \"path\";\nimport fs from \"fs/promises\";\nimport { exists, readJson, readText, getTopLevelDirectories } from \"../utils/files\";\n\nexport interface ProjectMetadata {\n projectName: string;\n languages: string[];\n frameworks: string[];\n tools: string[];\n directories: string[];\n}\n\n/**\n * Scan a repository path to detect project configurations.\n */\nexport async function detectProject(targetPath: string): Promise<ProjectMetadata> {\n const absolutePath = path.resolve(targetPath);\n \n // 1. Resolve Project Name\n let projectName = path.basename(absolutePath);\n const packageJson = await readJson(path.join(absolutePath, \"package.json\"));\n if (packageJson && packageJson.name) {\n projectName = packageJson.name;\n } else {\n // Try to get Cargo.toml project name\n const cargoToml = await readText(path.join(absolutePath, \"Cargo.toml\"));\n if (cargoToml) {\n const match = cargoToml.match(/name\\s*=\\s*\"([^\"]+)\"/);\n if (match && match[1]) {\n projectName = match[1];\n }\n }\n }\n\n // 2. Detect Languages\n const languages: string[] = [];\n \n if (await exists(path.join(absolutePath, \"package.json\"))) {\n // Determine if it is TS or JS\n const tsconfigExists = await exists(path.join(absolutePath, \"tsconfig.json\"));\n if (tsconfigExists) {\n languages.push(\"TypeScript\", \"JavaScript\");\n } else {\n languages.push(\"JavaScript\");\n }\n }\n \n if (\n (await exists(path.join(absolutePath, \"requirements.txt\"))) ||\n (await exists(path.join(absolutePath, \"pyproject.toml\"))) ||\n (await exists(path.join(absolutePath, \"Pipfile\"))) ||\n (await exists(path.join(absolutePath, \"setup.py\")))\n ) {\n languages.push(\"Python\");\n }\n\n if (await exists(path.join(absolutePath, \"go.mod\"))) {\n languages.push(\"Go\");\n }\n\n if (await exists(path.join(absolutePath, \"Cargo.toml\"))) {\n languages.push(\"Rust\");\n }\n\n if (\n (await exists(path.join(absolutePath, \"pom.xml\"))) ||\n (await exists(path.join(absolutePath, \"build.gradle\")))\n ) {\n languages.push(\"Java\");\n }\n\n // Scan root for csproj files\n try {\n const files = await fs.readdir(absolutePath);\n if (files.some(f => f.endsWith(\".csproj\") || f.endsWith(\".sln\"))) {\n languages.push(\"C#\");\n }\n } catch {\n // Ignore read errors\n }\n\n // 3. Detect Frameworks\n const frameworks: string[] = [];\n \n // JS/TS dependencies scan\n if (packageJson) {\n const deps = {\n ...(packageJson.dependencies || {}),\n ...(packageJson.devDependencies || {}),\n };\n \n if (deps[\"next\"]) frameworks.push(\"Next.js\");\n else if (deps[\"react-native\"]) frameworks.push(\"React Native\");\n else if (deps[\"react\"]) frameworks.push(\"React\");\n \n if (deps[\"nuxt\"]) frameworks.push(\"Nuxt\");\n else if (deps[\"vue\"]) frameworks.push(\"Vue\");\n \n if (deps[\"@angular/core\"]) frameworks.push(\"Angular\");\n if (deps[\"svelte\"] || deps[\"@sveltejs/kit\"]) frameworks.push(\"Svelte\");\n \n if (deps[\"express\"]) frameworks.push(\"Express\");\n if (deps[\"@nestjs/core\"]) frameworks.push(\"NestJS\");\n if (deps[\"koa\"]) frameworks.push(\"Koa\");\n if (deps[\"fastify\"]) frameworks.push(\"Fastify\");\n if (deps[\"tailwindcss\"]) frameworks.push(\"Tailwind CSS\");\n }\n\n // Python dependencies scan\n const pyprojectToml = await readText(path.join(absolutePath, \"pyproject.toml\"));\n const reqsTxt = await readText(path.join(absolutePath, \"requirements.txt\"));\n const pythonDeps = `${pyprojectToml || \"\"} ${reqsTxt || \"\"}`;\n \n if (pythonDeps.includes(\"fastapi\")) frameworks.push(\"FastAPI\");\n if (pythonDeps.includes(\"django\")) frameworks.push(\"Django\");\n if (pythonDeps.includes(\"flask\")) frameworks.push(\"Flask\");\n if (pythonDeps.includes(\"streamlit\")) frameworks.push(\"Streamlit\");\n\n // Go dependencies scan\n const goMod = await readText(path.join(absolutePath, \"go.mod\"));\n if (goMod) {\n if (goMod.includes(\"github.com/gin-gonic/gin\")) frameworks.push(\"Gin\");\n if (goMod.includes(\"github.com/labstack/echo\")) frameworks.push(\"Echo\");\n if (goMod.includes(\"github.com/gofiber/fiber\")) frameworks.push(\"Fiber\");\n }\n\n // Rust dependencies scan\n const cargoTomlStr = await readText(path.join(absolutePath, \"Cargo.toml\"));\n if (cargoTomlStr) {\n if (cargoTomlStr.includes(\"tokio\")) frameworks.push(\"Tokio\");\n if (cargoTomlStr.includes(\"actix-web\")) frameworks.push(\"Actix-Web\");\n if (cargoTomlStr.includes(\"axum\")) frameworks.push(\"Axum\");\n if (cargoTomlStr.includes(\"rocket\")) frameworks.push(\"Rocket\");\n }\n\n // 4. Detect Tools & Infrastructure\n const tools: string[] = [];\n \n if (await exists(path.join(absolutePath, \"Dockerfile\")) || await exists(path.join(absolutePath, \"docker-compose.yml\"))) {\n tools.push(\"Docker\");\n }\n if (await exists(path.join(absolutePath, \".github/workflows\"))) {\n tools.push(\"GitHub Actions\");\n }\n if (await exists(path.join(absolutePath, \".gitlab-ci.yml\"))) {\n tools.push(\"GitLab CI\");\n }\n\n // Check common ORMs or DB libraries\n if (packageJson) {\n const deps = { ...(packageJson.dependencies || {}), ...(packageJson.devDependencies || {}) };\n if (deps[\"prisma\"]) tools.push(\"Prisma ORM\");\n if (deps[\"mongoose\"]) tools.push(\"Mongoose (MongoDB)\");\n if (deps[\"sequelize\"]) tools.push(\"Sequelize\");\n if (deps[\"typeorm\"]) tools.push(\"TypeORM\");\n if (deps[\"pg\"]) tools.push(\"PostgreSQL Client\");\n if (deps[\"sqlite3\"]) tools.push(\"SQLite3 Client\");\n }\n if (pythonDeps.includes(\"sqlalchemy\")) tools.push(\"SQLAlchemy ORM\");\n if (pythonDeps.includes(\"tortoise-orm\")) tools.push(\"Tortoise ORM\");\n\n // 5. Scan directories for local AGENTS.md candidates\n const directories = await getTopLevelDirectories(absolutePath);\n\n return {\n projectName,\n languages: Array.from(new Set(languages)),\n frameworks: Array.from(new Set(frameworks)),\n tools: Array.from(new Set(tools)),\n directories,\n };\n}\n","import fs from \"fs/promises\";\nimport path from \"path\";\n\n/**\n * Check if a file or directory exists at the given path.\n */\nexport async function exists(targetPath: string): Promise<boolean> {\n try {\n await fs.access(targetPath);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Read and parse JSON file safely. Returns null if error or file doesn't exist.\n */\nexport async function readJson<T = any>(filePath: string): Promise<T | null> {\n try {\n const content = await fs.readFile(filePath, \"utf-8\");\n return JSON.parse(content) as T;\n } catch {\n return null;\n }\n}\n\n/**\n * Read text file safely. Returns null if error or file doesn't exist.\n */\nexport async function readText(filePath: string): Promise<string | null> {\n try {\n return await fs.readFile(filePath, \"utf-8\");\n } catch {\n return null;\n }\n}\n\n/**\n * Get all top-level directories in targetPath, excluding common ignore paths.\n */\nexport async function getTopLevelDirectories(\n targetPath: string,\n ignoredDirs: string[] = [\"node_modules\", \".git\", \"dist\", \"build\", \"target\", \"venv\", \".venv\", \"__pycache__\", \".docforagents\", \"knowledge\"]\n): Promise<string[]> {\n try {\n const items = await fs.readdir(targetPath, { withFileTypes: true });\n return items\n .filter((item) => item.isDirectory() && !ignoredDirs.includes(item.name))\n .map((item) => item.name);\n } catch {\n return [];\n }\n}\n","import fs from \"fs/promises\";\nimport path from \"path\";\nimport { ProjectMetadata } from \"./detector\";\nimport { exists } from \"../utils/files\";\nimport {\n generateConfigJson,\n generateRootAgentsMd,\n generateFolderAgentsMd,\n generateArchitectureOverviewMd,\n generateApiOverviewMd,\n generateDecisionsReadmeMd,\n generateGlossaryMd,\n generateTestingOverviewMd,\n} from \"./templates\";\n\nexport interface GenerationResult {\n filesCreated: string[];\n filesSkipped: string[];\n}\n\n/**\n * Generate the standard docforagents layout in the target project path.\n */\nexport async function generateKnowledgeBase(\n targetPath: string,\n metadata: ProjectMetadata,\n options: { forceOverwrite?: boolean; skipFolderAgents?: boolean; folderAgents?: string[] } = {}\n): Promise<GenerationResult> {\n const absolutePath = path.resolve(targetPath);\n const filesCreated: string[] = [];\n const filesSkipped: string[] = [];\n\n // Helper to safely write a file and track results\n const writeFileSafely = async (filePath: string, content: string) => {\n const relativePath = path.relative(absolutePath, filePath);\n const fileExists = await exists(filePath);\n \n if (fileExists && !options.forceOverwrite) {\n filesSkipped.push(relativePath);\n return;\n }\n\n // Ensure parent directory exists\n await fs.mkdir(path.dirname(filePath), { recursive: true });\n await fs.writeFile(filePath, content, \"utf-8\");\n filesCreated.push(relativePath);\n };\n\n // 1. Create root configurations & entry points\n const configPath = path.join(absolutePath, \".docforagents\", \"config.json\");\n await writeFileSafely(configPath, generateConfigJson(metadata));\n\n const rootAgentsPath = path.join(absolutePath, \"AGENTS.md\");\n await writeFileSafely(rootAgentsPath, generateRootAgentsMd(metadata));\n\n // 2. Create knowledge base directory files\n const knowledgeDir = path.join(absolutePath, \"knowledge\");\n \n await writeFileSafely(\n path.join(knowledgeDir, \"architecture\", \"overview.md\"),\n generateArchitectureOverviewMd(metadata.projectName)\n );\n\n await writeFileSafely(\n path.join(knowledgeDir, \"api\", \"overview.md\"),\n generateApiOverviewMd(metadata.projectName)\n );\n\n await writeFileSafely(\n path.join(knowledgeDir, \"decisions\", \"README.md\"),\n generateDecisionsReadmeMd(metadata.projectName)\n );\n\n await writeFileSafely(\n path.join(knowledgeDir, \"glossary\", \"terms.md\"),\n generateGlossaryMd()\n );\n\n await writeFileSafely(\n path.join(knowledgeDir, \"testing\", \"overview.md\"),\n generateTestingOverviewMd(metadata)\n );\n\n // 3. Create folder-level AGENTS.md files\n const foldersToGenerate = options.folderAgents !== undefined\n ? options.folderAgents\n : (options.skipFolderAgents ? [] : metadata.directories);\n\n for (const dir of foldersToGenerate) {\n if (dir.startsWith(\".\")) {\n continue;\n }\n const folderAgentsPath = path.join(absolutePath, dir, \"AGENTS.md\");\n await writeFileSafely(folderAgentsPath, generateFolderAgentsMd(dir));\n }\n\n return {\n filesCreated,\n filesSkipped,\n };\n}\n","import { ProjectMetadata } from \"./detector\";\n\n/**\n * Generate config.json content based on metadata.\n */\nexport function generateConfigJson(metadata: ProjectMetadata): string {\n const config = {\n $schema: \"https://docforagents.org/schemas/v1/config.json\",\n version: \"1.0.0\",\n project: {\n name: metadata.projectName,\n languages: metadata.languages,\n frameworks: metadata.frameworks,\n tools: metadata.tools,\n },\n knowledgeDir: \"knowledge\",\n exclude: [\n \"node_modules\",\n \".git\",\n \"dist\",\n \"build\",\n \"target\",\n \"venv\",\n \".venv\",\n \"__pycache__\",\n \".docforagents/cache\"\n ],\n rules: {\n requireAdrForMajorChanges: false,\n requireAgentsUpdateOnApiChange: true\n }\n };\n return JSON.stringify(config, null, 2);\n}\n\n/**\n * Generate root AGENTS.md template.\n */\nexport function generateRootAgentsMd(metadata: ProjectMetadata): string {\n const languagesList = metadata.languages.map(l => `- ${l}`).join(\"\\n\") || \"- (None detected)\";\n const frameworksList = metadata.frameworks.map(f => `- ${f}`).join(\"\\n\") || \"- (None detected)\";\n const toolsList = metadata.tools.map(t => `- ${t}`).join(\"\\n\") || \"- (None detected)\";\n \n const directoryList = metadata.directories\n .map(dir => `- [${dir}/](file://./${dir}/) — *Add responsibilities of this directory* (see [${dir}/AGENTS.md](file://./${dir}/AGENTS.md) for local rules)`)\n .join(\"\\n\") || \"- (No directories detected)\";\n\n return `# AGENTS.md — AI Agent Context Entry Point\n\n> [!NOTE]\n> **To AI Coding Agents:** This file serves as your primary landing page for understanding the architecture, rules, and entry points of the **${metadata.projectName}** project. Before executing tasks or modifications, review this page and follow the links to specific files.\n\n## Project Overview\n*Briefly describe what this project does, its goals, and its business context.*\n\n## Core Stack & Environment\n### Languages\n${languagesList}\n\n### Frameworks & Libraries\n${frameworksList}\n\n### Infrastructure & Tools\n${toolsList}\n\n---\n\n## Repository Map\n\n### Core Knowledge Base\nAll architectural and domain-specific knowledge resides in the \\`knowledge/\\` directory:\n- [Architecture Overview](file://./knowledge/architecture/overview.md) — System components, data flow, design patterns.\n- [API Documentation](file://./knowledge/api/overview.md) — Endpoints, schemas, payloads.\n- [Architecture Decisions (ADRs)](file://./knowledge/decisions/README.md) — Why the project was built this way.\n- [Glossary of Terms](file://./knowledge/glossary/terms.md) — Domain vocabulary and definitions.\n- [Testing Guidelines](file://./knowledge/testing/overview.md) — Test setup, commands, and strategies.\n\n### Directory Structure\n${directoryList}\n\n---\n\n## Agent Guidelines & Conventions\n\n### 1. Read Before Write\n- Check the relevant local \\`AGENTS.md\\` inside directories you are editing.\n- Look at the [Architecture Decisions](file://./knowledge/decisions/README.md) to understand existing patterns (e.g. repository pattern, clean architecture).\n\n### 2. Standardized Changes\n- **API changes** MUST update [API Overview](file://./knowledge/api/overview.md) and local \\`AGENTS.md\\` interfaces.\n- **Architectural changes** require an Architecture Decision Record (ADR) under [Decisions](file://./knowledge/decisions/README.md).\n\n### 3. Verification\n- Always execute tests according to [Testing Guidelines](file://./knowledge/testing/overview.md) before declaring a task complete.\n`;\n}\n\n/**\n * Generate folder-level AGENTS.md template.\n */\nexport function generateFolderAgentsMd(folderName: string): string {\n return `# AGENTS.md — Local Directory Rules for \\`${folderName}/\\`\n\n> [!NOTE]\n> **To AI Coding Agents:** This file defines the responsibilities, entry points, and coding conventions specific to the \\`${folderName}/\\` directory. Adhere strictly to these guidelines when making modifications here.\n\n## Purpose & Responsibility\n*Describe the single responsibility of this directory (e.g. \\\"Handles authentication endpoints and JWT verification\\\").*\n\n## Core Entry Points\n- [\\`index.ts\\` or entry file](file://./index.ts) — *Describe what imports/exports this file exposes.*\n\n## Internal Dependencies & Imports\n- **Imports from other modules:** *Specify which parent modules this directory is allowed to import from.*\n- **Outward dependencies:** *What external npm/pip packages or databases does this folder communicate with?*\n\n## Conventions & Implementation Rules\n1. **Design Patterns**: *e.g., Use controllers for route handling, delegate business logic to services.*\n2. **Naming Conventions**: *e.g., Suffix all services with \\`Service\\` (e.g., \\`AuthService\\`).*\n3. **Error Handling**: *e.g., Do not throw raw errors; wrap in \\`AppError\\` with status codes.*\n4. **Security**: *e.g., Ensure JWT middleware is applied to all new route configurations.*\n`;\n}\n\n/**\n * Template for knowledge/architecture/overview.md\n */\nexport function generateArchitectureOverviewMd(projectName: string): string {\n return `# Architecture Overview — ${projectName}\n\n## System Overview\n*Provide a high-level description of how this system is put together. Mention if it is a monolith, microservices, SPA, Serverless, etc.*\n\n## Core Components\n*List the primary components/modules of the application and their relationships.*\n\n\\`\\`\\`mermaid\ngraph TD\n Client[Client / Frontend] --> API[API Gateway / Backend]\n API --> DB[(Database)]\n API --> Cache[(Cache / Redis)]\n\\`\\`\\`\n\n## Core Design Patterns\n*Outline the engineering patterns used in this codebase (e.g., Clean Architecture, MVC, CQRS, Repository Pattern, Dependency Injection).*\n\n- **Pattern A**: *Description of how it is applied.*\n- **Pattern B**: *Description of how it is applied.*\n\n## Data Flows\n1. **Request Flow**: *Trace a typical request from the frontend to database and back.*\n2. **Background Processes**: *Describe queues, cron jobs, event-driven pipelines if applicable.*\n`;\n}\n\n/**\n * Template for knowledge/api/overview.md\n */\nexport function generateApiOverviewMd(projectName: string): string {\n return `# API Reference — ${projectName}\n\n## Authentication & Authorization\n*Describe how clients authenticate to the APIs (e.g. Bearer tokens, cookies, API keys).*\n\n\\`\\`\\`http\nAuthorization: Bearer <token>\n\\`\\`\\`\n\n## Base URLs\n- Development: \\`http://localhost:3000/api\\`\n- Staging: \\`https://staging.api.example.com/v1\\`\n- Production: \\`https://api.example.com/v1\\`\n\n## Main Endpoints\n\n### 1. Health check\n- **Method / Path**: \\`GET /health\\`\n- **Description**: Returns the system status.\n- **Response**:\n \\`\\`\\`json\n {\n \"status\": \"healthy\",\n \"timestamp\": \"2026-07-27T18:00:00Z\"\n }\n \\`\\`\\`\n\n### 2. [Endpoint Name]\n- **Method / Path**: \\`POST /resource\\`\n- **Headers**: \\`Content-Type: application/json\\`\n- **Request Body**:\n \\`\\`\\`json\n {\n \"name\": \"example\"\n }\n \\`\\`\\`\n- **Response (201 Created)**:\n \\`\\`\\`json\n {\n \"id\": \"uuid-1234\",\n \"name\": \"example\"\n }\n \\`\\`\\`\n`;\n}\n\n/**\n * Template for knowledge/decisions/README.md\n */\nexport function generateDecisionsReadmeMd(projectName: string): string {\n return `# Architectural Decision Records (ADR)\n\nThis folder contains the history of major design and architectural choices made in the **${projectName}** repository.\n\n## What is an ADR?\nAn Architectural Decision Record (ADR) is a document that captures an important architectural decision, including the context in which the decision was made, the consequences of the decision, and its current status (Proposed, Accepted, Superceded).\n\n## ADR Index\n\n| ADR # | Title | Status | Date |\n|-------|-------|--------|------|\n| [ADR-001](file://./001-initial-architecture.md) | Initial Architecture Scaffolding | Accepted | 2026-07-27 |\n\n*To create a new ADR, copy the template format and name it sequentially (e.g. \\`002-use-redis-caching.md\\`).*\n`;\n}\n\n/**\n * Template for knowledge/glossary/terms.md\n */\nexport function generateGlossaryMd(): string {\n return `# Domain Glossary\n\nDefine the core business terms and domain models used in this repository. This reduces ambiguity for AI agents and onboarding engineers.\n\n| Term | Definition | Context / Usage |\n|------|------------|-----------------|\n| **ADR** | Architecture Decision Record. | Engineering workflow documentation |\n| **Agent** | An autonomous AI agent performing operations on code. | AI Coding context |\n| **Knowledge Layer** | The directory containing machine-readable code specification and guidelines. | Standard repo structure |\n`;\n}\n\n/**\n * Template for knowledge/testing/overview.md\n */\nexport function generateTestingOverviewMd(metadata: ProjectMetadata): string {\n return `# Testing Guidelines\n\n## Running Tests\n*Provide the exact commands required to execute the test suite.*\n\n\\`\\`\\`bash\n# Run unit tests\nnpm run test\n# Run integration / e2e tests\nnpm run test:e2e\n\\`\\`\\`\n\n## Testing Philosophy\n- **Unit Tests**: Describe where unit tests are placed (e.g., next to the file as \\`*.test.ts\\` or in a \\`test/\\` directory).\n- **Integration Tests**: Describe how to test integrations with mock services/databases.\n- **Coverage**: Target code coverage expectations.\n\n## Creating New Tests\n- Use the standard test framework configurations.\n- Mock external network calls using MSW, nock, or custom mock suites.\n`;\n}\n\n/**\n * Generate the prompt for folder-specific AGENTS.md generation.\n */\nexport function generateFolderAgentsPrompt(\n folderName: string,\n tree: string,\n filesContext: string\n): string {\n return `You are tasked with generating the customized folder-level AGENTS.md for the directory \\`${folderName}/\\`.\nBelow is the directory tree for this subdirectory:\n\\`\\`\\`\n${tree}\n\\`\\`\\`\n\nHere is the content of key files inside this directory:\n${filesContext}\n\nAnalyze the files to generate a highly detailed rules document for AI coding agents modifying this directory.\nInclude:\n1. **Purpose & Responsibility**: Describe the single responsibility of this directory (e.g. \"Handles authentication endpoints and JWT verification\").\n2. **Core Entry Points**: List the primary entry files and export signatures that other directories or external clients interact with.\n3. **Internal Dependencies & Imports**: Detail which other directories this folder imports from, and any critical packages it depends on.\n4. **Conventions & Implementation Rules**: Extract local conventions, design patterns (e.g., repository patterns, controller structures), naming schemes, and error/security constraints specific to this directory.\n\nFormat your output exactly as standard Markdown, using standard alert boxes (> [!NOTE]) for emphasis. Start directly with \\`# AGENTS.md — Local Directory Rules for \\`${folderName}/\\` \\`.`;\n}\n","import chalk from \"chalk\";\nimport prompts from \"prompts\";\n\n/**\n * Print a clean visual representation of the folders recommended for AGENTS.md creation.\n */\nexport function printFolderRecommendation(projectName: string, directories: string[]): void {\n if (directories.length === 0) return;\n\n console.log(chalk.bold(`\\n📁 ${projectName}`));\n \n // Show up to 5 directories. If more, show the rest as a summary.\n const maxToShow = 5;\n const dirsToShow = directories.slice(0, maxToShow);\n const remaining = directories.length - maxToShow;\n\n dirsToShow.forEach((dir, idx) => {\n const isLast = idx === dirsToShow.length - 1 && remaining <= 0;\n const branch = isLast ? \"└──\" : \"├──\";\n console.log(` ${branch} 📁 ${dir}/`);\n console.log(` ${isLast ? \" \" : \"│ \"} └── 📝 ${chalk.green(\"AGENTS.md\")} ${chalk.gray(\"(recommended)\")}`);\n });\n\n if (remaining > 0) {\n console.log(` └── ${chalk.gray(`... and ${remaining} more folders`)}`);\n }\n console.log();\n}\n\n/**\n * Interactively prompt the user to approve or select directories for AGENTS.md creation.\n * If the project is large (> 5 directories), we alert the user about potential token/time usage.\n */\nexport async function configureFolderAgentsCreation(\n projectName: string,\n directories: string[]\n): Promise<string[]> {\n const filteredDirs = directories.filter(dir => !dir.startsWith(\".\"));\n if (filteredDirs.length === 0) {\n return [];\n }\n\n printFolderRecommendation(projectName, filteredDirs);\n\n const isLargeProject = filteredDirs.length > 5;\n if (isLargeProject) {\n console.log(\n chalk.yellow(\n `⚠️ This is a large project with ${filteredDirs.length} folders recommended for AGENTS.md creation.`\n )\n );\n console.log(\n chalk.gray(\n ` Auto-creating rules via LLM for all folders may consume a significant amount of time and tokens.\\n`\n )\n );\n }\n\n const response = await prompts(\n {\n type: \"select\",\n name: \"action\",\n message: \"Configure folder-level AGENTS.md creation:\",\n choices: [\n {\n title: `Auto-create in all recommended folders (${filteredDirs.length} folders)`,\n value: \"all\",\n },\n {\n title: \"Manual control (select specific folders)\",\n value: \"manual\",\n },\n {\n title: \"Skip folder-level AGENTS.md entirely\",\n value: \"skip\",\n },\n ],\n initial: 0,\n },\n {\n onCancel: () => {\n console.log(chalk.yellow(\"\\nOperation cancelled.\"));\n process.exit(0);\n },\n }\n );\n\n if (response.action === \"all\") {\n return filteredDirs;\n }\n\n if (response.action === \"skip\") {\n return [];\n }\n\n if (response.action === \"manual\") {\n const manualResponse = await prompts(\n {\n type: \"multiselect\",\n name: \"folders\",\n message: \"Select subdirectories to create AGENTS.md in:\",\n choices: filteredDirs.map((dir) => ({\n title: `${dir}/`,\n value: dir,\n selected: true,\n })),\n hint: \"- Space to select/deselect, Enter to confirm\",\n min: 0,\n },\n {\n onCancel: () => {\n console.log(chalk.yellow(\"\\nOperation cancelled.\"));\n process.exit(0);\n },\n }\n );\n\n return manualResponse.folders || [];\n }\n\n return [];\n}\n"],"mappings":";;;AAAA,SAAS,eAAe;;;ACAxB,OAAOA,WAAU;AACjB,OAAOC,YAAW;AAClB,OAAOC,cAAa;;;ACFpB,OAAO,UAAU;AACjB,OAAOC,SAAQ;;;ACDf,OAAO,QAAQ;AAMf,eAAsB,OAAO,YAAsC;AACjE,MAAI;AACF,UAAM,GAAG,OAAO,UAAU;AAC1B,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAKA,eAAsB,SAAkB,UAAqC;AAC3E,MAAI;AACF,UAAM,UAAU,MAAM,GAAG,SAAS,UAAU,OAAO;AACnD,WAAO,KAAK,MAAM,OAAO;AAAA,EAC3B,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAKA,eAAsB,SAAS,UAA0C;AACvE,MAAI;AACF,WAAO,MAAM,GAAG,SAAS,UAAU,OAAO;AAAA,EAC5C,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAKA,eAAsB,uBACpB,YACA,cAAwB,CAAC,gBAAgB,QAAQ,QAAQ,SAAS,UAAU,QAAQ,SAAS,eAAe,iBAAiB,WAAW,GACrH;AACnB,MAAI;AACF,UAAM,QAAQ,MAAM,GAAG,QAAQ,YAAY,EAAE,eAAe,KAAK,CAAC;AAClE,WAAO,MACJ,OAAO,CAAC,SAAS,KAAK,YAAY,KAAK,CAAC,YAAY,SAAS,KAAK,IAAI,CAAC,EACvE,IAAI,CAAC,SAAS,KAAK,IAAI;AAAA,EAC5B,QAAQ;AACN,WAAO,CAAC;AAAA,EACV;AACF;;;ADtCA,eAAsB,cAAc,YAA8C;AAChF,QAAM,eAAe,KAAK,QAAQ,UAAU;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3,"sources":["../src/index.ts","../src/commands/init.ts","../src/core/detector.ts","../src/utils/files.ts","../src/core/generator.ts","../src/templates/configJson.ts","../src/templates/rootAgents.ts","../src/templates/folderAgents.ts","../src/templates/architectureOverview.ts","../src/templates/apiOverview.ts","../src/templates/decisionsReadme.ts","../src/templates/glossary.ts","../src/templates/testingOverview.ts","../src/utils/prompts.ts","../src/commands/generate.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { handleInit } from \"./commands/init\";\nimport { handleGenerate } from \"./commands/generate\";\n// import { handleAnalyze } from \"./commands/analyze\";\n\nconst program = new Command();\n\nprogram\n .name(\"docforagents\")\n .description(\"Open-source AI-native knowledge specification and tooling for software repositories\")\n .version(\"0.1.0\");\n\nprogram\n .command(\"init\")\n .description(\"Scaffold the AI-native knowledge specification in a repository\")\n .argument(\"[path]\", \"Path to the project directory\", \".\")\n .option(\"-y, --yes\", \"Skip interactive prompts and use detected defaults\")\n .option(\"-f, --force\", \"Overwrite existing knowledge specification files if they exist\")\n .option(\"--folders <folders>\", \"Comma-separated list of custom subdirectories to create AGENTS.md in (bypasses auto-detection)\")\n .action(async (targetDir, options) => {\n await handleInit(targetDir, options);\n });\n\nprogram\n .command(\"generate\")\n .alias(\"gen\")\n .description(\"Generate a local AGENTS.md template in a directory\")\n .argument(\"[path]\", \"Path to the directory or AGENTS.md file\", \".\")\n .option(\"-f, --force\", \"Overwrite existing AGENTS.md file if it exists\")\n .action(async (targetDir, options) => {\n await handleGenerate(targetDir, options);\n });\n\n// program\n// .command(\"analyze\")\n// .description(\"Scan the repository codebase and generate AI documentation files\")\n// .argument(\"[path]\", \"Path to the project directory\", \".\")\n// .option(\"-y, --yes\", \"Skip interactive prompts and generate for all recommended folders\")\n// .option(\"--skip-folders\", \"Skip generating folder-level AGENTS.md rule files\")\n// .action(async (targetDir, options) => {\n// await handleAnalyze(targetDir, options);\n// });\n\nprogram.parse(process.argv);\n","import path from \"path\";\nimport chalk from \"chalk\";\nimport prompts from \"prompts\";\nimport { detectProject } from \"../core/detector\";\nimport { generateKnowledgeBase } from \"../core/generator\";\nimport { configureFolderAgentsCreation } from \"../utils/prompts\";\n\nexport interface InitOptions {\n yes?: boolean;\n force?: boolean;\n folders?: string;\n}\n\n/**\n * Handle the 'init' command.\n */\nexport async function handleInit(targetDir: string = \".\", options: InitOptions = {}): Promise<void> {\n const resolvedPath = path.resolve(targetDir);\n \n console.log(chalk.bold.cyan(\"\\n🔍 Scanning repository for docforagents initialization...\"));\n console.log(chalk.gray(`Path: ${resolvedPath}\\n`));\n\n // 1. Detect project details\n let metadata;\n try {\n metadata = await detectProject(resolvedPath);\n } catch (error) {\n console.error(chalk.red(\"Error scanning project:\"), error);\n process.exit(1);\n }\n\n // Log detected items\n console.log(chalk.bold(\"Detected stack:\"));\n console.log(` Project Name: ${chalk.green(metadata.projectName)}`);\n console.log(` Languages: ${chalk.blue(metadata.languages.join(\", \") || \"None detected\")}`);\n console.log(` Frameworks: ${chalk.blue(metadata.frameworks.join(\", \") || \"None detected\")}`);\n console.log(` Tools/Infra: ${chalk.blue(metadata.tools.join(\", \") || \"None detected\")}`);\n console.log(` Directories: ${chalk.blue(metadata.directories.join(\", \") || \"None detected\")}\\n`);\n\n let projectName = metadata.projectName;\n let selectedFolders: string[];\n let proceed = true;\n\n if (options.folders) {\n // Escape hatch: parse the comma-separated folders\n selectedFolders = options.folders.split(\",\").map(f => f.trim()).filter(Boolean);\n console.log(chalk.gray(`Using custom subdirectories: ${selectedFolders.join(\", \")}\\n`));\n } else {\n selectedFolders = metadata.directories.filter(dir => !dir.startsWith(\".\"));\n\n // 2. Interactive Prompts (unless --yes flag is passed)\n if (!options.yes) {\n const nameResponse = await prompts(\n {\n type: \"text\",\n name: \"projectName\",\n message: \"Customize project name:\",\n initial: projectName,\n },\n {\n onCancel: () => {\n console.log(chalk.yellow(\"\\nInitialization cancelled.\"));\n process.exit(0);\n }\n }\n );\n\n projectName = nameResponse.projectName ?? projectName;\n\n // Use interactive folder config helper\n selectedFolders = await configureFolderAgentsCreation(projectName, metadata.directories);\n\n const proceedResponse = await prompts(\n {\n type: \"confirm\",\n name: \"proceed\",\n message: \"Proceed to write standard knowledge layer?\",\n initial: true,\n },\n {\n onCancel: () => {\n console.log(chalk.yellow(\"\\nInitialization cancelled.\"));\n process.exit(0);\n }\n }\n );\n\n proceed = proceedResponse.proceed ?? proceed;\n }\n }\n\n if (!proceed) {\n console.log(chalk.yellow(\"\\nInitialization aborted.\"));\n return;\n }\n\n // Update metadata with customized project name\n metadata.projectName = projectName;\n\n // 3. Generate files\n console.log(chalk.cyan(\"\\n✍️ Writing knowledge base...\"));\n \n try {\n const result = await generateKnowledgeBase(resolvedPath, metadata, {\n forceOverwrite: options.force,\n folderAgents: selectedFolders,\n });\n\n // 4. Summarize results\n if (result.filesCreated.length > 0) {\n console.log(chalk.bold.green(`\\nSuccessfully created ${result.filesCreated.length} files:`));\n result.filesCreated.forEach(f => console.log(` ${chalk.green(\"✓\")} ${f}`));\n }\n\n if (result.filesSkipped.length > 0) {\n console.log(chalk.bold.yellow(`\\nSkipped ${result.filesSkipped.length} existing files (use --force or -f to overwrite):`));\n result.filesSkipped.forEach(f => console.log(` ${chalk.yellow(\"-\")} ${f}`));\n }\n\n console.log(chalk.bold.cyan(\"\\n🎉 Knowledge Layer Scaffolded successfully!\"));\n console.log(\"Your repository is now machine-readable for AI agents. Open root \" + chalk.bold.green(\"AGENTS.md\") + \" to get started.\\n\");\n\n } catch (error) {\n console.error(chalk.red(\"\\nError generating files:\"), error);\n process.exit(1);\n }\n}\n","import path from \"path\";\nimport fs from \"fs/promises\";\nimport { exists, readJson, readText, getTopLevelDirectories } from \"../utils/files\";\n\nexport interface ProjectMetadata {\n projectName: string;\n languages: string[];\n frameworks: string[];\n tools: string[];\n directories: string[];\n}\n\n/**\n * Scan a repository path to detect project configurations.\n */\nexport async function detectProject(targetPath: string): Promise<ProjectMetadata> {\n const absolutePath = path.resolve(targetPath);\n \n // 1. Resolve Project Name\n let projectName = path.basename(absolutePath);\n const packageJson = await readJson(path.join(absolutePath, \"package.json\"));\n if (packageJson && packageJson.name) {\n projectName = packageJson.name;\n } else {\n // Try to get Cargo.toml project name\n const cargoToml = await readText(path.join(absolutePath, \"Cargo.toml\"));\n if (cargoToml) {\n const match = cargoToml.match(/name\\s*=\\s*\"([^\"]+)\"/);\n if (match && match[1]) {\n projectName = match[1];\n }\n }\n }\n\n // 2. Detect Languages\n const languages: string[] = [];\n \n if (await exists(path.join(absolutePath, \"package.json\"))) {\n // Determine if it is TS or JS\n const tsconfigExists = await exists(path.join(absolutePath, \"tsconfig.json\"));\n if (tsconfigExists) {\n languages.push(\"TypeScript\", \"JavaScript\");\n } else {\n languages.push(\"JavaScript\");\n }\n }\n \n if (\n (await exists(path.join(absolutePath, \"requirements.txt\"))) ||\n (await exists(path.join(absolutePath, \"pyproject.toml\"))) ||\n (await exists(path.join(absolutePath, \"Pipfile\"))) ||\n (await exists(path.join(absolutePath, \"setup.py\")))\n ) {\n languages.push(\"Python\");\n }\n\n if (await exists(path.join(absolutePath, \"go.mod\"))) {\n languages.push(\"Go\");\n }\n\n if (await exists(path.join(absolutePath, \"Cargo.toml\"))) {\n languages.push(\"Rust\");\n }\n\n if (\n (await exists(path.join(absolutePath, \"pom.xml\"))) ||\n (await exists(path.join(absolutePath, \"build.gradle\")))\n ) {\n languages.push(\"Java\");\n }\n\n // Scan root for csproj files\n try {\n const files = await fs.readdir(absolutePath);\n if (files.some(f => f.endsWith(\".csproj\") || f.endsWith(\".sln\"))) {\n languages.push(\"C#\");\n }\n } catch {\n // Ignore read errors\n }\n\n // 3. Detect Frameworks\n const frameworks: string[] = [];\n \n // JS/TS dependencies scan\n if (packageJson) {\n const deps = {\n ...(packageJson.dependencies || {}),\n ...(packageJson.devDependencies || {}),\n };\n \n if (deps[\"next\"]) frameworks.push(\"Next.js\");\n else if (deps[\"react-native\"]) frameworks.push(\"React Native\");\n else if (deps[\"react\"]) frameworks.push(\"React\");\n \n if (deps[\"nuxt\"]) frameworks.push(\"Nuxt\");\n else if (deps[\"vue\"]) frameworks.push(\"Vue\");\n \n if (deps[\"@angular/core\"]) frameworks.push(\"Angular\");\n if (deps[\"svelte\"] || deps[\"@sveltejs/kit\"]) frameworks.push(\"Svelte\");\n \n if (deps[\"express\"]) frameworks.push(\"Express\");\n if (deps[\"@nestjs/core\"]) frameworks.push(\"NestJS\");\n if (deps[\"koa\"]) frameworks.push(\"Koa\");\n if (deps[\"fastify\"]) frameworks.push(\"Fastify\");\n if (deps[\"tailwindcss\"]) frameworks.push(\"Tailwind CSS\");\n }\n\n // Python dependencies scan\n const pyprojectToml = await readText(path.join(absolutePath, \"pyproject.toml\"));\n const reqsTxt = await readText(path.join(absolutePath, \"requirements.txt\"));\n const pythonDeps = `${pyprojectToml || \"\"} ${reqsTxt || \"\"}`;\n \n if (pythonDeps.includes(\"fastapi\")) frameworks.push(\"FastAPI\");\n if (pythonDeps.includes(\"django\")) frameworks.push(\"Django\");\n if (pythonDeps.includes(\"flask\")) frameworks.push(\"Flask\");\n if (pythonDeps.includes(\"streamlit\")) frameworks.push(\"Streamlit\");\n\n // Go dependencies scan\n const goMod = await readText(path.join(absolutePath, \"go.mod\"));\n if (goMod) {\n if (goMod.includes(\"github.com/gin-gonic/gin\")) frameworks.push(\"Gin\");\n if (goMod.includes(\"github.com/labstack/echo\")) frameworks.push(\"Echo\");\n if (goMod.includes(\"github.com/gofiber/fiber\")) frameworks.push(\"Fiber\");\n }\n\n // Rust dependencies scan\n const cargoTomlStr = await readText(path.join(absolutePath, \"Cargo.toml\"));\n if (cargoTomlStr) {\n if (cargoTomlStr.includes(\"tokio\")) frameworks.push(\"Tokio\");\n if (cargoTomlStr.includes(\"actix-web\")) frameworks.push(\"Actix-Web\");\n if (cargoTomlStr.includes(\"axum\")) frameworks.push(\"Axum\");\n if (cargoTomlStr.includes(\"rocket\")) frameworks.push(\"Rocket\");\n }\n\n // 4. Detect Tools & Infrastructure\n const tools: string[] = [];\n \n if (await exists(path.join(absolutePath, \"Dockerfile\")) || await exists(path.join(absolutePath, \"docker-compose.yml\"))) {\n tools.push(\"Docker\");\n }\n if (await exists(path.join(absolutePath, \".github/workflows\"))) {\n tools.push(\"GitHub Actions\");\n }\n if (await exists(path.join(absolutePath, \".gitlab-ci.yml\"))) {\n tools.push(\"GitLab CI\");\n }\n\n // Check common ORMs or DB libraries\n if (packageJson) {\n const deps = { ...(packageJson.dependencies || {}), ...(packageJson.devDependencies || {}) };\n if (deps[\"prisma\"]) tools.push(\"Prisma ORM\");\n if (deps[\"mongoose\"]) tools.push(\"Mongoose (MongoDB)\");\n if (deps[\"sequelize\"]) tools.push(\"Sequelize\");\n if (deps[\"typeorm\"]) tools.push(\"TypeORM\");\n if (deps[\"pg\"]) tools.push(\"PostgreSQL Client\");\n if (deps[\"sqlite3\"]) tools.push(\"SQLite3 Client\");\n }\n if (pythonDeps.includes(\"sqlalchemy\")) tools.push(\"SQLAlchemy ORM\");\n if (pythonDeps.includes(\"tortoise-orm\")) tools.push(\"Tortoise ORM\");\n\n // 5. Scan directories for local AGENTS.md candidates using marker-file heuristic\n const directories = await findSubProjects(absolutePath);\n\n return {\n projectName,\n languages: Array.from(new Set(languages)),\n frameworks: Array.from(new Set(frameworks)),\n tools: Array.from(new Set(tools)),\n directories,\n };\n}\n\nconst projectMarkers = [\n \"package.json\", // Node/JS/TS\n \"requirements.txt\", // Python\n \"pyproject.toml\", // Python\n \"pom.xml\", // Java\n \"go.mod\", // Go\n \"Cargo.toml\", // Rust\n \".git\" // Generic fallback\n];\n\nconst blackholeDirs = [\n \"node_modules\",\n \".git\",\n \"dist\",\n \"build\",\n \"target\",\n \"venv\",\n \".venv\",\n \"__pycache__\",\n \".docforagents\",\n \"knowledge\"\n];\n\n/**\n * Recursively find directories containing project marker files, up to a certain depth.\n */\nasync function findSubProjects(\n basePath: string,\n currentPath: string = basePath,\n depth: number = 0,\n maxDepth: number = 3\n): Promise<string[]> {\n if (depth > maxDepth) {\n return [];\n }\n\n const results: string[] = [];\n try {\n const items = await fs.readdir(currentPath, { withFileTypes: true });\n\n // Check if this subdirectory (if it's not the base path itself) contains any project marker.\n if (currentPath !== basePath) {\n let hasMarker = false;\n for (const item of items) {\n if (item.isFile() && projectMarkers.includes(item.name)) {\n hasMarker = true;\n break;\n }\n }\n if (hasMarker) {\n const relative = path.relative(basePath, currentPath).replace(/\\\\/g, \"/\");\n results.push(relative);\n return results;\n }\n }\n\n // Recurse into subdirectories\n for (const item of items) {\n if (item.isDirectory() && !blackholeDirs.includes(item.name) && !item.name.startsWith(\".\")) {\n const subPath = path.join(currentPath, item.name);\n const subResults = await findSubProjects(basePath, subPath, depth + 1, maxDepth);\n results.push(...subResults);\n }\n }\n } catch (error) {\n // Ignore read errors\n }\n\n return results;\n}\n","import fs from \"fs/promises\";\nimport path from \"path\";\n\n/**\n * Check if a file or directory exists at the given path.\n */\nexport async function exists(targetPath: string): Promise<boolean> {\n try {\n await fs.access(targetPath);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Read and parse JSON file safely. Returns null if error or file doesn't exist.\n */\nexport async function readJson<T = any>(filePath: string): Promise<T | null> {\n try {\n const content = await fs.readFile(filePath, \"utf-8\");\n return JSON.parse(content) as T;\n } catch {\n return null;\n }\n}\n\n/**\n * Read text file safely. Returns null if error or file doesn't exist.\n */\nexport async function readText(filePath: string): Promise<string | null> {\n try {\n return await fs.readFile(filePath, \"utf-8\");\n } catch {\n return null;\n }\n}\n\n/**\n * Get all top-level directories in targetPath, excluding common ignore paths.\n */\nexport async function getTopLevelDirectories(\n targetPath: string,\n ignoredDirs: string[] = [\"node_modules\", \".git\", \"dist\", \"build\", \"target\", \"venv\", \".venv\", \"__pycache__\", \".docforagents\", \"knowledge\"]\n): Promise<string[]> {\n try {\n const items = await fs.readdir(targetPath, { withFileTypes: true });\n return items\n .filter((item) => item.isDirectory() && !ignoredDirs.includes(item.name))\n .map((item) => item.name);\n } catch {\n return [];\n }\n}\n","import fs from \"fs/promises\";\nimport path from \"path\";\nimport { ProjectMetadata } from \"./detector\";\nimport { exists } from \"../utils/files\";\nimport {\n generateConfigJson,\n generateRootAgentsMd,\n generateFolderAgentsMd,\n generateArchitectureOverviewMd,\n generateApiOverviewMd,\n generateDecisionsReadmeMd,\n generateGlossaryMd,\n generateTestingOverviewMd,\n} from \"./templates\";\n\nexport interface GenerationResult {\n filesCreated: string[];\n filesSkipped: string[];\n}\n\n/**\n * Generate the standard docforagents layout in the target project path.\n */\nexport async function generateKnowledgeBase(\n targetPath: string,\n metadata: ProjectMetadata,\n options: { forceOverwrite?: boolean; skipFolderAgents?: boolean; folderAgents?: string[] } = {}\n): Promise<GenerationResult> {\n const absolutePath = path.resolve(targetPath);\n const filesCreated: string[] = [];\n const filesSkipped: string[] = [];\n\n // Helper to safely write a file and track results\n const writeFileSafely = async (filePath: string, content: string) => {\n const relativePath = path.relative(absolutePath, filePath);\n const fileExists = await exists(filePath);\n \n if (fileExists && !options.forceOverwrite) {\n filesSkipped.push(relativePath);\n return;\n }\n\n // Ensure parent directory exists\n await fs.mkdir(path.dirname(filePath), { recursive: true });\n await fs.writeFile(filePath, content, \"utf-8\");\n filesCreated.push(relativePath);\n };\n\n // 1. Create root configurations & entry points\n const configPath = path.join(absolutePath, \".docforagents\", \"config.json\");\n await writeFileSafely(configPath, generateConfigJson(metadata));\n\n const rootAgentsPath = path.join(absolutePath, \"AGENTS.md\");\n await writeFileSafely(rootAgentsPath, generateRootAgentsMd(metadata));\n\n // 2. Create knowledge base directory files\n const knowledgeDir = path.join(absolutePath, \"knowledge\");\n \n await writeFileSafely(\n path.join(knowledgeDir, \"architecture\", \"overview.md\"),\n generateArchitectureOverviewMd(metadata.projectName)\n );\n\n await writeFileSafely(\n path.join(knowledgeDir, \"api\", \"overview.md\"),\n generateApiOverviewMd(metadata.projectName)\n );\n\n await writeFileSafely(\n path.join(knowledgeDir, \"decisions\", \"README.md\"),\n generateDecisionsReadmeMd(metadata.projectName)\n );\n\n await writeFileSafely(\n path.join(knowledgeDir, \"glossary\", \"terms.md\"),\n generateGlossaryMd()\n );\n\n await writeFileSafely(\n path.join(knowledgeDir, \"testing\", \"overview.md\"),\n generateTestingOverviewMd(metadata)\n );\n\n // 3. Create folder-level AGENTS.md files\n const foldersToGenerate = options.folderAgents !== undefined\n ? options.folderAgents\n : (options.skipFolderAgents ? [] : metadata.directories);\n\n for (const dir of foldersToGenerate) {\n if (dir.startsWith(\".\")) {\n continue;\n }\n const folderAgentsPath = path.join(absolutePath, dir, \"AGENTS.md\");\n await writeFileSafely(folderAgentsPath, generateFolderAgentsMd(dir));\n }\n\n return {\n filesCreated,\n filesSkipped,\n };\n}\n","import { ProjectMetadata } from \"../core/detector\";\n\n/**\n * Generate config.json content based on metadata.\n */\nexport function generateConfigJson(metadata: ProjectMetadata): string {\n const config = {\n $schema: \"https://docforagents.org/schemas/v1/config.json\",\n version: \"1.0.0\",\n project: {\n name: metadata.projectName,\n languages: metadata.languages,\n frameworks: metadata.frameworks,\n tools: metadata.tools,\n },\n knowledgeDir: \"knowledge\",\n exclude: [\n \"node_modules\",\n \".git\",\n \"dist\",\n \"build\",\n \"target\",\n \"venv\",\n \".venv\",\n \"__pycache__\",\n \".docforagents/cache\"\n ],\n rules: {\n requireAdrForMajorChanges: false,\n requireAgentsUpdateOnApiChange: true\n }\n };\n return JSON.stringify(config, null, 2);\n}\n","import { ProjectMetadata } from \"../core/detector\";\n\n/**\n * Generate root AGENTS.md template.\n */\nexport function generateRootAgentsMd(metadata: ProjectMetadata): string {\n const languagesList = metadata.languages.map(l => `- ${l}`).join(\"\\n\") || \"- (None detected)\";\n const frameworksList = metadata.frameworks.map(f => `- ${f}`).join(\"\\n\") || \"- (None detected)\";\n const toolsList = metadata.tools.map(t => `- ${t}`).join(\"\\n\") || \"- (None detected)\";\n \n const directoryList = metadata.directories\n .map(dir => `- [${dir}/](file://./${dir}/) — *Add responsibilities of this directory* (see [${dir}/AGENTS.md](file://./${dir}/AGENTS.md) for local rules)`)\n .join(\"\\n\") || \"- (No directories detected)\";\n\n return `# AGENTS.md — AI Agent Context Entry Point\n\n> [!NOTE]\n> **To AI Coding Agents:** This file serves as your primary landing page for understanding the architecture, rules, and entry points of the **${metadata.projectName}** project. Before executing tasks or modifications, review this page and follow the links to specific files.\n\n## Project Overview\n*Briefly describe what this project does, its goals, and its business context.*\n\n## Core Stack & Environment\n### Languages\n${languagesList}\n\n### Frameworks & Libraries\n${frameworksList}\n\n### Infrastructure & Tools\n${toolsList}\n\n---\n\n## Repository Map\n\n### Core Knowledge Base\nAll architectural and domain-specific knowledge resides in the \\`knowledge/\\` directory:\n- [Architecture Overview](file://./knowledge/architecture/overview.md) — System components, data flow, design patterns.\n- [API Documentation](file://./knowledge/api/overview.md) — Endpoints, schemas, payloads.\n- [Architecture Decisions (ADRs)](file://./knowledge/decisions/README.md) — Why the project was built this way.\n- [Glossary of Terms](file://./knowledge/glossary/terms.md) — Domain vocabulary and definitions.\n- [Testing Guidelines](file://./knowledge/testing/overview.md) — Test setup, commands, and strategies.\n\n### Directory Structure\n${directoryList}\n\n---\n\n## Agent Guidelines & Conventions\n\n### 1. Read Before Write\n- Check the relevant local \\`AGENTS.md\\` inside directories you are editing.\n- Look at the [Architecture Decisions](file://./knowledge/decisions/README.md) to understand existing patterns (e.g. repository pattern, clean architecture).\n\n### 2. Standardized Changes\n- **API changes** MUST update [API Overview](file://./knowledge/api/overview.md) and local \\`AGENTS.md\\` interfaces.\n- **Architectural changes** require an Architecture Decision Record (ADR) under [Decisions](file://./knowledge/decisions/README.md).\n\n### 3. Verification\n- Always execute tests according to [Testing Guidelines](file://./knowledge/testing/overview.md) before declaring a task complete.\n`;\n}\n","/**\n * Generate folder-level AGENTS.md template.\n */\nexport function generateFolderAgentsMd(folderName: string): string {\n return `# AGENTS.md — Local Directory Rules for \\`${folderName}/\\`\n\n> [!NOTE]\n> **To AI Coding Agents:** This file defines the responsibilities, entry points, and coding conventions specific to the \\`${folderName}/\\` directory. Adhere strictly to these guidelines when making modifications here.\n\n## Purpose & Responsibility\n*Describe the single responsibility of this directory (e.g. \"Handles authentication endpoints and JWT verification\").*\n\n## Core Entry Points\n- [\\`index.ts\\` or entry file](file://./index.ts) — *Describe what imports/exports this file exposes.*\n\n## Internal Dependencies & Imports\n- **Imports from other modules:** *Specify which parent modules this directory is allowed to import from.*\n- **Outward dependencies:** *What external npm/pip packages or databases does this folder communicate with?*\n\n## Conventions & Implementation Rules\n1. **Design Patterns**: *e.g., Use controllers for route handling, delegate business logic to services.*\n2. **Naming Conventions**: *e.g., Suffix all services with \\`Service\\` (e.g., \\`AuthService\\`).*\n3. **Error Handling**: *e.g., Do not throw raw errors; wrap in \\`AppError\\` with status codes.*\n4. **Security**: *e.g., Ensure JWT middleware is applied to all new route configurations.*\n`;\n}\n","/**\n * Template for knowledge/architecture/overview.md\n */\nexport function generateArchitectureOverviewMd(projectName: string): string {\n return `# Architecture Overview — ${projectName}\n\n## System Overview\n*Provide a high-level description of how this system is put together. Mention if it is a monolith, microservices, SPA, Serverless, etc.*\n\n## Core Components\n*List the primary components/modules of the application and their relationships.*\n\n\\`\\`\\`mermaid\ngraph TD\n Client[Client / Frontend] --> API[API Gateway / Backend]\n API --> DB[(Database)]\n API --> Cache[(Cache / Redis)]\n\\`\\`\\`\n\n## Core Design Patterns\n*Outline the engineering patterns used in this codebase (e.g., Clean Architecture, MVC, CQRS, Repository Pattern, Dependency Injection).*\n\n- **Pattern A**: *Description of how it is applied.*\n- **Pattern B**: *Description of how it is applied.*\n\n## Data Flows\n1. **Request Flow**: *Trace a typical request from the frontend to database and back.*\n2. **Background Processes**: *Describe queues, cron jobs, event-driven pipelines if applicable.*\n`;\n}\n","/**\n * Template for knowledge/api/overview.md\n */\nexport function generateApiOverviewMd(projectName: string): string {\n return `# API Reference — ${projectName}\n\n## Authentication & Authorization\n*Describe how clients authenticate to the APIs (e.g. Bearer tokens, cookies, API keys).*\n\n\\`\\`\\`http\nAuthorization: Bearer <token>\n\\`\\`\\`\n\n## Base URLs\n- Development: \\`http://localhost:3000/api\\`\n- Staging: \\`https://staging.api.example.com/v1\\`\n- Production: \\`https://api.example.com/v1\\`\n\n## Main Endpoints\n\n### 1. Health check\n- **Method / Path**: \\`GET /health\\`\n- **Description**: Returns the system status.\n- **Response**:\n \\`\\`\\`json\n {\n \"status\": \"healthy\",\n \"timestamp\": \"2026-07-27T18:00:00Z\"\n }\n \\`\\`\\`\n\n### 2. [Endpoint Name]\n- **Method / Path**: \\`POST /resource\\`\n- **Headers**: \\`Content-Type: application/json\\`\n- **Request Body**:\n \\`\\`\\`json\n {\n \"name\": \"example\"\n }\n \\`\\`\\`\n- **Response (201 Created)**:\n \\`\\`\\`json\n {\n \"id\": \"uuid-1234\",\n \"name\": \"example\"\n }\n \\`\\`\\`\n`;\n}\n","/**\n * Template for knowledge/decisions/README.md\n */\nexport function generateDecisionsReadmeMd(projectName: string): string {\n return `# Architectural Decision Records (ADR)\n\nThis folder contains the history of major design and architectural choices made in the **${projectName}** repository.\n\n## What is an ADR?\nAn Architectural Decision Record (ADR) is a document that captures an important architectural decision, including the context in which the decision was made, the consequences of the decision, and its current status (Proposed, Accepted, Superceded).\n\n## ADR Index\n\n| ADR # | Title | Status | Date |\n|-------|-------|--------|------|\n| [ADR-001](file://./001-initial-architecture.md) | Initial Architecture Scaffolding | Accepted | 2026-07-27 |\n\n*To create a new ADR, copy the template format and name it sequentially (e.g. \\`002-use-redis-caching.md\\`).*\n`;\n}\n","/**\n * Template for knowledge/glossary/terms.md\n */\nexport function generateGlossaryMd(): string {\n return `# Domain Glossary\n\nDefine the core business terms and domain models used in this repository. This reduces ambiguity for AI agents and onboarding engineers.\n\n| Term | Definition | Context / Usage |\n|------|------------|-----------------|\n| **ADR** | Architecture Decision Record. | Engineering workflow documentation |\n| **Agent** | An autonomous AI agent performing operations on code. | AI Coding context |\n| **Knowledge Layer** | The directory containing machine-readable code specification and guidelines. | Standard repo structure |\n`;\n}\n","import { ProjectMetadata } from \"../core/detector\";\n\n/**\n * Template for knowledge/testing/overview.md\n */\nexport function generateTestingOverviewMd(metadata: ProjectMetadata): string {\n return `# Testing Guidelines\n\n## Running Tests\n*Provide the exact commands required to execute the test suite.*\n\n\\`\\`\\`bash\n# Run unit tests\nnpm run test\n# Run integration / e2e tests\nnpm run test:e2e\n\\`\\`\\`\n\n## Testing Philosophy\n- **Unit Tests**: Describe where unit tests are placed (e.g., next to the file as \\`*.test.ts\\` or in a \\`test/\\` directory).\n- **Integration Tests**: Describe how to test integrations with mock services/databases.\n- **Coverage**: Target code coverage expectations.\n\n## Creating New Tests\n- Use the standard test framework configurations.\n- Mock external network calls using MSW, nock, or custom mock suites.\n`;\n}\n","import chalk from \"chalk\";\nimport prompts from \"prompts\";\n\n/**\n * Print a clean visual representation of the folders recommended for AGENTS.md creation.\n */\nexport function printFolderRecommendation(projectName: string, directories: string[]): void {\n if (directories.length === 0) return;\n\n console.log(chalk.bold(`\\n📁 ${projectName}`));\n \n // Show up to 5 directories. If more, show the rest as a summary.\n const maxToShow = 5;\n const dirsToShow = directories.slice(0, maxToShow);\n const remaining = directories.length - maxToShow;\n\n dirsToShow.forEach((dir, idx) => {\n const isLast = idx === dirsToShow.length - 1 && remaining <= 0;\n const branch = isLast ? \"└──\" : \"├──\";\n console.log(` ${branch} 📁 ${dir}/`);\n console.log(` ${isLast ? \" \" : \"│ \"} └── 📝 ${chalk.green(\"AGENTS.md\")} ${chalk.gray(\"(recommended)\")}`);\n });\n\n if (remaining > 0) {\n console.log(` └── ${chalk.gray(`... and ${remaining} more folders`)}`);\n }\n console.log();\n}\n\n/**\n * Interactively prompt the user to approve or select directories for AGENTS.md creation.\n * If the project is large (> 5 directories), we alert the user about potential token/time usage.\n */\nexport async function configureFolderAgentsCreation(\n projectName: string,\n directories: string[]\n): Promise<string[]> {\n const filteredDirs = directories.filter(dir => !dir.startsWith(\".\"));\n if (filteredDirs.length === 0) {\n return [];\n }\n\n printFolderRecommendation(projectName, filteredDirs);\n\n const isLargeProject = filteredDirs.length > 5;\n if (isLargeProject) {\n console.log(\n chalk.yellow(\n `⚠️ This is a large project with ${filteredDirs.length} folders recommended for AGENTS.md creation.`\n )\n );\n console.log(\n chalk.gray(\n ` Auto-creating rules via LLM for all folders may consume a significant amount of time and tokens.\\n`\n )\n );\n }\n\n const response = await prompts(\n {\n type: \"select\",\n name: \"action\",\n message: \"Configure folder-level AGENTS.md creation:\",\n choices: [\n {\n title: `Auto-create in all recommended folders (${filteredDirs.length} folders)`,\n value: \"all\",\n },\n {\n title: \"Manual control (select specific folders)\",\n value: \"manual\",\n },\n {\n title: \"Skip folder-level AGENTS.md entirely\",\n value: \"skip\",\n },\n ],\n initial: 0,\n },\n {\n onCancel: () => {\n console.log(chalk.yellow(\"\\nOperation cancelled.\"));\n process.exit(0);\n },\n }\n );\n\n if (response.action === \"all\") {\n return filteredDirs;\n }\n\n if (response.action === \"skip\") {\n return [];\n }\n\n if (response.action === \"manual\") {\n const manualResponse = await prompts(\n {\n type: \"multiselect\",\n name: \"folders\",\n message: \"Select subdirectories to create AGENTS.md in:\",\n choices: filteredDirs.map((dir) => ({\n title: `${dir}/`,\n value: dir,\n selected: true,\n })),\n hint: \"- Space to select/deselect, Enter to confirm\",\n min: 0,\n },\n {\n onCancel: () => {\n console.log(chalk.yellow(\"\\nOperation cancelled.\"));\n process.exit(0);\n },\n }\n );\n\n return manualResponse.folders || [];\n }\n\n return [];\n}\n","import path from \"path\";\nimport fs from \"fs/promises\";\nimport chalk from \"chalk\";\nimport { generateFolderAgentsMd } from \"../core/templates\";\nimport { exists } from \"../utils/files\";\n\nexport interface GenerateOptions {\n force?: boolean;\n}\n\n/**\n * Handle the 'generate' / 'gen' command to scaffold a single local AGENTS.md template.\n */\nexport async function handleGenerate(targetDir: string = \".\", options: GenerateOptions = {}): Promise<void> {\n const resolvedPath = path.resolve(targetDir);\n \n let writePath = resolvedPath;\n // If the target path is not pointing directly to an AGENTS.md file, assume it's a directory and target AGENTS.md inside it.\n if (!resolvedPath.endsWith(\"AGENTS.md\")) {\n writePath = path.join(resolvedPath, \"AGENTS.md\");\n }\n\n const folderPath = path.dirname(writePath);\n const folderName = path.basename(folderPath);\n\n const fileExists = await exists(writePath);\n if (fileExists && !options.force) {\n console.error(chalk.red(`\\nError: AGENTS.md already exists at ${writePath}`));\n console.error(chalk.yellow(\"Use -f or --force to overwrite it.\\n\"));\n process.exit(1);\n }\n\n try {\n await fs.mkdir(folderPath, { recursive: true });\n const content = generateFolderAgentsMd(folderName);\n await fs.writeFile(writePath, content, \"utf-8\");\n\n const relativePath = path.relative(process.cwd(), writePath);\n console.log(chalk.bold.green(`\\n✓ Successfully generated ${relativePath}\\n`));\n } catch (error) {\n console.error(chalk.red(\"\\nError generating AGENTS.md file:\"), error);\n process.exit(1);\n }\n}\n"],"mappings":";;;AAAA,SAAS,eAAe;;;ACAxB,OAAOA,WAAU;AACjB,OAAOC,YAAW;AAClB,OAAOC,cAAa;;;ACFpB,OAAO,UAAU;AACjB,OAAOC,SAAQ;;;ACDf,OAAO,QAAQ;AAMf,eAAsB,OAAO,YAAsC;AACjE,MAAI;AACF,UAAM,GAAG,OAAO,UAAU;AAC1B,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAKA,eAAsB,SAAkB,UAAqC;AAC3E,MAAI;AACF,UAAM,UAAU,MAAM,GAAG,SAAS,UAAU,OAAO;AACnD,WAAO,KAAK,MAAM,OAAO;AAAA,EAC3B,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAKA,eAAsB,SAAS,UAA0C;AACvE,MAAI;AACF,WAAO,MAAM,GAAG,SAAS,UAAU,OAAO;AAAA,EAC5C,QAAQ;AACN,WAAO;AAAA,EACT;AACF;;;ADrBA,eAAsB,cAAc,YAA8C;AAChF,QAAM,eAAe,KAAK,QAAQ,UAAU;AAG5C,MAAI,cAAc,KAAK,SAAS,YAAY;AAC5C,QAAM,cAAc,MAAM,SAAS,KAAK,KAAK,cAAc,cAAc,CAAC;AAC1E,MAAI,eAAe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fs","fs","path","path","fs","path","chalk","prompts","path","fs","chalk","path","chalk","fs"]}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docforagents",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Open-source AI-native knowledge specification and tooling for software repositories",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"bin": {
|
|
8
|
-
"docforagents": "
|
|
8
|
+
"docforagents": "dist/index.js"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "tsup",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"@google/generative-ai": "^0.24.1",
|
|
33
33
|
"chalk": "^5.3.0",
|
|
34
34
|
"commander": "^12.1.0",
|
|
35
|
+
"docforagents": "^0.1.1",
|
|
35
36
|
"fast-glob": "^3.3.2",
|
|
36
37
|
"prompts": "^2.4.2"
|
|
37
38
|
},
|