@superwall/cli 2.1.1 → 2.2.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.
Files changed (68) hide show
  1. package/README.md +9 -0
  2. package/dist/{apple-BHbX0jbn.js → apple-Bcr_PteR.js} +13 -13
  3. package/dist/auth.d.ts +1 -1
  4. package/dist/auth.js +3 -3
  5. package/dist/{billing-4zhIBFRQ.js → billing-CWM1ds3K.js} +3 -3
  6. package/dist/{bind-CHLHmxgA.js → bind-DEYxsnZD.js} +4 -4
  7. package/dist/{build-5PQeSnNN.js → build--oQKfZU6.js} +6 -6
  8. package/dist/{client-BIvOmWPC.js → client-CimFymxG.js} +3 -3
  9. package/dist/{create-VK-pNfN7.js → create-BG9n4fvs.js} +22 -22
  10. package/dist/{create-BSNIFsnN.js → create-DTAyHkxb.js} +6 -6
  11. package/dist/create-kT2C9k4h.js +19 -0
  12. package/dist/{doctor-9JS96QkX.js → doctor-BkygMUe2.js} +6 -6
  13. package/dist/{drivers-BamBJ10Y.js → drivers-C6eXj5-r.js} +3 -3
  14. package/dist/entry.js +19 -19
  15. package/dist/{environment-eV7LEnSN.js → environment-CQn323uB.js} +1 -1
  16. package/dist/{existing-C8dSYHGk.js → existing-CvOluc9U.js} +2 -2
  17. package/dist/held-Bwkhufdj.js +16 -0
  18. package/dist/{held-BMisHn8F.js → held-QM7yfrXq.js} +6 -6
  19. package/dist/{integrate-VWtTNPCr.js → integrate-Ci_MLkQG.js} +21 -21
  20. package/dist/{login-BimbukE5.js → login-BIAWgdzM.js} +256 -33
  21. package/dist/{login-BmwG14LC.js → login-DLi71nJq.js} +1 -1
  22. package/dist/login-Dy9N5ZDH.js +16 -0
  23. package/dist/{lookup-k9EeOiZr.js → lookup-DZFrfzO0.js} +2 -2
  24. package/dist/{migrate-C86h6jeF.js → migrate-BKF1WckS.js} +21 -21
  25. package/dist/{notification-url-BVaTgWZ5.js → notification-url-erXQ1edb.js} +2 -2
  26. package/dist/{open-0tDCQOXC.js → open-BjvGVwJf.js} +10 -10
  27. package/dist/{org-DUwdrKPV.js → org-CvPGVSBF.js} +2 -2
  28. package/dist/{paths-BCbjCLP5.js → paths-oRuC18Kt.js} +1 -1
  29. package/dist/{playbook-oov9yV0q.js → playbook-CtTj1HBK.js} +10 -10
  30. package/dist/{promote-DPGPamkE.js → promote-BkJYISza.js} +16 -16
  31. package/dist/push-BIizJJOn.js +22 -0
  32. package/dist/{push-Cz4lJ8Qd.js → push-Ul2SW87i.js} +4 -4
  33. package/dist/{registry-CTczUigi.js → registry-OmPZ6dj0.js} +77 -36
  34. package/dist/{resources-B1qKDVXd.js → resources-FIrK7pE9.js} +1 -1
  35. package/dist/{run-DTPsVmFw.js → run-CwEY1eu5.js} +2 -2
  36. package/dist/{scan-Bb48xZqB.js → scan-CpbfZ2ju.js} +1 -1
  37. package/dist/scan-DjyvuWel.js +4 -0
  38. package/dist/{scope-B6UYGuwn.js → scope-BSqVfZvy.js} +4 -4
  39. package/dist/{selection-BbNk9r1q.js → selection-CHnVk8uw.js} +3 -3
  40. package/dist/server-BTveynqC.js +22 -0
  41. package/dist/{server-EYBMKAG1.js → server-D5xl5iKO.js} +66 -16
  42. package/dist/{session-xG9E8J2N.js → session-6lnJ0shD.js} +1 -1
  43. package/dist/{session-Crg9X-FI.js → session-BFwasPVq.js} +9 -8
  44. package/dist/session-Ds6tLC19.js +6 -0
  45. package/dist/skills/superwall/references/data-analytics.md +7 -8
  46. package/dist/skills/superwall-framework/references/migrate-from-editor.md +2 -1
  47. package/dist/{skills-Dg3k6TRC.js → skills-B8uSuanf.js} +8 -8
  48. package/dist/{skills-BdMKE2uO.js → skills-D7sG0xom.js} +4 -4
  49. package/dist/{spinner-Ba3XhlMb.js → spinner-TZeZEeVv.js} +3 -3
  50. package/dist/{storage-CerJ5KLP.d.ts → storage-BbJF7z3l.d.ts} +1 -0
  51. package/dist/{storage-DIkYajce.js → storage-DqKJe13V.js} +12 -2
  52. package/dist/storekit-C_LFh8qy.js +16 -0
  53. package/dist/{storekit-C2UzIIMs.js → storekit-uyT3DWo4.js} +3 -3
  54. package/dist/{telemetry-CVP8O6Y3.js → telemetry-D_uIIuSk.js} +1 -1
  55. package/dist/{token-IWv2httm.js → token-BJsLGoSX.js} +1 -1
  56. package/dist/tools.d.ts +8 -8
  57. package/dist/tools.js +14 -4
  58. package/dist/{upgrade-1t3aQUxh.js → upgrade-BRM51As6.js} +1 -1
  59. package/dist/{upgrade-DLf0LJDh.js → upgrade-DV_rmhyV.js} +2 -2
  60. package/package.json +2 -2
  61. package/dist/create-oj3zXvHZ.js +0 -19
  62. package/dist/held-DeJW2gUk.js +0 -16
  63. package/dist/login-2JHCG6c1.js +0 -16
  64. package/dist/push-Chp21y3a.js +0 -22
  65. package/dist/scan-B1SkkUi7.js +0 -4
  66. package/dist/server-CwrZ-I1r.js +0 -22
  67. package/dist/session-DItGa4z0.js +0 -6
  68. package/dist/storekit-DHNxDDpA.js +0 -16
@@ -1,10 +1,11 @@
1
- import { f as Integration, i as AUTH_HOST, p as OAUTH_SCOPE, s as CLI_CLIENT_ID, t as API_HOST } from "./environment-eV7LEnSN.js";
2
- import { i as serializeSession, o as writeSession } from "./storage-DIkYajce.js";
1
+ import { f as Integration, i as AUTH_HOST, p as OAUTH_SCOPE, s as CLI_CLIENT_ID, t as API_HOST } from "./environment-CQn323uB.js";
2
+ import { c as writePendingLogin, l as writeSession, o as serializeSession, r as removePendingLogin, t as readPendingLogin } from "./storage-DqKJe13V.js";
3
3
  import { a as readOnboardingIdempotencyKey, d as writeOnboardedApp, f as writeOnboardedOrg, i as readOnboardedOrg } from "./config-BO1Y87kV.js";
4
- import { r as track } from "./telemetry-CVP8O6Y3.js";
4
+ import { r as track } from "./telemetry-D_uIIuSk.js";
5
+ import { r as UsageError } from "./spinner-TZeZEeVv.js";
5
6
  import { n as ui } from "./ui-D_qf3Gvw.js";
6
- import { t as scanProject } from "./scan-Bb48xZqB.js";
7
- import { s as ensureSkillsCurrent } from "./skills-BdMKE2uO.js";
7
+ import { t as scanProject } from "./scan-CpbfZ2ju.js";
8
+ import { s as ensureSkillsCurrent } from "./skills-D7sG0xom.js";
8
9
  import { spawn } from "node:child_process";
9
10
  import { setTimeout } from "node:timers/promises";
10
11
 
@@ -65,7 +66,8 @@ function hasDisplay(env, platform) {
65
66
  }
66
67
  function openBrowser(url, deps = {}) {
67
68
  const platform = deps.platform ?? process.platform;
68
- if (!hasDisplay(deps.env ?? process.env, platform)) return Promise.resolve(false);
69
+ const env = deps.env ?? process.env;
70
+ if (env.BROWSER === "none" || !hasDisplay(env, platform)) return Promise.resolve(false);
69
71
  const cmd = platform === "darwin" ? "open" : platform === "win32" ? "cmd" : "xdg-open";
70
72
  const args = platform === "win32" ? [
71
73
  "/c",
@@ -91,22 +93,116 @@ function openBrowser(url, deps = {}) {
91
93
  //#endregion
92
94
  //#region src/core/account/login.ts
93
95
  const DEVICE_GRANT = "urn:ietf:params:oauth:grant-type:device_code";
94
- async function performLogin(opts = {}) {
96
+ async function createPendingLogin(opts) {
95
97
  const issuer = opts.issuer ?? AUTH_HOST();
96
- const apiHost = opts.apiHost ?? API_HOST();
97
98
  const clientId = opts.clientId ?? CLI_CLIENT_ID();
98
99
  const disc = await discover(issuer);
99
100
  if (!disc.device_authorization_endpoint) throw new Error("auth.superwall.com does not advertise a device-authorization endpoint.");
100
101
  const dev = await startDeviceAuth(disc.device_authorization_endpoint, clientId);
101
102
  const url = dev.verification_uri_complete ?? dev.verification_uri;
102
103
  const browserOpened = await (opts.openBrowser ?? openBrowser)(url);
104
+ const now = Date.now();
105
+ return {
106
+ browserOpened,
107
+ pending: {
108
+ apiHost: opts.apiHost ?? API_HOST(),
109
+ clientId,
110
+ tokenEndpoint: disc.token_endpoint,
111
+ deviceCode: dev.device_code,
112
+ userCode: dev.user_code,
113
+ url,
114
+ interval: dev.interval ?? 5,
115
+ expiresAt: now + (dev.expires_in ?? 600) * 1e3,
116
+ lastPolledAt: now,
117
+ ...opts.orgName ? { orgName: opts.orgName } : {},
118
+ ...opts.app ? { app: opts.app } : {}
119
+ }
120
+ };
121
+ }
122
+ async function performLogin(opts = {}) {
123
+ const { pending, browserOpened } = await createPendingLogin(opts);
103
124
  opts.onVerify?.({
104
- url,
105
- userCode: dev.user_code,
125
+ url: pending.url,
126
+ userCode: pending.userCode,
106
127
  browserOpened
107
128
  });
108
- const { accessToken, refreshToken, expiresIn, idToken } = await pollForToken(disc.token_endpoint, clientId, dev, opts.onStatus);
109
- let apiToken = accessToken;
129
+ const tokens = await pollForToken(pending, pending.expiresAt, opts.onStatus);
130
+ if (!tokens) throw new Error("Login timed out.");
131
+ const finished = await finishLogin(pending, tokens, opts);
132
+ if ("needsOrganization" in finished) throw new Error("Your account has no organization yet - run `superwall login` interactively to create one.");
133
+ return finished.session;
134
+ }
135
+ async function startLogin(opts = {}) {
136
+ const started = await createPendingLogin(opts);
137
+ writePendingLogin(started.pending);
138
+ return started;
139
+ }
140
+ async function pollLogin(opts) {
141
+ const pending = readPendingLogin();
142
+ if (!pending) throw new Error("No login in progress. Run `superwall login` first.");
143
+ if (opts.orgName) pending.orgName = opts.orgName;
144
+ if (opts.app) pending.app = opts.app;
145
+ const tokens = await resolvePollTokens(pending, opts);
146
+ if (!tokens) {
147
+ writePendingLogin(pending);
148
+ return {
149
+ status: "pending",
150
+ pending
151
+ };
152
+ }
153
+ pending.tokens = tokens;
154
+ writePendingLogin(pending);
155
+ const finished = await finishLogin(pending, tokens, {
156
+ ...opts,
157
+ orgName: pending.orgName,
158
+ app: pending.app
159
+ });
160
+ if ("session" in finished) {
161
+ removePendingLogin();
162
+ return {
163
+ status: "logged_in",
164
+ session: finished.session
165
+ };
166
+ }
167
+ return {
168
+ status: "needs_organization",
169
+ pending
170
+ };
171
+ }
172
+ async function resolvePollTokens(pending, opts) {
173
+ const held = pending.tokens;
174
+ if (held) {
175
+ if (!held.refreshToken) return held;
176
+ const fresh = await refreshAccessToken(pending.tokenEndpoint, pending.clientId, held.refreshToken);
177
+ return fresh ? {
178
+ ...held,
179
+ ...fresh,
180
+ expiresIn: fresh.expiresIn
181
+ } : held;
182
+ }
183
+ if (Date.now() >= pending.expiresAt) {
184
+ removePendingLogin();
185
+ throw new Error("The login request expired. Run `superwall login` again for a new code.");
186
+ }
187
+ try {
188
+ return await pollForToken(pending, Math.min(pending.expiresAt, Date.now() + opts.timeoutMs), opts.onStatus);
189
+ } catch (error) {
190
+ removePendingLogin();
191
+ throw error;
192
+ }
193
+ }
194
+ async function resolveOnboardSetup(opts) {
195
+ if (opts.onOnboard) return opts.onOnboard();
196
+ if (opts.orgName) return {
197
+ orgName: opts.orgName,
198
+ ...opts.app ? { app: opts.app } : {}
199
+ };
200
+ }
201
+ async function finishLogin(pending, tokens, opts) {
202
+ const { apiHost, clientId, tokenEndpoint } = pending;
203
+ const { idToken } = tokens;
204
+ let { refreshToken, expiresIn } = tokens;
205
+ let apiToken = tokens.accessToken;
110
206
  if (idToken) await findJson(`${apiHost}/v2/me`, idToken).catch(() => null);
111
207
  const me = await findJson(`${apiHost}/v2/me`, apiToken).catch(() => null);
112
208
  let hasOrg = false;
@@ -117,8 +213,8 @@ async function performLogin(opts = {}) {
117
213
  }
118
214
  let createdNewOrg = false;
119
215
  if (!hasOrg && !readOnboardedOrg()) {
120
- if (!opts.onOnboard) throw new Error("Your account has no organization yet - run `superwall login` interactively to create one.");
121
- const setup = await opts.onOnboard();
216
+ const setup = await resolveOnboardSetup(opts);
217
+ if (setup === void 0) return { needsOrganization: true };
122
218
  if (!setup) throw new Error("Cancelled.");
123
219
  opts.onStatus?.("Creating your account…");
124
220
  let org;
@@ -138,8 +234,12 @@ async function performLogin(opts = {}) {
138
234
  }
139
235
  if (createdNewOrg && refreshToken) {
140
236
  opts.onStatus?.("Activating your organization…");
141
- const fresh = await refreshAccessToken(disc.token_endpoint, clientId, refreshToken);
142
- if (fresh) apiToken = fresh;
237
+ const fresh = await refreshAccessToken(tokenEndpoint, clientId, refreshToken);
238
+ if (fresh) {
239
+ apiToken = fresh.accessToken;
240
+ refreshToken = fresh.refreshToken;
241
+ expiresIn = fresh.expiresIn;
242
+ }
143
243
  }
144
244
  const session = {
145
245
  authMethod: "oauth",
@@ -149,11 +249,11 @@ async function performLogin(opts = {}) {
149
249
  accessToken: apiToken,
150
250
  refreshToken,
151
251
  accessTokenExpiresAt: expiresIn ? Date.now() + expiresIn * 1e3 : void 0,
152
- tokenEndpoint: disc.token_endpoint,
252
+ tokenEndpoint,
153
253
  oauthClientId: clientId
154
254
  };
155
255
  writeSession(session);
156
- return session;
256
+ return { session };
157
257
  }
158
258
  async function loginWithApiKey(apiKey, apiHost = API_HOST()) {
159
259
  const key = apiKey.trim();
@@ -198,18 +298,18 @@ async function startDeviceAuth(endpoint, clientId) {
198
298
  }
199
299
  return await r.json();
200
300
  }
201
- async function pollForToken(tokenEndpoint, clientId, dev, onStatus) {
202
- const deadline = Date.now() + (dev.expires_in ?? 600) * 1e3;
203
- let interval = dev.interval ?? 5;
204
- while (Date.now() < deadline) {
205
- await setTimeout(interval * 1e3);
206
- const r = await fetch(tokenEndpoint, {
301
+ async function pollForToken(pending, deadline, onStatus) {
302
+ let wait = Math.max(0, pending.lastPolledAt + pending.interval * 1e3 - Date.now());
303
+ while (Date.now() + wait < deadline) {
304
+ await setTimeout(wait);
305
+ pending.lastPolledAt = Date.now();
306
+ const r = await fetch(pending.tokenEndpoint, {
207
307
  method: "POST",
208
308
  headers: { "content-type": "application/x-www-form-urlencoded" },
209
309
  body: new URLSearchParams({
210
310
  grant_type: DEVICE_GRANT,
211
- device_code: dev.device_code,
212
- client_id: clientId
311
+ device_code: pending.deviceCode,
312
+ client_id: pending.clientId
213
313
  })
214
314
  });
215
315
  const d = await r.json().catch(() => ({}));
@@ -222,16 +322,17 @@ async function pollForToken(tokenEndpoint, clientId, dev, onStatus) {
222
322
  switch (d.error) {
223
323
  case "authorization_pending":
224
324
  onStatus?.("Waiting for you to approve in the browser…");
225
- continue;
325
+ break;
226
326
  case "slow_down":
227
- interval += 5;
228
- continue;
327
+ pending.interval += 5;
328
+ break;
229
329
  case "expired_token": throw new Error("The login request expired - run `superwall login` again.");
230
330
  case "access_denied": throw new Error("Login was denied.");
231
331
  default: throw new Error(d.error_description || d.error || "Token polling failed.");
232
332
  }
333
+ wait = pending.interval * 1e3;
233
334
  }
234
- throw new Error("Login timed out.");
335
+ return null;
235
336
  }
236
337
  async function createOrganization(apiHost, token, name) {
237
338
  const created = await postJson(`${apiHost}/v2/me/organizations`, token, { name });
@@ -271,7 +372,13 @@ async function refreshAccessToken(tokenEndpoint, clientId, refreshToken) {
271
372
  })
272
373
  });
273
374
  if (!r.ok) return null;
274
- return (await r.json()).access_token ?? null;
375
+ const d = await r.json();
376
+ if (!d.access_token) return null;
377
+ return {
378
+ accessToken: d.access_token,
379
+ refreshToken: d.refresh_token ?? refreshToken,
380
+ ...d.expires_in === void 0 ? {} : { expiresIn: d.expires_in }
381
+ };
275
382
  } catch {
276
383
  return null;
277
384
  }
@@ -300,6 +407,120 @@ async function postJson(url, accessToken, body) {
300
407
  }
301
408
  return r.json();
302
409
  }
410
+ const POLL_HINT = "superwall login --poll";
411
+ const POLL_TIMEOUT_SECONDS = 60;
412
+ function isPlatform(value) {
413
+ return value === "ios" || value === "android" || value === "web";
414
+ }
415
+ function resolveAgentLogin(flags) {
416
+ const orgName = flags.orgName?.trim() || void 0;
417
+ const appName = flags.appName?.trim() || void 0;
418
+ const base = {
419
+ orgName,
420
+ issuer: flags.host,
421
+ clientId: flags.clientId
422
+ };
423
+ if (!appName) {
424
+ if (flags.platform || flags.bundleId) throw new UsageError("--platform and --bundle-id need --app-name.");
425
+ return base;
426
+ }
427
+ if (!orgName) throw new UsageError("--app-name needs --org-name.");
428
+ if (!flags.platform || !isPlatform(flags.platform)) throw new UsageError("--app-name needs --platform ios, android or web.");
429
+ const bundleId = flags.bundleId?.trim() || void 0;
430
+ return {
431
+ ...base,
432
+ app: {
433
+ name: appName,
434
+ platform: flags.platform,
435
+ ...bundleId ? { bundleId } : {}
436
+ }
437
+ };
438
+ }
439
+ const formatExpiry = (pending) => new Date(pending.expiresAt).toISOString();
440
+ async function runAgentLoginStart(ctx, agent, openBrowser$1) {
441
+ const { pending, browserOpened } = await startLogin({
442
+ ...agent,
443
+ ...openBrowser$1 ? { openBrowser: openBrowser$1 } : {}
444
+ });
445
+ track("login started", { method: "oauth_poll" });
446
+ if (ctx.json) return ctx.output.data({
447
+ status: "pending",
448
+ verification_url: pending.url,
449
+ user_code: pending.userCode,
450
+ expires_at: formatExpiry(pending),
451
+ browser_opened: browserOpened,
452
+ next: POLL_HINT
453
+ });
454
+ ctx.ui.info(`Approve this login in your browser · code \`${pending.userCode}\`\n${pending.url}`);
455
+ if (!browserOpened) ctx.ui.warn(BROWSER_UNAVAILABLE);
456
+ ctx.ui.outro(`Once it's approved, run \`${POLL_HINT}\` to finish. The code expires at ${formatExpiry(pending)}.`);
457
+ }
458
+ async function runAgentLoginPoll(ctx, agent, timeoutSeconds) {
459
+ const { ui: ui$1 } = ctx;
460
+ const seconds = timeoutSeconds !== void 0 && timeoutSeconds >= 0 ? timeoutSeconds : POLL_TIMEOUT_SECONDS;
461
+ const hooks = onboardingHooks((await scanProject(ctx.installDir).catch(() => null))?.apps[0]);
462
+ const spin = ui$1.spinner();
463
+ spin.start("Waiting for you to approve in the browser");
464
+ let result;
465
+ try {
466
+ result = await pollLogin({
467
+ ...agent,
468
+ timeoutMs: seconds * 1e3,
469
+ onStatus: (m) => spin.message(m),
470
+ onProvisioned: hooks.onProvisioned
471
+ });
472
+ } catch (e) {
473
+ spin.stop("Login failed");
474
+ track("login finished", {
475
+ status: "error",
476
+ method: "oauth_poll"
477
+ });
478
+ throw e;
479
+ }
480
+ if (result.status === "logged_in") {
481
+ spin.stop(`Logged in as \`${result.session.userEmail ?? "you"}\``);
482
+ track("login finished", {
483
+ status: "success",
484
+ method: "oauth_poll"
485
+ });
486
+ const provisioned = hooks.provisioned();
487
+ if (ctx.json) return ctx.output.data({
488
+ status: "logged_in",
489
+ ...serializeSession(result.session),
490
+ ...provisioned?.publicApiKey ? { app: {
491
+ public_api_key: provisioned.publicApiKey,
492
+ application_id: provisioned.applicationId ?? null,
493
+ project_id: provisioned.projectId ?? null
494
+ } } : {}
495
+ });
496
+ await ensureSkillsCurrent(false, "login").catch(() => {});
497
+ ui$1.outro(provisioned?.publicApiKey ? "Your app is ready - run `superwall integrate` to set up the SDK." : "You're all set - run `superwall integrate` to set up your app.");
498
+ return;
499
+ }
500
+ ctx.fail();
501
+ if (result.status === "needs_organization") {
502
+ spin.stop("Approved");
503
+ const next = `${POLL_HINT} --org-name "<name>"`;
504
+ const message = `This account has no organization yet. Run \`${next}\` to create one, with --app-name and --platform to create its first app too.`;
505
+ if (ctx.json) return ctx.output.data({
506
+ status: "needs_organization",
507
+ message,
508
+ next
509
+ });
510
+ ui$1.warn(message);
511
+ return;
512
+ }
513
+ const { pending } = result;
514
+ spin.stop("Not approved yet");
515
+ if (ctx.json) return ctx.output.data({
516
+ status: "pending",
517
+ verification_url: pending.url,
518
+ user_code: pending.userCode,
519
+ expires_at: formatExpiry(pending),
520
+ next: POLL_HINT
521
+ });
522
+ ui$1.info(`Still waiting for approval · code \`${pending.userCode}\`\n${pending.url}\nRun \`${POLL_HINT}\` again. The code expires at ${formatExpiry(pending)}.`);
523
+ }
303
524
  async function runLogin(ctx, { flags, openBrowser: openBrowser$1 }) {
304
525
  const { ui: ui$1 } = ctx;
305
526
  ui$1.intro("Superwall login");
@@ -327,7 +548,9 @@ async function runLogin(ctx, { flags, openBrowser: openBrowser$1 }) {
327
548
  }
328
549
  return;
329
550
  }
330
- if (!ctx.interactive) throw new Error("Browser login requires an interactive terminal. Use `superwall login --api-key <key>`.");
551
+ const agent = resolveAgentLogin(flags);
552
+ if (flags.poll) return runAgentLoginPoll(ctx, agent, flags.timeout);
553
+ if (!ctx.interactive) return runAgentLoginStart(ctx, agent, openBrowser$1);
331
554
  const hooks = onboardingHooks((await scanProject(ctx.installDir).catch(() => null))?.apps[0]);
332
555
  const spin = ui$1.spinner();
333
556
  try {
@@ -366,4 +589,4 @@ async function runLogin(ctx, { flags, openBrowser: openBrowser$1 }) {
366
589
  }
367
590
 
368
591
  //#endregion
369
- export { onboardingHooks as a, openBrowser as i, runLogin as n, BROWSER_UNAVAILABLE as r, performLogin as t };
592
+ export { BROWSER_UNAVAILABLE as a, startLogin as i, pollLogin as n, openBrowser as o, runLogin as r, onboardingHooks as s, performLogin as t };
@@ -1,5 +1,5 @@
1
1
  import { n as ui } from "./ui-D_qf3Gvw.js";
2
- import { a as onboardingHooks, r as BROWSER_UNAVAILABLE, t as performLogin } from "./login-BimbukE5.js";
2
+ import { a as BROWSER_UNAVAILABLE, s as onboardingHooks, t as performLogin } from "./login-BIAWgdzM.js";
3
3
 
4
4
  //#region src/core/workflows/login.ts
5
5
  async function performLoginWithUi(app, onProvisioned) {
@@ -0,0 +1,16 @@
1
+ import "./token-BJsLGoSX.js";
2
+ import "./output-Ggzq5_-t.js";
3
+ import "./environment-CQn323uB.js";
4
+ import "./storage-DqKJe13V.js";
5
+ import "./client-CimFymxG.js";
6
+ import "./config-BO1Y87kV.js";
7
+ import "./telemetry-D_uIIuSk.js";
8
+ import "./spawn-DmmmHIP-.js";
9
+ import "./spinner-TZeZEeVv.js";
10
+ import "./ui-D_qf3Gvw.js";
11
+ import "./scan-CpbfZ2ju.js";
12
+ import "./paths-oRuC18Kt.js";
13
+ import { i as startLogin, n as pollLogin, r as runLogin, t as performLogin } from "./login-BIAWgdzM.js";
14
+ import "./skills-D7sG0xom.js";
15
+
16
+ export { performLogin, pollLogin, runLogin, startLogin };
@@ -1,5 +1,5 @@
1
- import { t as ApiError } from "./client-BIvOmWPC.js";
2
- import { F as orgProjects, L as rememberOrg, p as listProjects } from "./resources-B1qKDVXd.js";
1
+ import { t as ApiError } from "./client-CimFymxG.js";
2
+ import { F as orgProjects, L as rememberOrg, p as listProjects } from "./resources-FIrK7pE9.js";
3
3
 
4
4
  //#region src/core/api/lookup.ts
5
5
  const DASHBOARD_PATH = /^\/(\d+)(?:\/(\d+))?(?:\/|$)/;
@@ -1,30 +1,30 @@
1
- import "./token-IWv2httm.js";
1
+ import "./token-BJsLGoSX.js";
2
2
  import { t as blocks } from "./output-Ggzq5_-t.js";
3
- import { c as DASHBOARD_URL, v as VERSION } from "./environment-eV7LEnSN.js";
4
- import { a as sessionOrgName, t as readSession } from "./storage-DIkYajce.js";
5
- import "./client-BIvOmWPC.js";
3
+ import { c as DASHBOARD_URL, v as VERSION } from "./environment-CQn323uB.js";
4
+ import { n as readSession, s as sessionOrgName } from "./storage-DqKJe13V.js";
5
+ import "./client-CimFymxG.js";
6
6
  import "./config-BO1Y87kV.js";
7
- import "./telemetry-CVP8O6Y3.js";
7
+ import "./telemetry-D_uIIuSk.js";
8
8
  import "./spawn-DmmmHIP-.js";
9
- import "./spinner-Ba3XhlMb.js";
9
+ import "./spinner-TZeZEeVv.js";
10
10
  import { n as ui } from "./ui-D_qf3Gvw.js";
11
11
  import "./theme-DUsCh-Vd.js";
12
12
  import { t as stripReport } from "./log-NVhVe_oe.js";
13
- import { t as scanProject } from "./scan-Bb48xZqB.js";
14
- import { t as detectExisting } from "./existing-C8dSYHGk.js";
15
- import "./paths-BCbjCLP5.js";
16
- import "./resources-B1qKDVXd.js";
17
- import "./lookup-k9EeOiZr.js";
18
- import "./login-BimbukE5.js";
19
- import "./skills-BdMKE2uO.js";
20
- import "./selection-BbNk9r1q.js";
21
- import { n as requireApi } from "./session-Crg9X-FI.js";
22
- import { n as performLoginWithUi } from "./login-BmwG14LC.js";
23
- import { t as runAction } from "./run-DTPsVmFw.js";
24
- import { t as detectDrivers } from "./drivers-BamBJ10Y.js";
25
- import { _ as screenNameOf, a as buildMigrationCopyPrompt, c as migrationFor, d as projectDirOf, f as scaffoldFromPaywall, g as placementOfName, h as findScreenCandidates, i as startStudio, l as migrationSource, m as screenMigrationFor, n as migrationNextSteps, o as hasOriginal, p as scaffoldFromScreen, r as screenNextSteps, t as askStudio, u as offerMigration } from "./open-0tDCQOXC.js";
26
- import "./server-EYBMKAG1.js";
27
- import { r as actionById, t as detectBilling } from "./billing-4zhIBFRQ.js";
13
+ import { t as scanProject } from "./scan-CpbfZ2ju.js";
14
+ import { t as detectExisting } from "./existing-CvOluc9U.js";
15
+ import "./paths-oRuC18Kt.js";
16
+ import "./resources-FIrK7pE9.js";
17
+ import "./lookup-DZFrfzO0.js";
18
+ import "./login-BIAWgdzM.js";
19
+ import "./skills-D7sG0xom.js";
20
+ import "./selection-CHnVk8uw.js";
21
+ import { n as requireApi } from "./session-BFwasPVq.js";
22
+ import { n as performLoginWithUi } from "./login-DLi71nJq.js";
23
+ import { t as runAction } from "./run-CwEY1eu5.js";
24
+ import { t as detectDrivers } from "./drivers-C6eXj5-r.js";
25
+ import { _ as screenNameOf, a as buildMigrationCopyPrompt, c as migrationFor, d as projectDirOf, f as scaffoldFromPaywall, g as placementOfName, h as findScreenCandidates, i as startStudio, l as migrationSource, m as screenMigrationFor, n as migrationNextSteps, o as hasOriginal, p as scaffoldFromScreen, r as screenNextSteps, t as askStudio, u as offerMigration } from "./open-BjvGVwJf.js";
26
+ import "./server-D5xl5iKO.js";
27
+ import { r as actionById, t as detectBilling } from "./billing-CWM1ds3K.js";
28
28
  import { n as writeReport } from "./reports-D_qbl7_u.js";
29
29
  import { execFile } from "node:child_process";
30
30
  import * as fs from "node:fs";
@@ -1,5 +1,5 @@
1
- import { D as updateServerNotifications, r as chooseKeyApp } from "./held-BMisHn8F.js";
2
- import { t as apiCall } from "./spinner-Ba3XhlMb.js";
1
+ import { D as updateServerNotifications, r as chooseKeyApp } from "./held-QM7yfrXq.js";
2
+ import { t as apiCall } from "./spinner-TZeZEeVv.js";
3
3
  import { i as findAppNotificationUrl } from "./client-BZ1UbpXz.js";
4
4
  import { t as timing } from "./timing-BVxPrYq3.js";
5
5
 
@@ -1,14 +1,14 @@
1
- import { S as isNonInteractive, c as DASHBOARD_URL } from "./environment-eV7LEnSN.js";
2
- import { t as ApiError } from "./client-BIvOmWPC.js";
1
+ import { S as isNonInteractive, c as DASHBOARD_URL } from "./environment-CQn323uB.js";
2
+ import { t as ApiError } from "./client-CimFymxG.js";
3
3
  import { t as stripReport } from "./log-NVhVe_oe.js";
4
- import { i as readPackageJson, r as allDeps } from "./scan-Bb48xZqB.js";
5
- import { c as findPaywall, f as listApplications } from "./resources-B1qKDVXd.js";
6
- import { d as readBundledSkill } from "./skills-BdMKE2uO.js";
7
- import { E as writeApp, S as isScreenOrigin, k as writeOrigin, w as readLock } from "./selection-BbNk9r1q.js";
8
- import { c as projectPackageName } from "./session-Crg9X-FI.js";
9
- import { a as copyToClipboard, i as readPrompt, n as runWithDriverFallback } from "./run-DTPsVmFw.js";
10
- import { t as detectDrivers } from "./drivers-BamBJ10Y.js";
11
- import { t as runStudio } from "./server-EYBMKAG1.js";
4
+ import { i as readPackageJson, r as allDeps } from "./scan-CpbfZ2ju.js";
5
+ import { c as findPaywall, f as listApplications } from "./resources-FIrK7pE9.js";
6
+ import { d as readBundledSkill } from "./skills-D7sG0xom.js";
7
+ import { E as writeApp, S as isScreenOrigin, k as writeOrigin, w as readLock } from "./selection-CHnVk8uw.js";
8
+ import { c as projectPackageName } from "./session-BFwasPVq.js";
9
+ import { a as copyToClipboard, i as readPrompt, n as runWithDriverFallback } from "./run-CwEY1eu5.js";
10
+ import { t as detectDrivers } from "./drivers-C6eXj5-r.js";
11
+ import { t as runStudio } from "./server-D5xl5iKO.js";
12
12
  import * as fs from "node:fs";
13
13
  import * as path from "node:path";
14
14
  import fg from "fast-glob";
@@ -1,6 +1,6 @@
1
- import { n as withSpinner } from "./spinner-Ba3XhlMb.js";
1
+ import { n as withSpinner } from "./spinner-TZeZEeVv.js";
2
2
  import { n as ui } from "./ui-D_qf3Gvw.js";
3
- import { M as listOrgGroups, N as listOrganizations, T as titleCase, w as rowName } from "./resources-B1qKDVXd.js";
3
+ import { M as listOrgGroups, N as listOrganizations, T as titleCase, w as rowName } from "./resources-FIrK7pE9.js";
4
4
 
5
5
  //#region src/core/account/org.ts
6
6
  async function orgForNewProject(api, interactive) {
@@ -1,4 +1,4 @@
1
- import { C as resolveEnv } from "./environment-eV7LEnSN.js";
1
+ import { C as resolveEnv } from "./environment-CQn323uB.js";
2
2
  import { existsSync } from "node:fs";
3
3
  import { dirname, join } from "node:path";
4
4
  import { homedir } from "node:os";
@@ -1,17 +1,17 @@
1
- import "./token-IWv2httm.js";
1
+ import "./token-BJsLGoSX.js";
2
2
  import "./output-Ggzq5_-t.js";
3
- import "./environment-eV7LEnSN.js";
4
- import "./storage-DIkYajce.js";
5
- import "./client-BIvOmWPC.js";
3
+ import "./environment-CQn323uB.js";
4
+ import "./storage-DqKJe13V.js";
5
+ import "./client-CimFymxG.js";
6
6
  import "./config-BO1Y87kV.js";
7
- import { i as updateTelemetryTags, r as track } from "./telemetry-CVP8O6Y3.js";
7
+ import { i as updateTelemetryTags, r as track } from "./telemetry-D_uIIuSk.js";
8
8
  import "./spawn-DmmmHIP-.js";
9
- import "./spinner-Ba3XhlMb.js";
9
+ import "./spinner-TZeZEeVv.js";
10
10
  import "./ui-D_qf3Gvw.js";
11
- import { t as scanProject } from "./scan-Bb48xZqB.js";
12
- import "./paths-BCbjCLP5.js";
13
- import { d as readBundledSkill } from "./skills-BdMKE2uO.js";
14
- import { n as FRAMEWORK_REF, t as detectBilling } from "./billing-4zhIBFRQ.js";
11
+ import { t as scanProject } from "./scan-CpbfZ2ju.js";
12
+ import "./paths-oRuC18Kt.js";
13
+ import { d as readBundledSkill } from "./skills-D7sG0xom.js";
14
+ import { n as FRAMEWORK_REF, t as detectBilling } from "./billing-CWM1ds3K.js";
15
15
 
16
16
  //#region src/core/workflows/playbook.ts
17
17
  async function printPlaybook(installDir, playbook) {
@@ -1,23 +1,23 @@
1
- import "./token-IWv2httm.js";
1
+ import "./token-BJsLGoSX.js";
2
2
  import "./output-Ggzq5_-t.js";
3
- import { v as VERSION } from "./environment-eV7LEnSN.js";
4
- import "./storage-DIkYajce.js";
5
- import { t as ApiError } from "./client-BIvOmWPC.js";
3
+ import { v as VERSION } from "./environment-CQn323uB.js";
4
+ import "./storage-DqKJe13V.js";
5
+ import { t as ApiError } from "./client-CimFymxG.js";
6
6
  import "./config-BO1Y87kV.js";
7
- import "./telemetry-CVP8O6Y3.js";
7
+ import "./telemetry-D_uIIuSk.js";
8
8
  import "./spawn-DmmmHIP-.js";
9
- import "./spinner-Ba3XhlMb.js";
9
+ import "./spinner-TZeZEeVv.js";
10
10
  import { n as ui } from "./ui-D_qf3Gvw.js";
11
- import "./scan-Bb48xZqB.js";
12
- import "./paths-BCbjCLP5.js";
13
- import { b as promotePaywallVersion, g as livePaywallVersion } from "./resources-B1qKDVXd.js";
14
- import "./lookup-k9EeOiZr.js";
15
- import "./login-BimbukE5.js";
16
- import "./skills-BdMKE2uO.js";
17
- import { N as resolveFramework, a as resolveProjectDir, g as transition, s as selectSurfaces, v as collectProjectDeclarations, w as readLock } from "./selection-BbNk9r1q.js";
18
- import { _ as targetLabel, g as planTargets, h as parsePlatformFlags, n as requireApi, v as wantedPlatforms, x as resolveApps, y as resolveBinding } from "./session-Crg9X-FI.js";
19
- import { a as pickApplicationOption, i as timed, o as pickAdoptOption, t as group } from "./push-Cz4lJ8Qd.js";
20
- import "./login-BmwG14LC.js";
11
+ import "./scan-CpbfZ2ju.js";
12
+ import "./paths-oRuC18Kt.js";
13
+ import { b as promotePaywallVersion, g as livePaywallVersion } from "./resources-FIrK7pE9.js";
14
+ import "./lookup-DZFrfzO0.js";
15
+ import "./login-BIAWgdzM.js";
16
+ import "./skills-D7sG0xom.js";
17
+ import { N as resolveFramework, a as resolveProjectDir, g as transition, s as selectSurfaces, v as collectProjectDeclarations, w as readLock } from "./selection-CHnVk8uw.js";
18
+ import { _ as targetLabel, g as planTargets, h as parsePlatformFlags, n as requireApi, v as wantedPlatforms, x as resolveApps, y as resolveBinding } from "./session-BFwasPVq.js";
19
+ import { a as pickApplicationOption, i as timed, o as pickAdoptOption, t as group } from "./push-Ul2SW87i.js";
20
+ import "./login-DLi71nJq.js";
21
21
  import pc from "picocolors";
22
22
 
23
23
  //#region src/core/paywalls/promote.ts
@@ -0,0 +1,22 @@
1
+ import "./token-BJsLGoSX.js";
2
+ import "./output-Ggzq5_-t.js";
3
+ import "./environment-CQn323uB.js";
4
+ import "./storage-DqKJe13V.js";
5
+ import "./client-CimFymxG.js";
6
+ import "./config-BO1Y87kV.js";
7
+ import "./telemetry-D_uIIuSk.js";
8
+ import "./spawn-DmmmHIP-.js";
9
+ import "./spinner-TZeZEeVv.js";
10
+ import "./ui-D_qf3Gvw.js";
11
+ import "./scan-CpbfZ2ju.js";
12
+ import "./paths-oRuC18Kt.js";
13
+ import "./resources-FIrK7pE9.js";
14
+ import "./lookup-DZFrfzO0.js";
15
+ import "./login-BIAWgdzM.js";
16
+ import "./skills-D7sG0xom.js";
17
+ import "./selection-CHnVk8uw.js";
18
+ import "./session-BFwasPVq.js";
19
+ import { i as timed, n as runPush, r as runPushPipeline, t as group } from "./push-Ul2SW87i.js";
20
+ import "./login-DLi71nJq.js";
21
+
22
+ export { group, runPush, runPushPipeline, timed };
@@ -1,8 +1,8 @@
1
- import { v as VERSION } from "./environment-eV7LEnSN.js";
1
+ import { v as VERSION } from "./environment-CQn323uB.js";
2
2
  import { n as ui } from "./ui-D_qf3Gvw.js";
3
- import { C as pushedProducts, E as versionProducts, S as pushPaywallVersion, b as promotePaywallVersion, h as livePaywall, v as platformLabel, y as platformStore } from "./resources-B1qKDVXd.js";
4
- import { A as writeSnapshot, F as requireAssets, I as syncAssets, M as frameworkVersion, N as resolveFramework, O as writeBindings, P as assetBaseUrl, T as removeBinding, _ as weight, a as resolveProjectDir, b as describeBindings, c as storesDiffer, d as kb, f as pendingPromoteWarning, g as transition, h as took, i as requireProject, l as BIND_VERB, m as resolveNote, p as pushedLine, r as requireClean, s as selectSurfaces, t as needsWork, v as collectProjectDeclarations, w as readLock, y as writeProjectTypes } from "./selection-BbNk9r1q.js";
5
- import { _ as targetLabel, d as listProjectCatalogue, g as planTargets, h as parsePlatformFlags, i as pushSource, l as writeProjectScaffold, m as requireProducts, n as requireApi, o as collectSourceFiles, p as projectForApplication, r as assertGit, s as warnNotPortable, v as wantedPlatforms, x as resolveApps, y as resolveBinding } from "./session-Crg9X-FI.js";
3
+ import { C as pushedProducts, E as versionProducts, S as pushPaywallVersion, b as promotePaywallVersion, h as livePaywall, v as platformLabel, y as platformStore } from "./resources-FIrK7pE9.js";
4
+ import { A as writeSnapshot, F as requireAssets, I as syncAssets, M as frameworkVersion, N as resolveFramework, O as writeBindings, P as assetBaseUrl, T as removeBinding, _ as weight, a as resolveProjectDir, b as describeBindings, c as storesDiffer, d as kb, f as pendingPromoteWarning, g as transition, h as took, i as requireProject, l as BIND_VERB, m as resolveNote, p as pushedLine, r as requireClean, s as selectSurfaces, t as needsWork, v as collectProjectDeclarations, w as readLock, y as writeProjectTypes } from "./selection-CHnVk8uw.js";
5
+ import { _ as targetLabel, d as listProjectCatalogue, g as planTargets, h as parsePlatformFlags, i as pushSource, l as writeProjectScaffold, m as requireProducts, n as requireApi, o as collectSourceFiles, p as projectForApplication, r as assertGit, s as warnNotPortable, v as wantedPlatforms, x as resolveApps, y as resolveBinding } from "./session-BFwasPVq.js";
6
6
  import pc from "picocolors";
7
7
  import { cpus } from "node:os";
8
8