agentic-kdd 2.0.6 → 2.0.7
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 +5 -0
- package/package.json +1 -1
- package/src/graph.js +70 -0
package/bin/akdd.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
const { init } = require('../src/init');
|
|
5
5
|
const { update } = require('../src/update');
|
|
6
|
+
const { graph } = require('../src/graph');
|
|
6
7
|
const pkg = require('../package.json');
|
|
7
8
|
|
|
8
9
|
const args = process.argv.slice(2);
|
|
@@ -15,6 +16,7 @@ const HELP = `
|
|
|
15
16
|
Usage:
|
|
16
17
|
akdd init Install Agentic KDD in the current project
|
|
17
18
|
akdd update Update to the latest version (keeps your memory intact)
|
|
19
|
+
akdd graph Show knowledge graph stats and sync memory
|
|
18
20
|
akdd --version Show version
|
|
19
21
|
akdd --help Show this help
|
|
20
22
|
|
|
@@ -29,6 +31,9 @@ switch (command) {
|
|
|
29
31
|
case 'update':
|
|
30
32
|
update();
|
|
31
33
|
break;
|
|
34
|
+
case 'graph':
|
|
35
|
+
graph();
|
|
36
|
+
break;
|
|
32
37
|
case '--version':
|
|
33
38
|
case '-v':
|
|
34
39
|
console.log(pkg.version);
|
package/package.json
CHANGED
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 };
|