@weavelogic/knowledge-graph-agent 0.8.7 → 0.8.8

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.
@@ -4,6 +4,15 @@
4
4
  * Spawns expert agents from claude-flow to analyze existing code and
5
5
  * documentation, then generates appropriate documents for each directory.
6
6
  */
7
+ /**
8
+ * Service documentation found in src/{service}/docs directories
9
+ */
10
+ interface ServiceDoc {
11
+ serviceName: string;
12
+ sourcePath: string;
13
+ fileName: string;
14
+ relativePath: string;
15
+ }
7
16
  /**
8
17
  * Document generation context
9
18
  */
@@ -15,6 +24,7 @@ export interface GenerationContext {
15
24
  frameworks: string[];
16
25
  existingDocs: string[];
17
26
  sourceFiles: string[];
27
+ serviceDocs: ServiceDoc[];
18
28
  }
19
29
  /**
20
30
  * Generation result for a single document
@@ -44,4 +54,5 @@ export declare function generateDocsWithAgents(projectRoot: string, docsPath: st
44
54
  verbose?: boolean;
45
55
  force?: boolean;
46
56
  }): Promise<AgentGenerationResult>;
57
+ export {};
47
58
  //# sourceMappingURL=doc-generator-agents.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"doc-generator-agents.d.ts","sourceRoot":"","sources":["../../src/generators/doc-generator-agents.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,kBAAkB,EAAE,YAAY,EAAE,CAAC;IACnC,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAaD;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE;IACP,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;CACZ,GACL,OAAO,CAAC,qBAAqB,CAAC,CA0EhC"}
1
+ {"version":3,"file":"doc-generator-agents.d.ts","sourceRoot":"","sources":["../../src/generators/doc-generator-agents.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH;;GAEG;AACH,UAAU,UAAU;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,kBAAkB,EAAE,YAAY,EAAE,CAAC;IACnC,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAaD;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE;IACP,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;CACZ,GACL,OAAO,CAAC,qBAAqB,CAAC,CAuFhC"}
@@ -1,5 +1,5 @@
1
- import { existsSync, readFileSync, writeFileSync } from "fs";
2
- import { basename, join } from "path";
1
+ import { existsSync, readFileSync, readdirSync, mkdirSync, copyFileSync, writeFileSync } from "fs";
2
+ import { basename, join, dirname } from "path";
3
3
  import fg from "fast-glob";
4
4
  import { spawn } from "child_process";
5
5
  async function generateDocsWithAgents(projectRoot, docsPath, options = {}) {
@@ -17,8 +17,16 @@ async function generateDocsWithAgents(projectRoot, docsPath, options = {}) {
17
17
  for (const task of tasks) {
18
18
  console.log(` - ${task.outputFile} (${task.agentType} agent)`);
19
19
  }
20
+ if (context.serviceDocs.length > 0) {
21
+ console.log("\n[Dry Run] Would copy service docs:");
22
+ for (const doc of context.serviceDocs) {
23
+ const targetPath = `services/${doc.serviceName}/${doc.relativePath}`;
24
+ console.log(` - ${doc.sourcePath} → ${targetPath}`);
25
+ }
26
+ }
20
27
  return result;
21
28
  }
29
+ const copiedDocs = copyServiceDocs(context, options.force);
22
30
  if (options.parallel) {
23
31
  const results = await Promise.allSettled(
24
32
  tasks.map((task) => executeAgentTask(task, context, options.verbose))
@@ -57,6 +65,7 @@ async function generateDocsWithAgents(projectRoot, docsPath, options = {}) {
57
65
  }
58
66
  }
59
67
  }
68
+ result.documentsGenerated.push(...copiedDocs);
60
69
  result.success = result.errors.length === 0;
61
70
  } catch (error) {
62
71
  result.success = false;
@@ -64,6 +73,40 @@ async function generateDocsWithAgents(projectRoot, docsPath, options = {}) {
64
73
  }
65
74
  return result;
66
75
  }
76
+ function copyServiceDocs(context, force) {
77
+ const { docsPath, serviceDocs } = context;
78
+ const copied = [];
79
+ for (const doc of serviceDocs) {
80
+ const targetDir = join(docsPath, "services", doc.serviceName);
81
+ const targetPath = join(targetDir, doc.relativePath);
82
+ const relativeTarget = `services/${doc.serviceName}/${doc.relativePath}`;
83
+ if (!force && existsSync(targetPath)) {
84
+ continue;
85
+ }
86
+ try {
87
+ const targetFileDir = dirname(targetPath);
88
+ if (!existsSync(targetFileDir)) {
89
+ mkdirSync(targetFileDir, { recursive: true });
90
+ }
91
+ copyFileSync(doc.sourcePath, targetPath);
92
+ copied.push({
93
+ path: relativeTarget,
94
+ title: doc.fileName.replace(".md", ""),
95
+ type: "service",
96
+ generated: true
97
+ });
98
+ } catch (error) {
99
+ copied.push({
100
+ path: relativeTarget,
101
+ title: doc.fileName.replace(".md", ""),
102
+ type: "service",
103
+ generated: false,
104
+ error: String(error)
105
+ });
106
+ }
107
+ }
108
+ return copied;
109
+ }
67
110
  async function buildGenerationContext(projectRoot, docsPath) {
68
111
  const context = {
69
112
  projectRoot,
@@ -72,7 +115,8 @@ async function buildGenerationContext(projectRoot, docsPath) {
72
115
  languages: [],
73
116
  frameworks: [],
74
117
  existingDocs: [],
75
- sourceFiles: []
118
+ sourceFiles: [],
119
+ serviceDocs: []
76
120
  };
77
121
  const pkgPath = join(projectRoot, "package.json");
78
122
  if (existsSync(pkgPath)) {
@@ -142,6 +186,34 @@ async function buildGenerationContext(projectRoot, docsPath) {
142
186
  if (!context.languages.includes("Python") && sourceFiles.some((f) => f.endsWith(".py"))) {
143
187
  context.languages.push("Python");
144
188
  }
189
+ const serviceDocs = [];
190
+ const srcDir = join(projectRoot, "src");
191
+ if (existsSync(srcDir)) {
192
+ try {
193
+ const srcEntries = readdirSync(srcDir, { withFileTypes: true });
194
+ for (const entry of srcEntries) {
195
+ if (entry.isDirectory()) {
196
+ const serviceDocsDir = join(srcDir, entry.name, "docs");
197
+ if (existsSync(serviceDocsDir)) {
198
+ const docsFiles = await fg("**/*.md", {
199
+ cwd: serviceDocsDir,
200
+ ignore: ["node_modules/**", ".git/**"]
201
+ });
202
+ for (const docFile of docsFiles) {
203
+ serviceDocs.push({
204
+ serviceName: entry.name,
205
+ sourcePath: join(serviceDocsDir, docFile),
206
+ fileName: basename(docFile),
207
+ relativePath: docFile
208
+ });
209
+ }
210
+ }
211
+ }
212
+ }
213
+ } catch {
214
+ }
215
+ }
216
+ context.serviceDocs = serviceDocs;
145
217
  return context;
146
218
  }
147
219
  async function planDocumentGeneration(context, force) {
@@ -1 +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 force?: 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, options.force);\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\n // Detect Python - check multiple locations for requirements\n const pythonConfigPaths = [\n join(projectRoot, 'requirements.txt'),\n join(projectRoot, 'pyproject.toml'),\n join(projectRoot, 'src/backend/requirements.txt'),\n join(projectRoot, 'backend/requirements.txt'),\n join(projectRoot, 'src/requirements.txt'),\n ];\n const foundPythonConfig = pythonConfigPaths.find(p => existsSync(p));\n\n // Also detect Python if we find .py files later in source scan\n // For now, check if there's a Python config file\n if (foundPythonConfig) {\n context.languages.push('Python');\n\n // Detect Python frameworks from requirements.txt or pyproject.toml\n try {\n let reqContent = readFileSync(foundPythonConfig, 'utf-8').toLowerCase();\n // Also check pyproject.toml if we found requirements.txt\n if (foundPythonConfig.includes('requirements.txt')) {\n const pyprojectPath = join(projectRoot, 'pyproject.toml');\n if (existsSync(pyprojectPath)) {\n reqContent += readFileSync(pyprojectPath, 'utf-8').toLowerCase();\n }\n }\n if (reqContent.includes('fastapi')) context.frameworks.push('FastAPI');\n if (reqContent.includes('flask')) context.frameworks.push('Flask');\n if (reqContent.includes('django')) context.frameworks.push('Django');\n if (reqContent.includes('sqlalchemy')) context.frameworks.push('SQLAlchemy');\n if (reqContent.includes('pydantic')) context.frameworks.push('Pydantic');\n if (reqContent.includes('alembic')) context.frameworks.push('Alembic');\n } catch {\n // Ignore read errors\n }\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 // Detect Python from .py files if not already detected\n if (!context.languages.includes('Python') && sourceFiles.some(f => f.endsWith('.py'))) {\n context.languages.push('Python');\n }\n\n return context;\n}\n\n/**\n * Plan what documents should be generated based on context\n */\nasync function planDocumentGeneration(context: GenerationContext, force?: boolean): Promise<AgentTask[]> {\n const tasks: AgentTask[] = [];\n const { projectRoot, docsPath, sourceFiles, frameworks } = context;\n\n // Helper to check if doc already exists (returns false if force is true)\n const docExists = (relativePath: string) => {\n if (force) return false; // Force regeneration\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 const backendFiles: string[] = [];\n const modelFiles: string[] = [];\n const frontendFiles: string[] = [];\n\n for (const file of sourceFiles) {\n const dir = file.split('/')[0];\n srcDirs.add(dir);\n const fileLower = file.toLowerCase();\n\n // Categorize files (improved patterns for Python and TypeScript)\n if (fileLower.includes('component') || fileLower.includes('/ui/') || fileLower.includes('/views/')) {\n componentFiles.push(file);\n }\n if (fileLower.includes('service') || fileLower.includes('/api/') || fileLower.includes('routes') || fileLower.includes('endpoints')) {\n serviceFiles.push(file);\n }\n if (fileLower.includes('util') || fileLower.includes('helper') || fileLower.includes('/lib/') || fileLower.includes('common')) {\n utilityFiles.push(file);\n }\n if (fileLower.includes('backend') || fileLower.includes('server') || fileLower.includes('app/')) {\n backendFiles.push(file);\n }\n if (fileLower.includes('model') || fileLower.includes('schema') || fileLower.includes('entities')) {\n modelFiles.push(file);\n }\n if (fileLower.includes('frontend') || fileLower.includes('client') || fileLower.includes('pages')) {\n frontendFiles.push(file);\n }\n }\n\n // If no service files found but backend files exist, use backend files\n if (serviceFiles.length === 0 && backendFiles.length > 0) {\n serviceFiles.push(...backendFiles);\n }\n\n // Generate architecture overview if source has modules with files\n // Threshold: at least 1 directory with 3+ source files\n if (srcDirs.size >= 1 && sourceFiles.length >= 3 && !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 // Generate SQLAlchemy docs for Python projects\n if (frameworks.includes('SQLAlchemy') && !docExists('integrations/databases/sqlalchemy.md')) {\n tasks.push({\n directory: 'integrations/databases',\n type: 'integration',\n agentType: 'coder',\n prompt: buildSQLAlchemyPrompt(context, modelFiles),\n outputFile: 'integrations/databases/sqlalchemy.md',\n });\n }\n\n // Generate FastAPI docs\n if (frameworks.includes('FastAPI') && !docExists('services/api/fastapi.md')) {\n tasks.push({\n directory: 'services/api',\n type: 'service',\n agentType: 'coder',\n prompt: buildFastAPIPrompt(context, serviceFiles),\n outputFile: 'services/api/fastapi.md',\n });\n }\n\n // Generate Flask docs\n if (frameworks.includes('Flask') && !docExists('services/api/flask.md')) {\n tasks.push({\n directory: 'services/api',\n type: 'service',\n agentType: 'coder',\n prompt: buildFlaskPrompt(context, serviceFiles),\n outputFile: 'services/api/flask.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 'integrations/databases/sqlalchemy.md': `---\ntitle: SQLAlchemy Integration\ntype: integration\nstatus: active\ntags: [sqlalchemy, database, orm, python]\ncreated: ${date}\n---\n\n# SQLAlchemy Integration\n\nDatabase ORM configuration for ${projectName}.\n\n## Models\n\n*Document your SQLAlchemy models*\n\n## Database Connection\n\n\\`\\`\\`python\nfrom sqlalchemy import create_engine\nfrom sqlalchemy.orm import sessionmaker\n\nengine = create_engine(DATABASE_URL)\nSession = sessionmaker(bind=engine)\n\\`\\`\\`\n\n## Migrations (Alembic)\n\n\\`\\`\\`bash\nalembic upgrade head\n\\`\\`\\`\n\n## Query Examples\n\n*Add common query patterns*\n\n---\n> Auto-generated by kg-agent\n`,\n\n 'services/api/fastapi.md': `---\ntitle: FastAPI Service\ntype: service\nstatus: active\ntags: [fastapi, api, python]\ncreated: ${date}\n---\n\n# FastAPI Service\n\nAPI service documentation for ${projectName}.\n\n## Running the Server\n\n\\`\\`\\`bash\nuvicorn main:app --reload\n\\`\\`\\`\n\n## API Endpoints\n\n*Document your API endpoints*\n\n## Authentication\n\n*Document authentication flow*\n\n## Request/Response Schemas\n\n*Document Pydantic models*\n\n---\n> Auto-generated by kg-agent\n`,\n\n 'services/api/flask.md': `---\ntitle: Flask Service\ntype: service\nstatus: active\ntags: [flask, api, python]\ncreated: ${date}\n---\n\n# Flask Service\n\nAPI service documentation for ${projectName}.\n\n## Running the Server\n\n\\`\\`\\`bash\nflask run\n\\`\\`\\`\n\n## Routes\n\n*Document your Flask routes*\n\n## Blueprints\n\n*Document blueprints structure*\n\n## Error Handling\n\n*Document error handling patterns*\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\nfunction buildSQLAlchemyPrompt(context: GenerationContext, modelFiles: string[]): string {\n return `Document SQLAlchemy database integration for ${context.projectName}.\nModel files: ${modelFiles.slice(0, 10).join(', ')}.\nGenerate integration documentation with models, relationships, and query patterns.`;\n}\n\nfunction buildFastAPIPrompt(context: GenerationContext, serviceFiles: string[]): string {\n return `Document FastAPI API service for ${context.projectName}.\nAPI files: ${serviceFiles.slice(0, 10).join(', ')}.\nGenerate API documentation with endpoints, request/response schemas, and authentication.`;\n}\n\nfunction buildFlaskPrompt(context: GenerationContext, serviceFiles: string[]): string {\n return `Document Flask API service for ${context.projectName}.\nRoute files: ${serviceFiles.slice(0, 10).join(', ')}.\nGenerate API documentation with routes, blueprints, and request handling.`;\n}\n"],"names":[],"mappings":";;;;AA4DA,eAAsB,uBACpB,aACA,UACA,UAKI,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,SAAS,QAAQ,KAAK;AAEjE,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,Q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kBAAkB,SAAoC;AAC7D,SAAO,4CAA4C,QAAQ,WAAW;AAAA;AAExE;AAEA,SAAS,sBAAsB,SAA4B,YAA8B;AACvF,SAAO,gDAAgD,QAAQ,WAAW;AAAA,eAC7D,WAAW,MAAM,GAAG,EAAE,EAAE,KAAK,IAAI,CAAC;AAAA;AAEjD;AAEA,SAAS,mBAAmB,SAA4B,cAAgC;AACtF,SAAO,oCAAoC,QAAQ,WAAW;AAAA,aACnD,aAAa,MAAM,GAAG,EAAE,EAAE,KAAK,IAAI,CAAC;AAAA;AAEjD;AAEA,SAAS,iBAAiB,SAA4B,cAAgC;AACpF,SAAO,kCAAkC,QAAQ,WAAW;AAAA,eAC/C,aAAa,MAAM,GAAG,EAAE,EAAE,KAAK,IAAI,CAAC;AAAA;AAEnD;"}
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, mkdirSync, copyFileSync } from 'fs';\nimport { join, basename, extname, relative, dirname } from 'path';\nimport fg from 'fast-glob';\nimport { spawn } from 'child_process';\n\n/**\n * Service documentation found in src/{service}/docs directories\n */\ninterface ServiceDoc {\n serviceName: string;\n sourcePath: string;\n fileName: string;\n relativePath: string;\n}\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 serviceDocs: ServiceDoc[];\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 force?: 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, options.force);\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 if (context.serviceDocs.length > 0) {\n console.log('\\n[Dry Run] Would copy service docs:');\n for (const doc of context.serviceDocs) {\n const targetPath = `services/${doc.serviceName}/${doc.relativePath}`;\n console.log(` - ${doc.sourcePath} → ${targetPath}`);\n }\n }\n return result;\n }\n\n // Copy service docs from src/{service}/docs to main docs directory\n const copiedDocs = copyServiceDocs(context, options.force);\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 // Add copied service docs to result\n result.documentsGenerated.push(...copiedDocs);\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 * Copy service docs from src/{service}/docs to main docs directory\n */\nfunction copyServiceDocs(context: GenerationContext, force?: boolean): GeneratedDoc[] {\n const { docsPath, serviceDocs } = context;\n const copied: GeneratedDoc[] = [];\n\n for (const doc of serviceDocs) {\n const targetDir = join(docsPath, 'services', doc.serviceName);\n const targetPath = join(targetDir, doc.relativePath);\n const relativeTarget = `services/${doc.serviceName}/${doc.relativePath}`;\n\n // Skip if target exists and not forcing\n if (!force && existsSync(targetPath)) {\n continue;\n }\n\n try {\n // Create target directory if needed\n const targetFileDir = dirname(targetPath);\n if (!existsSync(targetFileDir)) {\n mkdirSync(targetFileDir, { recursive: true });\n }\n\n // Copy the file\n copyFileSync(doc.sourcePath, targetPath);\n\n copied.push({\n path: relativeTarget,\n title: doc.fileName.replace('.md', ''),\n type: 'service',\n generated: true,\n });\n } catch (error) {\n copied.push({\n path: relativeTarget,\n title: doc.fileName.replace('.md', ''),\n type: 'service',\n generated: false,\n error: String(error),\n });\n }\n }\n\n return copied;\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 serviceDocs: [],\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\n // Detect Python - check multiple locations for requirements\n const pythonConfigPaths = [\n join(projectRoot, 'requirements.txt'),\n join(projectRoot, 'pyproject.toml'),\n join(projectRoot, 'src/backend/requirements.txt'),\n join(projectRoot, 'backend/requirements.txt'),\n join(projectRoot, 'src/requirements.txt'),\n ];\n const foundPythonConfig = pythonConfigPaths.find(p => existsSync(p));\n\n // Also detect Python if we find .py files later in source scan\n // For now, check if there's a Python config file\n if (foundPythonConfig) {\n context.languages.push('Python');\n\n // Detect Python frameworks from requirements.txt or pyproject.toml\n try {\n let reqContent = readFileSync(foundPythonConfig, 'utf-8').toLowerCase();\n // Also check pyproject.toml if we found requirements.txt\n if (foundPythonConfig.includes('requirements.txt')) {\n const pyprojectPath = join(projectRoot, 'pyproject.toml');\n if (existsSync(pyprojectPath)) {\n reqContent += readFileSync(pyprojectPath, 'utf-8').toLowerCase();\n }\n }\n if (reqContent.includes('fastapi')) context.frameworks.push('FastAPI');\n if (reqContent.includes('flask')) context.frameworks.push('Flask');\n if (reqContent.includes('django')) context.frameworks.push('Django');\n if (reqContent.includes('sqlalchemy')) context.frameworks.push('SQLAlchemy');\n if (reqContent.includes('pydantic')) context.frameworks.push('Pydantic');\n if (reqContent.includes('alembic')) context.frameworks.push('Alembic');\n } catch {\n // Ignore read errors\n }\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 // Detect Python from .py files if not already detected\n if (!context.languages.includes('Python') && sourceFiles.some(f => f.endsWith('.py'))) {\n context.languages.push('Python');\n }\n\n // Scan for service docs in src/{service}/docs directories\n const serviceDocs: ServiceDoc[] = [];\n const srcDir = join(projectRoot, 'src');\n if (existsSync(srcDir)) {\n try {\n const srcEntries = readdirSync(srcDir, { withFileTypes: true });\n for (const entry of srcEntries) {\n if (entry.isDirectory()) {\n const serviceDocsDir = join(srcDir, entry.name, 'docs');\n if (existsSync(serviceDocsDir)) {\n // Find all markdown files in this service's docs directory\n const docsFiles = await fg('**/*.md', {\n cwd: serviceDocsDir,\n ignore: ['node_modules/**', '.git/**'],\n });\n for (const docFile of docsFiles) {\n serviceDocs.push({\n serviceName: entry.name,\n sourcePath: join(serviceDocsDir, docFile),\n fileName: basename(docFile),\n relativePath: docFile,\n });\n }\n }\n }\n }\n } catch {\n // Ignore errors reading src directory\n }\n }\n context.serviceDocs = serviceDocs;\n\n return context;\n}\n\n/**\n * Plan what documents should be generated based on context\n */\nasync function planDocumentGeneration(context: GenerationContext, force?: boolean): Promise<AgentTask[]> {\n const tasks: AgentTask[] = [];\n const { projectRoot, docsPath, sourceFiles, frameworks } = context;\n\n // Helper to check if doc already exists (returns false if force is true)\n const docExists = (relativePath: string) => {\n if (force) return false; // Force regeneration\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 const backendFiles: string[] = [];\n const modelFiles: string[] = [];\n const frontendFiles: string[] = [];\n\n for (const file of sourceFiles) {\n const dir = file.split('/')[0];\n srcDirs.add(dir);\n const fileLower = file.toLowerCase();\n\n // Categorize files (improved patterns for Python and TypeScript)\n if (fileLower.includes('component') || fileLower.includes('/ui/') || fileLower.includes('/views/')) {\n componentFiles.push(file);\n }\n if (fileLower.includes('service') || fileLower.includes('/api/') || fileLower.includes('routes') || fileLower.includes('endpoints')) {\n serviceFiles.push(file);\n }\n if (fileLower.includes('util') || fileLower.includes('helper') || fileLower.includes('/lib/') || fileLower.includes('common')) {\n utilityFiles.push(file);\n }\n if (fileLower.includes('backend') || fileLower.includes('server') || fileLower.includes('app/')) {\n backendFiles.push(file);\n }\n if (fileLower.includes('model') || fileLower.includes('schema') || fileLower.includes('entities')) {\n modelFiles.push(file);\n }\n if (fileLower.includes('frontend') || fileLower.includes('client') || fileLower.includes('pages')) {\n frontendFiles.push(file);\n }\n }\n\n // If no service files found but backend files exist, use backend files\n if (serviceFiles.length === 0 && backendFiles.length > 0) {\n serviceFiles.push(...backendFiles);\n }\n\n // Generate architecture overview if source has modules with files\n // Threshold: at least 1 directory with 3+ source files\n if (srcDirs.size >= 1 && sourceFiles.length >= 3 && !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 // Generate SQLAlchemy docs for Python projects\n if (frameworks.includes('SQLAlchemy') && !docExists('integrations/databases/sqlalchemy.md')) {\n tasks.push({\n directory: 'integrations/databases',\n type: 'integration',\n agentType: 'coder',\n prompt: buildSQLAlchemyPrompt(context, modelFiles),\n outputFile: 'integrations/databases/sqlalchemy.md',\n });\n }\n\n // Generate FastAPI docs\n if (frameworks.includes('FastAPI') && !docExists('services/api/fastapi.md')) {\n tasks.push({\n directory: 'services/api',\n type: 'service',\n agentType: 'coder',\n prompt: buildFastAPIPrompt(context, serviceFiles),\n outputFile: 'services/api/fastapi.md',\n });\n }\n\n // Generate Flask docs\n if (frameworks.includes('Flask') && !docExists('services/api/flask.md')) {\n tasks.push({\n directory: 'services/api',\n type: 'service',\n agentType: 'coder',\n prompt: buildFlaskPrompt(context, serviceFiles),\n outputFile: 'services/api/flask.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 'integrations/databases/sqlalchemy.md': `---\ntitle: SQLAlchemy Integration\ntype: integration\nstatus: active\ntags: [sqlalchemy, database, orm, python]\ncreated: ${date}\n---\n\n# SQLAlchemy Integration\n\nDatabase ORM configuration for ${projectName}.\n\n## Models\n\n*Document your SQLAlchemy models*\n\n## Database Connection\n\n\\`\\`\\`python\nfrom sqlalchemy import create_engine\nfrom sqlalchemy.orm import sessionmaker\n\nengine = create_engine(DATABASE_URL)\nSession = sessionmaker(bind=engine)\n\\`\\`\\`\n\n## Migrations (Alembic)\n\n\\`\\`\\`bash\nalembic upgrade head\n\\`\\`\\`\n\n## Query Examples\n\n*Add common query patterns*\n\n---\n> Auto-generated by kg-agent\n`,\n\n 'services/api/fastapi.md': `---\ntitle: FastAPI Service\ntype: service\nstatus: active\ntags: [fastapi, api, python]\ncreated: ${date}\n---\n\n# FastAPI Service\n\nAPI service documentation for ${projectName}.\n\n## Running the Server\n\n\\`\\`\\`bash\nuvicorn main:app --reload\n\\`\\`\\`\n\n## API Endpoints\n\n*Document your API endpoints*\n\n## Authentication\n\n*Document authentication flow*\n\n## Request/Response Schemas\n\n*Document Pydantic models*\n\n---\n> Auto-generated by kg-agent\n`,\n\n 'services/api/flask.md': `---\ntitle: Flask Service\ntype: service\nstatus: active\ntags: [flask, api, python]\ncreated: ${date}\n---\n\n# Flask Service\n\nAPI service documentation for ${projectName}.\n\n## Running the Server\n\n\\`\\`\\`bash\nflask run\n\\`\\`\\`\n\n## Routes\n\n*Document your Flask routes*\n\n## Blueprints\n\n*Document blueprints structure*\n\n## Error Handling\n\n*Document error handling patterns*\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\nfunction buildSQLAlchemyPrompt(context: GenerationContext, modelFiles: string[]): string {\n return `Document SQLAlchemy database integration for ${context.projectName}.\nModel files: ${modelFiles.slice(0, 10).join(', ')}.\nGenerate integration documentation with models, relationships, and query patterns.`;\n}\n\nfunction buildFastAPIPrompt(context: GenerationContext, serviceFiles: string[]): string {\n return `Document FastAPI API service for ${context.projectName}.\nAPI files: ${serviceFiles.slice(0, 10).join(', ')}.\nGenerate API documentation with endpoints, request/response schemas, and authentication.`;\n}\n\nfunction buildFlaskPrompt(context: GenerationContext, serviceFiles: string[]): string {\n return `Document Flask API service for ${context.projectName}.\nRoute files: ${serviceFiles.slice(0, 10).join(', ')}.\nGenerate API documentation with routes, blueprints, and request handling.`;\n}\n"],"names":[],"mappings":";;;;AAuEA,eAAsB,uBACpB,aACA,UACA,UAKI,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,SAAS,QAAQ,KAAK;AAEjE,QAAI,QAAQ,QAAQ;AAClB,cAAQ,IAAI,qDAAqD;AACjE,iBAAW,QAAQ,OAAO;AACxB,gBAAQ,IAAI,OAAO,KAAK,UAAU,KAAK,KAAK,SAAS,SAAS;AAAA,MAChE;AACA,UAAI,QAAQ,YAAY,SAAS,GAAG;AAClC,gBAAQ,IAAI,sCAAsC;AAClD,mBAAW,OAAO,QAAQ,aAAa;AACrC,gBAAM,aAAa,YAAY,I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BAAiB,SAA4B,cAAgC;AACpF,SAAO,kCAAkC,QAAQ,WAAW;AAAA,eAC/C,aAAa,MAAM,GAAG,EAAE,EAAE,KAAK,IAAI,CAAC;AAAA;AAEnD;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weavelogic/knowledge-graph-agent",
3
- "version": "0.8.7",
3
+ "version": "0.8.8",
4
4
  "description": "Knowledge graph agent for Claude Code - generates knowledge graphs, initializes docs, and integrates with claude-flow",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",