topchester-ai 0.51.0 → 0.52.0

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.
package/dist/bin.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as runTopchesterCli } from "./cli-DkzkXlKD.mjs";
2
+ import { t as runTopchesterCli } from "./cli-yf0DNAUH.mjs";
3
3
  //#region src/bin.ts
4
4
  await runTopchesterCli();
5
5
  //#endregion
@@ -15337,8 +15337,8 @@ function createTopchesterProgram() {
15337
15337
  console.log(result.lines.join("\n"));
15338
15338
  if (!result.ok) process.exitCode = 1;
15339
15339
  });
15340
- const authCommand = program.command("auth").description("manage global provider authentication");
15341
- authCommand.command("login").description("log in to a provider").argument("<provider>", "provider id").option("--device", "use device-code login").action(async (provider, options) => {
15340
+ const authCommand = program.command("auth").description("manage global provider authentication").addHelpText("after", formatAuthCommandHelp);
15341
+ authCommand.command("login").usage("[options] <provider>").description("log in to a provider").argument("[provider]", "provider id").option("--device", "use device-code login").addHelpText("after", formatAuthLoginHelp).action(async (provider, options) => {
15342
15342
  try {
15343
15343
  await executeAuthLoginCommand(provider, options);
15344
15344
  } catch (error) {
@@ -15471,19 +15471,66 @@ function printStartupSummary(context) {
15471
15471
  }
15472
15472
  }
15473
15473
  }
15474
+ const AUTH_PROVIDERS = [{
15475
+ id: "codex",
15476
+ name: "Codex / ChatGPT",
15477
+ auth: "OAuth device-code login for Codex-backed model access.",
15478
+ example: "topchester auth login codex --device"
15479
+ }];
15480
+ function formatAuthCommandHelp() {
15481
+ return [
15482
+ "",
15483
+ ui.label("Supported providers:"),
15484
+ ...AUTH_PROVIDERS.map((provider) => ` ${ui.modelInline(provider.id.padEnd(8))} ${provider.name} - ${provider.auth}`),
15485
+ "",
15486
+ ui.label("Examples:"),
15487
+ ...AUTH_PROVIDERS.map((provider) => ` ${provider.example}`),
15488
+ " topchester auth status"
15489
+ ].join("\n");
15490
+ }
15491
+ function formatAuthLoginHelp() {
15492
+ return [
15493
+ "",
15494
+ ui.label("Supported providers:"),
15495
+ ...AUTH_PROVIDERS.map((provider) => ` ${ui.modelInline(provider.id.padEnd(8))} ${provider.auth}`),
15496
+ "",
15497
+ ui.label("Examples:"),
15498
+ ...AUTH_PROVIDERS.map((provider) => ` ${provider.example}`),
15499
+ "",
15500
+ ui.label("What happens:"),
15501
+ " Topchester prints a browser URL and one-time code, waits for approval, then stores tokens in the global auth store."
15502
+ ].join("\n");
15503
+ }
15504
+ function formatAuthLoginUsageError(reason) {
15505
+ return [
15506
+ ui.error(reason),
15507
+ "",
15508
+ ui.label("Usage:"),
15509
+ " topchester auth login <provider> --device",
15510
+ "",
15511
+ ui.label("Supported providers:"),
15512
+ ...AUTH_PROVIDERS.map((provider) => ` ${provider.id.padEnd(8)} ${provider.name} - ${provider.auth}`),
15513
+ "",
15514
+ ui.label("Examples:"),
15515
+ ...AUTH_PROVIDERS.map((provider) => ` ${provider.example}`),
15516
+ "",
15517
+ "Run `topchester auth login --help` for details."
15518
+ ].join("\n");
15519
+ }
15474
15520
  async function executeAuthLoginCommand(provider, options) {
15475
- if (provider !== "codex") throw new Error(`Unsupported auth provider "${provider}". Supported providers: codex.`);
15476
- if (!options.device) throw new Error("Usage: topchester auth login codex --device");
15521
+ if (!provider) throw new Error(formatAuthLoginUsageError("Missing provider."));
15522
+ if (provider !== "codex") throw new Error(formatAuthLoginUsageError(`Unsupported auth provider "${provider}".`));
15523
+ if (!options.device) throw new Error(formatAuthLoginUsageError("Codex login currently requires \"--device\"."));
15477
15524
  const deviceCode = await requestCodexDeviceCode();
15478
- console.log("Codex device login");
15479
- console.log(`verification URL: ${deviceCode.verificationUrl}`);
15480
- console.log(`user code: ${deviceCode.userCode}`);
15481
- console.log(`expires: ${new Date(deviceCode.expiresAt).toISOString()}`);
15482
- console.log("Device codes are a common phishing target. Never share this code.");
15483
- console.log("Waiting for browser approval...");
15525
+ console.log(ui.heading("Codex device login"));
15526
+ console.log(`${ui.label("verification URL:")} ${deviceCode.verificationUrl}`);
15527
+ console.log(`${ui.label("user code:")} ${ui.inverse(deviceCode.userCode)}`);
15528
+ console.log(`${ui.label("expires:")} ${new Date(deviceCode.expiresAt).toISOString()}`);
15529
+ console.log(ui.warn("Device codes are a common phishing target. Never share this code."));
15530
+ console.log(ui.label("Waiting for browser approval..."));
15484
15531
  await setAuthProvider("codex", await exchangeCodexAuthorizationCode(await pollCodexDeviceAuthorization(deviceCode), { issuer: deviceCode.issuer }));
15485
15532
  await configureCodexGlobalProvider();
15486
- console.log("Codex login saved.");
15533
+ console.log(ui.ok("Codex login saved."));
15487
15534
  console.log("Configured global Codex provider and starter model choices.");
15488
15535
  }
15489
15536
  async function formatAuthStatus() {
@@ -15582,4 +15629,4 @@ function formatDryRunSyncStatus(status) {
15582
15629
  //#endregion
15583
15630
  export { runTopchesterCli as t };
15584
15631
 
15585
- //# sourceMappingURL=cli-DkzkXlKD.mjs.map
15632
+ //# sourceMappingURL=cli-yf0DNAUH.mjs.map