@keystrokehq/cli 0.0.104 → 0.0.105

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/README.md CHANGED
@@ -35,7 +35,7 @@ keystroke auth logout
35
35
  | `platformUrl` | `https://api.keystroke.ai` | Platform API (direct; used by CLI platform commands) |
36
36
  | `serverUrl` | `http://localhost:3001` | Local keystroke server API (`keystroke dev` / `keystroke start`) |
37
37
 
38
- `auth login` persists both `webUrl` and `platformUrl`. Local dev: `--web-url http://localhost:3000` (platform URL resolves to `http://localhost:3002`). Cloud auth does not change `serverUrl` — local project commands still hit your dev server.
38
+ `auth login` persists both `webUrl` and `platformUrl`. Omit `--web-url` to always reset to production defaults (`https://app.keystroke.ai` / `https://api.keystroke.ai`), even if a previous login pointed at localhost. Local dev: `--web-url http://localhost:3000` (platform URL resolves to `http://localhost:3002`). Cloud auth does not change `serverUrl` — local project commands still hit your dev server.
39
39
 
40
40
  Existing commands do not require auth yet. Use `resolveCliAuth()` when adding protected commands.
41
41
 
package/dist/index.mjs CHANGED
@@ -13428,15 +13428,23 @@ async function getSessionWithBearer(baseURL, accessToken) {
13428
13428
  };
13429
13429
  }
13430
13430
  //#endregion
13431
+ //#region src/auth/resolve-login-targets.ts
13432
+ function resolveAuthLoginTargets(options, config) {
13433
+ const webUrl = options.webUrl ?? "https://app.keystroke.ai";
13434
+ return {
13435
+ webUrl,
13436
+ platformUrl: resolvePlatformUrlForWebUrl(webUrl, {
13437
+ platformUrl: options.platformUrl,
13438
+ fallback: options.webUrl ? getPlatformUrl(config) : DEFAULT_PLATFORM_URL
13439
+ })
13440
+ };
13441
+ }
13442
+ //#endregion
13431
13443
  //#region src/commands/auth/login.ts
13432
13444
  function registerAuthLoginCommand(auth) {
13433
- auth.command("login").description("Authenticate via browser device flow").option("--web-url <url>", "Web dashboard origin (default from config)").option("--platform-url <url>", "Platform API origin (derived from web URL when omitted)").option("--org <id>", "Active organization id (skips prompt when you belong to several)").action(async (options) => {
13445
+ auth.command("login").description("Authenticate via browser device flow").option("--web-url <url>", "Web dashboard origin (omit to use production defaults; local dev: http://localhost:3000)").option("--platform-url <url>", "Platform API origin (derived from web URL when omitted)").option("--org <id>", "Active organization id (skips prompt when you belong to several)").action(async (options) => {
13434
13446
  const config = createCliConfig();
13435
- const webUrl = options.webUrl ?? getWebUrl(config);
13436
- const platformUrl = resolvePlatformUrlForWebUrl(webUrl, {
13437
- platformUrl: options.platformUrl,
13438
- fallback: getPlatformUrl(config)
13439
- });
13447
+ const { webUrl, platformUrl } = resolveAuthLoginTargets(options, config);
13440
13448
  config.set("webUrl", webUrl);
13441
13449
  config.set("platformUrl", platformUrl);
13442
13450
  try {