@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
|
@@ -1,14 +1,143 @@
|
|
|
1
|
-
import { c as CHANNELS, s as CHANNEL, x as VERSION } from "./environment-
|
|
2
|
-
import { c as readSkillsSync, g as writeSkillsSync } from "./config-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { existsSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
|
|
1
|
+
import { T as isNonInteractive, c as CHANNELS, s as CHANNEL, v as TELEMETRY_HOST, x as VERSION, y as TELEMETRY_KEY } from "./environment-sE2wZYdg.js";
|
|
2
|
+
import { _ as writeTelemetryNoticeShown, c as readSkillsSync, g as writeSkillsSync, t as readAnonymousId, u as telemetryNoticeShown } from "./config-DOp5oChe.js";
|
|
3
|
+
import { n as ui } from "./ui-hFgji1e8.js";
|
|
4
|
+
import { n as withSpinner } from "./spinner-BQp7fQvK.js";
|
|
5
|
+
import { i as packagedDir, t as AGENT_SKILLS_DIR } from "./paths-CIlyzF2I.js";
|
|
6
|
+
import { execFile, spawn } from "node:child_process";
|
|
7
|
+
import { appendFileSync, existsSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
|
|
9
8
|
import { tmpdir } from "node:os";
|
|
10
9
|
import { join } from "node:path";
|
|
10
|
+
import { createInterface } from "node:readline";
|
|
11
|
+
import { promisify } from "node:util";
|
|
11
12
|
|
|
13
|
+
//#region src/core/support/telemetry.ts
|
|
14
|
+
const tags = {};
|
|
15
|
+
const pending = [];
|
|
16
|
+
function updateTelemetryTags(next) {
|
|
17
|
+
Object.assign(tags, next);
|
|
18
|
+
}
|
|
19
|
+
function isTelemetryEnabled(env, key) {
|
|
20
|
+
return Boolean(key) && !env.DO_NOT_TRACK && !env.SUPERWALL_TELEMETRY_DISABLED && !env.NODE_TEST_CONTEXT;
|
|
21
|
+
}
|
|
22
|
+
function telemetryEnabled() {
|
|
23
|
+
return isTelemetryEnabled(process.env, TELEMETRY_KEY());
|
|
24
|
+
}
|
|
25
|
+
function buildEvent(event, props, distinctId) {
|
|
26
|
+
return {
|
|
27
|
+
api_key: TELEMETRY_KEY(),
|
|
28
|
+
event,
|
|
29
|
+
distinct_id: distinctId,
|
|
30
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
31
|
+
properties: {
|
|
32
|
+
$process_person_profile: false,
|
|
33
|
+
cli_version: VERSION,
|
|
34
|
+
platform: process.platform,
|
|
35
|
+
ci: process.env.CI === "true",
|
|
36
|
+
interactive: !isNonInteractive(),
|
|
37
|
+
...tags,
|
|
38
|
+
...props
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function track(event, props = {}) {
|
|
43
|
+
if (!telemetryEnabled()) return;
|
|
44
|
+
try {
|
|
45
|
+
const payload = buildEvent(event, props, readAnonymousId());
|
|
46
|
+
pending.push(fetch(`${TELEMETRY_HOST()}/capture/`, {
|
|
47
|
+
method: "POST",
|
|
48
|
+
headers: { "content-type": "application/json" },
|
|
49
|
+
body: JSON.stringify(payload),
|
|
50
|
+
signal: AbortSignal.timeout(1500)
|
|
51
|
+
}).catch(() => {}));
|
|
52
|
+
} catch {}
|
|
53
|
+
}
|
|
54
|
+
async function flushTelemetry(capMs = 2e3) {
|
|
55
|
+
if (pending.length === 0) return;
|
|
56
|
+
await Promise.race([Promise.allSettled(pending), new Promise((done) => setTimeout(done, capMs).unref())]);
|
|
57
|
+
}
|
|
58
|
+
function maybeShowTelemetryNotice(ui$1) {
|
|
59
|
+
if (!telemetryEnabled() || telemetryNoticeShown()) return;
|
|
60
|
+
writeTelemetryNoticeShown();
|
|
61
|
+
ui$1.info("The CLI collects anonymous usage data - no personal data, ever (see the README). Opt out with `SUPERWALL_TELEMETRY_DISABLED=1`.");
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region src/core/workflows/agent/drivers/spawn.ts
|
|
66
|
+
const execFileAsync = promisify(execFile);
|
|
67
|
+
function writeTranscript(line) {
|
|
68
|
+
const transcript = process.env.SW_BENCH_TRANSCRIPT;
|
|
69
|
+
if (!transcript) return;
|
|
70
|
+
try {
|
|
71
|
+
appendFileSync(transcript, line + "\n");
|
|
72
|
+
} catch {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
async function readVersion(bin) {
|
|
77
|
+
try {
|
|
78
|
+
const { stdout } = await execFileAsync(bin, ["--version"], { timeout: 5e3 });
|
|
79
|
+
return stdout.trim().split("\n")[0];
|
|
80
|
+
} catch {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
async function onPath(bin) {
|
|
85
|
+
const probe = process.platform === "win32" ? "where" : "command";
|
|
86
|
+
const args = process.platform === "win32" ? [bin] : ["-v", bin];
|
|
87
|
+
try {
|
|
88
|
+
await execFileAsync(probe, args, {
|
|
89
|
+
timeout: 5e3,
|
|
90
|
+
shell: process.platform !== "win32"
|
|
91
|
+
});
|
|
92
|
+
return true;
|
|
93
|
+
} catch {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
const CMD_META = /([()\][%!^"`<>&|;, *?])/g;
|
|
98
|
+
function escapeCmdCommand(bin) {
|
|
99
|
+
return bin.replace(CMD_META, "^$1");
|
|
100
|
+
}
|
|
101
|
+
function escapeCmdShimArgument(arg) {
|
|
102
|
+
return `"${arg.replace(/(\\*)"/g, "$1$1\\\"").replace(/(\\*)$/, "$1$1")}"`.replace(CMD_META, "^$1").replace(CMD_META, "^$1");
|
|
103
|
+
}
|
|
104
|
+
function spawnStream(opts) {
|
|
105
|
+
return new Promise((resolve$1, reject) => {
|
|
106
|
+
const options = {
|
|
107
|
+
cwd: opts.cwd,
|
|
108
|
+
signal: opts.signal,
|
|
109
|
+
stdio: [
|
|
110
|
+
"ignore",
|
|
111
|
+
"pipe",
|
|
112
|
+
"pipe"
|
|
113
|
+
]
|
|
114
|
+
};
|
|
115
|
+
const child = opts.cmdShim && process.platform === "win32" ? spawn([escapeCmdCommand(opts.bin), ...opts.args.map(escapeCmdShimArgument)].join(" "), {
|
|
116
|
+
...options,
|
|
117
|
+
shell: true
|
|
118
|
+
}) : spawn(opts.bin, opts.args, options);
|
|
119
|
+
createInterface({ input: child.stdout }).on("line", (line) => {
|
|
120
|
+
if (line.length) {
|
|
121
|
+
writeTranscript(line);
|
|
122
|
+
opts.onStdoutLine(line);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
const { onStderrLine } = opts;
|
|
126
|
+
if (onStderrLine) createInterface({ input: child.stderr }).on("line", (line) => {
|
|
127
|
+
if (line.length) onStderrLine(line);
|
|
128
|
+
});
|
|
129
|
+
child.on("error", (e) => {
|
|
130
|
+
if (e.name === "AbortError") {
|
|
131
|
+
resolve$1({ code: null });
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
reject(e);
|
|
135
|
+
});
|
|
136
|
+
child.on("close", (code) => resolve$1({ code }));
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
//#endregion
|
|
12
141
|
//#region src/core/support/skills.ts
|
|
13
142
|
const SUPERWALL_SKILLS_SOURCE = "superwall/skills";
|
|
14
143
|
const skillsRefFor = (channel) => CHANNELS[channel].skillsRef;
|
|
@@ -226,6 +355,7 @@ async function runInstall(args, opts) {
|
|
|
226
355
|
};
|
|
227
356
|
const { code } = await spawnStream({
|
|
228
357
|
bin: "npx",
|
|
358
|
+
cmdShim: true,
|
|
229
359
|
args,
|
|
230
360
|
cwd: process.cwd(),
|
|
231
361
|
onStdoutLine: () => {},
|
|
@@ -354,4 +484,4 @@ async function runSkills(ctx, { flags }) {
|
|
|
354
484
|
}
|
|
355
485
|
|
|
356
486
|
//#endregion
|
|
357
|
-
export { bundledSkills as a, knownSkills as c, readBundledSkill as d, runSkills as f, updateSkills as h, SUPERWALL_SKILLS_SOURCE as i, normalizeSkillFrontmatter as l, skillsRefFor as m, SKILLS_INSTALL_SOURCE as n, checkSkillsSync as o, skillSummary as p, SKILLS_REF as r, ensureSkillsCurrent as s, PLAYBOOKS as t, normalizeSkillsDir as u };
|
|
487
|
+
export { updateTelemetryTags as S, readVersion as _, bundledSkills as a, maybeShowTelemetryNotice as b, knownSkills as c, readBundledSkill as d, runSkills as f, onPath as g, updateSkills as h, SUPERWALL_SKILLS_SOURCE as i, normalizeSkillFrontmatter as l, skillsRefFor as m, SKILLS_INSTALL_SOURCE as n, checkSkillsSync as o, skillSummary as p, SKILLS_REF as r, ensureSkillsCurrent as s, PLAYBOOKS as t, normalizeSkillsDir as u, spawnStream as v, track as x, flushTelemetry as y };
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import "./token-
|
|
2
|
-
import "./
|
|
3
|
-
import "./environment-
|
|
4
|
-
import "./
|
|
5
|
-
import "./
|
|
6
|
-
import "./
|
|
7
|
-
import "./
|
|
8
|
-
import "./
|
|
9
|
-
import "./spinner-DPdBlZe2.js";
|
|
10
|
-
import "./ui-D_qf3Gvw.js";
|
|
11
|
-
import "./paths-CzTJVpfi.js";
|
|
12
|
-
import { a as bundledSkills, c as knownSkills, d as readBundledSkill, f as runSkills, h as updateSkills, i as SUPERWALL_SKILLS_SOURCE, l as normalizeSkillFrontmatter, m as skillsRefFor, n as SKILLS_INSTALL_SOURCE, o as checkSkillsSync, p as skillSummary, r as SKILLS_REF, s as ensureSkillsCurrent, t as PLAYBOOKS, u as normalizeSkillsDir } from "./skills-421SFEyF.js";
|
|
1
|
+
import "./token-CWQ6tdva.js";
|
|
2
|
+
import "./storage-BR6imSqm.js";
|
|
3
|
+
import "./environment-sE2wZYdg.js";
|
|
4
|
+
import "./config-DOp5oChe.js";
|
|
5
|
+
import { a as bundledSkills, c as knownSkills, d as readBundledSkill, f as runSkills, h as updateSkills, i as SUPERWALL_SKILLS_SOURCE, l as normalizeSkillFrontmatter, m as skillsRefFor, n as SKILLS_INSTALL_SOURCE, o as checkSkillsSync, p as skillSummary, r as SKILLS_REF, s as ensureSkillsCurrent, t as PLAYBOOKS, u as normalizeSkillsDir } from "./skills-BB1uIt8t.js";
|
|
6
|
+
import "./ui-hFgji1e8.js";
|
|
7
|
+
import "./spinner-BQp7fQvK.js";
|
|
8
|
+
import "./paths-CIlyzF2I.js";
|
|
13
9
|
|
|
14
10
|
export { PLAYBOOKS, SKILLS_INSTALL_SOURCE, SKILLS_REF, SUPERWALL_SKILLS_SOURCE, bundledSkills, checkSkillsSync, ensureSkillsCurrent, knownSkills, normalizeSkillFrontmatter, normalizeSkillsDir, readBundledSkill, runSkills, skillSummary, skillsRefFor, updateSkills };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { s as formatSharedLock } from "./types-Dc9U_4kp.js";
|
|
2
|
+
import * as fs from "node:fs";
|
|
3
|
+
import * as path from "node:path";
|
|
4
|
+
import fg from "fast-glob";
|
|
5
|
+
|
|
6
|
+
//#region src/core/paywalls/source/source.ts
|
|
7
|
+
const HARD_EXCLUDES = [
|
|
8
|
+
".superwall/**",
|
|
9
|
+
"**/node_modules/**",
|
|
10
|
+
".git/**",
|
|
11
|
+
"**/.env*",
|
|
12
|
+
"**/.DS_Store",
|
|
13
|
+
"**/.npmrc",
|
|
14
|
+
"**/.netrc",
|
|
15
|
+
"**/*.pem",
|
|
16
|
+
"**/*.p8",
|
|
17
|
+
"**/*.p12",
|
|
18
|
+
"**/*.key",
|
|
19
|
+
"**/*.keystore",
|
|
20
|
+
"**/*.jks",
|
|
21
|
+
"**/google-services.json",
|
|
22
|
+
"**/GoogleService-Info.plist"
|
|
23
|
+
];
|
|
24
|
+
const LOCK_FILE = "superwall.lock";
|
|
25
|
+
const SOURCE_LIMIT_BYTES = 250 * 1024 * 1024;
|
|
26
|
+
const LARGEST_SHOWN = 3;
|
|
27
|
+
const megabytes = (bytes) => `${(bytes / 1024 / 1024).toFixed(1)} MB`;
|
|
28
|
+
function gitignoreExcludes(superwallDir) {
|
|
29
|
+
let text;
|
|
30
|
+
try {
|
|
31
|
+
text = fs.readFileSync(path.join(superwallDir, ".gitignore"), "utf8");
|
|
32
|
+
} catch {
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
const excludes = [];
|
|
36
|
+
for (const raw of text.split("\n")) {
|
|
37
|
+
const line = raw.trim();
|
|
38
|
+
if (line === "" || line.startsWith("#") || line.startsWith("!")) continue;
|
|
39
|
+
const anchored = line.startsWith("/");
|
|
40
|
+
const body = (anchored ? line.slice(1) : line).replace(/\/+$/, "");
|
|
41
|
+
if (body === "") continue;
|
|
42
|
+
const base = anchored || body.includes("/") ? body : `**/${body}`;
|
|
43
|
+
excludes.push(base, `${base}/**`);
|
|
44
|
+
}
|
|
45
|
+
return excludes;
|
|
46
|
+
}
|
|
47
|
+
const readFramework = (superwallDir, relative$1) => relative$1 === LOCK_FILE ? Buffer.from(formatSharedLock(superwallDir)) : fs.readFileSync(path.join(superwallDir, relative$1));
|
|
48
|
+
async function collectSourceFiles(superwallDir, read = readFramework) {
|
|
49
|
+
const entries = await fg("**/*", {
|
|
50
|
+
cwd: superwallDir,
|
|
51
|
+
dot: true,
|
|
52
|
+
onlyFiles: true,
|
|
53
|
+
followSymbolicLinks: false,
|
|
54
|
+
ignore: [...HARD_EXCLUDES, ...gitignoreExcludes(superwallDir)]
|
|
55
|
+
});
|
|
56
|
+
if (entries.length === 0) return {
|
|
57
|
+
ok: false,
|
|
58
|
+
reason: `No source files found in ${superwallDir}.`
|
|
59
|
+
};
|
|
60
|
+
const sizes = entries.map((relative$1) => ({
|
|
61
|
+
path: relative$1,
|
|
62
|
+
bytes: fs.statSync(path.join(superwallDir, relative$1)).size
|
|
63
|
+
}));
|
|
64
|
+
const total = sizes.reduce((sum, entry) => sum + entry.bytes, 0);
|
|
65
|
+
if (total > SOURCE_LIMIT_BYTES) {
|
|
66
|
+
const largest = sizes.sort((a, b) => b.bytes - a.bytes).slice(0, LARGEST_SHOWN).map((entry) => `${entry.path} (${megabytes(entry.bytes)})`).join(", ");
|
|
67
|
+
return {
|
|
68
|
+
ok: false,
|
|
69
|
+
reason: `The source in ${superwallDir} is ${megabytes(total)}, over the ${SOURCE_LIMIT_BYTES / 1024 / 1024} MB limit. Largest: ${largest}. Add what doesn't belong to .gitignore, then push again.`
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
ok: true,
|
|
74
|
+
files: entries.sort().map((relative$1) => ({
|
|
75
|
+
path: relative$1,
|
|
76
|
+
content: read(superwallDir, relative$1)
|
|
77
|
+
}))
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
//#endregion
|
|
82
|
+
export { collectSourceFiles as t };
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { n as findApplication } from "./lookup-
|
|
5
|
-
import { f as writeBinding,
|
|
6
|
-
import {
|
|
7
|
-
import { i as
|
|
1
|
+
import { b as ApiUnreachableError, y as ApiError } from "./config-DOp5oChe.js";
|
|
2
|
+
import { d as linkSourceCommit, f as listAppPaywalls, o as createHeadlessPaywall, v as mintSourceAccess } from "./resources-XwvXA20E.js";
|
|
3
|
+
import { n as ui } from "./ui-hFgji1e8.js";
|
|
4
|
+
import { n as findApplication } from "./lookup-DqmIbUkv.js";
|
|
5
|
+
import { f as readLock, h as writeBinding, s as formatSharedLock } from "./types-Dc9U_4kp.js";
|
|
6
|
+
import { r as pushSourceTree, t as gitAvailable } from "./git-Hf9Wc7Hp.js";
|
|
7
|
+
import { i as LOCK_FILE } from "./scope-Cg1AdAfO.js";
|
|
8
|
+
import { n as writeSourceBase, t as readSourceBase } from "./base-CAU0hWoI.js";
|
|
9
|
+
import * as fs from "node:fs";
|
|
10
|
+
import * as path from "node:path";
|
|
8
11
|
import { setTimeout } from "node:timers/promises";
|
|
9
12
|
import { productVariables } from "@superwall/studio/products";
|
|
10
13
|
|
|
@@ -89,9 +92,11 @@ async function listProjectCatalogue(api, projectId) {
|
|
|
89
92
|
const rows = await api.list(`/v2/products?project_id=${encodeURIComponent(projectId)}`);
|
|
90
93
|
const variables = /* @__PURE__ */ new Map();
|
|
91
94
|
const stores = /* @__PURE__ */ new Map();
|
|
95
|
+
const names = /* @__PURE__ */ new Map();
|
|
92
96
|
for (const row of rows) {
|
|
93
97
|
if (!row.identifier) continue;
|
|
94
98
|
variables.set(row.identifier, productVariables(row));
|
|
99
|
+
if (typeof row.name === "string" && row.name !== "" && !names.has(row.identifier)) names.set(row.identifier, row.name);
|
|
95
100
|
const store = storeOf(row);
|
|
96
101
|
if (store === void 0) continue;
|
|
97
102
|
const known = stores.get(row.identifier) ?? [];
|
|
@@ -99,17 +104,22 @@ async function listProjectCatalogue(api, projectId) {
|
|
|
99
104
|
}
|
|
100
105
|
return {
|
|
101
106
|
variables: Object.fromEntries(variables),
|
|
102
|
-
stores: Object.fromEntries(stores)
|
|
107
|
+
stores: Object.fromEntries(stores),
|
|
108
|
+
names: Object.fromEntries(names)
|
|
103
109
|
};
|
|
104
110
|
}
|
|
105
|
-
|
|
106
|
-
return (
|
|
111
|
+
function productListings(catalogue) {
|
|
112
|
+
return Object.fromEntries(Object.keys(catalogue.variables).map((identifier) => [identifier, {
|
|
113
|
+
...Object.hasOwn(catalogue.names, identifier) ? { name: catalogue.names[identifier] } : {},
|
|
114
|
+
...Object.hasOwn(catalogue.stores, identifier) ? { stores: catalogue.stores[identifier] } : {}
|
|
115
|
+
}]));
|
|
107
116
|
}
|
|
108
117
|
async function listApplicationCatalogue(api, applicationId) {
|
|
109
118
|
const projectId = await projectForApplication(api, applicationId);
|
|
110
119
|
if (projectId === void 0) return {
|
|
111
120
|
variables: {},
|
|
112
|
-
stores: {}
|
|
121
|
+
stores: {},
|
|
122
|
+
names: {}
|
|
113
123
|
};
|
|
114
124
|
return listProjectCatalogue(api, projectId);
|
|
115
125
|
}
|
|
@@ -155,13 +165,27 @@ var GitRequiredError = class extends Error {
|
|
|
155
165
|
async function assertGit(hasGit = gitAvailable) {
|
|
156
166
|
if (!await hasGit()) throw new GitRequiredError();
|
|
157
167
|
}
|
|
168
|
+
function withCurrentLock(superwallDir, files, landing) {
|
|
169
|
+
const others = files.filter((file) => file.path !== LOCK_FILE);
|
|
170
|
+
if (!fs.existsSync(path.join(superwallDir, LOCK_FILE))) return others;
|
|
171
|
+
const lock = {
|
|
172
|
+
path: LOCK_FILE,
|
|
173
|
+
content: Buffer.from(formatSharedLock(superwallDir, landing))
|
|
174
|
+
};
|
|
175
|
+
return [...others, lock].sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
|
|
176
|
+
}
|
|
158
177
|
async function syncSource(input, message) {
|
|
159
178
|
const access = await mintSourceAccess(input.api, input.paywallId);
|
|
179
|
+
const landing = message.kind === "paywall" || message.kind === "funnel" ? {
|
|
180
|
+
kind: message.kind,
|
|
181
|
+
id: message.surface,
|
|
182
|
+
paywallId: input.paywallId
|
|
183
|
+
} : void 0;
|
|
160
184
|
const pushed = await pushSourceTree({
|
|
161
185
|
access,
|
|
162
186
|
base: readSourceBase(input.superwallDir, access.repo),
|
|
163
187
|
overwrite: input.overwrite,
|
|
164
|
-
files: input.files,
|
|
188
|
+
files: withCurrentLock(input.superwallDir, input.files, landing),
|
|
165
189
|
message
|
|
166
190
|
});
|
|
167
191
|
if (pushed.syncedTo) writeSourceBase(input.superwallDir, access.repo, pushed.syncedTo);
|
|
@@ -217,7 +241,7 @@ async function linkCommit(input, access, commitSha) {
|
|
|
217
241
|
await setTimeout(LINK_RETRY_DELAY_MS);
|
|
218
242
|
}
|
|
219
243
|
}
|
|
220
|
-
const isTransient = (error) => error instanceof ApiUnreachableError || error instanceof ApiError && error.status >= 500;
|
|
244
|
+
const isTransient = (error) => error instanceof ApiUnreachableError && !error.timedOut || error instanceof ApiError && error.status >= 500;
|
|
221
245
|
|
|
222
246
|
//#endregion
|
|
223
|
-
export { listApplicationCatalogue as a, projectForApplication as c, warnNotPortable as i, requireProducts as l, pushProjectSource as n, listProjectCatalogue as o, pushSource as r,
|
|
247
|
+
export { listApplicationCatalogue as a, projectForApplication as c, warnNotPortable as i, requireProducts as l, pushProjectSource as n, listProjectCatalogue as o, pushSource as r, productListings as s, assertGit as t, resolveBinding as u };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { s as CHANNEL } from "./environment-
|
|
4
|
-
import {
|
|
5
|
-
import { n as ui, r as useRenderer } from "./ui-
|
|
1
|
+
import { i as NotLoggedInError } from "./token-CWQ6tdva.js";
|
|
2
|
+
import { d as createCommandOutput, p as writeJson } from "./storage-BR6imSqm.js";
|
|
3
|
+
import { s as CHANNEL } from "./environment-sE2wZYdg.js";
|
|
4
|
+
import { y as ApiError } from "./config-DOp5oChe.js";
|
|
5
|
+
import { n as ui, r as useRenderer } from "./ui-hFgji1e8.js";
|
|
6
6
|
import pc from "picocolors";
|
|
7
7
|
|
|
8
8
|
//#region src/program/host.ts
|
|
@@ -267,9 +267,11 @@ function defineCatalog(spec) {
|
|
|
267
267
|
mcp: spec.mcp,
|
|
268
268
|
channel: spec.channel,
|
|
269
269
|
flags: spec.flags ?? {},
|
|
270
|
+
strictFlags: spec.strictFlags ?? false,
|
|
270
271
|
operations: spec.operations,
|
|
271
272
|
help: spec.help,
|
|
272
273
|
tools: spec.tools,
|
|
274
|
+
commandFor: spec.commandFor,
|
|
273
275
|
execute: (input, runtime = {}) => {
|
|
274
276
|
return runLifecycle(spec, input, runtime, (ctx) => {
|
|
275
277
|
return spec.run(ctx, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as MANIFEST_FILE, o as readManifest, r as VENDORED_SDK, t as ArtifactError } from "./project-
|
|
1
|
+
import { n as MANIFEST_FILE, o as readManifest, r as VENDORED_SDK, t as ArtifactError } from "./project-BomArwSj.js";
|
|
2
2
|
import { i as downloadRepoDir, n as PUBLIC_REPO, r as RepoDownloadError } from "./download-DhGd4hOB.js";
|
|
3
|
-
import { n as compareVersions, r as vendoredVersion, t as STARTER_DIR } from "./sdk-
|
|
3
|
+
import { n as compareVersions, r as vendoredVersion, t as STARTER_DIR } from "./sdk-BFunw4Hc.js";
|
|
4
4
|
import { execFile } from "node:child_process";
|
|
5
5
|
import * as fs from "node:fs";
|
|
6
6
|
import * as os$1 from "node:os";
|
|
@@ -127,17 +127,21 @@ function replaceDirectory(stage, target, rename = fs.renameSync) {
|
|
|
127
127
|
force: true
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
|
+
/** Returns whether package.json had to change. */
|
|
130
131
|
function pointPackageAtSdk(file) {
|
|
131
132
|
const text = fs.readFileSync(file, "utf8");
|
|
132
133
|
const parsed = JSON.parse(text);
|
|
133
|
-
if (parsed.dependencies?.["@superwall/artifact-sdk"] === "file:vendor/artifact-sdk") return;
|
|
134
|
+
if (parsed.dependencies?.["@superwall/artifact-sdk"] === "file:vendor/artifact-sdk") return false;
|
|
134
135
|
parsed.dependencies = {
|
|
135
136
|
...parsed.dependencies,
|
|
136
137
|
"@superwall/artifact-sdk": "file:vendor/artifact-sdk"
|
|
137
138
|
};
|
|
138
139
|
const indent = /^([ \t]+)"/m.exec(text)?.[1] ?? " ";
|
|
139
140
|
fs.writeFileSync(file, `${JSON.stringify(parsed, null, indent)}${text.endsWith("\n") ? "\n" : ""}`);
|
|
141
|
+
return true;
|
|
140
142
|
}
|
|
143
|
+
const readIfPresent = (file) => fs.existsSync(file) ? fs.readFileSync(file, "utf8") : void 0;
|
|
144
|
+
const commitList = (files) => files.length === 1 ? files[0] : `${files.slice(0, -1).join(", ")} and ${files.at(-1)}`;
|
|
141
145
|
function readStageVersion(stage) {
|
|
142
146
|
const { version } = JSON.parse(fs.readFileSync(path.join(stage, "package.json"), "utf8"));
|
|
143
147
|
if (typeof version !== "string") throw new RepoDownloadError("The downloaded artifact SDK has no version.");
|
|
@@ -173,17 +177,23 @@ async function runArtifactUpdate(ctx, input, runtime = {}) {
|
|
|
173
177
|
});
|
|
174
178
|
}
|
|
175
179
|
spin.stop(before === version ? `Already on the latest artifact SDK, ${version}` : `Artifact SDK ${version}`);
|
|
176
|
-
|
|
180
|
+
const sdkChanged = before !== version;
|
|
181
|
+
const packageChanged = pointPackageAtSdk(packageFile);
|
|
182
|
+
const changed = [...sdkChanged ? ["vendor/artifact-sdk"] : [], ...packageChanged ? ["package.json"] : []];
|
|
177
183
|
if (!input.install) {
|
|
178
|
-
ctx.ui.info(
|
|
184
|
+
if (changed.length > 0) ctx.ui.info(`Run \`npm install\` to update package-lock.json, then commit ${commitList([...changed, "the lockfile"])}.`);
|
|
179
185
|
return;
|
|
180
186
|
}
|
|
187
|
+
const lockFile = path.join(root, "package-lock.json");
|
|
188
|
+
const lockBefore = readIfPresent(lockFile);
|
|
181
189
|
try {
|
|
182
190
|
await (runtime.install ?? npmInstall)(root);
|
|
183
|
-
ctx.ui.success("Updated package-lock.json. Commit vendor/artifact-sdk and the lockfile.");
|
|
184
191
|
} catch {
|
|
185
192
|
ctx.ui.warn("`npm install` failed. Run it yourself to update package-lock.json.");
|
|
193
|
+
return;
|
|
186
194
|
}
|
|
195
|
+
if (readIfPresent(lockFile) !== lockBefore) ctx.ui.success(`Updated package-lock.json. Commit ${commitList([...changed, "the lockfile"])}.`);
|
|
196
|
+
else if (changed.length > 0) ctx.ui.success(`Commit ${commitList(changed)}.`);
|
|
187
197
|
}
|
|
188
198
|
|
|
189
199
|
//#endregion
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import "./token-
|
|
2
|
-
import "./
|
|
3
|
-
import "./environment-
|
|
4
|
-
import "./
|
|
5
|
-
import
|
|
6
|
-
import "./
|
|
7
|
-
import "./
|
|
8
|
-
import {
|
|
9
|
-
import { t as ArtifactError } from "./project-
|
|
10
|
-
import "./lock-DgSx-p8Y.js";
|
|
11
|
-
import "./scope-ehZ7L1nj.js";
|
|
1
|
+
import "./token-CWQ6tdva.js";
|
|
2
|
+
import "./storage-BR6imSqm.js";
|
|
3
|
+
import "./environment-sE2wZYdg.js";
|
|
4
|
+
import { y as ApiError } from "./config-DOp5oChe.js";
|
|
5
|
+
import "./orgs-DQQJ3sw_.js";
|
|
6
|
+
import "./types-Dc9U_4kp.js";
|
|
7
|
+
import "./scope-Cg1AdAfO.js";
|
|
8
|
+
import { D as requestDeploy, T as listVersions, a as latestManifest, b as getBuild, c as openLink, d as resolveArtifact, f as roleCanApprove, l as pickVersion, n as awaitingInstall, o as newestFirst, p as visibilityOf, w as listMembers, x as getMe } from "./resolve-DO7bPota.js";
|
|
9
|
+
import { t as ArtifactError } from "./project-BomArwSj.js";
|
|
12
10
|
|
|
13
11
|
//#region src/core/artifacts/status.ts
|
|
14
12
|
const SHOWN_VERSIONS = 3;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { n as API_HOST_OVERRIDE, t as API_HOST } from "./environment-sE2wZYdg.js";
|
|
2
|
+
|
|
1
3
|
//#region src/core/state/store.ts
|
|
2
4
|
function memoryStore() {
|
|
3
5
|
const files = /* @__PURE__ */ new Map();
|
|
@@ -119,4 +121,41 @@ function renderBlock(renderer, block) {
|
|
|
119
121
|
}
|
|
120
122
|
|
|
121
123
|
//#endregion
|
|
122
|
-
|
|
124
|
+
//#region src/core/account/storage.ts
|
|
125
|
+
const sessionOrgName = (session) => {
|
|
126
|
+
return session?.authMethod === "api_key" ? session.orgName : void 0;
|
|
127
|
+
};
|
|
128
|
+
const FILE = "auth.json";
|
|
129
|
+
const PENDING_FILE = "pending-login.json";
|
|
130
|
+
function writePendingLogin(pending) {
|
|
131
|
+
state().write(PENDING_FILE, `${formatJson(pending)}\n`);
|
|
132
|
+
}
|
|
133
|
+
function readPendingLogin() {
|
|
134
|
+
return readJson(state(), PENDING_FILE) ?? null;
|
|
135
|
+
}
|
|
136
|
+
function removePendingLogin() {
|
|
137
|
+
state().remove(PENDING_FILE);
|
|
138
|
+
}
|
|
139
|
+
function writeSession(session) {
|
|
140
|
+
state().write(FILE, `${formatJson(session)}\n`);
|
|
141
|
+
}
|
|
142
|
+
function readSession() {
|
|
143
|
+
return readJson(state(), FILE) ?? null;
|
|
144
|
+
}
|
|
145
|
+
function removeSession() {
|
|
146
|
+
state().remove(FILE);
|
|
147
|
+
}
|
|
148
|
+
function resolveApiHost(session) {
|
|
149
|
+
return API_HOST_OVERRIDE() ?? session.host ?? API_HOST();
|
|
150
|
+
}
|
|
151
|
+
function serializeSession(session) {
|
|
152
|
+
return {
|
|
153
|
+
authenticated: true,
|
|
154
|
+
user: { email: session.userEmail ?? null },
|
|
155
|
+
credential: { type: session.apiKey ? "api_key" : session.accessToken ? "oauth" : "unknown" },
|
|
156
|
+
host: resolveApiHost(session)
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
//#endregion
|
|
161
|
+
export { memoryStore as _, resolveApiHost as a, useStores as b, writePendingLogin as c, createCommandOutput as d, formatJson as f, emptyStore as g, cache as h, removeSession as i, writeSession as l, stripAnsi as m, readSession as n, serializeSession as o, writeJson as p, removePendingLogin as r, sessionOrgName as s, readPendingLogin as t, blocks as u, readJson as v, state as y };
|