agentic-kdd 2.2.13 → 3.0.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.
Files changed (2) hide show
  1. package/bin/akdd.js +174 -117
  2. package/package.json +8 -3
package/bin/akdd.js CHANGED
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
 
4
- const { init } = require('../src/init');
5
- const { update } = require('../src/update');
6
- const { graph } = require('../src/graph');
4
+ const { init } = require('../src/init');
5
+ const { update } = require('../src/update');
6
+ const { graph } = require('../src/graph');
7
7
  const { dashboard } = require('../src/dashboard');
8
- const { analyze } = require('../src/analyze');
9
- const pkg = require('../package.json');
8
+ const { analyze } = require('../src/analyze');
9
+ const pkg = require('../package.json');
10
10
  const path = require('path');
11
- const fs = require('fs');
11
+ const fs = require('fs');
12
12
  const { execSync } = require('child_process');
13
13
 
14
14
  const args = process.argv.slice(2);
@@ -18,92 +18,113 @@ const arg2 = args[2];
18
18
 
19
19
  const HELP = `
20
20
  Agentic KDD v${pkg.version}
21
- Autonomous development pipeline with Knowledge-Driven Development
21
+ Autonomous development pipeline one developer, full-department output.
22
22
 
23
- Usage:
23
+ Setup:
24
24
  akdd init Install Agentic KDD in the current project
25
25
  akdd update Update agents + engine (memory stays intact)
26
- akdd analyze Analyze project code and auto-build knowledge graph
26
+ akdd health System health check what's configured, what's missing
27
+ akdd health --fix Auto-fix common issues
28
+
29
+ Memory & Knowledge:
27
30
  akdd sync Sync memory files to SQLite graph
28
- akdd graph Sync memory + show graph stats
31
+ akdd graph Sync + show graph stats
29
32
  akdd stats Show graph stats and HIGH rules
30
- akdd coala Show CoALA memory stats (procedural + episodic + semantic)
31
- akdd metricas Show agent KPIs (Goal Attainment, Autonomy, etc.)
32
- akdd buscar Hybrid search across all 3 memory layers
33
- akdd impacto Show impact of touching a module/file
33
+ akdd coala Show CoALA memory stats (4 layers)
34
+ akdd buscar Hybrid search across all memory layers
35
+ akdd impacto Semantic impact of a module/entity
34
36
  akdd decay Apply temporal decay to stale patterns
35
- akdd dashboard Open visual dashboard in browser
37
+ akdd audit Memory audit stale entries, contradictions, proposals
38
+ akdd forget <id> Forget a memory entry with documented reason
39
+
40
+ AST & Impact Analysis:
41
+ akdd ast Index project AST (symbols, imports, call graph, PageRank)
42
+ akdd ast stats Show AST index stats
43
+ akdd ast symbols <f> Show symbols in a file
44
+ akdd ast-impact <f> Full impact analysis of a file/module
45
+ akdd why <entity> Explain why something exists (causal chain)
46
+
47
+ Specs & Autonomy:
48
+ akdd spec list List all module specs
49
+ akdd spec <module> Show spec status + next wave
50
+ akdd spec create <m> Create feature spec for a module
51
+ akdd spec create <m> --bugfix Create bugfix spec
52
+
53
+ Knowledge Base:
54
+ akdd adr Ingest ADRs from docs/adr/
55
+ akdd knowledge Ingest gotchas/conventions from docs/
56
+
57
+ Metrics & Observability:
58
+ akdd metrics Project KPIs — success rate, rework, autonomy score
59
+ akdd metrics trend Show trend of last 10 cycles
60
+ akdd trail Recent decision trails (what changed and why)
61
+ akdd trail <ciclo_id> Full trail of a specific cycle
62
+ akdd trail why <f> Why does this file/entity exist?
36
63
 
37
64
  Intelligence v2.2:
38
- akdd git-context Analyze git diff + risk assessment from episodic memory
39
- akdd predict Show predictive patterns detected from episodic memory
40
- akdd embed-status Check local embeddings status (all-MiniLM-L6-v2)
41
- akdd embed-install Install local embeddings (~23MB, 100% offline)
42
- akdd ci-install Install GitHub Actions workflow for auto CI/CD memory
43
- akdd ci-status Show last CI/CD reports stored in memory
44
- akdd ci-report Report CI result to memory (called by CI workflow)
45
-
46
- akdd --version Show version
47
- akdd --help Show this help
48
-
49
- After init, open the project in Cursor or Claude Code and type:
50
- aa: [your task]
65
+ akdd git-context Analyze git diff + risk assessment
66
+ akdd predict Predictive risk patterns from episodic memory
67
+ akdd embed-status Local embeddings status
68
+ akdd embed-install Install local embeddings (~23MB, offline)
69
+ akdd jina-install Install jina-v2-code embeddings (~500MB, code-optimized)
70
+ akdd ci-install Install GitHub Actions CI/CD workflow
71
+ akdd ci-status Show last CI/CD reports
72
+
73
+ Dashboard:
74
+ akdd dashboard Open visual dashboard in browser
75
+
76
+ MCP Server (Cursor / Claude Code):
77
+ node .agentic/grafo/mcp-server.cjs
78
+ See: github.com/Adrianlpz211/Agentic-KDD-MCP
79
+
80
+ akdd --version / akdd --help
51
81
  `;
52
82
 
53
83
  function findGrafo() {
54
84
  const p = path.join(process.cwd(), '.agentic', 'grafo', 'grafo.cjs');
55
- if (!fs.existsSync(p)) {
56
- console.log('\n grafo.cjs not found. Run: akdd update\n');
57
- process.exit(1);
58
- }
85
+ if (!fs.existsSync(p)) { console.log('\n grafo.cjs not found. Run: akdd update\n'); process.exit(1); }
59
86
  return p;
60
87
  }
61
88
 
62
89
  function runGrafo(cmd, extra) {
63
90
  const grafo = findGrafo();
64
- try {
65
- execSync(`node "${grafo}" ${cmd}${extra ? ' ' + extra : ''}`, {
66
- stdio: 'inherit', cwd: process.cwd()
67
- });
68
- } catch(e) { process.exit(1); }
91
+ const fullCmd = extra ? `node "${grafo}" ${cmd} ${extra}` : `node "${grafo}" ${cmd}`;
92
+ try { execSync(fullCmd, { stdio: 'inherit', cwd: process.cwd() }); }
93
+ catch(e) { process.exit(e.status || 1); }
69
94
  }
70
95
 
71
- function runGrafoPipe(cmd, extra) {
72
- const grafo = findGrafo();
73
- try {
74
- return execSync(`node "${grafo}" ${cmd}${extra ? ' ' + extra : ''}`, {
75
- stdio: 'pipe', cwd: process.cwd()
76
- }).toString();
77
- } catch(e) { return ''; }
96
+ function runModule(name, cmd, extra) {
97
+ const p = path.join(process.cwd(), '.agentic', 'grafo', name);
98
+ if (!fs.existsSync(p)) { console.log(`\n ${name} not found. Run: akdd update\n`); process.exit(1); }
99
+ const fullCmd = [
100
+ `node "${p}"`,
101
+ cmd || '',
102
+ extra || ''
103
+ ].join(' ').trim().replace(/\s+/g,' ');
104
+ try { execSync(fullCmd, { stdio: 'inherit', cwd: process.cwd() }); }
105
+ catch(e) { process.exit(e.status || 1); }
78
106
  }
79
107
 
80
108
  switch (command) {
81
109
 
82
- // ── Comandos existentes ─────────────────────────────────────────────────────
83
- case 'init':
84
- init(); break;
85
-
86
- case 'update':
87
- update(); break;
88
-
89
- case 'analyze':
90
- case 'analizar':
91
- analyze(); break;
110
+ case 'init': init(); break;
111
+ case 'update': update(); break;
112
+ case 'analyze': analyze(); break;
92
113
 
93
- case 'graph':
94
- graph(); break;
95
-
96
- case 'sync':
97
- runGrafo('sync'); break;
98
-
99
- case 'stats':
100
- runGrafo('stats'); break;
101
-
102
- case 'coala':
103
- runGrafo('coala'); break;
114
+ // ── v3.0: Health ────────────────────────────────────────────────────────
115
+ case 'health': {
116
+ const fixFlag = args.includes('--fix') ? '--fix' : '';
117
+ runModule('health-check.cjs', fixFlag);
118
+ break;
119
+ }
104
120
 
105
- case 'metricas':
106
- runGrafo('metricas'); break;
121
+ // ── Core memory ────────────────────────────────────────────────────────
122
+ case 'sync': runGrafo('sync'); break;
123
+ case 'graph': graph(); break;
124
+ case 'stats': runGrafo('stats'); break;
125
+ case 'coala': runGrafo('coala'); break;
126
+ case 'metricas': runGrafo('metricas'); break;
127
+ case 'decay': runGrafo('decay'); break;
107
128
 
108
129
  case 'buscar':
109
130
  if (!arg1) { console.log('\n Uso: akdd buscar "query" [area]\n'); break; }
@@ -115,81 +136,117 @@ switch (command) {
115
136
  runGrafo('impacto', `"${arg1}"`);
116
137
  break;
117
138
 
118
- case 'decay':
119
- runGrafo('decay'); break;
139
+ // ── v3.0: Memory Audit ─────────────────────────────────────────────────
140
+ case 'audit': runModule('memory-audit.cjs', 'report'); break;
120
141
 
121
- case 'dashboard':
122
- dashboard(); break;
123
-
124
- // ── v2.2: Intelligence features ────────────────────────────────────────────
125
-
126
- case 'git-context': {
127
- if (args.includes('--install-hook')) {
128
- runGrafo('git-context', '--install-hook');
129
- break;
130
- }
131
- runGrafo('git-context');
142
+ case 'forget': {
143
+ if (!arg1) { console.log('\n Uso: akdd forget <id> "<razón>"\n'); break; }
144
+ const reason = args.slice(2).join(' ');
145
+ if (!reason) { console.log('\n Uso: akdd forget <id> "<razón>"\n'); break; }
146
+ runModule('memory-audit.cjs', 'forget', `${arg1} "${reason}"`);
132
147
  break;
133
148
  }
134
149
 
135
- case 'predict': {
136
- runGrafo('predict');
150
+ // ── v3.0: AST ──────────────────────────────────────────────────────────
151
+ case 'ast': {
152
+ const sub = arg1 || 'index';
153
+ const tgt = arg2 || '';
154
+ if (sub === 'stats') runModule('ast-indexer.cjs', 'stats');
155
+ else if (sub === 'symbols') {
156
+ if (!tgt) { console.log('\n Uso: akdd ast symbols <archivo>\n'); break; }
157
+ runModule('ast-indexer.cjs', 'symbols', `"${tgt}"`);
158
+ } else {
159
+ runModule('ast-indexer.cjs', 'index', tgt);
160
+ }
137
161
  break;
138
162
  }
139
163
 
140
- case 'embed-status': {
141
- runGrafo('embed-status');
164
+ case 'ast-impact':
165
+ if (!arg1) { console.log('\n Uso: akdd ast-impact <archivo_o_módulo>\n'); break; }
166
+ runModule('impact-analyzer.cjs', 'analyze', `"${arg1}"`);
142
167
  break;
143
- }
144
168
 
145
- case 'embed-install': {
146
- runGrafo('embed-install');
169
+ case 'why':
170
+ if (!arg1) { console.log('\n Uso: akdd why <archivo_o_entidad>\n'); break; }
171
+ runModule('decision-trail.cjs', 'why', `"${arg1}"`);
147
172
  break;
148
- }
149
173
 
150
- case 'ci-install': {
151
- runGrafo('ci-install');
174
+ // ── v3.0: Specs ────────────────────────────────────────────────────────
175
+ case 'spec': {
176
+ const sub = arg1;
177
+ const mod = arg2;
178
+ if (!sub || sub === 'list') runModule('spec-manager.cjs', 'list');
179
+ else if (sub === 'create') {
180
+ if (!mod) { console.log('\n Uso: akdd spec create <módulo> [--bugfix]\n'); break; }
181
+ runModule('spec-manager.cjs', 'create', `"${mod}"${args.includes('--bugfix') ? ' --bugfix' : ''}`);
182
+ }
183
+ else if (sub === 'waves') { if (!mod) { console.log('\n Uso: akdd spec waves <módulo>\n'); break; } runModule('spec-manager.cjs', 'waves', `"${mod}"`); }
184
+ else if (sub === 'validate') { if (!mod) { console.log('\n Uso: akdd spec validate <módulo>\n'); break; } runModule('spec-manager.cjs', 'validate', `"${mod}"`); }
185
+ else runModule('spec-manager.cjs', 'status', `"${sub}"`);
152
186
  break;
153
187
  }
154
188
 
155
- case 'ci-status': {
156
- runGrafo('ci-status');
189
+ case 'spec-create':
190
+ if (!arg1) { console.log('\n Uso: akdd spec-create <módulo> [--bugfix]\n'); break; }
191
+ runModule('spec-manager.cjs', 'create', `"${arg1}"${args.includes('--bugfix') ? ' --bugfix' : ''}`);
157
192
  break;
158
- }
159
193
 
160
- case 'ci-report': {
161
- // Llamado por GitHub Actions — no interrumpir el CI si falla
162
- const grafo = path.join(process.cwd(), '.agentic', 'grafo', 'grafo.cjs');
163
- if (!fs.existsSync(grafo)) { process.exit(0); }
194
+ // ── v3.0: Knowledge ────────────────────────────────────────────────────
195
+ case 'adr':
196
+ runModule('adr-ingestor.cjs', 'ingest', arg1 || 'docs/adr');
197
+ break;
164
198
 
165
- const esExito = args.includes('--success');
166
- const outputIdx = args.indexOf('--output');
167
- const outputFile = outputIdx >= 0 ? args[outputIdx + 1] : null;
199
+ case 'knowledge':
200
+ runModule('knowledge-ingestor.cjs', 'ingest', arg1 || '');
201
+ break;
168
202
 
169
- const flags = [
170
- esExito ? '--success' : '',
171
- outputFile ? `--output "${outputFile}"` : ''
172
- ].filter(Boolean).join(' ');
203
+ // ── v3.0: Metrics ──────────────────────────────────────────────────────
204
+ case 'metrics':
205
+ runModule('metrics.cjs', arg1 || 'summary');
206
+ break;
173
207
 
174
- try {
175
- execSync(`node "${grafo}" ci-report ${flags}`, {
176
- stdio: 'inherit', cwd: process.cwd(), timeout: 60000
177
- });
178
- } catch(e) { process.exit(0); } // no fallar el CI
208
+ // ── v3.0: Decision Trail ───────────────────────────────────────────────
209
+ case 'trail': {
210
+ if (!arg1) runModule('decision-trail.cjs', 'recent', '5');
211
+ else if (arg1 === 'why') { if (!arg2) { console.log('\n Uso: akdd trail why <entidad>\n'); break; } runModule('decision-trail.cjs', 'why', `"${arg2}"`); }
212
+ else if (arg1 === 'timeline'){ if (!arg2) { console.log('\n Uso: akdd trail timeline <módulo>\n'); break; } runModule('decision-trail.cjs', 'timeline', `"${arg2}"`); }
213
+ else runModule('decision-trail.cjs', 'ciclo', `"${arg1}"`);
179
214
  break;
180
215
  }
181
216
 
182
- // ── Meta ────────────────────────────────────────────────────────────────────
183
- case '--version':
184
- case '-v':
185
- console.log(pkg.version);
217
+ // ── Dashboard ──────────────────────────────────────────────────────────
218
+ case 'dashboard': dashboard(); break;
219
+
220
+ // ── v2.2: Intelligence ─────────────────────────────────────────────────
221
+ case 'git-context': runGrafo('git-context', args.includes('--install-hook') ? '--install-hook' : ''); break;
222
+ case 'predict': runGrafo('predict'); break;
223
+ case 'embed-status': runGrafo('embed-status'); break;
224
+ case 'embed-install': runGrafo('embed-install'); break;
225
+
226
+ case 'jina-install':
227
+ runModule('embeddings.cjs', 'install-jina');
186
228
  break;
187
229
 
188
- case '--help':
189
- case '-h':
190
- case undefined:
191
- console.log(HELP);
230
+ case 'ci-install': runGrafo('ci-install'); break;
231
+ case 'ci-status': runGrafo('ci-status'); break;
232
+
233
+ case 'ci-report': {
234
+ const grafo = path.join(process.cwd(), '.agentic', 'grafo', 'grafo.cjs');
235
+ if (!fs.existsSync(grafo)) { process.exit(0); }
236
+ const esExito = args.includes('--success');
237
+ const outIdx = args.indexOf('--output');
238
+ const outFile = outIdx >= 0 ? args[outIdx + 1] : null;
239
+ const flags = [esExito ? '--success' : '', outFile ? `--output "${outFile}"` : ''].filter(Boolean).join(' ');
240
+ try { execSync(`node "${grafo}" ci-report ${flags}`, { stdio: 'inherit', cwd: process.cwd(), timeout: 60000 }); }
241
+ catch(e) { process.exit(0); }
192
242
  break;
243
+ }
244
+
245
+ case '--version': case '-v':
246
+ console.log(pkg.version); break;
247
+
248
+ case '--help': case '-h': case undefined:
249
+ console.log(HELP); break;
193
250
 
194
251
  default:
195
252
  console.log(`\n Unknown command: ${command}`);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "agentic-kdd",
3
- "version": "2.2.13",
4
- "description": "Autonomous development pipeline with KDD — aa: · ag: · audit: · Git Context · Prediction · Local Embeddings · CI/CD. Works with Cursor and Claude Code.",
3
+ "version": "3.0.1",
4
+ "description": "Autonomous development pipeline — aa: · ag: · audit: · AST graph · Harness · Specs · Impact analysis · Decision trail · Metrics · MCP server. Works with Cursor and Claude Code.",
5
5
  "main": "src/index.js",
6
6
  "bin": {
7
7
  "akdd": "bin/akdd.js"
@@ -21,7 +21,12 @@
21
21
  "knowledge-driven",
22
22
  "agentic",
23
23
  "sqlite",
24
- "dashboard"
24
+ "dashboard",
25
+ "mcp",
26
+ "ast",
27
+ "harness",
28
+ "specs",
29
+ "memory"
25
30
  ],
26
31
  "author": "Adrianlpz211",
27
32
  "license": "MIT",