@weavelogic/knowledge-graph-agent 0.8.0 → 0.8.1
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;AAMpC;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,
|
|
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;AAMpC;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAmJ3C"}
|
|
@@ -12,10 +12,9 @@ function createDocsCommand() {
|
|
|
12
12
|
const projectRoot = validateProjectRoot(options.path);
|
|
13
13
|
const docsPath = options.docs;
|
|
14
14
|
validateDocsPath(projectRoot, docsPath);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return;
|
|
15
|
+
const isExisting = docsExist(projectRoot, docsPath);
|
|
16
|
+
if (isExisting) {
|
|
17
|
+
spinner.text = "Adding missing files to existing documentation...";
|
|
19
18
|
}
|
|
20
19
|
const result = await initDocs({
|
|
21
20
|
projectRoot,
|
|
@@ -24,7 +23,13 @@ function createDocsCommand() {
|
|
|
24
23
|
detectFramework: options.detect !== false
|
|
25
24
|
});
|
|
26
25
|
if (result.success) {
|
|
27
|
-
|
|
26
|
+
if (isExisting && result.filesCreated.length === 0) {
|
|
27
|
+
spinner.succeed("Documentation already complete - no new files needed");
|
|
28
|
+
} else if (isExisting) {
|
|
29
|
+
spinner.succeed(`Documentation updated - added ${result.filesCreated.length} missing files`);
|
|
30
|
+
} else {
|
|
31
|
+
spinner.succeed("Documentation initialized!");
|
|
32
|
+
}
|
|
28
33
|
} else {
|
|
29
34
|
spinner.warn("Documentation initialized with errors");
|
|
30
35
|
}
|
|
@@ -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 { 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 .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 //
|
|
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 { 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 .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 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":";;;;;AAeO,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,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M;AAEhC,YAAQ,IAAA;AACR,YAAQ,IAAI,MAAM,MAAM,cAAc,CAAC;AACvC,aAAS,QAAQ,CAAA,SAAQ;AACvB,YAAM,SAAS,GAAG,WAAW,KAAK,KAAK,UAAU,IAAI,CAAC;AACtD,YAAM,OAAO,SAAS,MAAM,MAAM,GAAG,IAAI,MAAM,IAAI,GAAG;AACtD,cAAQ,IAAI,OAAO,IAAI,IAAI,IAAI,EAAE;AAAA,IACnC,CAAC;AAGD,UAAM,OAAO,CAAC,YAAY,cAAc,YAAY,YAAY,QAAQ;AACxE,YAAQ,IAAA;AACR,YAAQ,IAAI,MAAM,MAAM,gBAAgB,CAAC;AACzC,SAAK,QAAQ,CAAA,QAAO;AAClB,YAAM,SAAS,GAAG,WAAW,KAAK,KAAK,UAAU,GAAG,CAAC;AACrD,YAAM,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;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weavelogic/knowledge-graph-agent",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1",
|
|
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",
|