@superwall/cli 1.1.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 (85) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +201 -0
  3. package/dist/actions-MB-eBY64.js +140 -0
  4. package/dist/api-BF7-toqM.js +151 -0
  5. package/dist/api-output-B5hh0q4V.js +20 -0
  6. package/dist/app-K6j9Es7h.js +189 -0
  7. package/dist/asc-CArSwo5D.js +539 -0
  8. package/dist/asc-products-YQ6Oc6YO.js +93 -0
  9. package/dist/auth-CY2cO_NF.js +139 -0
  10. package/dist/auth.d.ts +30 -0
  11. package/dist/auth.js +4 -0
  12. package/dist/billing-DWyfEQ6l.js +80 -0
  13. package/dist/bind-hslFhcTR.js +213 -0
  14. package/dist/chunk-DQxbwPpZ.js +30 -0
  15. package/dist/command-Kwx4ekbo.js +283 -0
  16. package/dist/create-Bbi8BOO1.js +410 -0
  17. package/dist/dev-D0lQDCQI.js +397 -0
  18. package/dist/devtools-8EgLo86w.js +3638 -0
  19. package/dist/doctor-ByeRdMcl.js +88 -0
  20. package/dist/drivers-DVAZgone.js +413 -0
  21. package/dist/entry.d.ts +9 -0
  22. package/dist/entry.js +495 -0
  23. package/dist/existing-CcJrIIAU.js +88 -0
  24. package/dist/feedback-Z0Wk7VC5.js +73 -0
  25. package/dist/git-3OX9u3xE.js +433 -0
  26. package/dist/hosted-CHwaUqLd.js +32 -0
  27. package/dist/integrate-DqOAqK7J.js +863 -0
  28. package/dist/json-C3hPIMkI.js +7 -0
  29. package/dist/login-Dr8UN_Gx.js +290 -0
  30. package/dist/migrate-D92bJTg6.js +114 -0
  31. package/dist/org-B2gy9Pmu.js +40 -0
  32. package/dist/params-Bvq0iqQK.js +52 -0
  33. package/dist/pipeline-CHHIg6BU.js +1056 -0
  34. package/dist/print-skill-BnZAk7dV.js +74 -0
  35. package/dist/promote-CRe9170G.js +88 -0
  36. package/dist/publish-DsODvrOD.js +35 -0
  37. package/dist/push-BDkZUC0v.js +35 -0
  38. package/dist/query-DIllrSnk.js +53 -0
  39. package/dist/resource-CdP1MDla.js +483 -0
  40. package/dist/resources-CVrWwA1K.js +233 -0
  41. package/dist/run-cGGBUMs5.js +89 -0
  42. package/dist/scan-BQexuUPO.js +236 -0
  43. package/dist/skills-DhuUs28u.js +64 -0
  44. package/dist/skills-xrfXt9u0.js +205 -0
  45. package/dist/spawn-DSoTXy_j.js +69 -0
  46. package/dist/spinner-gOxIMz-V.js +18 -0
  47. package/dist/storekit-Ddvs4Ynw.js +29 -0
  48. package/dist/telemetry-CcfrtXdf.js +204 -0
  49. package/dist/token-DHRH8cxi.js +102 -0
  50. package/dist/ui-C4ncRJqd.js +27703 -0
  51. package/dist/update-BiVeR024.js +137 -0
  52. package/dist/upgrade-DYWspApv.js +72 -0
  53. package/package.json +87 -0
  54. package/prompts/actions/dashboard-setup.xml +10 -0
  55. package/prompts/actions/integrate.xml +5 -0
  56. package/prompts/actions/migrate.xml +11 -0
  57. package/prompts/actions/placements-implement.xml +20 -0
  58. package/prompts/actions/placements-review.xml +18 -0
  59. package/prompts/actions/review-fix.xml +18 -0
  60. package/prompts/actions/review.xml +18 -0
  61. package/prompts/commandments.xml +17 -0
  62. package/prompts/context.xml +9 -0
  63. package/skills/README.md +118 -0
  64. package/skills/superwall-dashboard/SKILL.md +81 -0
  65. package/skills/superwall-dashboard/references/setup.md +101 -0
  66. package/skills/superwall-integrate/SKILL.md +76 -0
  67. package/skills/superwall-integrate/references/expo.md +269 -0
  68. package/skills/superwall-integrate/references/flutter.md +285 -0
  69. package/skills/superwall-integrate/references/ios.md +314 -0
  70. package/skills/superwall-integrate/references/react-native.md +245 -0
  71. package/skills/superwall-migrate/SKILL.md +83 -0
  72. package/skills/superwall-migrate/references/adapty.md +229 -0
  73. package/skills/superwall-migrate/references/qonversion.md +227 -0
  74. package/skills/superwall-migrate/references/revenuecat.md +414 -0
  75. package/skills/superwall-placements/SKILL.md +73 -0
  76. package/skills/superwall-placements/references/expo.md +161 -0
  77. package/skills/superwall-placements/references/flutter.md +139 -0
  78. package/skills/superwall-placements/references/ios.md +165 -0
  79. package/skills/superwall-placements/references/react-native.md +145 -0
  80. package/skills/superwall-placements/references/strategy.md +221 -0
  81. package/skills/superwall-review/SKILL.md +75 -0
  82. package/skills/superwall-review/references/expo.md +100 -0
  83. package/skills/superwall-review/references/flutter.md +99 -0
  84. package/skills/superwall-review/references/ios.md +108 -0
  85. package/skills/superwall-review/references/react-native.md +100 -0
@@ -0,0 +1,88 @@
1
+ import { a as apiKeyFromEnv } from "./telemetry-CcfrtXdf.js";
2
+ import "./json-C3hPIMkI.js";
3
+ import "./update-BiVeR024.js";
4
+ import { i as loadSession } from "./token-DHRH8cxi.js";
5
+ import { t as defineCommand } from "./command-Kwx4ekbo.js";
6
+ import { a as fg, i as THEME, n as ui } from "./ui-C4ncRJqd.js";
7
+ import "./spawn-DSoTXy_j.js";
8
+ import { t as scanProject } from "./scan-BQexuUPO.js";
9
+ import { t as detectDrivers } from "./drivers-DVAZgone.js";
10
+ import "./hosted-CHwaUqLd.js";
11
+ import { t as detectExisting } from "./existing-CcJrIIAU.js";
12
+
13
+ //#region src/commands/account/doctor.ts
14
+ const runDoctor = defineCommand({
15
+ name: "doctor",
16
+ auth: "optional",
17
+ output: "both",
18
+ async run(ctx) {
19
+ ui.intro("Superwall doctor");
20
+ const spin = ui.spinner();
21
+ spin.start("Checking your setup");
22
+ const drivers = await detectDrivers();
23
+ const scan = await scanProject(ctx.installDir);
24
+ spin.stop("Checks complete");
25
+ const top = scan.apps[0];
26
+ const existing = top ? detectExisting(top) : null;
27
+ const session = loadSession();
28
+ const rows = [
29
+ [
30
+ drivers.length > 0,
31
+ "Coding agent",
32
+ drivers.map((d) => d.info.displayName).join(", ") || "none found"
33
+ ],
34
+ top ? [
35
+ true,
36
+ "Project",
37
+ `${top.framework.name}${top.details ? ` · ${top.details}` : ""}`
38
+ ] : scan.unsupported[0] ? [
39
+ false,
40
+ "Project",
41
+ `${scan.unsupported[0].framework.name} (not supported by this command)`
42
+ ] : [
43
+ false,
44
+ "Project",
45
+ "not detected"
46
+ ],
47
+ ...existing ? [
48
+ [
49
+ existing.sdkInstalled,
50
+ "SDK",
51
+ existing.sdkInstalled ? "installed" : "not installed"
52
+ ],
53
+ [
54
+ existing.configureFound,
55
+ "configure()",
56
+ existing.configureFound ? "present" : "missing"
57
+ ],
58
+ [
59
+ !!existing.apiKey,
60
+ "API key",
61
+ existing.apiKey ?? "none in project"
62
+ ]
63
+ ] : [],
64
+ [
65
+ !!session || !!apiKeyFromEnv(),
66
+ "Logged in",
67
+ session ? session.userEmail ?? session.orgName ?? "yes" : apiKeyFromEnv() ? "via SUPERWALL_API_KEY" : "no - run `superwall login`"
68
+ ]
69
+ ];
70
+ if (ctx.json) {
71
+ const checks = rows.map(([ok, label, value]) => ({
72
+ ok,
73
+ label,
74
+ value
75
+ }));
76
+ return ctx.output.data({
77
+ ok: checks.every((check) => check.ok),
78
+ checks
79
+ });
80
+ }
81
+ ui.report(rows.map(([ok, label, value]) => `${ok ? fg(THEME.primary, "✓") : fg(THEME.alert, "✗")} ${label.padEnd(13)} ${value}`).join("\n"));
82
+ const failed = rows.filter(([ok]) => !ok).length;
83
+ ui.outro(failed === 0 ? "All checks passed." : `${failed} of ${rows.length} checks need attention.`);
84
+ }
85
+ });
86
+
87
+ //#endregion
88
+ export { runDoctor };
@@ -0,0 +1,413 @@
1
+ import { k as VERSION } from "./telemetry-CcfrtXdf.js";
2
+ import { n as readVersion, r as spawnStream, t as onPath } from "./spawn-DSoTXy_j.js";
3
+ import { n as getHostedAuthToken, r as getHostedStatus, t as getHostedAnthropicBaseUrl } from "./hosted-CHwaUqLd.js";
4
+ import { tmpdir } from "node:os";
5
+ import { basename, join } from "node:path";
6
+ import { readFile, rm } from "node:fs/promises";
7
+ import { query } from "@anthropic-ai/claude-agent-sdk";
8
+
9
+ //#region src/core/agent/drivers/limits.ts
10
+ const USAGE_LIMIT_PATTERNS = [
11
+ /\b(?:session|usage) limit\b/i,
12
+ /\b(?:daily|weekly|monthly) limit (?:hit|reached|exceeded)\b/i,
13
+ /\b(?:credit|credits|quota) (?:is |are )?exhausted\b/i,
14
+ /\b(?:out of|no) (?:credits?|usage) remaining\b/i
15
+ ];
16
+ function isUsageLimitText(text) {
17
+ return !!text && USAGE_LIMIT_PATTERNS.some((pattern) => pattern.test(text));
18
+ }
19
+
20
+ //#endregion
21
+ //#region src/core/agent/drivers/capabilities.ts
22
+ function toolsForCapabilities(capabilities) {
23
+ const tools = [
24
+ "Read",
25
+ "Glob",
26
+ "Grep"
27
+ ];
28
+ if (capabilities.filesystem === "write") tools.push("Write", "Edit");
29
+ if (capabilities.shell !== "none") tools.push("Bash");
30
+ if (capabilities.network) tools.push("WebFetch", "WebSearch");
31
+ return tools;
32
+ }
33
+
34
+ //#endregion
35
+ //#region src/core/agent/drivers/claude.ts
36
+ const BIN$1 = "claude";
37
+ function toolSummary$1(name, input) {
38
+ const i = input ?? {};
39
+ if (typeof i.file_path === "string") return `${name} ${basename(i.file_path)}`;
40
+ if (typeof i.command === "string") return `${name}: ${String(i.command).slice(0, 60)}`;
41
+ if (typeof i.pattern === "string") return `${name} ${i.pattern}`;
42
+ return name;
43
+ }
44
+ function extractStatus$1(text) {
45
+ return text.match(/\[STATUS\]\s*(.+?)\s*$/m)?.[1]?.trim();
46
+ }
47
+ function emitAssistant$1(message, onEvent) {
48
+ if (!onEvent) return;
49
+ const content = message?.content;
50
+ if (!Array.isArray(content)) return;
51
+ for (const block of content) if (block?.type === "text" && typeof block.text === "string") {
52
+ const status = extractStatus$1(block.text);
53
+ if (status) onEvent({
54
+ type: "status",
55
+ text: status
56
+ });
57
+ else if (block.text.trim()) onEvent({
58
+ type: "text",
59
+ text: block.text.trim()
60
+ });
61
+ } else if (block?.type === "tool_use" && typeof block.name === "string") onEvent({
62
+ type: "tool",
63
+ name: block.name,
64
+ summary: toolSummary$1(block.name, block.input)
65
+ });
66
+ }
67
+ const claudeDriver = {
68
+ id: "claude",
69
+ displayName: "Claude Code",
70
+ async detect() {
71
+ if (!await onPath(BIN$1)) return null;
72
+ return {
73
+ id: "claude",
74
+ displayName: "Claude Code",
75
+ bin: BIN$1,
76
+ version: await readVersion(BIN$1)
77
+ };
78
+ },
79
+ async run(opts) {
80
+ const args = buildClaudeArgs(opts);
81
+ let finalText;
82
+ let ok = false;
83
+ let usageLimited = false;
84
+ const { code } = await spawnStream({
85
+ bin: BIN$1,
86
+ args,
87
+ cwd: opts.cwd,
88
+ signal: opts.signal,
89
+ onStdoutLine: (line) => {
90
+ if (isUsageLimitText(line)) usageLimited = true;
91
+ let msg;
92
+ try {
93
+ msg = JSON.parse(line);
94
+ } catch {
95
+ return;
96
+ }
97
+ if (msg.type === "assistant") emitAssistant$1(msg.message, opts.onEvent);
98
+ else if (msg.type === "result") {
99
+ if (typeof msg.result === "string") finalText = msg.result;
100
+ ok = msg.subtype === "success" && msg.is_error !== true;
101
+ }
102
+ },
103
+ onStderrLine: (line) => {
104
+ if (isUsageLimitText(line)) usageLimited = true;
105
+ }
106
+ });
107
+ if (code !== 0 && !ok) opts.onEvent?.({
108
+ type: "error",
109
+ message: `claude exited with code ${code}`
110
+ });
111
+ return {
112
+ finalText,
113
+ ok,
114
+ failureReason: !ok && (usageLimited || isUsageLimitText(finalText)) ? "usage-limit" : void 0
115
+ };
116
+ }
117
+ };
118
+ function buildClaudeArgs(opts) {
119
+ const args = [
120
+ "-p",
121
+ opts.prompt,
122
+ "--output-format",
123
+ "stream-json",
124
+ "--verbose",
125
+ "--permission-mode",
126
+ opts.capabilities.filesystem === "read" ? "plan" : "acceptEdits",
127
+ "--add-dir",
128
+ opts.cwd,
129
+ "--allowedTools",
130
+ toolsForCapabilities(opts.capabilities).join(",")
131
+ ];
132
+ if (opts.systemAppend) args.push("--append-system-prompt", opts.systemAppend);
133
+ return args;
134
+ }
135
+
136
+ //#endregion
137
+ //#region src/core/agent/drivers/codex.ts
138
+ const BIN = "codex";
139
+ function normalizeCodexEvent(msg, onEvent) {
140
+ if (!onEvent) return;
141
+ const item = msg.item ?? null;
142
+ const node = msg.msg ?? null ?? item ?? msg;
143
+ const t = String(node.type ?? msg.type ?? "");
144
+ if (t.includes("agent_message") || t.includes("assistant")) {
145
+ const text = node.message ?? node.text ?? node.delta;
146
+ if (typeof text === "string" && text.trim()) {
147
+ const status = text.match(/\[STATUS\]\s*(.+?)\s*$/m)?.[1];
148
+ if (status) onEvent({
149
+ type: "status",
150
+ text: status.trim()
151
+ });
152
+ else onEvent({
153
+ type: "text",
154
+ text: text.trim()
155
+ });
156
+ }
157
+ } else if (t.includes("command") || t.includes("exec") || t.includes("patch") || t.includes("file")) {
158
+ const cmd = node.command;
159
+ onEvent({
160
+ type: "tool",
161
+ name: "exec",
162
+ summary: Array.isArray(cmd) ? cmd.join(" ").slice(0, 60) : void 0
163
+ });
164
+ }
165
+ }
166
+ const codexDriver = {
167
+ id: "codex",
168
+ displayName: "Codex",
169
+ async detect() {
170
+ if (!await onPath(BIN)) return null;
171
+ return {
172
+ id: "codex",
173
+ displayName: "Codex",
174
+ bin: BIN,
175
+ version: await readVersion(BIN)
176
+ };
177
+ },
178
+ async run(opts) {
179
+ const lastMsgFile = join(tmpdir(), `superwall-codex-${process.pid}-${Date.now()}.txt`);
180
+ const args = buildCodexArgs(opts, lastMsgFile);
181
+ let ok = false;
182
+ let usageLimited = false;
183
+ const { code } = await spawnStream({
184
+ bin: BIN,
185
+ args,
186
+ cwd: opts.cwd,
187
+ signal: opts.signal,
188
+ onStdoutLine: (line) => {
189
+ if (isUsageLimitText(line)) usageLimited = true;
190
+ try {
191
+ normalizeCodexEvent(JSON.parse(line), opts.onEvent);
192
+ } catch {}
193
+ },
194
+ onStderrLine: (line) => {
195
+ if (isUsageLimitText(line)) usageLimited = true;
196
+ }
197
+ });
198
+ ok = code === 0;
199
+ let finalText;
200
+ try {
201
+ finalText = (await readFile(lastMsgFile, "utf8")).trim() || void 0;
202
+ } catch {} finally {
203
+ await rm(lastMsgFile, { force: true }).catch(() => {});
204
+ }
205
+ if (!ok) opts.onEvent?.({
206
+ type: "error",
207
+ message: `codex exited with code ${code}`
208
+ });
209
+ return {
210
+ finalText,
211
+ ok,
212
+ failureReason: !ok && (usageLimited || isUsageLimitText(finalText)) ? "usage-limit" : void 0
213
+ };
214
+ }
215
+ };
216
+ function buildCodexArgs(opts, lastMsgFile) {
217
+ const prompt = opts.systemAppend ? `${opts.systemAppend}\n\n---\n\n${opts.prompt}` : opts.prompt;
218
+ const readOnly = opts.capabilities.filesystem === "read";
219
+ const args = [
220
+ "exec",
221
+ prompt,
222
+ "--json",
223
+ "--sandbox",
224
+ readOnly ? "read-only" : "workspace-write"
225
+ ];
226
+ if (opts.capabilities.network) args.push("-c", `${readOnly ? "sandbox_read_only" : "sandbox_workspace_write"}.network_access=true`);
227
+ args.push("-C", opts.cwd, "--skip-git-repo-check", "--output-last-message", lastMsgFile);
228
+ return args;
229
+ }
230
+
231
+ //#endregion
232
+ //#region src/core/agent/drivers/superwall.ts
233
+ const SDK_MODEL_ALIAS = "claude-sonnet-5";
234
+ function toolSummary(name, input) {
235
+ const i = input ?? {};
236
+ if (typeof i.file_path === "string") return `${name} ${basename(i.file_path)}`;
237
+ if (typeof i.command === "string") return `${name}: ${String(i.command).slice(0, 60)}`;
238
+ if (typeof i.pattern === "string") return `${name} ${i.pattern}`;
239
+ return name;
240
+ }
241
+ function extractStatus(text) {
242
+ return text.match(/\[STATUS\]\s*(.+?)\s*$/m)?.[1]?.trim();
243
+ }
244
+ function emitAssistant(message, onEvent) {
245
+ if (!onEvent) return;
246
+ const content = message?.content;
247
+ if (!Array.isArray(content)) return;
248
+ for (const block of content) if (block?.type === "text" && typeof block.text === "string") {
249
+ const status = extractStatus(block.text);
250
+ if (status) onEvent({
251
+ type: "status",
252
+ text: status
253
+ });
254
+ else if (block.text.trim()) onEvent({
255
+ type: "text",
256
+ text: block.text.trim()
257
+ });
258
+ } else if (block?.type === "tool_use" && typeof block.name === "string") onEvent({
259
+ type: "tool",
260
+ name: block.name,
261
+ summary: toolSummary(block.name, block.input)
262
+ });
263
+ }
264
+ function resultText(message) {
265
+ if (message.type !== "result") return void 0;
266
+ if ("result" in message && typeof message.result === "string") return message.result;
267
+ if ("errors" in message && Array.isArray(message.errors)) return message.errors.join("\n");
268
+ }
269
+ function buildEnv(token) {
270
+ return {
271
+ ...process.env,
272
+ ANTHROPIC_BASE_URL: getHostedAnthropicBaseUrl(),
273
+ ANTHROPIC_AUTH_TOKEN: token,
274
+ ANTHROPIC_API_KEY: "",
275
+ ANTHROPIC_MODEL: SDK_MODEL_ALIAS,
276
+ ANTHROPIC_DEFAULT_SONNET_MODEL: SDK_MODEL_ALIAS,
277
+ ANTHROPIC_DEFAULT_OPUS_MODEL: SDK_MODEL_ALIAS,
278
+ ANTHROPIC_DEFAULT_HAIKU_MODEL: SDK_MODEL_ALIAS,
279
+ CLAUDE_CODE_SUBAGENT_MODEL: SDK_MODEL_ALIAS,
280
+ CLAUDE_AGENT_SDK_CLIENT_APP: `superwall-cli/${VERSION}`,
281
+ CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: "1",
282
+ CLAUDE_CODE_MAX_RETRIES: "2"
283
+ };
284
+ }
285
+ async function getRunAuth() {
286
+ const token = await getHostedAuthToken();
287
+ if (!token) return {
288
+ ok: false,
289
+ message: "Sign in with `superwall login` to use the bundled Superwall Agent."
290
+ };
291
+ const status = await getHostedStatus();
292
+ if (!status) return {
293
+ ok: false,
294
+ message: "The hosted Superwall Agent is unavailable right now."
295
+ };
296
+ if (status.exhausted) return {
297
+ ok: false,
298
+ message: "Your hosted Superwall Agent credit is exhausted."
299
+ };
300
+ return {
301
+ ok: true,
302
+ token
303
+ };
304
+ }
305
+ const superwallDriver = {
306
+ id: "superwall",
307
+ displayName: "Superwall Agent",
308
+ async detect() {
309
+ return {
310
+ id: "superwall",
311
+ displayName: "Superwall Agent",
312
+ bin: "claude-agent-sdk"
313
+ };
314
+ },
315
+ async run(opts) {
316
+ const auth = await getRunAuth();
317
+ if (!auth.ok) {
318
+ opts.onEvent?.({
319
+ type: "error",
320
+ message: auth.message
321
+ });
322
+ return {
323
+ ok: false,
324
+ finalText: auth.message,
325
+ failureReason: isUsageLimitText(auth.message) ? "usage-limit" : void 0
326
+ };
327
+ }
328
+ const abortController = new AbortController();
329
+ const onAbort = () => abortController.abort(opts.signal?.reason);
330
+ if (opts.signal?.aborted) onAbort();
331
+ else opts.signal?.addEventListener("abort", onAbort, { once: true });
332
+ let finalText;
333
+ let ok = false;
334
+ try {
335
+ const options = {
336
+ abortController,
337
+ cwd: opts.cwd,
338
+ tools: {
339
+ type: "preset",
340
+ preset: "claude_code"
341
+ },
342
+ allowedTools: toolsForCapabilities(opts.capabilities),
343
+ disallowedTools: opts.capabilities.filesystem === "read" ? [
344
+ "Write",
345
+ "Edit",
346
+ "MultiEdit",
347
+ "NotebookEdit"
348
+ ] : void 0,
349
+ permissionMode: opts.capabilities.filesystem === "read" ? "plan" : "acceptEdits",
350
+ systemPrompt: opts.systemAppend ? {
351
+ type: "preset",
352
+ preset: "claude_code",
353
+ append: opts.systemAppend
354
+ } : {
355
+ type: "preset",
356
+ preset: "claude_code"
357
+ },
358
+ model: SDK_MODEL_ALIAS,
359
+ settingSources: [],
360
+ strictMcpConfig: true,
361
+ persistSession: false,
362
+ env: buildEnv(auth.token),
363
+ stderr: () => {}
364
+ };
365
+ for await (const message of query({
366
+ prompt: opts.prompt,
367
+ options
368
+ })) if (message.type === "assistant") emitAssistant(message.message, opts.onEvent);
369
+ else if (message.type === "result") {
370
+ finalText = resultText(message);
371
+ ok = message.subtype === "success" && message.is_error !== true;
372
+ }
373
+ } catch (e) {
374
+ const message = e instanceof Error ? e.message : String(e);
375
+ opts.onEvent?.({
376
+ type: "error",
377
+ message
378
+ });
379
+ return {
380
+ ok: false,
381
+ finalText: message,
382
+ failureReason: isUsageLimitText(message) ? "usage-limit" : void 0
383
+ };
384
+ } finally {
385
+ opts.signal?.removeEventListener("abort", onAbort);
386
+ }
387
+ return {
388
+ finalText,
389
+ ok,
390
+ failureReason: !ok && isUsageLimitText(finalText) ? "usage-limit" : void 0
391
+ };
392
+ }
393
+ };
394
+
395
+ //#endregion
396
+ //#region src/core/agent/drivers/index.ts
397
+ const ALL_DRIVERS = [
398
+ claudeDriver,
399
+ codexDriver,
400
+ superwallDriver
401
+ ];
402
+ async function detectDrivers() {
403
+ return (await Promise.all(ALL_DRIVERS.map(async (driver) => {
404
+ const info = await driver.detect();
405
+ return info ? {
406
+ driver,
407
+ info
408
+ } : null;
409
+ }))).filter((r) => r !== null);
410
+ }
411
+
412
+ //#endregion
413
+ export { detectDrivers as t };
@@ -0,0 +1,9 @@
1
+ //#region src/entry.d.ts
2
+ /**
3
+ * The CLI's programmatic entrypoint: the `superwall` package's bin calls
4
+ * this after registering tsx (which is what lets the paywall commands load
5
+ * the project's framework TypeScript at runtime).
6
+ */
7
+ declare function main(): Promise<void>;
8
+ //#endregion
9
+ export { main };