| 23 | } |
| 24 | |
| 25 | export function registerAuthCommands(program: Command): void { |
| 26 | program |
| 27 | .command("login") |
| 28 | .description("Log in to Context7") |
| 29 | .option("--no-browser", "Don't open browser automatically") |
| 30 | .action(async (options) => { |
| 31 | await loginCommand(options); |
| 32 | }); |
| 33 | |
| 34 | program |
| 35 | .command("logout") |
| 36 | .description("Log out of Context7") |
| 37 | .action(() => { |
| 38 | logoutCommand(); |
| 39 | }); |
| 40 | |
| 41 | program |
| 42 | .command("whoami") |
| 43 | .description("Show current login status") |
| 44 | .action(async () => { |
| 45 | await whoamiCommand(); |
| 46 | }); |
| 47 | } |
| 48 | |
| 49 | function renderDeviceCodeBox( |
| 50 | userCode: string, |