@weavelogic/knowledge-graph-agent 0.8.6 → 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.
@@ -1 +1 @@
1
- {"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/docs.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAkM3C"}
1
+ {"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/docs.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAoM3C"}
@@ -7,7 +7,7 @@ import { validateProjectRoot, validateDocsPath } from "../../core/security.js";
7
7
  function createDocsCommand() {
8
8
  const command = new Command("docs");
9
9
  command.description("Documentation management commands");
10
- command.command("init").description("Initialize documentation directory with weave-nn structure").option("-p, --path <path>", "Project root path", ".").option("-d, --docs <path>", "Docs directory path", "docs").option("-t, --template <template>", "Template to use (default, minimal)").option("--no-examples", "Skip example files").option("--no-detect", "Skip framework detection").option("-f, --force", "Overwrite existing files").option("-g, --generate", "Generate documents using expert agents").option("--parallel", "Run agent generation in parallel").option("--dry-run", "Show what would be generated without creating files").option("-v, --verbose", "Show detailed agent output").action(async (options) => {
10
+ command.command("init").description("Initialize documentation directory with weave-nn structure").option("-p, --path <path>", "Project root path", ".").option("-d, --docs <path>", "Docs directory path", "docs").option("-t, --template <template>", "Template to use (default, minimal)").option("--no-examples", "Skip example files").option("--no-detect", "Skip framework detection").option("-f, --force", "Overwrite existing files").option("-g, --generate", "Generate documents using expert agents").option("--parallel", "Run agent generation in parallel").option("--dry-run", "Show what would be generated without creating files").option("-v, --verbose", "Show detailed agent output").option("--force-generate", "Force regenerate documents even if they exist").action(async (options) => {
11
11
  const spinner = ora("Initializing documentation...").start();
12
12
  try {
13
13
  const projectRoot = validateProjectRoot(options.path);
@@ -68,7 +68,8 @@ function createDocsCommand() {
68
68
  const genResult = await generateDocsWithAgents(projectRoot, result.docsPath, {
69
69
  parallel: options.parallel,
70
70
  dryRun: options.dryRun,
71
- verbose: options.verbose
71
+ verbose: options.verbose,
72
+ force: options.forceGenerate
72
73
  });
73
74
  if (options.dryRun) {
74
75
  genSpinner.info("Dry run complete - no files created");
@@ -1 +1 @@
1
- {"version":3,"file":"docs.js","sources":["../../../src/cli/commands/docs.ts"],"sourcesContent":["/**\n * Docs Command\n *\n * Initialize and manage documentation directory.\n */\n\nimport { Command } from 'commander';\nimport chalk from 'chalk';\nimport ora from 'ora';\nimport { initDocs, docsExist, getDocsPath } from '../../generators/docs-init.js';\nimport { generateDocsWithAgents } from '../../generators/doc-generator-agents.js';\nimport { validateProjectRoot, validateDocsPath } from '../../core/security.js';\n\n/**\n * Create docs command\n */\nexport function createDocsCommand(): Command {\n const command = new Command('docs');\n\n command\n .description('Documentation management commands');\n\n // Init subcommand\n command\n .command('init')\n .description('Initialize documentation directory with weave-nn structure')\n .option('-p, --path <path>', 'Project root path', '.')\n .option('-d, --docs <path>', 'Docs directory path', 'docs')\n .option('-t, --template <template>', 'Template to use (default, minimal)')\n .option('--no-examples', 'Skip example files')\n .option('--no-detect', 'Skip framework detection')\n .option('-f, --force', 'Overwrite existing files')\n .option('-g, --generate', 'Generate documents using expert agents')\n .option('--parallel', 'Run agent generation in parallel')\n .option('--dry-run', 'Show what would be generated without creating files')\n .option('-v, --verbose', 'Show detailed agent output')\n .action(async (options) => {\n const spinner = ora('Initializing documentation...').start();\n\n try {\n // Validate paths to prevent traversal attacks\n const projectRoot = validateProjectRoot(options.path);\n const docsPath = options.docs;\n validateDocsPath(projectRoot, docsPath); // Ensure docs stays within project\n\n // Note: initDocs is additive - it only creates missing files/directories\n // The --force flag is for overwriting existing files if needed in the future\n const isExisting = docsExist(projectRoot, docsPath);\n if (isExisting) {\n spinner.text = 'Adding missing files to existing documentation...';\n }\n\n const result = await initDocs({\n projectRoot,\n docsPath,\n includeExamples: options.examples !== false,\n detectFramework: options.detect !== false,\n });\n\n if (result.success) {\n if (isExisting && result.filesCreated.length === 0) {\n spinner.succeed('Documentation already complete - no new files needed');\n } else if (isExisting) {\n spinner.succeed(`Documentation updated - added ${result.filesCreated.length} missing files`);\n } else {\n spinner.succeed('Documentation initialized!');\n }\n } else {\n spinner.warn('Documentation initialized with errors');\n }\n\n console.log();\n console.log(chalk.white(' Created:'));\n console.log(chalk.gray(` Path: ${result.docsPath}`));\n console.log(chalk.green(` Files: ${result.filesCreated.length}`));\n\n if (result.errors.length > 0) {\n console.log();\n console.log(chalk.yellow(' Errors:'));\n result.errors.forEach(err => {\n console.log(chalk.gray(` - ${err}`));\n });\n }\n\n console.log();\n console.log(chalk.cyan('Structure created:'));\n console.log(chalk.gray(`\n ${docsPath}/\n ├── README.md # Documentation home\n ├── PRIMITIVES.md # Technology primitives\n ├── MOC.md # Map of Content\n ├── concepts/ # Abstract concepts\n ├── components/ # Reusable components\n ├── services/ # Backend services\n ├── features/ # Product features\n ├── integrations/ # External integrations\n ├── standards/ # Coding standards\n ├── guides/ # How-to guides\n └── references/ # API references\n `));\n\n // Run agent generation if requested\n if (options.generate) {\n console.log();\n const genSpinner = ora('Analyzing project and generating documents with expert agents...').start();\n\n try {\n const genResult = await generateDocsWithAgents(projectRoot, result.docsPath, {\n parallel: options.parallel,\n dryRun: options.dryRun,\n verbose: options.verbose,\n });\n\n if (options.dryRun) {\n genSpinner.info('Dry run complete - no files created');\n } else if (genResult.success) {\n genSpinner.succeed(`Generated ${genResult.documentsGenerated.filter(d => d.generated).length} documents using ${genResult.agentsSpawned} agents`);\n } else {\n genSpinner.warn(`Generated ${genResult.documentsGenerated.filter(d => d.generated).length} documents with ${genResult.errors.length} errors`);\n }\n\n if (genResult.documentsGenerated.length > 0 && !options.dryRun) {\n console.log();\n console.log(chalk.white(' Generated Documents:'));\n for (const doc of genResult.documentsGenerated) {\n const icon = doc.generated ? chalk.green('✓') : chalk.red('✗');\n console.log(` ${icon} ${doc.path}${doc.error ? chalk.gray(` (${doc.error})`) : ''}`);\n }\n }\n\n if (genResult.errors.length > 0 && !options.dryRun) {\n console.log();\n console.log(chalk.yellow(' Agent Errors:'));\n genResult.errors.forEach(err => {\n console.log(chalk.gray(` - ${err}`));\n });\n }\n } catch (genError) {\n genSpinner.fail('Agent generation failed');\n console.error(chalk.red(String(genError)));\n }\n }\n\n console.log();\n console.log(chalk.cyan('Next: ') + chalk.white('kg graph') + chalk.gray(' to generate knowledge graph'));\n console.log();\n\n } catch (error) {\n spinner.fail('Failed to initialize documentation');\n console.error(chalk.red(String(error)));\n process.exit(1);\n }\n });\n\n // Status subcommand\n command\n .command('status')\n .description('Show documentation status')\n .option('-p, --path <path>', 'Project root path', '.')\n .action(async (options) => {\n // Validate path to prevent traversal\n const projectRoot = validateProjectRoot(options.path);\n const docsPath = getDocsPath(projectRoot);\n\n if (!docsPath) {\n console.log(chalk.yellow(' No documentation directory found'));\n console.log(chalk.gray(' Run ') + chalk.cyan('kg docs init') + chalk.gray(' to create one'));\n return;\n }\n\n console.log(chalk.white('\\n Documentation Status\\n'));\n console.log(chalk.gray(' Path:'), chalk.white(docsPath));\n console.log();\n\n // Count files\n const fg = await import('fast-glob');\n const files = await fg.default('**/*.md', {\n cwd: docsPath,\n ignore: ['node_modules/**', '.git/**'],\n });\n\n console.log(chalk.gray(' Markdown files:'), chalk.white(files.length));\n\n // Check for key files\n const keyFiles = ['README.md', 'PRIMITIVES.md', 'MOC.md'];\n const fs = await import('fs');\n const path = await import('path');\n\n console.log();\n console.log(chalk.white(' Key Files:'));\n keyFiles.forEach(file => {\n const exists = fs.existsSync(path.join(docsPath, file));\n const icon = exists ? chalk.green('✓') : chalk.red('✗');\n console.log(` ${icon} ${file}`);\n });\n\n // Check directories\n const dirs = ['concepts', 'components', 'services', 'features', 'guides'];\n console.log();\n console.log(chalk.white(' Directories:'));\n dirs.forEach(dir => {\n const exists = fs.existsSync(path.join(docsPath, dir));\n const icon = exists ? chalk.green('✓') : chalk.gray('○');\n console.log(` ${icon} ${dir}/`);\n });\n\n console.log();\n });\n\n return command;\n}\n"],"names":[],"mappings":";;;;;;AAgBO,SAAS,oBAA6B;AAC3C,QAAM,UAAU,IAAI,QAAQ,MAAM;AAElC,UACG,YAAY,mCAAmC;AAGlD,UACG,QAAQ,MAAM,EACd,YAAY,4DAA4D,EACxE,OAAO,qBAAqB,qBAAqB,GAAG,EACpD,OAAO,qBAAqB,uBAAuB,MAAM,EACzD,OAAO,6BAA6B,oCAAoC,EACxE,OAAO,iBAAiB,oBAAoB,EAC5C,OAAO,eAAe,0BAA0B,EAChD,OAAO,eAAe,0BAA0B,EAChD,OAAO,kBAAkB,wCAAwC,EACjE,OAAO,cAAc,kCAAkC,EACvD,OAAO,aAAa,qDAAqD,EACzE,OAAO,iBAAiB,4BAA4B,EACpD,OAAO,OAAO,YAAY;AACzB,UAAM,UAAU,IAAI,+BAA+B,EAAE,MAAA;AAErD,QAAI;AAEF,YAAM,cAAc,oBAAoB,QAAQ,IAAI;AACpD,YAAM,WAAW,QAAQ;AACzB,uBAAiB,aAAa,QAAQ;AAItC,YAAM,aAAa,UAAU,aAAa,QAAQ;AAClD,UAAI,YAAY;AACd,gBAAQ,OAAO;AAAA,MACjB;AAEA,YAAM,SAAS,MAAM,SAAS;AAAA,QAC5B;AAAA,QACA;AAAA,QACA,iBAAiB,QAAQ,aAAa;AAAA,QACtC,iBAAiB,QAAQ,WAAW;AAAA,MAAA,CACrC;AAED,UAAI,OAAO,SAAS;AAClB,YAAI,cAAc,OAAO,aAAa,WAAW,GAAG;AAClD,kBAAQ,QAAQ,sDAAsD;AAAA,QACxE,WAAW,YAAY;AACrB,kBAAQ,QAAQ,iCAAiC,OAAO,aAAa,MAAM,gBAAgB;AAAA,QAC7F,OAAO;AACL,kBAAQ,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AAM,OAAO,SAAS,MAAM,MAAM,GAAG,IAAI,MAAM,KAAK,GAAG;AACvD,cAAQ,IAAI,OAAO,IAAI,IAAI,GAAG,GAAG;AAAA,IACnC,CAAC;AAED,YAAQ,IAAA;AAAA,EACV,CAAC;AAEH,SAAO;AACT;"}
1
+ {"version":3,"file":"docs.js","sources":["../../../src/cli/commands/docs.ts"],"sourcesContent":["/**\n * Docs Command\n *\n * Initialize and manage documentation directory.\n */\n\nimport { Command } from 'commander';\nimport chalk from 'chalk';\nimport ora from 'ora';\nimport { initDocs, docsExist, getDocsPath } from '../../generators/docs-init.js';\nimport { generateDocsWithAgents } from '../../generators/doc-generator-agents.js';\nimport { validateProjectRoot, validateDocsPath } from '../../core/security.js';\n\n/**\n * Create docs command\n */\nexport function createDocsCommand(): Command {\n const command = new Command('docs');\n\n command\n .description('Documentation management commands');\n\n // Init subcommand\n command\n .command('init')\n .description('Initialize documentation directory with weave-nn structure')\n .option('-p, --path <path>', 'Project root path', '.')\n .option('-d, --docs <path>', 'Docs directory path', 'docs')\n .option('-t, --template <template>', 'Template to use (default, minimal)')\n .option('--no-examples', 'Skip example files')\n .option('--no-detect', 'Skip framework detection')\n .option('-f, --force', 'Overwrite existing files')\n .option('-g, --generate', 'Generate documents using expert agents')\n .option('--parallel', 'Run agent generation in parallel')\n .option('--dry-run', 'Show what would be generated without creating files')\n .option('-v, --verbose', 'Show detailed agent output')\n .option('--force-generate', 'Force regenerate documents even if they exist')\n .action(async (options) => {\n const spinner = ora('Initializing documentation...').start();\n\n try {\n // Validate paths to prevent traversal attacks\n const projectRoot = validateProjectRoot(options.path);\n const docsPath = options.docs;\n validateDocsPath(projectRoot, docsPath); // Ensure docs stays within project\n\n // Note: initDocs is additive - it only creates missing files/directories\n // The --force flag is for overwriting existing files if needed in the future\n const isExisting = docsExist(projectRoot, docsPath);\n if (isExisting) {\n spinner.text = 'Adding missing files to existing documentation...';\n }\n\n const result = await initDocs({\n projectRoot,\n docsPath,\n includeExamples: options.examples !== false,\n detectFramework: options.detect !== false,\n });\n\n if (result.success) {\n if (isExisting && result.filesCreated.length === 0) {\n spinner.succeed('Documentation already complete - no new files needed');\n } else if (isExisting) {\n spinner.succeed(`Documentation updated - added ${result.filesCreated.length} missing files`);\n } else {\n spinner.succeed('Documentation initialized!');\n }\n } else {\n spinner.warn('Documentation initialized with errors');\n }\n\n console.log();\n console.log(chalk.white(' Created:'));\n console.log(chalk.gray(` Path: ${result.docsPath}`));\n console.log(chalk.green(` Files: ${result.filesCreated.length}`));\n\n if (result.errors.length > 0) {\n console.log();\n console.log(chalk.yellow(' Errors:'));\n result.errors.forEach(err => {\n console.log(chalk.gray(` - ${err}`));\n });\n }\n\n console.log();\n console.log(chalk.cyan('Structure created:'));\n console.log(chalk.gray(`\n ${docsPath}/\n ├── README.md # Documentation home\n ├── PRIMITIVES.md # Technology primitives\n ├── MOC.md # Map of Content\n ├── concepts/ # Abstract concepts\n ├── components/ # Reusable components\n ├── services/ # Backend services\n ├── features/ # Product features\n ├── integrations/ # External integrations\n ├── standards/ # Coding standards\n ├── guides/ # How-to guides\n └── references/ # API references\n `));\n\n // Run agent generation if requested\n if (options.generate) {\n console.log();\n const genSpinner = ora('Analyzing project and generating documents with expert agents...').start();\n\n try {\n const genResult = await generateDocsWithAgents(projectRoot, result.docsPath, {\n parallel: options.parallel,\n dryRun: options.dryRun,\n verbose: options.verbose,\n force: options.forceGenerate,\n });\n\n if (options.dryRun) {\n genSpinner.info('Dry run complete - no files created');\n } else if (genResult.success) {\n genSpinner.succeed(`Generated ${genResult.documentsGenerated.filter(d => d.generated).length} documents using ${genResult.agentsSpawned} agents`);\n } else {\n genSpinner.warn(`Generated ${genResult.documentsGenerated.filter(d => d.generated).length} documents with ${genResult.errors.length} errors`);\n }\n\n if (genResult.documentsGenerated.length > 0 && !options.dryRun) {\n console.log();\n console.log(chalk.white(' Generated Documents:'));\n for (const doc of genResult.documentsGenerated) {\n const icon = doc.generated ? chalk.green('✓') : chalk.red('✗');\n console.log(` ${icon} ${doc.path}${doc.error ? chalk.gray(` (${doc.error})`) : ''}`);\n }\n }\n\n if (genResult.errors.length > 0 && !options.dryRun) {\n console.log();\n console.log(chalk.yellow(' Agent Errors:'));\n genResult.errors.forEach(err => {\n console.log(chalk.gray(` - ${err}`));\n });\n }\n } catch (genError) {\n genSpinner.fail('Agent generation failed');\n console.error(chalk.red(String(genError)));\n }\n }\n\n console.log();\n console.log(chalk.cyan('Next: ') + chalk.white('kg graph') + chalk.gray(' to generate knowledge graph'));\n console.log();\n\n } catch (error) {\n spinner.fail('Failed to initialize documentation');\n console.error(chalk.red(String(error)));\n process.exit(1);\n }\n });\n\n // Status subcommand\n command\n .command('status')\n .description('Show documentation status')\n .option('-p, --path <path>', 'Project root path', '.')\n .action(async (options) => {\n // Validate path to prevent traversal\n const projectRoot = validateProjectRoot(options.path);\n const docsPath = getDocsPath(projectRoot);\n\n if (!docsPath) {\n console.log(chalk.yellow(' No documentation directory found'));\n console.log(chalk.gray(' Run ') + chalk.cyan('kg docs init') + chalk.gray(' to create one'));\n return;\n }\n\n console.log(chalk.white('\\n Documentation Status\\n'));\n console.log(chalk.gray(' Path:'), chalk.white(docsPath));\n console.log();\n\n // Count files\n const fg = await import('fast-glob');\n const files = await fg.default('**/*.md', {\n cwd: docsPath,\n ignore: ['node_modules/**', '.git/**'],\n });\n\n console.log(chalk.gray(' Markdown files:'), chalk.white(files.length));\n\n // Check for key files\n const keyFiles = ['README.md', 'PRIMITIVES.md', 'MOC.md'];\n const fs = await import('fs');\n const path = await import('path');\n\n console.log();\n console.log(chalk.white(' Key Files:'));\n keyFiles.forEach(file => {\n const exists = fs.existsSync(path.join(docsPath, file));\n const icon = exists ? chalk.green('✓') : chalk.red('✗');\n console.log(` ${icon} ${file}`);\n });\n\n // Check directories\n const dirs = ['concepts', 'components', 'services', 'features', 'guides'];\n console.log();\n console.log(chalk.white(' Directories:'));\n dirs.forEach(dir => {\n const exists = fs.existsSync(path.join(docsPath, dir));\n const icon =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AM,KAAK,GAAG;AACvD,cAAQ,IAAI,OAAO,IAAI,IAAI,GAAG,GAAG;AAAA,IACnC,CAAC;AAED,YAAQ,IAAA;AAAA,EACV,CAAC;AAEH,SAAO;AACT;"}
@@ -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
@@ -42,5 +52,7 @@ export declare function generateDocsWithAgents(projectRoot: string, docsPath: st
42
52
  parallel?: boolean;
43
53
  dryRun?: boolean;
44
54
  verbose?: boolean;
55
+ force?: boolean;
45
56
  }): Promise<AgentGenerationResult>;
57
+ export {};
46
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;CACd,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 = {}) {
@@ -11,14 +11,22 @@ async function generateDocsWithAgents(projectRoot, docsPath, options = {}) {
11
11
  };
12
12
  try {
13
13
  const context = await buildGenerationContext(projectRoot, docsPath);
14
- const tasks = await planDocumentGeneration(context);
14
+ const tasks = await planDocumentGeneration(context, options.force);
15
15
  if (options.dryRun) {
16
16
  console.log("\n[Dry Run] Would generate the following documents:");
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)) {
@@ -95,8 +139,32 @@ async function buildGenerationContext(projectRoot, docsPath) {
95
139
  if (existsSync(join(projectRoot, "package.json"))) {
96
140
  context.languages.push("JavaScript");
97
141
  }
98
- if (existsSync(join(projectRoot, "requirements.txt")) || existsSync(join(projectRoot, "pyproject.toml"))) {
142
+ const pythonConfigPaths = [
143
+ join(projectRoot, "requirements.txt"),
144
+ join(projectRoot, "pyproject.toml"),
145
+ join(projectRoot, "src/backend/requirements.txt"),
146
+ join(projectRoot, "backend/requirements.txt"),
147
+ join(projectRoot, "src/requirements.txt")
148
+ ];
149
+ const foundPythonConfig = pythonConfigPaths.find((p) => existsSync(p));
150
+ if (foundPythonConfig) {
99
151
  context.languages.push("Python");
152
+ try {
153
+ let reqContent = readFileSync(foundPythonConfig, "utf-8").toLowerCase();
154
+ if (foundPythonConfig.includes("requirements.txt")) {
155
+ const pyprojectPath = join(projectRoot, "pyproject.toml");
156
+ if (existsSync(pyprojectPath)) {
157
+ reqContent += readFileSync(pyprojectPath, "utf-8").toLowerCase();
158
+ }
159
+ }
160
+ if (reqContent.includes("fastapi")) context.frameworks.push("FastAPI");
161
+ if (reqContent.includes("flask")) context.frameworks.push("Flask");
162
+ if (reqContent.includes("django")) context.frameworks.push("Django");
163
+ if (reqContent.includes("sqlalchemy")) context.frameworks.push("SQLAlchemy");
164
+ if (reqContent.includes("pydantic")) context.frameworks.push("Pydantic");
165
+ if (reqContent.includes("alembic")) context.frameworks.push("Alembic");
166
+ } catch {
167
+ }
100
168
  }
101
169
  if (existsSync(join(projectRoot, "Cargo.toml"))) {
102
170
  context.languages.push("Rust");
@@ -115,30 +183,77 @@ async function buildGenerationContext(projectRoot, docsPath) {
115
183
  dot: true
116
184
  });
117
185
  context.sourceFiles = sourceFiles;
186
+ if (!context.languages.includes("Python") && sourceFiles.some((f) => f.endsWith(".py"))) {
187
+ context.languages.push("Python");
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;
118
217
  return context;
119
218
  }
120
- async function planDocumentGeneration(context) {
219
+ async function planDocumentGeneration(context, force) {
121
220
  const tasks = [];
122
221
  const { projectRoot, docsPath, sourceFiles, frameworks } = context;
123
222
  const docExists = (relativePath) => {
223
+ if (force) return false;
124
224
  return existsSync(join(docsPath, relativePath));
125
225
  };
126
226
  const srcDirs = /* @__PURE__ */ new Set();
127
227
  const componentFiles = [];
128
228
  const serviceFiles = [];
129
229
  const utilityFiles = [];
230
+ const backendFiles = [];
231
+ const modelFiles = [];
130
232
  for (const file of sourceFiles) {
131
233
  const dir = file.split("/")[0];
132
234
  srcDirs.add(dir);
133
- if (file.includes("component") || file.includes("ui/")) {
235
+ const fileLower = file.toLowerCase();
236
+ if (fileLower.includes("component") || fileLower.includes("/ui/") || fileLower.includes("/views/")) {
134
237
  componentFiles.push(file);
135
- } else if (file.includes("service") || file.includes("api/")) {
238
+ }
239
+ if (fileLower.includes("service") || fileLower.includes("/api/") || fileLower.includes("routes") || fileLower.includes("endpoints")) {
136
240
  serviceFiles.push(file);
137
- } else if (file.includes("util") || file.includes("helper") || file.includes("lib/")) {
241
+ }
242
+ if (fileLower.includes("util") || fileLower.includes("helper") || fileLower.includes("/lib/") || fileLower.includes("common")) {
138
243
  utilityFiles.push(file);
139
244
  }
245
+ if (fileLower.includes("backend") || fileLower.includes("server") || fileLower.includes("app/")) {
246
+ backendFiles.push(file);
247
+ }
248
+ if (fileLower.includes("model") || fileLower.includes("schema") || fileLower.includes("entities")) {
249
+ modelFiles.push(file);
250
+ }
251
+ if (fileLower.includes("frontend") || fileLower.includes("client") || fileLower.includes("pages")) ;
140
252
  }
141
- if (srcDirs.size > 2 && !docExists("concepts/architecture/overview.md")) {
253
+ if (serviceFiles.length === 0 && backendFiles.length > 0) {
254
+ serviceFiles.push(...backendFiles);
255
+ }
256
+ if (srcDirs.size >= 1 && sourceFiles.length >= 3 && !docExists("concepts/architecture/overview.md")) {
142
257
  tasks.push({
143
258
  directory: "concepts/architecture",
144
259
  type: "concept",
@@ -205,6 +320,33 @@ async function planDocumentGeneration(context) {
205
320
  outputFile: "integrations/databases/prisma.md"
206
321
  });
207
322
  }
323
+ if (frameworks.includes("SQLAlchemy") && !docExists("integrations/databases/sqlalchemy.md")) {
324
+ tasks.push({
325
+ directory: "integrations/databases",
326
+ type: "integration",
327
+ agentType: "coder",
328
+ prompt: buildSQLAlchemyPrompt(context, modelFiles),
329
+ outputFile: "integrations/databases/sqlalchemy.md"
330
+ });
331
+ }
332
+ if (frameworks.includes("FastAPI") && !docExists("services/api/fastapi.md")) {
333
+ tasks.push({
334
+ directory: "services/api",
335
+ type: "service",
336
+ agentType: "coder",
337
+ prompt: buildFastAPIPrompt(context, serviceFiles),
338
+ outputFile: "services/api/fastapi.md"
339
+ });
340
+ }
341
+ if (frameworks.includes("Flask") && !docExists("services/api/flask.md")) {
342
+ tasks.push({
343
+ directory: "services/api",
344
+ type: "service",
345
+ agentType: "coder",
346
+ prompt: buildFlaskPrompt(context, serviceFiles),
347
+ outputFile: "services/api/flask.md"
348
+ });
349
+ }
208
350
  return tasks;
209
351
  }
210
352
  async function executeAgentTask(task, context, verbose) {
@@ -483,6 +625,111 @@ npx prisma migrate dev
483
625
 
484
626
  *Add Prisma client usage examples*
485
627
 
628
+ ---
629
+ > Auto-generated by kg-agent
630
+ `,
631
+ "integrations/databases/sqlalchemy.md": `---
632
+ title: SQLAlchemy Integration
633
+ type: integration
634
+ status: active
635
+ tags: [sqlalchemy, database, orm, python]
636
+ created: ${date}
637
+ ---
638
+
639
+ # SQLAlchemy Integration
640
+
641
+ Database ORM configuration for ${projectName}.
642
+
643
+ ## Models
644
+
645
+ *Document your SQLAlchemy models*
646
+
647
+ ## Database Connection
648
+
649
+ \`\`\`python
650
+ from sqlalchemy import create_engine
651
+ from sqlalchemy.orm import sessionmaker
652
+
653
+ engine = create_engine(DATABASE_URL)
654
+ Session = sessionmaker(bind=engine)
655
+ \`\`\`
656
+
657
+ ## Migrations (Alembic)
658
+
659
+ \`\`\`bash
660
+ alembic upgrade head
661
+ \`\`\`
662
+
663
+ ## Query Examples
664
+
665
+ *Add common query patterns*
666
+
667
+ ---
668
+ > Auto-generated by kg-agent
669
+ `,
670
+ "services/api/fastapi.md": `---
671
+ title: FastAPI Service
672
+ type: service
673
+ status: active
674
+ tags: [fastapi, api, python]
675
+ created: ${date}
676
+ ---
677
+
678
+ # FastAPI Service
679
+
680
+ API service documentation for ${projectName}.
681
+
682
+ ## Running the Server
683
+
684
+ \`\`\`bash
685
+ uvicorn main:app --reload
686
+ \`\`\`
687
+
688
+ ## API Endpoints
689
+
690
+ *Document your API endpoints*
691
+
692
+ ## Authentication
693
+
694
+ *Document authentication flow*
695
+
696
+ ## Request/Response Schemas
697
+
698
+ *Document Pydantic models*
699
+
700
+ ---
701
+ > Auto-generated by kg-agent
702
+ `,
703
+ "services/api/flask.md": `---
704
+ title: Flask Service
705
+ type: service
706
+ status: active
707
+ tags: [flask, api, python]
708
+ created: ${date}
709
+ ---
710
+
711
+ # Flask Service
712
+
713
+ API service documentation for ${projectName}.
714
+
715
+ ## Running the Server
716
+
717
+ \`\`\`bash
718
+ flask run
719
+ \`\`\`
720
+
721
+ ## Routes
722
+
723
+ *Document your Flask routes*
724
+
725
+ ## Blueprints
726
+
727
+ *Document blueprints structure*
728
+
729
+ ## Error Handling
730
+
731
+ *Document error handling patterns*
732
+
486
733
  ---
487
734
  > Auto-generated by kg-agent
488
735
  `
@@ -557,6 +804,21 @@ function buildPrismaPrompt(context) {
557
804
  return `Document Prisma database integration for ${context.projectName}.
558
805
  Generate integration documentation with schema, models, and usage patterns.`;
559
806
  }
807
+ function buildSQLAlchemyPrompt(context, modelFiles) {
808
+ return `Document SQLAlchemy database integration for ${context.projectName}.
809
+ Model files: ${modelFiles.slice(0, 10).join(", ")}.
810
+ Generate integration documentation with models, relationships, and query patterns.`;
811
+ }
812
+ function buildFastAPIPrompt(context, serviceFiles) {
813
+ return `Document FastAPI API service for ${context.projectName}.
814
+ API files: ${serviceFiles.slice(0, 10).join(", ")}.
815
+ Generate API documentation with endpoints, request/response schemas, and authentication.`;
816
+ }
817
+ function buildFlaskPrompt(context, serviceFiles) {
818
+ return `Document Flask API service for ${context.projectName}.
819
+ Route files: ${serviceFiles.slice(0, 10).join(", ")}.
820
+ Generate API documentation with routes, blueprints, and request handling.`;
821
+ }
560
822
  export {
561
823
  generateDocsWithAgents
562
824
  };
@@ -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 } = {}\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,Q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"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,IAAI,WAAW,IAAI,IAAI,YAAY;AAClE,kBAAQ,IAAI,OAAO,IAAI,UAAU,MAAM,UAAU,EAAE;AAAA,QACrD;AAAA,MACF;AACA,aAAO;AAAA,IACT;AAGA,UAAM,aAAa,gBAAgB,SAAS,QAAQ,KAAK;AAGzD,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,EAA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EA,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;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;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weavelogic/knowledge-graph-agent",
3
- "version": "0.8.6",
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",