()
| 8 | import '../src/shims/macro.js' |
| 9 | |
| 10 | async function main() { |
| 11 | const { getCommands } = await import('../src/commands.js') |
| 12 | |
| 13 | const cwd = process.cwd() |
| 14 | const commands = await getCommands(cwd) |
| 15 | |
| 16 | console.log(`Loaded ${commands.length} commands:\n`) |
| 17 | |
| 18 | // Group commands by type for readability |
| 19 | const byType: Record<string, typeof commands> = {} |
| 20 | for (const cmd of commands) { |
| 21 | const t = cmd.type |
| 22 | if (!byType[t]) byType[t] = [] |
| 23 | byType[t]!.push(cmd) |
| 24 | } |
| 25 | |
| 26 | for (const [type, cmds] of Object.entries(byType)) { |
| 27 | console.log(` [${type}] (${cmds.length} commands)`) |
| 28 | for (const cmd of cmds) { |
| 29 | const aliases = cmd.aliases?.length ? ` (aliases: ${cmd.aliases.join(', ')})` : '' |
| 30 | const hidden = cmd.isHidden ? ' [hidden]' : '' |
| 31 | const source = cmd.type === 'prompt' ? ` (source: ${cmd.source})` : '' |
| 32 | console.log(` /${cmd.name} — ${cmd.description || '(no description)'}${aliases}${hidden}${source}`) |
| 33 | } |
| 34 | console.log() |
| 35 | } |
| 36 | |
| 37 | // Verify essential commands are present |
| 38 | const essential = ['help', 'config', 'init', 'commit', 'review'] |
| 39 | const commandNames = new Set(commands.map(c => c.name)) |
| 40 | const missing = essential.filter(n => !commandNames.has(n)) |
| 41 | |
| 42 | if (missing.length > 0) { |
| 43 | console.error(`❌ Missing essential commands: ${missing.join(', ')}`) |
| 44 | process.exit(1) |
| 45 | } |
| 46 | |
| 47 | console.log(`✅ All ${essential.length} essential commands present: ${essential.join(', ')}`) |
| 48 | |
| 49 | // Check moved-to-plugin commands |
| 50 | const movedToPlugin = commands.filter( |
| 51 | c => c.type === 'prompt' && c.description && c.name |
| 52 | ).filter(c => ['security-review', 'pr-comments'].includes(c.name)) |
| 53 | |
| 54 | if (movedToPlugin.length > 0) { |
| 55 | console.log(`✅ Moved-to-plugin commands present and loadable: ${movedToPlugin.map(c => c.name).join(', ')}`) |
| 56 | } |
| 57 | |
| 58 | console.log(`\n✅ Command system loaded successfully (${commands.length} commands)`) |
| 59 | } |
| 60 | |
| 61 | main().catch(err => { |
| 62 | console.error('❌ Command loading failed:', err) |
no test coverage detected