@superwall/cli 1.2.0 → 1.3.0-beta.4

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 (50) hide show
  1. package/README.md +6 -4
  2. package/dist/{actions-DYQTxMXS.js → actions-C0sUjLGZ.js} +2 -2
  3. package/dist/{api-B2Zsf08U.js → api-NEcc9ESi.js} +9 -9
  4. package/dist/{api-output-B5hh0q4V.js → api-output-D9ggXQIr.js} +1 -1
  5. package/dist/{app-rYAP19Jo.js → app-vECLIkWi.js} +11 -11
  6. package/dist/{asa-DlM6dlPD.js → asa-CZcmgOho.js} +11 -11
  7. package/dist/{asc-D6qBCfuj.js → asc-mJv5I7lW.js} +12 -12
  8. package/dist/{auth-BEnVvJlK.js → auth-BCsxGMUQ.js} +10 -10
  9. package/dist/auth.js +2 -2
  10. package/dist/{billing-DO-gNWvW.js → billing-KoxHLZzm.js} +1 -1
  11. package/dist/{bind-KZhPLTdC.js → bind-CBLvcdzo.js} +4 -4
  12. package/dist/{command-B12qooZb.js → command-Bav1fWvv.js} +93 -102
  13. package/dist/{create-BTEvRC1X.js → create-CA_s5fN9.js} +18 -18
  14. package/dist/{dev-CwfCGm36.js → dev-B1o8OCRT.js} +37 -19
  15. package/dist/{doctor-DIxs8i8A.js → doctor-CyiygODt.js} +10 -10
  16. package/dist/{drivers-D6Ka26e2.js → drivers-DSkM9kMJ.js} +2 -2
  17. package/dist/entry.js +523 -467
  18. package/dist/{existing-CECenoHS.js → existing-D7p2hnhq.js} +2 -2
  19. package/dist/{feedback-CV2coV73.js → feedback-BBIkn1Yp.js} +9 -9
  20. package/dist/{git-CCJwXufi.js → git-C0x00Urq.js} +10 -10
  21. package/dist/{hosted-BCwzTTEw.js → hosted-q7_n5udj.js} +3 -3
  22. package/dist/{integrate-Bhq0wkU0.js → integrate-DstRn_NP.js} +28 -27
  23. package/dist/{login-D5TjqsXJ.js → login-DGc6GQqT.js} +8 -7
  24. package/dist/{migrate-Cz7VqQNj.js → migrate-CcwiRU6G.js} +20 -20
  25. package/dist/{org-B2gy9Pmu.js → org-Cg25bcsj.js} +3 -3
  26. package/dist/output-DmEUd7Xa.js +123 -0
  27. package/dist/{params-Bvq0iqQK.js → params-B1zeElGa.js} +1 -2
  28. package/dist/{pipeline-ChRDxU9b.js → pipeline-B3c4tjfA.js} +105 -98
  29. package/dist/{print-skill-BPePCjy4.js → print-skill-DBEmY01G.js} +7 -7
  30. package/dist/{promote-C54bfsg3.js → promote-bg_Li4za.js} +18 -18
  31. package/dist/publish-lviGUOF8.js +35 -0
  32. package/dist/push-C8vuasQL.js +35 -0
  33. package/dist/{query-CXjrBFow.js → query-dO6QUMTQ.js} +10 -10
  34. package/dist/{resource-CM2bIB5v.js → resource-BZvGoZlY.js} +13 -13
  35. package/dist/{resources-CVrWwA1K.js → resources-s64mBHaC.js} +1 -0
  36. package/dist/{run-CAIDPbwe.js → run-BfI8NVh4.js} +2 -2
  37. package/dist/{scan-BrikLKx5.js → scan-HfLbAkLc.js} +2 -2
  38. package/dist/{skills-BwXcAVIf.js → skills-BDMwScz3.js} +4 -3
  39. package/dist/{skills-_TULXe09.js → skills-DuI61I8U.js} +8 -8
  40. package/dist/{spinner-gOxIMz-V.js → spinner-B9dT3DBY.js} +1 -1
  41. package/dist/{telemetry-CpIXSAbQ.js → telemetry-vvgwHwjA.js} +6 -41
  42. package/dist/{token-DHRH8cxi.js → token-CwKfB5Ic.js} +2 -2
  43. package/dist/{ui-C4ncRJqd.js → ui-Lqt_zFOr.js} +5 -1
  44. package/dist/update-DeK9OQ5x.js +59 -0
  45. package/dist/{upgrade-BNPbzr5V.js → upgrade-Dyxk8mwJ.js} +6 -6
  46. package/package.json +4 -4
  47. package/dist/json-C3hPIMkI.js +0 -7
  48. package/dist/publish-NUNSIKri.js +0 -35
  49. package/dist/push-BjEpY9-h.js +0 -35
  50. package/dist/update-BdcpwRu_.js +0 -137
package/dist/entry.js CHANGED
@@ -1,11 +1,11 @@
1
- import { k as VERSION, t as flushTelemetry, w as ENV_API_KEY } from "./telemetry-CpIXSAbQ.js";
2
- import "./json-C3hPIMkI.js";
3
- import { c as writeJson, n as flushUpdateCheck } from "./update-BdcpwRu_.js";
1
+ import { g as VERSION, i as writeJson, u as ENV_API_KEY } from "./output-DmEUd7Xa.js";
2
+ import { t as flushTelemetry } from "./telemetry-vvgwHwjA.js";
3
+ import { n as flushUpdateCheck } from "./update-DeK9OQ5x.js";
4
4
  import yargs from "yargs";
5
5
  import { hideBin } from "yargs/helpers";
6
6
  import pc from "picocolors";
7
7
 
8
- //#region src/cli.ts
8
+ //#region src/cli/options.ts
9
9
  const installDirOption = { "install-dir": {
10
10
  describe: "Directory to set up Superwall in (default: cwd)",
11
11
  type: "string"
@@ -37,6 +37,64 @@ const API_VERBS = [
37
37
  "patch",
38
38
  "delete"
39
39
  ];
40
+
41
+ //#endregion
42
+ //#region src/cli/account.ts
43
+ const registerAccountCommands = (cli) => cli.command("login", "Log in to Superwall (opens your browser)", (y) => y.options({
44
+ "api-key": {
45
+ type: "string",
46
+ describe: "Log in headlessly with an API key (for CI) instead of the browser"
47
+ },
48
+ host: {
49
+ type: "string",
50
+ describe: "OAuth issuer override",
51
+ hidden: true
52
+ },
53
+ "client-id": {
54
+ type: "string",
55
+ describe: "OAuth client id override",
56
+ hidden: true
57
+ }
58
+ }), (argv) => {
59
+ return import("./auth-BCsxGMUQ.js").then((m) => m.runLogin(argv));
60
+ }).command("logout", "Log out of Superwall", (y) => y, (argv) => {
61
+ return import("./auth-BCsxGMUQ.js").then((m) => m.runLogout(argv));
62
+ }).command("whoami", "Show the logged-in Superwall account", (y) => y, (argv) => {
63
+ return import("./auth-BCsxGMUQ.js").then((m) => m.runWhoami(argv));
64
+ }).command("skills", "Install or update the Superwall agent skills for your coding agent", (y) => y.options({
65
+ skill: {
66
+ type: "array",
67
+ describe: "Install specific skills by name (default: all)"
68
+ },
69
+ force: {
70
+ type: "boolean",
71
+ describe: "Reinstall even if skills are already up to date"
72
+ },
73
+ yes: {
74
+ type: "boolean",
75
+ alias: "y",
76
+ describe: "Install all skills without asking"
77
+ },
78
+ "dry-run": {
79
+ type: "boolean",
80
+ describe: "Print the install command without running it",
81
+ hidden: true
82
+ }
83
+ }), (argv) => {
84
+ return import("./skills-DuI61I8U.js").then((m) => m.runSkills(argv));
85
+ }).command("doctor", "Check the health of your Superwall integration", (y) => y.options({ ...installDirOption }), (argv) => {
86
+ return import("./doctor-CyiygODt.js").then((m) => m.runDoctor(argv));
87
+ }).command("upgrade", "Update the CLI to the latest version", (y) => y, (argv) => {
88
+ return import("./upgrade-Dyxk8mwJ.js").then((m) => m.runUpgrade(argv));
89
+ }).command("feedback [message]", "Send feedback about the CLI to the Superwall team", (y) => y.positional("message", {
90
+ type: "string",
91
+ describe: "Your feedback (omit to be prompted)"
92
+ }).example("$0 feedback \"migrate crashed on Expo\"", "Send feedback").example("$0 feedback \"...\" --json", "For agents / automation"), (argv) => {
93
+ return import("./feedback-BBIkn1Yp.js").then((m) => m.runFeedback(argv));
94
+ });
95
+
96
+ //#endregion
97
+ //#region src/cli/help.ts
40
98
  function printHelp() {
41
99
  const pad = (cmd) => ` ${cmd.padEnd(30)}`;
42
100
  const row = (cmd, desc) => `${pad(cmd)}${desc}`;
@@ -102,360 +160,405 @@ function printHelp() {
102
160
  ""
103
161
  ].join("\n"));
104
162
  }
105
- async function run() {
106
- const args = hideBin(process.argv);
107
- if (args.length === 0 || args[0] === "help" || (args[0] === "-h" || args[0] === "--help") && args.length === 1) {
108
- printHelp();
109
- return;
110
- }
111
- let cli = yargs(args).scriptName("superwall").usage("Superwall CLI\n\n$0 [command]").option("interactive", {
163
+
164
+ //#endregion
165
+ //#region src/cli/paywalls.ts
166
+ const registerPaywallCommands = (cli) => cli.command("create [dir]", "Set up paywalls in your app - creates a superwall/ directory inside it", (y) => y.positional("dir", {
167
+ type: "string",
168
+ describe: "Your app's root (default: cwd) - paywalls land in superwall/ inside it"
169
+ }).options({
170
+ example: {
171
+ type: "string",
172
+ describe: "Start from a public example by name, e.g. --example with-rive"
173
+ },
174
+ yes: {
175
+ type: "boolean",
176
+ alias: "y",
177
+ describe: "Accept defaults and skip the optional prompts"
178
+ },
179
+ install: {
180
+ type: "boolean",
181
+ default: true,
182
+ describe: "Install dependencies after scaffolding (--no-install to skip)"
183
+ },
184
+ connect: {
112
185
  type: "boolean",
113
186
  default: true,
187
+ describe: "Connect a Superwall app when possible (--no-connect to skip)"
188
+ }
189
+ }).example("$0 create", "Set up superwall/ in the current app").example("$0 create --example with-rive", "Start from an example"), (argv) => {
190
+ return import("./create-CA_s5fN9.js").then((m) => m.runCreate(argv));
191
+ }).command("dev [dir..]", "Host the studio: browse and preview your paywalls and funnels", (y) => y.positional("dir", {
192
+ type: "string",
193
+ array: true,
194
+ describe: "Project directories to serve (default: cwd)"
195
+ }).options({
196
+ port: {
197
+ type: "number",
198
+ default: 6100,
199
+ alias: "p",
200
+ describe: "Preferred port (falls back to the next free one)"
201
+ },
202
+ host: {
203
+ type: "string",
204
+ default: "0.0.0.0",
205
+ describe: "Host to bind"
206
+ }
207
+ }), (argv) => {
208
+ return import("./dev-B1o8OCRT.js").then((m) => m.runDev(argv));
209
+ }).command("push [dir]", "Build and push your paywalls as immutable versions (production untouched)", (y) => y.positional("dir", {
210
+ type: "string",
211
+ describe: "Project directory (default: cwd)"
212
+ }).options({
213
+ id: {
214
+ type: "array",
215
+ string: true,
216
+ describe: "Limit to these paywalls or funnels by id (repeatable, or comma-separated)"
217
+ },
218
+ platform: {
219
+ type: "array",
220
+ string: true,
221
+ describe: "Limit to these platforms (repeatable, or comma-separated) - ios, android, web, flutter, react_native"
222
+ },
223
+ rename: {
224
+ type: "array",
225
+ string: true,
226
+ describe: "Declare a renamed directory as <old>=<new> (repeatable) - required in CI, where the resolver cannot prompt"
227
+ },
228
+ message: {
229
+ type: "string",
230
+ alias: "m",
231
+ describe: "Publish note recorded in the source commit (only lands when this publish creates a new source commit — unchanged source reuses the existing commit)"
232
+ }
233
+ }), (argv) => {
234
+ return import("./push-C8vuasQL.js").then((m) => m.runPush(argv));
235
+ }).command("promote [dir]", "Point production at a pushed version (the latest by default)", (y) => y.version(false).positional("dir", {
236
+ type: "string",
237
+ describe: "Project directory (default: cwd)"
238
+ }).options({
239
+ id: {
240
+ type: "array",
241
+ string: true,
242
+ describe: "Limit to these paywalls or funnels by id (repeatable, or comma-separated)"
243
+ },
244
+ platform: {
245
+ type: "array",
246
+ string: true,
247
+ describe: "Limit to these platforms (repeatable, or comma-separated) - ios, android, web, flutter, react_native"
248
+ },
249
+ version: {
250
+ type: "number",
251
+ alias: "v",
252
+ describe: "Pushed version number to promote (requires a single --id)"
253
+ }
254
+ }), (argv) => {
255
+ return import("./promote-bg_Li4za.js").then((m) => m.runPromote(argv));
256
+ }).command("publish [dir]", "Push and promote in one step - build, version, and ship to production", (y) => y.positional("dir", {
257
+ type: "string",
258
+ describe: "Project directory (default: cwd)"
259
+ }).options({
260
+ id: {
261
+ type: "array",
262
+ string: true,
263
+ describe: "Limit to these paywalls or funnels by id (repeatable, or comma-separated)"
264
+ },
265
+ platform: {
266
+ type: "array",
267
+ string: true,
268
+ describe: "Limit to these platforms (repeatable, or comma-separated) - ios, android, web, flutter, react_native"
269
+ },
270
+ rename: {
271
+ type: "array",
272
+ string: true,
273
+ describe: "Declare a renamed directory as <old>=<new> (repeatable) - required in CI, where the resolver cannot prompt"
274
+ },
275
+ message: {
276
+ type: "string",
277
+ alias: "m",
278
+ describe: "Publish note recorded in the source commit (only lands when this publish creates a new source commit — unchanged source reuses the existing commit)"
279
+ }
280
+ }), (argv) => {
281
+ return import("./publish-lviGUOF8.js").then((m) => m.runPublish(argv));
282
+ });
283
+
284
+ //#endregion
285
+ //#region src/cli/platform.ts
286
+ const registerPlatformCommands = (cli) => cli.command("query [sql]", "Run SQL against your ClickHouse analytics data", (y) => y.positional("sql", {
287
+ type: "string",
288
+ describe: "SQL query (or pass it with --file / stdin)"
289
+ }).options({ file: {
290
+ type: "string",
291
+ describe: "Read SQL from a .sql file"
292
+ } }).example("$0 query \"SHOW TABLES FROM sw\"", "Run an inline query").example("$0 query --file report.sql --json", "Run a saved query"), (argv) => {
293
+ return import("./query-dO6QUMTQ.js").then((m) => m.runQuery(argv));
294
+ }).command("asc <target> [value] [value2]", "Call the App Store Connect API through Superwall's signed proxy (no .p8 / JWT needed)", (y) => y.positional("target", {
295
+ type: "string",
296
+ describe: "get|post|patch|delete, a raw path (/v1/...), or: apps | products | subscriptions | iaps | docs | keys"
297
+ }).positional("value", {
298
+ type: "string",
299
+ describe: "Path (for a verb), app bundle id / ASC app id (shortcuts), docs path or search, or list|set|rm (keys)"
300
+ }).positional("value2", {
301
+ type: "string",
302
+ describe: "Team id (keys rm)"
303
+ }).options({
304
+ d: {
305
+ type: "array",
306
+ describe: "Request param, Stripe-style: -d key=value (string) or key:=value (number/bool/json); nesting via key[sub]"
307
+ },
308
+ team: {
309
+ type: "string",
310
+ describe: "ASC team id (if the org has more than one connected)"
311
+ },
312
+ force: {
313
+ type: "boolean",
314
+ describe: "Skip request-body schema validation and send as-is (post/patch)"
315
+ },
316
+ quiet: {
317
+ type: "boolean",
114
318
  hidden: true,
115
- describe: "Allow prompts (use --no-interactive for automation)"
116
- }).option("json", {
319
+ describe: "Suppress progress output"
320
+ },
321
+ "key-id": {
322
+ type: "string",
323
+ describe: "ASC key id (keys set)"
324
+ },
325
+ issuer: {
326
+ type: "string",
327
+ describe: "ASC issuer id (keys set)"
328
+ },
329
+ "key-file": {
330
+ type: "string",
331
+ describe: "Path to the .p8 key file (keys set)"
332
+ },
333
+ name: {
334
+ type: "string",
335
+ describe: "Account name (keys set)"
336
+ },
337
+ "dry-run": {
117
338
  type: "boolean",
118
- default: false,
119
- describe: "Machine-readable output"
120
- }).command("integrate", "Set up the SDK, placements, and dashboard in your app", (y) => y.options({
121
- ...installDirOption,
122
- ...apiKeyOption,
123
- ...dryRunOption,
124
- ...skillOption,
125
- driver: {
126
- type: "string",
127
- choices: [
128
- "claude",
129
- "codex",
130
- "superwall"
131
- ],
132
- describe: "Force a coding-agent backend (default: first detected)",
133
- hidden: true
134
- }
135
- }), (argv) => {
136
- if (argv.skill) return import("./print-skill-BPePCjy4.js").then((m) => m.runPrintSkill("integrate")(argv));
137
- return import("./integrate-Bhq0wkU0.js").then((m) => m.runIntegrate(argv));
138
- }).command("review", "Review an existing Superwall setup end to end", (y) => y.options({
139
- ...installDirOption,
140
- ...dryRunOption,
141
- ...skillOption,
142
- fix: {
143
- type: "boolean",
144
- describe: "Apply verified, safe fixes from the latest review"
145
- }
146
- }), (argv) => {
147
- const id = argv.fix ? "review-fix" : "review";
148
- if (argv.skill) return import("./print-skill-BPePCjy4.js").then((m) => m.runPrintSkill(id)(argv));
149
- return import("./integrate-Bhq0wkU0.js").then((m) => m.runActionCommand(id)(argv));
150
- }).command("migrate", "Migrate from RevenueCat / Adapty / Qonversion to Superwall", (y) => y.options({
151
- ...installDirOption,
152
- "dry-run": {
153
- type: "boolean",
154
- describe: "Plan without changes"
155
- },
156
- ...skillOption
157
- }), (argv) => {
158
- if (argv.skill) return import("./print-skill-BPePCjy4.js").then((m) => m.runPrintSkill("migrate")(argv));
159
- return import("./migrate-Cz7VqQNj.js").then((m) => m.runMigrate(argv));
160
- }).command("login", "Log in to Superwall (opens your browser)", (y) => y.options({
161
- "api-key": {
162
- type: "string",
163
- describe: "Log in headlessly with an API key (for CI) instead of the browser"
164
- },
165
- host: {
166
- type: "string",
167
- describe: "OAuth issuer override",
168
- hidden: true
169
- },
170
- "client-id": {
171
- type: "string",
172
- describe: "OAuth client id override",
173
- hidden: true
174
- }
175
- }), (argv) => {
176
- return import("./auth-BEnVvJlK.js").then((m) => m.runLogin(argv));
177
- }).command("logout", "Log out of Superwall", (y) => y, (argv) => {
178
- return import("./auth-BEnVvJlK.js").then((m) => m.runLogout(argv));
179
- }).command("whoami", "Show the logged-in Superwall account", (y) => y, (argv) => {
180
- return import("./auth-BEnVvJlK.js").then((m) => m.runWhoami(argv));
181
- }).command("skills", "Install or update the Superwall agent skills for your coding agent", (y) => y.options({
182
- skill: {
183
- type: "array",
184
- describe: "Install specific skills by name (default: all)"
185
- },
186
- force: {
187
- type: "boolean",
188
- describe: "Reinstall even if skills are already up to date"
189
- },
190
- yes: {
191
- type: "boolean",
192
- alias: "y",
193
- describe: "Install all skills without asking"
194
- },
195
- "dry-run": {
196
- type: "boolean",
197
- describe: "Print the install command without running it",
198
- hidden: true
199
- }
200
- }), (argv) => {
201
- return import("./skills-_TULXe09.js").then((m) => m.runSkills(argv));
202
- }).command("doctor", "Check the health of your Superwall integration", (y) => y.options({ ...installDirOption }), (argv) => {
203
- return import("./doctor-DIxs8i8A.js").then((m) => m.runDoctor(argv));
204
- }).command("upgrade", "Update the CLI to the latest version", (y) => y, (argv) => {
205
- return import("./upgrade-BNPbzr5V.js").then((m) => m.runUpgrade(argv));
206
- }).command("feedback [message]", "Send feedback about the CLI to the Superwall team", (y) => y.positional("message", {
207
- type: "string",
208
- describe: "Your feedback (omit to be prompted)"
209
- }).example("$0 feedback \"migrate crashed on Expo\"", "Send feedback").example("$0 feedback \"...\" --json", "For agents / automation"), (argv) => {
210
- return import("./feedback-CV2coV73.js").then((m) => m.runFeedback(argv));
211
- }).command("query [sql]", "Run SQL against your ClickHouse analytics data", (y) => y.positional("sql", {
212
- type: "string",
213
- describe: "SQL query (or pass it with --file / stdin)"
214
- }).options({ file: {
215
- type: "string",
216
- describe: "Read SQL from a .sql file"
217
- } }).example("$0 query \"SHOW TABLES FROM sw\"", "Run an inline query").example("$0 query --file report.sql --json", "Run a saved query"), (argv) => {
218
- return import("./query-CXjrBFow.js").then((m) => m.runQuery(argv));
219
- }).command("asc <target> [value] [value2]", "Call the App Store Connect API through Superwall's signed proxy (no .p8 / JWT needed)", (y) => y.positional("target", {
220
- type: "string",
221
- describe: "get|post|patch|delete, a raw path (/v1/...), or: apps | products | subscriptions | iaps | docs | keys"
222
- }).positional("value", {
339
+ hidden: true,
340
+ describe: "Plan without writing"
341
+ }
342
+ }), (argv) => {
343
+ return import("./asc-mJv5I7lW.js").then((m) => m.runAsc(argv));
344
+ }).command("asa <target> [action] [value]", "Call the Apple Search Ads API through Superwall's proxy (no key or token handling)", (y) => y.positional("target", {
345
+ type: "string",
346
+ describe: "A resource (campaigns, adgroups, keywords, negative-keywords, ads, creatives, product-pages, ad-rejections, reports, impression-share, apps, geo, budget-orders, acls, me), get|post|put|delete, a raw path (/campaigns), docs, or keys"
347
+ }).positional("action", {
348
+ type: "string",
349
+ describe: "list | get | find | create | update | delete | ... (see asa docs <resource>), or the path for a verb"
350
+ }).positional("value", {
351
+ type: "string",
352
+ describe: "Id (comma-separated for bulk), search query, or App Store app id"
353
+ }).options({
354
+ app: {
223
355
  type: "string",
224
- describe: "Path (for a verb), app bundle id / ASC app id (shortcuts), docs path or search, or list|set|rm (keys)"
225
- }).positional("value2", {
356
+ describe: "Superwall app id or name (if several have Apple Search Ads connected)"
357
+ },
358
+ "org-id": {
226
359
  type: "string",
227
- describe: "Team id (keys rm)"
228
- }).options({
229
- d: {
230
- type: "array",
231
- describe: "Request param, Stripe-style: -d key=value (string) or key:=value (number/bool/json); nesting via key[sub]"
232
- },
233
- team: {
234
- type: "string",
235
- describe: "ASC team id (if the org has more than one connected)"
236
- },
237
- force: {
238
- type: "boolean",
239
- describe: "Skip request-body schema validation and send as-is (post/patch)"
240
- },
241
- quiet: {
242
- type: "boolean",
243
- hidden: true
244
- },
245
- "key-id": {
246
- type: "string",
247
- describe: "ASC key id (keys set)"
248
- },
249
- issuer: {
250
- type: "string",
251
- describe: "ASC issuer id (keys set)"
252
- },
253
- "key-file": {
254
- type: "string",
255
- describe: "Path to the .p8 key file (keys set)"
256
- },
257
- name: {
258
- type: "string",
259
- describe: "Account name (keys set)"
260
- },
261
- "dry-run": {
262
- type: "boolean",
263
- hidden: true
264
- }
265
- }), (argv) => {
266
- return import("./asc-D6qBCfuj.js").then((m) => m.runAsc(argv));
267
- }).command("asa <target> [action] [value]", "Call the Apple Search Ads API through Superwall's proxy (no key or token handling)", (y) => y.positional("target", {
360
+ describe: "Apple Search Ads org id (X-AP-Context), if the API user spans several"
361
+ },
362
+ campaign: {
268
363
  type: "string",
269
- describe: "A resource (campaigns, adgroups, keywords, negative-keywords, ads, creatives, product-pages, ad-rejections, reports, impression-share, apps, geo, budget-orders, acls, me), get|post|put|delete, a raw path (/campaigns), docs, or keys"
270
- }).positional("action", {
364
+ describe: "Campaign id"
365
+ },
366
+ adgroup: {
271
367
  type: "string",
272
- describe: "list | get | find | create | update | delete | ... (see asa docs <resource>), or the path for a verb"
273
- }).positional("value", {
368
+ describe: "Ad group id"
369
+ },
370
+ "adam-id": {
274
371
  type: "string",
275
- describe: "Id (comma-separated for bulk), search query, or App Store app id"
276
- }).options({
277
- app: {
278
- type: "string",
279
- describe: "Superwall app id or name (if several have Apple Search Ads connected)"
280
- },
281
- "org-id": {
282
- type: "string",
283
- describe: "Apple Search Ads org id (X-AP-Context), if the API user spans several"
284
- },
285
- campaign: {
286
- type: "string",
287
- describe: "Campaign id"
288
- },
289
- adgroup: {
290
- type: "string",
291
- describe: "Ad group id"
292
- },
293
- "adam-id": {
294
- type: "string",
295
- describe: "App Store app id (adamId)"
296
- },
297
- d: {
298
- type: "array",
299
- describe: "Body field, Stripe-style: -d key=value (string) or key:=value (number/bool/json); nesting via key[sub]. Query params on get/delete"
300
- },
301
- body: {
302
- type: "string",
303
- describe: "Request body as JSON: inline, @file, or @- for stdin"
304
- },
305
- selector: {
306
- type: "string",
307
- describe: "Apple selector as JSON (find, reports): inline, @file, or @-"
308
- },
309
- field: {
310
- type: "string",
311
- describe: "Selector shorthand: field name (with --op and --values)"
312
- },
313
- op: {
314
- type: "string",
315
- describe: "Selector shorthand: EQUALS, IN, CONTAINS, STARTSWITH, ..."
316
- },
317
- values: {
318
- type: "string",
319
- describe: "Selector shorthand: comma-separated values"
320
- },
321
- "order-by": {
322
- type: "string",
323
- describe: "Selector sort: field[:asc|desc]"
324
- },
325
- fields: {
326
- type: "string",
327
- describe: "Comma-separated fields to return (partial fetch)"
328
- },
329
- limit: {
330
- type: "number",
331
- describe: "Page size"
332
- },
333
- offset: {
334
- type: "number",
335
- describe: "Page offset"
336
- },
337
- all: {
338
- type: "boolean",
339
- describe: "Walk every page"
340
- },
341
- currency: {
342
- type: "string",
343
- describe: "Currency for money flags (defaults to the account's)"
344
- },
345
- name: { type: "string" },
346
- status: {
347
- type: "string",
348
- describe: "ENABLED, PAUSED (keywords: ACTIVE, PAUSED)"
349
- },
350
- countries: {
351
- type: "string",
352
- describe: "Comma-separated country codes"
353
- },
354
- budget: {
355
- type: "string",
356
- describe: "Lifetime budget amount"
357
- },
358
- "daily-budget": {
359
- type: "string",
360
- describe: "Daily budget amount"
361
- },
362
- "supply-sources": {
363
- type: "string",
364
- describe: "Comma-separated supply sources"
365
- },
366
- "ad-channel-type": {
367
- type: "string",
368
- describe: "SEARCH or DISPLAY"
369
- },
370
- "billing-event": {
371
- type: "string",
372
- describe: "TAPS or IMPRESSIONS"
373
- },
374
- "default-bid": {
375
- type: "string",
376
- describe: "Ad group default bid"
377
- },
378
- "cpa-goal": {
379
- type: "string",
380
- describe: "Ad group CPA goal"
381
- },
382
- "search-match": {
383
- type: "boolean",
384
- describe: "Ad group Search Match"
385
- },
386
- text: {
387
- type: "string",
388
- describe: "Keyword text"
389
- },
390
- "match-type": {
391
- type: "string",
392
- describe: "BROAD or EXACT"
393
- },
394
- bid: {
395
- type: "string",
396
- describe: "Keyword bid amount"
397
- },
398
- "creative-id": { type: "string" },
399
- type: {
400
- type: "string",
401
- describe: "Creative type"
402
- },
403
- "product-page-id": { type: "string" },
404
- start: {
405
- type: "string",
406
- describe: "Start date (YYYY-MM-DD)"
407
- },
408
- end: {
409
- type: "string",
410
- describe: "End date (YYYY-MM-DD)"
411
- },
412
- granularity: {
413
- type: "string",
414
- describe: "HOURLY, DAILY, WEEKLY, or MONTHLY"
415
- },
416
- "group-by": {
417
- type: "string",
418
- describe: "Report dimension (e.g. countryOrRegion)"
419
- },
420
- "time-zone": {
421
- type: "string",
422
- describe: "Report time zone: UTC or ORTZ"
423
- },
424
- dimensions: {
425
- type: "string",
426
- describe: "Impression share dimensions"
427
- },
428
- metrics: {
429
- type: "string",
430
- describe: "Impression share metrics"
431
- },
432
- owned: {
433
- type: "boolean",
434
- describe: "apps search: only apps this org owns"
435
- },
436
- country: {
437
- type: "string",
438
- describe: "geo search: country code"
439
- },
440
- entity: {
441
- type: "string",
442
- describe: "geo: Country, AdminArea, or Locality"
443
- },
444
- "adgroup-level": {
445
- type: "boolean",
446
- describe: "negative-keywords find: search ad group negatives"
447
- },
448
- states: {
449
- type: "string",
450
- describe: "product-pages list: comma-separated states"
451
- },
452
- "device-classes": { type: "string" },
453
- "language-codes": { type: "string" },
454
- expand: { type: "boolean" },
455
- "include-deleted-assets": { type: "boolean" }
456
- }), (argv) => {
457
- return import("./asa-DlM6dlPD.js").then((m) => m.runAsa(argv));
458
- });
372
+ describe: "App Store app id (adamId)"
373
+ },
374
+ d: {
375
+ type: "array",
376
+ describe: "Body field, Stripe-style: -d key=value (string) or key:=value (number/bool/json); nesting via key[sub]. Query params on get/delete"
377
+ },
378
+ body: {
379
+ type: "string",
380
+ describe: "Request body as JSON: inline, @file, or @- for stdin"
381
+ },
382
+ selector: {
383
+ type: "string",
384
+ describe: "Apple selector as JSON (find, reports): inline, @file, or @-"
385
+ },
386
+ field: {
387
+ type: "string",
388
+ describe: "Selector shorthand: field name (with --op and --values)"
389
+ },
390
+ op: {
391
+ type: "string",
392
+ describe: "Selector shorthand: EQUALS, IN, CONTAINS, STARTSWITH, ..."
393
+ },
394
+ values: {
395
+ type: "string",
396
+ describe: "Selector shorthand: comma-separated values"
397
+ },
398
+ "order-by": {
399
+ type: "string",
400
+ describe: "Selector sort: field[:asc|desc]"
401
+ },
402
+ fields: {
403
+ type: "string",
404
+ describe: "Comma-separated fields to return (partial fetch)"
405
+ },
406
+ limit: {
407
+ type: "number",
408
+ describe: "Page size"
409
+ },
410
+ offset: {
411
+ type: "number",
412
+ describe: "Page offset"
413
+ },
414
+ all: {
415
+ type: "boolean",
416
+ describe: "Walk every page"
417
+ },
418
+ currency: {
419
+ type: "string",
420
+ describe: "Currency for money flags (defaults to the account's)"
421
+ },
422
+ name: {
423
+ type: "string",
424
+ describe: "Name for the created or updated entity"
425
+ },
426
+ status: {
427
+ type: "string",
428
+ describe: "ENABLED, PAUSED (keywords: ACTIVE, PAUSED)"
429
+ },
430
+ countries: {
431
+ type: "string",
432
+ describe: "Comma-separated country codes"
433
+ },
434
+ budget: {
435
+ type: "string",
436
+ describe: "Lifetime budget amount"
437
+ },
438
+ "daily-budget": {
439
+ type: "string",
440
+ describe: "Daily budget amount"
441
+ },
442
+ "supply-sources": {
443
+ type: "string",
444
+ describe: "Comma-separated supply sources"
445
+ },
446
+ "ad-channel-type": {
447
+ type: "string",
448
+ describe: "SEARCH or DISPLAY"
449
+ },
450
+ "billing-event": {
451
+ type: "string",
452
+ describe: "TAPS or IMPRESSIONS"
453
+ },
454
+ "default-bid": {
455
+ type: "string",
456
+ describe: "Ad group default bid"
457
+ },
458
+ "cpa-goal": {
459
+ type: "string",
460
+ describe: "Ad group CPA goal"
461
+ },
462
+ "search-match": {
463
+ type: "boolean",
464
+ describe: "Ad group Search Match"
465
+ },
466
+ text: {
467
+ type: "string",
468
+ describe: "Keyword text"
469
+ },
470
+ "match-type": {
471
+ type: "string",
472
+ describe: "BROAD or EXACT"
473
+ },
474
+ bid: {
475
+ type: "string",
476
+ describe: "Keyword bid amount"
477
+ },
478
+ "creative-id": {
479
+ type: "string",
480
+ describe: "Creative id (ads create)"
481
+ },
482
+ type: {
483
+ type: "string",
484
+ describe: "Creative type"
485
+ },
486
+ "product-page-id": {
487
+ type: "string",
488
+ describe: "Custom product page id"
489
+ },
490
+ start: {
491
+ type: "string",
492
+ describe: "Start date (YYYY-MM-DD)"
493
+ },
494
+ end: {
495
+ type: "string",
496
+ describe: "End date (YYYY-MM-DD)"
497
+ },
498
+ granularity: {
499
+ type: "string",
500
+ describe: "HOURLY, DAILY, WEEKLY, or MONTHLY"
501
+ },
502
+ "group-by": {
503
+ type: "string",
504
+ describe: "Report dimension (e.g. countryOrRegion)"
505
+ },
506
+ "time-zone": {
507
+ type: "string",
508
+ describe: "Report time zone: UTC or ORTZ"
509
+ },
510
+ dimensions: {
511
+ type: "string",
512
+ describe: "Impression share dimensions"
513
+ },
514
+ metrics: {
515
+ type: "string",
516
+ describe: "Impression share metrics"
517
+ },
518
+ owned: {
519
+ type: "boolean",
520
+ describe: "apps search: only apps this org owns"
521
+ },
522
+ country: {
523
+ type: "string",
524
+ describe: "geo search: country code"
525
+ },
526
+ entity: {
527
+ type: "string",
528
+ describe: "geo: Country, AdminArea, or Locality"
529
+ },
530
+ "adgroup-level": {
531
+ type: "boolean",
532
+ describe: "negative-keywords find: search ad group negatives"
533
+ },
534
+ states: {
535
+ type: "string",
536
+ describe: "product-pages list: comma-separated states"
537
+ },
538
+ "device-classes": {
539
+ type: "string",
540
+ describe: "product-pages: comma-separated device classes"
541
+ },
542
+ "language-codes": {
543
+ type: "string",
544
+ describe: "product-pages: comma-separated language codes"
545
+ },
546
+ expand: {
547
+ type: "boolean",
548
+ describe: "product-pages: include nested versions"
549
+ },
550
+ "include-deleted-assets": {
551
+ type: "boolean",
552
+ describe: "product-pages: include deleted assets"
553
+ }
554
+ }), (argv) => {
555
+ return import("./asa-CZcmgOho.js").then((m) => m.runAsa(argv));
556
+ });
557
+
558
+ //#endregion
559
+ //#region src/cli/resources.ts
560
+ const registerResourceCommands = (input) => {
561
+ let cli = input;
459
562
  const RESOURCE_HELP = {
460
563
  orgs: "Your Superwall organizations (list, use <id|name>)",
461
564
  apps: "Your apps, grouped by project (list, create <name> --platform ios, use <id>)"
@@ -529,10 +632,10 @@ async function run() {
529
632
  describe: "Plan without writing"
530
633
  }
531
634
  }), (argv) => {
532
- return import("./resource-CM2bIB5v.js").then((m) => m.runResource(resource)(argv));
635
+ return import("./resource-BZvGoZlY.js").then((m) => m.runResource(resource)(argv));
533
636
  });
534
637
  cli = cli.command("bootstrap", "Complete account tree: orgs, projects, apps, campaigns, placements, and products", (y) => y, (argv) => {
535
- return import("./api-B2Zsf08U.js").then((m) => m.runBootstrap(argv));
638
+ return import("./api-NEcc9ESi.js").then((m) => m.runBootstrap(argv));
536
639
  });
537
640
  for (const verb of API_VERBS) cli = cli.command(`${verb} <path>`, `Make ${verb.toUpperCase()} requests to the Superwall API`, (y) => y.positional("path", {
538
641
  type: "string",
@@ -541,125 +644,78 @@ async function run() {
541
644
  type: "array",
542
645
  describe: "Param, Stripe-style: -d key=value (string) or key:=value (number/bool/json); nesting via key[sub]"
543
646
  } }), (argv) => {
544
- return import("./api-B2Zsf08U.js").then((m) => m.runApi(verb)(argv));
647
+ return import("./api-NEcc9ESi.js").then((m) => m.runApi(verb)(argv));
545
648
  });
546
- cli = cli.command("create [dir]", "Set up paywalls in your app - creates a superwall/ directory inside it", (y) => y.positional("dir", {
547
- type: "string",
548
- describe: "Your app's root (default: cwd) - paywalls land in superwall/ inside it"
549
- }).options({
550
- example: {
551
- type: "string",
552
- describe: "Start from a public example by name, e.g. --example with-rive"
553
- },
554
- yes: {
555
- type: "boolean",
556
- alias: "y",
557
- describe: "Accept defaults and skip the optional prompts"
558
- },
559
- install: {
560
- type: "boolean",
561
- default: true,
562
- describe: "Install dependencies after scaffolding (--no-install to skip)"
563
- },
564
- connect: {
565
- type: "boolean",
566
- default: true,
567
- describe: "Connect a Superwall app when possible (--no-connect to skip)"
568
- }
569
- }).example("$0 create", "Set up superwall/ in the current app").example("$0 create --example with-rive", "Start from an example"), (argv) => {
570
- return import("./create-BTEvRC1X.js").then((m) => m.runCreate(argv));
571
- }).command("dev [dir..]", "Host the studio: browse and preview your paywalls and funnels", (y) => y.positional("dir", {
572
- type: "string",
573
- array: true,
574
- describe: "Project directories to serve (default: cwd)"
575
- }).options({
576
- port: {
577
- type: "number",
578
- default: 6100,
579
- alias: "p",
580
- describe: "Preferred port (falls back to the next free one)"
581
- },
582
- host: {
583
- type: "string",
584
- default: "0.0.0.0",
585
- describe: "Host to bind"
586
- }
587
- }), (argv) => {
588
- return import("./dev-CwfCGm36.js").then((m) => m.runDev(argv));
589
- }).command("push [dir]", "Build and push your paywalls as immutable versions (production untouched)", (y) => y.positional("dir", {
590
- type: "string",
591
- describe: "Project directory (default: cwd)"
592
- }).options({
593
- id: {
594
- type: "array",
595
- string: true,
596
- describe: "Limit to these paywalls or funnels by id (repeatable, or comma-separated)"
597
- },
598
- platform: {
599
- type: "array",
600
- string: true,
601
- describe: "Limit to these platforms (repeatable, or comma-separated) - ios, android, web, flutter, react_native"
602
- },
603
- rename: {
604
- type: "array",
605
- string: true,
606
- describe: "Declare a renamed directory as <old>=<new> (repeatable) - required in CI, where the resolver cannot prompt"
607
- },
608
- message: {
609
- type: "string",
610
- alias: "m",
611
- describe: "Publish note recorded in the source commit (only lands when this publish creates a new source commit — unchanged source reuses the existing commit)"
612
- }
613
- }), (argv) => {
614
- return import("./push-BjEpY9-h.js").then((m) => m.runPush(argv));
615
- }).command("promote [dir]", "Point production at a pushed version (the latest by default)", (y) => y.version(false).positional("dir", {
616
- type: "string",
617
- describe: "Project directory (default: cwd)"
618
- }).options({
619
- id: {
620
- type: "array",
621
- string: true,
622
- describe: "Limit to these paywalls or funnels by id (repeatable, or comma-separated)"
623
- },
624
- platform: {
625
- type: "array",
626
- string: true,
627
- describe: "Limit to these platforms (repeatable, or comma-separated) - ios, android, web, flutter, react_native"
628
- },
629
- version: {
630
- type: "number",
631
- alias: "v",
632
- describe: "Pushed version number to promote (requires a single --id)"
633
- }
634
- }), (argv) => {
635
- return import("./promote-C54bfsg3.js").then((m) => m.runPromote(argv));
636
- }).command("publish [dir]", "Push and promote in one step - build, version, and ship to production", (y) => y.positional("dir", {
649
+ return cli;
650
+ };
651
+
652
+ //#endregion
653
+ //#region src/cli/workflow.ts
654
+ const registerWorkflowCommands = (cli) => cli.command("integrate", "Set up the SDK, placements, and dashboard in your app", (y) => y.options({
655
+ ...installDirOption,
656
+ ...apiKeyOption,
657
+ ...dryRunOption,
658
+ ...skillOption,
659
+ driver: {
637
660
  type: "string",
638
- describe: "Project directory (default: cwd)"
639
- }).options({
640
- id: {
641
- type: "array",
642
- string: true,
643
- describe: "Limit to these paywalls or funnels by id (repeatable, or comma-separated)"
644
- },
645
- platform: {
646
- type: "array",
647
- string: true,
648
- describe: "Limit to these platforms (repeatable, or comma-separated) - ios, android, web, flutter, react_native"
649
- },
650
- rename: {
651
- type: "array",
652
- string: true,
653
- describe: "Declare a renamed directory as <old>=<new> (repeatable) - required in CI, where the resolver cannot prompt"
654
- },
655
- message: {
656
- type: "string",
657
- alias: "m",
658
- describe: "Publish note recorded in the source commit (only lands when this publish creates a new source commit — unchanged source reuses the existing commit)"
659
- }
660
- }), (argv) => {
661
- return import("./publish-NUNSIKri.js").then((m) => m.runPublish(argv));
661
+ choices: [
662
+ "claude",
663
+ "codex",
664
+ "superwall"
665
+ ],
666
+ describe: "Force a coding-agent backend (default: first detected)",
667
+ hidden: true
668
+ }
669
+ }), (argv) => {
670
+ if (argv.skill) return import("./print-skill-DBEmY01G.js").then((m) => m.runPrintSkill("integrate")(argv));
671
+ return import("./integrate-DstRn_NP.js").then((m) => m.runIntegrate(argv));
672
+ }).command("review", "Review an existing Superwall setup end to end", (y) => y.options({
673
+ ...installDirOption,
674
+ ...dryRunOption,
675
+ ...skillOption,
676
+ fix: {
677
+ type: "boolean",
678
+ describe: "Apply verified, safe fixes from the latest review"
679
+ }
680
+ }), (argv) => {
681
+ const id = argv.fix ? "review-fix" : "review";
682
+ if (argv.skill) return import("./print-skill-DBEmY01G.js").then((m) => m.runPrintSkill(id)(argv));
683
+ return import("./integrate-DstRn_NP.js").then((m) => m.runActionCommand(id)(argv));
684
+ }).command("migrate", "Migrate from RevenueCat / Adapty / Qonversion to Superwall", (y) => y.options({
685
+ ...installDirOption,
686
+ "dry-run": {
687
+ type: "boolean",
688
+ describe: "Plan without changes"
689
+ },
690
+ ...skillOption
691
+ }), (argv) => {
692
+ if (argv.skill) return import("./print-skill-DBEmY01G.js").then((m) => m.runPrintSkill("migrate")(argv));
693
+ return import("./migrate-CcwiRU6G.js").then((m) => m.runMigrate(argv));
694
+ });
695
+
696
+ //#endregion
697
+ //#region src/cli.ts
698
+ async function run() {
699
+ const args = hideBin(process.argv);
700
+ if (args.length === 0 || args[0] === "help" || (args[0] === "-h" || args[0] === "--help") && args.length === 1) {
701
+ printHelp();
702
+ return;
703
+ }
704
+ let cli = yargs(args).scriptName("superwall").usage("Superwall CLI\n\n$0 [command]").option("interactive", {
705
+ type: "boolean",
706
+ default: true,
707
+ hidden: true,
708
+ describe: "Allow prompts (use --no-interactive for automation)"
709
+ }).option("json", {
710
+ type: "boolean",
711
+ default: false,
712
+ describe: "Machine-readable output"
662
713
  });
714
+ cli = registerWorkflowCommands(cli);
715
+ cli = registerAccountCommands(cli);
716
+ cli = registerPlatformCommands(cli);
717
+ cli = registerResourceCommands(cli);
718
+ cli = registerPaywallCommands(cli);
663
719
  await cli.command("$0", false, (y) => y, () => printHelp()).version(VERSION).alias("v", "version").help().alias("h", "help").recommendCommands().showHelpOnFail(false).fail((msg, err) => {
664
720
  if (err) throw err;
665
721
  const friendly = msg.replace(/^Unknown arguments?:/, "Unknown command:").replace(/^Not enough non-option arguments.*$/, "Missing a required argument.");