()
| 465 | } |
| 466 | |
| 467 | async function main() { |
| 468 | const args = process.argv.slice(2) |
| 469 | const skipPrompt = args.includes('-y') || args.includes('--yes') |
| 470 | const command = args.find(arg => !arg.startsWith('-')) |
| 471 | |
| 472 | // Handle subcommands directly |
| 473 | if (command === 'init') { |
| 474 | p.intro('Skills Manager - Init') |
| 475 | await initSubmodules(skipPrompt) |
| 476 | p.outro('Done') |
| 477 | return |
| 478 | } |
| 479 | |
| 480 | if (command === 'sync') { |
| 481 | p.intro('Skills Manager - Sync') |
| 482 | await syncSubmodules() |
| 483 | p.outro('Done') |
| 484 | return |
| 485 | } |
| 486 | |
| 487 | if (command === 'check') { |
| 488 | p.intro('Skills Manager - Check') |
| 489 | await checkUpdates() |
| 490 | p.outro('Done') |
| 491 | return |
| 492 | } |
| 493 | |
| 494 | if (command === 'cleanup') { |
| 495 | p.intro('Skills Manager - Cleanup') |
| 496 | await cleanup(skipPrompt) |
| 497 | p.outro('Done') |
| 498 | return |
| 499 | } |
| 500 | |
| 501 | // No subcommand: show interactive menu (requires interaction) |
| 502 | if (skipPrompt) { |
| 503 | p.log.error('Command required when using -y flag') |
| 504 | p.log.info('Available commands: init, sync, check, cleanup') |
| 505 | process.exit(1) |
| 506 | } |
| 507 | |
| 508 | p.intro('Skills Manager') |
| 509 | |
| 510 | const action = await p.select({ |
| 511 | message: 'What would you like to do?', |
| 512 | options: [ |
| 513 | { value: 'sync', label: 'Sync submodules', hint: 'Pull latest and sync Type 2 skills' }, |
| 514 | { value: 'init', label: 'Init submodules', hint: 'Add new submodules' }, |
| 515 | { value: 'check', label: 'Check updates', hint: 'See available updates' }, |
| 516 | { value: 'cleanup', label: 'Cleanup', hint: 'Remove unused submodules and skills' }, |
| 517 | ], |
| 518 | }) |
| 519 | |
| 520 | if (p.isCancel(action)) { |
| 521 | p.cancel('Cancelled') |
| 522 | process.exit(0) |
| 523 | } |
| 524 |
no test coverage detected