@wspc/cli 0.0.13 → 0.0.14

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/cli.js CHANGED
@@ -1253,9 +1253,9 @@ var ConfigStore = class {
1253
1253
  };
1254
1254
 
1255
1255
  // src/version.ts
1256
- var VERSION = "0.0.13";
1256
+ var VERSION = "0.0.14";
1257
1257
  var SPEC_SHA = "7842b7a9";
1258
- var SPEC_FETCHED_AT = "2026-06-09T08:10:52.164Z";
1258
+ var SPEC_FETCHED_AT = "2026-06-10T05:27:40.161Z";
1259
1259
  var API_BASE = "https://api.wspc.ai";
1260
1260
 
1261
1261
  // src/index.ts
@@ -3508,9 +3508,18 @@ async function runLogin(opts) {
3508
3508
  }
3509
3509
 
3510
3510
  // src/handwritten/commands/login.ts
3511
- var loginCommand = new Command54("login").description("Log in via OAuth device flow (default) or API key").option("--api-key <key>", "Log in with a wspc API key (escape hatch)").option("--json", "Emit machine-readable events to stdout").action(async (opts) => {
3511
+ function resolveLoginTarget(opts, env) {
3512
+ const baseUrl = opts.apiBase ?? env.WSPC_API_BASE ?? API_BASE;
3513
+ const envName = opts.env ?? (baseUrl === API_BASE ? "prod" : "local");
3514
+ return { baseUrl, envName };
3515
+ }
3516
+ function wantsJson(opts, env) {
3517
+ return opts.json === true || env.WSPC_OUTPUT === "json";
3518
+ }
3519
+ var loginCommand = new Command54("login").description("Log in via OAuth device flow (default) or API key").option("--api-key <key>", "Log in with a wspc API key (escape hatch)").option("--api-base <url>", "Target API base URL (default: production)").option("--env <name>", "Config env name to store credentials under").option("--json", "Emit machine-readable events to stdout").action(async (opts) => {
3512
3520
  const store = new ConfigStore();
3513
- const output = opts.json ? { write: () => {
3521
+ const { baseUrl, envName } = resolveLoginTarget(opts, process.env);
3522
+ const output = wantsJson(opts, process.env) ? { write: () => {
3514
3523
  }, writeJson: (e) => process.stdout.write(JSON.stringify(e) + "\n") } : {
3515
3524
  write: (s) => process.stdout.write(s + "\n"),
3516
3525
  writeJson: () => {
@@ -3518,7 +3527,8 @@ var loginCommand = new Command54("login").description("Log in via OAuth device f
3518
3527
  };
3519
3528
  await runLogin({
3520
3529
  store,
3521
- baseUrl: API_BASE,
3530
+ baseUrl,
3531
+ envName,
3522
3532
  apiKey: opts.apiKey,
3523
3533
  output
3524
3534
  });