awc-zns-mtd 2.9.0 → 2.10.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/.github/workflows/ci.yml +148 -0
- package/.husky/pre-commit +2 -0
- package/.prettierignore +31 -0
- package/.prettierrc +13 -0
- package/IMPLEMENTATION_SUMMARY.md +410 -0
- package/PHASE_2_SUMMARY.md +289 -0
- package/README.md +114 -47
- package/SECURITY.md +58 -0
- package/eslint.config.js +70 -0
- package/jest.config.js +49 -0
- package/package.json +40 -14
- package/src/modules/custom-agents/cli/awc-agent.js +505 -372
- package/test/integration/cli/cli-commands.integration.test.js +101 -0
- package/test/setup.js +22 -0
- package/test/unit/commands/version.test.js +39 -0
- package/test/unit/config/config-manager.test.js +147 -0
- package/test/unit/utils/file-utils.test.js +177 -0
- package/test/unit/utils/validators.test.js +57 -0
- package/tools/cli/commands/init.js +556 -513
- package/tools/cli/commands/new-project.js +680 -659
- package/tools/cli/commands/validate.js +13 -13
- package/tools/cli/commands/version.js +5 -3
- package/tools/cli/utils/console-logger.js +39 -15
- package/tools/cli/utils/logger.js +176 -0
- package/tools/cli/utils/project-analyzer.js +33 -16
- package/tools/cli/utils/validators.js +144 -0
- package/tools/cli/utils/version.js +6 -2
- package/tools/config/config-manager.js +243 -0
- package/tools/version/changelog-manager.js +301 -288
- package/tools/version/update-checker.js +32 -32
- package/tools/version/version-bump.js +89 -90
- package/tools/version/version-manager.js +17 -7
- package/tsconfig.json +47 -0
- package/types/index.d.ts +206 -0
- package/tools/cli/commands/init-old.js +0 -147
- package/tools/cli/commands/new-project-broken.js +0 -1302
- package/tools/cli/commands/new-project-old.js +0 -1302
- package/tools/cli/commands/new-project.js.backup +0 -1302
|
@@ -1,372 +1,505 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* AWC Agent CLI - Gestión automática de agentes custom
|
|
5
|
-
* Framework: AWC-ZNS-MTD v1.0.0
|
|
6
|
-
* Uso: awc-agent <comando> [opciones]
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
const fs = require('fs');
|
|
10
|
-
const path = require('path');
|
|
11
|
-
const yaml = require('js-yaml');
|
|
12
|
-
|
|
13
|
-
// Colores para terminal (expandidos)
|
|
14
|
-
const colors = {
|
|
15
|
-
reset: '\x1b[0m',
|
|
16
|
-
bright: '\x1b[1m',
|
|
17
|
-
dim: '\x1b[2m',
|
|
18
|
-
cyan: '\x1b[36m',
|
|
19
|
-
green: '\x1b[32m',
|
|
20
|
-
yellow: '\x1b[33m',
|
|
21
|
-
blue: '\x1b[34m',
|
|
22
|
-
magenta: '\x1b[35m',
|
|
23
|
-
red: '\x1b[31m',
|
|
24
|
-
white: '\x1b[37m',
|
|
25
|
-
bgCyan: '\x1b[46m',
|
|
26
|
-
bgGreen: '\x1b[42m',
|
|
27
|
-
bgBlue: '\x1b[44m'
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
// Logo AWC
|
|
31
|
-
function displayLogo() {
|
|
32
|
-
console.log();
|
|
33
|
-
console.log(colors.cyan + colors.bright
|
|
34
|
-
console.log(' ██╔══██╗██║ ██║██╔════╝');
|
|
35
|
-
console.log(' ███████║██║ █╗ ██║██║ ');
|
|
36
|
-
console.log(' ██╔══██║██║███╗██║██║ ');
|
|
37
|
-
console.log(' ██║ ██║╚███╔███╔╝╚██████╗');
|
|
38
|
-
console.log(
|
|
39
|
-
console.log();
|
|
40
|
-
console.log(colors.magenta + colors.bright
|
|
41
|
-
console.log(
|
|
42
|
-
console.log(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
console.log(
|
|
46
|
-
console.log();
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
'
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
console.log(
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
console.log(
|
|
164
|
-
console.log(`${colors.
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
//
|
|
226
|
-
if (
|
|
227
|
-
console.log(
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
const
|
|
243
|
-
const
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
);
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
console.log(
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
console.log(
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
console.log(
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
console.log(
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* AWC Agent CLI - Gestión automática de agentes custom
|
|
5
|
+
* Framework: AWC-ZNS-MTD v1.0.0
|
|
6
|
+
* Uso: awc-agent <comando> [opciones]
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const fs = require('fs');
|
|
10
|
+
const path = require('path');
|
|
11
|
+
const yaml = require('js-yaml');
|
|
12
|
+
|
|
13
|
+
// Colores para terminal (expandidos)
|
|
14
|
+
const colors = {
|
|
15
|
+
reset: '\x1b[0m',
|
|
16
|
+
bright: '\x1b[1m',
|
|
17
|
+
dim: '\x1b[2m',
|
|
18
|
+
cyan: '\x1b[36m',
|
|
19
|
+
green: '\x1b[32m',
|
|
20
|
+
yellow: '\x1b[33m',
|
|
21
|
+
blue: '\x1b[34m',
|
|
22
|
+
magenta: '\x1b[35m',
|
|
23
|
+
red: '\x1b[31m',
|
|
24
|
+
white: '\x1b[37m',
|
|
25
|
+
bgCyan: '\x1b[46m',
|
|
26
|
+
bgGreen: '\x1b[42m',
|
|
27
|
+
bgBlue: '\x1b[44m'
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// Logo AWC
|
|
31
|
+
function displayLogo() {
|
|
32
|
+
console.log();
|
|
33
|
+
console.log(`${colors.cyan + colors.bright} █████╗ ██╗ ██╗ ██████╗`);
|
|
34
|
+
console.log(' ██╔══██╗██║ ██║██╔════╝');
|
|
35
|
+
console.log(' ███████║██║ █╗ ██║██║ ');
|
|
36
|
+
console.log(' ██╔══██║██║███╗██║██║ ');
|
|
37
|
+
console.log(' ██║ ██║╚███╔███╔╝╚██████╗');
|
|
38
|
+
console.log(` ╚═╝ ╚═╝ ╚══╝╚══╝ ╚═════╝${colors.reset}`);
|
|
39
|
+
console.log();
|
|
40
|
+
console.log(`${colors.magenta + colors.bright} ╔═══════════════════════════════╗`);
|
|
41
|
+
console.log(` ║ ${colors.white}ZNS-MTD Agent Framework${colors.magenta} ║`);
|
|
42
|
+
console.log(
|
|
43
|
+
` ║ ${colors.dim}${colors.white}Zen • Neutro • Sistemático${colors.magenta}${colors.bright} ║`
|
|
44
|
+
);
|
|
45
|
+
console.log(` ╚═══════════════════════════════╝${colors.reset}`);
|
|
46
|
+
console.log();
|
|
47
|
+
console.log(`${colors.dim} 🚀 22 Agentes Especializados | 191 Workflows${colors.reset}`);
|
|
48
|
+
console.log();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Detectar si está instalado globalmente desde NPM o local
|
|
52
|
+
const isGlobalInstall = !fs.existsSync(path.join(__dirname, '../agents'));
|
|
53
|
+
const AGENTS_DATA_DIR = isGlobalInstall
|
|
54
|
+
? path.join(__dirname, 'agents-data')
|
|
55
|
+
: path.join(__dirname, '../agents');
|
|
56
|
+
const CONFIG_FILE = isGlobalInstall
|
|
57
|
+
? path.join(__dirname, 'config.yaml')
|
|
58
|
+
: path.join(__dirname, '../config.yaml');
|
|
59
|
+
const WORKSPACE_AGENTS_DIR = path.join(process.cwd(), '.awc-agents');
|
|
60
|
+
|
|
61
|
+
// Cargar configuración
|
|
62
|
+
function loadConfig() {
|
|
63
|
+
const configContent = fs.readFileSync(CONFIG_FILE, 'utf8');
|
|
64
|
+
return yaml.load(configContent);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Listar todos los agentes
|
|
68
|
+
function listAgents() {
|
|
69
|
+
const config = loadConfig();
|
|
70
|
+
|
|
71
|
+
displayLogo();
|
|
72
|
+
console.log(
|
|
73
|
+
`${colors.bright}${colors.bgCyan}${colors.white} 📋 AGENTES DISPONIBLES ${colors.reset} ${colors.dim}22 agentes • 191 workflows${colors.reset}\n`
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
const categories = {
|
|
77
|
+
Frontend: [],
|
|
78
|
+
Backend: [],
|
|
79
|
+
Infrastructure: [],
|
|
80
|
+
Architecture: [],
|
|
81
|
+
Quality: [],
|
|
82
|
+
Business: [],
|
|
83
|
+
AI: [],
|
|
84
|
+
Documentation: []
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
// Organizar por categoría
|
|
88
|
+
config.module.agents.forEach((agent, index) => {
|
|
89
|
+
const cat =
|
|
90
|
+
agent.category === 'development'
|
|
91
|
+
? agent.subcategory === 'frontend' || agent.subcategory === 'mobile'
|
|
92
|
+
? 'Frontend'
|
|
93
|
+
: 'Backend'
|
|
94
|
+
: agent.category === 'infrastructure'
|
|
95
|
+
? 'Infrastructure'
|
|
96
|
+
: agent.category === 'architecture'
|
|
97
|
+
? 'Architecture'
|
|
98
|
+
: agent.category === 'quality'
|
|
99
|
+
? 'Quality'
|
|
100
|
+
: agent.category === 'business'
|
|
101
|
+
? 'Business'
|
|
102
|
+
: agent.category === 'ai'
|
|
103
|
+
? 'AI'
|
|
104
|
+
: 'Documentation';
|
|
105
|
+
|
|
106
|
+
categories[cat].push({ ...agent, index: index + 1 });
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
// Mostrar por categoría con diseño mejorado
|
|
110
|
+
Object.entries(categories).forEach(([category, agents]) => {
|
|
111
|
+
if (agents.length === 0) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const icon = getCategoryIcon(category);
|
|
116
|
+
console.log(
|
|
117
|
+
`${colors.bright}${colors.blue}╭─ ${icon} ${category.toUpperCase()}${colors.reset} ${colors.dim}(${agents.length} agentes)${colors.reset}`
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
agents.forEach((agent, idx) => {
|
|
121
|
+
const isLast = idx === agents.length - 1;
|
|
122
|
+
const prefix = isLast ? '╰─' : '├─';
|
|
123
|
+
console.log(
|
|
124
|
+
`${colors.blue}${prefix}${colors.reset} ${colors.bright}${colors.green}${agent.index.toString().padStart(2, '0')}${colors.reset} ${colors.dim}│${colors.reset} ${colors.cyan}${agent.id.padEnd(36)}${colors.reset} ${colors.dim}│${colors.reset} ${colors.yellow}${agent.workflows} workflows${colors.reset}`
|
|
125
|
+
);
|
|
126
|
+
});
|
|
127
|
+
console.log('');
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
console.log(
|
|
131
|
+
`${colors.bright}${colors.magenta}┌─────────────────────────────────────────────────────────┐${colors.reset}`
|
|
132
|
+
);
|
|
133
|
+
console.log(
|
|
134
|
+
`${colors.bright}${colors.magenta}│${colors.reset} ${colors.yellow}💡 Comandos rápidos:${colors.reset} ${colors.bright}${colors.magenta}│${colors.reset}`
|
|
135
|
+
);
|
|
136
|
+
console.log(
|
|
137
|
+
`${colors.bright}${colors.magenta}│${colors.reset} ${colors.cyan}awc-agent load 1${colors.reset} ${colors.dim}→ Cargar agente #1${colors.reset} ${colors.bright}${colors.magenta}│${colors.reset}`
|
|
138
|
+
);
|
|
139
|
+
console.log(
|
|
140
|
+
`${colors.bright}${colors.magenta}│${colors.reset} ${colors.cyan}awc-agent search java${colors.reset} ${colors.dim}→ Buscar por tecnología${colors.reset} ${colors.bright}${colors.magenta}│${colors.reset}`
|
|
141
|
+
);
|
|
142
|
+
console.log(
|
|
143
|
+
`${colors.bright}${colors.magenta}└─────────────────────────────────────────────────────────┘${colors.reset}\n`
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function getCategoryIcon(category) {
|
|
148
|
+
const icons = {
|
|
149
|
+
Frontend: '🎨',
|
|
150
|
+
Backend: '☕',
|
|
151
|
+
Infrastructure: '🛠️',
|
|
152
|
+
Architecture: '🏗️',
|
|
153
|
+
Quality: '🔍',
|
|
154
|
+
Business: '📊',
|
|
155
|
+
AI: '🤖',
|
|
156
|
+
Documentation: '📄'
|
|
157
|
+
};
|
|
158
|
+
return icons[category] || '📦';
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// Inicializar agentes en workspace
|
|
162
|
+
function initWorkspace() {
|
|
163
|
+
console.log();
|
|
164
|
+
console.log(`${colors.bright}${colors.cyan}⚙️ Inicializando workspace AWC...${colors.reset}\n`);
|
|
165
|
+
|
|
166
|
+
// Crear carpeta .awc-agents en el workspace actual
|
|
167
|
+
if (!fs.existsSync(WORKSPACE_AGENTS_DIR)) {
|
|
168
|
+
fs.mkdirSync(WORKSPACE_AGENTS_DIR, { recursive: true });
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// Copiar todos los agentes YAML
|
|
172
|
+
const config = loadConfig();
|
|
173
|
+
let copiedCount = 0;
|
|
174
|
+
|
|
175
|
+
config.module.agents.forEach((agent) => {
|
|
176
|
+
const sourceFile = path.join(AGENTS_DATA_DIR, path.basename(agent.file));
|
|
177
|
+
const destFile = path.join(WORKSPACE_AGENTS_DIR, path.basename(agent.file));
|
|
178
|
+
|
|
179
|
+
if (fs.existsSync(sourceFile)) {
|
|
180
|
+
fs.copyFileSync(sourceFile, destFile);
|
|
181
|
+
copiedCount++;
|
|
182
|
+
process.stdout.write(`${colors.dim} ✓ ${path.basename(agent.file)}${colors.reset}\r`);
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
console.log('\n');
|
|
187
|
+
console.log(
|
|
188
|
+
`${colors.bright}${colors.bgGreen}${colors.white} ✅ WORKSPACE INICIALIZADO ${colors.reset}\n`
|
|
189
|
+
);
|
|
190
|
+
console.log(`${colors.dim}╭─────────────────────────────────────────────╮${colors.reset}`);
|
|
191
|
+
console.log(
|
|
192
|
+
`${colors.dim}│${colors.reset} ${colors.cyan}Carpeta:${colors.reset} ${WORKSPACE_AGENTS_DIR.substring(WORKSPACE_AGENTS_DIR.lastIndexOf(path.sep) + 1).padEnd(23)} ${colors.dim}│${colors.reset}`
|
|
193
|
+
);
|
|
194
|
+
console.log(
|
|
195
|
+
`${colors.dim}│${colors.reset} ${colors.cyan}Agentes:${colors.reset} ${`${copiedCount}/22`.padEnd(23)} ${colors.dim}│${colors.reset}`
|
|
196
|
+
);
|
|
197
|
+
console.log(`${colors.dim}╰─────────────────────────────────────────────╯${colors.reset}\n`);
|
|
198
|
+
console.log(`${colors.yellow}💡 Siguiente paso:${colors.reset}`);
|
|
199
|
+
console.log(
|
|
200
|
+
` ${colors.bright}${colors.green}awc-agent load 1${colors.reset} ${colors.dim}# Cargar tu primer agente${colors.reset}\n`
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// Cargar agente específico
|
|
205
|
+
function loadAgent(agentIdOrNumber) {
|
|
206
|
+
const config = loadConfig();
|
|
207
|
+
let agent;
|
|
208
|
+
|
|
209
|
+
// Buscar por número o ID
|
|
210
|
+
if (!isNaN(agentIdOrNumber)) {
|
|
211
|
+
const index = parseInt(agentIdOrNumber) - 1;
|
|
212
|
+
agent = config.module.agents[index];
|
|
213
|
+
} else {
|
|
214
|
+
agent = config.module.agents.find((a) => a.id === agentIdOrNumber);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
if (!agent) {
|
|
218
|
+
console.log(`\n${colors.red}❌ Agente no encontrado: ${agentIdOrNumber}${colors.reset}`);
|
|
219
|
+
console.log(
|
|
220
|
+
`${colors.yellow}💡 Usa ${colors.bright}awc-agent list${colors.reset}${colors.yellow} para ver agentes disponibles${colors.reset}\n`
|
|
221
|
+
);
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// Asegurar que el workspace esté inicializado
|
|
226
|
+
if (!fs.existsSync(WORKSPACE_AGENTS_DIR)) {
|
|
227
|
+
console.log(
|
|
228
|
+
`\n${colors.yellow}⚠️ Inicializando workspace por primera vez...${colors.reset}\n`
|
|
229
|
+
);
|
|
230
|
+
initWorkspace();
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
const agentFileName = path.basename(agent.file);
|
|
234
|
+
const workspaceAgentPath = path.join(WORKSPACE_AGENTS_DIR, agentFileName);
|
|
235
|
+
const sourceAgentPath = path.join(AGENTS_DATA_DIR, agentFileName);
|
|
236
|
+
|
|
237
|
+
// Copiar agente al workspace si no existe
|
|
238
|
+
if (!fs.existsSync(workspaceAgentPath) && fs.existsSync(sourceAgentPath)) {
|
|
239
|
+
fs.copyFileSync(sourceAgentPath, workspaceAgentPath);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
const agentPath = fs.existsSync(workspaceAgentPath) ? workspaceAgentPath : sourceAgentPath;
|
|
243
|
+
const agentContent = fs.readFileSync(agentPath, 'utf8');
|
|
244
|
+
const agentData = yaml.load(agentContent);
|
|
245
|
+
|
|
246
|
+
console.log();
|
|
247
|
+
console.log(
|
|
248
|
+
`${colors.bright}${colors.bgGreen}${colors.white} ✅ AGENTE CARGADO ${colors.reset}\n`
|
|
249
|
+
);
|
|
250
|
+
console.log(
|
|
251
|
+
`${colors.dim}╭──────────────────────────────────────────────────────────╮${colors.reset}`
|
|
252
|
+
);
|
|
253
|
+
console.log(
|
|
254
|
+
`${colors.dim}│${colors.reset} ${colors.cyan}Nombre:${colors.reset} ${agentData.agent.metadata.name.padEnd(42)} ${colors.dim}│${colors.reset}`
|
|
255
|
+
);
|
|
256
|
+
console.log(
|
|
257
|
+
`${colors.dim}│${colors.reset} ${colors.cyan}ID:${colors.reset} ${agent.id.padEnd(42)} ${colors.dim}│${colors.reset}`
|
|
258
|
+
);
|
|
259
|
+
console.log(
|
|
260
|
+
`${colors.dim}│${colors.reset} ${colors.cyan}Stack:${colors.reset} ${agent.stack.slice(0, 3).join(', ').padEnd(42)} ${colors.dim}│${colors.reset}`
|
|
261
|
+
);
|
|
262
|
+
console.log(
|
|
263
|
+
`${colors.dim}│${colors.reset} ${colors.cyan}Workflows:${colors.reset} ${`${agent.workflows} disponibles`.padEnd(42)} ${colors.dim}│${colors.reset}`
|
|
264
|
+
);
|
|
265
|
+
console.log(
|
|
266
|
+
`${colors.dim}╰──────────────────────────────────────────────────────────╯${colors.reset}\n`
|
|
267
|
+
);
|
|
268
|
+
|
|
269
|
+
// Mostrar comando para Copilot Chat con diseño destacado
|
|
270
|
+
console.log(
|
|
271
|
+
`${colors.bright}${colors.magenta}╔════════════════════════════════════════════════════════════╗${colors.reset}`
|
|
272
|
+
);
|
|
273
|
+
console.log(
|
|
274
|
+
`${colors.bright}${colors.magenta}║${colors.reset} ${colors.bright}${colors.yellow}📋 COPIAR EN GITHUB COPILOT CHAT:${colors.reset} ${colors.bright}${colors.magenta}║${colors.reset}`
|
|
275
|
+
);
|
|
276
|
+
console.log(
|
|
277
|
+
`${colors.bright}${colors.magenta}╠════════════════════════════════════════════════════════════╣${colors.reset}`
|
|
278
|
+
);
|
|
279
|
+
console.log(
|
|
280
|
+
`${colors.bright}${colors.magenta}║${colors.reset} ${colors.bright}${colors.magenta}║${colors.reset}`
|
|
281
|
+
);
|
|
282
|
+
console.log(
|
|
283
|
+
`${colors.bright}${colors.magenta}║${colors.reset} ${colors.bright}${colors.green}#file:.awc-agents/${agentFileName}${colors.reset} ${colors.bright}${colors.magenta}║${colors.reset}`
|
|
284
|
+
);
|
|
285
|
+
console.log(
|
|
286
|
+
`${colors.bright}${colors.magenta}║${colors.reset} ${colors.bright}${colors.green}actúa como este agente, muestra *help${colors.reset} ${colors.bright}${colors.magenta}║${colors.reset}`
|
|
287
|
+
);
|
|
288
|
+
console.log(
|
|
289
|
+
`${colors.bright}${colors.magenta}║${colors.reset} ${colors.bright}${colors.magenta}║${colors.reset}`
|
|
290
|
+
);
|
|
291
|
+
console.log(
|
|
292
|
+
`${colors.bright}${colors.magenta}╚════════════════════════════════════════════════════════════╝${colors.reset}\n`
|
|
293
|
+
);
|
|
294
|
+
|
|
295
|
+
// Mostrar workflows disponibles
|
|
296
|
+
if (agentData.agent.workflows && agentData.agent.workflows.list) {
|
|
297
|
+
console.log(`${colors.bright}${colors.blue}🎯 WORKFLOWS DISPONIBLES:${colors.reset}\n`);
|
|
298
|
+
const maxToShow = 5;
|
|
299
|
+
agentData.agent.workflows.list.slice(0, maxToShow).forEach((workflow) => {
|
|
300
|
+
console.log(` ${colors.green}▸ ${colors.bright}*${workflow.id}${colors.reset}`);
|
|
301
|
+
console.log(` ${colors.dim}${workflow.description}${colors.reset}\n`);
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
if (agentData.agent.workflows.list.length > maxToShow) {
|
|
305
|
+
console.log(
|
|
306
|
+
` ${colors.dim}... y ${agentData.agent.workflows.list.length - maxToShow} workflows más${colors.reset}\n`
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// Buscar agente por tecnología
|
|
313
|
+
function searchByTech(tech) {
|
|
314
|
+
const config = loadConfig();
|
|
315
|
+
const results = config.module.agents.filter(
|
|
316
|
+
(agent) =>
|
|
317
|
+
agent.stack.some((s) => s.toLowerCase().includes(tech.toLowerCase())) ||
|
|
318
|
+
agent.whenToUse.toLowerCase().includes(tech.toLowerCase())
|
|
319
|
+
);
|
|
320
|
+
|
|
321
|
+
if (results.length === 0) {
|
|
322
|
+
console.log(`\n${colors.red}❌ No se encontraron agentes para: ${tech}${colors.reset}`);
|
|
323
|
+
console.log(
|
|
324
|
+
`${colors.yellow}💡 Prueba con: react, java, python, docker, kubernetes, etc.${colors.reset}\n`
|
|
325
|
+
);
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
console.log();
|
|
330
|
+
console.log(
|
|
331
|
+
`${colors.bright}${colors.bgBlue}${colors.white} 🔍 RESULTADOS PARA: ${tech.toUpperCase()} ${colors.reset} ${colors.dim}${results.length} agentes encontrados${colors.reset}\n`
|
|
332
|
+
);
|
|
333
|
+
|
|
334
|
+
results.forEach((agent, index) => {
|
|
335
|
+
const agentNumber = config.module.agents.indexOf(agent) + 1;
|
|
336
|
+
const isLast = index === results.length - 1;
|
|
337
|
+
|
|
338
|
+
console.log(
|
|
339
|
+
`${colors.dim}${isLast ? '╰─' : '├─'}${colors.reset} ${colors.bright}${colors.green}#${agentNumber.toString().padStart(2, '0')}${colors.reset} ${colors.cyan}${agent.id}${colors.reset}`
|
|
340
|
+
);
|
|
341
|
+
console.log(
|
|
342
|
+
`${colors.dim}${isLast ? ' ' : '│ '}${colors.reset} ${colors.yellow}↳ ${agent.stack.slice(0, 4).join(' • ')}${colors.reset}`
|
|
343
|
+
);
|
|
344
|
+
console.log(
|
|
345
|
+
`${colors.dim}${isLast ? ' ' : '│ '}${colors.reset} ${colors.dim}${agent.workflows} workflows disponibles${colors.reset}`
|
|
346
|
+
);
|
|
347
|
+
if (!isLast) {
|
|
348
|
+
console.log(`${colors.dim}│${colors.reset}`);
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
console.log();
|
|
353
|
+
console.log(
|
|
354
|
+
`${colors.yellow}💡 Cargar agente:${colors.reset} ${colors.bright}${colors.green}awc-agent load ${config.module.agents.indexOf(results[0]) + 1}${colors.reset}\n`
|
|
355
|
+
);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
// Mostrar help
|
|
359
|
+
function showHelp() {
|
|
360
|
+
displayLogo();
|
|
361
|
+
|
|
362
|
+
console.log(`${colors.bright}${colors.cyan}USO:${colors.reset}`);
|
|
363
|
+
console.log(` ${colors.dim}awc-agent <comando> [opciones]${colors.reset}\n`);
|
|
364
|
+
|
|
365
|
+
console.log(`${colors.bright}${colors.cyan}COMANDOS PRINCIPALES:${colors.reset}\n`);
|
|
366
|
+
|
|
367
|
+
console.log(
|
|
368
|
+
` ${colors.bright}${colors.green}init${colors.reset} ${colors.dim}│${colors.reset} Inicializa workspace (.awc-agents/)`
|
|
369
|
+
);
|
|
370
|
+
console.log(
|
|
371
|
+
` ${colors.bright}${colors.green}list${colors.reset} ${colors.dim}│${colors.reset} Lista todos los agentes (22 agentes)`
|
|
372
|
+
);
|
|
373
|
+
console.log(
|
|
374
|
+
` ${colors.bright}${colors.green}load <id|#>${colors.reset} ${colors.dim}│${colors.reset} Carga un agente específico`
|
|
375
|
+
);
|
|
376
|
+
console.log(
|
|
377
|
+
` ${colors.bright}${colors.green}search <tech>${colors.reset} ${colors.dim}│${colors.reset} Busca agentes por tecnología`
|
|
378
|
+
);
|
|
379
|
+
console.log(
|
|
380
|
+
` ${colors.bright}${colors.green}help${colors.reset} ${colors.dim}│${colors.reset} Muestra esta ayuda\n`
|
|
381
|
+
);
|
|
382
|
+
|
|
383
|
+
console.log(`${colors.bright}${colors.cyan}EJEMPLOS DE USO:${colors.reset}\n`);
|
|
384
|
+
console.log(` ${colors.dim}# Primera vez (inicializar)${colors.reset}`);
|
|
385
|
+
console.log(` ${colors.cyan}$ awc-agent init${colors.reset}\n`);
|
|
386
|
+
|
|
387
|
+
console.log(` ${colors.dim}# Listar todos los agentes${colors.reset}`);
|
|
388
|
+
console.log(` ${colors.cyan}$ awc-agent list${colors.reset}\n`);
|
|
389
|
+
|
|
390
|
+
console.log(` ${colors.dim}# Cargar agente por número${colors.reset}`);
|
|
391
|
+
console.log(
|
|
392
|
+
` ${colors.cyan}$ awc-agent load 1${colors.reset} ${colors.dim}# Frontend React${colors.reset}`
|
|
393
|
+
);
|
|
394
|
+
console.log(
|
|
395
|
+
` ${colors.cyan}$ awc-agent load 3${colors.reset} ${colors.dim}# Backend Java${colors.reset}\n`
|
|
396
|
+
);
|
|
397
|
+
|
|
398
|
+
console.log(` ${colors.dim}# Cargar agente por ID${colors.reset}`);
|
|
399
|
+
console.log(` ${colors.cyan}$ awc-agent load backend-java-senior${colors.reset}\n`);
|
|
400
|
+
|
|
401
|
+
console.log(` ${colors.dim}# Buscar por tecnología${colors.reset}`);
|
|
402
|
+
console.log(
|
|
403
|
+
` ${colors.cyan}$ awc-agent search react${colors.reset} ${colors.dim}# Agentes React${colors.reset}`
|
|
404
|
+
);
|
|
405
|
+
console.log(
|
|
406
|
+
` ${colors.cyan}$ awc-agent search java${colors.reset} ${colors.dim}# Agentes Java${colors.reset}`
|
|
407
|
+
);
|
|
408
|
+
console.log(
|
|
409
|
+
` ${colors.cyan}$ awc-agent search docker${colors.reset} ${colors.dim}# DevOps/Docker${colors.reset}\n`
|
|
410
|
+
);
|
|
411
|
+
|
|
412
|
+
console.log(`${colors.bright}${colors.cyan}FLUJO DE TRABAJO TÍPICO:${colors.reset}\n`);
|
|
413
|
+
console.log(
|
|
414
|
+
` ${colors.yellow}1.${colors.reset} ${colors.dim}Inicializar workspace${colors.reset} ${colors.cyan}awc-agent init${colors.reset}`
|
|
415
|
+
);
|
|
416
|
+
console.log(
|
|
417
|
+
` ${colors.yellow}2.${colors.reset} ${colors.dim}Ver agentes disponibles${colors.reset} ${colors.cyan}awc-agent list${colors.reset}`
|
|
418
|
+
);
|
|
419
|
+
console.log(
|
|
420
|
+
` ${colors.yellow}3.${colors.reset} ${colors.dim}Cargar agente deseado${colors.reset} ${colors.cyan}awc-agent load 3${colors.reset}`
|
|
421
|
+
);
|
|
422
|
+
console.log(
|
|
423
|
+
` ${colors.yellow}4.${colors.reset} ${colors.dim}Copiar comando generado${colors.reset} ${colors.green}#file:.awc-agents/...${colors.reset}`
|
|
424
|
+
);
|
|
425
|
+
console.log(
|
|
426
|
+
` ${colors.yellow}5.${colors.reset} ${colors.dim}Pegar en Copilot Chat${colors.reset} ${colors.magenta}Ejecutar workflows${colors.reset}\n`
|
|
427
|
+
);
|
|
428
|
+
|
|
429
|
+
console.log(`${colors.bright}${colors.cyan}CATEGORÍAS DISPONIBLES:${colors.reset}\n`);
|
|
430
|
+
console.log(' 🎨 Frontend (2) ☕ Backend (4) 🛠️ Infrastructure (2)');
|
|
431
|
+
console.log(' 🏗️ Architecture (4) 🔍 Quality (3) 📊 Business (2)');
|
|
432
|
+
console.log(' 🤖 AI/Prompts (2) 📄 Documentation (3)\n');
|
|
433
|
+
|
|
434
|
+
console.log(
|
|
435
|
+
`${colors.dim}────────────────────────────────────────────────────────────${colors.reset}`
|
|
436
|
+
);
|
|
437
|
+
console.log(
|
|
438
|
+
`${colors.bright}${colors.magenta}Framework AWC-ZNS-MTD v1.0.0${colors.reset} ${colors.dim}│ Zen • Neutro • Sistemático${colors.reset}`
|
|
439
|
+
);
|
|
440
|
+
console.log(
|
|
441
|
+
`${colors.dim}────────────────────────────────────────────────────────────${colors.reset}\n`
|
|
442
|
+
);
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
// Main
|
|
446
|
+
function main() {
|
|
447
|
+
const args = process.argv.slice(2);
|
|
448
|
+
const command = args[0];
|
|
449
|
+
|
|
450
|
+
if (!command || command === 'help' || command === '--help' || command === '-h') {
|
|
451
|
+
showHelp();
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
switch (command) {
|
|
456
|
+
case 'init':
|
|
457
|
+
initWorkspace();
|
|
458
|
+
break;
|
|
459
|
+
case 'list':
|
|
460
|
+
case 'ls':
|
|
461
|
+
listAgents();
|
|
462
|
+
break;
|
|
463
|
+
case 'load':
|
|
464
|
+
case 'use':
|
|
465
|
+
if (!args[1]) {
|
|
466
|
+
console.log(`\n${colors.red}❌ Especifica un agente${colors.reset}`);
|
|
467
|
+
console.log(
|
|
468
|
+
`${colors.yellow}💡 Uso:${colors.reset} ${colors.bright}awc-agent load <número>${colors.reset}`
|
|
469
|
+
);
|
|
470
|
+
console.log(
|
|
471
|
+
`${colors.yellow}💡 Ejemplo:${colors.reset} ${colors.cyan}awc-agent load 1${colors.reset}\n`
|
|
472
|
+
);
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
475
|
+
loadAgent(args[1]);
|
|
476
|
+
break;
|
|
477
|
+
case 'search':
|
|
478
|
+
case 'find':
|
|
479
|
+
if (!args[1]) {
|
|
480
|
+
console.log(`\n${colors.red}❌ Especifica una tecnología${colors.reset}`);
|
|
481
|
+
console.log(
|
|
482
|
+
`${colors.yellow}💡 Uso:${colors.reset} ${colors.bright}awc-agent search <tech>${colors.reset}`
|
|
483
|
+
);
|
|
484
|
+
console.log(
|
|
485
|
+
`${colors.yellow}💡 Ejemplo:${colors.reset} ${colors.cyan}awc-agent search react${colors.reset}\n`
|
|
486
|
+
);
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
searchByTech(args[1]);
|
|
490
|
+
break;
|
|
491
|
+
case 'version':
|
|
492
|
+
case '--version':
|
|
493
|
+
case '-v':
|
|
494
|
+
console.log(
|
|
495
|
+
`\n${colors.bright}${colors.cyan}awc-agent-cli${colors.reset} ${colors.green}v1.0.0${colors.reset}`
|
|
496
|
+
);
|
|
497
|
+
console.log(`${colors.dim}AWC-ZNS-MTD Framework${colors.reset}\n`);
|
|
498
|
+
break;
|
|
499
|
+
default:
|
|
500
|
+
console.log(`\n${colors.red}❌ Comando desconocido: ${command}${colors.reset}\n`);
|
|
501
|
+
showHelp();
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
main();
|