@superwall/cli 1.6.1 → 1.6.2

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 (57) hide show
  1. package/README.md +6 -0
  2. package/dist/{actions-BdZ-7BJd.js → actions-H7f6knyY.js} +2 -2
  3. package/dist/{api-FjrCPu6r.js → api-Dv3LyZ5m.js} +7 -7
  4. package/dist/{app-YeJj35Ia.js → app-mJC5NDtW.js} +7 -7
  5. package/dist/{asa-4nk7HHy8.js → asa-D6H7Pjae.js} +8 -8
  6. package/dist/{asc-2TZOQuK1.js → asc-xCin0akG.js} +9 -9
  7. package/dist/{auth-QUYfKdwk.js → auth-ZlLL-Gko.js} +8 -8
  8. package/dist/auth.js +2 -2
  9. package/dist/{billing-BK7bpv1t.js → billing-C8kBge_S.js} +1 -1
  10. package/dist/{bind-Ch4VR2EY.js → bind-BIzaGq8K.js} +2 -2
  11. package/dist/build-B7BS1rF2.js +87 -0
  12. package/dist/{command-BJ_6850A.js → command-3fGYyC8r.js} +4 -4
  13. package/dist/{create-vSQxQlEP.js → create-CwnnNqv4.js} +20 -19
  14. package/dist/{dev-DEss5dwo.js → dev-CgGAb5Al.js} +9 -6
  15. package/dist/dev-Dx99K183.js +22 -0
  16. package/dist/{doctor-BYTfekBr.js → doctor-CyUvut31.js} +9 -9
  17. package/dist/{drivers-DGml3OlF.js → drivers-6RMOPIdn.js} +2 -2
  18. package/dist/entry.js +99 -32
  19. package/dist/{existing-DgSo639M.js → existing-DHpPn1y6.js} +2 -2
  20. package/dist/feedback-RKyGuQ8_.js +152 -0
  21. package/dist/{hosted-DqGp6oV2.js → hosted-BeGVAntr.js} +2 -2
  22. package/dist/{integrate-Cl9eKHoF.js → integrate-BR2LR-EK.js} +20 -20
  23. package/dist/{login-DS3MPeW2.js → login-Bhxgqwtm.js} +3 -3
  24. package/dist/{migrate-WiTO71PE.js → migrate-C-4ISELN.js} +22 -21
  25. package/dist/{open-studio-CbMUL5Va.js → open-studio-BnVD6tJ9.js} +16 -13
  26. package/dist/{output-XKuoEEjP.js → output-C-4UKMot.js} +1 -1
  27. package/dist/{pipeline-J9-nENTS.js → pipeline-CHX0Syre.js} +9 -494
  28. package/dist/{print-skill-BOGm5Szi.js → print-skill-BiZLdCKv.js} +6 -6
  29. package/dist/{promote-Ci085QxU.js → promote-Pgpz-3xl.js} +15 -14
  30. package/dist/publish-BPeuc3lq.js +35 -0
  31. package/dist/push-DcSQ4odB.js +35 -0
  32. package/dist/{query-BZStoGLM.js → query-CWLaZkdm.js} +7 -7
  33. package/dist/{resource-ClLHSXi6.js → resource-jwASPCrw.js} +11 -11
  34. package/dist/{run-CiaWn78U.js → run-D-NbZLpj.js} +2 -2
  35. package/dist/{scan-DEgX5HxV.js → scan-BmAW413l.js} +1 -1
  36. package/dist/selection-BGi6GyxC.js +496 -0
  37. package/dist/skills/superwall-framework/SKILL.md +109 -36
  38. package/dist/skills/superwall-framework/references/cli.md +45 -5
  39. package/dist/skills/superwall-framework/references/mobile-design.md +60 -181
  40. package/dist/{skills-DsBAVRTE.js → skills-AxAf7bDB.js} +77 -8
  41. package/dist/{skills-DjPCmUMU.js → skills-FK5aDuNV.js} +6 -6
  42. package/dist/{telemetry-EzV7cA7s.js → telemetry-Ch9cCTI-.js} +1 -1
  43. package/dist/{token-r5g876aI.js → token-BGAVPSQc.js} +1 -1
  44. package/dist/{update-Cz3Q3MFj.js → update-DIXbL-H9.js} +2 -2
  45. package/dist/{upgrade-BA_4sdnh.js → upgrade-De7JMI1g.js} +5 -5
  46. package/package.json +2 -2
  47. package/dist/dev-B9qmPH1W.js +0 -21
  48. package/dist/feedback-4LsBpZZx.js +0 -73
  49. package/dist/publish--TV-j8Zd.js +0 -34
  50. package/dist/push-CpGetsJF.js +0 -34
  51. package/dist/skills/superwall-framework/references/responsive.md +0 -162
  52. /package/dist/{api-output-CEhN-U_N.js → api-output-aJNw7Syy.js} +0 -0
  53. /package/dist/{asc-products-1e1DoGeL.js → asc-products-Dvcyef3_.js} +0 -0
  54. /package/dist/{org-CV8c849b.js → org-CQduIOic.js} +0 -0
  55. /package/dist/{params-BxgTuCzr.js → params-l3CrvRtR.js} +0 -0
  56. /package/dist/{reports-C0xHCLnt.js → reports-DqMs9xNR.js} +0 -0
  57. /package/dist/{storekit-Dlpbq5Wv.js → storekit-CC4gnTI6.js} +0 -0
package/dist/entry.js CHANGED
@@ -1,6 +1,6 @@
1
- import { i as writeJson, l as CHANNEL, p as ENV_API_KEY, y as VERSION } from "./output-XKuoEEjP.js";
2
- import { t as flushTelemetry } from "./telemetry-EzV7cA7s.js";
3
- import { n as flushUpdateCheck } from "./update-Cz3Q3MFj.js";
1
+ import { i as writeJson, l as CHANNEL, p as ENV_API_KEY, y as VERSION } from "./output-C-4UKMot.js";
2
+ import { t as flushTelemetry } from "./telemetry-Ch9cCTI-.js";
3
+ import { n as flushUpdateCheck } from "./update-DIXbL-H9.js";
4
4
  import yargs from "yargs";
5
5
  import { hideBin } from "yargs/helpers";
6
6
  import pc from "picocolors";
@@ -56,11 +56,11 @@ const registerAccountCommands = (cli) => cli.command("login", "Log in to Superwa
56
56
  hidden: true
57
57
  }
58
58
  }), (argv) => {
59
- return import("./auth-QUYfKdwk.js").then((m) => m.runLogin(argv));
59
+ return import("./auth-ZlLL-Gko.js").then((m) => m.runLogin(argv));
60
60
  }).command("logout", "Log out of Superwall", (y) => y, (argv) => {
61
- return import("./auth-QUYfKdwk.js").then((m) => m.runLogout(argv));
61
+ return import("./auth-ZlLL-Gko.js").then((m) => m.runLogout(argv));
62
62
  }).command("whoami", "Show the logged-in Superwall account", (y) => y, (argv) => {
63
- return import("./auth-QUYfKdwk.js").then((m) => m.runWhoami(argv));
63
+ return import("./auth-ZlLL-Gko.js").then((m) => m.runWhoami(argv));
64
64
  }).command("skills", "Install or update the Superwall agent skills for your coding agent", (y) => y.options({
65
65
  skill: {
66
66
  type: "array",
@@ -81,16 +81,58 @@ const registerAccountCommands = (cli) => cli.command("login", "Log in to Superwa
81
81
  hidden: true
82
82
  }
83
83
  }), (argv) => {
84
- return import("./skills-DjPCmUMU.js").then((m) => m.runSkills(argv));
84
+ return import("./skills-FK5aDuNV.js").then((m) => m.runSkills(argv));
85
85
  }).command("doctor", "Check the health of your Superwall integration", (y) => y.options({ ...installDirOption }), (argv) => {
86
- return import("./doctor-BYTfekBr.js").then((m) => m.runDoctor(argv));
86
+ return import("./doctor-CyUvut31.js").then((m) => m.runDoctor(argv));
87
87
  }).command("upgrade", "Update the CLI to the latest version", (y) => y, (argv) => {
88
- return import("./upgrade-BA_4sdnh.js").then((m) => m.runUpgrade(argv));
89
- }).command("feedback [message]", "Send feedback about the CLI to the Superwall team", (y) => y.positional("message", {
88
+ return import("./upgrade-De7JMI1g.js").then((m) => m.runUpgrade(argv));
89
+ }).command("feedback [message]", "Report a bug or send feedback to the Superwall team", (y) => y.positional("message", {
90
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-4LsBpZZx.js").then((m) => m.runFeedback(argv));
91
+ describe: "What happened: what you ran, what you expected, what you got (omit to be prompted)"
92
+ }).options({
93
+ title: {
94
+ type: "string",
95
+ describe: "One-line summary"
96
+ },
97
+ kind: {
98
+ type: "string",
99
+ choices: [
100
+ "bug",
101
+ "docs",
102
+ "idea",
103
+ "praise",
104
+ "other"
105
+ ],
106
+ describe: "What this is (default: other)"
107
+ },
108
+ command: {
109
+ type: "string",
110
+ describe: "The command or call that misbehaved"
111
+ },
112
+ project: {
113
+ type: "string",
114
+ describe: "Project id it happened in (defaults to this directory's linked app)"
115
+ },
116
+ app: {
117
+ type: "string",
118
+ describe: "App id it happened in (defaults to this directory's linked app)"
119
+ },
120
+ context: {
121
+ type: "string",
122
+ array: true,
123
+ describe: "Repro context as key=value, repeatable (paywall=…, placement=…, sdk=ios@4.5.0, device=…)"
124
+ },
125
+ file: {
126
+ type: "string",
127
+ array: true,
128
+ describe: "Attach a log or snippet (repeatable, max 5; '-' reads stdin; long files keep the last 20k chars)"
129
+ },
130
+ agent: {
131
+ type: "string",
132
+ describe: "The agent sending it (auto-detected when possible)"
133
+ }
134
+ }).example("$0 feedback \"migrate crashed on Expo\"", "Send feedback").example("$0 feedback \"push fails with 413 on a 2MB asset; expected upload\" --title \"push 413 on large asset\" --kind bug --command \"superwall push\" --app 123 --context paywall=pw_abc --file push.log --json", "For agents: a full bug report"), (argv) => {
135
+ return import("./feedback-RKyGuQ8_.js").then((m) => m.runFeedback(argv));
94
136
  });
95
137
 
96
138
  //#endregion
@@ -117,11 +159,12 @@ function printHelp() {
117
159
  head("Paywalls & funnels"),
118
160
  row("create [dir]", "Set up paywalls in your app - creates superwall/ inside it"),
119
161
  row("dev [dir..]", "Host the studio: browse and preview your paywalls and funnels"),
162
+ row("build [dir]", "Build the snapshot documents a push would version, without pushing"),
120
163
  row("push [dir]", "Build and push your paywalls and funnels as immutable versions"),
121
164
  row("promote [dir]", "Point production at a pushed version"),
122
165
  row("publish [dir]", "Push and promote in one step"),
123
166
  pc.dim(" push and publish take -m <note> to record why, in the source commit."),
124
- pc.dim(" All three take --platform <p> when the project pushes to several platforms."),
167
+ pc.dim(" All four take --platform <p> when the project pushes to several platforms."),
125
168
  ""
126
169
  ] : [],
127
170
  head("Resource commands"),
@@ -152,7 +195,7 @@ function printHelp() {
152
195
  row("skills", "Install or update the Superwall agent skills"),
153
196
  row("doctor", "Check the health of your integration"),
154
197
  row("upgrade", "Update the CLI to the latest version"),
155
- row("feedback", "Send feedback about the CLI to the Superwall team"),
198
+ row("feedback", "Report a bug or send feedback to the Superwall team"),
156
199
  "",
157
200
  pc.bold("Flags:"),
158
201
  row("--json", "Machine-readable output"),
@@ -199,7 +242,7 @@ const registerPaywallCommands = (cli) => cli.command("create [dir]", "Set up pay
199
242
  describe: "Connect a Superwall app when possible (--no-connect to skip)"
200
243
  }
201
244
  }).example("$0 create", "Set up superwall/ in the current app").example("$0 create --example with-rive", "Start from an example").example("$0 create --from 65920", "Rebuild dashboard paywall 65920 as code").example("$0 create --app 52518", "Connect a specific Superwall app"), (argv) => {
202
- return import("./create-vSQxQlEP.js").then((m) => m.runCreate(argv));
245
+ return import("./create-CwnnNqv4.js").then((m) => m.runCreate(argv));
203
246
  }).command("dev [dir..]", "Host the studio: browse and preview your paywalls and funnels", (y) => y.positional("dir", {
204
247
  type: "string",
205
248
  array: true,
@@ -222,7 +265,31 @@ const registerPaywallCommands = (cli) => cli.command("create [dir]", "Set up pay
222
265
  describe: "Open the browser at this studio path once the server is up"
223
266
  }
224
267
  }), (argv) => {
225
- return import("./dev-B9qmPH1W.js").then((m) => m.runDev(argv));
268
+ return import("./dev-Dx99K183.js").then((m) => m.runDev(argv));
269
+ }).command("build [dir]", "Build your paywalls into the snapshot documents a push would version, without pushing", (y) => y.positional("dir", {
270
+ type: "string",
271
+ describe: "Project directory (default: cwd)"
272
+ }).options({
273
+ id: {
274
+ type: "array",
275
+ string: true,
276
+ describe: "Limit to these paywalls or funnels by id (repeatable, or comma-separated)"
277
+ },
278
+ platform: {
279
+ type: "array",
280
+ string: true,
281
+ describe: "Build for these platforms (repeatable, or comma-separated) - ios, android, web. Default: one platform-neutral document"
282
+ },
283
+ out: {
284
+ type: "string",
285
+ describe: "Directory to write into (default: superwall/.superwall/build)"
286
+ },
287
+ json: {
288
+ type: "boolean",
289
+ describe: "Print the built files as JSON"
290
+ }
291
+ }).example("$0 build --id plus-upgrade --platform ios", "Build one paywall for iOS").example("$0 build --json", "Build everything and list the files as JSON"), (argv) => {
292
+ return import("./build-B7BS1rF2.js").then((m) => m.runBuild(argv));
226
293
  }).command("push [dir]", "Build and push your paywalls as immutable versions (production untouched)", (y) => y.positional("dir", {
227
294
  type: "string",
228
295
  describe: "Project directory (default: cwd)"
@@ -248,7 +315,7 @@ const registerPaywallCommands = (cli) => cli.command("create [dir]", "Set up pay
248
315
  describe: "Publish note recorded in the source commit (only lands when this publish creates a new source commit — unchanged source reuses the existing commit)"
249
316
  }
250
317
  }), (argv) => {
251
- return import("./push-CpGetsJF.js").then((m) => m.runPush(argv));
318
+ return import("./push-DcSQ4odB.js").then((m) => m.runPush(argv));
252
319
  }).command("promote [dir]", "Point production at a pushed version (the latest by default)", (y) => y.version(false).positional("dir", {
253
320
  type: "string",
254
321
  describe: "Project directory (default: cwd)"
@@ -269,7 +336,7 @@ const registerPaywallCommands = (cli) => cli.command("create [dir]", "Set up pay
269
336
  describe: "Pushed version number to promote (requires a single --id)"
270
337
  }
271
338
  }), (argv) => {
272
- return import("./promote-Ci085QxU.js").then((m) => m.runPromote(argv));
339
+ return import("./promote-Pgpz-3xl.js").then((m) => m.runPromote(argv));
273
340
  }).command("publish [dir]", "Push and promote in one step - build, version, and ship to production", (y) => y.positional("dir", {
274
341
  type: "string",
275
342
  describe: "Project directory (default: cwd)"
@@ -295,7 +362,7 @@ const registerPaywallCommands = (cli) => cli.command("create [dir]", "Set up pay
295
362
  describe: "Publish note recorded in the source commit (only lands when this publish creates a new source commit — unchanged source reuses the existing commit)"
296
363
  }
297
364
  }), (argv) => {
298
- return import("./publish--TV-j8Zd.js").then((m) => m.runPublish(argv));
365
+ return import("./publish-BPeuc3lq.js").then((m) => m.runPublish(argv));
299
366
  });
300
367
 
301
368
  //#endregion
@@ -307,7 +374,7 @@ const registerPlatformCommands = (cli) => cli.command("query [sql]", "Run SQL ag
307
374
  type: "string",
308
375
  describe: "Read SQL from a .sql file"
309
376
  } }).example("$0 query \"SHOW TABLES FROM sw\"", "Run an inline query").example("$0 query --file report.sql --json", "Run a saved query"), (argv) => {
310
- return import("./query-BZStoGLM.js").then((m) => m.runQuery(argv));
377
+ return import("./query-CWLaZkdm.js").then((m) => m.runQuery(argv));
311
378
  }).command("asc <target> [value] [value2]", "Call the App Store Connect API through Superwall's signed proxy (no .p8 / JWT needed)", (y) => y.positional("target", {
312
379
  type: "string",
313
380
  describe: "get|post|patch|delete, a raw path (/v1/...), or: apps | products | subscriptions | iaps | docs | keys"
@@ -357,7 +424,7 @@ const registerPlatformCommands = (cli) => cli.command("query [sql]", "Run SQL ag
357
424
  describe: "Plan without writing"
358
425
  }
359
426
  }), (argv) => {
360
- return import("./asc-2TZOQuK1.js").then((m) => m.runAsc(argv));
427
+ return import("./asc-xCin0akG.js").then((m) => m.runAsc(argv));
361
428
  }).command("asa <target> [action] [value]", "Call the Apple Search Ads API through Superwall's proxy (no key or token handling)", (y) => y.positional("target", {
362
429
  type: "string",
363
430
  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"
@@ -569,7 +636,7 @@ const registerPlatformCommands = (cli) => cli.command("query [sql]", "Run SQL ag
569
636
  describe: "product-pages: include deleted assets"
570
637
  }
571
638
  }), (argv) => {
572
- return import("./asa-4nk7HHy8.js").then((m) => m.runAsa(argv));
639
+ return import("./asa-D6H7Pjae.js").then((m) => m.runAsa(argv));
573
640
  });
574
641
 
575
642
  //#endregion
@@ -649,10 +716,10 @@ const registerResourceCommands = (input) => {
649
716
  describe: "Plan without writing"
650
717
  }
651
718
  }), (argv) => {
652
- return import("./resource-ClLHSXi6.js").then((m) => m.runResource(resource)(argv));
719
+ return import("./resource-jwASPCrw.js").then((m) => m.runResource(resource)(argv));
653
720
  });
654
721
  cli = cli.command("bootstrap", "Complete account tree: orgs, projects, apps, campaigns, placements, and products", (y) => y, (argv) => {
655
- return import("./api-FjrCPu6r.js").then((m) => m.runBootstrap(argv));
722
+ return import("./api-Dv3LyZ5m.js").then((m) => m.runBootstrap(argv));
656
723
  });
657
724
  for (const verb of API_VERBS) cli = cli.command(`${verb} <path>`, `Make ${verb.toUpperCase()} requests to the Superwall API`, (y) => y.positional("path", {
658
725
  type: "string",
@@ -661,7 +728,7 @@ const registerResourceCommands = (input) => {
661
728
  type: "array",
662
729
  describe: "Param, Stripe-style: -d key=value (string) or key:=value (number/bool/json); nesting via key[sub]"
663
730
  } }), (argv) => {
664
- return import("./api-FjrCPu6r.js").then((m) => m.runApi(verb)(argv));
731
+ return import("./api-Dv3LyZ5m.js").then((m) => m.runApi(verb)(argv));
665
732
  });
666
733
  return cli;
667
734
  };
@@ -694,8 +761,8 @@ const registerWorkflowCommands = (cli) => cli.command("integrate", "Set up the S
694
761
  hidden: true
695
762
  }
696
763
  }), (argv) => {
697
- if (argv.skill) return import("./print-skill-BOGm5Szi.js").then((m) => m.runPrintSkill("integrate")(argv));
698
- return import("./integrate-Cl9eKHoF.js").then((m) => m.runIntegrate(argv));
764
+ if (argv.skill) return import("./print-skill-BiZLdCKv.js").then((m) => m.runPrintSkill("integrate")(argv));
765
+ return import("./integrate-BR2LR-EK.js").then((m) => m.runIntegrate(argv));
699
766
  }).command("review", "Review an existing Superwall setup end to end", (y) => y.options({
700
767
  ...installDirOption,
701
768
  ...dryRunOption,
@@ -706,8 +773,8 @@ const registerWorkflowCommands = (cli) => cli.command("integrate", "Set up the S
706
773
  }
707
774
  }), (argv) => {
708
775
  const id = argv.fix ? "review-fix" : "review";
709
- if (argv.skill) return import("./print-skill-BOGm5Szi.js").then((m) => m.runPrintSkill(id)(argv));
710
- return import("./integrate-Cl9eKHoF.js").then((m) => m.runActionCommand(id)(argv));
776
+ if (argv.skill) return import("./print-skill-BiZLdCKv.js").then((m) => m.runPrintSkill(id)(argv));
777
+ return import("./integrate-BR2LR-EK.js").then((m) => m.runActionCommand(id)(argv));
711
778
  }).command(CHANNEL() === "next" ? "migrate [paywall]" : "migrate", CHANNEL() === "next" ? "Migrate from RevenueCat / Adapty / Qonversion, or rebuild a dashboard paywall or a native screen as code" : "Migrate from RevenueCat / Adapty / Qonversion", (y) => {
712
779
  const base = y.options({
713
780
  ...installDirOption,
@@ -723,8 +790,8 @@ const registerWorkflowCommands = (cli) => cli.command("integrate", "Set up the S
723
790
  describe: "A dashboard paywall id: scaffold it as code (if not already) and rebuild its pages with your agent, or copy the prompt"
724
791
  }).options(migrateNextOptions).example("$0 migrate 65920", "Rebuild dashboard paywall 65920 as code").example("$0 migrate --screen App/UpdateRequiredView.swift", "Rebuild a native screen as a Superwall surface");
725
792
  }, (argv) => {
726
- if (argv.skill && argv.paywall === void 0 && argv.screen === void 0) return import("./print-skill-BOGm5Szi.js").then((m) => m.runPrintSkill("migrate")(argv));
727
- return import("./migrate-WiTO71PE.js").then((m) => m.runMigrate(argv));
793
+ if (argv.skill && argv.paywall === void 0 && argv.screen === void 0) return import("./print-skill-BiZLdCKv.js").then((m) => m.runPrintSkill("migrate")(argv));
794
+ return import("./migrate-C-4ISELN.js").then((m) => m.runMigrate(argv));
728
795
  });
729
796
 
730
797
  //#endregion
@@ -1,5 +1,5 @@
1
- import { m as Integration } from "./output-XKuoEEjP.js";
2
- import { n as allDeps, r as readPackageJson } from "./scan-DEgX5HxV.js";
1
+ import { m as Integration } from "./output-C-4UKMot.js";
2
+ import { n as allDeps, r as readPackageJson } from "./scan-BmAW413l.js";
3
3
  import { readFileSync } from "node:fs";
4
4
  import fg from "fast-glob";
5
5
 
@@ -0,0 +1,152 @@
1
+ import { _ as TELEMETRY_HOST, v as TELEMETRY_KEY, y as VERSION } from "./output-C-4UKMot.js";
2
+ import { a as getAnonymousId, s as getOnboardedApp } from "./telemetry-Ch9cCTI-.js";
3
+ import "./update-DIXbL-H9.js";
4
+ import { i as loadSession } from "./token-BGAVPSQc.js";
5
+ import { t as defineCommand } from "./command-3fGYyC8r.js";
6
+ import "./ui-4gLyfrgl.js";
7
+ import { basename } from "node:path";
8
+ import { arch, release } from "node:os";
9
+ import { readFileSync } from "node:fs";
10
+
11
+ //#region src/core/feedback.ts
12
+ const FEEDBACK_KINDS = [
13
+ "bug",
14
+ "docs",
15
+ "idea",
16
+ "praise",
17
+ "other"
18
+ ];
19
+ const MAX_FILES = 5;
20
+ const MAX_FILE_CHARS = 2e4;
21
+ function parseContext(pairs) {
22
+ const out = {};
23
+ for (const pair of pairs) {
24
+ const at = pair.indexOf("=");
25
+ if (at < 1) throw new Error(`--context expects key=value, got "${pair}"`);
26
+ out[pair.slice(0, at).trim()] = pair.slice(at + 1).trim();
27
+ }
28
+ return out;
29
+ }
30
+ function linkedApp(cwd = process.cwd()) {
31
+ const app = getOnboardedApp(cwd);
32
+ return {
33
+ projectId: app?.projectId,
34
+ applicationId: app?.applicationId
35
+ };
36
+ }
37
+ const AGENT_ENV = [
38
+ ["CLAUDECODE", "claude-code"],
39
+ ["CODEX_SANDBOX", "codex"],
40
+ ["CURSOR_AGENT", "cursor"],
41
+ ["GEMINI_CLI", "gemini-cli"]
42
+ ];
43
+ function detectAgent(env = process.env) {
44
+ return AGENT_ENV.find(([key]) => env[key])?.[1];
45
+ }
46
+ /** Reads `--file` paths (`-` = stdin), keeping the base name and the tail of long logs. */
47
+ function readAttachments(paths) {
48
+ if (paths.length > MAX_FILES) throw new Error(`Attach at most ${MAX_FILES} files.`);
49
+ return paths.map((path) => {
50
+ const raw = readFileSync(path === "-" ? 0 : path, "utf8");
51
+ const truncated = raw.length > MAX_FILE_CHARS;
52
+ return {
53
+ name: path === "-" ? "stdin" : basename(path),
54
+ content: truncated ? raw.slice(-MAX_FILE_CHARS) : raw,
55
+ truncated
56
+ };
57
+ });
58
+ }
59
+ function buildFeedbackEvent(feedback, via, distinctId, session) {
60
+ return {
61
+ api_key: TELEMETRY_KEY(),
62
+ event: "feedback submitted",
63
+ distinct_id: distinctId,
64
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
65
+ properties: {
66
+ $process_person_profile: false,
67
+ title: feedback.title ?? null,
68
+ message: feedback.message,
69
+ kind: feedback.kind,
70
+ command: feedback.command ?? null,
71
+ project_id: feedback.projectId ?? null,
72
+ application_id: feedback.applicationId ?? null,
73
+ context: feedback.context,
74
+ attachments: feedback.attachments,
75
+ via,
76
+ agent: feedback.agent ?? null,
77
+ cli_version: VERSION,
78
+ platform: process.platform,
79
+ os_release: release(),
80
+ arch: arch(),
81
+ node_version: process.version,
82
+ ci: process.env.CI === "true",
83
+ email: session?.userEmail ?? null,
84
+ org_id: session?.orgId ?? null,
85
+ org_name: session?.orgName ?? null,
86
+ auth_method: session?.authMethod ?? null
87
+ }
88
+ };
89
+ }
90
+ async function submitFeedback(feedback, via) {
91
+ if (!TELEMETRY_KEY()) return false;
92
+ const payload = buildFeedbackEvent(feedback, via, getAnonymousId(), loadSession());
93
+ try {
94
+ return (await fetch(`${TELEMETRY_HOST()}/capture/`, {
95
+ method: "POST",
96
+ headers: { "content-type": "application/json" },
97
+ body: JSON.stringify(payload),
98
+ signal: AbortSignal.timeout(8e3)
99
+ })).ok;
100
+ } catch {
101
+ return false;
102
+ }
103
+ }
104
+
105
+ //#endregion
106
+ //#region src/commands/account/feedback.ts
107
+ const runFeedback = defineCommand({
108
+ name: "feedback",
109
+ output: "both",
110
+ async run(ctx) {
111
+ const { ui, json, interactive, argv } = ctx;
112
+ let message = argv.message?.trim();
113
+ if (!message && interactive) {
114
+ ui.intro("Superwall feedback");
115
+ const answer = await ui.text({
116
+ message: "What's your feedback on Superwall?",
117
+ placeholder: "What worked, what didn't, what's missing...",
118
+ validate: (v) => v?.trim() ? void 0 : "Required"
119
+ });
120
+ if (answer === null) return void ui.warn("Cancelled.");
121
+ message = answer.trim();
122
+ }
123
+ if (!message) throw new Error("Usage: superwall feedback \"<message>\" [--title ...] [--kind bug] [--file log.txt]");
124
+ const kind = argv.kind ?? "other";
125
+ if (!FEEDBACK_KINDS.includes(kind)) throw new Error(`--kind must be one of: ${FEEDBACK_KINDS.join(", ")}`);
126
+ const agent = argv.agent?.trim() || detectAgent();
127
+ const attachments = readAttachments([].concat(argv.file ?? []).map(String).filter(Boolean));
128
+ const context = parseContext([].concat(argv.context ?? []).map(String));
129
+ const linked = linkedApp();
130
+ const via = agent || !interactive ? "agent" : "human";
131
+ const spin = interactive ? ui.spinner() : null;
132
+ spin?.start("Sending your feedback");
133
+ const ok = await submitFeedback({
134
+ title: argv.title?.trim() || void 0,
135
+ message,
136
+ kind,
137
+ command: argv.command?.trim() || void 0,
138
+ agent,
139
+ projectId: argv.project ?? linked.projectId,
140
+ applicationId: argv.app ?? linked.applicationId,
141
+ context,
142
+ attachments
143
+ }, via);
144
+ spin?.stop(ok ? "Sent" : "Failed to send");
145
+ if (json) return ctx.output.data({ submitted: ok });
146
+ if (!ok) throw new Error("Couldn't send your feedback - check your connection and try again.");
147
+ ui.success("Thank you! We've received your feedback and will read through it. Really appreciate you helping us make Superwall better.");
148
+ }
149
+ });
150
+
151
+ //#endregion
152
+ export { runFeedback };
@@ -1,5 +1,5 @@
1
- import { o as API_HOST } from "./output-XKuoEEjP.js";
2
- import { i as loadSession, t as getOAuthAccessToken } from "./token-r5g876aI.js";
1
+ import { o as API_HOST } from "./output-C-4UKMot.js";
2
+ import { i as loadSession, t as getOAuthAccessToken } from "./token-BGAVPSQc.js";
3
3
 
4
4
  //#region src/core/agent/hosted.ts
5
5
  const STATUS_PATH = "/v2/cli-agent/status";
@@ -1,27 +1,27 @@
1
- import { b as apiKeyFromEnv, f as DASHBOARD_URL, r as formatJson, t as blocks, y as VERSION } from "./output-XKuoEEjP.js";
2
- import { r as setTelemetryTags, s as getOnboardedApp } from "./telemetry-EzV7cA7s.js";
3
- import "./update-Cz3Q3MFj.js";
4
- import { i as loadSession } from "./token-r5g876aI.js";
5
- import { a as superwallApi, t as defineCommand } from "./command-BJ_6850A.js";
1
+ import { b as apiKeyFromEnv, f as DASHBOARD_URL, r as formatJson, t as blocks, y as VERSION } from "./output-C-4UKMot.js";
2
+ import { r as setTelemetryTags, s as getOnboardedApp } from "./telemetry-Ch9cCTI-.js";
3
+ import "./update-DIXbL-H9.js";
4
+ import { i as loadSession } from "./token-BGAVPSQc.js";
5
+ import { a as superwallApi, t as defineCommand } from "./command-3fGYyC8r.js";
6
6
  import { i as stripReport, n as ui } from "./ui-4gLyfrgl.js";
7
- import { n as ensureSkillsCurrent } from "./skills-DsBAVRTE.js";
7
+ import { n as ensureSkillsCurrent } from "./skills-AxAf7bDB.js";
8
8
  import "./spawn-DSoTXy_j.js";
9
- import "./login-DS3MPeW2.js";
10
- import { i as SUPPORTED_LABEL, t as scanProject } from "./scan-DEgX5HxV.js";
11
- import { t as detectDrivers } from "./drivers-DGml3OlF.js";
12
- import "./hosted-DqGp6oV2.js";
13
- import { t as detectExisting } from "./existing-DgSo639M.js";
9
+ import "./login-Bhxgqwtm.js";
10
+ import { i as SUPPORTED_LABEL, t as scanProject } from "./scan-BmAW413l.js";
11
+ import { t as detectDrivers } from "./drivers-6RMOPIdn.js";
12
+ import "./hosted-BeGVAntr.js";
13
+ import { t as detectExisting } from "./existing-DHpPn1y6.js";
14
14
  import { t as withSpinner } from "./spinner-DFctF_Jw.js";
15
15
  import { T as rowName, b as platformLabel, g as listResource, o as createProduct, p as listApplications } from "./resources-Bf9O1JNM.js";
16
- import "./org-CV8c849b.js";
17
- import { n as resolveAppBinding, r as resolveScopeFromKey, t as platformForIntegration } from "./bind-Ch4VR2EY.js";
18
- import { r as actionById } from "./actions-BdZ-7BJd.js";
19
- import { a as recoverUnmatchedScope, i as pickApp, n as ensureAgentDriverReady, o as stage, r as performLoginWithUi, t as chooseAction } from "./app-YeJj35Ia.js";
20
- import { a as copyToClipboard, r as buildCopyPrompt, t as runAction } from "./run-CiaWn78U.js";
21
- import { c as listAscConfigs, i as listAscApps, n as fetchUnimportedAscProducts, o as createAscConfig, r as findAscAppId, t as ascTypeDisplay } from "./asc-products-1e1DoGeL.js";
22
- import { t as generateStoreKit } from "./storekit-Dlpbq5Wv.js";
23
- import { n as saveReport, t as loadReport } from "./reports-C0xHCLnt.js";
24
- import { t as detectBilling } from "./billing-BK7bpv1t.js";
16
+ import "./org-CQduIOic.js";
17
+ import { n as resolveAppBinding, r as resolveScopeFromKey, t as platformForIntegration } from "./bind-BIzaGq8K.js";
18
+ import { r as actionById } from "./actions-H7f6knyY.js";
19
+ import { a as recoverUnmatchedScope, i as pickApp, n as ensureAgentDriverReady, o as stage, r as performLoginWithUi, t as chooseAction } from "./app-mJC5NDtW.js";
20
+ import { a as copyToClipboard, r as buildCopyPrompt, t as runAction } from "./run-D-NbZLpj.js";
21
+ import { c as listAscConfigs, i as listAscApps, n as fetchUnimportedAscProducts, o as createAscConfig, r as findAscAppId, t as ascTypeDisplay } from "./asc-products-Dvcyef3_.js";
22
+ import { t as generateStoreKit } from "./storekit-CC4gnTI6.js";
23
+ import { n as saveReport, t as loadReport } from "./reports-DqMs9xNR.js";
24
+ import { t as detectBilling } from "./billing-C8kBge_S.js";
25
25
  import { basename, join } from "node:path";
26
26
  import { homedir } from "node:os";
27
27
  import { readFileSync, writeFileSync } from "node:fs";
@@ -1,6 +1,6 @@
1
- import { c as AUTH_HOST, d as CLI_CLIENT_ID, h as OAUTH_SCOPE, m as Integration, o as API_HOST } from "./output-XKuoEEjP.js";
2
- import { c as getOnboardedOrg, l as getOnboardingIdempotencyKey, m as setOnboardedOrg, p as setOnboardedApp } from "./telemetry-EzV7cA7s.js";
3
- import { a as saveSession } from "./token-r5g876aI.js";
1
+ import { c as AUTH_HOST, d as CLI_CLIENT_ID, h as OAUTH_SCOPE, m as Integration, o as API_HOST } from "./output-C-4UKMot.js";
2
+ import { c as getOnboardedOrg, l as getOnboardingIdempotencyKey, m as setOnboardedOrg, p as setOnboardedApp } from "./telemetry-Ch9cCTI-.js";
3
+ import { a as saveSession } from "./token-BGAVPSQc.js";
4
4
  import { n as ui } from "./ui-4gLyfrgl.js";
5
5
  import { spawn } from "node:child_process";
6
6
 
@@ -1,28 +1,29 @@
1
- import { f as DASHBOARD_URL, t as blocks, y as VERSION } from "./output-XKuoEEjP.js";
2
- import "./telemetry-EzV7cA7s.js";
3
- import "./update-Cz3Q3MFj.js";
4
- import { i as loadSession } from "./token-r5g876aI.js";
5
- import { t as defineCommand } from "./command-BJ_6850A.js";
1
+ import { f as DASHBOARD_URL, t as blocks, y as VERSION } from "./output-C-4UKMot.js";
2
+ import "./telemetry-Ch9cCTI-.js";
3
+ import "./update-DIXbL-H9.js";
4
+ import { i as loadSession } from "./token-BGAVPSQc.js";
5
+ import { t as defineCommand } from "./command-3fGYyC8r.js";
6
6
  import { i as stripReport, n as ui } from "./ui-4gLyfrgl.js";
7
- import "./skills-DsBAVRTE.js";
7
+ import "./skills-AxAf7bDB.js";
8
8
  import "./spawn-DSoTXy_j.js";
9
- import "./login-DS3MPeW2.js";
10
- import { t as scanProject } from "./scan-DEgX5HxV.js";
11
- import { t as detectDrivers } from "./drivers-DGml3OlF.js";
12
- import "./hosted-DqGp6oV2.js";
13
- import { t as detectExisting } from "./existing-DgSo639M.js";
9
+ import "./login-Bhxgqwtm.js";
10
+ import { t as scanProject } from "./scan-BmAW413l.js";
11
+ import { t as detectDrivers } from "./drivers-6RMOPIdn.js";
12
+ import "./hosted-BeGVAntr.js";
13
+ import { t as detectExisting } from "./existing-DHpPn1y6.js";
14
14
  import "./spinner-DFctF_Jw.js";
15
15
  import "./resources-Bf9O1JNM.js";
16
- import "./org-CV8c849b.js";
17
- import "./bind-Ch4VR2EY.js";
18
- import { A as requireApi } from "./pipeline-J9-nENTS.js";
19
- import { r as actionById } from "./actions-BdZ-7BJd.js";
20
- import { r as performLoginWithUi } from "./app-YeJj35Ia.js";
21
- import { t as runAction } from "./run-CiaWn78U.js";
22
- import { _ as screenNameOf, a as buildMigrationCopyPrompt, c as migrationFor, d as projectDirOf, f as scaffoldFromPaywall, g as placementOfName, h as findScreenCandidates, i as startStudio, l as migrationSource, m as screenMigrationFor, n as migrationNextSteps, o as hasOriginal, p as scaffoldFromScreen, r as screenNextSteps, t as askStudio, u as offerMigration } from "./open-studio-CbMUL5Va.js";
23
- import "./dev-DEss5dwo.js";
24
- import { n as saveReport } from "./reports-C0xHCLnt.js";
25
- import { t as detectBilling } from "./billing-BK7bpv1t.js";
16
+ import "./selection-BGi6GyxC.js";
17
+ import "./org-CQduIOic.js";
18
+ import "./bind-BIzaGq8K.js";
19
+ import { _ as requireApi } from "./pipeline-CHX0Syre.js";
20
+ import { r as actionById } from "./actions-H7f6knyY.js";
21
+ import { r as performLoginWithUi } from "./app-mJC5NDtW.js";
22
+ import { t as runAction } from "./run-D-NbZLpj.js";
23
+ import { _ as screenNameOf, a as buildMigrationCopyPrompt, c as migrationFor, d as projectDirOf, f as scaffoldFromPaywall, g as placementOfName, h as findScreenCandidates, i as startStudio, l as migrationSource, m as screenMigrationFor, n as migrationNextSteps, o as hasOriginal, p as scaffoldFromScreen, r as screenNextSteps, t as askStudio, u as offerMigration } from "./open-studio-BnVD6tJ9.js";
24
+ import "./dev-CgGAb5Al.js";
25
+ import { n as saveReport } from "./reports-DqMs9xNR.js";
26
+ import { t as detectBilling } from "./billing-C8kBge_S.js";
26
27
  import * as path from "node:path";
27
28
  import * as os$1 from "node:os";
28
29
  import * as fs from "node:fs";