splithub 0.5.1 → 0.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 +6 -6
- package/dist/{alerts-RXUG22S7.js → alerts-WOWJ3MZV.js} +4 -4
- package/dist/{analytics-3TFARFQE.js → analytics-ZGLVQDIL.js} +5 -5
- package/dist/{chunk-5UN2NKIF.js → chunk-3V6SD74H.js} +9 -9
- package/dist/chunk-3V6SD74H.js.map +1 -0
- package/dist/{chunk-5Y6HUYA6.js → chunk-4AZ2EOIY.js} +3 -3
- package/dist/chunk-4AZ2EOIY.js.map +1 -0
- package/dist/{chunk-5JKDO4IN.js → chunk-4DPMTGNP.js} +3 -3
- package/dist/chunk-4DPMTGNP.js.map +1 -0
- package/dist/{chunk-JZH4ZC2R.js → chunk-5R6543RT.js} +6 -6
- package/dist/chunk-5R6543RT.js.map +1 -0
- package/dist/{chunk-RBV5NIMY.js → chunk-7ADMC5F3.js} +3 -3
- package/dist/chunk-7ADMC5F3.js.map +1 -0
- package/dist/{chunk-OXQZJCAC.js → chunk-BDCKWKJB.js} +37 -37
- package/dist/chunk-BDCKWKJB.js.map +1 -0
- package/dist/{chunk-CAFWOX3S.js → chunk-BLEJ5DOY.js} +2 -2
- package/dist/chunk-BLEJ5DOY.js.map +1 -0
- package/dist/{chunk-XTHEBWKY.js → chunk-DOPSOUUT.js} +7 -7
- package/dist/chunk-DOPSOUUT.js.map +1 -0
- package/dist/{chunk-YZPQK4N7.js → chunk-GWWJHAH4.js} +4 -4
- package/dist/chunk-GWWJHAH4.js.map +1 -0
- package/dist/{chunk-4OQEIP33.js → chunk-H5GMGCOT.js} +3 -3
- package/dist/chunk-H5GMGCOT.js.map +1 -0
- package/dist/{chunk-YRHCGHV7.js → chunk-I5YYG3NU.js} +3 -3
- package/dist/chunk-I5YYG3NU.js.map +1 -0
- package/dist/{chunk-FCV7PQN6.js → chunk-IIX2EISO.js} +4 -4
- package/dist/chunk-IIX2EISO.js.map +1 -0
- package/dist/{chunk-G2URJ423.js → chunk-ISEVDVKJ.js} +3 -3
- package/dist/chunk-ISEVDVKJ.js.map +1 -0
- package/dist/{chunk-Q4W6H7XO.js → chunk-JFRRGBZU.js} +6 -6
- package/dist/chunk-JFRRGBZU.js.map +1 -0
- package/dist/{chunk-WQETHW5W.js → chunk-JQA3WWEQ.js} +4 -4
- package/dist/chunk-JQA3WWEQ.js.map +1 -0
- package/dist/{chunk-Z2LTGGUG.js → chunk-KWL6EUML.js} +3 -3
- package/dist/chunk-KWL6EUML.js.map +1 -0
- package/dist/{chunk-LWJSVUMI.js → chunk-LF4ZI43E.js} +2 -2
- package/dist/{chunk-WV6RNTIM.js → chunk-NZ4RSQ56.js} +3 -3
- package/dist/{chunk-WV6RNTIM.js.map → chunk-NZ4RSQ56.js.map} +1 -1
- package/dist/{chunk-ZHM47JI5.js → chunk-PWLTCKEC.js} +6 -6
- package/dist/chunk-PWLTCKEC.js.map +1 -0
- package/dist/{chunk-SXFGWWE7.js → chunk-Q5LYYWYC.js} +15 -15
- package/dist/chunk-Q5LYYWYC.js.map +1 -0
- package/dist/{chunk-56WHXKGA.js → chunk-VMYL36BP.js} +2 -2
- package/dist/{chunk-NFZZSF4M.js → chunk-XT7Z5GY2.js} +2 -2
- package/dist/{ci-W72GPWEB.js → ci-G4IQPM5K.js} +2 -2
- package/dist/{connect-SHXP65T2.js → connect-BICSF6XG.js} +11 -11
- package/dist/connect-BICSF6XG.js.map +1 -0
- package/dist/{create-HRROFCS2.js → create-7VLV2H67.js} +3 -3
- package/dist/{dev-4O4ZVVKH.js → dev-3CPW4LTF.js} +3 -3
- package/dist/{doctor-GCAMTBJG.js → doctor-L7NTDL2E.js} +4 -4
- package/dist/domains-J5SKVM6S.js +10 -0
- package/dist/{experiment-reports-WMODMYBX.js → experiment-reports-AN4S7PYS.js} +5 -5
- package/dist/index.js +32 -32
- package/dist/index.js.map +1 -1
- package/dist/init-Q234CCOT.js +19 -0
- package/dist/{lifecycle-C6RF5MC6.js → lifecycle-RROP7JMK.js} +3 -3
- package/dist/{links-JWPXODYS.js → links-DYSFIVRV.js} +4 -4
- package/dist/{login-OT77MNKL.js → login-JIH5576K.js} +3 -3
- package/dist/{menu-XMAEYJNC.js → menu-TCO6OVKR.js} +26 -26
- package/dist/menu-TCO6OVKR.js.map +1 -0
- package/dist/{notes-QN5XW2TI.js → notes-KHLQUNEF.js} +4 -4
- package/dist/{plan-UHBAQXRB.js → plan-BYRG2YK6.js} +3 -3
- package/dist/plan-BYRG2YK6.js.map +1 -0
- package/dist/{push-UJHOXRO3.js → push-6MOHROGS.js} +3 -3
- package/dist/{remove-MSEG2USQ.js → remove-C65D4VDA.js} +2 -2
- package/dist/{report-E6EJECSP.js → report-Z5XHK5D6.js} +4 -4
- package/dist/report-Z5XHK5D6.js.map +1 -0
- package/dist/{results-OJJKMZ4O.js → results-3UYAU4OP.js} +6 -6
- package/dist/{review-GIYBPVP3.js → review-FOE4IIXA.js} +2 -2
- package/dist/{ship-6A6EWZEX.js → ship-6HWSIA2E.js} +2 -2
- package/dist/{skills-4G73YN3S.js → skills-RBRC7UWI.js} +4 -4
- package/dist/status-RLKOX6NA.js +17 -0
- package/package.json +4 -4
- package/dist/chunk-4OQEIP33.js.map +0 -1
- package/dist/chunk-5JKDO4IN.js.map +0 -1
- package/dist/chunk-5UN2NKIF.js.map +0 -1
- package/dist/chunk-5Y6HUYA6.js.map +0 -1
- package/dist/chunk-CAFWOX3S.js.map +0 -1
- package/dist/chunk-FCV7PQN6.js.map +0 -1
- package/dist/chunk-G2URJ423.js.map +0 -1
- package/dist/chunk-JZH4ZC2R.js.map +0 -1
- package/dist/chunk-OXQZJCAC.js.map +0 -1
- package/dist/chunk-Q4W6H7XO.js.map +0 -1
- package/dist/chunk-RBV5NIMY.js.map +0 -1
- package/dist/chunk-SXFGWWE7.js.map +0 -1
- package/dist/chunk-WQETHW5W.js.map +0 -1
- package/dist/chunk-XTHEBWKY.js.map +0 -1
- package/dist/chunk-YRHCGHV7.js.map +0 -1
- package/dist/chunk-YZPQK4N7.js.map +0 -1
- package/dist/chunk-Z2LTGGUG.js.map +0 -1
- package/dist/chunk-ZHM47JI5.js.map +0 -1
- package/dist/connect-SHXP65T2.js.map +0 -1
- package/dist/domains-CR34APOD.js +0 -10
- package/dist/init-X2D3YAMU.js +0 -19
- package/dist/menu-XMAEYJNC.js.map +0 -1
- package/dist/plan-UHBAQXRB.js.map +0 -1
- package/dist/report-E6EJECSP.js.map +0 -1
- package/dist/status-SDXLN4SE.js +0 -17
- /package/dist/{alerts-RXUG22S7.js.map → alerts-WOWJ3MZV.js.map} +0 -0
- /package/dist/{analytics-3TFARFQE.js.map → analytics-ZGLVQDIL.js.map} +0 -0
- /package/dist/{chunk-LWJSVUMI.js.map → chunk-LF4ZI43E.js.map} +0 -0
- /package/dist/{chunk-56WHXKGA.js.map → chunk-VMYL36BP.js.map} +0 -0
- /package/dist/{chunk-NFZZSF4M.js.map → chunk-XT7Z5GY2.js.map} +0 -0
- /package/dist/{ci-W72GPWEB.js.map → ci-G4IQPM5K.js.map} +0 -0
- /package/dist/{create-HRROFCS2.js.map → create-7VLV2H67.js.map} +0 -0
- /package/dist/{dev-4O4ZVVKH.js.map → dev-3CPW4LTF.js.map} +0 -0
- /package/dist/{doctor-GCAMTBJG.js.map → doctor-L7NTDL2E.js.map} +0 -0
- /package/dist/{domains-CR34APOD.js.map → domains-J5SKVM6S.js.map} +0 -0
- /package/dist/{experiment-reports-WMODMYBX.js.map → experiment-reports-AN4S7PYS.js.map} +0 -0
- /package/dist/{init-X2D3YAMU.js.map → init-Q234CCOT.js.map} +0 -0
- /package/dist/{lifecycle-C6RF5MC6.js.map → lifecycle-RROP7JMK.js.map} +0 -0
- /package/dist/{links-JWPXODYS.js.map → links-DYSFIVRV.js.map} +0 -0
- /package/dist/{login-OT77MNKL.js.map → login-JIH5576K.js.map} +0 -0
- /package/dist/{notes-QN5XW2TI.js.map → notes-KHLQUNEF.js.map} +0 -0
- /package/dist/{push-UJHOXRO3.js.map → push-6MOHROGS.js.map} +0 -0
- /package/dist/{remove-MSEG2USQ.js.map → remove-C65D4VDA.js.map} +0 -0
- /package/dist/{results-OJJKMZ4O.js.map → results-3UYAU4OP.js.map} +0 -0
- /package/dist/{review-GIYBPVP3.js.map → review-FOE4IIXA.js.map} +0 -0
- /package/dist/{ship-6A6EWZEX.js.map → ship-6HWSIA2E.js.map} +0 -0
- /package/dist/{skills-4G73YN3S.js.map → skills-RBRC7UWI.js.map} +0 -0
- /package/dist/{status-SDXLN4SE.js.map → status-RLKOX6NA.js.map} +0 -0
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
// src/skills-self-hosted.ts
|
|
4
4
|
var SKILL_SELF_HOSTED = `---
|
|
5
5
|
name: splithub-self-hosted
|
|
6
|
-
description: Keep
|
|
6
|
+
description: Keep sh2 events in your own database (self mode): which tables, how to write a Store for Postgres, MySQL, Prisma, Drizzle, Supabase or anything else, where the ingest route lives, how the CLI reads results from it, and how to get cloud data into your own database for reports. Use when the user wants data in their infra or asks about tables, schema or reporting.
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
#
|
|
9
|
+
# sh2 with your own database
|
|
10
10
|
|
|
11
11
|
Two ways to own the data:
|
|
12
12
|
|
|
13
13
|
1. **Self mode** \u2014 the app hosts the ingest route and the store; nothing leaves your infra.
|
|
14
14
|
\`splithub.config.ts\`: \`storage: { mode: 'self', endpoint: '/api/splithub' }\`.
|
|
15
|
-
2. **Cloud + export** \u2014 events go to
|
|
15
|
+
2. **Cloud + export** \u2014 events go to sh2 Cloud; you pull summaries into your warehouse for reports.
|
|
16
16
|
|
|
17
17
|
## Self mode: the pieces
|
|
18
18
|
|
|
@@ -21,7 +21,7 @@ Two ways to own the data:
|
|
|
21
21
|
\`POST /events\` from the SDK and answers \`GET /status\`, \`GET /results/<id>\` for the CLI
|
|
22
22
|
(\`npx splithub status\` talks to the local dev server, or \`--url https://your.app/api/splithub\`).
|
|
23
23
|
Self-hosted reads are raw numbers per variant (\`variants[]\`: visitors, conversions, rate, revenue)
|
|
24
|
-
with \`analysis: { available: false }\`. Verdicts, data-quality stars and recommendations come with
|
|
24
|
+
with \`analysis: { available: false }\`. Verdicts, data-quality stars and recommendations come with sh2 Cloud,
|
|
25
25
|
and so do slices, breakdowns, timelines and raw experiment events (\`results --from/--filter/--by\` answer \`NOT_CLOUD\` here).
|
|
26
26
|
With an analytics property the SDK sends \`track()\` as one \`event\` row and a page as one \`page\` row; the handler
|
|
27
27
|
stores the goal rows experiments need next to them (goals of the config's experiments only), so the store sees goals as before.
|
|
@@ -83,7 +83,7 @@ one raw query for \`variantCounts\`. Supabase: the same SQL as a Postgres functi
|
|
|
83
83
|
## Do not
|
|
84
84
|
|
|
85
85
|
- Put database credentials in \`splithub.config.ts\` (it ships to the browser). They belong in the route's env.
|
|
86
|
-
- Call a winner from raw rates: a higher rate is often noise. Say the numbers as they are; verdicts come with
|
|
86
|
+
- Call a winner from raw rates: a higher rate is often noise. Say the numbers as they are; verdicts come with sh2 Cloud.
|
|
87
87
|
`;
|
|
88
88
|
|
|
89
89
|
// src/skills-ship.ts
|
|
@@ -132,7 +132,7 @@ Report what changed (files, the kept content) and the verdict in one line with i
|
|
|
132
132
|
`;
|
|
133
133
|
var SKILL_LOOP = `---
|
|
134
134
|
name: splithub-loop
|
|
135
|
-
description: The whole experiment loop for an agent with
|
|
135
|
+
description: The whole experiment loop for an agent with sh2, step by step with the MCP tools and CLI --json fields: plan, create, implement, check, push, read results, finish, ship. Use when the user asks to run an experiment end to end, or to pick up an experiment where it stands.
|
|
136
136
|
---
|
|
137
137
|
|
|
138
138
|
# The full loop
|
|
@@ -175,13 +175,13 @@ Rules that keep the answer honest:
|
|
|
175
175
|
// src/skills-analytics.ts
|
|
176
176
|
var SKILL_ANALYTICS = `---
|
|
177
177
|
name: splithub-analytics
|
|
178
|
-
description: Collect and read web analytics with
|
|
178
|
+
description: Collect and read web analytics with sh2: analytics properties (pageviews, events with track(), identified users, sources, channels, pages, goals and conversions), setting one up in the app (analytics connect), funnels, paths, retention, realtime, event props, CSV export, segments, notes and alerts on traffic, sh.js or the SDK, allowed domains. Use when the user wants traffic numbers, page or source reports, event tracking, funnels, or asks to "add analytics" to an app that uses sh2 or could.
|
|
179
179
|
---
|
|
180
180
|
|
|
181
|
-
#
|
|
181
|
+
# sh2 analytics
|
|
182
182
|
|
|
183
183
|
An analytics property is a stream of pageviews and custom events, like a site in Google Analytics. It sits next to the
|
|
184
|
-
experiments: same config file, same CLI, same key, same storage choice (
|
|
184
|
+
experiments: same config file, same CLI, same key, same storage choice (sh2 Cloud or the app's own database).
|
|
185
185
|
There are no variants and no verdicts: reports are counts.
|
|
186
186
|
|
|
187
187
|
## Set it up
|
|
@@ -202,7 +202,7 @@ There are no variants and no verdicts: reports are counts.
|
|
|
202
202
|
experiments whose goal is that event. Only what the app passes to \`track()\` is sent.
|
|
203
203
|
- Users: \`const identify = useIdentify(); identify(user.id, { plan: 'pro' })\` after sign-in (\`identify(null)\` on sign-out;
|
|
204
204
|
sh.js: \`splithub.identify(id, traits)\`) ties visits to the app's user; reports then count \`users\`. No emails or names in traits.
|
|
205
|
-
- No SDK: \`<script src="https://go.
|
|
205
|
+
- No SDK: \`<script src="https://go.sh2.uk/sh.js" data-key="pk_\u2026" async></script>\` sends pageviews (SPA navigations
|
|
206
206
|
included) and \`window.splithub.track(name, props)\` once the tag has \`data-property="sh-x1h78w"\`.
|
|
207
207
|
- One install covers analytics and experiments: the provider (or sh.js) with \`property\` collects pageviews and runs
|
|
208
208
|
experiments. Each \`track()\` sends one event row and each page one page row; experiments whose goal is that event or
|
|
@@ -219,7 +219,7 @@ There are no variants and no verdicts: reports are counts.
|
|
|
219
219
|
## Read it
|
|
220
220
|
|
|
221
221
|
- \`npx splithub analytics --json\`: every property with visitors, visits, pageviews and bounce for the last 30 days.
|
|
222
|
-
- \`npx splithub status --json\` (
|
|
222
|
+
- \`npx splithub status --json\` (sh2 Cloud) also lists every property under \`properties\`: the last 7 days against the 7 before
|
|
223
223
|
(visitors, \`change\`, goal conversions); \`npx splithub report\` adds them as an Analytics table. The digest (Pro, set in the
|
|
224
224
|
dashboard under Alerts) covers properties too: visitors, top sources and pages, goals and events against the period before.
|
|
225
225
|
- \`npx splithub analytics site --json\` (\`--days 7\`, or \`--from 2026-10-01 --to 2026-10-31\`): totals, \`users\` (identified),
|
|
@@ -228,7 +228,7 @@ There are no variants and no verdicts: reports are counts.
|
|
|
228
228
|
visit dimension, \`--goal signup\` adds conversions per row; \`--by variant --experiment hero\` splits visits by the
|
|
229
229
|
variant each visitor saw, \`--by trait --key plan\` by an identify() trait. \`--filter country=DE,FR --filter source="(none)"\` narrows any report.
|
|
230
230
|
- \`npx splithub analytics events site --json\`: the latest raw pageviews and events, to check tracking right after wiring it.
|
|
231
|
-
- More reports (
|
|
231
|
+
- More reports (sh2 Cloud), each with the same \`--days\` / \`--from --to\` / \`--filter\` flags:
|
|
232
232
|
- \`analytics funnel site --steps "page:/,event:Signup,goal:paid" [--within visit|7d|30d] [--by country]\`: visitors per step
|
|
233
233
|
in order, \`conversion\` (share of step 1) and \`dropoff\` (share lost since the step before).
|
|
234
234
|
- \`analytics funnels site\`: the funnels saved on the property (its Funnels tab, shared with the team).
|
|
@@ -244,7 +244,7 @@ There are no variants and no verdicts: reports are counts.
|
|
|
244
244
|
(\`analytics segments\`, \`--save <name> country=DE\`, \`--delete <id|name>\`).
|
|
245
245
|
- Notes mark a day on the charts: \`npx splithub notes add "Launched new pricing" [--kind win] [--property site] [--day 2026-10-05]\`,
|
|
246
246
|
\`notes --property site\` lists them; add one when you ship something that may move traffic.
|
|
247
|
-
- Alerts on a property (
|
|
247
|
+
- Alerts on a property (sh2 Cloud, Pro): \`npx splithub alerts add traffic_drop --property site --percent 50\`, \`traffic_spike\`,
|
|
248
248
|
\`goal_silent --property site --goal signup --hours 24\`, \`event_count --property site --event Signup --count 1000 [--repeat]\`.
|
|
249
249
|
- Words: a visit (\`sessions\`) ends after 30 minutes without events; a bounce is a visit with one page and no event;
|
|
250
250
|
\`source\` is the UTM source or the referrer's site (Google, Facebook, \u2026), \`(none)\` = direct; \`channel\` groups them (Direct,
|
|
@@ -252,12 +252,12 @@ There are no variants and no verdicts: reports are counts.
|
|
|
252
252
|
\`duration\` is in milliseconds. Bots are never counted.
|
|
253
253
|
- Self-hosted (\`mode: 'self'\`): the same commands give raw counts from the app's database (pageviews, visitors,
|
|
254
254
|
sessions, events by name) for \`--days\` or \`--from --to\` (UTC days). Filters, \`--by\`, \`--compare\` and reports with sources,
|
|
255
|
-
pages, visits and conversions come with
|
|
255
|
+
pages, visits and conversions come with sh2 Cloud: say so.
|
|
256
256
|
|
|
257
257
|
## Manage it
|
|
258
258
|
|
|
259
259
|
- \`npx splithub analytics pause site\` / \`resume site\`: live in the cloud within a minute; paused events are dropped and not billed.
|
|
260
|
-
- \`npx splithub analytics archive site\` / \`restore site\` (
|
|
260
|
+
- \`npx splithub analytics archive site\` / \`restore site\` (sh2 Cloud): like Archive in the dashboard, it stops collecting and leaves
|
|
261
261
|
the list (\`archived\` in it), numbers kept; restored comes back paused.
|
|
262
262
|
- \`npx splithub analytics remove site\`: out of the config (push next); a dashboard-made property is deleted with its numbers.
|
|
263
263
|
- Allowed domains are per experiment and per property: \`npx splithub domains set property site example.com\` (subdomains included),
|
|
@@ -277,10 +277,10 @@ There are no variants and no verdicts: reports are counts.
|
|
|
277
277
|
// src/skills-apps.ts
|
|
278
278
|
var SKILL_APPS = `---
|
|
279
279
|
name: splithub-apps
|
|
280
|
-
description: Run
|
|
280
|
+
description: Run sh2 experiments and analytics in a mobile or desktop app: React Native and Expo (@splithub/react-native), native iOS (Swift package SplitHub) and Android (io.splithub:splithub). Screens, app_version targeting, retention, and why app experiments are created in the cloud. Use when the project has react-native, expo, an Xcode project or an Android Gradle build, or the user asks to A/B test or measure an app.
|
|
281
281
|
---
|
|
282
282
|
|
|
283
|
-
#
|
|
283
|
+
# sh2 in apps
|
|
284
284
|
|
|
285
285
|
Same experiments, goals and analytics as on the web. Two things differ: an app's config is built into the binary,
|
|
286
286
|
and screens take the place of pages.
|
|
@@ -337,14 +337,14 @@ and screens take the place of pages.
|
|
|
337
337
|
// src/skills.ts
|
|
338
338
|
var SKILL_SPLITHUB = `---
|
|
339
339
|
name: splithub
|
|
340
|
-
description: Add, change, run or read experiments in an app that uses
|
|
340
|
+
description: Add, change, run or read experiments in an app that uses sh2 (@splithub/react, splithub.config.ts, the splithub CLI, sh2 Cloud). Use when the user asks to A/B test a component, headline, image, price, CTA or page, asks which variant is winning, or wants to start, pause or finish an experiment; also for notes on the charts, alert rules (events used, traffic, goals, winners), short links and allowed domains.
|
|
341
341
|
---
|
|
342
342
|
|
|
343
|
-
#
|
|
343
|
+
# sh2 for coding agents
|
|
344
344
|
|
|
345
345
|
Three pieces: \`splithub.config.ts\` (the experiments; source of truth when it exists),
|
|
346
346
|
\`@splithub/react\` (renders variants), the \`splithub\` CLI (creates, pushes, reads results).
|
|
347
|
-
Events go to the app's own database (self mode) or to
|
|
347
|
+
Events go to the app's own database (self mode) or to sh2 Cloud (cloud mode).
|
|
348
348
|
|
|
349
349
|
## Where things live
|
|
350
350
|
|
|
@@ -375,7 +375,7 @@ Events go to the app's own database (self mode) or to SplitHub Cloud (cloud mode
|
|
|
375
375
|
|---|---|---|---|
|
|
376
376
|
| \`value\` | only data changes: text, number, image URL, price, JSON. The default choice: no new components. | \`--variants control,bold --value control="Old text" --value bold="New text"\` | \`const text = useValue<string>('<id>')\`; server components: \`getValue\` from \`@splithub/next\`; no SDK: \`sh.value('<id>')\` |
|
|
377
377
|
| \`component\` | structure changes: a layout, a section, a flow, a different component per variant | \`--variants control,bold\` (the CLI scaffolds \`splithub/<id>/<Variant>.tsx\` stubs) | \`<Experiment id="<id>"><Variant name="control">\u2026</Variant><Variant name="bold">\u2026</Variant></Experiment>\`, or \`useVariant('<id>')\` in a switch |
|
|
378
|
-
| \`redirect\` | a whole page changes: another URL per variant | \`--match / --to control=/ --to v2=/home-v2\` | nothing: \`@splithub/next\` middleware or the drop-in script \`<script src="https://go.
|
|
378
|
+
| \`redirect\` | a whole page changes: another URL per variant | \`--match / --to control=/ --to v2=/home-v2\` | nothing: \`@splithub/next\` middleware or the drop-in script \`<script src="https://go.sh2.uk/sh.js" data-key="pk_\u2026">\` sends visitors there |
|
|
379
379
|
| \`mvt\` | several things change at once (headline \xD7 button \xD7 image) and the user wants to know which of them matters; every combination is tested and each factor is read on its own | \`--factor headline=old:"Old text",new:"New text" --factor button=blue:#2563eb,green:#16a34a\` (no \`--variants\`; first level = control; at most 4 factors \xD7 4 levels, 16 combinations) | \`const { headline, button } = useValue<{ headline: string; button: string }>('<id>')\` |
|
|
380
380
|
|
|
381
381
|
mvt needs more visitors than a two-variant experiment: every combination must reach the minimum on its own (the results show the
|
|
@@ -424,7 +424,7 @@ visitors; \`create --good-sample\`); say it next to the verdict. \`verdict.sampl
|
|
|
424
424
|
\`verdict.sample.checks[]\`: report the stars and the unmet labels; they never override the verdict. \`daysToVerdict\` says when to look again.
|
|
425
425
|
Never declare a winner from raw rates. \`srm_detected\` means the split is broken: fix the setup before anything else.
|
|
426
426
|
|
|
427
|
-
### Slices, breakdowns, timelines (
|
|
427
|
+
### Slices, breakdowns, timelines (sh2 Cloud)
|
|
428
428
|
|
|
429
429
|
- A slice: \`npx splithub results <id> --from 2026-10-01 --to 2026-10-15 --filter country=DE --filter channel="Paid Search" --json\`.
|
|
430
430
|
\`from\` / \`to\` are first-exposure days (project time zone): the visitors who entered the experiment then, with all their
|
|
@@ -460,7 +460,7 @@ Whenever you see an experiment with \`status: finished\` (in \`status\`, \`resul
|
|
|
460
460
|
|
|
461
461
|
A \`paused\` experiment is not over: say so and ask whether to resume (\`start\`) or finish it.
|
|
462
462
|
|
|
463
|
-
## Around experiments (
|
|
463
|
+
## Around experiments (sh2 Cloud)
|
|
464
464
|
|
|
465
465
|
- **Notes**: what happened on a day, marked on experiment timelines and analytics charts. \`npx splithub notes add "Launched the
|
|
466
466
|
new pricing page" [--kind note|issue|win] [--experiment <key> | --property <id>] [--day 2026-10-05]\` (none = the whole
|
|
@@ -543,12 +543,12 @@ SRM = the split differs from the configured weights \xB7 guardrail = a metric th
|
|
|
543
543
|
`;
|
|
544
544
|
var SKILL_SPLITHUB_API = `---
|
|
545
545
|
name: splithub-api
|
|
546
|
-
description: Use the
|
|
546
|
+
description: Use the sh2 Cloud HTTP API directly: public key event ingest, API-key endpoints for config, status, results, overrides, analytics reports, notes, short links and alert rules. Use when writing a server, a script, a non-JS client, or when the CLI is not available.
|
|
547
547
|
---
|
|
548
548
|
|
|
549
|
-
#
|
|
549
|
+
# sh2 Cloud API
|
|
550
550
|
|
|
551
|
-
Base URL: \`https://go.
|
|
551
|
+
Base URL: \`https://go.sh2.uk\`. JSON in, JSON out (no envelope under \`/v1/*\`). Two credentials:
|
|
552
552
|
|
|
553
553
|
- **Public key \`pk_\u2026\`**: identifies the project to browsers and SDKs. Safe to ship. Can only send events and read
|
|
554
554
|
the public overrides JSON.
|
|
@@ -602,7 +602,7 @@ Server-side sending: a key with \`events:write\` can post to \`POST /v1/events\`
|
|
|
602
602
|
so there is no origin check; keep it on the server.
|
|
603
603
|
|
|
604
604
|
\`\`\`bash
|
|
605
|
-
curl -X POST https://go.
|
|
605
|
+
curl -X POST https://go.sh2.uk/v1/events \\
|
|
606
606
|
-H "Authorization: Bearer $SPLITHUB_API_KEY" -H "Content-Type: application/json" \\
|
|
607
607
|
-d '{ "sdk": "server/1.0", "events": [
|
|
608
608
|
{ "id": "g_order_1042", "type": "goal", "goal": "purchase", "vid": "v_abc", "ts": 1760000010000, "props": { "revenue": 49 } },
|
|
@@ -679,7 +679,7 @@ Scripts should prefer the API-key endpoints above; the session ones exist for th
|
|
|
679
679
|
|
|
680
680
|
## Drop-in script (no SDK)
|
|
681
681
|
|
|
682
|
-
\`<script src="https://go.
|
|
682
|
+
\`<script src="https://go.sh2.uk/sh.js" data-key="pk_live_\u2026"></script>\` in \`<head>\`: redirect experiments, page-visit and
|
|
683
683
|
click goals from the cloud config, \`window.splithub.track(name, props)\` for every event (goals included), pageviews
|
|
684
684
|
for analytics properties (\`data-property="site"\`). An app with the SDK does not need it: one install per property,
|
|
685
685
|
or only the first of the two collects pageviews.
|
|
@@ -692,10 +692,10 @@ or only the first of the two collects pageviews.
|
|
|
692
692
|
`;
|
|
693
693
|
var SKILL_SPLITHUB_MCP = `---
|
|
694
694
|
name: splithub-mcp
|
|
695
|
-
description: Use or set up the
|
|
695
|
+
description: Use or set up the sh2 MCP server (@splithub/mcp) so an agent can create experiments, read verdicts, start/pause/finish experiments and push config through tools instead of shelling out, plus analytics, notes, alerts and short links. Use when the user asks to connect sh2 to Claude Code, Cursor, Codex or another MCP client.
|
|
696
696
|
---
|
|
697
697
|
|
|
698
|
-
#
|
|
698
|
+
# sh2 MCP server
|
|
699
699
|
|
|
700
700
|
\`@splithub/mcp\` is a stdio MCP server that wraps the \`splithub\` CLI for the current project folder.
|
|
701
701
|
Same credentials and config file as the CLI; nothing extra to configure.
|
|
@@ -781,7 +781,7 @@ function configTemplate(project, mode, key, options = {}) {
|
|
|
781
781
|
// store release. Create experiments in the dashboard to start them without a release.` : "";
|
|
782
782
|
return `import { defineConfig } from '@splithub/core';
|
|
783
783
|
|
|
784
|
-
//
|
|
784
|
+
// sh2 experiments. This file is the source of truth: the SDK, the CLI
|
|
785
785
|
// and the dashboard all read it. Keys: lowercase a-z 0-9 - _. First variant = control.${appNote}
|
|
786
786
|
export default defineConfig({
|
|
787
787
|
project: '${project}',
|
|
@@ -854,9 +854,9 @@ export function ${name}() {
|
|
|
854
854
|
`;
|
|
855
855
|
}
|
|
856
856
|
var AGENTS_SECTION = `
|
|
857
|
-
## A/B testing (
|
|
857
|
+
## A/B testing (sh2)
|
|
858
858
|
|
|
859
|
-
This project uses
|
|
859
|
+
This project uses sh2 (\`@splithub/react\`). Experiments are declared in
|
|
860
860
|
\`splithub.config.ts\` and rendered with \`<Experiment id>\` / \`useVariant(id)\` /
|
|
861
861
|
\`useValue(id)\`. Events: \`useTrack()\` then \`track('<event name>')\`; an experiment's goal is any event name.
|
|
862
862
|
|
|
@@ -871,16 +871,16 @@ This project uses SplitHub (\`@splithub/react\`). Experiments are declared in
|
|
|
871
871
|
- \`create\` writes \`status: 'running'\`: the experiment goes live when the code is deployed. Always tell the user that, and that
|
|
872
872
|
\`npx splithub pause <id>\` or Pause in the dashboard holds it. Never change \`seed\` of a running experiment.
|
|
873
873
|
- Analytics: set it up with \`npx splithub analytics connect --json\` (names the property on the provider), read it with
|
|
874
|
-
\`npx splithub analytics <property> --json\`; also \`funnel\`, \`paths\`, \`retention\`, \`realtime\`, \`export\` (
|
|
874
|
+
\`npx splithub analytics <property> --json\`; also \`funnel\`, \`paths\`, \`retention\`, \`realtime\`, \`export\` (sh2 Cloud).
|
|
875
875
|
Details: .claude/skills/splithub-analytics/SKILL.md
|
|
876
|
-
- Notes, alerts, links, domains (
|
|
876
|
+
- Notes, alerts, links, domains (sh2 Cloud): \`npx splithub notes add "<what shipped>"\` when you ship, \`npx splithub alerts\` (rules, e.g.
|
|
877
877
|
\`alerts add usage --every 1000\`), \`npx splithub links\` (short links), \`npx splithub domains\`. Humans: \`npx splithub\` opens the menu.
|
|
878
878
|
- Apps (React Native / Expo / iOS / Android): new experiments start in the dashboard (the config is built into the binary);
|
|
879
879
|
screens are page events. Details: .claude/skills/splithub-apps/SKILL.md
|
|
880
880
|
- Config ships to the browser: no secrets in it. Full rules: .claude/skills/splithub/SKILL.md
|
|
881
881
|
`;
|
|
882
882
|
var CURSOR_RULE = `---
|
|
883
|
-
description:
|
|
883
|
+
description: sh2 A/B testing conventions
|
|
884
884
|
globs: ["splithub.config.ts", "splithub/**", "**/*.tsx"]
|
|
885
885
|
alwaysApply: false
|
|
886
886
|
---
|
|
@@ -896,4 +896,4 @@ export {
|
|
|
896
896
|
AGENTS_SECTION,
|
|
897
897
|
CURSOR_RULE
|
|
898
898
|
};
|
|
899
|
-
//# sourceMappingURL=chunk-
|
|
899
|
+
//# sourceMappingURL=chunk-BDCKWKJB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/skills-self-hosted.ts","../src/skills-ship.ts","../src/skills-analytics.ts","../src/skills-apps.ts","../src/skills.ts","../src/templates.ts"],"sourcesContent":["// Skill: sh2 with the user's own database (self mode) and reporting from the cloud.\n// Bundled fallback; sh2 Cloud serves the current text at GET /v1/skills.\nexport const SKILL_SELF_HOSTED = `---\nname: splithub-self-hosted\ndescription: Keep sh2 events in your own database (self mode): which tables, how to write a Store for Postgres, MySQL, Prisma, Drizzle, Supabase or anything else, where the ingest route lives, how the CLI reads results from it, and how to get cloud data into your own database for reports. Use when the user wants data in their infra or asks about tables, schema or reporting.\n---\n\n# sh2 with your own database\n\nTwo ways to own the data:\n\n1. **Self mode** — the app hosts the ingest route and the store; nothing leaves your infra.\n \\`splithub.config.ts\\`: \\`storage: { mode: 'self', endpoint: '/api/splithub' }\\`.\n2. **Cloud + export** — events go to sh2 Cloud; you pull summaries into your warehouse for reports.\n\n## Self mode: the pieces\n\n- Route: \\`app/api/splithub/[[...path]]/route.ts\\` (Next.js) or any fetch-style handler from\n \\`createSplitHubHandler({ config, store, adminToken })\\` in \\`@splithub/node\\`. It accepts\n \\`POST /events\\` from the SDK and answers \\`GET /status\\`, \\`GET /results/<id>\\` for the CLI\n (\\`npx splithub status\\` talks to the local dev server, or \\`--url https://your.app/api/splithub\\`).\n Self-hosted reads are raw numbers per variant (\\`variants[]\\`: visitors, conversions, rate, revenue)\n with \\`analysis: { available: false }\\`. Verdicts, data-quality stars and recommendations come with sh2 Cloud,\n and so do slices, breakdowns, timelines and raw experiment events (\\`results --from/--filter/--by\\` answer \\`NOT_CLOUD\\` here).\n With an analytics property the SDK sends \\`track()\\` as one \\`event\\` row and a page as one \\`page\\` row; the handler\n stores the goal rows experiments need next to them (goals of the config's experiments only), so the store sees goals as before.\n- Store: an object with three methods (below). Ready-made: \\`@splithub/adapter-sqlite\\`\n (Node 22.13+, \\`node:sqlite\\`, zero setup) and \\`@splithub/adapter-d1\\` (Cloudflare D1).\n \\`npx splithub init --mode self --db postgres|mysql|custom\\` writes \\`splithub/store.ts\\` with a\n working Postgres (pg) or MySQL (mysql2) store, or a documented stub for anything else.\n- Admin token: set \\`SPLITHUB_ADMIN_TOKEN\\` in the app and \\`--token\\` / \\`SPLITHUB_ADMIN_TOKEN\\` for\n the CLI, so results are not public.\n\n## The events table\n\nOne table, one row per event. Column names are yours; the templates use these:\n\n| column | type | meaning |\n|---|---|---|\n| id | text, primary key | client-generated, unique; dedupe on it (retries resend batches) |\n| type | text | \\`exposure\\` or \\`goal\\` |\n| experiment, variant | text | for exposures |\n| goal | text | for goals |\n| visitor_id, session_id | text | \\`sh_vid\\` cookie / session |\n| ts | bigint | client time, unix ms |\n| url | text | page |\n| props | json | goal payload, e.g. \\`{ \"revenue\": 49 }\\` |\n| received_at | bigint | server time, unix ms |\n| host, country, device, browser | text | request metadata (fill from headers if you want breakdowns) |\n\nIndexes: \\`(type, experiment, visitor_id, ts)\\` and \\`(type, goal, visitor_id, ts)\\`.\n\n## The Store interface (\\`@splithub/node\\`)\n\n\\`\\`\\`ts\ninterface Store {\n insertEvents(events: StoredEvent[]): Promise<number>; // skip existing ids, return inserted count\n variantCounts(experiment: string, goal: string): Promise<VariantCounts[]>; // per variant: exposures, conversions, revenue\n summaries(): Promise<ExperimentSummary[]>; // per experiment: exposures, visitors, first/last ts\n close?(): Promise<void> | void;\n}\n\\`\\`\\`\n\nAttribution rule — keep it exactly, so self-hosted results equal the cloud's:\n**a visitor converts for a variant when they sent the goal at or after their first exposure to\nthat variant; exposures and conversions count unique visitors.** The SQL in the generated\n\\`splithub/store.ts\\` implements it (CTE \\`first_exposure\\`, then goals joined with \\`ts >= first_ts\\`).\n\nPrisma / Drizzle: map the table in your schema and write the three methods with the ORM, or run the\none raw query for \\`variantCounts\\`. Supabase: the same SQL as a Postgres function called through\n\\`rpc\\`. Mongo: \\`$group\\` by variant and visitor with \\`$min ts\\`, then \\`$lookup\\` goals.\n\n## Reports from the cloud into your database\n\n- CSV: dashboard → experiment → Export (summary, daily timeline, raw events up to 50k rows).\n- Webhook channel for alerts and the digest: POST JSON to your endpoint when something happens.\n- Scheduled pull: a cron in your app calls \\`GET /v1/status\\` and \\`GET /v1/results/<id>\\` with the\n API key (\\`sk_…\\`) and stores the verdicts. Raw events live 30–90 days in the cloud (plan dependent),\n aggregates a year: pull summaries, not raw rows, for long-term reporting.\n- Need every raw event forever in your infra? Use self mode; one store per project.\n\n## Do not\n\n- Put database credentials in \\`splithub.config.ts\\` (it ships to the browser). They belong in the route's env.\n- Call a winner from raw rates: a higher rate is often noise. Say the numbers as they are; verdicts come with sh2 Cloud.\n`;\n","// Skills: ship the winner (`splithub ship`) and the full agent loop. Installed next\n// to the other skills by `splithub init` / `splithub skills`.\n\nexport const SKILL_SHIP = `---\nname: splithub-ship\ndescription: Ship the winner of an experiment and remove the experiment from the code: keep only the winning value, component or page, delete the losing variants, finish the experiment and clean splithub.config.ts. Use when an experiment has a verdict and the user says ship it, roll out the winner, remove the experiment, or clean up; and whenever an experiment shows status finished and the user agreed on which variant to keep.\n---\n\n# Shipping the winner\n\nGoal: the app behaves exactly as the kept variant did, with no experiment left in the code or in the config.\n\n## 1. Decide\n\n\\`npx splithub results <id> --json\\` (MCP: \\`splithub_results\\`). Act on \\`verdict.status\\`:\n- \\`winner_found\\`: keep \\`verdict.winner\\`.\n- \\`no_significant_difference\\`: keep the control, or the simpler variant if the user agrees.\n- \\`insufficient_sample\\`: do not ship. Say when to look again: \\`daysToVerdict\\` days at the current traffic.\n- \\`srm_detected\\`: do not ship. The split is broken; fix the setup first.\n- \\`guardrail_breached\\`: do not ship the variant in \\`verdict.guardrailBreached\\`; it made a guardrail worse. Say what broke.\nAsk the user which variant to keep before going on. Never pick from raw rates.\n\n## 2. Preview, then ship\n\n\\`\\`\\`bash\nnpx splithub ship <id> --keep <variant> --dry-run --json # diff + leftovers, nothing written\nnpx splithub ship <id> --keep <variant> --json # apply\n\\`\\`\\`\nMCP: \\`splithub_ship\\` with \\`dryRun: true\\`, then without. It archives the experiment in the cloud (numbers stay readable), removes it from\n\\`splithub.config.ts\\` (checked by reloading the file) and rewrites the code:\n- \\`<Experiment id>\\` → the kept \\`<Variant>\\`'s children; the other variants are dropped.\n- \\`useValue('<id>')\\` / \\`sh.value('<id>')\\` → the kept value as a literal.\n- \\`useVariant('<id>')\\` comparisons, ternaries, \\`&&\\`, \\`if\\` and \\`switch\\` → the kept branch.\n- Unused \\`Experiment\\`, \\`Variant\\`, \\`useVariant\\`, \\`useValue\\` imports go.\n\n## 3. Finish by hand\n\n- \\`leftovers[]\\`: each \\`{ file, line, text, reason }\\` still mentions the experiment; rewrite those yourself.\n- component kind: delete components and files only the losing variants used (e.g. \\`splithub/<id>/\\`).\n- redirect kind: make the kept URL the real page (move the route or add a permanent redirect), delete the other page.\n- Goal: keep \\`track('<goal>')\\` when another experiment measures it (\\`next\\` says so); otherwise ask before removing it.\n- Cloud mode: \\`npx splithub push\\`. Then \\`npx splithub doctor\\` and the project's typecheck and tests.\n- \\`npx splithub refs <id> --json\\` must return \\`count: 0\\` for the experiment.\n\nReport what changed (files, the kept content) and the verdict in one line with its numbers. Never reuse the id.\n`;\n\nexport const SKILL_LOOP = `---\nname: splithub-loop\ndescription: The whole experiment loop for an agent with sh2, step by step with the MCP tools and CLI --json fields: plan, create, implement, check, push, read results, finish, ship. Use when the user asks to run an experiment end to end, or to pick up an experiment where it stands.\n---\n\n# The full loop\n\nEach step: MCP tool, or the CLI with \\`--json\\` (one line of JSON; errors are \\`{ error, code, hint }\\`, exit 1).\n\n| step | MCP tool | CLI | read |\n|---|---|---|---|\n| 0. size it | \\`splithub_plan\\` | \\`plan --baseline 0.05 --mde 0.1 [<id>]\\` | \\`perVariant\\`, \\`total\\`, \\`traffic.daysLeft\\` |\n| 1. create | \\`splithub_experiment_create\\` | \\`create --kind … --id … --goal … --yes\\` | \\`snippet\\`, \\`files\\`, \\`nextStep\\`, \\`handoff\\` |\n| 2. implement | (edit code) | | wire \\`snippet\\`; \\`track('<goal>')\\` where it converts |\n| 3. check | \\`splithub_doctor\\`, \\`splithub_refs\\` | \\`doctor\\`, \\`refs <id>\\` | \\`ok\\`, \\`checks[]\\`; \\`refs[]\\` shows the wiring |\n| 4. push (cloud) | \\`splithub_push\\` | \\`push\\` (\\`--dry-run\\` to preview) | \\`adopted\\`, \\`diff\\` |\n| 5. results | \\`splithub_status\\`, \\`splithub_results\\` | \\`status\\`, \\`results <id>\\` | \\`verdict.status\\`, \\`verdict.message\\`, \\`verdict.notes[]\\`, \\`daysToVerdict\\` |\n| 6. finish | \\`splithub_experiment_status\\` | \\`finish <id>\\` | \\`live\\`, \\`next\\` |\n| 7. ship | \\`splithub_ship\\` | \\`ship <id> --keep <v> [--dry-run]\\` | \\`diff\\`, \\`leftovers[]\\`, \\`next\\` |\n\nRules that keep the answer honest:\n- Plan before creating: if \\`traffic.daysLeft\\` is months, try a bigger change or a busier page.\n- \\`create\\` writes a running experiment; it goes live when the code is deployed (and pushed in cloud mode). Tell the user.\n- Verdicts are sequential (always-valid): checking any day is safe. Quote \\`verdict.message\\` and the always-valid\n \\`comparisons[].sequential.pValue\\`, not the fixed-horizon \\`pValue\\` (p = 0.01 there can still be not significant).\n Relay \\`verdict.notes[]\\`. Verdicts depend on sample size, not days. Say \\`verdict.sample.quality\\` (small | ok | good;\n good = every variant has its share of \\`goodSample\\`, default 5000 visitors, \\`create --good-sample\\`) next to the verdict.\n- \\`daysToVerdict\\` is the re-check date: schedule (or tell the user) a look in that many days instead of polling.\n- \\`srm_detected\\`: the split is broken; fix the setup, do not read the numbers.\n- \\`guardrail_breached\\`: don't ship. A variant made a guardrail worse (\\`verdict.guardrailBreached[]\\`), e.g. \"bold wins on\n signups but raises refunds\". \\`verdict.metrics[]\\` has the secondary metrics and guardrails, read like the main table.\n- Guard what matters when creating: \\`--secondary pricing_view --guardrail refunds:higher\\` (MCP: \\`secondary\\`, \\`guardrails\\`).\n Experiments that could clash on one page go in one layer: \\`--layer checkout:0-50\\` and \\`checkout:50-100\\` never share a visitor.\n- \\`splithub holdout set 5\\` keeps 5% of visitors out of every experiment; the \\`__holdout\\` row (\"Holdout: long-term impact\")\n compares them with everyone else.\n- Ask the user which variant to keep before \\`ship\\`; preview with \\`dryRun\\` and show them the diff.\n- Error \\`code\\` → action: \\`NOT_LOGGED_IN\\` → \\`splithub_login\\`, show the link, wait, retry · \\`INSUFFICIENT_SCOPE\\` → the key\n can only read; ask for a key with write scope · \\`NO_CONFIG\\` → \\`splithub_init\\` ·\n \\`EXPERIMENT_NOT_FOUND\\` → \\`splithub_status\\` for ids · \\`CONFIG_UNSAFE\\` → edit the config by hand where the experiment is\n defined · \\`CONFIG_WRITE\\` → the file was restored; edit by hand, then \\`doctor\\`.\n`;\n","// Skill: analytics properties (pageviews and custom events, read as reports).\n\nexport const SKILL_ANALYTICS = `---\nname: splithub-analytics\ndescription: Collect and read web analytics with sh2: analytics properties (pageviews, events with track(), identified users, sources, channels, pages, goals and conversions), setting one up in the app (analytics connect), funnels, paths, retention, realtime, event props, CSV export, segments, notes and alerts on traffic, sh.js or the SDK, allowed domains. Use when the user wants traffic numbers, page or source reports, event tracking, funnels, or asks to \"add analytics\" to an app that uses sh2 or could.\n---\n\n# sh2 analytics\n\nAn analytics property is a stream of pageviews and custom events, like a site in Google Analytics. It sits next to the\nexperiments: same config file, same CLI, same key, same storage choice (sh2 Cloud or the app's own database).\nThere are no variants and no verdicts: reports are counts.\n\n## Set it up\n\n1. One step: \\`npx splithub analytics connect --json\\` (or Analytics → Set up in the \\`npx splithub\\` menu) picks the project's\n property (or creates one: \\`--name \"Marketing site\"\\`; a given id is used, \\`connect sh-x1h78w\\`) and adds\n \\`property=\"sh-…\"\\` to the one \\`<SplitHubProvider>\\` / \\`<SplitHubNextProvider>\\` in the code. It answers \\`wired.status\\`:\n added | already | other (another property is named there: ask, then \\`--force\\`) | none | many (add \\`snippets.provider\\`\n or \\`snippets.script\\` yourself), plus \\`snippets.track\\` and \\`next\\`.\n By hand: \\`npx splithub analytics create --name \"Marketing site\" --json\\` writes \\`properties: { 'sh-x1h78w': { name: … } }\\`\n into \\`splithub.config.ts\\` (self-hosted projects keep their properties there). Cloud mode: both also create it in the\n cloud at once (\\`live: applied\\`), so no push is needed; when \\`live\\` names a missing API key, \\`npx splithub login\\` and run it\n again, or \\`npx splithub push\\`. A property made in the dashboard needs no push either; its id is on its page.\n2. Send events. Events go only to a property named by its id, never to a guess:\n - SDK: \\`<SplitHubProvider config={config} property=\"sh-x1h78w\">\\`: a pageview on load and on every client-side route change.\n - Events: one call, \\`const track = useTrack(); track('Video Played', { id: 3 })\\` (or \\`client.track(...)\\`). Names: letters,\n digits, spaces and \\`_ . : / -\\`, up to 64 characters; props: a flat object up to 4 KB. The same call counts for\n experiments whose goal is that event. Only what the app passes to \\`track()\\` is sent.\n - Users: \\`const identify = useIdentify(); identify(user.id, { plan: 'pro' })\\` after sign-in (\\`identify(null)\\` on sign-out;\n sh.js: \\`splithub.identify(id, traits)\\`) ties visits to the app's user; reports then count \\`users\\`. No emails or names in traits.\n - No SDK: \\`<script src=\"https://go.sh2.uk/sh.js\" data-key=\"pk_…\" async></script>\\` sends pageviews (SPA navigations\n included) and \\`window.splithub.track(name, props)\\` once the tag has \\`data-property=\"sh-x1h78w\"\\`.\n - One install covers analytics and experiments: the provider (or sh.js) with \\`property\\` collects pageviews and runs\n experiments. Each \\`track()\\` sends one event row and each page one page row; experiments whose goal is that event or\n page count them from those rows, so nothing extra is sent or billed. Never add sh.js and the SDK for the same\n property: when both run on a page, only the first collects pageviews.\n - Servers and other languages: \\`POST /v1/events\\` with \\`{ type: 'page', prop, url, vid, sid, ts, id, title?, ref? }\\` or\n \\`{ type: 'event', prop, name, props?, … }\\` (splithub-api skill).\n3. Development never sends to the cloud (same rule as experiments): check a deploy or \\`vite preview\\`.\n4. Events: any name is recorded, nothing to declare first. A goal is an event marked as one (\\`goals\\` in the config, the\n goal switch on an event in the dashboard, or simply naming the event as an experiment's goal); goals count as\n conversions in every property (a property's \\`goals\\` list narrows that). \\`value\\` is what one conversion is worth\n when the event carries no \\`revenue\\` prop; \\`event: 'Video Played'\\` matches an event name that is not a valid key.\n\n## Read it\n\n- \\`npx splithub analytics --json\\`: every property with visitors, visits, pageviews and bounce for the last 30 days.\n- \\`npx splithub status --json\\` (sh2 Cloud) also lists every property under \\`properties\\`: the last 7 days against the 7 before\n (visitors, \\`change\\`, goal conversions); \\`npx splithub report\\` adds them as an Analytics table. The digest (Pro, set in the\n dashboard under Alerts) covers properties too: visitors, top sources and pages, goals and events against the period before.\n- \\`npx splithub analytics site --json\\` (\\`--days 7\\`, or \\`--from 2026-10-01 --to 2026-10-31\\`): totals, \\`users\\` (identified),\n goals (conversions = unique visitors who reached the goal in the range, completions, revenue), top pages, top sources, notes.\n- \\`--by page|source|channel|referrer|utm_source|utm_medium|utm_campaign|country|device|browser|os|platform|app_version|entry|exit|event|goal\\`; with a\n visit dimension, \\`--goal signup\\` adds conversions per row; \\`--by variant --experiment hero\\` splits visits by the\n variant each visitor saw, \\`--by trait --key plan\\` by an identify() trait. \\`--filter country=DE,FR --filter source=\"(none)\"\\` narrows any report.\n- \\`npx splithub analytics events site --json\\`: the latest raw pageviews and events, to check tracking right after wiring it.\n- More reports (sh2 Cloud), each with the same \\`--days\\` / \\`--from --to\\` / \\`--filter\\` flags:\n - \\`analytics funnel site --steps \"page:/,event:Signup,goal:paid\" [--within visit|7d|30d] [--by country]\\`: visitors per step\n in order, \\`conversion\\` (share of step 1) and \\`dropoff\\` (share lost since the step before).\n - \\`analytics funnels site\\`: the funnels saved on the property (its Funnels tab, shared with the team).\n \\`--save Signup --steps \"page:/,goal:signup\" [--within 7d]\\` saves one (a saved name updates it), \\`--delete <id|name>\\`\n removes one, and \\`analytics funnel site --funnel Signup\\` runs it. Save a funnel the user will want to read again.\n - \\`analytics paths site --page /pricing [--prev]\\`: where visits went next (or came from).\n - \\`analytics retention site [--start visit|event:<name>|goal:<key>] [--return visit|event:<name>] [--period day|week]\\`: cohorts\n \\`{ start, users, retained[] }\\`, \\`retained[0]\\` = the cohort period itself; up to 90 days or 26 weeks (\\`clamped\\`).\n - \\`analytics realtime site\\`: visitors in the last 5 minutes, top pages and sources.\n - \\`analytics props site --event Signup [--key plan]\\`: an event's prop names, or one prop's values.\n - \\`analytics export site --by page|day [--raw] > report.csv\\`: CSV to stdout.\n - \\`--compare\\` on a report adds the period right before (\\`previous\\`), \\`--compare year\\` the same days a year earlier, \\`--compare 2026-08-01..2026-08-31\\` chosen days; \\`--segment \"Paid traffic\"\\` applies a saved segment\n (\\`analytics segments\\`, \\`--save <name> country=DE\\`, \\`--delete <id|name>\\`).\n - Notes mark a day on the charts: \\`npx splithub notes add \"Launched new pricing\" [--kind win] [--property site] [--day 2026-10-05]\\`,\n \\`notes --property site\\` lists them; add one when you ship something that may move traffic.\n - Alerts on a property (sh2 Cloud, Pro): \\`npx splithub alerts add traffic_drop --property site --percent 50\\`, \\`traffic_spike\\`,\n \\`goal_silent --property site --goal signup --hours 24\\`, \\`event_count --property site --event Signup --count 1000 [--repeat]\\`.\n- Words: a visit (\\`sessions\\`) ends after 30 minutes without events; a bounce is a visit with one page and no event;\n \\`source\\` is the UTM source or the referrer's site (Google, Facebook, …), \\`(none)\\` = direct; \\`channel\\` groups them (Direct,\n Organic Search, Paid Social, Email, Referral, …); a conversion is a visitor reaching a goal (once per visitor in the range);\n \\`duration\\` is in milliseconds. Bots are never counted.\n- Self-hosted (\\`mode: 'self'\\`): the same commands give raw counts from the app's database (pageviews, visitors,\n sessions, events by name) for \\`--days\\` or \\`--from --to\\` (UTC days). Filters, \\`--by\\`, \\`--compare\\` and reports with sources,\n pages, visits and conversions come with sh2 Cloud: say so.\n\n## Manage it\n\n- \\`npx splithub analytics pause site\\` / \\`resume site\\`: live in the cloud within a minute; paused events are dropped and not billed.\n- \\`npx splithub analytics archive site\\` / \\`restore site\\` (sh2 Cloud): like Archive in the dashboard, it stops collecting and leaves\n the list (\\`archived\\` in it), numbers kept; restored comes back paused.\n- \\`npx splithub analytics remove site\\`: out of the config (push next); a dashboard-made property is deleted with its numbers.\n- Allowed domains are per experiment and per property: \\`npx splithub domains set property site example.com\\` (subdomains included),\n \\`npx splithub domains clear property site\\` (any domain again), \\`npx splithub domains\\` lists them all. An empty list\n accepts every origin. Add localhost too when testing from it.\n- Apps: \\`kind: 'app'\\` on a property (\\`analytics create --kind app\\`, the default in an app project) shows screens, versions and\n retention in the dashboard; screens are page events (the \\`splithub-apps\\` skill).\n- Billing: every pageview and custom event counts like one exposure against the project's allowance.\n\n## Do not\n\n- Put personal data in event props (emails, names, ids from other systems).\n- Fire an event in a render loop or on every scroll: each one is stored and billed.\n- Read analytics counts as an experiment result: use \\`splithub results\\` for experiments.\n`;\n","// Skill: experiments and analytics in mobile and desktop apps (React Native / Expo, iOS, Android).\n\nexport const SKILL_APPS = `---\nname: splithub-apps\ndescription: Run sh2 experiments and analytics in a mobile or desktop app: React Native and Expo (@splithub/react-native), native iOS (Swift package SplitHub) and Android (io.splithub:splithub). Screens, app_version targeting, retention, and why app experiments are created in the cloud. Use when the project has react-native, expo, an Xcode project or an Android Gradle build, or the user asks to A/B test or measure an app.\n---\n\n# sh2 in apps\n\nSame experiments, goals and analytics as on the web. Two things differ: an app's config is built into the binary,\nand screens take the place of pages.\n\n## Install\n\n- React Native / Expo: \\`npx splithub init --mode cloud --yes --json\\`. It installs \\`@splithub/react-native\\` (plus\n \\`@react-native-async-storage/async-storage\\`, through \\`npx expo install\\` on Expo) and wraps the entry in\n \\`<SplitHubProvider config={config}>\\`: \\`app/_layout.tsx\\` with Expo Router (adds \\`<ExpoRouterScreens />\\`),\n else \\`App.tsx\\` (adds \\`<NavigationScreens />\\` inside \\`<NavigationContainer>\\` with React Navigation). Both come from\n \\`@splithub/react-native\\`; the hooks \\`useExpoRouterTracking()\\` / \\`useNavigationTracking(ref)\\` do the same by hand.\n Without a config file: \\`<SplitHubProvider publicKey=\"pk_…\" property=\"sh-…\">\\`.\n \\`app.entry.status\\`: added | already | manual (wire \\`nextStep\\` by hand). Hooks are the web ones, imported from\n \\`@splithub/react-native\\`: \\`useValue\\`, \\`useVariant\\`, \\`<Experiment>\\`, \\`useTrack\\`, \\`useIdentify\\`.\n- iOS: Swift package \\`SplitHub\\` (Xcode: File → Add Package Dependencies → \\`https://github.com/splithub-io/splithub-sdk\\`).\n \\`SplitHub.start(publicKey: \"pk_…\", property: \"sh-…\")\\` once at launch; \\`SplitHub.variant(\"id\")\\`, SwiftUI \\`SplitHubExperiment(\"id\") { variant in }\\`.\n- Android: \\`implementation(\"io.splithub:splithub:<version>\")\\` (+ \\`io.splithub:splithub-compose\\` for Compose).\n \\`SplitHub.start(this, \"pk_…\", property = \"sh-…\")\\` in \\`Application.onCreate\\`; \\`SplitHub.variant(\"id\")\\`, Compose \\`Experiment(\"id\") { variant -> }\\`, \\`TrackScreen(\"Home\")\\`.\n- Native apps have no \\`splithub.config.ts\\`: \\`init\\` prints the install lines and a quick start, and experiments come from the cloud.\n- Analytics: \\`npx splithub analytics connect --json\\` names a property on the provider; in an app project it is created with \\`kind: 'app'\\`.\n- \\`npx splithub doctor\\` checks the package, the storage module and the provider.\n\n## Experiments reach apps through the cloud\n\n- The config file ships inside the binary: an experiment added there reaches users only with the next store release,\n and only users who update. Old versions stay on what they were built with.\n- Start new experiments in the dashboard (no release; installed apps get them on the next launch with network). Pause,\n finish, weights and values set in the dashboard or with \\`npx splithub pause|start|finish <id>\\` also apply live.\n- Still \\`npx splithub push\\` after any config change, so the cloud and the file agree. Apps also receive the pushed\n experiments from the cloud (overrides JSON with \\`?all=1\\`), so a pushed experiment reaches an app whose build has its variants.\n- Redirect experiments do nothing in an app: use \\`value\\` (copy, prices, flags as JSON) or \\`component\\`.\n- Assignment is the same local hash on every platform: a visitor gets the same variant on web, iOS and Android.\n\n## Screens, versions, platforms\n\n- A screen is a \\`page\\` event: url \\`/<screen name>\\` (or the route path with Expo Router), title the screen name. Every\n page report, funnel (\\`page:/Checkout\\`) and pageview goal (\\`{ type: 'pageview', path: '/Checkout' }\\`) works on screens.\n- Without a navigation tracker: \\`useScreen('Settings')\\` (React Native), \\`SplitHub.screen(\"Settings\")\\` (iOS, Android).\n- Target app versions in the experiment's flow (dashboard targeting, or by hand):\n \\`{ type: 'condition', conditions: [{ field: 'app_version', op: 'gte', value: '2.4' }], then: 'split', else: 'skip' }\\`.\n \\`gte\\` / \\`lt\\` compare dotted versions part by part (\\`2.10.0\\` ≥ \\`2.9\\`). \\`platform\\` is \\`ios | android | macos | windows | linux | web\\`.\n Gate on the version that ships the variant code, so older builds skip the experiment.\n- Break down or filter by them: \\`results <id> --by platform\\`, \\`--by app_version\\`, \\`--filter platform=ios\\`;\n \\`analytics <property> --by app_version\\`, \\`--filter app_version=2.5.0\\`.\n- Events sent offline are kept on the device and arrive later with their own time: today's numbers can still grow.\n\n## Retention\n\n\\`npx splithub analytics retention <property> [--period day|week] [--from --to] --json\\`: \\`cohorts[] { start, users, retained[] }\\`,\n\\`retained[0]\\` is the cohort period itself, \\`retained[n] / users\\` the share back in period n. Up to 90 days or 26 weeks\n(\\`clamped: true\\` when cut). \\`--start event:Signup\\` and \\`--return event:<name>\\` change who counts. Counts, never a verdict.\n`;\n","// Agent skills installed by `splithub init` / `splithub skills`. One folder per\n// topic under .claude/skills/, so an agent loads only what the task needs:\n// splithub — the library, the config file, the CLI, where things live\n// ab-testing — what a good test is, metrics, sample size, when to stop\n// splithub-api — the HTTP API (keys, endpoints, payloads) for scripts and servers\n// splithub-mcp — the MCP server: tools, how to register it in Claude Code / Cursor\n// splithub-ship — keep a variant and take the test out (`splithub ship`)\n// splithub-loop — the whole loop for an agent, tool by tool\n// splithub-analytics — analytics properties: pageviews, events, reports, allowed domains\n// splithub-apps — React Native / Expo, iOS and Android: install, screens, versions, retention\n// Same text goes to .cursor/rules and the AGENTS.md section points here.\n\nexport interface Skill {\n dir: string;\n body: string;\n}\n\nexport const SKILL_SPLITHUB = `---\nname: splithub\ndescription: Add, change, run or read experiments in an app that uses sh2 (@splithub/react, splithub.config.ts, the splithub CLI, sh2 Cloud). Use when the user asks to A/B test a component, headline, image, price, CTA or page, asks which variant is winning, or wants to start, pause or finish an experiment; also for notes on the charts, alert rules (events used, traffic, goals, winners), short links and allowed domains.\n---\n\n# sh2 for coding agents\n\nThree pieces: \\`splithub.config.ts\\` (the experiments; source of truth when it exists),\n\\`@splithub/react\\` (renders variants), the \\`splithub\\` CLI (creates, pushes, reads results).\nEvents go to the app's own database (self mode) or to sh2 Cloud (cloud mode).\n\n## Where things live\n\n- Config: \\`splithub.config.ts\\` in the project root. Experiments and goals. Ships to the browser: never put secrets in it.\n- Credentials: \\`npx splithub login\\` (or \\`init --mode cloud\\`) prints a link; the human approves it in the browser; the CLI\n stores a project API key for this folder. Never ask the user to paste keys. CI uses \\`SPLITHUB_API_KEY\\`.\n- The public key (\\`pk_\\`) ends up in \\`storage.key\\` of the config from any of: \\`login\\` (saved credentials), the first\n \\`push\\`, \\`init --key\\`, or \\`SPLITHUB_API_KEY\\` in the environment (init asks the cloud). Missing key = events go nowhere.\n- Cloud: \\`npx splithub push\\` uploads the config. Experiments the cloud has from an earlier push that the file lacks are\n kept (\\`kept\\` in the answer); only \\`npx splithub push --prune\\` removes them, and only when the user asked for that.\n \\`npx splithub pull\\` writes dashboard-created experiments into the file.\n- Results: \\`npx splithub status --json\\` (in the cloud it also has \\`properties\\`: each analytics property's last 7 days), \\`npx splithub results <id> --json\\`. Sizing: \\`npx splithub plan --baseline 0.05 --mde 0.1\\`.\n- Closer reads (cloud): \\`results <id> --from --to --filter country=DE\\` (a slice), \\`--by <dimension>\\`, \\`--timeline\\`, \\`--engagement\\`,\n \\`--events\\`, \\`--export --by <dimension>\\` or \\`--export --events\\` (CSV); \\`npx splithub events --experiment <id>\\` for the raw tail. See \"Read results\".\n- Code that uses an experiment: \\`npx splithub refs <id> --json\\`. Keep a variant and remove the experiment: \\`npx splithub ship <id> --keep <v>\\`.\n- \\`--json\\` prints one line; errors are \\`{ error, code, hint }\\` with exit code 1. \\`INSUFFICIENT_SCOPE\\` adds \\`scope\\`\n (e.g. \\`notes:write\\`): the API key is limited to some areas; ask the user for a key with that scope. The \\`splithub-loop\\` skill has the whole flow.\n- Everything interactive: \\`npx splithub\\`, one menu: Experiments, Analytics, Short links, Alerts, Notes, Allowed domains,\n push / pull, local testing, doctor, agent skills. Everything scriptable: subcommands + \\`--json\\` (\\`npx splithub --help\\`).\n- Web analytics (pageviews, events, sources, pages, funnels) live in analytics properties: \\`npx splithub analytics connect\\`\n sets one up in the app; the \\`splithub-analytics\\` skill has the rest.\n- Apps (React Native, Expo, iOS, Android): the \\`splithub-apps\\` skill. The config is built into the binary, so new\n experiments for an app start in the dashboard; screens are page events; target versions with \\`app_version\\` \\`gte\\`.\n\n## Pick the kind\n\n| kind | use it when | create | read in code |\n|---|---|---|---|\n| \\`value\\` | only data changes: text, number, image URL, price, JSON. The default choice: no new components. | \\`--variants control,bold --value control=\"Old text\" --value bold=\"New text\"\\` | \\`const text = useValue<string>('<id>')\\`; server components: \\`getValue\\` from \\`@splithub/next\\`; no SDK: \\`sh.value('<id>')\\` |\n| \\`component\\` | structure changes: a layout, a section, a flow, a different component per variant | \\`--variants control,bold\\` (the CLI scaffolds \\`splithub/<id>/<Variant>.tsx\\` stubs) | \\`<Experiment id=\"<id>\"><Variant name=\"control\">…</Variant><Variant name=\"bold\">…</Variant></Experiment>\\`, or \\`useVariant('<id>')\\` in a switch |\n| \\`redirect\\` | a whole page changes: another URL per variant | \\`--match / --to control=/ --to v2=/home-v2\\` | nothing: \\`@splithub/next\\` middleware or the drop-in script \\`<script src=\"https://go.sh2.uk/sh.js\" data-key=\"pk_…\">\\` sends visitors there |\n| \\`mvt\\` | several things change at once (headline × button × image) and the user wants to know which of them matters; every combination is tested and each factor is read on its own | \\`--factor headline=old:\"Old text\",new:\"New text\" --factor button=blue:#2563eb,green:#16a34a\\` (no \\`--variants\\`; first level = control; at most 4 factors × 4 levels, 16 combinations) | \\`const { headline, button } = useValue<{ headline: string; button: string }>('<id>')\\` |\n\nmvt needs more visitors than a two-variant experiment: every combination must reach the minimum on its own (the results show the\ncombinations and, below them, each factor summed over its combinations). With little traffic, change one thing with \\`value\\`.\n\n## Create an experiment\n\n1. \\`npx splithub create --kind <value|component|redirect|mvt> --id <key> … --goal <event name> --yes --json\\` (see the table).\n The key is the experiment's id for good: never reuse one from an earlier experiment. \\`--name \"Signup button\"\\` adds a human\n name (dashboard, CLI) that can change any time. \\`push\\` fails with \\`KEY_CONFLICT\\` when a key already belongs to\n another experiment: ask the user, then rename the key, or push with \\`--replace <key>\\` (new experiment, old numbers cleared)\n or \\`--same <key>\\` (same experiment). \\`KEY_DELETED\\`: a deleted experiment used the key; pick a new one.\n2. Goal: any event the app sends with \\`track('<name>', props?)\\`, the one call for every event. Nothing to declare\n first: a name not in \\`goals\\` becomes an event goal keyed by its slug (\\`Video Played\\` → \\`video-played\\`) and \\`create\\`\n says so. A goal is just an event marked as one; page visits and clicks are goals declared in \\`goals\\`:\n \\`{ type: 'pageview', path: '/thanks' }\\`, \\`{ type: 'click', selector: '#buy' }\\` (tracked automatically by the SDK and the script).\n With an analytics property on the provider, the same \\`track()\\` and pageviews feed both: one install, one row per action.\n3. Wire it in code. \\`create\\` writes \\`status: 'running'\\`: the experiment goes live for every visitor, first page view\n included, as soon as this code is deployed. Use \\`--status draft\\` only when the user asks to hold it.\n4. Cloud mode: \\`npx splithub push\\` after any config change.\n5. Hand-off, always: end your reply by saying the experiment is **running in the config** and goes live when the user deploys\n this code; nothing is recorded before that, and local development never sends events to the cloud. Tell them how to\n check it locally (\\`?sh_force=<id>:<variant>\\`) and that Pause in the dashboard or \\`npx splithub pause <id>\\` holds it.\n In cloud mode a status set in the dashboard wins over the file for every visitor, first page included.\n For a draft (only if asked): say visitors do not see it and nothing is recorded until \\`npx splithub start <id>\\`.\n\nA draft is invisible to visitors. To check one before starting: \\`runDraftsInDev: true\\` at the top level of the config\nserves drafts like running experiments in development only (\\`NODE_ENV=development\\`: \\`next dev\\`, \\`vite\\`);\n\\`?sh_force=<id>:<variant>\\` shows one variant on any page, draft or not, without recording an exposure;\n\\`?sh_debug=1\\` (or \\`npx splithub dev\\`) logs every decision and opens a panel to switch variants.\nIn development the SDK explains drafts, paused experiments and held-back events in one line each. Vite apps: add \\`splithub()\\`\nfrom \\`@splithub/core/vite\\` to the plugins in vite.config so these lines and a summary of every experiment appear in the\nterminal that runs \\`vite\\`; Next.js server code prints them in its terminal anyway.\n\nKeys: lowercase a-z 0-9 - _, max 64 chars. First variant = control. Weights are relative (50/50, 1/1, 90/10).\nTargeting (country, device, UTM, cookie, time) is a \\`flow\\` graph on the experiment, edited in the dashboard; \\`pull\\` brings it into the file.\n\n## Read results\n\n\\`verdict.status\\` ∈ no_data | insufficient_sample | srm_detected | winner_found | no_significant_difference.\nReport \\`verdict.message\\` verbatim and the numbers behind it (visitors per variant, lift, the always-valid\n\\`comparisons[].sequential.pValue\\` and \\`sequential.ci\\`; the plain \\`pValue\\` is fixed-horizon, for display only) and relay\n\\`verdict.notes[]\\`. Verdicts are sequential and depend on sample size, not days: safe to check any time. \\`verdict.sample.quality\\` is\nsmall (below 100 visitors per variant or 50 conversions), ok, or good (every variant has its share of \\`goodSample\\`, default 5000\nvisitors; \\`create --good-sample\\`); say it next to the verdict. \\`verdict.sample.stars\\` (0..5) scores data quality from\n\\`verdict.sample.checks[]\\`: report the stars and the unmet labels; they never override the verdict. \\`daysToVerdict\\` says when to look again.\nNever declare a winner from raw rates. \\`srm_detected\\` means the split is broken: fix the setup before anything else.\n\n### Slices, breakdowns, timelines (sh2 Cloud)\n\n- A slice: \\`npx splithub results <id> --from 2026-10-01 --to 2026-10-15 --filter country=DE --filter channel=\"Paid Search\" --json\\`.\n \\`from\\` / \\`to\\` are first-exposure days (project time zone): the visitors who entered the experiment then, with all their\n later conversions. Filters: country, region, city, device, os, browser, language, host, source, channel, utm_source,\n utm_medium, utm_campaign, utm_term, utm_content, landing or page (the page of the first exposure); comma-separated values,\n \\`(none)\\` matches empty. The answer carries \\`scope\\` and its verdict is computed on the slice only: say so and quote\n \\`scope.note\\`. The decision stays with the unfiltered verdict; a slice carries no \\`voice\\` (no advice).\n- One view at a time, same range and filters (\\`--json\\` adds \\`view\\`): \\`--by country|device|source|channel|page|landing|utm_campaign|…\\`\n gives \\`segments[]\\` with each variant's cells and its lift against the control inside the segment (\\`significant\\`, \\`better\\`,\n \\`small\\` = too few visitors); \\`--timeline\\` gives visitors and conversions per day and variant (a day = visitors first seen\n that day); \\`--engagement\\` gives bounce rate, pages per visit and visit length per variant from the analytics property on\n the same visitors (\\`property: null\\` = none); \\`--events\\` gives \\`rows[]\\` for every goal (the experiment's goal, metrics and\n guardrails first, \\`measured\\`) and event of these visitors, each with \\`perVariant\\` visitors and rate and \\`comparisons[]\\` against\n the control (\\`property: null\\` = goals only: other events need analytics on the same site). \\`--export --by <dimension>\\` prints\n the breakdown as CSV, \\`--export --events\\` the events table.\n- \\`npx splithub events --experiment <id> [--type exposure|goal] [--limit 50] [--before <nextBefore>]\\` lists the raw exposures\n and goals (same filters; 7 days, 30 on Pro). Use it to check the wiring.\n- Segments and events are for hypotheses: never call a winner from one segment or one event. With several segments, one will look great by chance.\n A self-hosted endpoint answers none of these (\\`NOT_CLOUD\\`); its results stay raw counts.\n\n## Finish, and what to do when an experiment is finished\n\n\\`npx splithub finish <id>\\` stops the experiment (live within a minute in cloud mode). A finished experiment keeps its numbers for as long\nas it stays in the config; the code still contains every variant until someone removes it.\n\nWhenever you see an experiment with \\`status: finished\\` (in \\`status\\`, \\`results\\`, the MCP tools, or right after you finished it):\n1. Read \\`npx splithub results <id> --json\\` and tell the user the verdict in one line with its numbers.\n2. Ask two questions, do not assume: **which variant to keep** (recommend \\`verdict.winner\\`; with no significant\n difference, the control or the simpler one) and **whether to remove the experiment from the code now**.\n3. On yes, follow the \\`splithub-ship\\` skill: \\`npx splithub ship <id> --keep <variant> --dry-run\\`, show the diff, then run it\n without \\`--dry-run\\`; fix the \\`leftovers\\`, \\`push\\` in cloud mode, run \\`doctor\\` and the project's checks.\n4. On no, leave everything: a finished experiment costs nothing and the user may come back to it.\n\nA \\`paused\\` experiment is not over: say so and ask whether to resume (\\`start\\`) or finish it.\n\n## Around experiments (sh2 Cloud)\n\n- **Notes**: what happened on a day, marked on experiment timelines and analytics charts. \\`npx splithub notes add \"Launched the\n new pricing page\" [--kind note|issue|win] [--experiment <key> | --property <id>] [--day 2026-10-05]\\` (none = the whole\n project); \\`notes\\` lists them (\\`--experiment\\`, \\`--property\\`, \\`--kind\\`, \\`--days\\`), \\`notes edit <id> \"<text>\"\\`, \\`notes delete <id>\\`.\n Add one when you ship something that may move the numbers.\n- **Alerts** (they fire on Pro; added on another plan they are saved switched off): \\`npx splithub alerts\\` lists rules, progress\n and recent alerts; \\`alerts add <condition>\\`: experiments \\`srm\\`, \\`winner\\`, \\`loser --lift 10\\`, \\`exposures --visitors N\\`,\n \\`conversions --conversions N\\`, \\`duration --days N\\`, \\`no_events --hours 24\\` (\\`--experiment <key>\\`, else every running one;\n \\`--pause\\`, \\`--finish\\`, \\`--drop-loser\\` act on it); account \\`quota --percent 80\\`, \\`usage --every 1000\\` (each time this month's\n events cross another 1,000); analytics \\`traffic_drop|traffic_spike --property <id> --percent 50\\`, \\`goal_silent --property <id>\n --goal <key> --hours 24\\`, \\`event_count --property <id> [--event <name>] --count 500 [--repeat]\\`. \\`alerts enable|disable|delete|test <id>\\`\n (\\`test\\` = what would fire now, nothing sent). Channels (email, Slack, Discord, webhook) are set in the dashboard.\n- **Short links**: \\`npx splithub links create https://example.com/spring [--slug spring] [--name \"Spring\"]\\`; several URLs with\n \\`--weights 70,30\\` split visitors between pages. \\`links\\` lists them with clicks, \\`links <slug>\\` shows one link's clicks,\n \\`links pause|resume|delete <slug>\\`.\n- **Allowed domains**: \\`npx splithub domains set experiment <key> example.com\\` (subdomains included), \\`domains clear experiment <key>\\`,\n \\`domains\\` lists them. No list = any origin.\n\n## Do not\n\n- Nest an \\`<Experiment>\\` inside a \\`<Variant>\\` of the same id; call hooks conditionally.\n- Change \\`seed\\`, weights or variants of a running experiment (reshuffles visitors). Create a new experiment instead.\n- Edit in the dashboard what the config file owns: file experiments are read-only there (pause/finish still work).\n- Run more than 2-3 experiments on one page of a low-traffic site.\n- Put secrets, API keys or database credentials in the config or in the browser. \\`pk_\\` is public, \\`sk_\\` is not.\n`;\n\nexport const SKILL_AB_TESTING = `---\nname: ab-testing\ndescription: How to design, run and read an experiment correctly: hypothesis, control, primary metric, sample size, significance, SRM, peeking, when to stop. Use before creating an experiment or when interpreting results, with any tool.\n---\n\n# A/B testing, the parts that matter\n\nAn experiment splits visitors at random into variants and compares one metric. It answers one question:\n\"does this change move this metric?\" Everything below exists to keep that answer honest.\n\n## Before creating an experiment\n\n1. **One hypothesis, one primary metric.** \"A shorter signup form raises signup completion.\" The metric is a goal\n (event, page visit or click) that happens after the exposure. Pick it before looking at data.\n2. **Control first.** The first variant is what exists today. Change one thing per variant; several unrelated changes\n in one variant cannot be attributed.\n3. **Traffic reality.** Rough rule: to detect a relative lift L on a baseline rate p you need about\n \\`16 · p(1-p) / (p·L)²\\` visitors per variant (95% confidence, 80% power).\n Examples: baseline 5%, lift 20% → ~7,600 per variant; baseline 2%, lift 10% → ~78,000 per variant.\n If the site cannot reach that in 2-4 weeks, try a bigger change or a higher-traffic page.\n4. **Few experiments per page.** Interactions between simultaneous experiments on the same page muddy both.\n\n## While it runs\n\n- **Do not peek and stop early.** Checking daily and stopping at the first \"significant\" moment inflates false\n positives several times. Decide the sample or the duration up front; run whole weeks (weekday/weekend cycles).\n- **SRM (sample ratio mismatch).** If the split is 50/50 and you see 60/40, the assignment or the tracking is broken\n (bots, caching, redirect loops, a variant that errors). Fix first; results from an SRM run are meaningless.\n- **Keep variants frozen.** Changing copy, weights or targeting mid-run reshuffles who saw what. Start a new experiment.\n- **Watch the guardrails.** A variant that wins the primary metric but breaks revenue, errors or latency is not a win.\n\n## Reading results\n\n- Significance (p < 0.05 after correction for several variants) says the difference is unlikely to be noise;\n the confidence interval says how big it plausibly is. A \"winner\" with a CI that touches 0 is a weak win.\n- \"No significant difference\" with a sample smaller than needed means **keep running**, not \"no effect\".\n With enough sample it means the change does not matter: ship whichever is cheaper or cleaner.\n- Relative lift is on the baseline rate: 5% → 6% is +20% relative, +1 point absolute. Report both.\n- Attribution: conversions count only after the visitor's first exposure, per unique visitor.\n- Segments (country, device) are for hypotheses, not verdicts: slicing after the fact finds noise.\n\n## When to stop\n\n- Winner found with the planned sample → ship it, finish the experiment, remove the losing code.\n- Planned sample reached, no difference → ship the simpler variant, finish.\n- SRM or broken tracking → stop, fix, restart as a new experiment.\n- The business moved on → finish; do not leave experiments running forever (they cost events and split traffic).\n\n## Vocabulary\n\nexposure = a visitor saw a variant · conversion = the goal happened after exposure · lift = relative change in rate ·\np-value = chance of seeing this difference by luck · CI = range the true difference likely lies in ·\nSRM = the split differs from the configured weights · guardrail = a metric that must not get worse.\n`;\n\nexport const SKILL_SPLITHUB_API = `---\nname: splithub-api\ndescription: Use the sh2 Cloud HTTP API directly: public key event ingest, API-key endpoints for config, status, results, overrides, analytics reports, notes, short links and alert rules. Use when writing a server, a script, a non-JS client, or when the CLI is not available.\n---\n\n# sh2 Cloud API\n\nBase URL: \\`https://go.sh2.uk\\`. JSON in, JSON out (no envelope under \\`/v1/*\\`). Two credentials:\n\n- **Public key \\`pk_…\\`**: identifies the project to browsers and SDKs. Safe to ship. Can only send events and read\n the public overrides JSON.\n- **API key \\`sk_…\\`**: project-scoped secret for servers, CI and the CLI (\\`npx splithub login\\` mints one through a\n browser approval; or Settings → API keys in the dashboard). Never in client code. It can be limited to some areas:\n see API keys and scopes below.\n\n## Send events (public key)\n\n\\`\\`\\`http\nPOST /v1/events\nAuthorization: Bearer pk_live_…\nContent-Type: application/json\n\n{ \"project\": \"my-app\", \"sdk\": \"custom/1.0\", \"events\": [\n { \"id\": \"e_01h…\", \"type\": \"exposure\", \"exp\": \"hero-cta\", \"var\": \"bold\", \"vid\": \"v_abc\", \"sid\": \"s_1\", \"ts\": 1760000000000, \"url\": \"/\" },\n { \"id\": \"g_01h…\", \"type\": \"goal\", \"goal\": \"signup\", \"vid\": \"v_abc\", \"sid\": \"s_1\", \"ts\": 1760000010000, \"props\": { \"revenue\": 49 } }\n] }\n\\`\\`\\`\n\n- Analytics properties take two more types: \\`{ \"type\": \"page\", \"prop\": \"site\", \"url\": \"/pricing\", \"title\"?, \"ref\"?, … }\\`\n (\\`ref\\` = document.referrer) and \\`{ \"type\": \"event\", \"prop\": \"site\", \"name\": \"Video Played\", \"props\"?: { … }, … }\\`.\n Both are billed like one exposure each; events of a property that is paused or unknown are dropped.\n An \\`event\\` row also converts the experiments whose goal is that event, and a \\`page\\` row the page-visit goals its path\n matches (not billed again): send one row per action, not a goal row next to it (one within 1 s is counted once).\n \\`{ \"type\": \"identify\", \"prop\": \"site\", \"uid\": \"user_42\", \"traits\"?: { \"plan\": \"pro\" }, … }\\` ties the visitor to your user\n (not billed). Requests from bots are dropped.\n- \\`id\\`: unique per event (8-64 chars, [a-z0-9_-]); duplicates are ignored. \\`vid\\`: stable visitor id (cookie \\`sh_vid\\`).\n- Reply \\`202 { ok, received, inserted, dropped }\\`. A project with nothing running or no config yet answers\n \\`202 { ok, inserted: 0, idle: 'no_running' | 'no_config' }\\`: nothing stored, not an error. \\`429\\` with \\`code\\` ∈\n quota_exceeded | deleted: back off for \\`Retry-After\\` seconds; nothing was stored. Allowed domains are set per experiment and per\n property: events from another origin are dropped, and \\`403 origin_not_allowed\\` comes back when nothing in the batch was allowed.\n- Exposures for experiments that are not running are dropped and not billed. Goals are never billed.\n\n## API keys and scopes\n\nA key can do everything (\\`*\\`, the default) or only some areas, each with read or write (write includes read).\nPick them in Settings → API keys when creating the key.\n\n| Area | Covers |\n|---|---|\n| \\`experiments\\` | status, results, report, config push, overrides, archive, reviews |\n| \\`analytics\\` | properties, their reports, segments, the event catalog |\n| \\`events\\` | read: raw events and \\`export.csv?raw=1\\`; write: send events from your server with this key |\n| \\`notes\\`, \\`links\\`, \\`alerts\\`, \\`domains\\` | those endpoints |\n\nScope strings: \\`<area>:read\\` / \\`<area>:write\\` (e.g. \\`notes:write\\`, \\`analytics:read\\`), \\`read\\` / \\`write\\` for every area,\n\\`*\\` for everything. Keys made before scopes existed have \\`*\\`.\n\nServer-side sending: a key with \\`events:write\\` can post to \\`POST /v1/events\\` instead of the public key. It is trusted,\nso there is no origin check; keep it on the server.\n\n\\`\\`\\`bash\ncurl -X POST https://go.sh2.uk/v1/events \\\\\n -H \"Authorization: Bearer $SPLITHUB_API_KEY\" -H \"Content-Type: application/json\" \\\\\n -d '{ \"sdk\": \"server/1.0\", \"events\": [\n { \"id\": \"g_order_1042\", \"type\": \"goal\", \"goal\": \"purchase\", \"vid\": \"v_abc\", \"ts\": 1760000010000, \"props\": { \"revenue\": 49 } },\n { \"id\": \"e_order_1042\", \"type\": \"event\", \"prop\": \"site\", \"name\": \"Order Paid\", \"vid\": \"v_abc\", \"ts\": 1760000010000 }\n ] }'\n\\`\\`\\`\n\n\\`vid\\` is the visitor's \\`sh_vid\\` cookie, so the goal lands on the variant they saw. A request the key may not make\nanswers \\`403 { code: 'insufficient_scope', scope: 'notes:write', error, hint }\\`: \\`scope\\` names the missing one, and the CLI\nshows it (\\`--json\\` adds \\`scope\\`). Ask the user for a key with that scope; don't retry with another key.\n\n## Live config for clients (public key)\n\n\\`GET /v1/overrides/<pk>.json\\` (apps add \\`?all=1\\`: \\`added\\` then also carries the pushed experiments) → \\`{ version, experiments: { <id>: { status?, traffic?, weights?, values? } }, added: [ …hosted experiments… ], goals: [...], ctx: { country, region, city } }\\`.\nPoll it at most once a minute; the SDK caches it in localStorage. \\`ctx\\` is the visitor's geo for targeting.\n\n## Project endpoints (API key)\n\n\\`\\`\\`http\nGET /v1/status every experiment: status, visitors, days, verdict headline\nGET /v1/results/<experiment> full verdict: sample, comparisons (lift, p-value, CI, P(beat)), srm, winner\n ?from=&to= (first-exposure days) &country=DE&channel=…: the verdict on that slice, with scope { filtered, range, filters, note }\nGET /v1/experiments/<experiment>/timeline ?from=&to=&<filters>: exposures[] and conversions[] per day and variant, notes\nGET /v1/experiments/<experiment>/breakdown/<by> by country|region|city|device|os|platform|app_version|browser|language|host|page (= url)|referrer|source|channel|landing|utm_*:\n order[], segments[] { dim, cells, comparisons { lift, pValue, significant, better }, total, small }\nGET /v1/experiments/<experiment>/engagement { property, variants[] { visitors, sessions, pagesPerVisit, bounceRate, avgVisit } } (&property=)\nGET /v1/experiments/<experiment>/events-summary { property, variants[], visitors, rows[] { name, goalKey, isGoal, measured, perVariant, comparisons, small } } (&property=)\nGET /v1/experiments/<experiment>/export.breakdown.csv?by= the breakdown as CSV, lift per segment\nGET /v1/experiments/<experiment>/export.events-summary.csv the events table as CSV, lift per event\nGET /v1/experiments/<experiment>/events ?type=exposure|goal&before=&limit=&<filters>: raw events, nextBefore (needs events:read)\nGET /v1/config the config stored in the cloud (file + dashboard experiments)\nPUT /v1/config { config, prune? } push a normalized config (what defineConfig returns); answers cloudOnly experiments to adopt and kept ones (from an earlier push, missing from this one; prune: true removes them)\nGET /v1/overrides live overrides\nPUT /v1/overrides/<experiment> { status | traffic | weights | values } pause / resume / reweight without a deploy\nDELETE /v1/overrides/<experiment>\nGET /v1/properties analytics properties: live status, goals, domains, last 30 days\nPOST /v1/properties { key, name?, goals?, domains? } create one (dashboard-owned)\nPATCH /v1/properties/<key> { status: running | paused, name?, goals? }\nGET /v1/properties/<key>/summary ?from=&to= (YYYY-MM-DD) &<dimension>=a,b[&compare=previous|year|custom&cfrom=&cto=]: totals, days, goals, notes\nGET /v1/properties/<key>/breakdown ?by=source|channel|page|event|goal|country|…&goal=[&compare=…]: rows\nGET /v1/properties/<key>/funnel ?steps=page:/,event:Signup,goal:paid&within=visit|7d|30d[&by=]: steps with visitors, conversion, dropoff\n ?funnel=<id> runs a saved funnel (its steps and within)\nGET|POST /v1/properties/<key>/funnels { name, steps[], within? } PATCH|DELETE /v1/properties/<key>/funnels/<id>\nGET /v1/properties/<key>/paths ?page=/pricing&direction=next|prev: rows { value, visits }\nGET /v1/properties/<key>/retention ?start=visit|event:<n>|goal:<k>&return=visit|event:<n>&period=day|week&from=&to=: { period, cohorts[] { start, users, retained[] } }\nGET /v1/properties/<key>/realtime | /events?type=page|event | /props?name=&key= | /export.csv?by=|day (&raw=1)\nGET|POST /v1/segments { name, filters, propertyKey? } PATCH|DELETE /v1/segments/<id>\nGET /v1/domains every allowed domain and where it applies, observed origins\nPUT /v1/domains/<experiment|property>/<key> { hosts: [...] } replace one list ([] = any origin)\nGET /v1/notes ?experiment=&property=&kind=&from=&to=[&exact=1] newest first; experiment / property also return project-wide notes unless exact=1\nPOST /v1/notes { text (≤ 2000), day? (default today, project time zone), kind?: note|issue|win, experimentKey? | propertyKey? (none = whole project) }\nPATCH|DELETE /v1/notes/<id> { text?, day?, kind? }\nGET /v1/links short links: shortUrl, destinations [{ id, url, weight }], status, totalClicks\nPOST /v1/links { name, destinations: [{ url, weight? }], shortCode?, description?, clickLimit? }\nPATCH|DELETE /v1/links/<id> { name?, shortCode?, status: active|paused, destinations?, description? } GET /v1/links/<id>/stats: byDay (30 days), byDestination, byCountry, byDevice, byReferrer\nGET /v1/alerts rules, channels, digest, history, conditions, plan\nPOST /v1/alerts/rules { condition, params, actions?: { notify, pause, finish, dropLoser }, name?, experiment?, enabled?, cooldownHours? }\nPATCH|DELETE /v1/alerts/rules/<id> POST /v1/alerts/rules/<id>/test (dry run: what would fire now)\n\\`\\`\\`\n\nAlert conditions and params: experiments \\`srm\\`, \\`winner\\` { minVisitors? }, \\`loser\\` { lift, minVisitors? }, \\`exposures\\` { visitors },\n\\`conversions\\` { conversions }, \\`duration\\` { days }, \\`no_events\\` { hours }; account \\`quota\\` { percent }, \\`usage\\` { every } (each time this\nmonth's billed events cross another multiple); analytics \\`traffic_drop\\` / \\`traffic_spike\\` { property, percent }, \\`goal_silent\\`\n{ property, goal, hours }, \\`event_count\\` { property, event? (any event when absent), count, repeat? }. \\`params.progress\\` { total, fired,\nmonth? } is read-only. Enabled rules need Pro: \\`402 pro_required\\` otherwise (save it with \\`enabled: false\\`).\n\n\\`Authorization: Bearer sk_live_…\\` on each. Status values: draft | running | paused | finished.\n\n## Dashboard-scope endpoints (session, same shapes the dashboard uses)\n\nUnder \\`/v1/projects/<projectId>/…\\` with a user session: \\`experiments\\` (hosted experiments CRUD incl. \\`flow\\` targeting),\n\\`goals\\`, \\`timeline\\`, \\`breakdown\\`, \\`realtime\\`, \\`events\\`, \\`export\\`, \\`notes\\`, \\`domains\\`, \\`properties\\`, \\`links\\`, \\`alerts\\`, \\`billing\\`, \\`ai\\`.\nScripts should prefer the API-key endpoints above; the session ones exist for the UI.\n\n## Drop-in script (no SDK)\n\n\\`<script src=\"https://go.sh2.uk/sh.js\" data-key=\"pk_live_…\"></script>\\` in \\`<head>\\`: redirect experiments, page-visit and\nclick goals from the cloud config, \\`window.splithub.track(name, props)\\` for every event (goals included), pageviews\nfor analytics properties (\\`data-property=\"site\"\\`). An app with the SDK does not need it: one install per property,\nor only the first of the two collects pageviews.\n\\`<meta name=\"splithub-experiment\" content=\"<id>\">\\` on a tested page for an instant decision.\n\n## Errors\n\n\\`400\\` validation (message in \\`error\\`), \\`401\\` bad key, \\`403\\` forbidden (\\`insufficient_scope\\` names the missing \\`scope\\`), \\`404\\` unknown experiment/project, \\`409\\` state\n(e.g. \\`config_not_pushed\\`, \\`file_owned\\`), \\`429\\` gate or rate limit. Bodies: \\`{ error, code?, hint? }\\`, auth errors included; \\`hint\\` is the next step.\n`;\n\nexport const SKILL_SPLITHUB_MCP = `---\nname: splithub-mcp\ndescription: Use or set up the sh2 MCP server (@splithub/mcp) so an agent can create experiments, read verdicts, start/pause/finish experiments and push config through tools instead of shelling out, plus analytics, notes, alerts and short links. Use when the user asks to connect sh2 to Claude Code, Cursor, Codex or another MCP client.\n---\n\n# sh2 MCP server\n\n\\`@splithub/mcp\\` is a stdio MCP server that wraps the \\`splithub\\` CLI for the current project folder.\nSame credentials and config file as the CLI; nothing extra to configure.\n\n## Register it\n\nClaude Code (project scope, committed in \\`.mcp.json\\`):\n\n\\`\\`\\`json\n{ \"mcpServers\": { \"splithub\": { \"command\": \"npx\", \"args\": [\"-y\", \"@splithub/mcp\"] } } }\n\\`\\`\\`\n\nor \\`claude mcp add splithub -- npx -y @splithub/mcp\\`. Cursor: the same object in \\`.cursor/mcp.json\\`.\nCodex / other clients: command \\`npx\\`, args \\`-y @splithub/mcp\\`. \\`npx splithub skills --mcp\\` writes both files.\nEnv: \\`SPLITHUB_PROJECT_DIR\\` (defaults to the MCP client's working directory), \\`SPLITHUB_API\\` (staging or self-hosted cloud), \\`SPLITHUB_API_KEY\\` (CI).\n\n## Tools\n\n| tool | does | notes |\n|---|---|---|\n| \\`splithub_status\\` | all experiments with verdict headline | start here |\n| \\`splithub_results\\` | full verdict for one experiment; from / to / filters for a slice, by / timeline / engagement / events for one view (cloud) | report \\`verdict.message\\` verbatim; \\`daysToVerdict\\` = when to check again; a slice's verdict is not the experiment's |\n| \\`splithub_experiment_events\\` | the latest raw exposures and goals of an experiment (cloud) | check the wiring |\n| \\`splithub_review\\` | stored AI reviews (Pro): at start, on verdict changes, on finish, on demand | quote them as the analyst's opinion, the verdict stays the source of truth |\n| \\`splithub_plan\\` | visitors per variant for a baseline and a lift; days at an experiment's traffic | before creating |\n| \\`splithub_experiment_create\\` | adds an experiment to splithub.config.ts | kind value / component / redirect / mvt, id, variants (or factors for mvt), goal, values/to, weights, traffic, maxVisitors, start/end; running by default |\n| \\`splithub_refs\\` | files and lines that use an experiment and its goal | check the wiring, find leftovers |\n| \\`splithub_ship\\` | finish, remove from the config, rewrite the code to the kept variant | \\`dryRun: true\\` first; returns \\`diff\\` and \\`leftovers\\` |\n| \\`splithub_remove\\` | removes an experiment from the config (archived in the cloud) | when the code is already clean |\n| \\`splithub_projects\\` | every folder on this machine connected to a cloud project | |\n| \\`splithub_init\\` | sets up the config, framework files and skills | once per project |\n| \\`splithub_experiment_status\\` | start / pause / finish | applies live in cloud mode; after \\`finished\\`, ask which variant to keep and whether to clean the code (splithub-ship skill) |\n| \\`splithub_push\\` / \\`splithub_pull\\` | sync the config with the cloud | pull adopts dashboard-created experiments |\n| \\`splithub_doctor\\` | checks the installation | run after wiring code |\n| \\`splithub_login\\` | returns a sign-in link; the human approves it in the browser | show the link, then call \\`splithub_whoami\\` |\n| \\`splithub_whoami\\` | connected project and keys | |\n| \\`splithub_analytics\\` | analytics properties; one property's totals, goals, top pages and sources; \\`by\\` a dimension | counts, never verdicts |\n| \\`splithub_analytics_events\\` | the latest raw pageviews and events of a property | check tracking after wiring it |\n| \\`splithub_analytics_funnel\\` / \\`_funnels\\` / \\`_paths\\` / \\`_retention\\` / \\`_realtime\\` | funnels (run, save, list), next pages, cohorts, visitors now (cloud) | counts, never verdicts |\n| \\`splithub_analytics_connect\\` | picks or creates a property and names it on the app's provider | \\`wired.status\\` none / many: add the snippet yourself |\n| \\`splithub_segments\\` | saved report filters (cloud) | |\n| \\`splithub_notes\\` | what happened on a day, per experiment, property or project: list / add / edit / delete (cloud) | add one when you ship |\n| \\`splithub_alerts\\` | alert rules: list / add / enable / disable / delete / test (cloud, fire on Pro) | conditions in the splithub skill |\n| \\`splithub_links\\` | short links: list / stats / create / edit / pause / resume / delete (cloud) | several URLs split by weight |\n| \\`splithub_property_create\\` | adds an analytics property to splithub.config.ts and to the cloud | no push needed |\n| \\`splithub_property_status\\` | pause / resume, archive / restore (cloud) or remove a property | live in cloud mode |\n| \\`splithub_domains\\` | allowed domains per experiment and property; set or clear one list | empty = any origin |\n\nOld names still answer for one release: \\`splithub_create_experiment\\`, \\`splithub_set_status\\`, \\`splithub_create_property\\`,\n\\`splithub_set_property_status\\`. Use the names above.\n\n## Working rules\n\n- Create (running by default) → wire in code → \\`doctor\\` → \\`push\\` (cloud mode) → tell the user it goes live when they\n deploy this code and that \\`set_status paused\\` or Pause in the dashboard holds it.\n- Results: never call a winner from raw rates; quote the verdict. \\`srm_detected\\` = fix the setup first.\n- Running experiments are frozen: no weight / variant / seed edits; create a new one.\n- Errors carry a \\`code\\`. \\`NOT_LOGGED_IN\\`: call \\`splithub_login\\`, show the link to the user, wait for them, then retry.\n- The whole loop (plan → create → implement → doctor → push → results → finish → ship) is in the \\`splithub-loop\\` skill.\n- A \\`finished\\` experiment in \\`splithub_status\\` or \\`splithub_results\\` means the experiment is over but its code is still there: report\n the verdict, ask which variant to keep and whether to remove the experiment from the code, then follow the \\`splithub-ship\\` skill.\n`;\n\nexport { SKILL_SELF_HOSTED } from './skills-self-hosted';\nimport { SKILL_SELF_HOSTED } from './skills-self-hosted';\nexport { SKILL_LOOP, SKILL_SHIP } from './skills-ship';\nimport { SKILL_LOOP, SKILL_SHIP } from './skills-ship';\nexport { SKILL_ANALYTICS } from './skills-analytics';\nimport { SKILL_ANALYTICS } from './skills-analytics';\nexport { SKILL_APPS } from './skills-apps';\nimport { SKILL_APPS } from './skills-apps';\n\nexport const SKILLS: Skill[] = [\n { dir: 'splithub', body: SKILL_SPLITHUB },\n { dir: 'ab-testing', body: SKILL_AB_TESTING },\n { dir: 'splithub-api', body: SKILL_SPLITHUB_API },\n { dir: 'splithub-mcp', body: SKILL_SPLITHUB_MCP },\n { dir: 'splithub-self-hosted', body: SKILL_SELF_HOSTED },\n { dir: 'splithub-ship', body: SKILL_SHIP },\n { dir: 'splithub-loop', body: SKILL_LOOP },\n { dir: 'splithub-analytics', body: SKILL_ANALYTICS },\n { dir: 'splithub-apps', body: SKILL_APPS },\n];\n\nexport const MCP_SERVER_ENTRY = { command: 'npx', args: ['-y', '@splithub/mcp'] };\n","export function configTemplate(project: string, mode: 'self' | 'cloud', key?: string, options: { app?: boolean } = {}): string {\n // An app has no origin of its own: self-hosted events go to the server's full URL, and Expo inlines EXPO_PUBLIC_* variables.\n const endpoint = options.app ? \"process.env.EXPO_PUBLIC_SPLITHUB_ENDPOINT ?? 'https://example.com/api/splithub'\" : \"'/api/splithub'\";\n const envKey = options.app ? 'EXPO_PUBLIC_SPLITHUB_KEY' : 'NEXT_PUBLIC_SPLITHUB_KEY';\n const storage = mode === 'self' ? `{ mode: 'self', endpoint: ${endpoint} }` : `{ mode: 'cloud', key: ${key ? `'${key}'` : `process.env.${envKey} ?? ''`} }`;\n const appNote = options.app\n ? `\n// In an app this file is built into the binary: a new experiment here reaches users with the next\n// store release. Create experiments in the dashboard to start them without a release.`\n : '';\n return `import { defineConfig } from '@splithub/core';\n\n// sh2 experiments. This file is the source of truth: the SDK, the CLI\n// and the dashboard all read it. Keys: lowercase a-z 0-9 - _. First variant = control.${appNote}\nexport default defineConfig({\n project: '${project}',\n storage: ${storage},\n // Drafts behave like running experiments while you develop (next dev, vite); production ignores them.\n runDraftsInDev: true,\n\n goals: {\n // events you mark as goals: call track('signup') where it happens.\n // An experiment's goal may also be any other event name you track().\n signup: { type: 'event' },\n },\n\n experiments: {\n // run \\`npx splithub create\\` or add entries here:\n //\n // 'hero-title': {\n // kind: 'value',\n // status: 'running',\n // variants: {\n // control: { weight: 50, value: 'Ship faster' },\n // direct: { weight: 50, value: 'Know which version wins' },\n // },\n // goal: 'signup',\n // },\n },\n});\n`;\n}\n\nexport function nextMiddlewareTemplate(configImport: string): string {\n return `import { splithubMiddleware } from '@splithub/next';\nimport splithub from '${configImport}';\n\n// Sets the visitor cookie, forwards it to Server Components and serves\n// redirect experiments with an invisible rewrite.\nexport default splithubMiddleware(splithub);\n\nexport const config = {\n matcher: ['/((?!_next|api|.*\\\\\\\\..*).*)'],\n};\n`;\n}\n\nexport function nextRouteTemplate(configImport: string, store: { imports: string; factory: string } = { imports: \"import { sqliteStore } from '@splithub/adapter-sqlite';\", factory: \"sqliteStore({ file: process.env.SPLITHUB_DB ?? './splithub.db' })\" }): string {\n return `import { createSplitHubHandler } from '@splithub/node';\n${store.imports}\nimport config from '${configImport}';\n\n// Self-hosted ingest + results: events stay in your database. The CLI reads\n// status / results from this route; set SPLITHUB_ADMIN_TOKEN to protect it.\nconst handler = createSplitHubHandler({\n config,\n store: ${store.factory},\n adminToken: process.env.SPLITHUB_ADMIN_TOKEN,\n});\n\nexport const POST = handler;\nexport const GET = handler;\nexport const runtime = 'nodejs';\n`;\n}\n\nexport function componentVariantTemplate(name: string, experiment: string, variant: string): string {\n return `// Variant \"${variant}\" of experiment \"${experiment}\". Edit freely.\nexport function ${name}() {\n return (\n <section>\n <h2>${experiment} · ${variant}</h2>\n </section>\n );\n}\n`;\n}\n\nexport const AGENTS_SECTION = `\n## A/B testing (sh2)\n\nThis project uses sh2 (\\`@splithub/react\\`). Experiments are declared in\n\\`splithub.config.ts\\` and rendered with \\`<Experiment id>\\` / \\`useVariant(id)\\` /\n\\`useValue(id)\\`. Events: \\`useTrack()\\` then \\`track('<event name>')\\`; an experiment's goal is any event name.\n\n- Not connected yet? \\`npx splithub init --mode cloud\\` (or \\`npx splithub login\\`) prints a link: show it to the user, they sign in and approve, the CLI gets the keys. Never ask the user to paste keys.\n- New experiment: \\`npx splithub create --kind value|component|redirect|mvt --id <key> --variants control,<other> --goal <event name> --yes\\`\n then wire it in code (value → \\`useValue\\`, component → \\`<Experiment>\\` with one \\`<Variant>\\` per key, redirect → nothing,\n mvt → \\`--factor name=level:value,…\\` and \\`const { a, b } = useValue(id)\\`).\n- Results: \\`npx splithub results <id> --json\\`; report \\`verdict.message\\` verbatim, never call a winner from raw rates.\n- Lifecycle: \\`npx splithub start|pause|finish <id>\\`. Check setup: \\`npx splithub doctor\\`.\n- A \\`finished\\` experiment still has all its variants in the code: report the verdict, ask which variant to keep and whether to\n remove the experiment from the code, then follow .claude/skills/splithub-ship/SKILL.md. Never delete experiment code unasked.\n- \\`create\\` writes \\`status: 'running'\\`: the experiment goes live when the code is deployed. Always tell the user that, and that\n \\`npx splithub pause <id>\\` or Pause in the dashboard holds it. Never change \\`seed\\` of a running experiment.\n- Analytics: set it up with \\`npx splithub analytics connect --json\\` (names the property on the provider), read it with\n \\`npx splithub analytics <property> --json\\`; also \\`funnel\\`, \\`paths\\`, \\`retention\\`, \\`realtime\\`, \\`export\\` (sh2 Cloud).\n Details: .claude/skills/splithub-analytics/SKILL.md\n- Notes, alerts, links, domains (sh2 Cloud): \\`npx splithub notes add \"<what shipped>\"\\` when you ship, \\`npx splithub alerts\\` (rules, e.g.\n \\`alerts add usage --every 1000\\`), \\`npx splithub links\\` (short links), \\`npx splithub domains\\`. Humans: \\`npx splithub\\` opens the menu.\n- Apps (React Native / Expo / iOS / Android): new experiments start in the dashboard (the config is built into the binary);\n screens are page events. Details: .claude/skills/splithub-apps/SKILL.md\n- Config ships to the browser: no secrets in it. Full rules: .claude/skills/splithub/SKILL.md\n`;\n\nexport { SKILL_SPLITHUB as SKILL_MD } from './skills';\nimport { SKILL_SPLITHUB } from './skills';\n\nexport const CURSOR_RULE = `---\ndescription: sh2 A/B testing conventions\nglobs: [\"splithub.config.ts\", \"splithub/**\", \"**/*.tsx\"]\nalwaysApply: false\n---\n${SKILL_SPLITHUB.replace(/^---[\\s\\S]*?---\\n/, '')}`;\n"],"mappings":";;;AAEO,IAAM,oBAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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
|
|
6
6
|
import {
|
|
7
7
|
c,
|
|
8
8
|
fail,
|
|
@@ -46,4 +46,4 @@ ${c.bold("Seen sending events")}`);
|
|
|
46
46
|
export {
|
|
47
47
|
domains
|
|
48
48
|
};
|
|
49
|
-
//# sourceMappingURL=chunk-
|
|
49
|
+
//# sourceMappingURL=chunk-BLEJ5DOY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/domains.ts"],"sourcesContent":["// splithub domains — which origins may send events, per test and per analytics property.\n//\n// splithub domains every allowed domain and where it applies\n// splithub domains set test <id> example.com [...] replace a test's list\n// splithub domains set property <id> example.com replace a property's list\n// splithub domains clear test|property <id> accept any origin again\n//\n// A test or property without domains accepts events from anywhere. sh2 Cloud only.\n\nimport { request, requireCloudToken } from '../api';\nimport { fail, printJson } from '../errors';\nimport { c, table } from '../ui';\nimport type { Flags } from './init';\n\ninterface DomainsData {\n entries: Array<{ kind: 'experiment' | 'property'; key: string; host: string }>;\n entities: Array<{ kind: 'experiment' | 'property'; key: string; name: string | null; status: string }>;\n observed: Array<{ host: string; events: number; lastSeen: number; allowedIn: Array<{ kind: string; key: string }> }>;\n}\n\nconst KINDS: Record<string, 'experiment' | 'property'> = { test: 'experiment', experiment: 'experiment', property: 'property' };\nconst label = (kind: string) => (kind === 'experiment' ? 'experiment' : 'property');\n\nexport async function domains(args: string[], flags: Flags): Promise<void> {\n const target = requireCloudToken(flags);\n const [action, kindArg, key, ...hosts] = args;\n if (!action) {\n const data = await request<DomainsData>(target, '/domains');\n if (flags.json) return printJson(data);\n const byHost = new Map<string, string[]>();\n for (const e of data.entries) byHost.set(e.host, [...(byHost.get(e.host) ?? []), `${label(e.kind)} ${e.key}`]);\n if (byHost.size === 0) console.log(c.dim('No experiment or property limits its origins: events are accepted from anywhere.'));\n else console.log(table(['DOMAIN', 'ALLOWED FOR'], [...byHost].map(([host, where]) => [c.bold(host), where.join(', ')])));\n const open = data.entities.filter((e) => !data.entries.some((x) => x.kind === e.kind && x.key === e.key));\n if (open.length && byHost.size) console.log(`\\n${c.dim(`Any origin: ${open.map((e) => `${label(e.kind)} ${e.key}`).join(', ')}`)}`);\n if (data.observed.length) {\n console.log(`\\n${c.bold('Seen sending events')}`);\n console.log(table(['ORIGIN', 'EVENTS', 'ALLOWED FOR'], data.observed.slice(0, 15).map((o) => [o.host, o.events.toLocaleString('en-US'), o.allowedIn.length ? o.allowedIn.map((a) => `${label(a.kind)} ${a.key}`).join(', ') : c.dim('–')])));\n }\n return;\n }\n if (action !== 'set' && action !== 'clear') fail('USAGE', `Unknown action \"${action}\". Use npx splithub domains set experiment <id> <domain...> or domains clear experiment <id>.`);\n const kind = KINDS[kindArg ?? ''];\n if (!kind || !key) fail('USAGE', `npx splithub domains ${action} experiment|property <id>${action === 'set' ? ' <domain...>' : ''}`);\n if (action === 'set' && hosts.length === 0) fail('USAGE', 'Which domains? npx splithub domains set experiment <id> example.com app.example.com (subdomains are included).');\n const out = await request<{ kind: string; key: string; hosts: string[] }>(target, `/domains/${kind}/${encodeURIComponent(key)}`, { method: 'PUT', body: JSON.stringify({ hosts: action === 'clear' ? [] : hosts }) });\n if (flags.json) return printJson(out);\n if (out.hosts.length === 0) console.log(`${c.green('✔')} ${label(kind)} ${c.bold(key)} accepts events from any origin`);\n else console.log(`${c.green('✔')} ${label(kind)} ${c.bold(key)} accepts events from ${out.hosts.join(', ')} ${c.dim('(and their subdomains; live within 60s)')}`);\n}\n"],"mappings":";;;;;;;;;;;;;AAoBA,IAAM,QAAmD,EAAE,MAAM,cAAc,YAAY,cAAc,UAAU,WAAW;AAC9H,IAAM,QAAQ,CAAC,SAAkB,SAAS,eAAe,eAAe;AAExE,eAAsB,QAAQ,MAAgB,OAA6B;AACzE,QAAM,SAAS,kBAAkB,KAAK;AACtC,QAAM,CAAC,QAAQ,SAAS,KAAK,GAAG,KAAK,IAAI;AACzC,MAAI,CAAC,QAAQ;AACX,UAAM,OAAO,MAAM,QAAqB,QAAQ,UAAU;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AI,QAAG,CAAC,CAAC,CAAC,CAAC;AAAA,IAC7O;AACA;AAAA,EACF;AACA,MAAI,WAAW,SAAS,WAAW,QAAS,MAAK,SAAS,mBAAmB,MAAM,+FAA+F;AAClL,QAAM,OAAO,MAAM,WAAW,EAAE;AAChC,MAAI,CAAC,QAAQ,CAAC,IAAK,MAAK,SAAS,wBAAwB,MAAM,4BAA4B,WAAW,QAAQ,iBAAiB,EAAE,EAAE;AACnI,MAAI,WAAW,SAAS,MAAM,WAAW,EAAG,MAAK,SAAS,gHAAgH;AAC1K,QAAM,MAAM,MAAM,QAAwD,QAAQ,YAAY,IAAI,IAAI,mBAAmB,GAAG,CAAC,IAAI,EAAE,QAAQ,OAAO,MAAM,KAAK,UAAU,EAAE,OAAO,WAAW,UAAU,CAAC,IAAI,MAAM,CAAC,EAAE,CAAC;AACpN,MAAI,MAAM,KAAM,QAAO,UAAU,GAAG;AACpC,MAAI,IAAI,MAAM,WAAW,EAAG,SAAQ,IAAI,GAAG,EAAE,MAAM,QAAG,CAAC,IAAI,MAAM,IAAI,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,iCAAiC;AAAA,MACjH,SAAQ,IAAI,GAAG,EAAE,MAAM,QAAG,CAAC,IAAI,MAAM,IAAI,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,wBAAwB,IAAI,MAAM,KAAK,IAAI,CAAC,IAAI,EAAE,IAAI,yCAAyC,CAAC,EAAE;AAClK;","names":[]}
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
CURSOR_RULE,
|
|
5
5
|
MCP_SERVER_ENTRY,
|
|
6
6
|
SKILLS
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-BDCKWKJB.js";
|
|
8
8
|
import {
|
|
9
9
|
detectProject
|
|
10
10
|
} from "./chunk-6K3MHBT7.js";
|
|
11
11
|
import {
|
|
12
12
|
fetchSkills
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-H5GMGCOT.js";
|
|
14
14
|
import {
|
|
15
15
|
c
|
|
16
16
|
} from "./chunk-ZISCJRR5.js";
|
|
@@ -35,7 +35,7 @@ function writeFile(file, content, force, out) {
|
|
|
35
35
|
out.skipped.push(file);
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
|
-
if (!/SplitHub|splithub/.test(current)) {
|
|
38
|
+
if (!/SplitHub|splithub|\bsh2\b/.test(current)) {
|
|
39
39
|
out.skipped.push(file);
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
@@ -74,7 +74,7 @@ function installSkills(root, options = {}) {
|
|
|
74
74
|
writeFileSync(agentsFile, `# ${detectProject(root).name}
|
|
75
75
|
${section}`, "utf8");
|
|
76
76
|
out.written.push(agentsFile);
|
|
77
|
-
} else if (!/SplitHub/.test(readFileSync(agentsFile, "utf8"))) {
|
|
77
|
+
} else if (!/SplitHub|\bsh2\b/.test(readFileSync(agentsFile, "utf8"))) {
|
|
78
78
|
writeFileSync(agentsFile, readFileSync(agentsFile, "utf8") + `
|
|
79
79
|
${section}`, "utf8");
|
|
80
80
|
out.written.push(`${agentsFile} (section appended)`);
|
|
@@ -100,8 +100,8 @@ async function skills(flags) {
|
|
|
100
100
|
if (result.mcp.length) console.log(`${c.green("\u2714")} MCP server registered in
|
|
101
101
|
${result.mcp.map(rel).join("\n ")}`);
|
|
102
102
|
if (result.skipped.length) console.log(c.dim(`unchanged: ${result.skipped.map(rel).join(", ")}`));
|
|
103
|
-
if (result.source === "bundled") console.log(c.dim("couldn't reach
|
|
104
|
-
if (!flags.mcp) console.log(c.dim(`add --mcp to register the
|
|
103
|
+
if (result.source === "bundled") console.log(c.dim("couldn't reach sh2 Cloud, so these are the copies bundled with this CLI"));
|
|
104
|
+
if (!flags.mcp) console.log(c.dim(`add --mcp to register the sh2 MCP server (Claude Code .mcp.json, Cursor .cursor/mcp.json; Codex and Copilot read AGENTS.md)`));
|
|
105
105
|
console.log(c.dim("skills: splithub (library + CLI), ab-testing (how to run experiments well), splithub-analytics (pageviews, events, reports), splithub-api (HTTP API), splithub-mcp (MCP tools), splithub-self-hosted (your own database), splithub-ship (keep the winner, remove the experiment), splithub-loop (the whole loop, tool by tool)"));
|
|
106
106
|
}
|
|
107
107
|
|
|
@@ -111,4 +111,4 @@ export {
|
|
|
111
111
|
installSkills,
|
|
112
112
|
skills
|
|
113
113
|
};
|
|
114
|
-
//# sourceMappingURL=chunk-
|
|
114
|
+
//# sourceMappingURL=chunk-DOPSOUUT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/skills.ts"],"sourcesContent":["// `splithub skills [--mcp] [--force]`: install or refresh the agent skills in\n// this project (.claude/skills/<name>/SKILL.md, .cursor/rules/splithub.mdc,\n// an AGENTS.md section) and, with --mcp, register the sh2 MCP server in\n// .mcp.json (Claude Code) and .cursor/mcp.json (Cursor). `init` calls this too.\n// The text comes from sh2 Cloud (GET /v1/skills) so it updates with a deploy;\n// the copies bundled here are the offline fallback.\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport { dirname, join, relative } from 'node:path';\nimport { fetchSkills, type SkillFile } from '../api';\nimport { detectProject } from '../project';\nimport { AGENTS_SECTION, CURSOR_RULE } from '../templates';\nimport { MCP_SERVER_ENTRY, SKILLS } from '../skills';\nimport { c } from '../ui';\nimport type { Flags } from './init';\n\nexport interface SkillsResult {\n written: string[];\n skipped: string[];\n mcp: string[];\n /** Where the text came from: sh2 Cloud, or the copies bundled with the CLI. */\n source: 'cloud' | 'bundled';\n}\n\n/** The copies shipped with this CLI, in the shape GET /v1/skills serves. */\nexport const BUNDLED_SKILL_FILES: SkillFile[] = [\n ...SKILLS.map((s) => ({ path: `.claude/skills/${s.dir}/SKILL.md`, body: s.body })),\n { path: '.cursor/rules/splithub.mdc', body: CURSOR_RULE },\n { path: 'AGENTS.md', body: AGENTS_SECTION },\n];\n\n/** Only where skills belong: a server answer never writes anywhere else in the project. */\nconst SAFE_PATH = /^(\\.claude\\/skills\\/[a-z0-9][a-z0-9-]*\\/SKILL\\.md|\\.cursor\\/rules\\/[a-z0-9][a-z0-9-]*\\.mdc|AGENTS\\.md)$/;\n\n/** Fresh text from sh2 Cloud (1.5 s at most), else the bundled copies. */\nexport async function loadSkillFiles(flags: Record<string, unknown> = {}): Promise<{ files: SkillFile[]; source: 'cloud' | 'bundled' }> {\n const remote = (await fetchSkills(flags))?.filter((f) => SAFE_PATH.test(f.path));\n return remote?.length ? { files: remote, source: 'cloud' } : { files: BUNDLED_SKILL_FILES, source: 'bundled' };\n}\n\nfunction writeFile(file: string, content: string, force: boolean, out: SkillsResult): void {\n if (existsSync(file) && !force) {\n const current = readFileSync(file, 'utf8');\n if (current === content) {\n out.skipped.push(file);\n return;\n }\n // Skills we wrote earlier get refreshed; a user-edited file is left alone unless --force.\n if (!/SplitHub|splithub|\\bsh2\\b/.test(current)) {\n out.skipped.push(file);\n return;\n }\n }\n mkdirSync(dirname(file), { recursive: true });\n writeFileSync(file, content, 'utf8');\n out.written.push(file);\n}\n\n/** Merge our server into an MCP config file ({ mcpServers: {...} }) without touching other entries. */\nfunction registerMcp(file: string, out: SkillsResult): void {\n let json: { mcpServers?: Record<string, unknown> } = {};\n if (existsSync(file)) {\n try {\n json = JSON.parse(readFileSync(file, 'utf8')) as typeof json;\n } catch {\n out.skipped.push(`${file} (not valid JSON, left untouched)`);\n return;\n }\n }\n const servers = json.mcpServers ?? {};\n if (JSON.stringify(servers.splithub) === JSON.stringify(MCP_SERVER_ENTRY)) {\n out.skipped.push(file);\n return;\n }\n json.mcpServers = { ...servers, splithub: MCP_SERVER_ENTRY };\n mkdirSync(dirname(file), { recursive: true });\n writeFileSync(file, JSON.stringify(json, null, 2) + '\\n', 'utf8');\n out.mcp.push(file);\n}\n\nexport function installSkills(root: string, options: { mcp?: boolean; force?: boolean; files?: SkillFile[]; source?: 'cloud' | 'bundled' } = {}): SkillsResult {\n const out: SkillsResult = { written: [], skipped: [], mcp: [], source: options.source ?? (options.files ? 'cloud' : 'bundled') };\n const files = options.files ?? BUNDLED_SKILL_FILES;\n for (const f of files) if (f.path !== 'AGENTS.md') writeFile(join(root, ...f.path.split('/')), f.body, Boolean(options.force), out);\n\n const section = files.find((f) => f.path === 'AGENTS.md')?.body ?? AGENTS_SECTION;\n const agentsFile = ['AGENTS.md', 'CLAUDE.md'].map((f) => join(root, f)).find((f) => existsSync(f)) ?? join(root, 'AGENTS.md');\n if (!existsSync(agentsFile)) {\n writeFileSync(agentsFile, `# ${detectProject(root).name}\n${section}`, 'utf8');\n out.written.push(agentsFile);\n } else if (!/SplitHub|\\bsh2\\b/.test(readFileSync(agentsFile, 'utf8'))) {\n writeFileSync(agentsFile, readFileSync(agentsFile, 'utf8') + `\n${section}`, 'utf8');\n out.written.push(`${agentsFile} (section appended)`);\n } else {\n out.skipped.push(agentsFile);\n }\n\n if (options.mcp) {\n registerMcp(join(root, '.mcp.json'), out);\n registerMcp(join(root, '.cursor', 'mcp.json'), out);\n }\n return out;\n}\n\nexport async function skills(flags: Flags): Promise<void> {\n const project = detectProject();\n const result = installSkills(project.root, { mcp: Boolean(flags.mcp), force: Boolean(flags.force), ...(await loadSkillFiles(flags)) });\n if (flags.json) {\n console.log(JSON.stringify(result));\n return;\n }\n const rel = (f: string) => relative(project.root, f) || f;\n if (result.written.length) console.log(`${c.green('✔')} wrote\\n ${result.written.map(rel).join('\\n ')}`);\n if (result.mcp.length) console.log(`${c.green('✔')} MCP server registered in\\n ${result.mcp.map(rel).join('\\n ')}`);\n if (result.skipped.length) console.log(c.dim(`unchanged: ${result.skipped.map(rel).join(', ')}`));\n if (result.source === 'bundled') console.log(c.dim(\"couldn't reach sh2 Cloud, so these are the copies bundled with this CLI\"));\n if (!flags.mcp) console.log(c.dim(`add --mcp to register the sh2 MCP server (Claude Code .mcp.json, Cursor .cursor/mcp.json; Codex and Copilot read AGENTS.md)`));\n console.log(c.dim('skills: splithub (library + CLI), ab-testing (how to run experiments well), splithub-analytics (pageviews, events, reports), splithub-api (HTTP API), splithub-mcp (MCP tools), splithub-self-hosted (your own database), splithub-ship (keep the winner, remove the experiment), splithub-loop (the whole loop, tool by tool)'));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAMA,SAAS,YAAY,WAAW,cAAc,qBAAqB;AACnE,SAAS,SAAS,MAAM,gBAAgB;AAiBjC,IAAM,sBAAmC;AAAA,EAC9C,GAAG,OAAO,IAAI,CAAC,OAAO,EAAE,MAAM,kBAAkB,EAAE,GAAG,aAAa,MAAM,EAAE,KAAK,EAAE;AAAA,EACjF,EAAE,MAAM,8BAA8B,MAAM,YAAY;AAAA,EACxD,EAAE,MAAM,aAAa,MAAM,eAAe;AAC5C;AAGA,IAAM,YAAY;AAGlB,eAAsB,eAAe,QAAiC,CAAC,GAAiE;AACtI,QAAM,UAAU,MAAM,YAAY,KAAK,IAAI,OAAO,CAAC,MAAM,UAAU,KAAK,EAAE,IAAI,CAAC;AAC/E,SAAO,QAAQ,SAAS,EAAE,OAAO,QAAQ,QAAQ,QAAQ,IAAI,EAAE,OAAO,qBAAqB,QAAQ,UAAU;AAC/G;AAEA,SAAS,UAAU,MAAc,SAAiB,OAAgB,KAAyB;AACzF,MAAI,WAAW,IAAI,KAAK,CAAC,OAAO;AAC9B,UAAM,UAAU,aAAa,MAAM,MAAM;AACzC,QAAI,YAAY,SAAS;AACvB,UAAI,QAAQ,KAAK,IAAI;AACrB;AAAA,IACF;AAEA,QAAI,CAAC,4BAA4B,KAAK,OAAO,GAAG;AAC9C,UAAI,QAAQ,KAAK,IAAI;AACrB;AAAA,IACF;AAAA,EACF;AACA,YAAU,QAAQ,IAAI,GAAG,EAAE,WAAW,KAAK,CAAC;AAC5C,gBAAc,MAAM,SAAS,MAAM;AACnC,MAAI,QAAQ,KAAK,IAAI;AACvB;AAGA,SAAS,YAAY,MAAc,KAAyB;AAC1D,MAAI,OAAiD,CAAC;AACtD,MAAI,WAAW,IAAI,GAAG;AACpB,QAAI;AACF,aAAO,KAAK,MAAM,aAAa,MA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AE,IAAI,6HAA6H,CAAC;AAChK,UAAQ,IAAI,EAAE,IAAI,gUAAgU,CAAC;AACrV;","names":[]}
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
requestText,
|
|
8
8
|
requireCloudToken,
|
|
9
9
|
resolveTarget
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-H5GMGCOT.js";
|
|
11
11
|
import {
|
|
12
12
|
bar,
|
|
13
13
|
c,
|
|
@@ -88,8 +88,8 @@ function cloudOnly(flags, what, report = true, rawHint = "Read the raw counts wi
|
|
|
88
88
|
if (t.cloud) return t;
|
|
89
89
|
const explicit = typeof flags.url === "string" && flags.url || process.env.SPLITHUB_URL;
|
|
90
90
|
if (!project.configFile && !explicit) return requireCloudToken(flags);
|
|
91
|
-
if (!report) return fail("NOT_CLOUD", `${what} come with
|
|
92
|
-
return fail("NOT_CLOUD", `${what} come with
|
|
91
|
+
if (!report) return fail("NOT_CLOUD", `${what} come with sh2 Cloud.`, "Connect this app with npx splithub init --mode cloud (or npx splithub login).");
|
|
92
|
+
return fail("NOT_CLOUD", `${what} come with sh2 Cloud: a self-hosted endpoint keeps raw counts only.`, rawHint);
|
|
93
93
|
}
|
|
94
94
|
var head = (key, parts) => console.log(`${c.bold(key)} ${c.dim(`\xB7 ${parts.join(" \xB7 ")}`)}
|
|
95
95
|
`);
|
|
@@ -295,4 +295,4 @@ export {
|
|
|
295
295
|
exportCsv,
|
|
296
296
|
segments
|
|
297
297
|
};
|
|
298
|
-
//# sourceMappingURL=chunk-
|
|
298
|
+
//# sourceMappingURL=chunk-GWWJHAH4.js.map
|