agentic-kdd 2.0.6 → 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 +14 -4
- 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/graph.js +70 -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 };
|
package/src/graph.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
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 graph() {
|
|
9
|
+
const projectPath = process.cwd();
|
|
10
|
+
const grafoPath = path.join(projectPath, '.agentic', 'grafo', 'grafo.js');
|
|
11
|
+
const dbPath = path.join(projectPath, '.agentic', 'memoria.db');
|
|
12
|
+
const memoriaPath = path.join(projectPath, '.agentic', 'memoria');
|
|
13
|
+
|
|
14
|
+
// Verificar que Agentic está instalado
|
|
15
|
+
if (!fs.existsSync(path.join(projectPath, '.agentic', 'config.md'))) {
|
|
16
|
+
console.log(chalk.yellow('\n Agentic KDD no está instalado en este proyecto.'));
|
|
17
|
+
console.log(chalk.gray(' Corre akdd init para instalarlo.\n'));
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Verificar que el grafo existe
|
|
22
|
+
if (!fs.existsSync(grafoPath)) {
|
|
23
|
+
console.log(chalk.yellow('\n El grafo no está disponible en este proyecto.'));
|
|
24
|
+
console.log(chalk.gray(' Actualiza con: akdd update\n'));
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
console.log('\n' + chalk.bold.blue(' Agentic KDD') + chalk.gray(' — grafo de conocimiento\n'));
|
|
29
|
+
|
|
30
|
+
// Sincronizar primero si hay archivos de memoria
|
|
31
|
+
if (fs.existsSync(memoriaPath)) {
|
|
32
|
+
try {
|
|
33
|
+
process.stdout.write(chalk.gray(' Sincronizando memoria... '));
|
|
34
|
+
execSync(`node "${grafoPath}" sync`, { stdio: 'pipe', cwd: projectPath });
|
|
35
|
+
console.log(chalk.green('✓'));
|
|
36
|
+
} catch (e) {
|
|
37
|
+
console.log(chalk.yellow('⚠ No se pudo sincronizar'));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Mostrar stats
|
|
42
|
+
if (fs.existsSync(dbPath)) {
|
|
43
|
+
try {
|
|
44
|
+
const output = execSync(`node "${grafoPath}" stats`, {
|
|
45
|
+
stdio: 'pipe',
|
|
46
|
+
cwd: projectPath
|
|
47
|
+
}).toString();
|
|
48
|
+
console.log(output);
|
|
49
|
+
} catch (e) {
|
|
50
|
+
console.log(chalk.red(' Error al leer el grafo: ' + e.message));
|
|
51
|
+
}
|
|
52
|
+
} else {
|
|
53
|
+
console.log(chalk.gray(' Sin datos aún — el grafo se llena a medida que usas aa:\n'));
|
|
54
|
+
console.log(chalk.gray(' Tip: después de cada tarea con aa:, el sistema actualiza el grafo solo.\n'));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Mostrar config del proyecto
|
|
58
|
+
const configPath = path.join(projectPath, '.agentic', 'config.md');
|
|
59
|
+
if (fs.existsSync(configPath)) {
|
|
60
|
+
const config = fs.readFileSync(configPath, 'utf8');
|
|
61
|
+
const nombre = (config.match(/Nombre: (.+)/) || [])[1] || '—';
|
|
62
|
+
const configurado = config.includes('CONFIGURADO: SI') ? chalk.green('✓ Configurado') : chalk.yellow('⚠ Sin configurar');
|
|
63
|
+
|
|
64
|
+
console.log(chalk.bold(' Proyecto: ') + nombre);
|
|
65
|
+
console.log(chalk.bold(' Estado: ') + configurado);
|
|
66
|
+
console.log('');
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
module.exports = { graph };
|