agentic-kdd 2.0.0
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/README.md +68 -0
- package/bin/akdd.js +46 -0
- package/package.json +40 -0
- package/src/init.js +309 -0
- package/src/update.js +92 -0
package/README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# agentic-kdd CLI
|
|
2
|
+
|
|
3
|
+
Install [Agentic KDD](https://github.com/Adrianlpz211/Agentic-KDD) in any project with one command.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g agentic-kdd
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Initialize a project
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
cd your-project
|
|
17
|
+
akdd init
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Detects your stack, asks 3 questions, and installs Agentic KDD.
|
|
21
|
+
Then open the project in Cursor or Claude Code and type:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
aa: [your task]
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Update to latest version
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
akdd update
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Updates agent instructions to the latest version.
|
|
34
|
+
Your memory, config, and knowledge base are never touched.
|
|
35
|
+
|
|
36
|
+
## What gets installed
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
your-project/
|
|
40
|
+
├── CLAUDE.md ← Claude Code reads this automatically
|
|
41
|
+
├── _LOCKS.md ← parallel instance coordination
|
|
42
|
+
├── _output/ ← auto-generated decision logs
|
|
43
|
+
├── .cursor/rules/agentic.mdc ← Cursor reads this automatically
|
|
44
|
+
└── .agentic/
|
|
45
|
+
├── config.md ← auto-configured for your stack
|
|
46
|
+
├── PLAN.md ← active task tracker
|
|
47
|
+
├── memoria/ ← KDD knowledge base
|
|
48
|
+
│ ├── trabajo.md
|
|
49
|
+
│ ├── errores.md
|
|
50
|
+
│ ├── patrones.md
|
|
51
|
+
│ └── decisiones.md
|
|
52
|
+
├── agentes/ ← 8 agent instruction files
|
|
53
|
+
└── conocimiento/ ← drop your project docs here
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Requirements
|
|
57
|
+
|
|
58
|
+
- Node.js 18+
|
|
59
|
+
- curl (pre-installed on Mac/Linux; on Windows use Git Bash)
|
|
60
|
+
|
|
61
|
+
## Links
|
|
62
|
+
|
|
63
|
+
- [GitHub](https://github.com/Adrianlpz211/Agentic-KDD)
|
|
64
|
+
- [Documentation](https://github.com/Adrianlpz211/Agentic-KDD/blob/main/docs/kdd-methodology.md)
|
|
65
|
+
|
|
66
|
+
## License
|
|
67
|
+
|
|
68
|
+
MIT
|
package/bin/akdd.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
'use strict';
|
|
4
|
+
|
|
5
|
+
const { init } = require('../src/init');
|
|
6
|
+
const { update } = require('../src/update');
|
|
7
|
+
const pkg = require('../package.json');
|
|
8
|
+
|
|
9
|
+
const args = process.argv.slice(2);
|
|
10
|
+
const command = args[0];
|
|
11
|
+
|
|
12
|
+
const HELP = `
|
|
13
|
+
Agentic KDD v${pkg.version}
|
|
14
|
+
Autonomous development pipeline with Knowledge-Driven Development
|
|
15
|
+
|
|
16
|
+
Usage:
|
|
17
|
+
akdd init Install Agentic KDD in the current project
|
|
18
|
+
akdd update Update to the latest version (keeps your memory intact)
|
|
19
|
+
akdd --version Show version
|
|
20
|
+
akdd --help Show this help
|
|
21
|
+
|
|
22
|
+
After init, open the project in Cursor or Claude Code and type:
|
|
23
|
+
aa: [your task]
|
|
24
|
+
`;
|
|
25
|
+
|
|
26
|
+
switch (command) {
|
|
27
|
+
case 'init':
|
|
28
|
+
init();
|
|
29
|
+
break;
|
|
30
|
+
case 'update':
|
|
31
|
+
update();
|
|
32
|
+
break;
|
|
33
|
+
case '--version':
|
|
34
|
+
case '-v':
|
|
35
|
+
console.log(pkg.version);
|
|
36
|
+
break;
|
|
37
|
+
case '--help':
|
|
38
|
+
case '-h':
|
|
39
|
+
case undefined:
|
|
40
|
+
console.log(HELP);
|
|
41
|
+
break;
|
|
42
|
+
default:
|
|
43
|
+
console.log(`\n Unknown command: ${command}`);
|
|
44
|
+
console.log(' Run akdd --help for usage\n');
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "agentic-kdd",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Autonomous development pipeline with Knowledge-Driven Development. Works with Cursor and Claude Code. Just type aa:",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"akdd": "./bin/akdd.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"test": "node bin/akdd.js --version"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"ai",
|
|
14
|
+
"cursor",
|
|
15
|
+
"claude-code",
|
|
16
|
+
"autonomous",
|
|
17
|
+
"development",
|
|
18
|
+
"pipeline",
|
|
19
|
+
"kdd",
|
|
20
|
+
"knowledge-driven",
|
|
21
|
+
"agentic"
|
|
22
|
+
],
|
|
23
|
+
"author": "Adrianlpz211",
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "https://github.com/Adrianlpz211/Agentic-KDD.git"
|
|
28
|
+
},
|
|
29
|
+
"homepage": "https://github.com/Adrianlpz211/Agentic-KDD",
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=18.0.0"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"axios": "^1.6.0",
|
|
35
|
+
"fs-extra": "^11.2.0",
|
|
36
|
+
"chalk": "^4.1.2",
|
|
37
|
+
"ora": "^5.4.1",
|
|
38
|
+
"inquirer": "^8.2.6"
|
|
39
|
+
}
|
|
40
|
+
}
|
package/src/init.js
ADDED
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('fs-extra');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const https = require('https');
|
|
6
|
+
const { execSync } = require('child_process');
|
|
7
|
+
|
|
8
|
+
// Chalk y ora en versiones CommonJS
|
|
9
|
+
const chalk = require('chalk');
|
|
10
|
+
const ora = require('ora');
|
|
11
|
+
const inquirer = require('inquirer');
|
|
12
|
+
|
|
13
|
+
const GITHUB_REPO = 'Adrianlpz211/Agentic-KDD';
|
|
14
|
+
const GITHUB_API = `https://api.github.com/repos/${GITHUB_REPO}/tarball/main`;
|
|
15
|
+
const TEMP_DIR = path.join(require('os').tmpdir(), 'agentic-kdd-download');
|
|
16
|
+
|
|
17
|
+
// ── Detectar stack del proyecto ────────────────────────────────
|
|
18
|
+
function detectStack(projectPath) {
|
|
19
|
+
const stack = {
|
|
20
|
+
hasNode: false,
|
|
21
|
+
hasPhp: false,
|
|
22
|
+
hasPython: false,
|
|
23
|
+
framework: '—',
|
|
24
|
+
packageManager: 'npm',
|
|
25
|
+
commands: {
|
|
26
|
+
install: 'npm install',
|
|
27
|
+
dev: 'npm run dev',
|
|
28
|
+
build: 'npm run build',
|
|
29
|
+
test: 'npm test',
|
|
30
|
+
lint: 'npm run lint'
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// Node.js
|
|
35
|
+
if (fs.existsSync(path.join(projectPath, 'package.json'))) {
|
|
36
|
+
stack.hasNode = true;
|
|
37
|
+
const pkg = fs.readJsonSync(path.join(projectPath, 'package.json'), { throws: false }) || {};
|
|
38
|
+
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
39
|
+
|
|
40
|
+
// Package manager
|
|
41
|
+
if (fs.existsSync(path.join(projectPath, 'pnpm-lock.yaml'))) {
|
|
42
|
+
stack.packageManager = 'pnpm';
|
|
43
|
+
stack.commands.install = 'pnpm install';
|
|
44
|
+
stack.commands.dev = 'pnpm dev';
|
|
45
|
+
stack.commands.build = 'pnpm build';
|
|
46
|
+
stack.commands.test = 'pnpm test';
|
|
47
|
+
stack.commands.lint = 'pnpm lint';
|
|
48
|
+
} else if (fs.existsSync(path.join(projectPath, 'yarn.lock'))) {
|
|
49
|
+
stack.packageManager = 'yarn';
|
|
50
|
+
stack.commands.install = 'yarn install';
|
|
51
|
+
stack.commands.dev = 'yarn dev';
|
|
52
|
+
stack.commands.build = 'yarn build';
|
|
53
|
+
stack.commands.test = 'yarn test';
|
|
54
|
+
stack.commands.lint = 'yarn lint';
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Framework
|
|
58
|
+
if (deps['next']) stack.framework = `Next.js ${deps['next'].replace('^', '')}`;
|
|
59
|
+
else if (deps['react']) stack.framework = `React ${deps['react'].replace('^', '')}`;
|
|
60
|
+
else if (deps['vue']) stack.framework = `Vue ${deps['vue'].replace('^', '')}`;
|
|
61
|
+
else if (deps['express']) stack.framework = `Express ${deps['express'].replace('^', '')}`;
|
|
62
|
+
else if (deps['fastify']) stack.framework = `Fastify`;
|
|
63
|
+
else if (deps['@nestjs/core']) stack.framework = `NestJS`;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// PHP
|
|
67
|
+
if (fs.existsSync(path.join(projectPath, 'composer.json'))) {
|
|
68
|
+
stack.hasPhp = true;
|
|
69
|
+
stack.packageManager = 'composer';
|
|
70
|
+
stack.commands.install = 'composer install';
|
|
71
|
+
stack.commands.dev = 'php artisan serve';
|
|
72
|
+
stack.commands.build = 'composer build';
|
|
73
|
+
stack.commands.test = './vendor/bin/phpunit';
|
|
74
|
+
stack.commands.lint = 'composer lint';
|
|
75
|
+
const composer = fs.readJsonSync(path.join(projectPath, 'composer.json'), { throws: false }) || {};
|
|
76
|
+
const require = composer.require || {};
|
|
77
|
+
if (require['laravel/framework']) stack.framework = 'Laravel';
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Python
|
|
81
|
+
if (fs.existsSync(path.join(projectPath, 'pyproject.toml')) ||
|
|
82
|
+
fs.existsSync(path.join(projectPath, 'requirements.txt'))) {
|
|
83
|
+
stack.hasPython = true;
|
|
84
|
+
stack.packageManager = 'pip';
|
|
85
|
+
stack.commands.install = 'pip install -r requirements.txt';
|
|
86
|
+
stack.commands.dev = 'uvicorn main:app --reload';
|
|
87
|
+
stack.commands.build = 'pip install -e .';
|
|
88
|
+
stack.commands.test = 'pytest';
|
|
89
|
+
stack.commands.lint = 'flake8';
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return stack;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// ── Descargar archivos de Agentic KDD desde GitHub ────────────
|
|
96
|
+
async function downloadFromGitHub(spinner) {
|
|
97
|
+
return new Promise((resolve, reject) => {
|
|
98
|
+
spinner.text = 'Downloading Agentic KDD from GitHub...';
|
|
99
|
+
|
|
100
|
+
const tmpFile = path.join(require('os').tmpdir(), 'agentic-kdd.tar.gz');
|
|
101
|
+
|
|
102
|
+
// Usar curl o wget si están disponibles (más confiable que https nativo)
|
|
103
|
+
try {
|
|
104
|
+
execSync(`curl -sL "https://github.com/${GITHUB_REPO}/archive/refs/heads/main.tar.gz" -o "${tmpFile}"`, {
|
|
105
|
+
stdio: 'pipe'
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
// Extraer
|
|
109
|
+
fs.ensureDirSync(TEMP_DIR);
|
|
110
|
+
execSync(`tar -xzf "${tmpFile}" -C "${TEMP_DIR}" --strip-components=1`, {
|
|
111
|
+
stdio: 'pipe'
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
fs.removeSync(tmpFile);
|
|
115
|
+
resolve(TEMP_DIR);
|
|
116
|
+
} catch (err) {
|
|
117
|
+
reject(new Error('Could not download from GitHub. Check your internet connection.'));
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// ── Copiar archivos de Agentic al proyecto ─────────────────────
|
|
123
|
+
function copyAgenticFiles(sourcePath, projectPath, spinner) {
|
|
124
|
+
const filesToCopy = [
|
|
125
|
+
'.agentic',
|
|
126
|
+
'.cursor',
|
|
127
|
+
'CLAUDE.md',
|
|
128
|
+
'_LOCKS.md',
|
|
129
|
+
'_output',
|
|
130
|
+
'docs'
|
|
131
|
+
];
|
|
132
|
+
|
|
133
|
+
spinner.text = 'Installing Agentic KDD files...';
|
|
134
|
+
|
|
135
|
+
for (const file of filesToCopy) {
|
|
136
|
+
const src = path.join(sourcePath, file);
|
|
137
|
+
const dest = path.join(projectPath, file);
|
|
138
|
+
|
|
139
|
+
if (fs.existsSync(src)) {
|
|
140
|
+
// No sobreescribir memoria si ya existe
|
|
141
|
+
if (file === '.agentic' && fs.existsSync(dest)) {
|
|
142
|
+
// Solo actualizar agentes, no memoria ni config
|
|
143
|
+
const agentsSrc = path.join(src, 'agentes');
|
|
144
|
+
const agentsDest = path.join(dest, 'agentes');
|
|
145
|
+
if (fs.existsSync(agentsSrc)) {
|
|
146
|
+
fs.copySync(agentsSrc, agentsDest, { overwrite: true });
|
|
147
|
+
}
|
|
148
|
+
// Copiar conocimiento README si no existe
|
|
149
|
+
const knowledgeReadmeSrc = path.join(src, 'conocimiento', 'README.md');
|
|
150
|
+
const knowledgeReadmeDest = path.join(dest, 'conocimiento', 'README.md');
|
|
151
|
+
if (fs.existsSync(knowledgeReadmeSrc) && !fs.existsSync(knowledgeReadmeDest)) {
|
|
152
|
+
fs.copySync(knowledgeReadmeSrc, knowledgeReadmeDest);
|
|
153
|
+
}
|
|
154
|
+
} else {
|
|
155
|
+
fs.copySync(src, dest, { overwrite: true });
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// ── Configurar config.md con el stack detectado ────────────────
|
|
162
|
+
function configureProject(projectPath, stack, answers) {
|
|
163
|
+
const configPath = path.join(projectPath, '.agentic', 'config.md');
|
|
164
|
+
|
|
165
|
+
if (!fs.existsSync(configPath)) return;
|
|
166
|
+
|
|
167
|
+
const projectName = answers.name || path.basename(projectPath);
|
|
168
|
+
const projectDesc = answers.description || '—';
|
|
169
|
+
const isNew = answers.isNew;
|
|
170
|
+
|
|
171
|
+
const config = `# Agentic KDD — Configuración del proyecto
|
|
172
|
+
CONFIGURADO: SI
|
|
173
|
+
VERSION: 2.0
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Proyecto
|
|
178
|
+
Nombre: ${projectName}
|
|
179
|
+
Descripción: ${projectDesc}
|
|
180
|
+
Tipo: ${isNew ? 'NUEVO' : 'EXISTENTE'}
|
|
181
|
+
|
|
182
|
+
## Stack
|
|
183
|
+
\`\`\`yaml
|
|
184
|
+
frontend:
|
|
185
|
+
framework: ${stack.framework}
|
|
186
|
+
language: ${stack.hasPhp ? 'PHP' : stack.hasPython ? 'Python' : 'TypeScript'}
|
|
187
|
+
|
|
188
|
+
backend:
|
|
189
|
+
runtime: ${stack.hasNode ? 'Node.js' : stack.hasPhp ? 'PHP' : 'Python'}
|
|
190
|
+
framework: ${stack.framework}
|
|
191
|
+
base_datos: —
|
|
192
|
+
|
|
193
|
+
devops:
|
|
194
|
+
package_manager: ${stack.packageManager}
|
|
195
|
+
|
|
196
|
+
commands:
|
|
197
|
+
install: ${stack.commands.install}
|
|
198
|
+
dev: ${stack.commands.dev}
|
|
199
|
+
build: ${stack.commands.build}
|
|
200
|
+
test: ${stack.commands.test}
|
|
201
|
+
lint: ${stack.commands.lint}
|
|
202
|
+
\`\`\`
|
|
203
|
+
|
|
204
|
+
## Arquitectura
|
|
205
|
+
_El agente Setup completa esto al analizar el proyecto._
|
|
206
|
+
|
|
207
|
+
## Módulos
|
|
208
|
+
### Implementados
|
|
209
|
+
_Ninguno aún._
|
|
210
|
+
|
|
211
|
+
### Pendientes
|
|
212
|
+
_Ninguno aún._
|
|
213
|
+
|
|
214
|
+
## Archivos compartidos críticos
|
|
215
|
+
_El Setup los detecta._
|
|
216
|
+
|
|
217
|
+
## Reglas del proyecto
|
|
218
|
+
_Se definen durante el desarrollo._
|
|
219
|
+
|
|
220
|
+
## Sinónimos del proyecto
|
|
221
|
+
_Sin sinónimos registrados aún._
|
|
222
|
+
`;
|
|
223
|
+
|
|
224
|
+
fs.writeFileSync(configPath, config, 'utf8');
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// ── Comando principal: akdd init ───────────────────────────────
|
|
228
|
+
async function init() {
|
|
229
|
+
const projectPath = process.cwd();
|
|
230
|
+
|
|
231
|
+
console.log('\n' + chalk.bold.blue(' Agentic KDD') + chalk.gray(' — autonomous development pipeline'));
|
|
232
|
+
console.log(chalk.gray(' github.com/Adrianlpz211/Agentic-KDD\n'));
|
|
233
|
+
|
|
234
|
+
// Verificar si ya está instalado
|
|
235
|
+
const alreadyInstalled = fs.existsSync(path.join(projectPath, '.agentic', 'config.md'));
|
|
236
|
+
if (alreadyInstalled) {
|
|
237
|
+
const { confirm } = await inquirer.prompt([{
|
|
238
|
+
type: 'confirm',
|
|
239
|
+
name: 'confirm',
|
|
240
|
+
message: chalk.yellow('Agentic KDD is already installed in this project. Reinstall?'),
|
|
241
|
+
default: false
|
|
242
|
+
}]);
|
|
243
|
+
if (!confirm) {
|
|
244
|
+
console.log(chalk.gray('\n Run akdd update to update without losing your memory.\n'));
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// Detectar stack
|
|
250
|
+
const spinner = ora({ text: 'Detecting project stack...', color: 'blue' }).start();
|
|
251
|
+
const stack = detectStack(projectPath);
|
|
252
|
+
spinner.succeed(chalk.green(`Stack detected: ${stack.framework} (${stack.packageManager})`));
|
|
253
|
+
|
|
254
|
+
// Preguntas
|
|
255
|
+
const answers = await inquirer.prompt([
|
|
256
|
+
{
|
|
257
|
+
type: 'input',
|
|
258
|
+
name: 'name',
|
|
259
|
+
message: 'Project name:',
|
|
260
|
+
default: path.basename(projectPath)
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
type: 'input',
|
|
264
|
+
name: 'description',
|
|
265
|
+
message: 'What does this project do? (1-2 lines):',
|
|
266
|
+
default: '—'
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
type: 'confirm',
|
|
270
|
+
name: 'isNew',
|
|
271
|
+
message: 'Is this a new project (from scratch)?',
|
|
272
|
+
default: !fs.existsSync(path.join(projectPath, 'src')) &&
|
|
273
|
+
!fs.existsSync(path.join(projectPath, 'app'))
|
|
274
|
+
}
|
|
275
|
+
]);
|
|
276
|
+
|
|
277
|
+
// Descargar e instalar
|
|
278
|
+
const installSpinner = ora({ text: 'Downloading Agentic KDD...', color: 'blue' }).start();
|
|
279
|
+
|
|
280
|
+
try {
|
|
281
|
+
const sourcePath = await downloadFromGitHub(installSpinner);
|
|
282
|
+
|
|
283
|
+
installSpinner.text = 'Installing files...';
|
|
284
|
+
copyAgenticFiles(sourcePath, projectPath, installSpinner);
|
|
285
|
+
|
|
286
|
+
installSpinner.text = 'Configuring project...';
|
|
287
|
+
configureProject(projectPath, stack, answers);
|
|
288
|
+
|
|
289
|
+
// Limpiar temp
|
|
290
|
+
fs.removeSync(TEMP_DIR);
|
|
291
|
+
|
|
292
|
+
installSpinner.succeed(chalk.green('Agentic KDD installed successfully!'));
|
|
293
|
+
|
|
294
|
+
// Mensaje final
|
|
295
|
+
console.log('\n' + chalk.bold(' Ready. Open this project in Cursor or Claude Code and type:\n'));
|
|
296
|
+
console.log(chalk.cyan(' aa: configurar') + chalk.gray(' ← let the Setup agent fine-tune the configuration'));
|
|
297
|
+
console.log(chalk.cyan(' aa: [your task]') + chalk.gray(' ← start building\n'));
|
|
298
|
+
|
|
299
|
+
console.log(chalk.gray(' Documentation: https://github.com/Adrianlpz211/Agentic-KDD\n'));
|
|
300
|
+
|
|
301
|
+
} catch (err) {
|
|
302
|
+
installSpinner.fail(chalk.red('Installation failed'));
|
|
303
|
+
console.error(chalk.red('\n Error: ' + err.message));
|
|
304
|
+
console.log(chalk.gray(' Try downloading manually from: https://github.com/Adrianlpz211/Agentic-KDD\n'));
|
|
305
|
+
process.exit(1);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
module.exports = { init };
|
package/src/update.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('fs-extra');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const { execSync } = require('child_process');
|
|
6
|
+
const chalk = require('chalk');
|
|
7
|
+
const ora = require('ora');
|
|
8
|
+
|
|
9
|
+
const GITHUB_REPO = 'Adrianlpz211/Agentic-KDD';
|
|
10
|
+
const TEMP_DIR = path.join(require('os').tmpdir(), 'agentic-kdd-update');
|
|
11
|
+
|
|
12
|
+
// ── Comando: akdd update ───────────────────────────────────────
|
|
13
|
+
async function update() {
|
|
14
|
+
const projectPath = process.cwd();
|
|
15
|
+
|
|
16
|
+
console.log('\n' + chalk.bold.blue(' Agentic KDD') + chalk.gray(' — updating...\n'));
|
|
17
|
+
|
|
18
|
+
// Verificar que está instalado
|
|
19
|
+
if (!fs.existsSync(path.join(projectPath, '.agentic', 'config.md'))) {
|
|
20
|
+
console.log(chalk.yellow(' Agentic KDD is not installed in this project.'));
|
|
21
|
+
console.log(chalk.gray(' Run akdd init to install it.\n'));
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const spinner = ora({ text: 'Downloading latest version from GitHub...', color: 'blue' }).start();
|
|
26
|
+
|
|
27
|
+
try {
|
|
28
|
+
const tmpFile = path.join(require('os').tmpdir(), 'agentic-kdd-update.tar.gz');
|
|
29
|
+
|
|
30
|
+
// Descargar
|
|
31
|
+
execSync(
|
|
32
|
+
`curl -sL "https://github.com/${GITHUB_REPO}/archive/refs/heads/main.tar.gz" -o "${tmpFile}"`,
|
|
33
|
+
{ stdio: 'pipe' }
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
// Extraer
|
|
37
|
+
fs.ensureDirSync(TEMP_DIR);
|
|
38
|
+
execSync(`tar -xzf "${tmpFile}" -C "${TEMP_DIR}" --strip-components=1`, { stdio: 'pipe' });
|
|
39
|
+
fs.removeSync(tmpFile);
|
|
40
|
+
|
|
41
|
+
spinner.text = 'Updating agents (keeping your memory intact)...';
|
|
42
|
+
|
|
43
|
+
// Actualizar SOLO los agentes — no tocar memoria ni config
|
|
44
|
+
const agentsSrc = path.join(TEMP_DIR, '.agentic', 'agentes');
|
|
45
|
+
const agentsDest = path.join(projectPath, '.agentic', 'agentes');
|
|
46
|
+
|
|
47
|
+
if (fs.existsSync(agentsSrc)) {
|
|
48
|
+
fs.copySync(agentsSrc, agentsDest, { overwrite: true });
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Actualizar CLAUDE.md y cursor rules
|
|
52
|
+
const filesToUpdate = ['CLAUDE.md', '_LOCKS.md'];
|
|
53
|
+
for (const file of filesToUpdate) {
|
|
54
|
+
const src = path.join(TEMP_DIR, file);
|
|
55
|
+
const dest = path.join(projectPath, file);
|
|
56
|
+
if (fs.existsSync(src)) {
|
|
57
|
+
fs.copySync(src, dest, { overwrite: true });
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Actualizar cursor rules
|
|
62
|
+
const cursorSrc = path.join(TEMP_DIR, '.cursor');
|
|
63
|
+
const cursorDest = path.join(projectPath, '.cursor');
|
|
64
|
+
if (fs.existsSync(cursorSrc)) {
|
|
65
|
+
fs.copySync(cursorSrc, cursorDest, { overwrite: true });
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Limpiar temp
|
|
69
|
+
fs.removeSync(TEMP_DIR);
|
|
70
|
+
|
|
71
|
+
spinner.succeed(chalk.green('Updated successfully!'));
|
|
72
|
+
|
|
73
|
+
console.log('\n' + chalk.bold(' What was updated:'));
|
|
74
|
+
console.log(chalk.gray(' ✓ Agent instructions (.agentic/agentes/)'));
|
|
75
|
+
console.log(chalk.gray(' ✓ CLAUDE.md'));
|
|
76
|
+
console.log(chalk.gray(' ✓ Cursor rules\n'));
|
|
77
|
+
|
|
78
|
+
console.log(chalk.bold(' What was kept intact:'));
|
|
79
|
+
console.log(chalk.gray(' ✓ Your project memory (.agentic/memoria/)'));
|
|
80
|
+
console.log(chalk.gray(' ✓ Your project config (.agentic/config.md)'));
|
|
81
|
+
console.log(chalk.gray(' ✓ Your knowledge base (.agentic/conocimiento/)'));
|
|
82
|
+
console.log(chalk.gray(' ✓ Your PLAN.md\n'));
|
|
83
|
+
|
|
84
|
+
} catch (err) {
|
|
85
|
+
spinner.fail(chalk.red('Update failed'));
|
|
86
|
+
console.error(chalk.red('\n Error: ' + err.message));
|
|
87
|
+
console.log(chalk.gray(' Check your internet connection and try again.\n'));
|
|
88
|
+
process.exit(1);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
module.exports = { update };
|