@superwall/cli 1.2.0 → 1.3.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +6 -4
  2. package/dist/{actions-DYQTxMXS.js → actions-DvHycH3X.js} +2 -2
  3. package/dist/{api-B2Zsf08U.js → api-B50i89j0.js} +9 -9
  4. package/dist/{api-output-B5hh0q4V.js → api-output-D9ggXQIr.js} +1 -1
  5. package/dist/{app-rYAP19Jo.js → app-FiC9SQVp.js} +11 -11
  6. package/dist/{asa-DlM6dlPD.js → asa-B5hrBL3t.js} +11 -11
  7. package/dist/{asc-D6qBCfuj.js → asc-CRtRYv17.js} +12 -12
  8. package/dist/{auth-BEnVvJlK.js → auth-CYognaF4.js} +10 -10
  9. package/dist/auth.js +2 -2
  10. package/dist/{billing-DO-gNWvW.js → billing-CSOUhWso.js} +1 -1
  11. package/dist/{bind-KZhPLTdC.js → bind-BbzBenoP.js} +4 -4
  12. package/dist/{command-B12qooZb.js → command-B7Te31wp.js} +93 -102
  13. package/dist/{create-BTEvRC1X.js → create--Q8nPgoa.js} +18 -18
  14. package/dist/{dev-CwfCGm36.js → dev-Dr6gXH-o.js} +37 -19
  15. package/dist/{doctor-DIxs8i8A.js → doctor-Cf0qNjbq.js} +10 -10
  16. package/dist/{drivers-D6Ka26e2.js → drivers-ItOmKzrw.js} +2 -2
  17. package/dist/entry.js +523 -467
  18. package/dist/{existing-CECenoHS.js → existing-B-e22WOr.js} +2 -2
  19. package/dist/{feedback-CV2coV73.js → feedback-C3UtAxye.js} +9 -9
  20. package/dist/{git-CCJwXufi.js → git-2wRxiwOc.js} +10 -10
  21. package/dist/{hosted-BCwzTTEw.js → hosted-vk05ZF6w.js} +3 -3
  22. package/dist/{integrate-Bhq0wkU0.js → integrate-Cv8r_i2l.js} +28 -27
  23. package/dist/{login-D5TjqsXJ.js → login-DOES7Kup.js} +8 -7
  24. package/dist/{migrate-Cz7VqQNj.js → migrate-C7R29RPH.js} +20 -20
  25. package/dist/{org-B2gy9Pmu.js → org-Cg25bcsj.js} +3 -3
  26. package/dist/output-D2Ax_hHL.js +123 -0
  27. package/dist/{params-Bvq0iqQK.js → params-B1zeElGa.js} +1 -2
  28. package/dist/{pipeline-ChRDxU9b.js → pipeline-BVeUA6Ig.js} +105 -98
  29. package/dist/{print-skill-BPePCjy4.js → print-skill-D-R81bno.js} +7 -7
  30. package/dist/{promote-C54bfsg3.js → promote-CV_Lsmqd.js} +18 -18
  31. package/dist/publish-CSnNvHHi.js +35 -0
  32. package/dist/push-sjnRI6iL.js +35 -0
  33. package/dist/{query-CXjrBFow.js → query-CdcWSinl.js} +10 -10
  34. package/dist/{resource-CM2bIB5v.js → resource-PVg0uzSK.js} +13 -13
  35. package/dist/{resources-CVrWwA1K.js → resources-s64mBHaC.js} +1 -0
  36. package/dist/{run-CAIDPbwe.js → run-XIkrFIgw.js} +2 -2
  37. package/dist/{scan-BrikLKx5.js → scan-Dk0ZlCY6.js} +2 -2
  38. package/dist/{skills-BwXcAVIf.js → skills-B-mR2CqM.js} +4 -3
  39. package/dist/{skills-_TULXe09.js → skills-CoEIW0mE.js} +8 -8
  40. package/dist/{spinner-gOxIMz-V.js → spinner-B9dT3DBY.js} +1 -1
  41. package/dist/{telemetry-CpIXSAbQ.js → telemetry-yJs7t0rt.js} +6 -41
  42. package/dist/{token-DHRH8cxi.js → token-GcbyH6G8.js} +2 -2
  43. package/dist/{ui-C4ncRJqd.js → ui-Lqt_zFOr.js} +5 -1
  44. package/dist/update-B4hoLAN-.js +59 -0
  45. package/dist/{upgrade-BNPbzr5V.js → upgrade-ByCYDXgb.js} +6 -6
  46. package/package.json +4 -4
  47. package/dist/json-C3hPIMkI.js +0 -7
  48. package/dist/publish-NUNSIKri.js +0 -35
  49. package/dist/push-BjEpY9-h.js +0 -35
  50. package/dist/update-BdcpwRu_.js +0 -137
@@ -0,0 +1,59 @@
1
+ import { g as VERSION } from "./output-D2Ax_hHL.js";
2
+ import { d as getUpdateCheck, g as setUpdateCheck } from "./telemetry-yJs7t0rt.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 { k as VERSION, v as setUpdateCheck } from "./telemetry-CpIXSAbQ.js";
2
- import "./json-C3hPIMkI.js";
3
- import { r as isNewerVersion, t as fetchLatestVersion } from "./update-BdcpwRu_.js";
4
- import "./token-DHRH8cxi.js";
5
- import { t as defineCommand } from "./command-B12qooZb.js";
6
- import "./ui-C4ncRJqd.js";
1
+ import { g as VERSION } from "./output-D2Ax_hHL.js";
2
+ import { g as setUpdateCheck } from "./telemetry-yJs7t0rt.js";
3
+ import { r as isNewerVersion, t as fetchLatestVersion } from "./update-B4hoLAN-.js";
4
+ import "./token-GcbyH6G8.js";
5
+ import { t as defineCommand } from "./command-B7Te31wp.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.2.0",
3
+ "version": "1.3.0-beta.3",
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=70 --test-coverage-branches=82 --test-coverage-functions=68 $(rg --files tests -g '*.test.ts')",
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.2.0",
61
+ "@superwall/studio": "1.3.0-beta.3",
62
62
  "ansi-escapes": "^7.3.0",
63
63
  "fast-glob": "^3.3.3",
64
64
  "ink": "^5.2.1",
@@ -1,7 +0,0 @@
1
- //#region src/util/json.ts
2
- function formatJson(value) {
3
- return JSON.stringify(value, null, 2);
4
- }
5
-
6
- //#endregion
7
- export { formatJson as t };
@@ -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 };
@@ -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 };
@@ -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 };