@superwall/cli 2.3.1 → 2.5.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 (117) hide show
  1. package/README.md +10 -0
  2. package/dist/{apple-z2qjOzIZ.js → apple-Dyr7OFBx.js} +17 -16
  3. package/dist/approve-Czs1-JO9.js +186 -0
  4. package/dist/{assets-DXXegdDt.js → assets-BrB9jQPQ.js} +3 -3
  5. package/dist/auth.d.ts +1 -1
  6. package/dist/auth.js +3 -3
  7. package/dist/{billing-B8tOjsnY.js → billing-D5qqIlVb.js} +3 -3
  8. package/dist/{bind-Bx9K6LwP.js → bind-B3eEcRyp.js} +4 -4
  9. package/dist/browser-Bp3yRKlU.js +36 -0
  10. package/dist/{build-Bu2kkzRe.js → build-DD9pSwHX.js} +10 -8
  11. package/dist/{client-DOgk9gAS.js → client-AI9H4GGB.js} +3 -3
  12. package/dist/{config-BO1Y87kV.js → config-CGcG7GOt.js} +9 -1
  13. package/dist/{create-B03MAuPe.js → create-B4m-IKlr.js} +8 -8
  14. package/dist/create-CJljlkJK.js +20 -0
  15. package/dist/{create-DzC_89gq.js → create-ChfgWpiM.js} +41 -69
  16. package/dist/{doctor-BGZSKY_B.js → doctor-XtXW6tKE.js} +6 -6
  17. package/dist/download-2Zu2I_Og.js +58 -0
  18. package/dist/{drivers-DqLgQxkC.js → drivers-CMEL13gp.js} +4 -4
  19. package/dist/entry.js +69 -33
  20. package/dist/{environment-i8BhiBDB.js → environment-BWT2S4qC.js} +9 -2
  21. package/dist/{existing-BPOG5zLO.js → existing-b0GxFcnc.js} +2 -2
  22. package/dist/{session-BDLQUJyV.js → git-D7AVdugb.js} +97 -335
  23. package/dist/held-CX7Zf8u-.js +17 -0
  24. package/dist/{held-C56PYMRH.js → held-D3PUNky2.js} +7 -7
  25. package/dist/install-CVUXsx8c.js +103 -0
  26. package/dist/{integrate-DZ4Qvoch.js → integrate-qvKd9pVW.js} +29 -27
  27. package/dist/{log-NVhVe_oe.js → log-C0MDCfA2.js} +1 -1
  28. package/dist/{login-p9GVEKzD.js → login-COmGHrU5.js} +2 -1
  29. package/dist/login-ClnJi1Ea.js +17 -0
  30. package/dist/{login-ONZdK8vN.js → login-PMoXUGqq.js} +9 -42
  31. package/dist/{lookup-flTi0at0.js → lookup-gjcKIZvh.js} +4 -3
  32. package/dist/{migrate-DnXpbhL1.js → migrate-SkkLLdmr.js} +33 -28
  33. package/dist/{migration-DJ1uNKhk.js → migration-DS44-3Zr.js} +10 -10
  34. package/dist/{notification-url-CCDeS5S-.js → notification-url-BjQPLf4-.js} +4 -4
  35. package/dist/{open-QdsZ_N47.js → open-DQpm2yVs.js} +2 -2
  36. package/dist/{org-BiFPjoHD.js → org-C04eAO-j.js} +3 -2
  37. package/dist/organization-BOECL3vZ.js +39 -0
  38. package/dist/orgs-D6Kk96mG.js +81 -0
  39. package/dist/{paths-yRgm5Jpa.js → paths-REb-GrbX.js} +2 -2
  40. package/dist/{playbook-B-pRKNa4.js → playbook-Du4Oydbf.js} +11 -11
  41. package/dist/{products-DH_fK9tY.js → products-Cqq59DBQ.js} +1 -1
  42. package/dist/project-CP6hiHra.js +47 -0
  43. package/dist/{promote-Djzk4C81.js → promote-Dm2_b1WK.js} +24 -19
  44. package/dist/pull-DsdOoG-D.js +36 -0
  45. package/dist/{pull-BLA9XwHj.js → pull-F6pvO4To.js} +9 -28
  46. package/dist/pull-zYAbqo9n.js +106 -0
  47. package/dist/{push-gSBxGDik.js → push-BIFLhAiO.js} +9 -7
  48. package/dist/push-CJVfvFZq.js +29 -0
  49. package/dist/push-D_l9KJZN.js +290 -0
  50. package/dist/push-SVzv7fzE.js +22 -0
  51. package/dist/{registry-D3xmWk9p.js → registry-DIJB0mJa.js} +890 -158
  52. package/dist/resolve--GsHj0Q1.js +171 -0
  53. package/dist/{resources-BTnczJCA.js → resources-BaP3p_LY.js} +3 -80
  54. package/dist/{run-C1SoizcJ.js → run-C5OPwhvS.js} +2 -2
  55. package/dist/run-CgLmD2vR.js +1345 -0
  56. package/dist/{scan-Dwk_lT5q.js → scan-Bj5y0zTZ.js} +1 -1
  57. package/dist/scan-v_WTE722.js +4 -0
  58. package/dist/{scope-Db7blD-l.js → scope-Bp_zwJOo.js} +6 -5
  59. package/dist/scope-CCb_7UvN.js +89 -0
  60. package/dist/sdk-TvT0p_nO.js +71 -0
  61. package/dist/selection-BltBpyp5.js +179 -0
  62. package/dist/series-TAixFBWW.js +685 -0
  63. package/dist/{server-Cb2N75JL.js → server-CdVIboQn.js} +10 -8
  64. package/dist/server-CvJVusw3.js +29 -0
  65. package/dist/session-B8JNXkwN.js +6 -0
  66. package/dist/session-D3fgXQBt.js +219 -0
  67. package/dist/{session-CnDJp_HO.js → session-Ywim-P8M.js} +1 -1
  68. package/dist/{setup-BLahHpgy.js → setup-zzjtTy8k.js} +9 -8
  69. package/dist/skills/index.json +5 -0
  70. package/dist/skills/superwall/SKILL.md +48 -30
  71. package/dist/skills/superwall/references/api.md +3 -2
  72. package/dist/skills/superwall-editor/SKILL.md +7 -5
  73. package/dist/skills/superwall-framework/SKILL.md +11 -8
  74. package/dist/skills/superwall-framework/references/onboarding-state.md +21 -14
  75. package/dist/skills/superwall-workspaces/SKILL.md +313 -0
  76. package/dist/skills/superwall-workspaces/references/cli.md +174 -0
  77. package/dist/skills/superwall-workspaces/references/slots.md +103 -0
  78. package/dist/{skills-zebMTZyr.js → skills-2qYaUXGE.js} +15 -9
  79. package/dist/skills-8um2fBPS.js +14 -0
  80. package/dist/{source-push-DxuJuwEf.js → source-push-kAep4gPe.js} +6 -5
  81. package/dist/{spinner-BN3U1CVB.js → spinner-BANVLncC.js} +17 -5
  82. package/dist/starter-CiLrp1cN.js +190 -0
  83. package/dist/status-CoYMK7QL.js +139 -0
  84. package/dist/{storage-VagEaaJC.js → storage-DzP22xKn.js} +1 -1
  85. package/dist/storekit-D5eopLM0.js +17 -0
  86. package/dist/{storekit-CoOf4Rvh.js → storekit-n1x0bWkQ.js} +4 -4
  87. package/dist/{telemetry-CM0BDwCK.js → telemetry-CXN6f-ZX.js} +2 -2
  88. package/dist/{token-lUUOkTJA.js → token-FmeHywYt.js} +1 -1
  89. package/dist/tools-skills/superwall/SKILL.md +49 -31
  90. package/dist/tools-skills/superwall/references/api.md +3 -2
  91. package/dist/tools-skills/superwall-editor/SKILL.md +7 -5
  92. package/dist/tools.d.ts +1 -1
  93. package/dist/tools.js +575 -75
  94. package/dist/try-BWbzgelb.js +120 -0
  95. package/dist/{selection-u2KiKu_d.js → types-JdxmnCko.js} +1 -178
  96. package/dist/upgrade-Bk5boOgW.js +206 -0
  97. package/dist/upgrade-CoWCEnoi.js +7 -0
  98. package/package.json +5 -3
  99. package/prompts/commandments.xml +2 -0
  100. package/dist/create-BdZS_T68.js +0 -19
  101. package/dist/held-DSNUY-NZ.js +0 -16
  102. package/dist/login-Blrkm6oi.js +0 -16
  103. package/dist/push-BkMgOT6X.js +0 -24
  104. package/dist/scan-Kp-MAutK.js +0 -4
  105. package/dist/server-psYghr9K.js +0 -24
  106. package/dist/session-CehHJWZk.js +0 -6
  107. package/dist/skills-DDV4zcLR.js +0 -14
  108. package/dist/storekit-BcBb2jXB.js +0 -16
  109. package/dist/upgrade-CpTJv_M7.js +0 -7
  110. package/dist/upgrade-DZbKb67W.js +0 -117
  111. /package/dist/{client-BZ1UbpXz.js → client-BJQXl62Q.js} +0 -0
  112. /package/dist/{devtools-pBl_vt03.js → devtools-ByZ6XYnn.js} +0 -0
  113. /package/dist/{input-vi0bou04.js → input-MDd67UIp.js} +0 -0
  114. /package/dist/{reports-CwwKLUh0.js → reports-CuhB1_ub.js} +0 -0
  115. /package/dist/{screenshot-file-tVBfUEIi.js → screenshot-file-XAS0Xy0e.js} +0 -0
  116. /package/dist/{storage-gRyQetN9.d.ts → storage-BjQCiTuz.d.ts} +0 -0
  117. /package/dist/{timing-BVxPrYq3.js → timing-Ca0TXY-A.js} +0 -0
package/README.md CHANGED
@@ -609,6 +609,16 @@ asking. The framework itself is built to be written by agents: a plain npm
609
609
  project, file-based routes, ordinary React state — conventions an agent
610
610
  already knows, so it gets a paywall right on the first try.
611
611
 
612
+ When an agent confirms a Superwall bug, a wrong doc or a capability you needed
613
+ that Superwall lacks, it reports it with `superwall feedback` on its own and
614
+ tells you in one line. Reports reach the Superwall team with your account, and
615
+ the same request from many teams is merged into one:
616
+
617
+ ```bash
618
+ superwall feedback "no way to end a campaign on a schedule" --kind idea \
619
+ --use-case "runs a Black Friday offer that must stop at midnight" --app <app> --json
620
+ ```
621
+
612
622
  ## Upgrading to 2.0
613
623
 
614
624
  2.0 renamed several commands; the old names are unknown commands now.
@@ -1,21 +1,22 @@
1
- import "./token-lUUOkTJA.js";
1
+ import "./token-FmeHywYt.js";
2
2
  import { t as blocks } from "./output-Ggzq5_-t.js";
3
- import "./environment-i8BhiBDB.js";
4
- import "./storage-VagEaaJC.js";
5
- import { t as ApiError } from "./client-DOgk9gAS.js";
6
- import { E as updateBundleId, a as chooseAppIntent, g as RefusedByApi, i as savedKey, m as KEY_LABEL, n as testModeWarning, p as KEY_KINDS, s as resolveApp, y as findIntegrations } from "./held-C56PYMRH.js";
7
- import "./config-BO1Y87kV.js";
8
- import { t as apiCall } from "./spinner-BN3U1CVB.js";
3
+ import "./environment-BWT2S4qC.js";
4
+ import "./storage-DzP22xKn.js";
5
+ import { t as ApiError } from "./client-AI9H4GGB.js";
6
+ import { E as updateBundleId, a as chooseAppIntent, g as RefusedByApi, i as savedKey, m as KEY_LABEL, n as testModeWarning, p as KEY_KINDS, s as resolveApp, y as findIntegrations } from "./held-D3PUNky2.js";
7
+ import "./config-CGcG7GOt.js";
8
+ import { t as apiCall } from "./spinner-BANVLncC.js";
9
9
  import "./ui-D_qf3Gvw.js";
10
- import "./paths-yRgm5Jpa.js";
11
- import "./resources-BTnczJCA.js";
12
- import "./org-BiFPjoHD.js";
13
- import "./lookup-flTi0at0.js";
14
- import "./scope-Db7blD-l.js";
15
- import "./client-BZ1UbpXz.js";
16
- import "./timing-BVxPrYq3.js";
17
- import { n as ensureNotificationUrl, r as environmentLines, t as describeNotificationUrl } from "./notification-url-CCDeS5S-.js";
18
- import { a as chooseTeam, n as keyAccess, o as signIn, r as keyRole, s as appleDeps, t as createAndSaveKey } from "./create-B03MAuPe.js";
10
+ import "./paths-REb-GrbX.js";
11
+ import "./orgs-D6Kk96mG.js";
12
+ import "./resources-BaP3p_LY.js";
13
+ import "./org-C04eAO-j.js";
14
+ import "./lookup-gjcKIZvh.js";
15
+ import "./scope-Bp_zwJOo.js";
16
+ import "./client-BJQXl62Q.js";
17
+ import "./timing-Ca0TXY-A.js";
18
+ import { n as ensureNotificationUrl, r as environmentLines, t as describeNotificationUrl } from "./notification-url-BjQPLf4-.js";
19
+ import { a as chooseTeam, n as keyAccess, o as signIn, r as keyRole, s as appleDeps, t as createAndSaveKey } from "./create-B4m-IKlr.js";
19
20
 
20
21
  //#region src/core/app-store-connect/setup/apple.ts
21
22
  const STEPS = [
@@ -0,0 +1,186 @@
1
+ import "./token-FmeHywYt.js";
2
+ import "./output-Ggzq5_-t.js";
3
+ import "./environment-BWT2S4qC.js";
4
+ import "./storage-DzP22xKn.js";
5
+ import { t as ApiError } from "./client-AI9H4GGB.js";
6
+ import "./config-CGcG7GOt.js";
7
+ import "./orgs-D6Kk96mG.js";
8
+ import "./types-JdxmnCko.js";
9
+ import "./scope-CCb_7UvN.js";
10
+ import { c as resolveWorkspace, l as roleCanApprove, m as approveVersion, o as pickVersion } from "./resolve--GsHj0Q1.js";
11
+ import { r as WorkspaceError } from "./project-CP6hiHra.js";
12
+
13
+ //#region src/core/workspaces/approve.ts
14
+ const SECTIONS = [
15
+ ["scopes", "Scopes"],
16
+ ["backgroundScopes", "Background scopes"],
17
+ ["egress", "Outside hosts"],
18
+ ["secrets", "Secrets"],
19
+ ["entrypoints", "Entrypoints"],
20
+ ["crons", "Crons"],
21
+ ["events", "Events"],
22
+ ["storage", "Storage"],
23
+ ["compatibility", "Compatibility"]
24
+ ];
25
+ const quoted = (text) => JSON.stringify(text);
26
+ const secretLabel = (secret) => `${secret.name} to ${secret.host} (${quoted(secret.inject)})`;
27
+ const metricLabel = (metric) => {
28
+ const breakdowns = (metric.breakdowns ?? []).map((breakdown) => breakdown.key);
29
+ const filters = (metric.filters ?? []).map((filter) => `${filter.key} (${filter.values.map((option) => quoted(option.value)).join(", ")})`);
30
+ return [
31
+ metric.value_type ?? "number",
32
+ breakdowns.length > 0 ? `split by ${breakdowns.join(", ")}` : void 0,
33
+ filters.length > 0 ? `filtered by ${filters.join(", ")}` : void 0
34
+ ].filter(Boolean).join(", ");
35
+ };
36
+ const entrypointLabel = (entrypoint) => [
37
+ `${entrypoint.id}: ${entrypoint.slot}`,
38
+ entrypoint.path ? `at ${entrypoint.path}` : void 0,
39
+ quoted(entrypoint.title),
40
+ entrypoint.metric ? `metric: ${metricLabel(entrypoint.metric)}` : void 0
41
+ ].filter(Boolean).join(" ");
42
+ const emptySide = {
43
+ scopes: [],
44
+ backgroundScopes: [],
45
+ egress: [],
46
+ secrets: [],
47
+ entrypoints: [],
48
+ crons: [],
49
+ events: [],
50
+ storage: [],
51
+ compatibility: []
52
+ };
53
+ function sideOf(version, enforced) {
54
+ const manifest = version?.manifest;
55
+ if (!version || !manifest) return emptySide;
56
+ if (enforced && version.grant === null) return emptySide;
57
+ const grant = enforced ? version.grant : null;
58
+ const storage = manifest.storage ?? {};
59
+ return {
60
+ scopes: grant?.scopes ?? manifest.scopes,
61
+ backgroundScopes: grant?.background_scopes ?? manifest.background?.scopes ?? [],
62
+ egress: grant?.egress ?? manifest.egress ?? [],
63
+ secrets: (grant?.secret_bindings ?? manifest.secrets ?? []).map(secretLabel),
64
+ entrypoints: manifest.entrypoints.map(entrypointLabel),
65
+ crons: (manifest.crons ?? []).map((cron) => `${cron.name}: ${cron.schedule}`),
66
+ events: manifest.events ?? [],
67
+ storage: [storage.sql ? "sql" : void 0, storage.kv ? "kv" : void 0].filter((kind) => kind !== void 0),
68
+ compatibility: [...version.compatibility_date ? [`date ${version.compatibility_date}`] : [], ...(version.compatibility_flags ?? []).map((flag) => `flag ${flag}`)]
69
+ };
70
+ }
71
+ function diffSides(before, after) {
72
+ return SECTIONS.flatMap(([section, title]) => {
73
+ const [old, next] = [new Set(before[section]), new Set(after[section])];
74
+ const added = [...next].filter((item) => !old.has(item)).sort();
75
+ const removed = [...old].filter((item) => !next.has(item)).sort();
76
+ return added.length + removed.length > 0 ? [{
77
+ section,
78
+ title,
79
+ added,
80
+ removed
81
+ }] : [];
82
+ });
83
+ }
84
+ const manifestLines = (side) => SECTIONS.flatMap(([section, title]) => {
85
+ const items = side[section];
86
+ if (items.length === 0) return section === "scopes" || section === "egress" ? [`${title}: none`] : [];
87
+ return [`${title}:`, ...[...items].sort().map((item) => ` ${item}`)];
88
+ });
89
+ const diffLines = (diff) => diff.flatMap(({ title, added, removed }) => [
90
+ `${title}:`,
91
+ ...added.map((item) => ` + ${item}`),
92
+ ...removed.map((item) => ` - ${item}`)
93
+ ]);
94
+ const ONLY_ADMINS = "Only organization owners and admins can approve workspace versions. Ask one of them to review this version.";
95
+ async function runWorkspaceApprove(ctx, input) {
96
+ const workspace = await resolveWorkspace(ctx, input);
97
+ const { version, versions } = await pickVersion(ctx, workspace, input.version, (candidate) => candidate.build_status === "SUCCEEDED" && candidate.id !== workspace.active_version_id);
98
+ if (version.build_status !== "SUCCEEDED" || version.manifest === null) throw new WorkspaceError(`Version ${version.id} is ${version.build_status.toLowerCase()}. Only a built version can be approved.`);
99
+ if (version.id === workspace.active_version_id && version.grant !== null) {
100
+ if (ctx.json) ctx.output.data({
101
+ approved: false,
102
+ reason: "already_active",
103
+ version_id: version.id
104
+ });
105
+ else ctx.ui.info(`Version ${version.id} is already live.`);
106
+ return;
107
+ }
108
+ const active = versions.find((candidate) => candidate.id === workspace.active_version_id);
109
+ const proposed = sideOf(version, false);
110
+ const diff = diffSides(sideOf(active, true), proposed);
111
+ const details = {
112
+ workspace_id: workspace.id,
113
+ version_id: version.id,
114
+ commit_sha: version.commit_sha,
115
+ active_version_id: active?.id ?? null,
116
+ manifest: version.manifest,
117
+ compatibility_date: version.compatibility_date ?? null,
118
+ compatibility_flags: version.compatibility_flags ?? [],
119
+ diff
120
+ };
121
+ if (!ctx.json) ctx.ui.report([
122
+ `${workspace.name}, version ${version.id} (${version.commit_sha.slice(0, 12)})`,
123
+ ...version.commit_message ? [version.commit_message.split("\n")[0] ?? ""] : [],
124
+ "",
125
+ "What it can do:",
126
+ ...manifestLines(proposed),
127
+ "",
128
+ active ? `Changes from the live version, ${active.id}:` : "Nothing is live yet, so all of this is new:",
129
+ ...diff.length === 0 ? [" Nothing it can do changes."] : diffLines(diff)
130
+ ].join("\n"));
131
+ const refuse = (reason, message) => {
132
+ if (ctx.json) ctx.output.data({
133
+ approved: false,
134
+ reason,
135
+ ...details
136
+ });
137
+ else ctx.ui.error(message);
138
+ ctx.fail();
139
+ };
140
+ if (!await roleCanApprove(ctx, workspace)) {
141
+ refuse("needs_admin", ONLY_ADMINS);
142
+ if (!ctx.json) ctx.ui.info("To ask for review, run `superwall workspaces share`.");
143
+ return;
144
+ }
145
+ const changes = diff.length > 0;
146
+ const accepted = !changes || input.acceptChanges;
147
+ if (ctx.interactive && !(input.yes && accepted)) {
148
+ if (!await ctx.ui.confirm({
149
+ message: changes ? `Approve version ${version.id}, with the changes above to what it can do?` : `Approve version ${version.id}?`,
150
+ initial: false
151
+ })) {
152
+ ctx.ui.outro("Nothing was approved.");
153
+ return;
154
+ }
155
+ } else if (!ctx.interactive) {
156
+ if (!input.yes) {
157
+ refuse("needs_yes", "Nothing was approved. Read the above, then pass --yes to approve it.");
158
+ return;
159
+ }
160
+ if (!accepted) {
161
+ refuse("needs_accept_changes", "Nothing was approved, because this changes what the workspace can do. Read the changes above, then pass --accept-changes too.");
162
+ return;
163
+ }
164
+ }
165
+ let approved;
166
+ try {
167
+ approved = await approveVersion(ctx.api, workspace.id, version.id);
168
+ } catch (error) {
169
+ if (!(error instanceof ApiError) || error.status !== 403) throw error;
170
+ refuse("forbidden", error.message);
171
+ return;
172
+ }
173
+ if (ctx.json) {
174
+ ctx.output.data({
175
+ approved: true,
176
+ ...details,
177
+ version: approved
178
+ });
179
+ return;
180
+ }
181
+ ctx.ui.success(`Approved version ${version.id}. It's live for everyone it's installed for.`);
182
+ ctx.ui.info(`Choose where it shows with \`superwall workspaces install <entrypoint> --workspace ${workspace.id}\`.`);
183
+ }
184
+
185
+ //#endregion
186
+ export { diffSides, runWorkspaceApprove, sideOf };
@@ -1,6 +1,6 @@
1
- import { r as ASSET_HOST } from "./environment-i8BhiBDB.js";
2
- import { t as ApiError } from "./client-DOgk9gAS.js";
3
- import { S as pushPaywallAssets } from "./resources-BTnczJCA.js";
1
+ import { r as ASSET_HOST } from "./environment-BWT2S4qC.js";
2
+ import { t as ApiError } from "./client-AI9H4GGB.js";
3
+ import { S as pushPaywallAssets } from "./resources-BaP3p_LY.js";
4
4
  import * as fs from "node:fs";
5
5
 
6
6
  //#region src/core/paywalls/assets.ts
package/dist/auth.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Session } from "./storage-gRyQetN9.js";
1
+ import { t as Session } from "./storage-BjQCiTuz.js";
2
2
 
3
3
  //#region src/core/account/errors.d.ts
4
4
  declare class NotLoggedInError extends Error {
package/dist/auth.js CHANGED
@@ -1,6 +1,6 @@
1
- import { n as resolveAuthToken, r as NotLoggedInError, t as getOAuthAccessToken } from "./token-lUUOkTJA.js";
1
+ import { n as resolveAuthToken, r as NotLoggedInError, t as getOAuthAccessToken } from "./token-FmeHywYt.js";
2
2
  import "./output-Ggzq5_-t.js";
3
- import "./environment-i8BhiBDB.js";
4
- import "./storage-VagEaaJC.js";
3
+ import "./environment-BWT2S4qC.js";
4
+ import "./storage-DzP22xKn.js";
5
5
 
6
6
  export { NotLoggedInError, getOAuthAccessToken, resolveAuthToken };
@@ -1,6 +1,6 @@
1
- import { f as Integration } from "./environment-i8BhiBDB.js";
2
- import { i as readPackageJson, r as allDeps } from "./scan-Dwk_lT5q.js";
3
- import { d as readBundledSkill } from "./skills-zebMTZyr.js";
1
+ import { h as Integration } from "./environment-BWT2S4qC.js";
2
+ import { i as readPackageJson, r as allDeps } from "./scan-Bj5y0zTZ.js";
3
+ import { d as readBundledSkill } from "./skills-2qYaUXGE.js";
4
4
  import { readFileSync } from "node:fs";
5
5
  import fg from "fast-glob";
6
6
 
@@ -1,8 +1,8 @@
1
- import { f as Integration } from "./environment-i8BhiBDB.js";
2
- import { n as withSpinner } from "./spinner-BN3U1CVB.js";
1
+ import { h as Integration } from "./environment-BWT2S4qC.js";
2
+ import { n as withSpinner } from "./spinner-BANVLncC.js";
3
3
  import { n as ui } from "./ui-D_qf3Gvw.js";
4
- import { c as createProject, m as listProjects, r as createApplication, y as platformLabel } from "./resources-BTnczJCA.js";
5
- import { n as orgForNewProject } from "./org-BiFPjoHD.js";
4
+ import { c as createProject, m as listProjects, r as createApplication, y as platformLabel } from "./resources-BaP3p_LY.js";
5
+ import { n as orgForNewProject } from "./org-C04eAO-j.js";
6
6
 
7
7
  //#region src/core/account/bind.ts
8
8
  const NEW = "__new__";
@@ -0,0 +1,36 @@
1
+ import { spawn } from "node:child_process";
2
+
3
+ //#region src/core/account/browser.ts
4
+ const BROWSER_UNAVAILABLE = "Couldn't open a browser here. Open the URL above to approve the login.";
5
+ function hasDisplay(env, platform) {
6
+ if (platform !== "linux") return true;
7
+ return Boolean(env.DISPLAY || env.WAYLAND_DISPLAY || env.WSL_DISTRO_NAME);
8
+ }
9
+ function openBrowser(url, deps = {}) {
10
+ const platform = deps.platform ?? process.platform;
11
+ const env = deps.env ?? process.env;
12
+ if (env.BROWSER === "none" || !hasDisplay(env, platform)) return Promise.resolve(false);
13
+ const cmd = platform === "darwin" ? "open" : platform === "win32" ? "cmd" : "xdg-open";
14
+ const args = platform === "win32" ? [
15
+ "/c",
16
+ "start",
17
+ "",
18
+ url.replaceAll("&", "^&")
19
+ ] : [url];
20
+ return new Promise((resolve) => {
21
+ try {
22
+ const child = (deps.spawn ?? spawn)(cmd, args, {
23
+ stdio: "ignore",
24
+ detached: true
25
+ });
26
+ child.once("error", () => resolve(false));
27
+ child.once("spawn", () => resolve(true));
28
+ child.unref();
29
+ } catch {
30
+ resolve(false);
31
+ }
32
+ });
33
+ }
34
+
35
+ //#endregion
36
+ export { openBrowser as n, BROWSER_UNAVAILABLE as t };
@@ -1,13 +1,15 @@
1
- import "./token-lUUOkTJA.js";
1
+ import "./token-FmeHywYt.js";
2
2
  import "./output-Ggzq5_-t.js";
3
- import { v as VERSION } from "./environment-i8BhiBDB.js";
4
- import "./storage-VagEaaJC.js";
5
- import "./client-DOgk9gAS.js";
6
- import "./config-BO1Y87kV.js";
3
+ import { x as VERSION } from "./environment-BWT2S4qC.js";
4
+ import "./storage-DzP22xKn.js";
5
+ import "./client-AI9H4GGB.js";
6
+ import "./config-CGcG7GOt.js";
7
7
  import { n as ui } from "./ui-D_qf3Gvw.js";
8
- import "./resources-BTnczJCA.js";
9
- import { t as assetBaseUrl } from "./assets-DXXegdDt.js";
10
- import { a as resolveProjectDir, b as writeProjectTypes, d as kb, h as took, i as requireProject, k as readLock, n as parseIds, s as selectSurfaces, y as collectProjectDeclarations, z as resolveFramework } from "./selection-u2KiKu_d.js";
8
+ import "./orgs-D6Kk96mG.js";
9
+ import "./resources-BaP3p_LY.js";
10
+ import { t as assetBaseUrl } from "./assets-BrB9jQPQ.js";
11
+ import { a as resolveProjectDir, d as kb, h as took, i as requireProject, n as parseIds, s as selectSurfaces, y as resolveFramework } from "./selection-BltBpyp5.js";
12
+ import { f as readLock, n as collectProjectDeclarations, r as writeProjectTypes } from "./types-JdxmnCko.js";
11
13
  import * as fs from "node:fs";
12
14
  import * as path from "node:path";
13
15
  import pc from "picocolors";
@@ -1,6 +1,6 @@
1
- import { n as resolveAuthToken, r as NotLoggedInError } from "./token-lUUOkTJA.js";
2
- import { _ as USER_AGENT } from "./environment-i8BhiBDB.js";
3
- import { a as resolveApiHost, n as readSession } from "./storage-VagEaaJC.js";
1
+ import { n as resolveAuthToken, r as NotLoggedInError } from "./token-FmeHywYt.js";
2
+ import { b as USER_AGENT } from "./environment-BWT2S4qC.js";
3
+ import { a as resolveApiHost, n as readSession } from "./storage-DzP22xKn.js";
4
4
 
5
5
  //#region src/core/api/client.ts
6
6
  const BODY_SNIPPET = 200;
@@ -81,6 +81,14 @@ function writeUpdateCheck(check) {
81
81
  config.updateCheck = check;
82
82
  write(config);
83
83
  }
84
+ function readAutoUpdate() {
85
+ return read().autoUpdate;
86
+ }
87
+ function writeAutoUpdate(update) {
88
+ const config = read();
89
+ config.autoUpdate = update;
90
+ write(config);
91
+ }
84
92
  function readOnboardingIdempotencyKey() {
85
93
  const config = read();
86
94
  if (config.onboardingIdempotencyKey) return config.onboardingIdempotencyKey;
@@ -102,4 +110,4 @@ function writeTelemetryNoticeShown() {
102
110
  }
103
111
 
104
112
  //#endregion
105
- export { readOnboardingIdempotencyKey as a, readUpdateCheck as c, writeOnboardedApp as d, writeOnboardedOrg as f, writeUpdateCheck as g, writeTelemetryNoticeShown as h, readOnboardedOrg as i, telemetryNoticeShown as l, writeSkillsSync as m, readDefaultApp as n, readOpenedOrgs as o, writeOpenedOrgs as p, readOnboardedApp as r, readSkillsSync as s, readAnonymousId as t, writeDefaultApp as u };
113
+ export { writeTelemetryNoticeShown as _, readOnboardedOrg as a, readSkillsSync as c, writeAutoUpdate as d, writeDefaultApp as f, writeSkillsSync as g, writeOpenedOrgs as h, readOnboardedApp as i, readUpdateCheck as l, writeOnboardedOrg as m, readAutoUpdate as n, readOnboardingIdempotencyKey as o, writeOnboardedApp as p, readDefaultApp as r, readOpenedOrgs as s, readAnonymousId as t, telemetryNoticeShown as u, writeUpdateCheck as v };
@@ -1,12 +1,12 @@
1
1
  import { r as formatJson, t as blocks } from "./output-Ggzq5_-t.js";
2
- import { b as appleCredentialsFromEnv, d as ENV_APPLE_PASSWORD, u as ENV_APPLE_ID, v as VERSION } from "./environment-i8BhiBDB.js";
3
- import { t as ApiError } from "./client-DOgk9gAS.js";
4
- import { i as savedKey, m as KEY_LABEL, n as testModeWarning, o as chooseIosApp, s as resolveApp, t as upsertHeldKey, x as keyKind, y as findIntegrations } from "./held-C56PYMRH.js";
5
- import { t as apiCall } from "./spinner-BN3U1CVB.js";
6
- import { n as SUPERWALL_HOME } from "./paths-yRgm5Jpa.js";
7
- import { A as listField, M as textField, O as field, j as parseJson } from "./resources-BTnczJCA.js";
8
- import { c as replaceAppPurchaseKey, s as replaceAppAscKey } from "./client-BZ1UbpXz.js";
9
- import { t as timing } from "./timing-BVxPrYq3.js";
2
+ import { C as appleCredentialsFromEnv, m as ENV_APPLE_PASSWORD, p as ENV_APPLE_ID, x as VERSION } from "./environment-BWT2S4qC.js";
3
+ import { t as ApiError } from "./client-AI9H4GGB.js";
4
+ import { i as savedKey, m as KEY_LABEL, n as testModeWarning, o as chooseIosApp, s as resolveApp, t as upsertHeldKey, x as keyKind, y as findIntegrations } from "./held-D3PUNky2.js";
5
+ import { t as apiCall } from "./spinner-BANVLncC.js";
6
+ import { n as SUPERWALL_HOME } from "./paths-REb-GrbX.js";
7
+ import { A as listField, M as textField, O as field, j as parseJson } from "./resources-BaP3p_LY.js";
8
+ import { c as replaceAppPurchaseKey, s as replaceAppAscKey } from "./client-BJQXl62Q.js";
9
+ import { t as timing } from "./timing-Ca0TXY-A.js";
10
10
  import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
11
11
  import { join } from "node:path";
12
12
  import { createHash, pbkdf2Sync, randomBytes } from "node:crypto";
@@ -0,0 +1,20 @@
1
+ import "./token-FmeHywYt.js";
2
+ import "./output-Ggzq5_-t.js";
3
+ import "./environment-BWT2S4qC.js";
4
+ import "./storage-DzP22xKn.js";
5
+ import "./client-AI9H4GGB.js";
6
+ import "./held-D3PUNky2.js";
7
+ import "./config-CGcG7GOt.js";
8
+ import "./spinner-BANVLncC.js";
9
+ import "./ui-D_qf3Gvw.js";
10
+ import "./paths-REb-GrbX.js";
11
+ import "./orgs-D6Kk96mG.js";
12
+ import "./resources-BaP3p_LY.js";
13
+ import "./org-C04eAO-j.js";
14
+ import "./lookup-gjcKIZvh.js";
15
+ import "./scope-Bp_zwJOo.js";
16
+ import "./client-BJQXl62Q.js";
17
+ import "./timing-Ca0TXY-A.js";
18
+ import { i as runAscKeysCreate, n as keyAccess, r as keyRole, t as createAndSaveKey } from "./create-B4m-IKlr.js";
19
+
20
+ export { createAndSaveKey, keyAccess, keyRole, runAscKeysCreate };
@@ -1,84 +1,56 @@
1
- import "./token-lUUOkTJA.js";
1
+ import "./token-FmeHywYt.js";
2
2
  import "./output-Ggzq5_-t.js";
3
- import "./environment-i8BhiBDB.js";
4
- import "./storage-VagEaaJC.js";
5
- import "./client-DOgk9gAS.js";
6
- import "./config-BO1Y87kV.js";
7
- import "./telemetry-CM0BDwCK.js";
3
+ import "./environment-BWT2S4qC.js";
4
+ import "./storage-DzP22xKn.js";
5
+ import "./client-AI9H4GGB.js";
6
+ import "./config-CGcG7GOt.js";
7
+ import "./telemetry-CXN6f-ZX.js";
8
8
  import "./spawn-DmmmHIP-.js";
9
- import "./spinner-BN3U1CVB.js";
9
+ import "./spinner-BANVLncC.js";
10
10
  import "./ui-D_qf3Gvw.js";
11
11
  import "./theme-DUsCh-Vd.js";
12
- import "./log-NVhVe_oe.js";
13
- import "./scan-Dwk_lT5q.js";
14
- import "./existing-BPOG5zLO.js";
15
- import "./paths-yRgm5Jpa.js";
16
- import { O as field } from "./resources-BTnczJCA.js";
17
- import "./org-BiFPjoHD.js";
18
- import "./lookup-flTi0at0.js";
19
- import "./bind-Bx9K6LwP.js";
20
- import "./login-ONZdK8vN.js";
21
- import "./skills-zebMTZyr.js";
22
- import "./assets-DXXegdDt.js";
23
- import "./selection-u2KiKu_d.js";
24
- import { n as requireApi, t as LoginRequiredError, u as projectPackageName } from "./session-BDLQUJyV.js";
25
- import "./source-push-DxuJuwEf.js";
26
- import "./login-p9GVEKzD.js";
27
- import "./run-C1SoizcJ.js";
28
- import "./drivers-DqLgQxkC.js";
29
- import { _ as slugOf, c as scaffoldFromPaywall, g as writeTemplate, h as writeSurfaceFiles, i as migrationFor, m as starterConfig, o as offerMigration, s as projectDirOf } from "./migration-DJ1uNKhk.js";
30
- import "./server-Cb2N75JL.js";
31
- import { i as startStudio, n as migrationNextSteps, t as askStudio } from "./open-QdsZ_N47.js";
32
- import { a as devCommand, c as uniqueSurfaceId, i as detectPackageManager, n as connectApp, o as initGit, r as detectHostApp, s as installDependencies, t as alreadyAProject } from "./setup-BLahHpgy.js";
33
- import { execFile } from "node:child_process";
12
+ import "./log-C0MDCfA2.js";
13
+ import "./scan-Bj5y0zTZ.js";
14
+ import "./existing-b0GxFcnc.js";
15
+ import "./paths-REb-GrbX.js";
16
+ import "./orgs-D6Kk96mG.js";
17
+ import { O as field } from "./resources-BaP3p_LY.js";
18
+ import "./org-C04eAO-j.js";
19
+ import "./lookup-gjcKIZvh.js";
20
+ import "./bind-B3eEcRyp.js";
21
+ import "./login-PMoXUGqq.js";
22
+ import "./skills-2qYaUXGE.js";
23
+ import "./browser-Bp3yRKlU.js";
24
+ import "./assets-BrB9jQPQ.js";
25
+ import "./selection-BltBpyp5.js";
26
+ import "./types-JdxmnCko.js";
27
+ import { a as projectPackageName, n as requireApi, t as LoginRequiredError } from "./session-D3fgXQBt.js";
28
+ import "./source-push-kAep4gPe.js";
29
+ import "./git-D7AVdugb.js";
30
+ import "./scope-CCb_7UvN.js";
31
+ import "./login-COmGHrU5.js";
32
+ import "./run-C5OPwhvS.js";
33
+ import "./drivers-CMEL13gp.js";
34
+ import { _ as slugOf, c as scaffoldFromPaywall, g as writeTemplate, h as writeSurfaceFiles, i as migrationFor, m as starterConfig, o as offerMigration, s as projectDirOf } from "./migration-DS44-3Zr.js";
35
+ import "./server-CdVIboQn.js";
36
+ import { i as startStudio, n as migrationNextSteps, t as askStudio } from "./open-DQpm2yVs.js";
37
+ import { i as downloadRepoDir, n as PUBLIC_REPO, r as RepoDownloadError, t as PUBLIC_REF } from "./download-2Zu2I_Og.js";
38
+ import { a as devCommand, c as uniqueSurfaceId, i as detectPackageManager, n as connectApp, o as initGit, r as detectHostApp, s as installDependencies, t as alreadyAProject } from "./setup-zzjtTy8k.js";
34
39
  import * as fs from "node:fs";
35
40
  import * as path from "node:path";
36
41
  import pc from "picocolors";
37
- import { promisify } from "node:util";
38
- import * as os$1 from "node:os";
39
- import { gunzipSync } from "node:zlib";
40
42
 
41
43
  //#region src/core/paywalls/project/examples.ts
42
- const run = promisify(execFile);
43
- const EXAMPLES_REPO = process.env.SUPERWALL_EXAMPLES_REPO ?? "superwall/superwall";
44
- const EXAMPLES_REF = process.env.SUPERWALL_EXAMPLES_REF ?? "main";
45
- var ExampleError = class extends Error {};
46
44
  async function listExamples(fetchImpl = fetch) {
47
- const response = await fetchImpl(`https://api.github.com/repos/${EXAMPLES_REPO}/contents/examples?ref=${EXAMPLES_REF}`);
48
- if (!response.ok) throw new ExampleError(`Could not list examples from github.com/${EXAMPLES_REPO} (HTTP ${response.status}).`);
45
+ const response = await fetchImpl(`https://api.github.com/repos/${PUBLIC_REPO}/contents/examples?ref=${PUBLIC_REF}`);
46
+ if (!response.ok) throw new RepoDownloadError(`Could not list examples from github.com/${PUBLIC_REPO} (HTTP ${response.status}).`);
49
47
  const entries = await response.json();
50
48
  return (Array.isArray(entries) ? entries : []).filter((entry) => field(entry, "type") === "dir").map((entry) => field(entry, "name")).filter((name) => typeof name === "string").sort();
51
49
  }
52
50
  async function downloadExample(name, target, fetchImpl = fetch) {
53
- if (!/^[a-z0-9][a-z0-9-]*$/.test(name)) throw new ExampleError(`\`${name}\` is not an example name.`);
54
- const response = await fetchImpl(`https://codeload.github.com/${EXAMPLES_REPO}/tar.gz/refs/heads/${EXAMPLES_REF}`);
55
- if (!response.ok) throw new ExampleError(`Could not download github.com/${EXAMPLES_REPO} (HTTP ${response.status}). Check your network, then try again.`);
56
- let archive;
57
- try {
58
- archive = gunzipSync(Buffer.from(await response.arrayBuffer()));
59
- } catch {
60
- throw new ExampleError(`The download of github.com/${EXAMPLES_REPO} was damaged. Try again.`);
61
- }
62
- const tarball = path.join(os$1.tmpdir(), `superwall-example-${process.pid}.tar`);
63
- fs.writeFileSync(tarball, archive);
64
- const prefix = `${EXAMPLES_REPO.split("/")[1]}-${EXAMPLES_REF.replace(/\//g, "-")}`;
65
- fs.mkdirSync(target, { recursive: true });
66
- try {
67
- await run("tar", [
68
- "-xf",
69
- tarball,
70
- "-C",
71
- target,
72
- "--strip-components",
73
- "3",
74
- `${prefix}/examples/${name}`
75
- ]);
76
- } catch {
77
- throw new ExampleError(`No example named \`${name}\` in github.com/${EXAMPLES_REPO} — run \`superwall create\` without --example to pick from the list.`);
78
- } finally {
79
- fs.rmSync(tarball, { force: true });
80
- }
81
- if (!fs.existsSync(path.join(target, "package.json"))) throw new ExampleError(`Example \`${name}\` did not contain a project.`);
51
+ if (!/^[a-z0-9][a-z0-9-]*$/.test(name)) throw new RepoDownloadError(`\`${name}\` is not an example name.`);
52
+ await downloadRepoDir(`examples/${name}`, target, `No example named \`${name}\` in github.com/${PUBLIC_REPO} — run \`superwall create\` without --example to pick from the list.`, fetchImpl);
53
+ if (!fs.existsSync(path.join(target, "package.json"))) throw new RepoDownloadError(`Example \`${name}\` did not contain a project.`);
82
54
  }
83
55
  function adoptExamplePackage(target, name) {
84
56
  const file = path.join(target, "package.json");
@@ -186,7 +158,7 @@ async function runCreate(ctx, options, deps = runtime) {
186
158
  }, {
187
159
  value: "example",
188
160
  label: "An example",
189
- hint: `github.com/${EXAMPLES_REPO}`
161
+ hint: `github.com/${PUBLIC_REPO}`
190
162
  }],
191
163
  initialValue: "minimal"
192
164
  });
@@ -208,7 +180,7 @@ async function runCreate(ctx, options, deps = runtime) {
208
180
  example = picked;
209
181
  } catch (error) {
210
182
  spin.stop("Could not fetch the example list");
211
- ui.warn(`${error instanceof ExampleError ? error.message : String(error)}\nStarting from minimal instead.`);
183
+ ui.warn(`${error instanceof RepoDownloadError ? error.message : String(error)}\nStarting from minimal instead.`);
212
184
  }
213
185
  }
214
186
  }
@@ -1,13 +1,13 @@
1
- import "./token-lUUOkTJA.js";
1
+ import "./token-FmeHywYt.js";
2
2
  import "./output-Ggzq5_-t.js";
3
- import { y as apiKeyFromEnv } from "./environment-i8BhiBDB.js";
4
- import { n as readSession } from "./storage-VagEaaJC.js";
3
+ import { S as apiKeyFromEnv } from "./environment-BWT2S4qC.js";
4
+ import { n as readSession } from "./storage-DzP22xKn.js";
5
5
  import "./spawn-DmmmHIP-.js";
6
6
  import { n as ui } from "./ui-D_qf3Gvw.js";
7
7
  import { n as fg, t as THEME } from "./theme-DUsCh-Vd.js";
8
- import { t as scanProject } from "./scan-Dwk_lT5q.js";
9
- import { t as detectExisting } from "./existing-BPOG5zLO.js";
10
- import { t as detectDrivers } from "./drivers-DqLgQxkC.js";
8
+ import { t as scanProject } from "./scan-Bj5y0zTZ.js";
9
+ import { t as detectExisting } from "./existing-b0GxFcnc.js";
10
+ import { t as detectDrivers } from "./drivers-CMEL13gp.js";
11
11
 
12
12
  //#region src/core/support/doctor.ts
13
13
  async function runDoctor(ctx, deps = {}) {