@musashishao/agent-kit 1.1.5 → 1.1.6

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.

Potentially problematic release.


This version of @musashishao/agent-kit might be problematic. Click here for more details.

package/bin/cli.js CHANGED
@@ -36,15 +36,21 @@ ${colors.bright}Usage:${colors.reset}
36
36
  npx ${PACKAGE_NAME} <command> [options]
37
37
 
38
38
  ${colors.bright}Commands:${colors.reset}
39
- init Install .agent folder into current project
40
- setup-codex Sync workflows with Codex CLI slash commands
41
- update Update .agent folder to match current package version
42
- status Check installation status
39
+ ${colors.cyan}init${colors.reset} Install .agent folder into current project
40
+ ${colors.cyan}setup-codex${colors.reset} Sync workflows with Codex CLI slash commands
41
+ ${colors.cyan}codex${colors.reset} Generate AGENTS.md for Codex CLI (use --template)
42
+ ${colors.cyan}agents${colors.reset} List all available agents
43
+ ${colors.cyan}skills${colors.reset} List all available skills
44
+ ${colors.cyan}workflows${colors.reset} List all available workflows
45
+ ${colors.cyan}doctor${colors.reset} Check configuration and diagnose issues
46
+ ${colors.cyan}update${colors.reset} Update .agent folder to latest version
47
+ ${colors.cyan}status${colors.reset} Check installation status
43
48
 
44
49
  ${colors.bright}Options:${colors.reset}
45
- --force Overwrite existing .agent folder (REQUIRED for update)
50
+ --force Overwrite existing files
46
51
  --path <dir> Install in specific directory
47
52
  --prefix <str> Custom prefix for slash commands (default: kit-)
53
+ --template <type> Template type: web, mobile, backend (for codex command)
48
54
  --quiet Suppress output
49
55
  --help Show this help message
50
56
  --version Show version
@@ -52,6 +58,9 @@ ${colors.bright}Options:${colors.reset}
52
58
  ${colors.bright}Examples:${colors.reset}
53
59
  npx ${PACKAGE_NAME} init
54
60
  npx ${PACKAGE_NAME} setup-codex
61
+ npx ${PACKAGE_NAME} codex --template web
62
+ npx ${PACKAGE_NAME} agents
63
+ npx ${PACKAGE_NAME} doctor
55
64
 
56
65
  ${colors.yellow}# To ensure you have the latest version from NPM:${colors.reset}
57
66
  npx ${PACKAGE_NAME}@latest update
@@ -252,6 +261,256 @@ function updateCommand(options) {
252
261
  log.success('Update complete!');
253
262
  }
254
263
 
264
+ // ============ NEW COMMANDS ============
265
+
266
+ function codexCommand(options) {
267
+ const targetDir = options.path || process.cwd();
268
+ const template = options.template || 'default';
269
+
270
+ log.title('📝 Musa Agent Kit - Generating AGENTS.md for Codex CLI');
271
+
272
+ const packageRoot = path.resolve(__dirname, '..');
273
+ const templatesDir = path.join(packageRoot, '.agent', 'templates');
274
+
275
+ // Determine template file
276
+ let templateFile;
277
+ switch (template) {
278
+ case 'web':
279
+ templateFile = 'AGENTS.web.md';
280
+ break;
281
+ case 'mobile':
282
+ templateFile = 'AGENTS.mobile.md';
283
+ break;
284
+ case 'backend':
285
+ templateFile = 'AGENTS.backend.md';
286
+ break;
287
+ default:
288
+ templateFile = 'AGENTS.md';
289
+ }
290
+
291
+ const templatePath = path.join(templatesDir, templateFile);
292
+ const destPath = path.join(targetDir, 'AGENTS.md');
293
+
294
+ if (!fs.existsSync(templatePath)) {
295
+ log.error(`Template not found: ${templateFile}`);
296
+ log.info('Available templates: default, web, mobile, backend');
297
+ process.exit(1);
298
+ }
299
+
300
+ if (fs.existsSync(destPath) && !options.force) {
301
+ log.warn('AGENTS.md already exists!');
302
+ log.info('Use --force to overwrite');
303
+ process.exit(1);
304
+ }
305
+
306
+ fs.copyFileSync(templatePath, destPath);
307
+
308
+ log.success(`AGENTS.md created with "${template}" template!`);
309
+ log.info('Edit the file to customize for your project.');
310
+ console.log(`
311
+ ${colors.bright}📄 File created:${colors.reset} ${destPath}
312
+
313
+ ${colors.bright}🎯 Next steps:${colors.reset}
314
+ 1. Edit AGENTS.md with your project details
315
+ 2. Replace [PROJECT_NAME] placeholders
316
+ 3. Update tech stack section
317
+ 4. Codex CLI will now use this config!
318
+ `);
319
+ }
320
+
321
+ function agentsCommand() {
322
+ const agentDir = path.join(process.cwd(), '.agent', 'agents');
323
+
324
+ log.title('🤖 Available Agents');
325
+
326
+ if (!fs.existsSync(agentDir)) {
327
+ log.warn('.agent/agents folder not found. Run "init" first.');
328
+ return;
329
+ }
330
+
331
+ const agents = fs.readdirSync(agentDir).filter(f => f.endsWith('.md'));
332
+
333
+ console.log(`${colors.bright}Found ${agents.length} agents:${colors.reset}\n`);
334
+
335
+ for (const agent of agents) {
336
+ const name = agent.replace('.md', '');
337
+ const content = fs.readFileSync(path.join(agentDir, agent), 'utf-8');
338
+
339
+ // Extract description from frontmatter
340
+ const descMatch = content.match(/description:\s*(.+)/);
341
+ const desc = descMatch ? descMatch[1].substring(0, 60) + '...' : 'No description';
342
+
343
+ console.log(` ${colors.cyan}@${name}${colors.reset}`);
344
+ console.log(` ${colors.yellow}${desc}${colors.reset}\n`);
345
+ }
346
+ }
347
+
348
+ function skillsCommand() {
349
+ const skillsDir = path.join(process.cwd(), '.agent', 'skills');
350
+
351
+ log.title('🧠 Available Skills');
352
+
353
+ if (!fs.existsSync(skillsDir)) {
354
+ log.warn('.agent/skills folder not found. Run "init" first.');
355
+ return;
356
+ }
357
+
358
+ const skills = fs.readdirSync(skillsDir, { withFileTypes: true })
359
+ .filter(d => d.isDirectory());
360
+
361
+ console.log(`${colors.bright}Found ${skills.length} skills:${colors.reset}\n`);
362
+
363
+ const categories = {
364
+ frontend: [],
365
+ backend: [],
366
+ security: [],
367
+ design: [],
368
+ debug: [],
369
+ other: []
370
+ };
371
+
372
+ for (const skill of skills) {
373
+ const skillPath = path.join(skillsDir, skill.name, 'SKILL.md');
374
+ if (fs.existsSync(skillPath)) {
375
+ const content = fs.readFileSync(skillPath, 'utf-8');
376
+ const descMatch = content.match(/description:\s*(.+)/);
377
+ const desc = descMatch ? descMatch[1].substring(0, 50) : '';
378
+
379
+ // Categorize
380
+ if (['react', 'next', 'tailwind', 'frontend'].some(k => skill.name.includes(k))) {
381
+ categories.frontend.push({ name: skill.name, desc });
382
+ } else if (['api', 'node', 'prisma', 'database', 'backend'].some(k => skill.name.includes(k))) {
383
+ categories.backend.push({ name: skill.name, desc });
384
+ } else if (['security', 'vulnerability', 'red-team'].some(k => skill.name.includes(k))) {
385
+ categories.security.push({ name: skill.name, desc });
386
+ } else if (['ui', 'design', 'mobile'].some(k => skill.name.includes(k))) {
387
+ categories.design.push({ name: skill.name, desc });
388
+ } else if (['debug', 'problem'].some(k => skill.name.includes(k))) {
389
+ categories.debug.push({ name: skill.name, desc });
390
+ } else {
391
+ categories.other.push({ name: skill.name, desc });
392
+ }
393
+ }
394
+ }
395
+
396
+ for (const [category, items] of Object.entries(categories)) {
397
+ if (items.length > 0) {
398
+ console.log(`${colors.bright}${category.toUpperCase()}${colors.reset} (${items.length})`);
399
+ for (const item of items) {
400
+ console.log(` ${colors.cyan}${item.name}${colors.reset}`);
401
+ }
402
+ console.log('');
403
+ }
404
+ }
405
+ }
406
+
407
+ function workflowsCommand() {
408
+ const workflowsDir = path.join(process.cwd(), '.agent', 'workflows');
409
+
410
+ log.title('⚡ Available Workflows (Slash Commands)');
411
+
412
+ if (!fs.existsSync(workflowsDir)) {
413
+ log.warn('.agent/workflows folder not found. Run "init" first.');
414
+ return;
415
+ }
416
+
417
+ const workflows = fs.readdirSync(workflowsDir).filter(f => f.endsWith('.md'));
418
+
419
+ console.log(`${colors.bright}Found ${workflows.length} workflows:${colors.reset}\n`);
420
+
421
+ for (const wf of workflows) {
422
+ const name = wf.replace('.md', '');
423
+ const content = fs.readFileSync(path.join(workflowsDir, wf), 'utf-8');
424
+
425
+ const descMatch = content.match(/description:\s*(.+)/);
426
+ const desc = descMatch ? descMatch[1] : 'No description';
427
+
428
+ console.log(` ${colors.green}/${name}${colors.reset}`);
429
+ console.log(` ${desc}\n`);
430
+ }
431
+ }
432
+
433
+ function doctorCommand() {
434
+ log.title('🩺 Agent Kit - Health Check');
435
+
436
+ const cwd = process.cwd();
437
+ const checks = [];
438
+
439
+ // Check 1: .agent folder
440
+ const agentDir = path.join(cwd, '.agent');
441
+ if (fs.existsSync(agentDir)) {
442
+ checks.push({ name: '.agent folder', status: '✅', message: 'Found' });
443
+ } else {
444
+ checks.push({ name: '.agent folder', status: '❌', message: 'Not found - run "init"' });
445
+ }
446
+
447
+ // Check 2: AGENTS.md
448
+ const agentsMd = path.join(cwd, 'AGENTS.md');
449
+ if (fs.existsSync(agentsMd)) {
450
+ checks.push({ name: 'AGENTS.md', status: '✅', message: 'Found (Codex CLI ready)' });
451
+ } else {
452
+ checks.push({ name: 'AGENTS.md', status: '⚠️', message: 'Not found - run "codex"' });
453
+ }
454
+
455
+ // Check 3: .codex folder
456
+ const codexDir = path.join(cwd, '.codex');
457
+ if (fs.existsSync(codexDir)) {
458
+ checks.push({ name: '.codex folder', status: '✅', message: 'Found' });
459
+ } else {
460
+ checks.push({ name: '.codex folder', status: '⚠️', message: 'Optional - not found' });
461
+ }
462
+
463
+ // Check 4: Agents count
464
+ if (fs.existsSync(path.join(agentDir, 'agents'))) {
465
+ const count = fs.readdirSync(path.join(agentDir, 'agents')).length;
466
+ checks.push({ name: 'Agents', status: '✅', message: `${count} available` });
467
+ }
468
+
469
+ // Check 5: Skills count
470
+ if (fs.existsSync(path.join(agentDir, 'skills'))) {
471
+ const count = fs.readdirSync(path.join(agentDir, 'skills')).length;
472
+ checks.push({ name: 'Skills', status: '✅', message: `${count} available` });
473
+ }
474
+
475
+ // Check 6: Workflows count
476
+ if (fs.existsSync(path.join(agentDir, 'workflows'))) {
477
+ const count = fs.readdirSync(path.join(agentDir, 'workflows')).length;
478
+ checks.push({ name: 'Workflows', status: '✅', message: `${count} available` });
479
+ }
480
+
481
+ // Check 7: Codex CLI global prompts
482
+ const codexPromptDir = path.join(os.homedir(), '.codex', 'prompts');
483
+ if (fs.existsSync(codexPromptDir)) {
484
+ const prompts = fs.readdirSync(codexPromptDir).filter(f => f.startsWith('kit-'));
485
+ if (prompts.length > 0) {
486
+ checks.push({ name: 'Codex slash commands', status: '✅', message: `${prompts.length} synced` });
487
+ } else {
488
+ checks.push({ name: 'Codex slash commands', status: '⚠️', message: 'Not synced - run "setup-codex"' });
489
+ }
490
+ } else {
491
+ checks.push({ name: 'Codex prompts dir', status: '⚠️', message: 'Not found' });
492
+ }
493
+
494
+ // Display results
495
+ console.log(`${colors.bright}Diagnostic Results:${colors.reset}\n`);
496
+
497
+ for (const check of checks) {
498
+ console.log(` ${check.status} ${colors.cyan}${check.name}${colors.reset}: ${check.message}`);
499
+ }
500
+
501
+ const hasErrors = checks.some(c => c.status === '❌');
502
+ const hasWarnings = checks.some(c => c.status === '⚠️');
503
+
504
+ console.log('');
505
+ if (hasErrors) {
506
+ log.error('Some critical checks failed. Run suggested commands to fix.');
507
+ } else if (hasWarnings) {
508
+ log.warn('Some optional configurations missing. Consider running suggested commands.');
509
+ } else {
510
+ log.success('All checks passed! Agent Kit is ready.');
511
+ }
512
+ }
513
+
255
514
  // Parse arguments
256
515
  const args = process.argv.slice(2);
257
516
  const command = args[0];
@@ -260,7 +519,8 @@ const options = {
260
519
  force: args.includes('--force'),
261
520
  quiet: args.includes('--quiet'),
262
521
  path: null,
263
- prefix: null
522
+ prefix: null,
523
+ template: null
264
524
  };
265
525
 
266
526
  // Parse --path
@@ -275,6 +535,12 @@ if (prefixIndex !== -1 && args[prefixIndex + 1]) {
275
535
  options.prefix = args[prefixIndex + 1];
276
536
  }
277
537
 
538
+ // Parse --template
539
+ const templateIndex = args.indexOf('--template');
540
+ if (templateIndex !== -1 && args[templateIndex + 1]) {
541
+ options.template = args[templateIndex + 1];
542
+ }
543
+
278
544
  // Execute command
279
545
  switch (command) {
280
546
  case 'init':
@@ -283,6 +549,21 @@ switch (command) {
283
549
  case 'setup-codex':
284
550
  setupCodexCommand(options);
285
551
  break;
552
+ case 'codex':
553
+ codexCommand(options);
554
+ break;
555
+ case 'agents':
556
+ agentsCommand();
557
+ break;
558
+ case 'skills':
559
+ skillsCommand();
560
+ break;
561
+ case 'workflows':
562
+ workflowsCommand();
563
+ break;
564
+ case 'doctor':
565
+ doctorCommand();
566
+ break;
286
567
  case 'update':
287
568
  updateCommand(options);
288
569
  break;
@@ -303,4 +584,3 @@ switch (command) {
303
584
  showHelp();
304
585
  process.exit(1);
305
586
  }
306
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@musashishao/agent-kit",
3
- "version": "1.1.5",
3
+ "version": "1.1.6",
4
4
  "description": "AI Agent templates - Skills, Agents, and Workflows for enhanced coding assistance",
5
5
  "main": "index.js",
6
6
  "bin": {