agentic-kdd 2.0.7 → 2.0.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.
- package/bin/akdd.js +10 -5
- package/package.json +5 -4
- package/src/dashboard-template.cjs +1345 -0
- package/src/dashboard-template.js +1345 -0
- package/src/dashboard.js +57 -0
package/src/dashboard.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const fs = require('fs-extra');
|
|
5
|
+
const chalk = require('chalk');
|
|
6
|
+
const { execSync } = require('child_process');
|
|
7
|
+
|
|
8
|
+
async function dashboard() {
|
|
9
|
+
const projectPath = process.cwd();
|
|
10
|
+
const configPath = path.join(projectPath, '.agentic', 'config.md');
|
|
11
|
+
const grafoCjs = path.join(projectPath, '.agentic', 'grafo', 'grafo.cjs');
|
|
12
|
+
const grafoJs = path.join(projectPath, '.agentic', 'grafo', 'grafo.js');
|
|
13
|
+
|
|
14
|
+
if (!fs.existsSync(configPath)) {
|
|
15
|
+
console.log(chalk.yellow('\n Agentic KDD not installed in this project.'));
|
|
16
|
+
console.log(chalk.gray(' Run: akdd init\n'));
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Sync graph
|
|
21
|
+
const grafoPath = fs.existsSync(grafoCjs) ? grafoCjs : grafoJs;
|
|
22
|
+
if (fs.existsSync(grafoPath)) {
|
|
23
|
+
try {
|
|
24
|
+
process.stdout.write(chalk.gray(' Syncing knowledge graph... '));
|
|
25
|
+
execSync(`node "${grafoPath}" sync`, { stdio: 'pipe', cwd: projectPath });
|
|
26
|
+
console.log(chalk.green('✓'));
|
|
27
|
+
} catch (e) {}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Check for local dashboard first
|
|
31
|
+
const localCjs = path.join(projectPath, 'dashboard.cjs');
|
|
32
|
+
const localJs = path.join(projectPath, 'dashboard.js');
|
|
33
|
+
const template = path.join(__dirname, 'dashboard-template.cjs');
|
|
34
|
+
|
|
35
|
+
const dashPath = fs.existsSync(localCjs) ? localCjs
|
|
36
|
+
: fs.existsSync(localJs) ? localJs
|
|
37
|
+
: fs.existsSync(template) ? template
|
|
38
|
+
: null;
|
|
39
|
+
|
|
40
|
+
if (!dashPath) {
|
|
41
|
+
console.log(chalk.yellow('\n Dashboard not found.'));
|
|
42
|
+
console.log(chalk.gray(' Copy dashboard.cjs to your project root.\n'));
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
console.log(chalk.blue('\n Agentic KDD Dashboard v4'));
|
|
47
|
+
const origCwd = process.cwd();
|
|
48
|
+
process.chdir(projectPath);
|
|
49
|
+
try {
|
|
50
|
+
require(dashPath);
|
|
51
|
+
} catch (e) {
|
|
52
|
+
console.log(chalk.red(' Error: ' + e.message));
|
|
53
|
+
process.chdir(origCwd);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
module.exports = { dashboard };
|