@weavelogic/knowledge-graph-agent 0.8.4 → 0.8.6

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.
@@ -0,0 +1,563 @@
1
+ import { existsSync, readFileSync, writeFileSync } from "fs";
2
+ import { basename, join } from "path";
3
+ import fg from "fast-glob";
4
+ import { spawn } from "child_process";
5
+ async function generateDocsWithAgents(projectRoot, docsPath, options = {}) {
6
+ const result = {
7
+ success: true,
8
+ documentsGenerated: [],
9
+ agentsSpawned: 0,
10
+ errors: []
11
+ };
12
+ try {
13
+ const context = await buildGenerationContext(projectRoot, docsPath);
14
+ const tasks = await planDocumentGeneration(context);
15
+ if (options.dryRun) {
16
+ console.log("\n[Dry Run] Would generate the following documents:");
17
+ for (const task of tasks) {
18
+ console.log(` - ${task.outputFile} (${task.agentType} agent)`);
19
+ }
20
+ return result;
21
+ }
22
+ if (options.parallel) {
23
+ const results = await Promise.allSettled(
24
+ tasks.map((task) => executeAgentTask(task, context, options.verbose))
25
+ );
26
+ for (let i = 0; i < results.length; i++) {
27
+ const r = results[i];
28
+ result.agentsSpawned++;
29
+ if (r.status === "fulfilled") {
30
+ result.documentsGenerated.push(r.value);
31
+ } else {
32
+ result.errors.push(`Failed: ${tasks[i].outputFile} - ${r.reason}`);
33
+ result.documentsGenerated.push({
34
+ path: tasks[i].outputFile,
35
+ title: basename(tasks[i].outputFile, ".md"),
36
+ type: tasks[i].type,
37
+ generated: false,
38
+ error: String(r.reason)
39
+ });
40
+ }
41
+ }
42
+ } else {
43
+ for (const task of tasks) {
44
+ result.agentsSpawned++;
45
+ try {
46
+ const doc = await executeAgentTask(task, context, options.verbose);
47
+ result.documentsGenerated.push(doc);
48
+ } catch (error) {
49
+ result.errors.push(`Failed: ${task.outputFile} - ${error}`);
50
+ result.documentsGenerated.push({
51
+ path: task.outputFile,
52
+ title: basename(task.outputFile, ".md"),
53
+ type: task.type,
54
+ generated: false,
55
+ error: String(error)
56
+ });
57
+ }
58
+ }
59
+ }
60
+ result.success = result.errors.length === 0;
61
+ } catch (error) {
62
+ result.success = false;
63
+ result.errors.push(`Generation failed: ${error}`);
64
+ }
65
+ return result;
66
+ }
67
+ async function buildGenerationContext(projectRoot, docsPath) {
68
+ const context = {
69
+ projectRoot,
70
+ docsPath,
71
+ projectName: basename(projectRoot),
72
+ languages: [],
73
+ frameworks: [],
74
+ existingDocs: [],
75
+ sourceFiles: []
76
+ };
77
+ const pkgPath = join(projectRoot, "package.json");
78
+ if (existsSync(pkgPath)) {
79
+ try {
80
+ const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
81
+ context.projectName = pkg.name?.replace(/^@[^/]+\//, "") || context.projectName;
82
+ const deps = { ...pkg.dependencies, ...pkg.devDependencies };
83
+ if (deps.react) context.frameworks.push("React");
84
+ if (deps.next) context.frameworks.push("Next.js");
85
+ if (deps.vue) context.frameworks.push("Vue");
86
+ if (deps.express) context.frameworks.push("Express");
87
+ if (deps.fastify) context.frameworks.push("Fastify");
88
+ if (deps["@prisma/client"] || deps.prisma) context.frameworks.push("Prisma");
89
+ } catch {
90
+ }
91
+ }
92
+ if (existsSync(join(projectRoot, "tsconfig.json"))) {
93
+ context.languages.push("TypeScript");
94
+ }
95
+ if (existsSync(join(projectRoot, "package.json"))) {
96
+ context.languages.push("JavaScript");
97
+ }
98
+ if (existsSync(join(projectRoot, "requirements.txt")) || existsSync(join(projectRoot, "pyproject.toml"))) {
99
+ context.languages.push("Python");
100
+ }
101
+ if (existsSync(join(projectRoot, "Cargo.toml"))) {
102
+ context.languages.push("Rust");
103
+ }
104
+ if (existsSync(join(projectRoot, "go.mod"))) {
105
+ context.languages.push("Go");
106
+ }
107
+ const existingDocs = await fg("**/*.md", {
108
+ cwd: docsPath,
109
+ ignore: ["node_modules/**", ".git/**", "_templates/**"]
110
+ });
111
+ context.existingDocs = existingDocs;
112
+ const sourceFiles = await fg("**/*.{ts,tsx,js,jsx,py,rs,go}", {
113
+ cwd: projectRoot,
114
+ ignore: ["node_modules/**", ".git/**", "dist/**", "build/**", docsPath + "/**"],
115
+ dot: true
116
+ });
117
+ context.sourceFiles = sourceFiles;
118
+ return context;
119
+ }
120
+ async function planDocumentGeneration(context) {
121
+ const tasks = [];
122
+ const { projectRoot, docsPath, sourceFiles, frameworks } = context;
123
+ const docExists = (relativePath) => {
124
+ return existsSync(join(docsPath, relativePath));
125
+ };
126
+ const srcDirs = /* @__PURE__ */ new Set();
127
+ const componentFiles = [];
128
+ const serviceFiles = [];
129
+ const utilityFiles = [];
130
+ for (const file of sourceFiles) {
131
+ const dir = file.split("/")[0];
132
+ srcDirs.add(dir);
133
+ if (file.includes("component") || file.includes("ui/")) {
134
+ componentFiles.push(file);
135
+ } else if (file.includes("service") || file.includes("api/")) {
136
+ serviceFiles.push(file);
137
+ } else if (file.includes("util") || file.includes("helper") || file.includes("lib/")) {
138
+ utilityFiles.push(file);
139
+ }
140
+ }
141
+ if (srcDirs.size > 2 && !docExists("concepts/architecture/overview.md")) {
142
+ tasks.push({
143
+ directory: "concepts/architecture",
144
+ type: "concept",
145
+ agentType: "analyst",
146
+ prompt: buildArchitecturePrompt(context, Array.from(srcDirs)),
147
+ outputFile: "concepts/architecture/overview.md"
148
+ });
149
+ }
150
+ if (frameworks.includes("React") || frameworks.includes("Vue")) {
151
+ if (componentFiles.length > 0 && !docExists("components/ui/overview.md")) {
152
+ tasks.push({
153
+ directory: "components/ui",
154
+ type: "component",
155
+ agentType: "coder",
156
+ prompt: buildComponentPrompt(context, componentFiles.slice(0, 10)),
157
+ outputFile: "components/ui/overview.md"
158
+ });
159
+ }
160
+ }
161
+ if (serviceFiles.length > 0 && !docExists("services/api/overview.md")) {
162
+ tasks.push({
163
+ directory: "services/api",
164
+ type: "service",
165
+ agentType: "coder",
166
+ prompt: buildServicePrompt(context, serviceFiles.slice(0, 10)),
167
+ outputFile: "services/api/overview.md"
168
+ });
169
+ }
170
+ if (utilityFiles.length > 0 && !docExists("components/utilities/overview.md")) {
171
+ tasks.push({
172
+ directory: "components/utilities",
173
+ type: "component",
174
+ agentType: "coder",
175
+ prompt: buildUtilityPrompt(context, utilityFiles.slice(0, 10)),
176
+ outputFile: "components/utilities/overview.md"
177
+ });
178
+ }
179
+ if (!docExists("guides/getting-started/quick-start.md")) {
180
+ tasks.push({
181
+ directory: "guides/getting-started",
182
+ type: "guide",
183
+ agentType: "researcher",
184
+ prompt: buildGettingStartedPrompt(context),
185
+ outputFile: "guides/getting-started/quick-start.md"
186
+ });
187
+ }
188
+ const hasLinting = existsSync(join(projectRoot, ".eslintrc.json")) || existsSync(join(projectRoot, ".eslintrc.js")) || existsSync(join(projectRoot, "eslint.config.js"));
189
+ const hasTypescript = existsSync(join(projectRoot, "tsconfig.json"));
190
+ if ((hasLinting || hasTypescript) && !docExists("standards/coding-standards/guide.md")) {
191
+ tasks.push({
192
+ directory: "standards/coding-standards",
193
+ type: "standard",
194
+ agentType: "analyst",
195
+ prompt: buildCodingStandardsPrompt(context, hasTypescript, hasLinting),
196
+ outputFile: "standards/coding-standards/guide.md"
197
+ });
198
+ }
199
+ if (frameworks.includes("Prisma") && !docExists("integrations/databases/prisma.md")) {
200
+ tasks.push({
201
+ directory: "integrations/databases",
202
+ type: "integration",
203
+ agentType: "coder",
204
+ prompt: buildPrismaPrompt(context),
205
+ outputFile: "integrations/databases/prisma.md"
206
+ });
207
+ }
208
+ return tasks;
209
+ }
210
+ async function executeAgentTask(task, context, verbose) {
211
+ const { docsPath } = context;
212
+ const outputPath = join(docsPath, task.outputFile);
213
+ const hasClaudeFlow = await checkClaudeFlowAvailable();
214
+ let content;
215
+ if (hasClaudeFlow) {
216
+ content = await executeWithClaudeFlow(task, context, verbose);
217
+ } else {
218
+ content = generateLocalTemplate(task, context);
219
+ }
220
+ writeFileSync(outputPath, content, "utf-8");
221
+ return {
222
+ path: task.outputFile,
223
+ title: extractTitle(content) || basename(task.outputFile, ".md"),
224
+ type: task.type,
225
+ generated: true
226
+ };
227
+ }
228
+ async function checkClaudeFlowAvailable() {
229
+ return new Promise((resolve) => {
230
+ const proc = spawn("npx", ["claude-flow@alpha", "--version"], {
231
+ stdio: "pipe",
232
+ shell: true
233
+ });
234
+ proc.on("close", (code) => {
235
+ resolve(code === 0);
236
+ });
237
+ proc.on("error", () => {
238
+ resolve(false);
239
+ });
240
+ setTimeout(() => {
241
+ proc.kill();
242
+ resolve(false);
243
+ }, 5e3);
244
+ });
245
+ }
246
+ async function executeWithClaudeFlow(task, context, verbose) {
247
+ return new Promise((resolve, reject) => {
248
+ const agentCmd = `npx claude-flow@alpha sparc run ${task.agentType} "${task.prompt.replace(/"/g, '\\"')}"`;
249
+ if (verbose) {
250
+ console.log(`
251
+ Spawning ${task.agentType} agent for ${task.outputFile}...`);
252
+ }
253
+ const proc = spawn(agentCmd, {
254
+ shell: true,
255
+ cwd: context.projectRoot,
256
+ stdio: verbose ? "inherit" : "pipe"
257
+ });
258
+ let output = "";
259
+ if (proc.stdout) {
260
+ proc.stdout.on("data", (data) => {
261
+ output += data.toString();
262
+ });
263
+ }
264
+ proc.on("close", (code) => {
265
+ if (code === 0 && output) {
266
+ resolve(output);
267
+ } else {
268
+ resolve(generateLocalTemplate(task, context));
269
+ }
270
+ });
271
+ proc.on("error", () => {
272
+ resolve(generateLocalTemplate(task, context));
273
+ });
274
+ setTimeout(() => {
275
+ proc.kill();
276
+ resolve(generateLocalTemplate(task, context));
277
+ }, 6e4);
278
+ });
279
+ }
280
+ function generateLocalTemplate(task, context) {
281
+ const date = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
282
+ const { projectName } = context;
283
+ const templates = {
284
+ "concepts/architecture/overview.md": `---
285
+ title: Architecture Overview
286
+ type: concept
287
+ status: active
288
+ tags: [architecture, overview]
289
+ created: ${date}
290
+ ---
291
+
292
+ # Architecture Overview
293
+
294
+ High-level architecture documentation for ${projectName}.
295
+
296
+ ## System Overview
297
+
298
+ This document describes the overall architecture and design patterns used in ${projectName}.
299
+
300
+ ## Module Structure
301
+
302
+ ${context.sourceFiles.slice(0, 20).map((f) => `- \`${f}\``).join("\n")}
303
+
304
+ ## Key Patterns
305
+
306
+ *Document key architectural patterns here*
307
+
308
+ ## Design Decisions
309
+
310
+ *Add Architecture Decision Records (ADRs)*
311
+
312
+ ---
313
+ > Auto-generated by kg-agent
314
+ `,
315
+ "components/ui/overview.md": `---
316
+ title: UI Components Overview
317
+ type: technical
318
+ status: active
319
+ tags: [components, ui]
320
+ created: ${date}
321
+ ---
322
+
323
+ # UI Components
324
+
325
+ User interface components for ${projectName}.
326
+
327
+ ## Component Library
328
+
329
+ ${context.frameworks.includes("React") ? "Built with **React**." : ""}
330
+ ${context.frameworks.includes("Vue") ? "Built with **Vue**." : ""}
331
+
332
+ ## Available Components
333
+
334
+ *Document available UI components*
335
+
336
+ ## Usage Patterns
337
+
338
+ *Add component usage examples*
339
+
340
+ ---
341
+ > Auto-generated by kg-agent
342
+ `,
343
+ "services/api/overview.md": `---
344
+ title: API Services Overview
345
+ type: service
346
+ status: active
347
+ tags: [api, services]
348
+ created: ${date}
349
+ ---
350
+
351
+ # API Services
352
+
353
+ Backend API services for ${projectName}.
354
+
355
+ ## Endpoints
356
+
357
+ *Document API endpoints*
358
+
359
+ ## Authentication
360
+
361
+ *Document authentication flow*
362
+
363
+ ## Error Handling
364
+
365
+ *Document error handling patterns*
366
+
367
+ ---
368
+ > Auto-generated by kg-agent
369
+ `,
370
+ "components/utilities/overview.md": `---
371
+ title: Utilities Overview
372
+ type: technical
373
+ status: active
374
+ tags: [utilities, helpers]
375
+ created: ${date}
376
+ ---
377
+
378
+ # Utility Functions
379
+
380
+ Reusable utilities and helpers for ${projectName}.
381
+
382
+ ## Available Utilities
383
+
384
+ *Document available utilities*
385
+
386
+ ## Usage Examples
387
+
388
+ *Add code examples*
389
+
390
+ ---
391
+ > Auto-generated by kg-agent
392
+ `,
393
+ "guides/getting-started/quick-start.md": `---
394
+ title: Quick Start Guide
395
+ type: guide
396
+ status: active
397
+ tags: [guide, getting-started]
398
+ created: ${date}
399
+ ---
400
+
401
+ # Quick Start
402
+
403
+ Get up and running with ${projectName}.
404
+
405
+ ## Prerequisites
406
+
407
+ ${context.languages.map((l) => `- ${l}`).join("\n")}
408
+
409
+ ## Installation
410
+
411
+ \`\`\`bash
412
+ npm install
413
+ \`\`\`
414
+
415
+ ## Basic Usage
416
+
417
+ *Add basic usage instructions*
418
+
419
+ ## Next Steps
420
+
421
+ - [[concepts/architecture/overview|Architecture Overview]]
422
+ - [[guides/_MOC|More Guides]]
423
+
424
+ ---
425
+ > Auto-generated by kg-agent
426
+ `,
427
+ "standards/coding-standards/guide.md": `---
428
+ title: Coding Standards
429
+ type: standard
430
+ status: active
431
+ tags: [standards, coding]
432
+ created: ${date}
433
+ ---
434
+
435
+ # Coding Standards
436
+
437
+ Code style and conventions for ${projectName}.
438
+
439
+ ## Language Standards
440
+
441
+ ${context.languages.map((l) => `### ${l}
442
+
443
+ *Add ${l} specific standards*`).join("\n\n")}
444
+
445
+ ## Linting Configuration
446
+
447
+ *Document ESLint/Prettier setup*
448
+
449
+ ## Best Practices
450
+
451
+ *Add coding best practices*
452
+
453
+ ---
454
+ > Auto-generated by kg-agent
455
+ `,
456
+ "integrations/databases/prisma.md": `---
457
+ title: Prisma Integration
458
+ type: integration
459
+ status: active
460
+ tags: [prisma, database, orm]
461
+ created: ${date}
462
+ ---
463
+
464
+ # Prisma Integration
465
+
466
+ Database ORM configuration for ${projectName}.
467
+
468
+ ## Schema Location
469
+
470
+ \`prisma/schema.prisma\`
471
+
472
+ ## Models
473
+
474
+ *Document database models*
475
+
476
+ ## Migrations
477
+
478
+ \`\`\`bash
479
+ npx prisma migrate dev
480
+ \`\`\`
481
+
482
+ ## Client Usage
483
+
484
+ *Add Prisma client usage examples*
485
+
486
+ ---
487
+ > Auto-generated by kg-agent
488
+ `
489
+ };
490
+ return templates[task.outputFile] || generateGenericTemplate(task, context, date);
491
+ }
492
+ function generateGenericTemplate(task, context, date) {
493
+ const title = basename(task.outputFile, ".md").split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
494
+ return `---
495
+ title: ${title}
496
+ type: ${task.type}
497
+ status: draft
498
+ tags: [${task.type}]
499
+ created: ${date}
500
+ ---
501
+
502
+ # ${title}
503
+
504
+ Documentation for ${context.projectName}.
505
+
506
+ ## Overview
507
+
508
+ *Add overview content*
509
+
510
+ ## Details
511
+
512
+ *Add detailed documentation*
513
+
514
+ ---
515
+ > Auto-generated by kg-agent
516
+ `;
517
+ }
518
+ function extractTitle(content) {
519
+ const match = content.match(/^#\s+(.+)$/m);
520
+ return match ? match[1] : null;
521
+ }
522
+ function buildArchitecturePrompt(context, dirs) {
523
+ return `Analyze the architecture of ${context.projectName}.
524
+ Modules: ${dirs.join(", ")}.
525
+ Languages: ${context.languages.join(", ")}.
526
+ Generate an Architecture Overview markdown document with system design, patterns, and key decisions.`;
527
+ }
528
+ function buildComponentPrompt(context, files) {
529
+ return `Document the UI components in ${context.projectName}.
530
+ Frameworks: ${context.frameworks.join(", ")}.
531
+ Component files: ${files.join(", ")}.
532
+ Generate a Components Overview markdown document.`;
533
+ }
534
+ function buildServicePrompt(context, files) {
535
+ return `Document the API services in ${context.projectName}.
536
+ Service files: ${files.join(", ")}.
537
+ Generate an API Services Overview markdown document with endpoints and patterns.`;
538
+ }
539
+ function buildUtilityPrompt(context, files) {
540
+ return `Document utility functions in ${context.projectName}.
541
+ Utility files: ${files.join(", ")}.
542
+ Generate a Utilities Overview markdown document.`;
543
+ }
544
+ function buildGettingStartedPrompt(context) {
545
+ return `Create a Quick Start guide for ${context.projectName}.
546
+ Languages: ${context.languages.join(", ")}.
547
+ Frameworks: ${context.frameworks.join(", ")}.
548
+ Generate a Getting Started guide with installation and basic usage.`;
549
+ }
550
+ function buildCodingStandardsPrompt(context, hasTypescript, hasLinting) {
551
+ return `Document coding standards for ${context.projectName}.
552
+ TypeScript: ${hasTypescript ? "yes" : "no"}.
553
+ ESLint: ${hasLinting ? "yes" : "no"}.
554
+ Generate a Coding Standards guide with style rules and best practices.`;
555
+ }
556
+ function buildPrismaPrompt(context) {
557
+ return `Document Prisma database integration for ${context.projectName}.
558
+ Generate integration documentation with schema, models, and usage patterns.`;
559
+ }
560
+ export {
561
+ generateDocsWithAgents
562
+ };
563
+ //# sourceMappingURL=doc-generator-agents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doc-generator-agents.js","sources":["../../src/generators/doc-generator-agents.ts"],"sourcesContent":["/**\n * Agent-Driven Document Generator\n *\n * Spawns expert agents from claude-flow to analyze existing code and\n * documentation, then generates appropriate documents for each directory.\n */\n\nimport { existsSync, readFileSync, writeFileSync, readdirSync, statSync } from 'fs';\nimport { join, basename, extname, relative } from 'path';\nimport fg from 'fast-glob';\nimport { spawn } from 'child_process';\n\n/**\n * Document generation context\n */\nexport interface GenerationContext {\n projectRoot: string;\n docsPath: string;\n projectName: string;\n languages: string[];\n frameworks: string[];\n existingDocs: string[];\n sourceFiles: string[];\n}\n\n/**\n * Generation result for a single document\n */\nexport interface GeneratedDoc {\n path: string;\n title: string;\n type: string;\n generated: boolean;\n error?: string;\n}\n\n/**\n * Overall generation result\n */\nexport interface AgentGenerationResult {\n success: boolean;\n documentsGenerated: GeneratedDoc[];\n agentsSpawned: number;\n errors: string[];\n}\n\n/**\n * Agent task definition\n */\ninterface AgentTask {\n directory: string;\n type: 'concept' | 'component' | 'service' | 'feature' | 'integration' | 'standard' | 'guide' | 'reference';\n agentType: 'researcher' | 'coder' | 'analyst';\n prompt: string;\n outputFile: string;\n}\n\n/**\n * Analyze project and generate documents using expert agents\n */\nexport async function generateDocsWithAgents(\n projectRoot: string,\n docsPath: string,\n options: {\n parallel?: boolean;\n dryRun?: boolean;\n verbose?: boolean;\n } = {}\n): Promise<AgentGenerationResult> {\n const result: AgentGenerationResult = {\n success: true,\n documentsGenerated: [],\n agentsSpawned: 0,\n errors: [],\n };\n\n try {\n // Build context by analyzing the project\n const context = await buildGenerationContext(projectRoot, docsPath);\n\n // Determine what documents should be generated\n const tasks = await planDocumentGeneration(context);\n\n if (options.dryRun) {\n console.log('\\n[Dry Run] Would generate the following documents:');\n for (const task of tasks) {\n console.log(` - ${task.outputFile} (${task.agentType} agent)`);\n }\n return result;\n }\n\n // Execute tasks (parallel or sequential)\n if (options.parallel) {\n const results = await Promise.allSettled(\n tasks.map(task => executeAgentTask(task, context, options.verbose))\n );\n\n for (let i = 0; i < results.length; i++) {\n const r = results[i];\n result.agentsSpawned++;\n\n if (r.status === 'fulfilled') {\n result.documentsGenerated.push(r.value);\n } else {\n result.errors.push(`Failed: ${tasks[i].outputFile} - ${r.reason}`);\n result.documentsGenerated.push({\n path: tasks[i].outputFile,\n title: basename(tasks[i].outputFile, '.md'),\n type: tasks[i].type,\n generated: false,\n error: String(r.reason),\n });\n }\n }\n } else {\n // Sequential execution\n for (const task of tasks) {\n result.agentsSpawned++;\n\n try {\n const doc = await executeAgentTask(task, context, options.verbose);\n result.documentsGenerated.push(doc);\n } catch (error) {\n result.errors.push(`Failed: ${task.outputFile} - ${error}`);\n result.documentsGenerated.push({\n path: task.outputFile,\n title: basename(task.outputFile, '.md'),\n type: task.type,\n generated: false,\n error: String(error),\n });\n }\n }\n }\n\n result.success = result.errors.length === 0;\n } catch (error) {\n result.success = false;\n result.errors.push(`Generation failed: ${error}`);\n }\n\n return result;\n}\n\n/**\n * Build context by analyzing the project\n */\nasync function buildGenerationContext(\n projectRoot: string,\n docsPath: string\n): Promise<GenerationContext> {\n const context: GenerationContext = {\n projectRoot,\n docsPath,\n projectName: basename(projectRoot),\n languages: [],\n frameworks: [],\n existingDocs: [],\n sourceFiles: [],\n };\n\n // Get project name from package.json\n const pkgPath = join(projectRoot, 'package.json');\n if (existsSync(pkgPath)) {\n try {\n const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));\n context.projectName = pkg.name?.replace(/^@[^/]+\\//, '') || context.projectName;\n\n // Detect frameworks from dependencies\n const deps = { ...pkg.dependencies, ...pkg.devDependencies };\n if (deps.react) context.frameworks.push('React');\n if (deps.next) context.frameworks.push('Next.js');\n if (deps.vue) context.frameworks.push('Vue');\n if (deps.express) context.frameworks.push('Express');\n if (deps.fastify) context.frameworks.push('Fastify');\n if (deps['@prisma/client'] || deps.prisma) context.frameworks.push('Prisma');\n } catch {\n // Ignore parse errors\n }\n }\n\n // Detect languages\n if (existsSync(join(projectRoot, 'tsconfig.json'))) {\n context.languages.push('TypeScript');\n }\n if (existsSync(join(projectRoot, 'package.json'))) {\n context.languages.push('JavaScript');\n }\n if (existsSync(join(projectRoot, 'requirements.txt')) || existsSync(join(projectRoot, 'pyproject.toml'))) {\n context.languages.push('Python');\n }\n if (existsSync(join(projectRoot, 'Cargo.toml'))) {\n context.languages.push('Rust');\n }\n if (existsSync(join(projectRoot, 'go.mod'))) {\n context.languages.push('Go');\n }\n\n // Find existing docs\n const existingDocs = await fg('**/*.md', {\n cwd: docsPath,\n ignore: ['node_modules/**', '.git/**', '_templates/**'],\n });\n context.existingDocs = existingDocs;\n\n // Find source files\n const sourceFiles = await fg('**/*.{ts,tsx,js,jsx,py,rs,go}', {\n cwd: projectRoot,\n ignore: ['node_modules/**', '.git/**', 'dist/**', 'build/**', docsPath + '/**'],\n dot: true,\n });\n context.sourceFiles = sourceFiles;\n\n return context;\n}\n\n/**\n * Plan what documents should be generated based on context\n */\nasync function planDocumentGeneration(context: GenerationContext): Promise<AgentTask[]> {\n const tasks: AgentTask[] = [];\n const { projectRoot, docsPath, sourceFiles, frameworks } = context;\n\n // Helper to check if doc already exists\n const docExists = (relativePath: string) => {\n return existsSync(join(docsPath, relativePath));\n };\n\n // Analyze source structure to determine what docs to generate\n const srcDirs = new Set<string>();\n const componentFiles: string[] = [];\n const serviceFiles: string[] = [];\n const utilityFiles: string[] = [];\n\n for (const file of sourceFiles) {\n const dir = file.split('/')[0];\n srcDirs.add(dir);\n\n // Categorize files\n if (file.includes('component') || file.includes('ui/')) {\n componentFiles.push(file);\n } else if (file.includes('service') || file.includes('api/')) {\n serviceFiles.push(file);\n } else if (file.includes('util') || file.includes('helper') || file.includes('lib/')) {\n utilityFiles.push(file);\n }\n }\n\n // Generate architecture overview if source has multiple modules\n if (srcDirs.size > 2 && !docExists('concepts/architecture/overview.md')) {\n tasks.push({\n directory: 'concepts/architecture',\n type: 'concept',\n agentType: 'analyst',\n prompt: buildArchitecturePrompt(context, Array.from(srcDirs)),\n outputFile: 'concepts/architecture/overview.md',\n });\n }\n\n // Generate component docs for detected UI frameworks\n if (frameworks.includes('React') || frameworks.includes('Vue')) {\n if (componentFiles.length > 0 && !docExists('components/ui/overview.md')) {\n tasks.push({\n directory: 'components/ui',\n type: 'component',\n agentType: 'coder',\n prompt: buildComponentPrompt(context, componentFiles.slice(0, 10)),\n outputFile: 'components/ui/overview.md',\n });\n }\n }\n\n // Generate service docs if API files detected\n if (serviceFiles.length > 0 && !docExists('services/api/overview.md')) {\n tasks.push({\n directory: 'services/api',\n type: 'service',\n agentType: 'coder',\n prompt: buildServicePrompt(context, serviceFiles.slice(0, 10)),\n outputFile: 'services/api/overview.md',\n });\n }\n\n // Generate utility docs\n if (utilityFiles.length > 0 && !docExists('components/utilities/overview.md')) {\n tasks.push({\n directory: 'components/utilities',\n type: 'component',\n agentType: 'coder',\n prompt: buildUtilityPrompt(context, utilityFiles.slice(0, 10)),\n outputFile: 'components/utilities/overview.md',\n });\n }\n\n // Generate getting started guide\n if (!docExists('guides/getting-started/quick-start.md')) {\n tasks.push({\n directory: 'guides/getting-started',\n type: 'guide',\n agentType: 'researcher',\n prompt: buildGettingStartedPrompt(context),\n outputFile: 'guides/getting-started/quick-start.md',\n });\n }\n\n // Generate standards/coding guide if tsconfig or eslint exists\n const hasLinting = existsSync(join(projectRoot, '.eslintrc.json')) ||\n existsSync(join(projectRoot, '.eslintrc.js')) ||\n existsSync(join(projectRoot, 'eslint.config.js'));\n const hasTypescript = existsSync(join(projectRoot, 'tsconfig.json'));\n\n if ((hasLinting || hasTypescript) && !docExists('standards/coding-standards/guide.md')) {\n tasks.push({\n directory: 'standards/coding-standards',\n type: 'standard',\n agentType: 'analyst',\n prompt: buildCodingStandardsPrompt(context, hasTypescript, hasLinting),\n outputFile: 'standards/coding-standards/guide.md',\n });\n }\n\n // Generate integration docs for detected databases/services\n if (frameworks.includes('Prisma') && !docExists('integrations/databases/prisma.md')) {\n tasks.push({\n directory: 'integrations/databases',\n type: 'integration',\n agentType: 'coder',\n prompt: buildPrismaPrompt(context),\n outputFile: 'integrations/databases/prisma.md',\n });\n }\n\n return tasks;\n}\n\n/**\n * Execute a single agent task\n */\nasync function executeAgentTask(\n task: AgentTask,\n context: GenerationContext,\n verbose?: boolean\n): Promise<GeneratedDoc> {\n const { docsPath } = context;\n const outputPath = join(docsPath, task.outputFile);\n\n // Try to use claude-flow if available, otherwise generate locally\n const hasClaudeFlow = await checkClaudeFlowAvailable();\n\n let content: string;\n\n if (hasClaudeFlow) {\n content = await executeWithClaudeFlow(task, context, verbose);\n } else {\n // Fallback to local template generation\n content = generateLocalTemplate(task, context);\n }\n\n // Write the file\n writeFileSync(outputPath, content, 'utf-8');\n\n return {\n path: task.outputFile,\n title: extractTitle(content) || basename(task.outputFile, '.md'),\n type: task.type,\n generated: true,\n };\n}\n\n/**\n * Check if claude-flow is available\n */\nasync function checkClaudeFlowAvailable(): Promise<boolean> {\n return new Promise((resolve) => {\n const proc = spawn('npx', ['claude-flow@alpha', '--version'], {\n stdio: 'pipe',\n shell: true,\n });\n\n proc.on('close', (code) => {\n resolve(code === 0);\n });\n\n proc.on('error', () => {\n resolve(false);\n });\n\n // Timeout after 5 seconds\n setTimeout(() => {\n proc.kill();\n resolve(false);\n }, 5000);\n });\n}\n\n/**\n * Execute task using claude-flow expert agents\n */\nasync function executeWithClaudeFlow(\n task: AgentTask,\n context: GenerationContext,\n verbose?: boolean\n): Promise<string> {\n return new Promise((resolve, reject) => {\n const agentCmd = `npx claude-flow@alpha sparc run ${task.agentType} \"${task.prompt.replace(/\"/g, '\\\\\"')}\"`;\n\n if (verbose) {\n console.log(`\\n Spawning ${task.agentType} agent for ${task.outputFile}...`);\n }\n\n const proc = spawn(agentCmd, {\n shell: true,\n cwd: context.projectRoot,\n stdio: verbose ? 'inherit' : 'pipe',\n });\n\n let output = '';\n\n if (proc.stdout) {\n proc.stdout.on('data', (data) => {\n output += data.toString();\n });\n }\n\n proc.on('close', (code) => {\n if (code === 0 && output) {\n resolve(output);\n } else {\n // Fallback to local generation\n resolve(generateLocalTemplate(task, context));\n }\n });\n\n proc.on('error', () => {\n resolve(generateLocalTemplate(task, context));\n });\n\n // Timeout after 60 seconds\n setTimeout(() => {\n proc.kill();\n resolve(generateLocalTemplate(task, context));\n }, 60000);\n });\n}\n\n/**\n * Generate document using local templates (fallback)\n */\nfunction generateLocalTemplate(task: AgentTask, context: GenerationContext): string {\n const date = new Date().toISOString().split('T')[0];\n const { projectName } = context;\n\n const templates: Record<string, string> = {\n 'concepts/architecture/overview.md': `---\ntitle: Architecture Overview\ntype: concept\nstatus: active\ntags: [architecture, overview]\ncreated: ${date}\n---\n\n# Architecture Overview\n\nHigh-level architecture documentation for ${projectName}.\n\n## System Overview\n\nThis document describes the overall architecture and design patterns used in ${projectName}.\n\n## Module Structure\n\n${context.sourceFiles.slice(0, 20).map(f => `- \\`${f}\\``).join('\\n')}\n\n## Key Patterns\n\n*Document key architectural patterns here*\n\n## Design Decisions\n\n*Add Architecture Decision Records (ADRs)*\n\n---\n> Auto-generated by kg-agent\n`,\n\n 'components/ui/overview.md': `---\ntitle: UI Components Overview\ntype: technical\nstatus: active\ntags: [components, ui]\ncreated: ${date}\n---\n\n# UI Components\n\nUser interface components for ${projectName}.\n\n## Component Library\n\n${context.frameworks.includes('React') ? 'Built with **React**.' : ''}\n${context.frameworks.includes('Vue') ? 'Built with **Vue**.' : ''}\n\n## Available Components\n\n*Document available UI components*\n\n## Usage Patterns\n\n*Add component usage examples*\n\n---\n> Auto-generated by kg-agent\n`,\n\n 'services/api/overview.md': `---\ntitle: API Services Overview\ntype: service\nstatus: active\ntags: [api, services]\ncreated: ${date}\n---\n\n# API Services\n\nBackend API services for ${projectName}.\n\n## Endpoints\n\n*Document API endpoints*\n\n## Authentication\n\n*Document authentication flow*\n\n## Error Handling\n\n*Document error handling patterns*\n\n---\n> Auto-generated by kg-agent\n`,\n\n 'components/utilities/overview.md': `---\ntitle: Utilities Overview\ntype: technical\nstatus: active\ntags: [utilities, helpers]\ncreated: ${date}\n---\n\n# Utility Functions\n\nReusable utilities and helpers for ${projectName}.\n\n## Available Utilities\n\n*Document available utilities*\n\n## Usage Examples\n\n*Add code examples*\n\n---\n> Auto-generated by kg-agent\n`,\n\n 'guides/getting-started/quick-start.md': `---\ntitle: Quick Start Guide\ntype: guide\nstatus: active\ntags: [guide, getting-started]\ncreated: ${date}\n---\n\n# Quick Start\n\nGet up and running with ${projectName}.\n\n## Prerequisites\n\n${context.languages.map(l => `- ${l}`).join('\\n')}\n\n## Installation\n\n\\`\\`\\`bash\nnpm install\n\\`\\`\\`\n\n## Basic Usage\n\n*Add basic usage instructions*\n\n## Next Steps\n\n- [[concepts/architecture/overview|Architecture Overview]]\n- [[guides/_MOC|More Guides]]\n\n---\n> Auto-generated by kg-agent\n`,\n\n 'standards/coding-standards/guide.md': `---\ntitle: Coding Standards\ntype: standard\nstatus: active\ntags: [standards, coding]\ncreated: ${date}\n---\n\n# Coding Standards\n\nCode style and conventions for ${projectName}.\n\n## Language Standards\n\n${context.languages.map(l => `### ${l}\\n\\n*Add ${l} specific standards*`).join('\\n\\n')}\n\n## Linting Configuration\n\n*Document ESLint/Prettier setup*\n\n## Best Practices\n\n*Add coding best practices*\n\n---\n> Auto-generated by kg-agent\n`,\n\n 'integrations/databases/prisma.md': `---\ntitle: Prisma Integration\ntype: integration\nstatus: active\ntags: [prisma, database, orm]\ncreated: ${date}\n---\n\n# Prisma Integration\n\nDatabase ORM configuration for ${projectName}.\n\n## Schema Location\n\n\\`prisma/schema.prisma\\`\n\n## Models\n\n*Document database models*\n\n## Migrations\n\n\\`\\`\\`bash\nnpx prisma migrate dev\n\\`\\`\\`\n\n## Client Usage\n\n*Add Prisma client usage examples*\n\n---\n> Auto-generated by kg-agent\n`,\n };\n\n return templates[task.outputFile] || generateGenericTemplate(task, context, date);\n}\n\n/**\n * Generate a generic template for unknown task types\n */\nfunction generateGenericTemplate(\n task: AgentTask,\n context: GenerationContext,\n date: string\n): string {\n const title = basename(task.outputFile, '.md')\n .split('-')\n .map(w => w.charAt(0).toUpperCase() + w.slice(1))\n .join(' ');\n\n return `---\ntitle: ${title}\ntype: ${task.type}\nstatus: draft\ntags: [${task.type}]\ncreated: ${date}\n---\n\n# ${title}\n\nDocumentation for ${context.projectName}.\n\n## Overview\n\n*Add overview content*\n\n## Details\n\n*Add detailed documentation*\n\n---\n> Auto-generated by kg-agent\n`;\n}\n\n/**\n * Extract title from markdown content\n */\nfunction extractTitle(content: string): string | null {\n const match = content.match(/^#\\s+(.+)$/m);\n return match ? match[1] : null;\n}\n\n// Prompt builders\n\nfunction buildArchitecturePrompt(context: GenerationContext, dirs: string[]): string {\n return `Analyze the architecture of ${context.projectName}.\nModules: ${dirs.join(', ')}.\nLanguages: ${context.languages.join(', ')}.\nGenerate an Architecture Overview markdown document with system design, patterns, and key decisions.`;\n}\n\nfunction buildComponentPrompt(context: GenerationContext, files: string[]): string {\n return `Document the UI components in ${context.projectName}.\nFrameworks: ${context.frameworks.join(', ')}.\nComponent files: ${files.join(', ')}.\nGenerate a Components Overview markdown document.`;\n}\n\nfunction buildServicePrompt(context: GenerationContext, files: string[]): string {\n return `Document the API services in ${context.projectName}.\nService files: ${files.join(', ')}.\nGenerate an API Services Overview markdown document with endpoints and patterns.`;\n}\n\nfunction buildUtilityPrompt(context: GenerationContext, files: string[]): string {\n return `Document utility functions in ${context.projectName}.\nUtility files: ${files.join(', ')}.\nGenerate a Utilities Overview markdown document.`;\n}\n\nfunction buildGettingStartedPrompt(context: GenerationContext): string {\n return `Create a Quick Start guide for ${context.projectName}.\nLanguages: ${context.languages.join(', ')}.\nFrameworks: ${context.frameworks.join(', ')}.\nGenerate a Getting Started guide with installation and basic usage.`;\n}\n\nfunction buildCodingStandardsPrompt(\n context: GenerationContext,\n hasTypescript: boolean,\n hasLinting: boolean\n): string {\n return `Document coding standards for ${context.projectName}.\nTypeScript: ${hasTypescript ? 'yes' : 'no'}.\nESLint: ${hasLinting ? 'yes' : 'no'}.\nGenerate a Coding Standards guide with style rules and best practices.`;\n}\n\nfunction buildPrismaPrompt(context: GenerationContext): string {\n return `Document Prisma database integration for ${context.projectName}.\nGenerate integration documentation with schema, models, and usage patterns.`;\n}\n"],"names":[],"mappings":";;;;AA4DA,eAAsB,uBACpB,aACA,UACA,UAII,CAAA,GAC4B;AAChC,QAAM,SAAgC;AAAA,IACpC,SAAS;AAAA,IACT,oBAAoB,CAAA;AAAA,IACpB,eAAe;AAAA,IACf,QAAQ,CAAA;AAAA,EAAC;AAGX,MAAI;AAEF,UAAM,UAAU,MAAM,uBAAuB,aAAa,QAAQ;AAGlE,UAAM,QAAQ,MAAM,uBAAuB,OAAO;AAElD,QAAI,QAAQ,QAAQ;AAClB,cAAQ,IAAI,qDAAqD;AACjE,iBAAW,QAAQ,OAAO;AACxB,gBAAQ,IAAI,OAAO,KAAK,UAAU,KAAK,KAAK,SAAS,SAAS;AAAA,MAChE;AACA,aAAO;AAAA,IACT;AAGA,QAAI,QAAQ,UAAU;AACpB,YAAM,UAAU,MAAM,QAAQ;AAAA,QAC5B,MAAM,IAAI,CAAA,SAAQ,iBAAiB,MAAM,SAAS,QAAQ,OAAO,CAAC;AAAA,MAAA;AAGpE,eAAS,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;AACvC,cAAM,IAAI,QAAQ,CAAC;AACnB,eAAO;AAEP,YAAI,EAAE,WAAW,aAAa;AAC5B,iBAAO,mBAAmB,KAAK,EAAE,KAAK;AAAA,QACxC,OAAO;AACL,iBAAO,OAAO,KAAK,WAAW,MAAM,CAAC,EAAE,UAAU,MAAM,EAAE,MA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mBAAmB,SAA4B,OAAyB;AAC/E,SAAO,gCAAgC,QAAQ,WAAW;AAAA,iBAC3C,MAAM,KAAK,IAAI,CAAC;AAAA;AAEjC;AAEA,SAAS,mBAAmB,SAA4B,OAAyB;AAC/E,SAAO,iCAAiC,QAAQ,WAAW;AAAA,iBAC5C,MAAM,KAAK,IAAI,CAAC;AAAA;AAEjC;AAEA,SAAS,0BAA0B,SAAoC;AACrE,SAAO,kCAAkC,QAAQ,WAAW;AAAA,aACjD,QAAQ,UAAU,KAAK,IAAI,CAAC;AAAA,cAC3B,QAAQ,WAAW,KAAK,IAAI,CAAC;AAAA;AAE3C;AAEA,SAAS,2BACP,SACA,eACA,YACQ;AACR,SAAO,iCAAiC,QAAQ,WAAW;AAAA,cAC/C,gBAAgB,QAAQ,IAAI;AAAA,UAChC,aAAa,QAAQ,IAAI;AAAA;AAEnC;AAEA,SAAS,kBAAkB,SAAoC;AAC7D,SAAO,4CAA4C,QAAQ,WAAW;AAAA;AAExE;"}
@@ -1 +1 @@
1
- {"version":3,"file":"docs-init.d.ts","sourceRoot":"","sources":["../../src/generators/docs-init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EAEf,MAAM,kBAAkB,CAAC;AAukB1B;;GAEG;AACH,wBAAsB,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CA6FhF;AAmPD;;GAEG;AACH,wBAAgB,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,SAAS,GAAG,OAAO,CAEzE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAW9D"}
1
+ {"version":3,"file":"docs-init.d.ts","sourceRoot":"","sources":["../../src/generators/docs-init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EAEf,MAAM,kBAAkB,CAAC;AAgmC1B;;GAEG;AACH,wBAAsB,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CA6FhF;AAmPD;;GAEG;AACH,wBAAgB,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,SAAS,GAAG,OAAO,CAEzE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAW9D"}