@superwall/cli 2.3.0 → 2.4.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 +10 -0
- package/dist/{apple-D79LBw5E.js → apple-Bx_fm5M-.js} +14 -14
- package/dist/{assets-Diivv88t.js → assets-W5yvyf0V.js} +3 -3
- package/dist/auth.js +3 -3
- package/dist/{billing-CCuMv6mh.js → billing-C4lXR0xG.js} +3 -3
- package/dist/{bind-CVRlFlRo.js → bind-82oTpHZ3.js} +4 -4
- package/dist/{build-BCq0cGh-.js → build-7_8cBgBm.js} +8 -8
- package/dist/{client-CYtQvWJR.js → client-ltxxHuxn.js} +3 -3
- package/dist/{config-BO1Y87kV.js → config-CGcG7GOt.js} +9 -1
- package/dist/create-CBCDWuyo.js +19 -0
- package/dist/{create-BZyUW60x.js → create-DEyveHS6.js} +29 -29
- package/dist/{create-BaP6hoQ1.js → create-Dk8U_B49.js} +6 -6
- package/dist/{doctor-kx01VvQX.js → doctor-Df2GwS4K.js} +6 -6
- package/dist/{drivers-D0818zGc.js → drivers-CTyYdBL7.js} +4 -4
- package/dist/entry.js +63 -28
- package/dist/{environment-a7W-0wg0.js → environment-djS0ik60.js} +8 -2
- package/dist/{existing-B7qxYiUX.js → existing-Das3PHGG.js} +2 -2
- package/dist/{held-CEyXc1SI.js → held-B8EFWDEc.js} +6 -6
- package/dist/held-BL4oizD6.js +16 -0
- package/dist/{integrate-RK5U0GTQ.js → integrate-Cz48dm_h.js} +23 -23
- package/dist/{log-NVhVe_oe.js → log-C0MDCfA2.js} +1 -1
- package/dist/{login-DrMLxlF4.js → login-CiK5T4w8.js} +7 -7
- package/dist/login-DdrOmi6m.js +16 -0
- package/dist/{login-NxCl2WuU.js → login-girc324T.js} +1 -1
- package/dist/{lookup-Dor6ch5A.js → lookup-us5vu5od.js} +3 -3
- package/dist/{migrate-CjSpcnNu.js → migrate-DaVwhdov.js} +27 -27
- package/dist/{migration-MlzZHGP-.js → migration-cS6UGeUj.js} +10 -10
- package/dist/{notification-url-C_QXtljc.js → notification-url-Hg42tAbW.js} +2 -2
- package/dist/{open-CBW0Cuog.js → open-BIuOZ9ka.js} +2 -2
- package/dist/{org-BJCyaL1b.js → org-BrR4HGvl.js} +2 -2
- package/dist/{paths-Cp_lgyWO.js → paths-CdwjySxK.js} +2 -2
- package/dist/{playbook-VqV7546k.js → playbook-BJ3opYIS.js} +11 -11
- package/dist/{promote-BSckFPwZ.js → promote-BQO-1ScY.js} +19 -19
- package/dist/{pull-DEumBwvc.js → pull-BhRswq6x.js} +24 -24
- package/dist/push-B3Onn_mL.js +24 -0
- package/dist/{push-D-dewDd1.js → push-CR110qRh.js} +7 -7
- package/dist/{registry-D6M1JxYC.js → registry-DZsWoWqH.js} +239 -130
- package/dist/{resources-DKn4itf3.js → resources-BMspgZO1.js} +2 -2
- package/dist/{run-Ccv5egCC.js → run-D4V6mq8_.js} +2 -2
- package/dist/{scan-Be17rMcQ.js → scan-CRexsHOE.js} +1 -1
- package/dist/scan-DUQjxOZf.js +4 -0
- package/dist/{scope-92neiQ2q.js → scope-Ct0_HoNq.js} +5 -5
- package/dist/{selection-C5ZY23dQ.js → selection-CgZJJ3FD.js} +2 -2
- package/dist/server-Cv-Ug9JF.js +24 -0
- package/dist/{server-DZ7L28w4.js → server-Dv1VwbNh.js} +8 -8
- package/dist/session-BCQuMcQ0.js +6 -0
- package/dist/{session-CdnUL4zt.js → session-CV0P8BjK.js} +7 -7
- package/dist/{session-gTuw2_8i.js → session-UiPlLFn6.js} +1 -1
- package/dist/{setup-esb3_a7N.js → setup-UWLhQG3M.js} +8 -8
- package/dist/skills/superwall-framework/SKILL.md +4 -3
- package/dist/skills/superwall-framework/references/onboarding-state.md +21 -14
- package/dist/{skills-miJDcjQ2.js → skills-CiWxt6vS.js} +15 -9
- package/dist/skills-DzOvse9L.js +14 -0
- package/dist/{source-push-NVrs53Uo.js → source-push-CX_k_yZD.js} +5 -5
- package/dist/{spinner-D6phP4Af.js → spinner-1uuKKZMc.js} +4 -4
- package/dist/{storage-BcvKhvzZ.js → storage-CrXGgIbS.js} +1 -1
- package/dist/storekit-B675ZNiA.js +16 -0
- package/dist/{storekit-Di3BkafX.js → storekit-CptdG4RJ.js} +3 -3
- package/dist/{telemetry-BpYXL-z3.js → telemetry-BqaPbM0k.js} +2 -2
- package/dist/{token-4dQOfOaK.js → token-zjjlkNDF.js} +1 -1
- package/dist/tools.js +125 -50
- package/dist/upgrade-AdyF7wXk.js +7 -0
- package/dist/upgrade-BBnmcyY2.js +206 -0
- package/package.json +2 -2
- package/prompts/commandments.xml +2 -0
- package/dist/create-DNfuZ9os.js +0 -19
- package/dist/held-C4BiAQ_X.js +0 -16
- package/dist/login-DV70XgZO.js +0 -16
- package/dist/push-YEPqa6hs.js +0 -24
- package/dist/scan-CocGVPe0.js +0 -4
- package/dist/server-1pOxW1GJ.js +0 -24
- package/dist/session-Cm0U68t3.js +0 -6
- package/dist/skills-B_oH2dYK.js +0 -14
- package/dist/storekit-D1A5VHT1.js +0 -16
- package/dist/upgrade-BnOq32zn.js +0 -7
- package/dist/upgrade-Cb6f4S_c.js +0 -117
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import "./output-Ggzq5_-t.js";
|
|
2
|
+
import "./environment-djS0ik60.js";
|
|
3
|
+
import "./config-CGcG7GOt.js";
|
|
4
|
+
import "./spawn-DmmmHIP-.js";
|
|
5
|
+
import { a as printAutoUpdate, c as runUpgrade, i as maybeNotifyUpdate, l as selectAutoUpdate, n as isGlobalInstall, o as recordAutoUpdate, r as isNewerVersion, s as refreshUpdateCheck, t as flushUpdateCheck } from "./upgrade-BBnmcyY2.js";
|
|
6
|
+
|
|
7
|
+
export { flushUpdateCheck, isGlobalInstall, isNewerVersion, maybeNotifyUpdate, printAutoUpdate, recordAutoUpdate, refreshUpdateCheck, runUpgrade, selectAutoUpdate };
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { a as AUTO_UPDATE, b as VERSION, g as RUNNING_VIA_NPX } from "./environment-djS0ik60.js";
|
|
2
|
+
import { c as readSkillsSync, d as writeAutoUpdate, l as readUpdateCheck, n as readAutoUpdate, v as writeUpdateCheck } from "./config-CGcG7GOt.js";
|
|
3
|
+
import { r as spawnStream } from "./spawn-DmmmHIP-.js";
|
|
4
|
+
import { execFileSync } from "node:child_process";
|
|
5
|
+
import { existsSync, realpathSync } from "node:fs";
|
|
6
|
+
import { tmpdir } from "node:os";
|
|
7
|
+
import { join, sep } from "node:path";
|
|
8
|
+
import { fileURLToPath } from "node:url";
|
|
9
|
+
import pc from "picocolors";
|
|
10
|
+
|
|
11
|
+
//#region src/core/support/upgrade.ts
|
|
12
|
+
const CHECK_INTERVAL_MS = 1440 * 60 * 1e3;
|
|
13
|
+
const REGISTRY_URL = "https://registry.npmjs.org/superwall/latest";
|
|
14
|
+
const pending = [];
|
|
15
|
+
function isNewerVersion(latest, current) {
|
|
16
|
+
const l = latest.split(".").map((n) => parseInt(n, 10));
|
|
17
|
+
const c = current.split(".").map((n) => parseInt(n, 10));
|
|
18
|
+
for (let i = 0; i < 3; i++) {
|
|
19
|
+
const a = l[i] ?? 0;
|
|
20
|
+
const b = c[i] ?? 0;
|
|
21
|
+
if (Number.isNaN(a) || Number.isNaN(b)) return false;
|
|
22
|
+
if (a !== b) return a > b;
|
|
23
|
+
}
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
async function selectLatestVersion() {
|
|
27
|
+
try {
|
|
28
|
+
const res = await fetch(REGISTRY_URL, {
|
|
29
|
+
headers: { accept: "application/json" },
|
|
30
|
+
signal: AbortSignal.timeout(5e3)
|
|
31
|
+
});
|
|
32
|
+
if (!res.ok) return null;
|
|
33
|
+
const { version } = await res.json();
|
|
34
|
+
return version ?? null;
|
|
35
|
+
} catch {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function majorOf(version) {
|
|
40
|
+
return parseInt(version.split(".")[0] ?? "", 10);
|
|
41
|
+
}
|
|
42
|
+
function selectAvailableUpdate() {
|
|
43
|
+
const latest = readUpdateCheck()?.latest;
|
|
44
|
+
if (!latest || !isNewerVersion(latest, VERSION)) return null;
|
|
45
|
+
return latest;
|
|
46
|
+
}
|
|
47
|
+
function refreshUpdateCheck() {
|
|
48
|
+
if (process.env.NODE_TEST_CONTEXT) return;
|
|
49
|
+
const cached = readUpdateCheck();
|
|
50
|
+
if ((cached?.checkedAt ? Date.now() - Date.parse(cached.checkedAt) : Infinity) < CHECK_INTERVAL_MS) return;
|
|
51
|
+
pending.push(selectLatestVersion().then((version) => {
|
|
52
|
+
if (version) writeUpdateCheck({
|
|
53
|
+
latest: version,
|
|
54
|
+
checkedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
55
|
+
});
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
async function flushUpdateCheck(capMs = 2e3) {
|
|
59
|
+
if (pending.length === 0) return;
|
|
60
|
+
await Promise.race([Promise.allSettled(pending), new Promise((done) => setTimeout(done, capMs).unref())]);
|
|
61
|
+
}
|
|
62
|
+
function maybeNotifyUpdate(stream) {
|
|
63
|
+
const latest = selectAvailableUpdate();
|
|
64
|
+
if (!latest) return;
|
|
65
|
+
stream.write(`${pc.dim(`Update available ${VERSION} → ${latest} · run \`superwall upgrade\``)}\n`);
|
|
66
|
+
}
|
|
67
|
+
function selectAutoUpdate() {
|
|
68
|
+
if (process.env.NODE_TEST_CONTEXT || !AUTO_UPDATE()) return null;
|
|
69
|
+
const latest = selectAvailableUpdate();
|
|
70
|
+
if (!latest || majorOf(latest) !== majorOf(VERSION)) return null;
|
|
71
|
+
const last = readAutoUpdate();
|
|
72
|
+
if (last?.version === latest && Date.now() - Date.parse(last.startedAt) < CHECK_INTERVAL_MS) return null;
|
|
73
|
+
return latest;
|
|
74
|
+
}
|
|
75
|
+
function recordAutoUpdate(version) {
|
|
76
|
+
writeAutoUpdate({
|
|
77
|
+
version,
|
|
78
|
+
startedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function printAutoUpdate(stream, version) {
|
|
82
|
+
stream.write(`${pc.dim(`Updating ${VERSION} → ${version} in the background`)}\n`);
|
|
83
|
+
}
|
|
84
|
+
function isGlobalInstall(file = fileURLToPath(import.meta.url)) {
|
|
85
|
+
try {
|
|
86
|
+
const root = execFileSync("npm", ["root", "--global"], {
|
|
87
|
+
encoding: "utf8",
|
|
88
|
+
timeout: 3e3,
|
|
89
|
+
stdio: [
|
|
90
|
+
"ignore",
|
|
91
|
+
"pipe",
|
|
92
|
+
"ignore"
|
|
93
|
+
]
|
|
94
|
+
}).trim();
|
|
95
|
+
return root !== "" && realpathSync(file).startsWith(`${realpathSync(root)}${sep}`);
|
|
96
|
+
} catch {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const SKILLS_OUTCOME = {
|
|
101
|
+
current: "Superwall skills are up to date",
|
|
102
|
+
updated: "Superwall skills updated",
|
|
103
|
+
failed: "Superwall skills not updated"
|
|
104
|
+
};
|
|
105
|
+
async function updateAgentSkills(ctx, work) {
|
|
106
|
+
const spin = ctx.ui.spinner();
|
|
107
|
+
spin.start("Checking Superwall skills");
|
|
108
|
+
const skills = await work().catch(() => "failed");
|
|
109
|
+
spin.stop(SKILLS_OUTCOME[skills]);
|
|
110
|
+
if (skills === "failed") ctx.ui.warn("Couldn't update the Superwall skills. Run `superwall skills --force` to retry.");
|
|
111
|
+
return skills;
|
|
112
|
+
}
|
|
113
|
+
async function updateSkillsInProcess() {
|
|
114
|
+
const { updateSkills } = await import("./skills-DzOvse9L.js");
|
|
115
|
+
return updateSkills();
|
|
116
|
+
}
|
|
117
|
+
async function updateSkillsWithInstalledCli(version) {
|
|
118
|
+
const prefix = [];
|
|
119
|
+
const { code } = await spawnStream({
|
|
120
|
+
bin: "npm",
|
|
121
|
+
args: ["prefix", "--global"],
|
|
122
|
+
cwd: process.cwd(),
|
|
123
|
+
onStdoutLine: (line) => prefix.push(line.trim())
|
|
124
|
+
});
|
|
125
|
+
const bin = prefix[0] ? join(prefix[0], "bin", "superwall") : void 0;
|
|
126
|
+
if (code !== 0 || !bin || !existsSync(bin)) return "failed";
|
|
127
|
+
const startedAt = Date.now();
|
|
128
|
+
if ((await spawnStream({
|
|
129
|
+
bin,
|
|
130
|
+
args: [
|
|
131
|
+
"skills",
|
|
132
|
+
"--force",
|
|
133
|
+
"--yes"
|
|
134
|
+
],
|
|
135
|
+
cwd: tmpdir(),
|
|
136
|
+
onStdoutLine: () => {},
|
|
137
|
+
onStderrLine: () => {}
|
|
138
|
+
})).code !== 0) return "failed";
|
|
139
|
+
const sync = readSkillsSync();
|
|
140
|
+
return sync?.cliVersion === version && Date.parse(sync.syncedAt) >= startedAt ? "updated" : "failed";
|
|
141
|
+
}
|
|
142
|
+
async function runUpgrade(ctx, pinned) {
|
|
143
|
+
const { ui } = ctx;
|
|
144
|
+
if (RUNNING_VIA_NPX()) {
|
|
145
|
+
ui.info("You're running via npx, which always fetches the latest published version - nothing to upgrade.");
|
|
146
|
+
const skills$1 = await updateAgentSkills(ctx, updateSkillsInProcess);
|
|
147
|
+
if (ctx.json) return ctx.output.data({
|
|
148
|
+
upgraded: false,
|
|
149
|
+
via: "npx",
|
|
150
|
+
skills: skills$1
|
|
151
|
+
});
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
ui.intro("Superwall upgrade");
|
|
155
|
+
const spin = ui.spinner();
|
|
156
|
+
spin.start("Checking the latest version");
|
|
157
|
+
const latest = pinned ?? await selectLatestVersion();
|
|
158
|
+
if (!latest) {
|
|
159
|
+
spin.stop("Check failed");
|
|
160
|
+
throw new Error("Couldn't reach the npm registry - try again.");
|
|
161
|
+
}
|
|
162
|
+
if (!isNewerVersion(latest, VERSION)) {
|
|
163
|
+
spin.stop(`You're on the latest version (\`${VERSION}\`)`);
|
|
164
|
+
const skills$1 = await updateAgentSkills(ctx, updateSkillsInProcess);
|
|
165
|
+
if (ctx.json) return ctx.output.data({
|
|
166
|
+
upgraded: false,
|
|
167
|
+
version: VERSION,
|
|
168
|
+
skills: skills$1
|
|
169
|
+
});
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
spin.message(`Upgrading \`${VERSION}\` → \`${latest}\``);
|
|
173
|
+
const errors = [];
|
|
174
|
+
const { code } = await spawnStream({
|
|
175
|
+
bin: "npm",
|
|
176
|
+
args: [
|
|
177
|
+
"install",
|
|
178
|
+
"--global",
|
|
179
|
+
`superwall@${latest}`
|
|
180
|
+
],
|
|
181
|
+
cwd: process.cwd(),
|
|
182
|
+
onStdoutLine: () => {},
|
|
183
|
+
onStderrLine: (line) => errors.push(line)
|
|
184
|
+
});
|
|
185
|
+
if (code !== 0) {
|
|
186
|
+
spin.stop("Upgrade failed");
|
|
187
|
+
const detail = errors.slice(-3).join(" ").trim();
|
|
188
|
+
throw new Error(`npm couldn't upgrade the package${detail ? ` (${detail.slice(0, 200)})` : ""}. Try: npm install --global superwall@latest`);
|
|
189
|
+
}
|
|
190
|
+
writeUpdateCheck({
|
|
191
|
+
latest,
|
|
192
|
+
checkedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
193
|
+
});
|
|
194
|
+
spin.stop(`Upgraded \`${VERSION}\` → \`${latest}\``);
|
|
195
|
+
const skills = await updateAgentSkills(ctx, () => updateSkillsWithInstalledCli(latest));
|
|
196
|
+
if (ctx.json) return ctx.output.data({
|
|
197
|
+
upgraded: true,
|
|
198
|
+
from: VERSION,
|
|
199
|
+
to: latest,
|
|
200
|
+
skills
|
|
201
|
+
});
|
|
202
|
+
ui.outro("You're on the latest version.");
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
//#endregion
|
|
206
|
+
export { printAutoUpdate as a, runUpgrade as c, maybeNotifyUpdate as i, selectAutoUpdate as l, isGlobalInstall as n, recordAutoUpdate as o, isNewerVersion as r, refreshUpdateCheck as s, flushUpdateCheck as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superwall/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "The official CLI for managing Superwall from your terminal or coding agent.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
66
|
"@anthropic-ai/claude-agent-sdk": "0.3.201",
|
|
67
|
-
"@superwall/studio": "2.
|
|
67
|
+
"@superwall/studio": "2.4.0",
|
|
68
68
|
"ansi-escapes": "^7.3.0",
|
|
69
69
|
"fast-glob": "^3.3.3",
|
|
70
70
|
"ink": "^5.2.1",
|
package/prompts/commandments.xml
CHANGED
|
@@ -13,5 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
<rule>Follow the task's output instructions exactly: for an implementation task, do NOT write a long summary - end with '[STATUS] Done'; for a review/report task, end with the concise report it asks for.</rule>
|
|
15
15
|
|
|
16
|
+
<rule>When you confirm a Superwall bug, a wrong or missing doc, or a capability the user needed that Superwall lacks, report it yourself without asking (Superwall's terms cover it): `superwall feedback "MESSAGE" --kind bug|docs|idea --use-case "USE_CASE" --app APP_ID --json`, where MESSAGE says what you ran, expected and got, and USE_CASE what the user is trying to do and why. Leave out secrets and end users' personal data. Then say so in one [STATUS] line.</rule>
|
|
17
|
+
|
|
16
18
|
<rule>If you cannot complete the integration safely (ambiguous project, missing entry point, would require destructive changes), stop and explain what you need instead of guessing.</rule>
|
|
17
19
|
</rules>
|
package/dist/create-DNfuZ9os.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import "./token-4dQOfOaK.js";
|
|
2
|
-
import "./output-Ggzq5_-t.js";
|
|
3
|
-
import "./environment-a7W-0wg0.js";
|
|
4
|
-
import "./storage-BcvKhvzZ.js";
|
|
5
|
-
import "./client-CYtQvWJR.js";
|
|
6
|
-
import "./held-CEyXc1SI.js";
|
|
7
|
-
import "./config-BO1Y87kV.js";
|
|
8
|
-
import "./spinner-D6phP4Af.js";
|
|
9
|
-
import "./ui-D_qf3Gvw.js";
|
|
10
|
-
import "./paths-Cp_lgyWO.js";
|
|
11
|
-
import "./resources-DKn4itf3.js";
|
|
12
|
-
import "./org-BJCyaL1b.js";
|
|
13
|
-
import "./lookup-Dor6ch5A.js";
|
|
14
|
-
import "./scope-92neiQ2q.js";
|
|
15
|
-
import "./client-BZ1UbpXz.js";
|
|
16
|
-
import "./timing-BVxPrYq3.js";
|
|
17
|
-
import { i as runAscKeysCreate, n as keyAccess, r as keyRole, t as createAndSaveKey } from "./create-BaP6hoQ1.js";
|
|
18
|
-
|
|
19
|
-
export { createAndSaveKey, keyAccess, keyRole, runAscKeysCreate };
|
package/dist/held-C4BiAQ_X.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import "./token-4dQOfOaK.js";
|
|
2
|
-
import "./output-Ggzq5_-t.js";
|
|
3
|
-
import "./environment-a7W-0wg0.js";
|
|
4
|
-
import "./storage-BcvKhvzZ.js";
|
|
5
|
-
import "./client-CYtQvWJR.js";
|
|
6
|
-
import { t as upsertHeldKey } from "./held-CEyXc1SI.js";
|
|
7
|
-
import "./config-BO1Y87kV.js";
|
|
8
|
-
import "./spinner-D6phP4Af.js";
|
|
9
|
-
import "./ui-D_qf3Gvw.js";
|
|
10
|
-
import "./resources-DKn4itf3.js";
|
|
11
|
-
import "./org-BJCyaL1b.js";
|
|
12
|
-
import "./lookup-Dor6ch5A.js";
|
|
13
|
-
import "./scope-92neiQ2q.js";
|
|
14
|
-
import "./client-BZ1UbpXz.js";
|
|
15
|
-
|
|
16
|
-
export { upsertHeldKey };
|
package/dist/login-DV70XgZO.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import "./token-4dQOfOaK.js";
|
|
2
|
-
import "./output-Ggzq5_-t.js";
|
|
3
|
-
import "./environment-a7W-0wg0.js";
|
|
4
|
-
import "./storage-BcvKhvzZ.js";
|
|
5
|
-
import "./client-CYtQvWJR.js";
|
|
6
|
-
import "./config-BO1Y87kV.js";
|
|
7
|
-
import "./telemetry-BpYXL-z3.js";
|
|
8
|
-
import "./spawn-DmmmHIP-.js";
|
|
9
|
-
import "./spinner-D6phP4Af.js";
|
|
10
|
-
import "./ui-D_qf3Gvw.js";
|
|
11
|
-
import "./scan-Be17rMcQ.js";
|
|
12
|
-
import "./paths-Cp_lgyWO.js";
|
|
13
|
-
import { i as startLogin, n as pollLogin, r as runLogin, t as performLogin } from "./login-DrMLxlF4.js";
|
|
14
|
-
import "./skills-miJDcjQ2.js";
|
|
15
|
-
|
|
16
|
-
export { performLogin, pollLogin, runLogin, startLogin };
|
package/dist/push-YEPqa6hs.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import "./token-4dQOfOaK.js";
|
|
2
|
-
import "./output-Ggzq5_-t.js";
|
|
3
|
-
import "./environment-a7W-0wg0.js";
|
|
4
|
-
import "./storage-BcvKhvzZ.js";
|
|
5
|
-
import "./client-CYtQvWJR.js";
|
|
6
|
-
import "./config-BO1Y87kV.js";
|
|
7
|
-
import "./telemetry-BpYXL-z3.js";
|
|
8
|
-
import "./spawn-DmmmHIP-.js";
|
|
9
|
-
import "./spinner-D6phP4Af.js";
|
|
10
|
-
import "./ui-D_qf3Gvw.js";
|
|
11
|
-
import "./scan-Be17rMcQ.js";
|
|
12
|
-
import "./paths-Cp_lgyWO.js";
|
|
13
|
-
import "./resources-DKn4itf3.js";
|
|
14
|
-
import "./lookup-Dor6ch5A.js";
|
|
15
|
-
import "./login-DrMLxlF4.js";
|
|
16
|
-
import "./skills-miJDcjQ2.js";
|
|
17
|
-
import "./assets-Diivv88t.js";
|
|
18
|
-
import "./selection-C5ZY23dQ.js";
|
|
19
|
-
import "./session-CdnUL4zt.js";
|
|
20
|
-
import "./source-push-NVrs53Uo.js";
|
|
21
|
-
import { i as timed, n as runPush, r as runPushPipeline, t as group } from "./push-D-dewDd1.js";
|
|
22
|
-
import "./login-NxCl2WuU.js";
|
|
23
|
-
|
|
24
|
-
export { group, runPush, runPushPipeline, timed };
|
package/dist/scan-CocGVPe0.js
DELETED
package/dist/server-1pOxW1GJ.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import "./token-4dQOfOaK.js";
|
|
2
|
-
import "./output-Ggzq5_-t.js";
|
|
3
|
-
import "./environment-a7W-0wg0.js";
|
|
4
|
-
import "./storage-BcvKhvzZ.js";
|
|
5
|
-
import "./client-CYtQvWJR.js";
|
|
6
|
-
import "./config-BO1Y87kV.js";
|
|
7
|
-
import "./telemetry-BpYXL-z3.js";
|
|
8
|
-
import "./spawn-DmmmHIP-.js";
|
|
9
|
-
import "./spinner-D6phP4Af.js";
|
|
10
|
-
import "./ui-D_qf3Gvw.js";
|
|
11
|
-
import "./scan-Be17rMcQ.js";
|
|
12
|
-
import "./paths-Cp_lgyWO.js";
|
|
13
|
-
import "./resources-DKn4itf3.js";
|
|
14
|
-
import "./lookup-Dor6ch5A.js";
|
|
15
|
-
import "./login-DrMLxlF4.js";
|
|
16
|
-
import "./skills-miJDcjQ2.js";
|
|
17
|
-
import "./assets-Diivv88t.js";
|
|
18
|
-
import "./selection-C5ZY23dQ.js";
|
|
19
|
-
import "./session-CdnUL4zt.js";
|
|
20
|
-
import "./source-push-NVrs53Uo.js";
|
|
21
|
-
import "./login-NxCl2WuU.js";
|
|
22
|
-
import { t as runStudio } from "./server-DZ7L28w4.js";
|
|
23
|
-
|
|
24
|
-
export { runStudio };
|
package/dist/session-Cm0U68t3.js
DELETED
package/dist/skills-B_oH2dYK.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import "./token-4dQOfOaK.js";
|
|
2
|
-
import "./output-Ggzq5_-t.js";
|
|
3
|
-
import "./environment-a7W-0wg0.js";
|
|
4
|
-
import "./storage-BcvKhvzZ.js";
|
|
5
|
-
import "./client-CYtQvWJR.js";
|
|
6
|
-
import "./config-BO1Y87kV.js";
|
|
7
|
-
import "./telemetry-BpYXL-z3.js";
|
|
8
|
-
import "./spawn-DmmmHIP-.js";
|
|
9
|
-
import "./spinner-D6phP4Af.js";
|
|
10
|
-
import "./ui-D_qf3Gvw.js";
|
|
11
|
-
import "./paths-Cp_lgyWO.js";
|
|
12
|
-
import { a as bundledSkills, c as knownSkills, d as readBundledSkill, f as runSkills, 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-miJDcjQ2.js";
|
|
13
|
-
|
|
14
|
-
export { PLAYBOOKS, SKILLS_INSTALL_SOURCE, SKILLS_REF, SUPERWALL_SKILLS_SOURCE, bundledSkills, checkSkillsSync, ensureSkillsCurrent, knownSkills, normalizeSkillFrontmatter, normalizeSkillsDir, readBundledSkill, runSkills, skillSummary, skillsRefFor };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import "./token-4dQOfOaK.js";
|
|
2
|
-
import "./output-Ggzq5_-t.js";
|
|
3
|
-
import "./environment-a7W-0wg0.js";
|
|
4
|
-
import "./storage-BcvKhvzZ.js";
|
|
5
|
-
import "./client-CYtQvWJR.js";
|
|
6
|
-
import "./config-BO1Y87kV.js";
|
|
7
|
-
import "./spinner-D6phP4Af.js";
|
|
8
|
-
import "./ui-D_qf3Gvw.js";
|
|
9
|
-
import "./resources-DKn4itf3.js";
|
|
10
|
-
import "./org-BJCyaL1b.js";
|
|
11
|
-
import "./lookup-Dor6ch5A.js";
|
|
12
|
-
import "./scope-92neiQ2q.js";
|
|
13
|
-
import "./input-vi0bou04.js";
|
|
14
|
-
import { n as writeStoreKit, t as generateStoreKit } from "./storekit-Di3BkafX.js";
|
|
15
|
-
|
|
16
|
-
export { generateStoreKit, writeStoreKit };
|
package/dist/upgrade-BnOq32zn.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import "./output-Ggzq5_-t.js";
|
|
2
|
-
import "./environment-a7W-0wg0.js";
|
|
3
|
-
import "./config-BO1Y87kV.js";
|
|
4
|
-
import "./spawn-DmmmHIP-.js";
|
|
5
|
-
import { a as runUpgrade, i as refreshUpdateCheck, n as isNewerVersion, r as maybeNotifyUpdate, t as flushUpdateCheck } from "./upgrade-Cb6f4S_c.js";
|
|
6
|
-
|
|
7
|
-
export { flushUpdateCheck, isNewerVersion, maybeNotifyUpdate, refreshUpdateCheck, runUpgrade };
|
package/dist/upgrade-Cb6f4S_c.js
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { m as RUNNING_VIA_NPX, v as VERSION } from "./environment-a7W-0wg0.js";
|
|
2
|
-
import { c as readUpdateCheck, g as writeUpdateCheck } from "./config-BO1Y87kV.js";
|
|
3
|
-
import { r as spawnStream } from "./spawn-DmmmHIP-.js";
|
|
4
|
-
import pc from "picocolors";
|
|
5
|
-
|
|
6
|
-
//#region src/core/support/upgrade.ts
|
|
7
|
-
const CHECK_INTERVAL_MS = 1440 * 60 * 1e3;
|
|
8
|
-
const REGISTRY_URL = "https://registry.npmjs.org/superwall/latest";
|
|
9
|
-
const pending = [];
|
|
10
|
-
function isNewerVersion(latest, current) {
|
|
11
|
-
const l = latest.split(".").map((n) => parseInt(n, 10));
|
|
12
|
-
const c = current.split(".").map((n) => parseInt(n, 10));
|
|
13
|
-
for (let i = 0; i < 3; i++) {
|
|
14
|
-
const a = l[i] ?? 0;
|
|
15
|
-
const b = c[i] ?? 0;
|
|
16
|
-
if (Number.isNaN(a) || Number.isNaN(b)) return false;
|
|
17
|
-
if (a !== b) return a > b;
|
|
18
|
-
}
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
async function selectLatestVersion() {
|
|
22
|
-
try {
|
|
23
|
-
const res = await fetch(REGISTRY_URL, {
|
|
24
|
-
headers: { accept: "application/json" },
|
|
25
|
-
signal: AbortSignal.timeout(5e3)
|
|
26
|
-
});
|
|
27
|
-
if (!res.ok) return null;
|
|
28
|
-
const { version } = await res.json();
|
|
29
|
-
return version ?? null;
|
|
30
|
-
} catch {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
function selectAvailableUpdate() {
|
|
35
|
-
const latest = readUpdateCheck()?.latest;
|
|
36
|
-
if (!latest || !isNewerVersion(latest, VERSION)) return null;
|
|
37
|
-
return latest;
|
|
38
|
-
}
|
|
39
|
-
function refreshUpdateCheck() {
|
|
40
|
-
if (process.env.NODE_TEST_CONTEXT) return;
|
|
41
|
-
const cached = readUpdateCheck();
|
|
42
|
-
if ((cached?.checkedAt ? Date.now() - Date.parse(cached.checkedAt) : Infinity) < CHECK_INTERVAL_MS) return;
|
|
43
|
-
pending.push(selectLatestVersion().then((version) => {
|
|
44
|
-
if (version) writeUpdateCheck({
|
|
45
|
-
latest: version,
|
|
46
|
-
checkedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
47
|
-
});
|
|
48
|
-
}));
|
|
49
|
-
}
|
|
50
|
-
async function flushUpdateCheck(capMs = 2e3) {
|
|
51
|
-
if (pending.length === 0) return;
|
|
52
|
-
await Promise.race([Promise.allSettled(pending), new Promise((done) => setTimeout(done, capMs).unref())]);
|
|
53
|
-
}
|
|
54
|
-
function maybeNotifyUpdate(stream) {
|
|
55
|
-
const latest = selectAvailableUpdate();
|
|
56
|
-
if (!latest) return;
|
|
57
|
-
stream.write(`${pc.dim(`Update available ${VERSION} → ${latest} · run \`superwall upgrade\``)}\n`);
|
|
58
|
-
}
|
|
59
|
-
async function runUpgrade(ctx) {
|
|
60
|
-
const { ui } = ctx;
|
|
61
|
-
if (RUNNING_VIA_NPX()) {
|
|
62
|
-
if (ctx.json) return ctx.output.data({
|
|
63
|
-
upgraded: false,
|
|
64
|
-
via: "npx"
|
|
65
|
-
});
|
|
66
|
-
ui.info("You're running via npx, which always fetches the latest published version - nothing to upgrade.");
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
ui.intro("Superwall upgrade");
|
|
70
|
-
const spin = ui.spinner();
|
|
71
|
-
spin.start("Checking the latest version");
|
|
72
|
-
const latest = await selectLatestVersion();
|
|
73
|
-
if (!latest) {
|
|
74
|
-
spin.stop("Check failed");
|
|
75
|
-
throw new Error("Couldn't reach the npm registry - try again.");
|
|
76
|
-
}
|
|
77
|
-
if (!isNewerVersion(latest, VERSION)) {
|
|
78
|
-
spin.stop(`You're on the latest version (\`${VERSION}\`)`);
|
|
79
|
-
if (ctx.json) return ctx.output.data({
|
|
80
|
-
upgraded: false,
|
|
81
|
-
version: VERSION
|
|
82
|
-
});
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
spin.message(`Upgrading \`${VERSION}\` → \`${latest}\``);
|
|
86
|
-
const errors = [];
|
|
87
|
-
const { code } = await spawnStream({
|
|
88
|
-
bin: "npm",
|
|
89
|
-
args: [
|
|
90
|
-
"install",
|
|
91
|
-
"--global",
|
|
92
|
-
`superwall@${latest}`
|
|
93
|
-
],
|
|
94
|
-
cwd: process.cwd(),
|
|
95
|
-
onStdoutLine: () => {},
|
|
96
|
-
onStderrLine: (line) => errors.push(line)
|
|
97
|
-
});
|
|
98
|
-
if (code !== 0) {
|
|
99
|
-
spin.stop("Upgrade failed");
|
|
100
|
-
const detail = errors.slice(-3).join(" ").trim();
|
|
101
|
-
throw new Error(`npm couldn't upgrade the package${detail ? ` (${detail.slice(0, 200)})` : ""}. Try: npm install --global superwall@latest`);
|
|
102
|
-
}
|
|
103
|
-
writeUpdateCheck({
|
|
104
|
-
latest,
|
|
105
|
-
checkedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
106
|
-
});
|
|
107
|
-
spin.stop(`Upgraded \`${VERSION}\` → \`${latest}\``);
|
|
108
|
-
if (ctx.json) return ctx.output.data({
|
|
109
|
-
upgraded: true,
|
|
110
|
-
from: VERSION,
|
|
111
|
-
to: latest
|
|
112
|
-
});
|
|
113
|
-
ui.outro("You're on the latest version.");
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
//#endregion
|
|
117
|
-
export { runUpgrade as a, refreshUpdateCheck as i, isNewerVersion as n, maybeNotifyUpdate as r, flushUpdateCheck as t };
|