@superwall/cli 2.6.0-beta.1 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -16
- package/dist/{apple-Bmt_iywx.js → apple-D-rfsuDA.js} +17 -19
- package/dist/{approve-D2UgqaRx.js → approve-aPc5RoXB.js} +14 -13
- package/dist/{assets-B_quADds.js → assets-PyuXe45Y.js} +3 -3
- package/dist/auth.d.ts +11 -4
- package/dist/auth.js +4 -5
- package/dist/base-CAU0hWoI.js +82 -0
- package/dist/{billing-ZIETn0j4.js → billing-Dt6L_l9R.js} +3 -3
- package/dist/{build-BWjXurjs.js → build-CY5FnMNY.js} +35 -16
- package/dist/config-DOp5oChe.js +377 -0
- package/dist/{create-C3uklw-U.js → create-BZL5VH4L.js} +41 -41
- package/dist/{create-BCIgjRHn.js → create-D6w3UL0m.js} +9 -9
- package/dist/create-DM5Y1Pyk.js +18 -0
- package/dist/{doctor-D2Q1EZe8.js → doctor-C9FR0qw3.js} +50 -10
- package/dist/entry.js +45 -40
- package/dist/{environment-BocmdvZ-.js → environment-sE2wZYdg.js} +1 -1
- package/dist/{drivers-BQkO5tHs.js → existing--peXpOZj.js} +305 -8
- package/dist/framework-DW5fqjh4.js +65 -0
- package/dist/{source-BccdO4aL.js → git-Hf9Wc7Hp.js} +34 -92
- package/dist/{held-Bykbwy-m.js → held-CUBCOCGP.js} +8 -8
- package/dist/held-DVxvPMSG.js +15 -0
- package/dist/{install-dXZZ79Oe.js → install-C5d82gZF.js} +15 -17
- package/dist/{integrate-DiSjlOjC.js → integrate-D8J_X1bj.js} +33 -38
- package/dist/{login-5sWIKDI2.js → login-C6X7JrhM.js} +8 -9
- package/dist/{login-Jp6E6d2e.js → login-DXhm9L0F.js} +3 -3
- package/dist/login-et319ESO.js +13 -0
- package/dist/{lookup-CWzVfPpq.js → lookup-DqmIbUkv.js} +28 -4
- package/dist/{migrate-BKiOUsMY.js → migrate-BYF6hKZ2.js} +66 -45
- package/dist/{notification-url-BDBxbwZq.js → notification-url-Bo54nkXv.js} +4 -4
- package/dist/{open-DNd49kT-.js → open-xdgXUzaF.js} +2 -2
- package/dist/{org-Dud1rF9f.js → org-BD8U3D1_.js} +4 -4
- package/dist/{organization-7vJA3uy1.js → organization-D-ZlB3qU.js} +4 -4
- package/dist/{orgs-Z0H9WOs1.js → orgs-DQQJ3sw_.js} +1 -2
- package/dist/{paths-CzTJVpfi.js → paths-CIlyzF2I.js} +1 -1
- package/dist/{playbook-DJ__edOW.js → playbook-ecggWGFi.js} +10 -14
- package/dist/{products-Cqq59DBQ.js → products-CJq_iXv5.js} +1 -1
- package/dist/{promote-DLtPSvmL.js → promote-QVMLGYlU.js} +27 -28
- package/dist/{pull-AoUmaiMK.js → pull-CCXhb2a7.js} +72 -26
- package/dist/{pull-D-YuT3e0.js → pull-CrdsfsAl.js} +33 -39
- package/dist/pull-h71pL3r_.js +30 -0
- package/dist/push-BIq6R8Ro.js +29 -0
- package/dist/push-D6pJM_vv.js +21 -0
- package/dist/{push-BMblzg_6.js → push-DJMGG7zW.js} +23 -12
- package/dist/{push-BrzMFd4Z.js → push-DiMDwGfe.js} +15 -8
- package/dist/{registry-DDU10_Ix.js → registry-BSnQXft4.js} +1288 -901
- package/dist/registry-YwzTfCNc.js +22 -0
- package/dist/{resolve-DpOSDDdr.js → resolve-DO7bPota.js} +52 -6
- package/dist/{resources-CptT7HD6.js → resources-XwvXA20E.js} +15 -2
- package/dist/{run-r3foWfhV.js → run-B-YvxfRc.js} +15 -17
- package/dist/scan-B36wkZmI.js +4 -0
- package/dist/{scan-nVQO7JLx.js → scan-ViBhmrB7.js} +1 -1
- package/dist/{scope-l1qGLsgz.js → scope-BLLUxbrA.js} +24 -18
- package/dist/{scope-ehZ7L1nj.js → scope-Cg1AdAfO.js} +33 -3
- package/dist/screenshot-file-Dix2Qynm.js +127 -0
- package/dist/{sdk-DEfQttek.js → sdk-BFunw4Hc.js} +1 -1
- package/dist/{framework-CLmf4swr.js → selection-C07e_GGY.js} +4 -54
- package/dist/{series-D2ZpZ8cx.js → series-B8NJK4yS.js} +1 -1
- package/dist/{server-DLARhh1k.js → server-CBtHzl9y.js} +40 -18
- package/dist/server-CZwSfzKe.js +33 -0
- package/dist/{base-ChTi42M0.js → session-BfVx50iA.js} +8 -83
- package/dist/{session-Z0BeaJPf.js → session-BlrwAdGN.js} +1 -1
- package/dist/session-Cip4j99n.js +5 -0
- package/dist/{migration-Z69tLeHC.js → setup-a4B72xJ8.js} +290 -28
- package/dist/skills/superwall/SKILL.md +37 -10
- package/dist/skills/superwall/references/api.md +66 -21
- package/dist/skills/superwall/references/asa.md +109 -64
- package/dist/skills/superwall/references/dashboard-links.md +65 -28
- package/dist/skills/superwall/references/data-analytics.md +1 -1
- package/dist/skills/superwall/workflows/dashboard/setup.md +15 -5
- package/dist/skills/superwall/workflows/integrate/flutter.md +9 -7
- package/dist/skills/superwall-artifacts/SKILL.md +7 -2
- package/dist/skills/superwall-artifacts/references/cli.md +4 -1
- package/dist/skills/superwall-framework/SKILL.md +197 -14
- package/dist/skills/superwall-framework/references/cli.md +98 -7
- package/dist/skills/superwall-framework/references/examples.md +2 -2
- package/dist/skills/superwall-framework/references/migrate-from-editor.md +5 -0
- package/dist/skills/superwall-framework/references/migrate-from-native.md +5 -0
- package/dist/{skills-421SFEyF.js → skills-BB1uIt8t.js} +139 -9
- package/dist/{skills-CdKwaTRS.js → skills-SnxFa2in.js} +8 -12
- package/dist/source-DQs6iLtC.js +82 -0
- package/dist/{source-push-B4s6r9bB.js → source-push-w7miTr6m.js} +38 -14
- package/dist/{spinner-DPdBlZe2.js → spinner-BQp7fQvK.js} +7 -5
- package/dist/{starter-0OdVPH4l.js → starter-BlJ_InZJ.js} +16 -6
- package/dist/{status-Dsc7d3z2.js → status-DxsIw9zq.js} +9 -11
- package/dist/{output-Ggzq5_-t.js → storage-BR6imSqm.js} +40 -1
- package/dist/storekit-BqyujKQ_.js +203 -0
- package/dist/storekit-ELVCMF0X.js +15 -0
- package/dist/{bind-ClFjTt0U.js → theme-Ed0gz6hr.js} +29 -6
- package/dist/token-CWQ6tdva.js +100 -0
- package/dist/tools-skills/animate-onboarding/SKILL.md +1 -1
- package/dist/tools-skills/mobile-design/SKILL.md +1 -1
- package/dist/tools-skills/onboarding-questions/SKILL.md +1 -1
- package/dist/tools-skills/superwall/SKILL.md +43 -17
- package/dist/tools-skills/superwall/references/api.md +74 -24
- package/dist/tools-skills/superwall/references/asa.md +109 -64
- package/dist/tools-skills/superwall/references/dashboard-links.md +65 -28
- package/dist/tools-skills/superwall/references/data-analytics.md +1 -1
- package/dist/tools-skills/superwall/workflows/dashboard/playbook.md +4 -3
- package/dist/tools-skills/superwall/workflows/dashboard/setup.md +21 -8
- package/dist/tools-skills/superwall/workflows/integrate/flutter.md +9 -7
- package/dist/tools-skills/superwall/workflows/migrate/adapty.md +4 -3
- package/dist/tools-skills/superwall/workflows/migrate/playbook.md +2 -2
- package/dist/tools-skills/superwall/workflows/migrate/qonversion.md +4 -3
- package/dist/tools-skills/superwall/workflows/migrate/revenuecat.md +4 -3
- package/dist/tools-skills/superwall-editor/SKILL.md +2 -3
- package/dist/tools.d.ts +6 -1
- package/dist/tools.js +1290 -747
- package/dist/{try-B8FYkTvQ.js → try-C3HW3hPZ.js} +20 -22
- package/dist/{lock-DgSx-p8Y.js → types-Dc9U_4kp.js} +86 -80
- package/dist/upgrade-Cw9jVt-r.js +348 -0
- package/dist/upgrade-DVsonzDF.js +27 -0
- package/package.json +11 -3
- package/dist/client-CyrYJzBF.js +0 -180
- package/dist/config-CGcG7GOt.js +0 -113
- package/dist/create-7HDW3DCl.js +0 -20
- package/dist/existing-Cl5x6_5u.js +0 -97
- package/dist/held-Chw3BtBV.js +0 -17
- package/dist/log-C0MDCfA2.js +0 -62
- package/dist/login-DZ8Pipf6.js +0 -17
- package/dist/pull-C1xm2zqG.js +0 -36
- package/dist/push-B42D8fKf.js +0 -22
- package/dist/push-Co5jk6Kr.js +0 -30
- package/dist/run-c1O2_8pp.js +0 -100
- package/dist/scan-D86kLtM7.js +0 -4
- package/dist/screenshot-file-XAS0Xy0e.js +0 -16
- package/dist/server-BEcsQaPu.js +0 -29
- package/dist/session-Csuaw6RU.js +0 -6
- package/dist/setup-C6NFy14d.js +0 -217
- package/dist/spawn-DmmmHIP-.js +0 -71
- package/dist/storage-DT_wxwJ8.js +0 -41
- package/dist/storekit-B9M2raxe.js +0 -47
- package/dist/storekit-BWZf-fNE.js +0 -17
- package/dist/telemetry-ovPiseFm.js +0 -56
- package/dist/theme-DUsCh-Vd.js +0 -25
- package/dist/token-Bu3FaRkv.js +0 -70
- package/dist/upgrade-B7TmvEPP.js +0 -206
- package/dist/upgrade-CAHyrWUL.js +0 -7
- /package/dist/{browser-Bp3yRKlU.js → browser-BVjaf98V.js} +0 -0
- /package/dist/{client-BJQXl62Q.js → client-BwYhzITp.js} +0 -0
- /package/dist/{design-lint-CiFc78aM.js → design-lint-mgO-2SGS.js} +0 -0
- /package/dist/{devtools-ByZ6XYnn.js → devtools-B6Vp6HMy.js} +0 -0
- /package/dist/{input-MDd67UIp.js → input-DOT_2Zvb.js} +0 -0
- /package/dist/{project-NoMtbMyl.js → project-BomArwSj.js} +0 -0
- /package/dist/{reports-HYVp169R.js → reports-hbxsd3Zo.js} +0 -0
- /package/dist/{storage-Bdz5AmqS.d.ts → storage-Bh3wT1Rn.d.ts} +0 -0
- /package/dist/{timing-Ca0TXY-A.js → timing-BKEEIBij.js} +0 -0
- /package/dist/{ui-D_qf3Gvw.js → ui-hFgji1e8.js} +0 -0
package/dist/entry.js
CHANGED
|
@@ -1,34 +1,38 @@
|
|
|
1
1
|
import { n as __require, r as __toESM, t as __commonJS } from "./chunk-DQxbwPpZ.js";
|
|
2
|
-
import "./token-
|
|
3
|
-
import {
|
|
4
|
-
import { T as isNonInteractive, s as CHANNEL, x as VERSION } from "./environment-
|
|
5
|
-
import "./
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import "./
|
|
9
|
-
import
|
|
10
|
-
import "./
|
|
11
|
-
import {
|
|
12
|
-
import { c as onChannel, f as useHost, l as summaryOf, o as examplesOf, r as UsageError, s as flagName } from "./spinner-
|
|
13
|
-
import
|
|
14
|
-
import { t as THEME } from "./theme-
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import "./
|
|
21
|
-
import "./
|
|
22
|
-
import "./
|
|
23
|
-
import "./
|
|
24
|
-
import "./
|
|
25
|
-
import "./
|
|
26
|
-
import "./
|
|
27
|
-
import "./
|
|
28
|
-
import "./
|
|
29
|
-
import "./
|
|
30
|
-
import "./
|
|
31
|
-
import "./
|
|
2
|
+
import "./token-CWQ6tdva.js";
|
|
3
|
+
import { b as useStores, m as stripAnsi, p as writeJson } from "./storage-BR6imSqm.js";
|
|
4
|
+
import { T as isNonInteractive, s as CHANNEL, x as VERSION } from "./environment-sE2wZYdg.js";
|
|
5
|
+
import { S as superwallApi } from "./config-DOp5oChe.js";
|
|
6
|
+
import { O as useAscRefresh } from "./held-CUBCOCGP.js";
|
|
7
|
+
import { b as maybeShowTelemetryNotice, x as track, y as flushTelemetry } from "./skills-BB1uIt8t.js";
|
|
8
|
+
import { t as scanProject } from "./scan-ViBhmrB7.js";
|
|
9
|
+
import "./resources-XwvXA20E.js";
|
|
10
|
+
import "./orgs-DQQJ3sw_.js";
|
|
11
|
+
import { r as useRenderer, t as silentRenderer } from "./ui-hFgji1e8.js";
|
|
12
|
+
import { c as onChannel, f as useHost, l as summaryOf, o as examplesOf, r as UsageError, s as flagName } from "./spinner-BQp7fQvK.js";
|
|
13
|
+
import "./org-BD8U3D1_.js";
|
|
14
|
+
import { t as THEME } from "./theme-Ed0gz6hr.js";
|
|
15
|
+
import "./lookup-DqmIbUkv.js";
|
|
16
|
+
import "./types-Dc9U_4kp.js";
|
|
17
|
+
import "./session-BfVx50iA.js";
|
|
18
|
+
import { i as wrapReportLine, r as styleMarkdown, t as detectExisting } from "./existing--peXpOZj.js";
|
|
19
|
+
import { n as SUPERWALL_HOME, r as expandHome } from "./paths-CIlyzF2I.js";
|
|
20
|
+
import "./setup-a4B72xJ8.js";
|
|
21
|
+
import "./framework-DW5fqjh4.js";
|
|
22
|
+
import "./login-C6X7JrhM.js";
|
|
23
|
+
import "./browser-BVjaf98V.js";
|
|
24
|
+
import "./login-DXhm9L0F.js";
|
|
25
|
+
import "./git-Hf9Wc7Hp.js";
|
|
26
|
+
import "./scope-Cg1AdAfO.js";
|
|
27
|
+
import { a as printAutoUpdate, f as selectAutoUpdate, i as maybeNotifyUpdate, n as isGlobalInstall, o as recordAutoUpdate, s as refreshUpdateCheck, t as flushUpdateCheck } from "./upgrade-Cw9jVt-r.js";
|
|
28
|
+
import { a as exampleLines, i as detailLines, n as listGroups, o as renderPage, r as cmd } from "./registry-BSnQXft4.js";
|
|
29
|
+
import "./session-BlrwAdGN.js";
|
|
30
|
+
import "./scope-BLLUxbrA.js";
|
|
31
|
+
import "./client-BwYhzITp.js";
|
|
32
|
+
import "./products-CJq_iXv5.js";
|
|
33
|
+
import "./input-DOT_2Zvb.js";
|
|
34
|
+
import "./timing-BKEEIBij.js";
|
|
35
|
+
import "./notification-url-Bo54nkXv.js";
|
|
32
36
|
import { spawn } from "node:child_process";
|
|
33
37
|
import * as fs from "node:fs";
|
|
34
38
|
import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
@@ -36,10 +40,10 @@ import os, { tmpdir } from "node:os";
|
|
|
36
40
|
import * as path from "node:path";
|
|
37
41
|
import { join, resolve } from "node:path";
|
|
38
42
|
import pc from "picocolors";
|
|
39
|
-
import { PassThrough, Stream } from "node:stream";
|
|
40
|
-
import process$1, { cwd, env } from "node:process";
|
|
41
43
|
import ansiEscapes from "ansi-escapes";
|
|
42
44
|
import wrapAnsi from "wrap-ansi";
|
|
45
|
+
import { PassThrough, Stream } from "node:stream";
|
|
46
|
+
import process$1, { cwd, env } from "node:process";
|
|
43
47
|
import tty from "node:tty";
|
|
44
48
|
import { EventEmitter } from "node:events";
|
|
45
49
|
import { Buffer } from "node:buffer";
|
|
@@ -22097,7 +22101,7 @@ var styles_default = styles$2;
|
|
|
22097
22101
|
//#endregion
|
|
22098
22102
|
//#region ../../node_modules/.bun/ink@5.2.1+95f74e15225f916f/node_modules/ink/build/reconciler.js
|
|
22099
22103
|
if (process$1.env["DEV"] === "true") try {
|
|
22100
|
-
await import("./devtools-
|
|
22104
|
+
await import("./devtools-B6Vp6HMy.js");
|
|
22101
22105
|
} catch (error) {
|
|
22102
22106
|
if (error.code === "ERR_MODULE_NOT_FOUND") console.warn(`
|
|
22103
22107
|
The environment variable DEV is set to true, so Ink tried to import \`react-devtools-core\`,
|
|
@@ -27745,15 +27749,15 @@ function startAutoUpdate(version, spawn$1 = spawn, isGlobal = isGlobalInstall) {
|
|
|
27745
27749
|
return false;
|
|
27746
27750
|
}
|
|
27747
27751
|
}
|
|
27748
|
-
function finishTerminal(
|
|
27752
|
+
function finishTerminal(stderr, mode, command, update, start$1 = startAutoUpdate) {
|
|
27749
27753
|
refreshUpdateCheck();
|
|
27750
|
-
if (command === "upgrade") return;
|
|
27754
|
+
if (command === "upgrade" || command === "dev") return;
|
|
27751
27755
|
const version = update ? selectAutoUpdate() : null;
|
|
27752
27756
|
if (version && start$1(version)) {
|
|
27753
|
-
if (mode !== "json") printAutoUpdate(
|
|
27757
|
+
if (mode !== "json") printAutoUpdate(stderr, version);
|
|
27754
27758
|
return;
|
|
27755
27759
|
}
|
|
27756
|
-
|
|
27760
|
+
maybeNotifyUpdate(stderr);
|
|
27757
27761
|
}
|
|
27758
27762
|
const terminalHost = {
|
|
27759
27763
|
api: superwallApi,
|
|
@@ -27770,7 +27774,7 @@ const terminalHost = {
|
|
|
27770
27774
|
starting: (ui, mode) => {
|
|
27771
27775
|
if (mode === "rich") maybeShowTelemetryNotice(ui);
|
|
27772
27776
|
},
|
|
27773
|
-
finishing: (
|
|
27777
|
+
finishing: (_stdout, mode, command, update) => finishTerminal(process.stderr, mode, command, update),
|
|
27774
27778
|
fail: () => {
|
|
27775
27779
|
process.exitCode = 1;
|
|
27776
27780
|
},
|
|
@@ -28019,7 +28023,7 @@ function parseTokens(tokens, flags, strict) {
|
|
|
28019
28023
|
if (error) throw error;
|
|
28020
28024
|
const unknown = /^Unknown arguments?: (.*)$/.exec(message);
|
|
28021
28025
|
if (!unknown?.[1]) throw new UsageError(message);
|
|
28022
|
-
throw new UsageError(`Unknown flag: ${unknown[1].split(", ").map((name) => name.length === 1 ? `-${name}` : `--${name}`).join(", ")}.`);
|
|
28026
|
+
throw new UsageError(`Unknown flag: ${unknown[1].split(", ").map((name) => name.length === 1 ? `-${name}` : `--${kebab(name)}`).join(", ")}.`);
|
|
28023
28027
|
}).parseSync();
|
|
28024
28028
|
const values = {};
|
|
28025
28029
|
for (const [key, value] of Object.entries(argv)) if (key !== "_" && key !== "$0") values[key] = value;
|
|
@@ -28077,7 +28081,8 @@ function resolveLine(tokens, groups) {
|
|
|
28077
28081
|
}
|
|
28078
28082
|
}
|
|
28079
28083
|
function resolveCommand(command, rest, globals) {
|
|
28080
|
-
const
|
|
28084
|
+
const strict = command.kind === "command" || command.strictFlags;
|
|
28085
|
+
const parsed = parseTokens(rest, onChannel(command.flags), strict && !globals.help);
|
|
28081
28086
|
if (globals.help) return {
|
|
28082
28087
|
kind: "help",
|
|
28083
28088
|
command,
|
|
@@ -1,12 +1,61 @@
|
|
|
1
|
-
import { t as getOAuthAccessToken } from "./token-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { t as getOAuthAccessToken } from "./token-CWQ6tdva.js";
|
|
2
|
+
import { n as readSession } from "./storage-BR6imSqm.js";
|
|
3
|
+
import { d as DASHBOARD_URL, h as Integration, t as API_HOST, x as VERSION } from "./environment-sE2wZYdg.js";
|
|
4
|
+
import { _ as readVersion, g as onPath, v as spawnStream } from "./skills-BB1uIt8t.js";
|
|
5
|
+
import { i as readPackageJson, r as allDeps } from "./scan-ViBhmrB7.js";
|
|
6
|
+
import { O as field } from "./resources-XwvXA20E.js";
|
|
7
|
+
import { n as fg$1, t as THEME } from "./theme-Ed0gz6hr.js";
|
|
8
|
+
import { i as packagedDir } from "./paths-CIlyzF2I.js";
|
|
9
|
+
import { createRequire } from "node:module";
|
|
10
|
+
import { spawn } from "node:child_process";
|
|
11
|
+
import { readFileSync } from "node:fs";
|
|
5
12
|
import { tmpdir } from "node:os";
|
|
6
13
|
import { basename, join } from "node:path";
|
|
14
|
+
import { pathToFileURL } from "node:url";
|
|
15
|
+
import pc from "picocolors";
|
|
7
16
|
import { readFile, rm } from "node:fs/promises";
|
|
8
|
-
import {
|
|
17
|
+
import { link } from "ansi-escapes";
|
|
18
|
+
import wrapAnsi from "wrap-ansi";
|
|
19
|
+
import fg from "fast-glob";
|
|
9
20
|
|
|
21
|
+
//#region src/ui/clipboard.ts
|
|
22
|
+
async function copyToClipboard(text) {
|
|
23
|
+
const cmd = resolveClipboardCommand();
|
|
24
|
+
return new Promise((resolve$1) => {
|
|
25
|
+
try {
|
|
26
|
+
const child = spawn(cmd.command, cmd.args, { stdio: [
|
|
27
|
+
"pipe",
|
|
28
|
+
"ignore",
|
|
29
|
+
"ignore"
|
|
30
|
+
] });
|
|
31
|
+
child.on("error", () => resolve$1(false));
|
|
32
|
+
child.on("close", (code) => resolve$1(code === 0));
|
|
33
|
+
child.stdin.on("error", () => resolve$1(false));
|
|
34
|
+
child.stdin.write(text);
|
|
35
|
+
child.stdin.end();
|
|
36
|
+
} catch {
|
|
37
|
+
resolve$1(false);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function resolveClipboardCommand() {
|
|
42
|
+
switch (process.platform) {
|
|
43
|
+
case "darwin": return {
|
|
44
|
+
command: "pbcopy",
|
|
45
|
+
args: []
|
|
46
|
+
};
|
|
47
|
+
case "win32": return {
|
|
48
|
+
command: "clip",
|
|
49
|
+
args: []
|
|
50
|
+
};
|
|
51
|
+
default: return {
|
|
52
|
+
command: "xclip",
|
|
53
|
+
args: ["-selection", "clipboard"]
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
//#endregion
|
|
10
59
|
//#region src/core/workflows/agent/drivers/capabilities.ts
|
|
11
60
|
function toolsForCapabilities(capabilities) {
|
|
12
61
|
const tools = [
|
|
@@ -273,6 +322,9 @@ async function selectHostedStatus() {
|
|
|
273
322
|
//#endregion
|
|
274
323
|
//#region src/core/workflows/agent/drivers/superwall.ts
|
|
275
324
|
const SDK_MODEL_ALIAS = "claude-sonnet-5";
|
|
325
|
+
const AGENT_SDK_PACKAGE = "@anthropic-ai/claude-agent-sdk";
|
|
326
|
+
const AGENT_SDK_VERSION = "0.3.201";
|
|
327
|
+
const AGENT_SDK_INSTALL_MESSAGE = `The bundled Superwall Agent needs ${AGENT_SDK_PACKAGE}. Install it with \`npm install ${AGENT_SDK_PACKAGE}@${AGENT_SDK_VERSION}\`, or use Claude Code or Codex.`;
|
|
276
328
|
function resultText(message) {
|
|
277
329
|
if ("result" in message && typeof message.result === "string") return message.result;
|
|
278
330
|
if ("errors" in message && Array.isArray(message.errors)) return message.errors.join("\n");
|
|
@@ -313,11 +365,44 @@ async function resolveRunAuth() {
|
|
|
313
365
|
token
|
|
314
366
|
};
|
|
315
367
|
}
|
|
316
|
-
|
|
368
|
+
const MISSING_MODULE_CODES = new Set(["ERR_MODULE_NOT_FOUND", "MODULE_NOT_FOUND"]);
|
|
369
|
+
function isRunQuery(value) {
|
|
370
|
+
return typeof value === "function";
|
|
371
|
+
}
|
|
372
|
+
function queryOf(module) {
|
|
373
|
+
const query = field(module, "query");
|
|
374
|
+
return isRunQuery(query) ? query : null;
|
|
375
|
+
}
|
|
376
|
+
function isMissingModule(error) {
|
|
377
|
+
const code = field(error, "code");
|
|
378
|
+
return typeof code === "string" && MISSING_MODULE_CODES.has(code);
|
|
379
|
+
}
|
|
380
|
+
async function importIfInstalled(importModule, specifier) {
|
|
381
|
+
try {
|
|
382
|
+
return queryOf(await importModule(specifier()));
|
|
383
|
+
} catch (error) {
|
|
384
|
+
if (isMissingModule(error)) return void 0;
|
|
385
|
+
throw error;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
function createSdkLoader(cwd = () => process.cwd(), importModule = (specifier) => import(specifier)) {
|
|
389
|
+
let loaded;
|
|
390
|
+
const fromProject = () => pathToFileURL(createRequire(join(cwd(), "package.json")).resolve(AGENT_SDK_PACKAGE)).href;
|
|
391
|
+
return () => {
|
|
392
|
+
loaded ??= (async () => {
|
|
393
|
+
const beside = await importIfInstalled(importModule, () => AGENT_SDK_PACKAGE);
|
|
394
|
+
if (beside !== void 0) return beside;
|
|
395
|
+
return await importIfInstalled(importModule, fromProject) ?? null;
|
|
396
|
+
})();
|
|
397
|
+
return loaded;
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
function createSuperwallDriver(loadQuery) {
|
|
317
401
|
return {
|
|
318
402
|
id: "superwall",
|
|
319
403
|
displayName: "Superwall Agent",
|
|
320
404
|
async detect() {
|
|
405
|
+
if (!await loadQuery()) return null;
|
|
321
406
|
return {
|
|
322
407
|
id: "superwall",
|
|
323
408
|
displayName: "Superwall Agent",
|
|
@@ -325,6 +410,17 @@ function createSuperwallDriver(runQuery) {
|
|
|
325
410
|
};
|
|
326
411
|
},
|
|
327
412
|
async run(opts) {
|
|
413
|
+
const runQuery = await loadQuery();
|
|
414
|
+
if (!runQuery) {
|
|
415
|
+
opts.onEvent?.({
|
|
416
|
+
type: "error",
|
|
417
|
+
message: AGENT_SDK_INSTALL_MESSAGE
|
|
418
|
+
});
|
|
419
|
+
return {
|
|
420
|
+
ok: false,
|
|
421
|
+
finalText: AGENT_SDK_INSTALL_MESSAGE
|
|
422
|
+
};
|
|
423
|
+
}
|
|
328
424
|
const auth = await resolveRunAuth();
|
|
329
425
|
if (!auth.ok) {
|
|
330
426
|
opts.onEvent?.({
|
|
@@ -404,7 +500,7 @@ function createSuperwallDriver(runQuery) {
|
|
|
404
500
|
}
|
|
405
501
|
};
|
|
406
502
|
}
|
|
407
|
-
const superwallDriver = createSuperwallDriver(
|
|
503
|
+
const superwallDriver = createSuperwallDriver(createSdkLoader());
|
|
408
504
|
|
|
409
505
|
//#endregion
|
|
410
506
|
//#region src/core/workflows/agent/drivers/index.ts
|
|
@@ -423,4 +519,205 @@ async function detectDrivers() {
|
|
|
423
519
|
}
|
|
424
520
|
|
|
425
521
|
//#endregion
|
|
426
|
-
|
|
522
|
+
//#region src/core/workflows/agent/prompt.ts
|
|
523
|
+
const cache = /* @__PURE__ */ new Map();
|
|
524
|
+
function readPrompt(rel, vars = {}) {
|
|
525
|
+
let raw = cache.get(rel);
|
|
526
|
+
if (raw === void 0) {
|
|
527
|
+
raw = readFileSync(join(packagedDir("prompts"), rel), "utf8");
|
|
528
|
+
cache.set(rel, raw);
|
|
529
|
+
}
|
|
530
|
+
return raw.replace(/\{\{#(\w+)\}\}([\s\S]*?)\{\{\/\1\}\}/g, (_m, key, body) => vars[key] ? body : "").replace(/\{\{(\w+)\}\}/g, (_m, key) => {
|
|
531
|
+
const value = vars[key];
|
|
532
|
+
if (value === void 0) throw new Error(`Missing prompt variable "${key}" in ${rel}`);
|
|
533
|
+
return value;
|
|
534
|
+
}).replace(/\n{3,}/g, "\n\n").trim();
|
|
535
|
+
}
|
|
536
|
+
function readCommandments() {
|
|
537
|
+
return readPrompt("commandments.xml");
|
|
538
|
+
}
|
|
539
|
+
function buildActionPrompt(action, ctx) {
|
|
540
|
+
return `${readPrompt("context.xml", {
|
|
541
|
+
platform: `${ctx.app.framework.name}${ctx.app.details ? ` (${ctx.app.details})` : ""}`,
|
|
542
|
+
app_dir: ctx.app.path,
|
|
543
|
+
api_key: ctx.apiKey || "(not provided)",
|
|
544
|
+
sdk_installed: ctx.existing.sdkInstalled ? "yes" : "no",
|
|
545
|
+
configure_present: ctx.existing.configureFound ? "yes" : "no",
|
|
546
|
+
docs_url: ctx.app.framework.docsUrl,
|
|
547
|
+
dashboard_url: DASHBOARD_URL
|
|
548
|
+
})}\n\n${readPrompt(`actions/${action.id}.xml`, action.vars(ctx))}`;
|
|
549
|
+
}
|
|
550
|
+
function buildCopyPrompt(action, ctx) {
|
|
551
|
+
return buildActionPrompt(action, ctx).split("\n").filter((line) => !line.includes("[STATUS]")).join("\n").trimEnd();
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
//#endregion
|
|
555
|
+
//#region src/core/workflows/agent/run.ts
|
|
556
|
+
async function runAction(opts) {
|
|
557
|
+
return runWithDriverFallback([opts.driver, ...opts.fallbackDrivers ?? []], {
|
|
558
|
+
prompt: buildActionPrompt(opts.action, opts.ctx),
|
|
559
|
+
cwd: opts.ctx.app.path,
|
|
560
|
+
systemAppend: readCommandments(),
|
|
561
|
+
capabilities: opts.action.capabilities,
|
|
562
|
+
onEvent: opts.onEvent,
|
|
563
|
+
signal: opts.signal
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
async function runWithDriverFallback(drivers, options) {
|
|
567
|
+
if (drivers.length === 0) throw new Error("No agent driver available.");
|
|
568
|
+
let result = { ok: false };
|
|
569
|
+
for (const driver of drivers) {
|
|
570
|
+
result = await driver.run(options);
|
|
571
|
+
if (result.ok || result.failureReason !== "usage-limit") return result;
|
|
572
|
+
}
|
|
573
|
+
return result;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
//#endregion
|
|
577
|
+
//#region src/ui/log.ts
|
|
578
|
+
function brand(text) {
|
|
579
|
+
return fg$1(THEME.primary, text);
|
|
580
|
+
}
|
|
581
|
+
function stripReport(raw) {
|
|
582
|
+
const lines = raw.replace(/\r/g, "").split("\n").filter((l) => !/^\s*\[STATUS\]/i.test(l));
|
|
583
|
+
while (lines[0]?.trim() === "") lines.shift();
|
|
584
|
+
while (lines.at(-1)?.trim() === "") lines.pop();
|
|
585
|
+
return lines.join("\n");
|
|
586
|
+
}
|
|
587
|
+
function styleMarkdown(text) {
|
|
588
|
+
return text.split("\n").map((line) => styleMarkdownLine(line)).join("\n");
|
|
589
|
+
}
|
|
590
|
+
function styleMarkdownLine(line, opts = {}) {
|
|
591
|
+
const heading = line.match(/^\s*(#{1,6})\s+(.*)$/)?.[2];
|
|
592
|
+
if (heading !== void 0) return brand(pc.bold(styleInline(heading, opts.hyperlinks ?? false)));
|
|
593
|
+
return styleInline(line, opts.hyperlinks ?? false);
|
|
594
|
+
}
|
|
595
|
+
function wrapReportLine(line, columns) {
|
|
596
|
+
const prefix = line.match(/^(\s*(?:(?:[-*+])|(?:\d+[.)]))\s+)/)?.[1] ?? "";
|
|
597
|
+
const content = prefix ? line.slice(prefix.length) : line;
|
|
598
|
+
const width = Math.max(12, columns - prefix.length);
|
|
599
|
+
return wrapAnsi(styleMarkdownLine(content, { hyperlinks: true }), width, {
|
|
600
|
+
hard: true,
|
|
601
|
+
trim: false
|
|
602
|
+
}).split("\n").map((part, index) => `${index === 0 ? prefix : " ".repeat(prefix.length)}${part}`);
|
|
603
|
+
}
|
|
604
|
+
function styleInline(line, hyperlinks) {
|
|
605
|
+
const re = /\[([^\]]+)]\(([^)]+)\)|\*\*(.+?)\*\*|`([^`]+)`|(https?:\/\/[^\s]+)/g;
|
|
606
|
+
let out = "";
|
|
607
|
+
let last = 0;
|
|
608
|
+
let match;
|
|
609
|
+
while (match = re.exec(line)) {
|
|
610
|
+
out += line.slice(last, match.index);
|
|
611
|
+
if (match[1] != null && match[2] != null) {
|
|
612
|
+
const label = match[1];
|
|
613
|
+
const target = match[2];
|
|
614
|
+
out += hyperlinks ? link(brand(pc.underline(label)), terminalLinkTarget(target)) : `${label} (${target})`;
|
|
615
|
+
} else if (match[3] != null) out += pc.bold(match[3]);
|
|
616
|
+
else if (match[4] != null) out += brand(match[4]);
|
|
617
|
+
else if (match[5] != null) out += hyperlinks ? link(brand(pc.underline(match[5])), match[5]) : match[5];
|
|
618
|
+
last = re.lastIndex;
|
|
619
|
+
}
|
|
620
|
+
out += line.slice(last);
|
|
621
|
+
return out;
|
|
622
|
+
}
|
|
623
|
+
function terminalLinkTarget(target) {
|
|
624
|
+
const local = target.match(/^(\/.*?)(?::(\d+))?$/);
|
|
625
|
+
const file = local?.[1];
|
|
626
|
+
if (file === void 0) return target;
|
|
627
|
+
const url = pathToFileURL(file).href;
|
|
628
|
+
return local?.[2] ? `${url}#L${local[2]}` : url;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
//#endregion
|
|
632
|
+
//#region src/core/codebase/existing.ts
|
|
633
|
+
const JS_SDK_PACKAGES = {
|
|
634
|
+
[Integration.expo]: ["expo-superwall"],
|
|
635
|
+
[Integration.reactNative]: ["@superwall/react-native-superwall", "react-native-superwall"],
|
|
636
|
+
[Integration.web]: ["@superwall/web", "superwall-js"]
|
|
637
|
+
};
|
|
638
|
+
const PK_RE = /pk_[A-Za-z0-9._-]{6,}/;
|
|
639
|
+
const CONFIGURE_RE = /Superwall\.(shared\.)?configure|configureSuperwall|SuperwallProvider|\.configure\(\s*apiKey/;
|
|
640
|
+
const SDK_REF_RE = /Superwall-iOS|SuperwallKit|superwallkit_flutter|expo-superwall|superwall/i;
|
|
641
|
+
const SOURCE_GLOBS = [
|
|
642
|
+
"**/*.{swift,ts,tsx,js,jsx,kt,dart}",
|
|
643
|
+
"**/.env*",
|
|
644
|
+
"**/*.xcconfig"
|
|
645
|
+
];
|
|
646
|
+
const IGNORE = [
|
|
647
|
+
"**/node_modules/**",
|
|
648
|
+
"**/.git/**",
|
|
649
|
+
"**/Pods/**",
|
|
650
|
+
"**/build/**",
|
|
651
|
+
"**/.build/**",
|
|
652
|
+
"**/DerivedData/**",
|
|
653
|
+
"**/dist/**",
|
|
654
|
+
"**/.next/**"
|
|
655
|
+
];
|
|
656
|
+
const MAX_FILES = 600;
|
|
657
|
+
function sdkInstalledFor(app) {
|
|
658
|
+
const jsPkgs = JS_SDK_PACKAGES[app.integration];
|
|
659
|
+
if (jsPkgs) {
|
|
660
|
+
const deps = allDeps(readPackageJson(app.path));
|
|
661
|
+
if (jsPkgs.some((p) => p in deps)) return true;
|
|
662
|
+
}
|
|
663
|
+
const manifests = fg.sync([
|
|
664
|
+
"**/Package.resolved",
|
|
665
|
+
"**/project.pbxproj",
|
|
666
|
+
"**/Podfile",
|
|
667
|
+
"**/pubspec.yaml",
|
|
668
|
+
"**/pubspec.lock",
|
|
669
|
+
"**/build.gradle",
|
|
670
|
+
"**/build.gradle.kts",
|
|
671
|
+
"**/libs.versions.toml"
|
|
672
|
+
], {
|
|
673
|
+
cwd: app.path,
|
|
674
|
+
ignore: IGNORE,
|
|
675
|
+
absolute: true,
|
|
676
|
+
deep: 5
|
|
677
|
+
});
|
|
678
|
+
for (const f of manifests) {
|
|
679
|
+
let content;
|
|
680
|
+
try {
|
|
681
|
+
content = readFileSync(f, "utf8");
|
|
682
|
+
} catch {
|
|
683
|
+
continue;
|
|
684
|
+
}
|
|
685
|
+
if (SDK_REF_RE.test(content)) return true;
|
|
686
|
+
}
|
|
687
|
+
return false;
|
|
688
|
+
}
|
|
689
|
+
function detectExisting(app) {
|
|
690
|
+
const sdkInstalled = sdkInstalledFor(app);
|
|
691
|
+
let configureFound = false;
|
|
692
|
+
let apiKey;
|
|
693
|
+
const files = fg.sync(SOURCE_GLOBS, {
|
|
694
|
+
cwd: app.path,
|
|
695
|
+
ignore: IGNORE,
|
|
696
|
+
absolute: true,
|
|
697
|
+
deep: 6,
|
|
698
|
+
dot: true
|
|
699
|
+
});
|
|
700
|
+
for (const f of files.slice(0, MAX_FILES)) {
|
|
701
|
+
let content;
|
|
702
|
+
try {
|
|
703
|
+
content = readFileSync(f, "utf8");
|
|
704
|
+
} catch {
|
|
705
|
+
continue;
|
|
706
|
+
}
|
|
707
|
+
if (!configureFound && CONFIGURE_RE.test(content)) configureFound = true;
|
|
708
|
+
if (!apiKey) {
|
|
709
|
+
const m = content.match(PK_RE);
|
|
710
|
+
if (m) apiKey = m[0];
|
|
711
|
+
}
|
|
712
|
+
if (configureFound && apiKey) break;
|
|
713
|
+
}
|
|
714
|
+
return {
|
|
715
|
+
sdkInstalled,
|
|
716
|
+
configureFound,
|
|
717
|
+
apiKey,
|
|
718
|
+
fullyIntegrated: sdkInstalled && configureFound
|
|
719
|
+
};
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
//#endregion
|
|
723
|
+
export { runAction as a, readPrompt as c, superwallDriver as d, selectHostedStatus as f, wrapReportLine as i, detectDrivers as l, stripReport as n, runWithDriverFallback as o, copyToClipboard as p, styleMarkdown as r, buildCopyPrompt as s, detectExisting as t, AGENT_SDK_INSTALL_MESSAGE as u };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
3
|
+
import { dirname, join, resolve } from "node:path";
|
|
4
|
+
import { pathToFileURL } from "node:url";
|
|
5
|
+
|
|
6
|
+
//#region src/core/paywalls/project/framework.ts
|
|
7
|
+
const IGNORE_WORKSPACE_INSTALL = "pnpm install --ignore-workspace";
|
|
8
|
+
function pnpmWorkspaceAbove(dir) {
|
|
9
|
+
let current = dirname(resolve(dir));
|
|
10
|
+
while (!existsSync(join(current, "pnpm-workspace.yaml"))) {
|
|
11
|
+
const parent = dirname(current);
|
|
12
|
+
if (parent === current) return false;
|
|
13
|
+
current = parent;
|
|
14
|
+
}
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
var FrameworkNotFoundError = class extends Error {
|
|
18
|
+
constructor(dir) {
|
|
19
|
+
const project = existsSync(join(dir, "superwall", "package.json")) ? join(dir, "superwall") : dir;
|
|
20
|
+
super(`No superwall framework found from ${dir}.\nInstall it in the project (\`npm i superwall\` / \`bun add superwall\`) and make sure you run this inside a project with a superwall/ directory.` + (pnpmWorkspaceAbove(project) ? `\nA pnpm workspace above ${project} skips a project it does not list: run \`${IGNORE_WORKSPACE_INSTALL}\` there.` : ""));
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
async function importSubpath(packageDir, subpath) {
|
|
24
|
+
return import(pathToFileURL(createRequire(join(packageDir, "package.json")).resolve(subpath)).href);
|
|
25
|
+
}
|
|
26
|
+
function fn(mod, name, subpath) {
|
|
27
|
+
const candidate = mod[name];
|
|
28
|
+
if (typeof candidate !== "function") throw new Error(`This project's superwall version does not export ${name} from ${subpath} — update the project's superwall dependency.`);
|
|
29
|
+
return candidate;
|
|
30
|
+
}
|
|
31
|
+
function resolveFrameworkDir(cwd) {
|
|
32
|
+
for (const anchor of [join(cwd, "superwall", "package.json"), join(cwd, "package.json")]) try {
|
|
33
|
+
return join(createRequire(anchor).resolve("superwall/package.json"), "..");
|
|
34
|
+
} catch {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
throw new FrameworkNotFoundError(cwd);
|
|
38
|
+
}
|
|
39
|
+
function frameworkVersion(cwd) {
|
|
40
|
+
try {
|
|
41
|
+
const { version } = JSON.parse(readFileSync(join(resolveFrameworkDir(cwd), "package.json"), "utf8"));
|
|
42
|
+
if (typeof version === "string" && version !== "") return version;
|
|
43
|
+
} catch {
|
|
44
|
+
return "unknown";
|
|
45
|
+
}
|
|
46
|
+
return "unknown";
|
|
47
|
+
}
|
|
48
|
+
async function resolveFramework(cwd) {
|
|
49
|
+
const dir = resolveFrameworkDir(cwd);
|
|
50
|
+
const [discover, build, preview] = await Promise.all([
|
|
51
|
+
importSubpath(dir, "superwall/discover"),
|
|
52
|
+
importSubpath(dir, "superwall/build"),
|
|
53
|
+
importSubpath(dir, "superwall/preview")
|
|
54
|
+
]);
|
|
55
|
+
const studioProject = typeof preview.buildStudioProject === "function" ? preview.buildStudioProject : void 0;
|
|
56
|
+
return {
|
|
57
|
+
discoverProject: fn(discover, "discoverProject", "superwall/discover"),
|
|
58
|
+
buildSnapshot: fn(build, "buildSnapshot", "superwall/build"),
|
|
59
|
+
startPreviewServer: fn(preview, "startPreviewServer", "superwall/preview"),
|
|
60
|
+
studioProject
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
//#endregion
|
|
65
|
+
export { resolveFramework as i, frameworkVersion as n, pnpmWorkspaceAbove as r, IGNORE_WORKSPACE_INSTALL as t };
|