@superwall/cli 1.2.0 → 1.3.0-beta.4
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 +6 -4
- package/dist/{actions-DYQTxMXS.js → actions-C0sUjLGZ.js} +2 -2
- package/dist/{api-B2Zsf08U.js → api-NEcc9ESi.js} +9 -9
- package/dist/{api-output-B5hh0q4V.js → api-output-D9ggXQIr.js} +1 -1
- package/dist/{app-rYAP19Jo.js → app-vECLIkWi.js} +11 -11
- package/dist/{asa-DlM6dlPD.js → asa-CZcmgOho.js} +11 -11
- package/dist/{asc-D6qBCfuj.js → asc-mJv5I7lW.js} +12 -12
- package/dist/{auth-BEnVvJlK.js → auth-BCsxGMUQ.js} +10 -10
- package/dist/auth.js +2 -2
- package/dist/{billing-DO-gNWvW.js → billing-KoxHLZzm.js} +1 -1
- package/dist/{bind-KZhPLTdC.js → bind-CBLvcdzo.js} +4 -4
- package/dist/{command-B12qooZb.js → command-Bav1fWvv.js} +93 -102
- package/dist/{create-BTEvRC1X.js → create-CA_s5fN9.js} +18 -18
- package/dist/{dev-CwfCGm36.js → dev-B1o8OCRT.js} +37 -19
- package/dist/{doctor-DIxs8i8A.js → doctor-CyiygODt.js} +10 -10
- package/dist/{drivers-D6Ka26e2.js → drivers-DSkM9kMJ.js} +2 -2
- package/dist/entry.js +523 -467
- package/dist/{existing-CECenoHS.js → existing-D7p2hnhq.js} +2 -2
- package/dist/{feedback-CV2coV73.js → feedback-BBIkn1Yp.js} +9 -9
- package/dist/{git-CCJwXufi.js → git-C0x00Urq.js} +10 -10
- package/dist/{hosted-BCwzTTEw.js → hosted-q7_n5udj.js} +3 -3
- package/dist/{integrate-Bhq0wkU0.js → integrate-DstRn_NP.js} +28 -27
- package/dist/{login-D5TjqsXJ.js → login-DGc6GQqT.js} +8 -7
- package/dist/{migrate-Cz7VqQNj.js → migrate-CcwiRU6G.js} +20 -20
- package/dist/{org-B2gy9Pmu.js → org-Cg25bcsj.js} +3 -3
- package/dist/output-DmEUd7Xa.js +123 -0
- package/dist/{params-Bvq0iqQK.js → params-B1zeElGa.js} +1 -2
- package/dist/{pipeline-ChRDxU9b.js → pipeline-B3c4tjfA.js} +105 -98
- package/dist/{print-skill-BPePCjy4.js → print-skill-DBEmY01G.js} +7 -7
- package/dist/{promote-C54bfsg3.js → promote-bg_Li4za.js} +18 -18
- package/dist/publish-lviGUOF8.js +35 -0
- package/dist/push-C8vuasQL.js +35 -0
- package/dist/{query-CXjrBFow.js → query-dO6QUMTQ.js} +10 -10
- package/dist/{resource-CM2bIB5v.js → resource-BZvGoZlY.js} +13 -13
- package/dist/{resources-CVrWwA1K.js → resources-s64mBHaC.js} +1 -0
- package/dist/{run-CAIDPbwe.js → run-BfI8NVh4.js} +2 -2
- package/dist/{scan-BrikLKx5.js → scan-HfLbAkLc.js} +2 -2
- package/dist/{skills-BwXcAVIf.js → skills-BDMwScz3.js} +4 -3
- package/dist/{skills-_TULXe09.js → skills-DuI61I8U.js} +8 -8
- package/dist/{spinner-gOxIMz-V.js → spinner-B9dT3DBY.js} +1 -1
- package/dist/{telemetry-CpIXSAbQ.js → telemetry-vvgwHwjA.js} +6 -41
- package/dist/{token-DHRH8cxi.js → token-CwKfB5Ic.js} +2 -2
- package/dist/{ui-C4ncRJqd.js → ui-Lqt_zFOr.js} +5 -1
- package/dist/update-DeK9OQ5x.js +59 -0
- package/dist/{upgrade-BNPbzr5V.js → upgrade-Dyxk8mwJ.js} +6 -6
- package/package.json +4 -4
- package/dist/json-C3hPIMkI.js +0 -7
- package/dist/publish-NUNSIKri.js +0 -35
- package/dist/push-BjEpY9-h.js +0 -35
- package/dist/update-BdcpwRu_.js +0 -137
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { g as VERSION } from "./output-DmEUd7Xa.js";
|
|
2
|
+
import { d as getUpdateCheck, g as setUpdateCheck } from "./telemetry-vvgwHwjA.js";
|
|
3
|
+
import pc from "picocolors";
|
|
4
|
+
|
|
5
|
+
//#region src/core/update.ts
|
|
6
|
+
const CHECK_INTERVAL_MS = 1440 * 60 * 1e3;
|
|
7
|
+
const REGISTRY_URL = "https://registry.npmjs.org/superwall/latest";
|
|
8
|
+
const pending = [];
|
|
9
|
+
function isNewerVersion(latest, current) {
|
|
10
|
+
const l = latest.split(".").map((n) => parseInt(n, 10));
|
|
11
|
+
const c = current.split(".").map((n) => parseInt(n, 10));
|
|
12
|
+
for (let i = 0; i < 3; i++) {
|
|
13
|
+
const a = l[i] ?? 0;
|
|
14
|
+
const b = c[i] ?? 0;
|
|
15
|
+
if (Number.isNaN(a) || Number.isNaN(b)) return false;
|
|
16
|
+
if (a !== b) return a > b;
|
|
17
|
+
}
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
async function fetchLatestVersion() {
|
|
21
|
+
try {
|
|
22
|
+
const res = await fetch(REGISTRY_URL, {
|
|
23
|
+
headers: { accept: "application/json" },
|
|
24
|
+
signal: AbortSignal.timeout(5e3)
|
|
25
|
+
});
|
|
26
|
+
if (!res.ok) return null;
|
|
27
|
+
const { version } = await res.json();
|
|
28
|
+
return version ?? null;
|
|
29
|
+
} catch {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function availableUpdate() {
|
|
34
|
+
const cached = getUpdateCheck();
|
|
35
|
+
return cached?.latest && isNewerVersion(cached.latest, VERSION) ? cached.latest : null;
|
|
36
|
+
}
|
|
37
|
+
function refreshUpdateCheck() {
|
|
38
|
+
if (process.env.NODE_TEST_CONTEXT) return;
|
|
39
|
+
const cached = getUpdateCheck();
|
|
40
|
+
if ((cached?.checkedAt ? Date.now() - Date.parse(cached.checkedAt) : Infinity) < CHECK_INTERVAL_MS) return;
|
|
41
|
+
pending.push(fetchLatestVersion().then((version) => {
|
|
42
|
+
if (version) setUpdateCheck({
|
|
43
|
+
latest: version,
|
|
44
|
+
checkedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
45
|
+
});
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
async function flushUpdateCheck(capMs = 2e3) {
|
|
49
|
+
if (pending.length === 0) return;
|
|
50
|
+
await Promise.race([Promise.allSettled(pending), new Promise((done) => setTimeout(done, capMs).unref())]);
|
|
51
|
+
}
|
|
52
|
+
function maybeNotifyUpdate(stream) {
|
|
53
|
+
const latest = availableUpdate();
|
|
54
|
+
if (!latest) return;
|
|
55
|
+
stream.write(`${pc.dim(`Update available ${VERSION} → ${latest} · run \`superwall upgrade\``)}\n`);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
//#endregion
|
|
59
|
+
export { refreshUpdateCheck as a, maybeNotifyUpdate as i, flushUpdateCheck as n, isNewerVersion as r, fetchLatestVersion as t };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./
|
|
3
|
-
import { r as isNewerVersion, t as fetchLatestVersion } from "./update-
|
|
4
|
-
import "./token-
|
|
5
|
-
import { t as defineCommand } from "./command-
|
|
6
|
-
import "./ui-
|
|
1
|
+
import { g as VERSION } from "./output-DmEUd7Xa.js";
|
|
2
|
+
import { g as setUpdateCheck } from "./telemetry-vvgwHwjA.js";
|
|
3
|
+
import { r as isNewerVersion, t as fetchLatestVersion } from "./update-DeK9OQ5x.js";
|
|
4
|
+
import "./token-CwKfB5Ic.js";
|
|
5
|
+
import { t as defineCommand } from "./command-Bav1fWvv.js";
|
|
6
|
+
import "./ui-Lqt_zFOr.js";
|
|
7
7
|
import { r as spawnStream } from "./spawn-DSoTXy_j.js";
|
|
8
8
|
|
|
9
9
|
//#region src/commands/account/upgrade.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superwall/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0-beta.4",
|
|
4
4
|
"description": "The official CLI for managing Superwall from your terminal or coding agent.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -47,18 +47,18 @@
|
|
|
47
47
|
"watch": "tsdown --watch",
|
|
48
48
|
"regen:asc": "tsx scripts/regen-asc-index.ts",
|
|
49
49
|
"dev": "bun bin.ts",
|
|
50
|
-
"test": "tsx --test $(rg --files tests -g '*.test.ts')",
|
|
50
|
+
"test": "tsx --test --import ./tests/setup.ts $(rg --files tests -g '*.test.ts')",
|
|
51
51
|
"link:global": "tsdown && bun link",
|
|
52
52
|
"typecheck": "tsc --noEmit",
|
|
53
53
|
"prepack": "bun run build",
|
|
54
54
|
"prepublishOnly": "bun run typecheck && bun run test",
|
|
55
55
|
"test:run": "tsx --test $(rg --files tests -g '*.test.ts')",
|
|
56
|
-
"test:coverage": "tsx --test --experimental-test-coverage --test-coverage-lines=
|
|
56
|
+
"test:coverage": "tsx --test --import ./tests/setup.ts --experimental-test-coverage --test-coverage-lines=85 --test-coverage-branches=88 --test-coverage-functions=85 $(rg --files tests -g '*.test.ts')",
|
|
57
57
|
"clean": "rm -rf dist"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"@anthropic-ai/claude-agent-sdk": "0.3.201",
|
|
61
|
-
"@superwall/studio": "1.
|
|
61
|
+
"@superwall/studio": "1.3.0-beta.4",
|
|
62
62
|
"ansi-escapes": "^7.3.0",
|
|
63
63
|
"fast-glob": "^3.3.3",
|
|
64
64
|
"ink": "^5.2.1",
|
package/dist/json-C3hPIMkI.js
DELETED
package/dist/publish-NUNSIKri.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import "./telemetry-CpIXSAbQ.js";
|
|
2
|
-
import "./json-C3hPIMkI.js";
|
|
3
|
-
import "./update-BdcpwRu_.js";
|
|
4
|
-
import "./token-DHRH8cxi.js";
|
|
5
|
-
import { t as defineCommand } from "./command-B12qooZb.js";
|
|
6
|
-
import "./ui-C4ncRJqd.js";
|
|
7
|
-
import "./skills-BwXcAVIf.js";
|
|
8
|
-
import "./spawn-DSoTXy_j.js";
|
|
9
|
-
import "./login-D5TjqsXJ.js";
|
|
10
|
-
import "./scan-BrikLKx5.js";
|
|
11
|
-
import "./hosted-BCwzTTEw.js";
|
|
12
|
-
import "./spinner-gOxIMz-V.js";
|
|
13
|
-
import "./resources-CVrWwA1K.js";
|
|
14
|
-
import "./org-B2gy9Pmu.js";
|
|
15
|
-
import "./bind-KZhPLTdC.js";
|
|
16
|
-
import { i as requireApi } from "./git-CCJwXufi.js";
|
|
17
|
-
import "./actions-DYQTxMXS.js";
|
|
18
|
-
import "./app-rYAP19Jo.js";
|
|
19
|
-
import { o as runPushPipeline } from "./pipeline-ChRDxU9b.js";
|
|
20
|
-
|
|
21
|
-
//#region src/commands/paywalls/publish.ts
|
|
22
|
-
const runPublish = defineCommand({
|
|
23
|
-
name: "publish",
|
|
24
|
-
output: "human",
|
|
25
|
-
async run(context) {
|
|
26
|
-
const api = await requireApi(context.interactive);
|
|
27
|
-
await runPushPipeline({
|
|
28
|
-
...context,
|
|
29
|
-
api
|
|
30
|
-
}, { promote: true });
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
//#endregion
|
|
35
|
-
export { runPublish };
|
package/dist/push-BjEpY9-h.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import "./telemetry-CpIXSAbQ.js";
|
|
2
|
-
import "./json-C3hPIMkI.js";
|
|
3
|
-
import "./update-BdcpwRu_.js";
|
|
4
|
-
import "./token-DHRH8cxi.js";
|
|
5
|
-
import { t as defineCommand } from "./command-B12qooZb.js";
|
|
6
|
-
import "./ui-C4ncRJqd.js";
|
|
7
|
-
import "./skills-BwXcAVIf.js";
|
|
8
|
-
import "./spawn-DSoTXy_j.js";
|
|
9
|
-
import "./login-D5TjqsXJ.js";
|
|
10
|
-
import "./scan-BrikLKx5.js";
|
|
11
|
-
import "./hosted-BCwzTTEw.js";
|
|
12
|
-
import "./spinner-gOxIMz-V.js";
|
|
13
|
-
import "./resources-CVrWwA1K.js";
|
|
14
|
-
import "./org-B2gy9Pmu.js";
|
|
15
|
-
import "./bind-KZhPLTdC.js";
|
|
16
|
-
import { i as requireApi } from "./git-CCJwXufi.js";
|
|
17
|
-
import "./actions-DYQTxMXS.js";
|
|
18
|
-
import "./app-rYAP19Jo.js";
|
|
19
|
-
import { o as runPushPipeline } from "./pipeline-ChRDxU9b.js";
|
|
20
|
-
|
|
21
|
-
//#region src/commands/paywalls/push.ts
|
|
22
|
-
const runPush = defineCommand({
|
|
23
|
-
name: "push",
|
|
24
|
-
output: "human",
|
|
25
|
-
async run(context) {
|
|
26
|
-
const api = await requireApi(context.interactive);
|
|
27
|
-
await runPushPipeline({
|
|
28
|
-
...context,
|
|
29
|
-
api
|
|
30
|
-
}, { promote: false });
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
//#endregion
|
|
35
|
-
export { runPush };
|
package/dist/update-BdcpwRu_.js
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { k as VERSION, p as getUpdateCheck, v as setUpdateCheck } from "./telemetry-CpIXSAbQ.js";
|
|
2
|
-
import { t as formatJson } from "./json-C3hPIMkI.js";
|
|
3
|
-
import pc from "picocolors";
|
|
4
|
-
import { stripVTControlCharacters } from "node:util";
|
|
5
|
-
|
|
6
|
-
//#region src/output.ts
|
|
7
|
-
const blocks = {
|
|
8
|
-
intro: (text) => ({
|
|
9
|
-
kind: "intro",
|
|
10
|
-
text
|
|
11
|
-
}),
|
|
12
|
-
step: (text) => ({
|
|
13
|
-
kind: "step",
|
|
14
|
-
text
|
|
15
|
-
}),
|
|
16
|
-
info: (text) => ({
|
|
17
|
-
kind: "info",
|
|
18
|
-
text
|
|
19
|
-
}),
|
|
20
|
-
success: (text) => ({
|
|
21
|
-
kind: "success",
|
|
22
|
-
text
|
|
23
|
-
}),
|
|
24
|
-
warning: (text) => ({
|
|
25
|
-
kind: "warning",
|
|
26
|
-
text
|
|
27
|
-
}),
|
|
28
|
-
report: (text) => ({
|
|
29
|
-
kind: "report",
|
|
30
|
-
text
|
|
31
|
-
}),
|
|
32
|
-
list: (value) => ({
|
|
33
|
-
kind: "list",
|
|
34
|
-
value
|
|
35
|
-
}),
|
|
36
|
-
nextSteps: (items) => ({
|
|
37
|
-
kind: "nextSteps",
|
|
38
|
-
items
|
|
39
|
-
}),
|
|
40
|
-
outro: (text) => ({
|
|
41
|
-
kind: "outro",
|
|
42
|
-
text
|
|
43
|
-
})
|
|
44
|
-
};
|
|
45
|
-
function writeJson(stream, value) {
|
|
46
|
-
stream.write(`${formatJson(value)}\n`);
|
|
47
|
-
}
|
|
48
|
-
function createCommandOutput(mode, renderer, streams = { stdout: process.stdout }) {
|
|
49
|
-
return {
|
|
50
|
-
mode,
|
|
51
|
-
data(value) {
|
|
52
|
-
if (mode === "json") writeJson(streams.stdout, value);
|
|
53
|
-
else renderer.report(formatJson(value));
|
|
54
|
-
},
|
|
55
|
-
text(value) {
|
|
56
|
-
if (mode === "json") throw new Error("This command must return structured JSON in --json mode.");
|
|
57
|
-
const text = value.replace(/\n$/, "");
|
|
58
|
-
renderer.report(mode === "text" ? stripVTControlCharacters(text) : text);
|
|
59
|
-
},
|
|
60
|
-
render(...blocks$1) {
|
|
61
|
-
if (mode === "json") return;
|
|
62
|
-
for (const block of blocks$1) renderBlock(renderer, block);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
function renderBlock(renderer, block) {
|
|
67
|
-
switch (block.kind) {
|
|
68
|
-
case "intro": return renderer.intro(block.text);
|
|
69
|
-
case "step": return renderer.step(block.text);
|
|
70
|
-
case "info": return renderer.info(block.text);
|
|
71
|
-
case "success": return renderer.success(block.text);
|
|
72
|
-
case "warning": return renderer.warn(block.text);
|
|
73
|
-
case "report": return renderer.report(block.text);
|
|
74
|
-
case "list": return renderer.list(block.value);
|
|
75
|
-
case "nextSteps":
|
|
76
|
-
if (block.items.length) renderer.note(block.items.map((item, index) => `${index + 1}. ${item}`).join("\n"), "Next steps");
|
|
77
|
-
return;
|
|
78
|
-
case "outro": return renderer.outro(block.text);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
//#endregion
|
|
83
|
-
//#region src/core/update.ts
|
|
84
|
-
const CHECK_INTERVAL_MS = 1440 * 60 * 1e3;
|
|
85
|
-
const REGISTRY_URL = "https://registry.npmjs.org/superwall/latest";
|
|
86
|
-
const pending = [];
|
|
87
|
-
function isNewerVersion(latest, current) {
|
|
88
|
-
const l = latest.split(".").map((n) => parseInt(n, 10));
|
|
89
|
-
const c = current.split(".").map((n) => parseInt(n, 10));
|
|
90
|
-
for (let i = 0; i < 3; i++) {
|
|
91
|
-
const a = l[i] ?? 0;
|
|
92
|
-
const b = c[i] ?? 0;
|
|
93
|
-
if (Number.isNaN(a) || Number.isNaN(b)) return false;
|
|
94
|
-
if (a !== b) return a > b;
|
|
95
|
-
}
|
|
96
|
-
return false;
|
|
97
|
-
}
|
|
98
|
-
async function fetchLatestVersion() {
|
|
99
|
-
try {
|
|
100
|
-
const res = await fetch(REGISTRY_URL, {
|
|
101
|
-
headers: { accept: "application/json" },
|
|
102
|
-
signal: AbortSignal.timeout(5e3)
|
|
103
|
-
});
|
|
104
|
-
if (!res.ok) return null;
|
|
105
|
-
const { version } = await res.json();
|
|
106
|
-
return version ?? null;
|
|
107
|
-
} catch {
|
|
108
|
-
return null;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
function availableUpdate() {
|
|
112
|
-
const cached = getUpdateCheck();
|
|
113
|
-
return cached?.latest && isNewerVersion(cached.latest, VERSION) ? cached.latest : null;
|
|
114
|
-
}
|
|
115
|
-
function refreshUpdateCheck() {
|
|
116
|
-
if (process.env.NODE_TEST_CONTEXT) return;
|
|
117
|
-
const cached = getUpdateCheck();
|
|
118
|
-
if ((cached?.checkedAt ? Date.now() - Date.parse(cached.checkedAt) : Infinity) < CHECK_INTERVAL_MS) return;
|
|
119
|
-
pending.push(fetchLatestVersion().then((version) => {
|
|
120
|
-
if (version) setUpdateCheck({
|
|
121
|
-
latest: version,
|
|
122
|
-
checkedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
123
|
-
});
|
|
124
|
-
}));
|
|
125
|
-
}
|
|
126
|
-
async function flushUpdateCheck(capMs = 2e3) {
|
|
127
|
-
if (pending.length === 0) return;
|
|
128
|
-
await Promise.race([Promise.allSettled(pending), new Promise((done) => setTimeout(done, capMs).unref())]);
|
|
129
|
-
}
|
|
130
|
-
function maybeNotifyUpdate(stream) {
|
|
131
|
-
const latest = availableUpdate();
|
|
132
|
-
if (!latest) return;
|
|
133
|
-
stream.write(`${pc.dim(`Update available ${VERSION} → ${latest} · run \`superwall upgrade\``)}\n`);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
//#endregion
|
|
137
|
-
export { refreshUpdateCheck as a, writeJson as c, maybeNotifyUpdate as i, flushUpdateCheck as n, blocks as o, isNewerVersion as r, createCommandOutput as s, fetchLatestVersion as t };
|