ReviewOS

also looking at this

stacks/buddy

test: import the CLI without parsing, and pin its wiring in-process

#1448
Merged glennmichael123 wants to merge test/cli-wiring into main
2 files +145 -2
bin/cli.tsmodified+8-2
Changes to bin/cli.ts
@@ -204,7 +204,7 @@ async function collectPackageContext(
204204 }
205205}
206206
207const cli = new CLI('buddy')
207const cli: CLI = new CLI('buddy')
208208
209209cli.usage(`[command] [options]
210210
@@ -3517,4 +3517,10 @@ cli.command('help', 'Show this help text').action(() => {
35173517cli.option('--config <path>', 'Path to a buddy config file')
35183518cli.version(version)
35193519cli.help()
3520cli.parse()
3520
3521// Exported for the in-process wiring tests: importing this module must not
3522// parse argv or run a command — only direct execution does.
3523export { cli }
3524
3525if (import.meta.main)
3526 cli.parse()