@superwall/cli 1.6.2 → 2.0.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 +281 -34
- package/dist/apple-CkKlHBZ9.js +195 -0
- package/dist/auth.d.ts +4 -19
- package/dist/auth.js +4 -2
- package/dist/{actions-H7f6knyY.js → billing-XCZU_T46.js} +98 -28
- package/dist/{bind-BIzaGq8K.js → bind-drne__Ys.js} +38 -33
- package/dist/{build-B7BS1rF2.js → build-Gpdq5QXP.js} +20 -26
- package/dist/client-BZ1UbpXz.js +66 -0
- package/dist/client-DP6Rc0t_.js +176 -0
- package/dist/config-BO1Y87kV.js +105 -0
- package/dist/create-BBrtgUgS.js +969 -0
- package/dist/{create-CwnnNqv4.js → create-Cwc3SRWJ.js} +194 -168
- package/dist/create-Yvf2gStM.js +19 -0
- package/dist/doctor-C9ldpPFC.js +83 -0
- package/dist/{drivers-6RMOPIdn.js → drivers-DNrx4LWA.js} +185 -172
- package/dist/entry.d.ts +0 -5
- package/dist/entry.js +28083 -801
- package/dist/environment-DF1qKlny.js +58 -0
- package/dist/{existing-DHpPn1y6.js → existing-78LWSsqS.js} +12 -6
- package/dist/held-Cy8Wl4D1.js +1112 -0
- package/dist/held-Ddw1XSsr.js +16 -0
- package/dist/input-vi0bou04.js +42 -0
- package/dist/{integrate-BR2LR-EK.js → integrate-DcJhpXy8.js} +277 -253
- package/dist/kinds-GFXB3sYu.js +11 -0
- package/dist/log-NVhVe_oe.js +62 -0
- package/dist/login-B2TsCE2H.js +53 -0
- package/dist/login-BoBe8Psl.js +16 -0
- package/dist/{login-Bhxgqwtm.js → login-D0lh3_JI.js} +144 -66
- package/dist/lookup-D-nmmAbw.js +71 -0
- package/dist/migrate-Cfec564E.js +274 -0
- package/dist/notification-url-YDbq6FMA.js +100 -0
- package/dist/{open-studio-BnVD6tJ9.js → open-Ba2vBl1_.js} +34 -43
- package/dist/org-D0g_q3mv.js +35 -0
- package/dist/output-Ggzq5_-t.js +122 -0
- package/dist/paths-DxSLdpOI.js +29 -0
- package/dist/playbook-DIeb7hne.js +53 -0
- package/dist/{asc-products-Dvcyef3_.js → products-DH_fK9tY.js} +6 -39
- package/dist/promote-COD4fYdz.js +91 -0
- package/dist/push-CncywhkQ.js +482 -0
- package/dist/push-CtD4FZQV.js +22 -0
- package/dist/registry-DSrosOYs.js +10228 -0
- package/dist/{reports-DqMs9xNR.js → reports-DdPq4blM.js} +7 -6
- package/dist/{resources-Bf9O1JNM.js → resources-Dqr01Dep.js} +150 -55
- package/dist/{run-D-NbZLpj.js → run-C9qg_QlC.js} +16 -22
- package/dist/scan-Cv5uOwVY.js +4 -0
- package/dist/{scan-BmAW413l.js → scan-DLrsrFS9.js} +48 -37
- package/dist/scope-V336uz8j.js +198 -0
- package/dist/screenshot-file-0UETadF8.js +16 -0
- package/dist/{selection-BGi6GyxC.js → selection-Rdw-ZUoG.js} +94 -51
- package/dist/send-BxD9yf6F.js +150 -0
- package/dist/{dev-CgGAb5Al.js → server-D0tGG8C4.js} +82 -87
- package/dist/server-z1LH94R_.js +22 -0
- package/dist/session-1AV_Bs_d.js +6 -0
- package/dist/session-CFAmMhem.js +40 -0
- package/dist/session-D_nEWKXT.js +768 -0
- package/dist/skills/animate-onboarding/SKILL.md +467 -0
- package/dist/skills/animate-onboarding/references/engine.md +494 -0
- package/dist/skills/animate-onboarding/references/framework/Question.tsx +71 -0
- package/dist/skills/animate-onboarding/references/framework/README.md +40 -0
- package/dist/skills/animate-onboarding/references/framework/answers.ts +19 -0
- package/dist/skills/animate-onboarding/references/framework/flow.ts +80 -0
- package/dist/skills/animate-onboarding/references/framework/handoffs.ts +869 -0
- package/dist/skills/animate-onboarding/references/framework/layout.tsx +113 -0
- package/dist/skills/animate-onboarding/references/framework/motion.css +559 -0
- package/dist/skills/animate-onboarding/references/framework/useStoryRouter.ts +48 -0
- package/dist/skills/animate-onboarding/references/handoffs.md +375 -0
- package/dist/skills/animate-onboarding/references/imageReady.ts +92 -0
- package/dist/skills/animate-onboarding/references/morphFrame.ts +356 -0
- package/dist/skills/animate-onboarding/references/performance.md +41 -0
- package/dist/skills/animate-onboarding/references/web-runtime/README.md +17 -0
- package/dist/skills/animate-onboarding/references/web-runtime/handoffs.ts +858 -0
- package/dist/skills/animate-onboarding/references/web-runtime/story-motion.css +301 -0
- package/dist/skills/index.json +37 -0
- package/dist/skills/mobile-design/SKILL.md +447 -0
- package/dist/skills/mobile-design/references/responsive.md +162 -0
- package/dist/skills/onboarding-questions/SKILL.md +231 -0
- package/dist/skills/onboarding-questions/references/arpu-questions.md +139 -0
- package/dist/skills/onboarding-questions/references/craft.md +142 -0
- package/dist/skills/onboarding-questions/references/example-reflective.md +117 -0
- package/dist/skills/superwall/SKILL.md +82 -9
- package/dist/skills/superwall/references/api.md +153 -37
- package/dist/skills/superwall/references/apple-setup.md +316 -0
- package/dist/skills/superwall/references/asc.md +74 -38
- package/dist/skills/superwall/references/data-analytics.md +55 -21
- package/dist/skills/superwall/workflows/dashboard/playbook.md +3 -3
- package/dist/skills/superwall/workflows/dashboard/setup.md +8 -8
- package/dist/skills/superwall/workflows/migrate/adapty.md +6 -6
- package/dist/skills/superwall/workflows/migrate/playbook.md +4 -4
- package/dist/skills/superwall/workflows/migrate/qonversion.md +5 -5
- package/dist/skills/superwall/workflows/migrate/revenuecat.md +6 -6
- package/dist/skills/superwall/workflows/placements/android.md +2 -2
- package/dist/skills/superwall/workflows/placements/expo.md +2 -2
- package/dist/skills/superwall/workflows/placements/flutter.md +2 -2
- package/dist/skills/superwall/workflows/placements/ios.md +2 -2
- package/dist/skills/superwall/workflows/placements/playbook.md +2 -2
- package/dist/skills/superwall/workflows/placements/react-native.md +2 -2
- package/dist/skills/superwall/workflows/placements/strategy.md +2 -2
- package/dist/skills/superwall/workflows/review/playbook.md +1 -1
- package/dist/skills/superwall-editor/SKILL.md +61 -0
- package/dist/skills/superwall-editor/references/cli.md +135 -0
- package/dist/skills/superwall-editor/references/design.md +51 -0
- package/dist/skills/superwall-editor/references/native-elements.md +171 -0
- package/dist/skills/superwall-editor/references/workflow.md +65 -0
- package/dist/skills/superwall-editor/scripts/sw-editor.sh +662 -0
- package/dist/skills/superwall-framework/SKILL.md +78 -28
- package/dist/skills/superwall-framework/references/cli.md +58 -28
- package/dist/skills/superwall-framework/references/examples.md +4 -3
- package/dist/skills/superwall-framework/references/layout.md +30 -8
- package/dist/skills/superwall-framework/references/migrate-from-editor.md +1 -1
- package/dist/skills/superwall-framework/references/onboarding-state.md +245 -0
- package/dist/skills/wwdc/SKILL.md +22 -0
- package/dist/skills/wwdc/references/docs.md +52 -0
- package/dist/skills/wwdc/scripts/wwdc.sh +266 -0
- package/dist/{skills-AxAf7bDB.js → skills-BvFOa4y6.js} +99 -122
- package/dist/skills-DMG4bpKk.js +14 -0
- package/dist/{spawn-DSoTXy_j.js → spawn-DmmmHIP-.js} +14 -12
- package/dist/spinner-CneRK5rk.js +294 -0
- package/dist/storage-DYvmIOHa.d.ts +16 -0
- package/dist/storage-s2Dnz-yl.js +31 -0
- package/dist/storekit-DafAnGkM.js +16 -0
- package/dist/storekit-yY_kS2iR.js +47 -0
- package/dist/telemetry-DtG92m5O.js +56 -0
- package/dist/theme-DUsCh-Vd.js +25 -0
- package/dist/timing-BVxPrYq3.js +5 -0
- package/dist/{token-BGAVPSQc.js → token-DzRh7dI1.js} +6 -38
- package/dist/tools.d.ts +96 -0
- package/dist/tools.js +11178 -0
- package/dist/ui-D_qf3Gvw.js +53 -0
- package/dist/upgrade-Bt4Ouw1y.js +117 -0
- package/dist/upgrade-Cqy5orjb.js +7 -0
- package/package.json +10 -5
- package/dist/api-Dv3LyZ5m.js +0 -151
- package/dist/api-output-aJNw7Syy.js +0 -20
- package/dist/app-mJC5NDtW.js +0 -189
- package/dist/asa-D6H7Pjae.js +0 -1194
- package/dist/asc-xCin0akG.js +0 -539
- package/dist/auth-ZlLL-Gko.js +0 -139
- package/dist/billing-C8kBge_S.js +0 -80
- package/dist/command-3fGYyC8r.js +0 -301
- package/dist/dev-Dx99K183.js +0 -22
- package/dist/doctor-CyUvut31.js +0 -88
- package/dist/feedback-RKyGuQ8_.js +0 -152
- package/dist/hosted-BeGVAntr.js +0 -32
- package/dist/migrate-C-4ISELN.js +0 -284
- package/dist/org-CQduIOic.js +0 -40
- package/dist/output-C-4UKMot.js +0 -136
- package/dist/params-l3CrvRtR.js +0 -51
- package/dist/pipeline-CHX0Syre.js +0 -977
- package/dist/print-skill-BiZLdCKv.js +0 -74
- package/dist/promote-Pgpz-3xl.js +0 -88
- package/dist/publish-BPeuc3lq.js +0 -35
- package/dist/push-DcSQ4odB.js +0 -35
- package/dist/query-CWLaZkdm.js +0 -53
- package/dist/resource-jwASPCrw.js +0 -483
- package/dist/skills-FK5aDuNV.js +0 -64
- package/dist/spinner-DFctF_Jw.js +0 -18
- package/dist/storekit-CC4gnTI6.js +0 -29
- package/dist/telemetry-Ch9cCTI-.js +0 -169
- package/dist/ui-4gLyfrgl.js +0 -27737
- package/dist/update-DIXbL-H9.js +0 -59
- package/dist/upgrade-De7JMI1g.js +0 -72
- /package/dist/{devtools-8EgLo86w.js → devtools-ByZ6XYnn.js} +0 -0
|
@@ -1,44 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { r as spawnStream } from "./spawn-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { _ as VERSION, a as CHANNEL, o as CHANNELS } from "./environment-DF1qKlny.js";
|
|
2
|
+
import { m as writeSkillsSync, s as readSkillsSync } from "./config-BO1Y87kV.js";
|
|
3
|
+
import { r as track } from "./telemetry-DtG92m5O.js";
|
|
4
|
+
import { r as spawnStream } from "./spawn-DmmmHIP-.js";
|
|
5
|
+
import { n as withSpinner } from "./spinner-CneRK5rk.js";
|
|
6
|
+
import { n as ui } from "./ui-D_qf3Gvw.js";
|
|
7
|
+
import { i as packagedDir, t as AGENT_SKILLS_DIR } from "./paths-DxSLdpOI.js";
|
|
7
8
|
import { existsSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
//#region src/packaged.ts
|
|
11
|
-
const moduleDir = dirname(fileURLToPath(import.meta.url));
|
|
12
|
-
let root;
|
|
13
|
-
/** The package root: nearest ancestor with a package.json (repo in dev, install dir in prod). */
|
|
14
|
-
function packageRoot() {
|
|
15
|
-
if (root) return root;
|
|
16
|
-
let dir = moduleDir;
|
|
17
|
-
while (!existsSync(join(dir, "package.json"))) {
|
|
18
|
-
const parent = dirname(dir);
|
|
19
|
-
if (parent === dir) break;
|
|
20
|
-
dir = parent;
|
|
21
|
-
}
|
|
22
|
-
return root = dir;
|
|
23
|
-
}
|
|
24
|
-
/** Locate a directory shipped with the package; skills are bundled into dist/ by the build. */
|
|
25
|
-
function packagedDir(name) {
|
|
26
|
-
return join(packageRoot(), name === "skills" ? "dist/skills" : name) + "/";
|
|
27
|
-
}
|
|
9
|
+
import { join } from "node:path";
|
|
10
|
+
import { tmpdir } from "node:os";
|
|
28
11
|
|
|
29
|
-
//#
|
|
30
|
-
//#region src/core/agent/skills.ts
|
|
12
|
+
//#region src/core/support/skills.ts
|
|
31
13
|
const SUPERWALL_SKILLS_SOURCE = "superwall/skills";
|
|
32
14
|
const skillsRefFor = (channel) => CHANNELS[channel].skillsRef;
|
|
33
15
|
const SKILLS_REF = () => skillsRefFor(CHANNEL());
|
|
34
16
|
const skillsInstallSourceFor = (channel) => channel === "latest" ? SUPERWALL_SKILLS_SOURCE : `https://github.com/${SUPERWALL_SKILLS_SOURCE}/tree/${skillsRefFor(channel)}`;
|
|
35
17
|
const SKILLS_INSTALL_SOURCE = () => skillsInstallSourceFor(CHANNEL());
|
|
36
|
-
const VENDORED_SKILLS = {
|
|
37
|
-
superwall: "latest",
|
|
38
|
-
"superwall-framework": "next"
|
|
39
|
-
};
|
|
40
18
|
const onChannel = (channel) => channel === "latest" || channel === CHANNEL();
|
|
41
|
-
|
|
19
|
+
function skillSummary(md) {
|
|
20
|
+
const firstSentence = (md.match(/^description:\s*(.+)$/m)?.[1] ?? "").trim().replace(/^["']|["'`]+$/g, "").replace(/(?<=\.)\s[\s\S]*$/, "");
|
|
21
|
+
return firstSentence.length > 64 ? `${firstSentence.slice(0, 61)}...` : firstSentence;
|
|
22
|
+
}
|
|
23
|
+
function bundledSkills() {
|
|
24
|
+
try {
|
|
25
|
+
return JSON.parse(readFileSync(`${bundledSkillsDir()}/index.json`, "utf8"));
|
|
26
|
+
} catch {
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const bundledSkillsForChannel = () => bundledSkills().filter((skill) => onChannel(skill.channel)).map((skill) => skill.name);
|
|
42
31
|
const PLAYBOOKS = {
|
|
43
32
|
"superwall-integrate": {
|
|
44
33
|
playbook: "superwall/workflows/integrate/playbook.md",
|
|
@@ -73,10 +62,10 @@ const cache = /* @__PURE__ */ new Map();
|
|
|
73
62
|
function bundledSkillsDir() {
|
|
74
63
|
return packagedDir("skills").replace(/\/$/, "");
|
|
75
64
|
}
|
|
76
|
-
function
|
|
65
|
+
function readBundledSkill(id, reference) {
|
|
77
66
|
const refs = (Array.isArray(reference) ? reference : [reference]).filter((r) => !!r);
|
|
78
67
|
const { playbook, refs: refsDir } = PLAYBOOKS[id];
|
|
79
|
-
const base =
|
|
68
|
+
const base = resolveSkillsBase(playbook);
|
|
80
69
|
const key = `${base}:${refs.length ? `${id}#${refs.join("+")}` : id}`;
|
|
81
70
|
const cached = cache.get(key);
|
|
82
71
|
if (cached !== void 0) return cached;
|
|
@@ -84,7 +73,7 @@ function loadBundledSkill(id, reference) {
|
|
|
84
73
|
cache.set(key, body);
|
|
85
74
|
return body;
|
|
86
75
|
}
|
|
87
|
-
function
|
|
76
|
+
function resolveSkillsBase(playbook) {
|
|
88
77
|
const installed = `${AGENT_SKILLS_DIR()}/`;
|
|
89
78
|
return existsSync(`${installed}${playbook}`) ? installed : packagedDir("skills");
|
|
90
79
|
}
|
|
@@ -103,63 +92,11 @@ function stripFrontmatter(md) {
|
|
|
103
92
|
}
|
|
104
93
|
return md;
|
|
105
94
|
}
|
|
106
|
-
const
|
|
107
|
-
{
|
|
108
|
-
name: "superwall",
|
|
109
|
-
summary: "Resources, ClickHouse SQL analytics, docs, SDK triage, and dashboard links",
|
|
110
|
-
channel: "latest"
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
name: "superwall-editor",
|
|
114
|
-
summary: "Build and edit live paywalls, onboarding, and web2app flows from the CLI",
|
|
115
|
-
channel: "latest"
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
name: "superwall-framework",
|
|
119
|
-
summary: "Paywalls, funnels and any updatable screen as React mini-apps with the framework",
|
|
120
|
-
channel: "next"
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
name: "superwall-integrate",
|
|
124
|
-
summary: "Install and configure the SDK in an app for the first time",
|
|
125
|
-
channel: "latest"
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
name: "superwall-placements",
|
|
129
|
-
summary: "Add or audit placements at feature gates and route them to campaigns",
|
|
130
|
-
channel: "latest"
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
name: "superwall-dashboard",
|
|
134
|
-
summary: "Create the entitlements, products and campaigns a placement needs",
|
|
135
|
-
channel: "latest"
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
name: "superwall-review",
|
|
139
|
-
summary: "Audit an existing Superwall setup end to end",
|
|
140
|
-
channel: "latest"
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
name: "superwall-migrate",
|
|
144
|
-
summary: "Move an app off RevenueCat, Adapty or Qonversion",
|
|
145
|
-
channel: "latest"
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
name: "superwall-paywall-migrate",
|
|
149
|
-
summary: "Rebuild a dashboard paywall as a framework paywall",
|
|
150
|
-
channel: "next"
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
name: "superwall-screen-migrate",
|
|
154
|
-
summary: "Rebuild a native screen as a framework surface",
|
|
155
|
-
channel: "next"
|
|
156
|
-
}
|
|
157
|
-
];
|
|
158
|
-
const knownSkills = () => KNOWN_SKILLS.filter((skill) => onChannel(skill.channel)).map(({ name, summary }) => ({
|
|
95
|
+
const knownSkills = () => bundledSkills().filter((skill) => onChannel(skill.channel)).map(({ name, summary }) => ({
|
|
159
96
|
name,
|
|
160
97
|
summary
|
|
161
98
|
}));
|
|
162
|
-
async function
|
|
99
|
+
async function listPublicSkills() {
|
|
163
100
|
try {
|
|
164
101
|
const res = await fetch(`https://api.github.com/repos/${SUPERWALL_SKILLS_SOURCE}/contents/skills?ref=${SKILLS_REF()}`, {
|
|
165
102
|
headers: { accept: "application/vnd.github+json" },
|
|
@@ -170,19 +107,17 @@ async function fetchPublicSkills() {
|
|
|
170
107
|
if (dirs.length === 0) return knownSkills();
|
|
171
108
|
return (await Promise.all(dirs.map(async (name) => ({
|
|
172
109
|
name,
|
|
173
|
-
summary: await
|
|
110
|
+
summary: await resolveSkillSummary(name)
|
|
174
111
|
})))).sort((a, b) => a.name === "superwall" ? -1 : b.name === "superwall" ? 1 : a.name.localeCompare(b.name));
|
|
175
112
|
} catch {
|
|
176
113
|
return knownSkills();
|
|
177
114
|
}
|
|
178
115
|
}
|
|
179
|
-
async function
|
|
116
|
+
async function resolveSkillSummary(name) {
|
|
180
117
|
try {
|
|
181
118
|
const res = await fetch(`https://raw.githubusercontent.com/${SUPERWALL_SKILLS_SOURCE}/${SKILLS_REF()}/skills/${name}/SKILL.md`, { signal: AbortSignal.timeout(6e3) });
|
|
182
119
|
if (!res.ok) return "";
|
|
183
|
-
|
|
184
|
-
const firstSentence = description.split(/(?<=\.)\s/)[0] ?? description;
|
|
185
|
-
return firstSentence.length > 64 ? `${firstSentence.slice(0, 61)}...` : firstSentence;
|
|
120
|
+
return skillSummary(await res.text());
|
|
186
121
|
} catch {
|
|
187
122
|
return "";
|
|
188
123
|
}
|
|
@@ -199,7 +134,7 @@ async function installPublicSkills(opts = {}) {
|
|
|
199
134
|
...selection
|
|
200
135
|
];
|
|
201
136
|
if (opts.dryRun) return runInstall(remote, opts);
|
|
202
|
-
const checkout = await clonePublicSkills(
|
|
137
|
+
const checkout = await clonePublicSkills();
|
|
203
138
|
if (!checkout) return runInstall(remote, opts);
|
|
204
139
|
try {
|
|
205
140
|
normalizeSkillsDir(join(checkout, "skills"));
|
|
@@ -220,7 +155,7 @@ async function installPublicSkills(opts = {}) {
|
|
|
220
155
|
});
|
|
221
156
|
}
|
|
222
157
|
}
|
|
223
|
-
async function clonePublicSkills(
|
|
158
|
+
async function clonePublicSkills() {
|
|
224
159
|
const dir = mkdtempSync(join(tmpdir(), "superwall-skills-"));
|
|
225
160
|
const { code } = await spawnStream({
|
|
226
161
|
bin: "git",
|
|
@@ -234,7 +169,7 @@ async function clonePublicSkills(cwd) {
|
|
|
234
169
|
`https://github.com/${SUPERWALL_SKILLS_SOURCE}.git`,
|
|
235
170
|
dir
|
|
236
171
|
],
|
|
237
|
-
cwd:
|
|
172
|
+
cwd: process.cwd(),
|
|
238
173
|
onStdoutLine: () => {}
|
|
239
174
|
}).catch(() => ({ code: 1 }));
|
|
240
175
|
if (code === 0 && existsSync(join(dir, "skills"))) return dir;
|
|
@@ -260,9 +195,10 @@ function normalizeSkillFrontmatter(md) {
|
|
|
260
195
|
const end = lines.indexOf("---", 1);
|
|
261
196
|
if (end < 0) return md;
|
|
262
197
|
for (let i = 1; i < end; i++) {
|
|
263
|
-
const match = lines[i]
|
|
264
|
-
|
|
265
|
-
const
|
|
198
|
+
const match = lines[i]?.match(/^([A-Za-z0-9_-]+):[ \t]+(.+?)\s*$/);
|
|
199
|
+
const key = match?.[1];
|
|
200
|
+
const value = match?.[2];
|
|
201
|
+
if (key === void 0 || value === void 0) continue;
|
|
266
202
|
if (/^["']/.test(value) || /^[|>][+-]?\d*$/.test(value)) continue;
|
|
267
203
|
if (/: |\s#/.test(value) || /^[`@%&*!?{}[\],]/.test(value) || value.endsWith(":")) lines[i] = `${key}: ${JSON.stringify(value)}`;
|
|
268
204
|
}
|
|
@@ -290,9 +226,9 @@ async function runInstall(args, opts) {
|
|
|
290
226
|
const { code } = await spawnStream({
|
|
291
227
|
bin: "npx",
|
|
292
228
|
args,
|
|
293
|
-
cwd:
|
|
294
|
-
onStdoutLine: (
|
|
295
|
-
onStderrLine: (
|
|
229
|
+
cwd: process.cwd(),
|
|
230
|
+
onStdoutLine: () => {},
|
|
231
|
+
onStderrLine: () => {}
|
|
296
232
|
});
|
|
297
233
|
return {
|
|
298
234
|
ok: code === 0,
|
|
@@ -306,7 +242,7 @@ function checkSkillsSync(sync, cliVersion, ref, now) {
|
|
|
306
242
|
if (!Number.isFinite(syncedAt)) return "stale";
|
|
307
243
|
return now - syncedAt > SHA_CHECK_INTERVAL_MS ? "verify" : "fresh";
|
|
308
244
|
}
|
|
309
|
-
async function
|
|
245
|
+
async function selectSourceSha() {
|
|
310
246
|
try {
|
|
311
247
|
const res = await fetch(`https://api.github.com/repos/${SUPERWALL_SKILLS_SOURCE}/commits/${SKILLS_REF()}`, {
|
|
312
248
|
headers: { accept: "application/vnd.github+json" },
|
|
@@ -320,14 +256,14 @@ async function fetchSourceSha() {
|
|
|
320
256
|
}
|
|
321
257
|
}
|
|
322
258
|
async function skillsOutOfDate() {
|
|
323
|
-
const sync =
|
|
259
|
+
const sync = readSkillsSync();
|
|
324
260
|
const check = checkSkillsSync(sync, VERSION, SKILLS_REF(), Date.now());
|
|
325
|
-
if (check === "stale") return true;
|
|
326
|
-
if (check === "fresh"
|
|
327
|
-
const head = await
|
|
261
|
+
if (!sync || check === "stale") return true;
|
|
262
|
+
if (check === "fresh") return false;
|
|
263
|
+
const head = await selectSourceSha();
|
|
328
264
|
if (!head) return false;
|
|
329
265
|
if (head !== sync.sourceSha) return true;
|
|
330
|
-
|
|
266
|
+
writeSkillsSync({
|
|
331
267
|
...sync,
|
|
332
268
|
syncedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
333
269
|
});
|
|
@@ -343,23 +279,21 @@ async function syncSkills(opts = {}) {
|
|
|
343
279
|
ok,
|
|
344
280
|
current: pub.ok
|
|
345
281
|
});
|
|
346
|
-
if (ok && pub.ok)
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
282
|
+
if (ok && pub.ok) {
|
|
283
|
+
const sourceSha = await selectSourceSha();
|
|
284
|
+
writeSkillsSync({
|
|
285
|
+
cliVersion: VERSION,
|
|
286
|
+
syncedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
287
|
+
sourceSha: sourceSha ?? void 0,
|
|
288
|
+
ref: SKILLS_REF()
|
|
289
|
+
});
|
|
290
|
+
}
|
|
352
291
|
}
|
|
353
292
|
return {
|
|
354
293
|
ok,
|
|
355
294
|
commands: [bundled.command, pub.command]
|
|
356
295
|
};
|
|
357
296
|
}
|
|
358
|
-
/**
|
|
359
|
-
* Install or refresh the skills with a spinner. `required` always installs and
|
|
360
|
-
* throws on failure (fresh integrations must ship with skills); otherwise this
|
|
361
|
-
* is a quiet refresh that no-ops when the last sync is current.
|
|
362
|
-
*/
|
|
363
297
|
async function ensureSkillsCurrent(required = false, trigger = "workflow") {
|
|
364
298
|
if (!required && !await skillsOutOfDate()) return;
|
|
365
299
|
const spin = ui.spinner();
|
|
@@ -368,6 +302,49 @@ async function ensureSkillsCurrent(required = false, trigger = "workflow") {
|
|
|
368
302
|
spin.stop(ok ? required ? "Superwall skills installed" : "Superwall skills up to date" : "Skill install skipped");
|
|
369
303
|
if (required && !ok) throw new Error("The integration completed, but the Superwall skills could not be installed.");
|
|
370
304
|
}
|
|
305
|
+
async function runSkills(ctx, { flags }) {
|
|
306
|
+
ui.intro("Superwall agent skills");
|
|
307
|
+
const named = flags.skill.filter(Boolean);
|
|
308
|
+
let skills = named.length ? named : void 0;
|
|
309
|
+
const { dryRun } = ctx;
|
|
310
|
+
const { force, yes } = flags;
|
|
311
|
+
const interactive = ctx.interactive && !yes;
|
|
312
|
+
if (!skills && !dryRun && !force) {
|
|
313
|
+
if (!await withSpinner("Checking your skills", skillsOutOfDate)) {
|
|
314
|
+
ui.success("Your Superwall skills are already up to date.");
|
|
315
|
+
ui.outro("Run `superwall skills --force` to reinstall.");
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
if (!skills && !dryRun && interactive) {
|
|
320
|
+
const available = await withSpinner(`Fetching skills from ${SKILLS_INSTALL_SOURCE()}`, listPublicSkills);
|
|
321
|
+
const picked = await ui.multiselect({
|
|
322
|
+
message: `Which skills from ${SKILLS_INSTALL_SOURCE()}? (installs globally)`,
|
|
323
|
+
options: available.map((s) => ({
|
|
324
|
+
value: s.name,
|
|
325
|
+
label: s.name,
|
|
326
|
+
hint: s.summary
|
|
327
|
+
})),
|
|
328
|
+
initialValues: available.map((s) => s.name)
|
|
329
|
+
});
|
|
330
|
+
if (picked === null || picked.length === 0) {
|
|
331
|
+
ui.warn("Nothing selected.");
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
skills = picked.length === available.length ? void 0 : picked;
|
|
335
|
+
} else if (skills?.length) ui.info(`Installing \`${skills.join("`, `")}\` from ${SKILLS_INSTALL_SOURCE()}`);
|
|
336
|
+
else ui.info(`Installing every skill from ${SKILLS_INSTALL_SOURCE()}`);
|
|
337
|
+
const spin = ui.spinner();
|
|
338
|
+
spin.start(dryRun ? "Resolving" : "Installing skills globally");
|
|
339
|
+
const { ok, commands } = await syncSkills({
|
|
340
|
+
skills,
|
|
341
|
+
dryRun
|
|
342
|
+
});
|
|
343
|
+
spin.stop(dryRun ? "Dry run" : ok ? "Skills installed for every detected agent" : "Install failed");
|
|
344
|
+
if (dryRun) for (const command of commands) ui.info(command);
|
|
345
|
+
ui.outro(ok ? `**Done.** Try: ask your agent to "review my Superwall setup".` : "Something went wrong - try again, or check that `npx` is available.");
|
|
346
|
+
if (!ok) throw new Error("Skill installation failed. Check that `npx` is available and try again.");
|
|
347
|
+
}
|
|
371
348
|
|
|
372
349
|
//#endregion
|
|
373
|
-
export {
|
|
350
|
+
export { bundledSkills as a, knownSkills as c, readBundledSkill as d, runSkills as f, 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 };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import "./token-DzRh7dI1.js";
|
|
2
|
+
import "./output-Ggzq5_-t.js";
|
|
3
|
+
import "./environment-DF1qKlny.js";
|
|
4
|
+
import "./storage-s2Dnz-yl.js";
|
|
5
|
+
import "./client-DP6Rc0t_.js";
|
|
6
|
+
import "./config-BO1Y87kV.js";
|
|
7
|
+
import "./telemetry-DtG92m5O.js";
|
|
8
|
+
import "./spawn-DmmmHIP-.js";
|
|
9
|
+
import "./spinner-CneRK5rk.js";
|
|
10
|
+
import "./ui-D_qf3Gvw.js";
|
|
11
|
+
import "./paths-DxSLdpOI.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-BvFOa4y6.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 +1,18 @@
|
|
|
1
|
-
import { promisify } from "node:util";
|
|
2
|
-
import { appendFileSync } from "node:fs";
|
|
3
1
|
import { execFile, spawn } from "node:child_process";
|
|
2
|
+
import { appendFileSync } from "node:fs";
|
|
4
3
|
import { createInterface } from "node:readline";
|
|
4
|
+
import { promisify } from "node:util";
|
|
5
5
|
|
|
6
|
-
//#region src/core/agent/drivers/spawn.ts
|
|
6
|
+
//#region src/core/workflows/agent/drivers/spawn.ts
|
|
7
7
|
const execFileAsync = promisify(execFile);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (!
|
|
8
|
+
function writeTranscript(line) {
|
|
9
|
+
const transcript = process.env.SW_BENCH_TRANSCRIPT;
|
|
10
|
+
if (!transcript) return;
|
|
11
11
|
try {
|
|
12
|
-
appendFileSync(
|
|
13
|
-
} catch {
|
|
12
|
+
appendFileSync(transcript, line + "\n");
|
|
13
|
+
} catch {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
14
16
|
}
|
|
15
17
|
async function readVersion(bin) {
|
|
16
18
|
try {
|
|
@@ -37,7 +39,6 @@ function spawnStream(opts) {
|
|
|
37
39
|
return new Promise((resolve, reject) => {
|
|
38
40
|
const child = spawn(opts.bin, opts.args, {
|
|
39
41
|
cwd: opts.cwd,
|
|
40
|
-
env: opts.env ?? process.env,
|
|
41
42
|
signal: opts.signal,
|
|
42
43
|
stdio: [
|
|
43
44
|
"ignore",
|
|
@@ -47,12 +48,13 @@ function spawnStream(opts) {
|
|
|
47
48
|
});
|
|
48
49
|
createInterface({ input: child.stdout }).on("line", (line) => {
|
|
49
50
|
if (line.length) {
|
|
50
|
-
|
|
51
|
+
writeTranscript(line);
|
|
51
52
|
opts.onStdoutLine(line);
|
|
52
53
|
}
|
|
53
54
|
});
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
const { onStderrLine } = opts;
|
|
56
|
+
if (onStderrLine) createInterface({ input: child.stderr }).on("line", (line) => {
|
|
57
|
+
if (line.length) onStderrLine(line);
|
|
56
58
|
});
|
|
57
59
|
child.on("error", (e) => {
|
|
58
60
|
if (e.name === "AbortError") {
|