@superwall/cli 1.4.0 → 1.6.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 (103) hide show
  1. package/README.md +21 -5
  2. package/dist/{actions-EfP8phmb.js → actions-Dt35nIi8.js} +3 -2
  3. package/dist/{api-CEwXCCoC.js → api-BOR-uXZe.js} +9 -9
  4. package/dist/{app-D8mEVlQo.js → app-BU27SLPX.js} +9 -9
  5. package/dist/{asa-BFWehnTA.js → asa-2ykGnjaV.js} +11 -11
  6. package/dist/{asc-DJqQmtmR.js → asc-r3xmFT0L.js} +14 -14
  7. package/dist/{auth-CT2DWX8r.js → auth-BWZfguI8.js} +9 -9
  8. package/dist/auth.js +2 -2
  9. package/dist/{billing-BzEnVPD2.js → billing-BsQgXXYh.js} +1 -1
  10. package/dist/{bind-BZxVyt9P.js → bind-BSTAinn6.js} +5 -4
  11. package/dist/{command-DP96_gmP.js → command-DMoMn7uc.js} +39 -16
  12. package/dist/{create-Q8TqqjZt.js → create-CSo6XjSm.js} +118 -91
  13. package/dist/dev-B0MF6z3L.js +21 -0
  14. package/dist/{dev-DlCcwFu5.js → dev-CuXa3J4Z.js} +29 -24
  15. package/dist/{doctor-CJsjHpCZ.js → doctor-DXJaDqsx.js} +10 -10
  16. package/dist/{drivers-UT36AnOw.js → drivers-Cr252DOJ.js} +3 -3
  17. package/dist/entry.js +84 -50
  18. package/dist/{existing-Cak1WxWB.js → existing-Ckx_g7Be.js} +6 -3
  19. package/dist/{feedback-DDRzoqPx.js → feedback-Dt5yebMS.js} +6 -6
  20. package/dist/{hosted-CEH78QVn.js → hosted-Cjekn8oJ.js} +2 -2
  21. package/dist/{integrate-D8jyhDzk.js → integrate-DVqhvPVq.js} +25 -66
  22. package/dist/{login-kneYhhk0.js → login-Bjj8QvIN.js} +6 -6
  23. package/dist/migrate-qmvOtp3l.js +283 -0
  24. package/dist/open-studio-CpHqjovS.js +1299 -0
  25. package/dist/{org-Cg25bcsj.js → org-CV8c849b.js} +3 -3
  26. package/dist/{output-csAtR6kJ.js → output-CiELrN8w.js} +15 -2
  27. package/dist/{pipeline-DAeI9tHs.js → pipeline-DSCHL9KA.js} +482 -9
  28. package/dist/{print-skill-BHVPP9cX.js → print-skill-CaHRJ8xW.js} +7 -7
  29. package/dist/{promote-Boek5K2d.js → promote-UMTh8Q33.js} +17 -18
  30. package/dist/publish-DWX8S9yZ.js +34 -0
  31. package/dist/push-Dox4_5Dq.js +34 -0
  32. package/dist/{query-B8G6T8Ba.js → query-CnSsDZ7Q.js} +10 -10
  33. package/dist/reports-C0xHCLnt.js +27 -0
  34. package/dist/{resource-DjsWVka-.js → resource-5bgyyL9B.js} +15 -15
  35. package/dist/{resources-s64mBHaC.js → resources-Bf9O1JNM.js} +28 -2
  36. package/dist/{run-BtcQJCP8.js → run-BVeZWbXx.js} +39 -22
  37. package/dist/{scan-DJixvuHn.js → scan-CAObNRgc.js} +44 -4
  38. package/dist/skills/superwall/SKILL.md +146 -0
  39. package/dist/skills/superwall/references/api.md +275 -0
  40. package/dist/skills/superwall/references/asa.md +160 -0
  41. package/dist/skills/superwall/references/asc.md +96 -0
  42. package/dist/skills/superwall/references/dashboard-links.md +57 -0
  43. package/dist/skills/superwall/references/data-analytics.md +893 -0
  44. package/dist/skills/superwall/references/docs.md +51 -0
  45. package/dist/skills/superwall/references/sdk-integration.md +105 -0
  46. package/dist/skills/superwall/references/sdk-source.md +18 -0
  47. package/{skills/superwall-dashboard/SKILL.md → dist/skills/superwall/workflows/dashboard/playbook.md} +3 -9
  48. package/{skills/superwall-dashboard/references → dist/skills/superwall/workflows/dashboard}/setup.md +1 -3
  49. package/dist/skills/superwall/workflows/integrate/android.md +292 -0
  50. package/{skills/superwall-integrate/SKILL.md → dist/skills/superwall/workflows/integrate/playbook.md} +16 -11
  51. package/{skills/superwall-migrate/references → dist/skills/superwall/workflows/migrate}/adapty.md +4 -4
  52. package/{skills/superwall-migrate/SKILL.md → dist/skills/superwall/workflows/migrate/playbook.md} +4 -10
  53. package/{skills/superwall-migrate/references → dist/skills/superwall/workflows/migrate}/qonversion.md +4 -4
  54. package/{skills/superwall-migrate/references → dist/skills/superwall/workflows/migrate}/revenuecat.md +4 -4
  55. package/dist/skills/superwall/workflows/placements/android.md +175 -0
  56. package/{skills/superwall-placements/references → dist/skills/superwall/workflows/placements}/expo.md +1 -1
  57. package/{skills/superwall-placements/references → dist/skills/superwall/workflows/placements}/flutter.md +1 -1
  58. package/{skills/superwall-placements/references → dist/skills/superwall/workflows/placements}/ios.md +1 -1
  59. package/{skills/superwall-placements/SKILL.md → dist/skills/superwall/workflows/placements/playbook.md} +6 -10
  60. package/{skills/superwall-placements/references → dist/skills/superwall/workflows/placements}/react-native.md +2 -2
  61. package/{skills/superwall-placements/references → dist/skills/superwall/workflows/placements}/strategy.md +4 -3
  62. package/dist/skills/superwall/workflows/review/android.md +120 -0
  63. package/{skills/superwall-review/references → dist/skills/superwall/workflows/review}/expo.md +1 -1
  64. package/{skills/superwall-review/references → dist/skills/superwall/workflows/review}/flutter.md +1 -1
  65. package/{skills/superwall-review/references → dist/skills/superwall/workflows/review}/ios.md +1 -1
  66. package/{skills/superwall-review/SKILL.md → dist/skills/superwall/workflows/review/playbook.md} +2 -7
  67. package/{skills/superwall-review/references → dist/skills/superwall/workflows/review}/react-native.md +1 -1
  68. package/dist/skills/superwall-framework/SKILL.md +253 -0
  69. package/dist/skills/superwall-framework/references/cli.md +340 -0
  70. package/dist/skills/superwall-framework/references/examples.md +123 -0
  71. package/dist/skills/superwall-framework/references/layout.md +295 -0
  72. package/dist/skills/superwall-framework/references/migrate-from-editor.md +208 -0
  73. package/dist/skills/superwall-framework/references/migrate-from-native.md +193 -0
  74. package/dist/skills/superwall-framework/references/mobile-design.md +371 -0
  75. package/dist/skills/superwall-framework/references/native/android.md +83 -0
  76. package/dist/skills/superwall-framework/references/native/flutter.md +65 -0
  77. package/dist/skills/superwall-framework/references/native/ios.md +77 -0
  78. package/dist/skills/superwall-framework/references/native/react-native.md +67 -0
  79. package/dist/skills/superwall-framework/references/responsive.md +162 -0
  80. package/dist/{skills-CRG1xk0G.js → skills-Cu41i-Az.js} +12 -12
  81. package/dist/{skills-CODut1Hn.js → skills-grTDuHlc.js} +134 -36
  82. package/dist/{spinner-B9dT3DBY.js → spinner-DFctF_Jw.js} +1 -1
  83. package/dist/{telemetry-BtkMdT-5.js → telemetry-BuCbmoux.js} +3 -3
  84. package/dist/{token-hM7V1KMG.js → token-mju3Q-vc.js} +3 -3
  85. package/dist/{ui-Lqt_zFOr.js → ui-4gLyfrgl.js} +76 -46
  86. package/dist/{update-CeylIjx5.js → update-DnGfpCD7.js} +2 -2
  87. package/dist/{upgrade-DRqUfCBT.js → upgrade-PMoj3yqJ.js} +6 -6
  88. package/package.json +8 -7
  89. package/prompts/actions/paywall-migrate.xml +24 -0
  90. package/prompts/actions/screen-migrate.xml +26 -0
  91. package/dist/git-ZwA3Mx8m.js +0 -433
  92. package/dist/migrate-D_x1oyTk.js +0 -114
  93. package/dist/publish-C-zEUnO9.js +0 -35
  94. package/dist/push-DUDQG-EO.js +0 -35
  95. package/skills/README.md +0 -118
  96. /package/dist/{api-output-D9ggXQIr.js → api-output-CEhN-U_N.js} +0 -0
  97. /package/dist/{asc-products-C6MvSy8H.js → asc-products-1e1DoGeL.js} +0 -0
  98. /package/dist/{params-B1zeElGa.js → params-BxgTuCzr.js} +0 -0
  99. /package/{skills/superwall-integrate/references → dist/skills/superwall/workflows/integrate}/expo.md +0 -0
  100. /package/{skills/superwall-integrate/references → dist/skills/superwall/workflows/integrate}/flutter.md +0 -0
  101. /package/{skills/superwall-integrate/references → dist/skills/superwall/workflows/integrate}/ios.md +0 -0
  102. /package/{skills/superwall-integrate/references → dist/skills/superwall/workflows/integrate}/react-native.md +0 -0
  103. /package/dist/{storekit-DPonXSwe.js → storekit-Dlpbq5Wv.js} +0 -0
@@ -1,9 +1,9 @@
1
- import { g as VERSION } from "./output-csAtR6kJ.js";
2
- import { h as setSkillsSync, i as track, u as getSkillsSync } from "./telemetry-BtkMdT-5.js";
3
- import { n as ui } from "./ui-Lqt_zFOr.js";
1
+ import { a as AGENT_SKILLS_DIR, l as CHANNEL, u as CHANNELS, y as VERSION } from "./output-CiELrN8w.js";
2
+ import { h as setSkillsSync, i as track, u as getSkillsSync } from "./telemetry-BuCbmoux.js";
3
+ import { n as ui } from "./ui-4gLyfrgl.js";
4
4
  import { r as spawnStream } from "./spawn-DSoTXy_j.js";
5
- import { existsSync, readFileSync } from "node:fs";
6
5
  import { dirname, join } from "node:path";
6
+ import { existsSync, readFileSync } from "node:fs";
7
7
  import { fileURLToPath } from "node:url";
8
8
 
9
9
  //#region src/packaged.ts
@@ -20,30 +20,76 @@ function packageRoot() {
20
20
  }
21
21
  return root = dir;
22
22
  }
23
- /** Locate a directory shipped with the package. */
23
+ /** Locate a directory shipped with the package; skills are bundled into dist/ by the build. */
24
24
  function packagedDir(name) {
25
- return join(packageRoot(), name) + "/";
25
+ return join(packageRoot(), name === "skills" ? "dist/skills" : name) + "/";
26
26
  }
27
27
 
28
28
  //#endregion
29
29
  //#region src/core/agent/skills.ts
30
+ const SUPERWALL_SKILLS_SOURCE = "superwall/skills";
31
+ const skillsRefFor = (channel) => CHANNELS[channel].skillsRef;
32
+ const SKILLS_REF = () => skillsRefFor(CHANNEL());
33
+ const skillsInstallSourceFor = (channel) => channel === "latest" ? SUPERWALL_SKILLS_SOURCE : `https://github.com/${SUPERWALL_SKILLS_SOURCE}/tree/${skillsRefFor(channel)}`;
34
+ const SKILLS_INSTALL_SOURCE = () => skillsInstallSourceFor(CHANNEL());
35
+ const VENDORED_SKILLS = {
36
+ superwall: "latest",
37
+ "superwall-framework": "next"
38
+ };
39
+ const onChannel = (channel) => channel === "latest" || channel === CHANNEL();
40
+ const bundledSkillsForChannel = () => Object.entries(VENDORED_SKILLS).filter(([, channel]) => onChannel(channel)).map(([name]) => name);
41
+ const PLAYBOOKS = {
42
+ "superwall-integrate": {
43
+ playbook: "superwall/workflows/integrate/playbook.md",
44
+ refs: "superwall/workflows/integrate"
45
+ },
46
+ "superwall-placements": {
47
+ playbook: "superwall/workflows/placements/playbook.md",
48
+ refs: "superwall/workflows/placements"
49
+ },
50
+ "superwall-dashboard": {
51
+ playbook: "superwall/workflows/dashboard/playbook.md",
52
+ refs: "superwall/workflows/dashboard"
53
+ },
54
+ "superwall-review": {
55
+ playbook: "superwall/workflows/review/playbook.md",
56
+ refs: "superwall/workflows/review"
57
+ },
58
+ "superwall-migrate": {
59
+ playbook: "superwall/workflows/migrate/playbook.md",
60
+ refs: "superwall/workflows/migrate"
61
+ },
62
+ "superwall-paywall-migrate": {
63
+ playbook: "superwall-framework/references/migrate-from-editor.md",
64
+ refs: "superwall-framework/references"
65
+ },
66
+ "superwall-screen-migrate": {
67
+ playbook: "superwall-framework/references/migrate-from-native.md",
68
+ refs: "superwall-framework/references/native"
69
+ }
70
+ };
30
71
  const cache = /* @__PURE__ */ new Map();
31
72
  function bundledSkillsDir() {
32
73
  return packagedDir("skills").replace(/\/$/, "");
33
74
  }
34
- /** SKILL.md body, plus references/<name>.md for each given reference (framework/provider depth). */
35
75
  function loadBundledSkill(id, reference) {
36
76
  const refs = (Array.isArray(reference) ? reference : [reference]).filter((r) => !!r);
37
- const key = refs.length ? `${id}#${refs.join("+")}` : id;
77
+ const { playbook, refs: refsDir } = PLAYBOOKS[id];
78
+ const base = skillsBaseFor(playbook);
79
+ const key = `${base}:${refs.length ? `${id}#${refs.join("+")}` : id}`;
38
80
  const cached = cache.get(key);
39
81
  if (cached !== void 0) return cached;
40
- const body = [readSkillFile(`${id}/SKILL.md`), ...refs.map((r) => readSkillFile(`${id}/references/${r}.md`))].filter(Boolean).join("\n\n");
82
+ const body = [readSkillFile(base, playbook), ...refs.map((r) => readSkillFile(base, `${refsDir}/${r}.md`))].filter(Boolean).join("\n\n");
41
83
  cache.set(key, body);
42
84
  return body;
43
85
  }
44
- function readSkillFile(rel) {
86
+ function skillsBaseFor(playbook) {
87
+ const installed = `${AGENT_SKILLS_DIR()}/`;
88
+ return existsSync(`${installed}${playbook}`) ? installed : packagedDir("skills");
89
+ }
90
+ function readSkillFile(base, rel) {
45
91
  try {
46
- return stripFrontmatter(readFileSync(`${packagedDir("skills")}${rel}`, "utf8")).trim();
92
+ return stripFrontmatter(readFileSync(`${base}${rel}`, "utf8")).trim();
47
93
  } catch (error) {
48
94
  throw new Error(`Bundled skill asset is missing: ${rel}`, { cause: error });
49
95
  }
@@ -56,34 +102,82 @@ function stripFrontmatter(md) {
56
102
  }
57
103
  return md;
58
104
  }
59
- const SUPERWALL_SKILLS_SOURCE = "superwall/skills";
60
- const KNOWN_SKILLS = [{
61
- name: "superwall",
62
- summary: "Resources, ClickHouse SQL analytics, docs, SDK triage, and dashboard links"
63
- }, {
64
- name: "superwall-editor",
65
- summary: "Build and edit live paywalls, onboarding, and web2app flows from the CLI"
66
- }];
105
+ const KNOWN_SKILLS = [
106
+ {
107
+ name: "superwall",
108
+ summary: "Resources, ClickHouse SQL analytics, docs, SDK triage, and dashboard links",
109
+ channel: "latest"
110
+ },
111
+ {
112
+ name: "superwall-editor",
113
+ summary: "Build and edit live paywalls, onboarding, and web2app flows from the CLI",
114
+ channel: "latest"
115
+ },
116
+ {
117
+ name: "superwall-framework",
118
+ summary: "Paywalls, funnels and any updatable screen as React mini-apps with the framework",
119
+ channel: "next"
120
+ },
121
+ {
122
+ name: "superwall-integrate",
123
+ summary: "Install and configure the SDK in an app for the first time",
124
+ channel: "latest"
125
+ },
126
+ {
127
+ name: "superwall-placements",
128
+ summary: "Add or audit placements at feature gates and route them to campaigns",
129
+ channel: "latest"
130
+ },
131
+ {
132
+ name: "superwall-dashboard",
133
+ summary: "Create the entitlements, products and campaigns a placement needs",
134
+ channel: "latest"
135
+ },
136
+ {
137
+ name: "superwall-review",
138
+ summary: "Audit an existing Superwall setup end to end",
139
+ channel: "latest"
140
+ },
141
+ {
142
+ name: "superwall-migrate",
143
+ summary: "Move an app off RevenueCat, Adapty or Qonversion",
144
+ channel: "latest"
145
+ },
146
+ {
147
+ name: "superwall-paywall-migrate",
148
+ summary: "Rebuild a dashboard paywall as a framework paywall",
149
+ channel: "next"
150
+ },
151
+ {
152
+ name: "superwall-screen-migrate",
153
+ summary: "Rebuild a native screen as a framework surface",
154
+ channel: "next"
155
+ }
156
+ ];
157
+ const knownSkills = () => KNOWN_SKILLS.filter((skill) => onChannel(skill.channel)).map(({ name, summary }) => ({
158
+ name,
159
+ summary
160
+ }));
67
161
  async function fetchPublicSkills() {
68
162
  try {
69
- const res = await fetch(`https://api.github.com/repos/${SUPERWALL_SKILLS_SOURCE}/contents/skills`, {
163
+ const res = await fetch(`https://api.github.com/repos/${SUPERWALL_SKILLS_SOURCE}/contents/skills?ref=${SKILLS_REF()}`, {
70
164
  headers: { accept: "application/vnd.github+json" },
71
165
  signal: AbortSignal.timeout(6e3)
72
166
  });
73
- if (!res.ok) return KNOWN_SKILLS;
167
+ if (!res.ok) return knownSkills();
74
168
  const dirs = (await res.json()).filter((e) => e.type === "dir").map((e) => e.name);
75
- if (dirs.length === 0) return KNOWN_SKILLS;
169
+ if (dirs.length === 0) return knownSkills();
76
170
  return (await Promise.all(dirs.map(async (name) => ({
77
171
  name,
78
172
  summary: await fetchSkillSummary(name)
79
173
  })))).sort((a, b) => a.name === "superwall" ? -1 : b.name === "superwall" ? 1 : a.name.localeCompare(b.name));
80
174
  } catch {
81
- return KNOWN_SKILLS;
175
+ return knownSkills();
82
176
  }
83
177
  }
84
178
  async function fetchSkillSummary(name) {
85
179
  try {
86
- const res = await fetch(`https://raw.githubusercontent.com/${SUPERWALL_SKILLS_SOURCE}/main/skills/${name}/SKILL.md`, { signal: AbortSignal.timeout(6e3) });
180
+ const res = await fetch(`https://raw.githubusercontent.com/${SUPERWALL_SKILLS_SOURCE}/${SKILLS_REF()}/skills/${name}/SKILL.md`, { signal: AbortSignal.timeout(6e3) });
87
181
  if (!res.ok) return "";
88
182
  const description = ((await res.text()).match(/^description:\s*(.+)$/m)?.[1] ?? "").trim().replace(/^["']|["'`]+$/g, "");
89
183
  const firstSentence = description.split(/(?<=\.)\s/)[0] ?? description;
@@ -97,7 +191,7 @@ async function installPublicSkills(opts = {}) {
97
191
  "-y",
98
192
  "skills@latest",
99
193
  "add",
100
- SUPERWALL_SKILLS_SOURCE,
194
+ SKILLS_INSTALL_SOURCE(),
101
195
  "--global",
102
196
  "--yes"
103
197
  ];
@@ -113,6 +207,8 @@ async function installBundledSkills(opts = {}) {
113
207
  bundledSkillsDir(),
114
208
  "--global",
115
209
  "--yes",
210
+ "--skill",
211
+ ...bundledSkillsForChannel(),
116
212
  "--copy"
117
213
  ], opts);
118
214
  }
@@ -135,15 +231,15 @@ async function runInstall(args, opts) {
135
231
  };
136
232
  }
137
233
  const SHA_CHECK_INTERVAL_MS = 1440 * 60 * 1e3;
138
- function checkSkillsSync(sync, cliVersion, now) {
139
- if (!sync || sync.cliVersion !== cliVersion) return "stale";
234
+ function checkSkillsSync(sync, cliVersion, ref, now) {
235
+ if (!sync || sync.cliVersion !== cliVersion || sync.ref !== ref) return "stale";
140
236
  const syncedAt = Date.parse(sync.syncedAt);
141
237
  if (!Number.isFinite(syncedAt)) return "stale";
142
238
  return now - syncedAt > SHA_CHECK_INTERVAL_MS ? "verify" : "fresh";
143
239
  }
144
240
  async function fetchSourceSha() {
145
241
  try {
146
- const res = await fetch(`https://api.github.com/repos/${SUPERWALL_SKILLS_SOURCE}/commits/main`, {
242
+ const res = await fetch(`https://api.github.com/repos/${SUPERWALL_SKILLS_SOURCE}/commits/${SKILLS_REF()}`, {
147
243
  headers: { accept: "application/vnd.github+json" },
148
244
  signal: AbortSignal.timeout(6e3)
149
245
  });
@@ -156,7 +252,7 @@ async function fetchSourceSha() {
156
252
  }
157
253
  async function skillsOutOfDate() {
158
254
  const sync = getSkillsSync();
159
- const check = checkSkillsSync(sync, VERSION, Date.now());
255
+ const check = checkSkillsSync(sync, VERSION, SKILLS_REF(), Date.now());
160
256
  if (check === "stale") return true;
161
257
  if (check === "fresh" || !sync) return false;
162
258
  const head = await fetchSourceSha();
@@ -169,23 +265,25 @@ async function skillsOutOfDate() {
169
265
  return false;
170
266
  }
171
267
  async function syncSkills(opts = {}) {
172
- const pub = await installPublicSkills(opts);
173
268
  const bundled = await installBundledSkills(opts);
174
- const ok = pub.ok && bundled.ok;
269
+ const pub = await installPublicSkills(opts);
270
+ const ok = bundled.ok;
175
271
  if (!opts.dryRun) {
176
272
  track("skills synced", {
177
273
  trigger: opts.trigger ?? "manual",
178
- ok
274
+ ok,
275
+ current: pub.ok
179
276
  });
180
- if (ok) setSkillsSync({
277
+ if (ok && pub.ok) setSkillsSync({
181
278
  cliVersion: VERSION,
182
279
  syncedAt: (/* @__PURE__ */ new Date()).toISOString(),
183
- sourceSha: await fetchSourceSha() ?? void 0
280
+ sourceSha: await fetchSourceSha() ?? void 0,
281
+ ref: SKILLS_REF()
184
282
  });
185
283
  }
186
284
  return {
187
285
  ok,
188
- commands: [pub.command, bundled.command]
286
+ commands: [bundled.command, pub.command]
189
287
  };
190
288
  }
191
289
  /**
@@ -203,4 +301,4 @@ async function ensureSkillsCurrent(required = false, trigger = "workflow") {
203
301
  }
204
302
 
205
303
  //#endregion
206
- export { skillsOutOfDate as a, loadBundledSkill as i, ensureSkillsCurrent as n, syncSkills as o, fetchPublicSkills as r, packagedDir as s, SUPERWALL_SKILLS_SOURCE as t };
304
+ export { skillsOutOfDate as a, loadBundledSkill as i, ensureSkillsCurrent as n, syncSkills as o, fetchPublicSkills as r, packagedDir as s, SKILLS_INSTALL_SOURCE as t };
@@ -1,4 +1,4 @@
1
- import { n as ui } from "./ui-Lqt_zFOr.js";
1
+ import { n as ui } from "./ui-4gLyfrgl.js";
2
2
 
3
3
  //#region src/ui/spinner.ts
4
4
  async function withSpinner(label, work) {
@@ -1,8 +1,8 @@
1
- import { g as VERSION, h as TELEMETRY_KEY, m as TELEMETRY_HOST, p as SUPERWALL_HOME, r as formatJson, v as isNonInteractive } from "./output-csAtR6kJ.js";
1
+ import { _ as TELEMETRY_HOST, g as SUPERWALL_HOME, r as formatJson, v as TELEMETRY_KEY, x as isNonInteractive, y as VERSION } from "./output-CiELrN8w.js";
2
+ import { join } from "node:path";
3
+ import { homedir } from "node:os";
2
4
  import { randomUUID } from "node:crypto";
3
5
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
4
- import { homedir } from "node:os";
5
- import { join } from "node:path";
6
6
 
7
7
  //#region src/core/state/config.ts
8
8
  function dir() {
@@ -1,7 +1,7 @@
1
- import { p as SUPERWALL_HOME, r as formatJson } from "./output-csAtR6kJ.js";
2
- import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
3
- import { homedir } from "node:os";
1
+ import { g as SUPERWALL_HOME, r as formatJson } from "./output-CiELrN8w.js";
4
2
  import { join } from "node:path";
3
+ import { homedir } from "node:os";
4
+ import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
5
5
 
6
6
  //#region src/core/auth/errors.ts
7
7
  var NotLoggedInError = class extends Error {
@@ -1,8 +1,8 @@
1
1
  import { n as __require, r as __toESM, t as __commonJS } from "./chunk-DQxbwPpZ.js";
2
2
  import pc from "picocolors";
3
+ import os from "node:os";
3
4
  import { stripVTControlCharacters } from "node:util";
4
5
  import * as fs from "node:fs";
5
- import os from "node:os";
6
6
  import { PassThrough, Stream } from "node:stream";
7
7
  import process$1, { cwd, env } from "node:process";
8
8
  import ansiEscapes, { link } from "ansi-escapes";
@@ -26202,6 +26202,30 @@ function emit() {
26202
26202
  function getState() {
26203
26203
  return state;
26204
26204
  }
26205
+ const interruptListeners = /* @__PURE__ */ new Set();
26206
+ function onInterrupt(listener) {
26207
+ interruptListeners.add(listener);
26208
+ return () => {
26209
+ interruptListeners.delete(listener);
26210
+ };
26211
+ }
26212
+ function interrupt() {
26213
+ const active$1 = state.active;
26214
+ if (active$1 && active$1.type !== "spinner") {
26215
+ state = {
26216
+ ...state,
26217
+ items: [...state.items, {
26218
+ id: nextId++,
26219
+ kind: "step",
26220
+ text: `${active$1.message}\ncancelled`
26221
+ }],
26222
+ active: null
26223
+ };
26224
+ emit();
26225
+ active$1.resolve(null);
26226
+ }
26227
+ for (const listener of [...interruptListeners]) listener();
26228
+ }
26205
26229
  function addItem(kind, text, title) {
26206
26230
  state = {
26207
26231
  ...state,
@@ -27262,31 +27286,48 @@ function SelectView({ active: active$1 }) {
27262
27286
  ] }),
27263
27287
  active$1.options.map((o, i) => {
27264
27288
  const sel = i === active$1.index;
27265
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { children: [
27266
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
27267
- dimColor: true,
27268
- children: "│ "
27269
- }),
27270
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
27271
- color: sel ? PRIMARY : void 0,
27272
- dimColor: o.disabled,
27273
- children: [
27274
- " ",
27275
- sel ? "●" : "○",
27276
- " ",
27277
- o.label
27278
- ]
27279
- }),
27280
- o.hint ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
27281
- dimColor: true,
27282
- children: [" ", o.hint]
27283
- }) : null
27284
- ] }, i);
27289
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OptionRow, {
27290
+ marker: `${sel ? "●" : "○"} `,
27291
+ label: o.label,
27292
+ hint: o.hint,
27293
+ color: sel ? PRIMARY : void 0,
27294
+ dim: o.disabled
27295
+ }, i);
27285
27296
  }),
27286
27297
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Footer, { text: active$1.footer })
27287
27298
  ]
27288
27299
  });
27289
27300
  }
27301
+ const OPTION_INDENT = "│ ";
27302
+ function OptionRow({ marker, label, hint, color, dim: dim$1, bold: bold$1 }) {
27303
+ const columns = process.stdout.columns ?? 80;
27304
+ const inline = !hint || 4 + marker.length + label.length + 1 + hint.length <= columns;
27305
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, {
27306
+ flexDirection: "column",
27307
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { children: [
27308
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
27309
+ dimColor: true,
27310
+ children: OPTION_INDENT
27311
+ }),
27312
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
27313
+ color,
27314
+ dimColor: dim$1,
27315
+ bold: bold$1,
27316
+ children: [marker, label]
27317
+ }),
27318
+ hint && inline ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
27319
+ dimColor: true,
27320
+ children: [" ", hint]
27321
+ }) : null
27322
+ ] }), hint && !inline ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
27323
+ dimColor: true,
27324
+ children: OPTION_INDENT
27325
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
27326
+ dimColor: true,
27327
+ children: [" ".repeat(marker.length), hint]
27328
+ })] }) : null]
27329
+ });
27330
+ }
27290
27331
  function Footer({ text }) {
27291
27332
  if (!text) return null;
27292
27333
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
@@ -27330,29 +27371,13 @@ function MultiSelectView({ active: active$1 }) {
27330
27371
  ] }), active$1.options.map((o, i) => {
27331
27372
  const cur = i === active$1.index;
27332
27373
  const on = active$1.selected.has(o.value);
27333
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { children: [
27334
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
27335
- dimColor: true,
27336
- children: "│ "
27337
- }),
27338
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
27339
- color: PRIMARY,
27340
- children: cur ? "❯ " : " "
27341
- }),
27342
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
27343
- color: on ? PRIMARY : void 0,
27344
- bold: cur,
27345
- children: [
27346
- on ? "◼" : "◻",
27347
- " ",
27348
- o.label
27349
- ]
27350
- }),
27351
- o.hint ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
27352
- dimColor: true,
27353
- children: [" ", o.hint]
27354
- }) : null
27355
- ] }, i);
27374
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OptionRow, {
27375
+ marker: `${cur ? "❯" : " "} ${on ? "◼" : "◻"} `,
27376
+ label: o.label,
27377
+ hint: o.hint,
27378
+ color: on ? PRIMARY : void 0,
27379
+ bold: cur
27380
+ }, i);
27356
27381
  })]
27357
27382
  });
27358
27383
  }
@@ -27478,6 +27503,9 @@ function ActiveRegion({ active: active$1 }) {
27478
27503
  }
27479
27504
  function App() {
27480
27505
  const s = useStore();
27506
+ use_input_default((input, key) => {
27507
+ if (key.ctrl && input === "c") interrupt();
27508
+ });
27481
27509
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, {
27482
27510
  flexDirection: "column",
27483
27511
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Static, {
@@ -27502,7 +27530,7 @@ let instance = null;
27502
27530
  function start() {
27503
27531
  if (!instance) {
27504
27532
  reset();
27505
- instance = render_default(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(App, {}));
27533
+ instance = render_default(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(App, {}), { exitOnCtrlC: false });
27506
27534
  }
27507
27535
  }
27508
27536
  function stop() {
@@ -27526,6 +27554,7 @@ const inkRenderer = {
27526
27554
  outro: (text) => {
27527
27555
  if (text) addItem("outro", text);
27528
27556
  },
27557
+ onInterrupt,
27529
27558
  spinner() {
27530
27559
  return {
27531
27560
  start: (message) => setActive({
@@ -27700,7 +27729,8 @@ const ui = {
27700
27729
  select: (o) => active.select(o),
27701
27730
  multiselect: (o) => active.multiselect(o),
27702
27731
  confirm: (o) => active.confirm(o),
27703
- text: (o) => active.text(o)
27732
+ text: (o) => active.text(o),
27733
+ onInterrupt: (listener) => active.onInterrupt?.(listener) ?? (() => {})
27704
27734
  };
27705
27735
 
27706
27736
  //#endregion
@@ -1,5 +1,5 @@
1
- import { g as VERSION } from "./output-csAtR6kJ.js";
2
- import { d as getUpdateCheck, g as setUpdateCheck } from "./telemetry-BtkMdT-5.js";
1
+ import { y as VERSION } from "./output-CiELrN8w.js";
2
+ import { d as getUpdateCheck, g as setUpdateCheck } from "./telemetry-BuCbmoux.js";
3
3
  import pc from "picocolors";
4
4
 
5
5
  //#region src/core/update.ts
@@ -1,9 +1,9 @@
1
- import { g as VERSION } from "./output-csAtR6kJ.js";
2
- import { g as setUpdateCheck } from "./telemetry-BtkMdT-5.js";
3
- import { r as isNewerVersion, t as fetchLatestVersion } from "./update-CeylIjx5.js";
4
- import "./token-hM7V1KMG.js";
5
- import { t as defineCommand } from "./command-DP96_gmP.js";
6
- import "./ui-Lqt_zFOr.js";
1
+ import { y as VERSION } from "./output-CiELrN8w.js";
2
+ import { g as setUpdateCheck } from "./telemetry-BuCbmoux.js";
3
+ import { r as isNewerVersion, t as fetchLatestVersion } from "./update-DnGfpCD7.js";
4
+ import "./token-mju3Q-vc.js";
5
+ import { t as defineCommand } from "./command-DMoMn7uc.js";
6
+ import "./ui-4gLyfrgl.js";
7
7
  import { r as spawnStream } from "./spawn-DSoTXy_j.js";
8
8
 
9
9
  //#region src/commands/account/upgrade.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superwall/cli",
3
- "version": "1.4.0",
3
+ "version": "1.6.0",
4
4
  "description": "The official CLI for managing Superwall from your terminal or coding agent.",
5
5
  "keywords": [
6
6
  "agent",
@@ -28,8 +28,7 @@
28
28
  "LICENSE",
29
29
  "package.json",
30
30
  "prompts",
31
- "README.md",
32
- "skills"
31
+ "README.md"
33
32
  ],
34
33
  "type": "module",
35
34
  "exports": {
@@ -43,22 +42,24 @@
43
42
  }
44
43
  },
45
44
  "scripts": {
46
- "build": "tsdown",
45
+ "build": "tsdown && tsx scripts/vendor-skills.ts",
47
46
  "watch": "tsdown --watch",
48
47
  "regen:asc": "tsx scripts/regen-asc-index.ts",
48
+ "skills:vendor": "tsx scripts/vendor-skills.ts",
49
+ "skills:ensure": "test -f dist/skills/superwall/SKILL.md || tsx scripts/vendor-skills.ts",
49
50
  "dev": "bun bin.ts",
50
- "test": "tsx --test --import ./tests/setup.ts $(rg --files tests -g '*.test.ts')",
51
+ "test": "bun run skills:ensure && tsx --test --import ./tests/setup.ts $(rg --files tests -g '*.test.ts')",
51
52
  "link:global": "tsdown && bun link",
52
53
  "typecheck": "tsc --noEmit",
53
54
  "prepack": "bun run build",
54
55
  "prepublishOnly": "bun run typecheck && bun run test",
55
56
  "test:run": "tsx --test $(rg --files tests -g '*.test.ts')",
56
- "test:coverage": "tsx --test --import ./tests/setup.ts --experimental-test-coverage --test-coverage-lines=85 --test-coverage-branches=88 --test-coverage-functions=85 $(rg --files tests -g '*.test.ts')",
57
+ "test:coverage": "bun run skills:ensure && tsx --test --import ./tests/setup.ts --experimental-test-coverage --test-coverage-lines=85 --test-coverage-branches=88 --test-coverage-functions=85 $(rg --files tests -g '*.test.ts')",
57
58
  "clean": "rm -rf dist"
58
59
  },
59
60
  "dependencies": {
60
61
  "@anthropic-ai/claude-agent-sdk": "0.3.201",
61
- "@superwall/studio": "1.4.0",
62
+ "@superwall/studio": "1.6.0",
62
63
  "ansi-escapes": "^7.3.0",
63
64
  "fast-glob": "^3.3.3",
64
65
  "ink": "^5.2.1",
@@ -0,0 +1,24 @@
1
+ <context>
2
+ <project_directory>{{project_dir}}</project_directory>
3
+ <surface_directory>{{surface_dir}}</surface_directory>
4
+ <source_paywall id="{{paywall_id}}">{{source_url}}</source_paywall>
5
+ <dashboard note="for the user, not you">{{dashboard_url}}</dashboard>
6
+ </context>
7
+
8
+ <task>
9
+ Rebuild the dashboard paywall described in {{surface_dir}}/MIGRATION.md as a framework paywall in that directory.
10
+
11
+ {{skill}}
12
+
13
+ <brief>
14
+ {{brief}}
15
+ </brief>
16
+
17
+ <rules>
18
+ <rule>Before editing any file, read it first. Match the project's existing style.</rule>
19
+ <rule>When using the superwall CLI, pass --json for every data command. Never run superwall push, promote or publish, and never create or change campaigns or products.</rule>
20
+ <rule>Emit a one-line progress update prefixed with '[STATUS] ' before EVERY step, including before running any shell command. The user only sees these [STATUS] lines, so keep a fresh, human-readable [STATUS] flowing the whole way through. Never go more than one tool call without a [STATUS] update.</rule>
21
+ <rule>Do not write a long summary. End with a short note listing anything not carried over, then '[STATUS] Done'.</rule>
22
+ <rule>If you cannot complete the rebuild safely (the served document cannot be read, a page's design cannot be inferred), stop and explain what you need instead of guessing.</rule>
23
+ </rules>
24
+ </task>
@@ -0,0 +1,26 @@
1
+ <context>
2
+ <project_directory>{{project_dir}}</project_directory>
3
+ <surface_directory>{{surface_dir}}</surface_directory>
4
+ <source_screen framework="{{framework}}">{{source_path}}</source_screen>
5
+ <original_screenshot>{{screenshot}}</original_screenshot>
6
+ <dashboard note="for the user, not you">{{dashboard_url}}</dashboard>
7
+ </context>
8
+
9
+ <task>
10
+ Rebuild the native screen described in {{surface_dir}}/MIGRATION.md as a framework surface in that directory. The source file path is relative to the project directory; read it, do not edit it.
11
+
12
+ {{skill}}
13
+
14
+ <brief>
15
+ {{brief}}
16
+ </brief>
17
+
18
+ <rules>
19
+ <rule>Before editing any file, read it first. Match the project's existing style.</rule>
20
+ <rule>Only write inside {{surface_dir}}. Never edit the app's own source, and never add register() calls; the app is wired after the user reviews the rebuild.</rule>
21
+ <rule>When using the superwall CLI, pass --json for every data command. Never run superwall push, promote or publish, and never create or change campaigns or products.</rule>
22
+ <rule>Emit a one-line progress update prefixed with '[STATUS] ' before EVERY step, including before running any shell command. The user only sees these [STATUS] lines, so keep a fresh, human-readable [STATUS] flowing the whole way through. Never go more than one tool call without a [STATUS] update.</rule>
23
+ <rule>Do not write a long summary. End with a short note listing anything not carried over, then '[STATUS] Done'.</rule>
24
+ <rule>If you cannot complete the rebuild safely (the source cannot be read, its design depends on code you cannot find), stop and explain what you need instead of guessing.</rule>
25
+ </rules>
26
+ </task>