splithub 0.2.1 → 0.2.2
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 +9 -1
- package/dist/chunk-5VFCW4FI.js +75 -0
- package/dist/chunk-5VFCW4FI.js.map +1 -0
- package/dist/{chunk-B6FITBWN.js → chunk-6OXCLYOI.js} +2 -2
- package/dist/{chunk-NMN5YGNP.js → chunk-7EB5WOYE.js} +4 -4
- package/dist/{chunk-E5VH4BQX.js → chunk-AZJEZFOB.js} +5 -5
- package/dist/{chunk-DDWYTOX4.js → chunk-BQAWJPIK.js} +4 -2
- package/dist/chunk-BQAWJPIK.js.map +1 -0
- package/dist/{chunk-5C24F2ZN.js → chunk-BSWCWCYP.js} +3 -3
- package/dist/{chunk-GVARYUL3.js → chunk-D7KVM4L7.js} +2 -2
- package/dist/{chunk-3RVNT2HA.js → chunk-ECV5QR6H.js} +5 -5
- package/dist/{chunk-V3DLUVOE.js → chunk-EJC4E3VD.js} +7 -2
- package/dist/{chunk-V3DLUVOE.js.map → chunk-EJC4E3VD.js.map} +1 -1
- package/dist/{chunk-OHA2M7QR.js → chunk-IFCSJYXN.js} +2 -2
- package/dist/{chunk-LT4JP3IF.js → chunk-IGYK7N2F.js} +7 -7
- package/dist/{chunk-PNPOOAHF.js → chunk-LK3NRAHA.js} +14 -13
- package/dist/chunk-LK3NRAHA.js.map +1 -0
- package/dist/{chunk-EYYLDI5J.js → chunk-NTAIRQP6.js} +3 -3
- package/dist/{chunk-PLXDG4B5.js → chunk-PLZRB3VX.js} +2 -2
- package/dist/{chunk-DUIJ5DTV.js → chunk-VKLZJRYW.js} +57 -68
- package/dist/chunk-VKLZJRYW.js.map +1 -0
- package/dist/{chunk-RYDA7PQF.js → chunk-X5AV7YBR.js} +27 -10
- package/dist/chunk-X5AV7YBR.js.map +1 -0
- package/dist/{chunk-KMO5GGGC.js → chunk-XVWJZJSF.js} +5 -5
- package/dist/{chunk-BJQJGLOB.js → chunk-ZND3T67D.js} +31 -10
- package/dist/chunk-ZND3T67D.js.map +1 -0
- package/dist/{ci-ZQZ6RBUJ.js → ci-4OC23DTI.js} +4 -4
- package/dist/create-NCBDS2YG.js +18 -0
- package/dist/dev-7FXVGFL6.js +11 -0
- package/dist/doctor-E4KLPZZI.js +14 -0
- package/dist/{holdout-BWVTTLEY.js → holdout-OKHR2CKW.js} +4 -4
- package/dist/index.js +28 -28
- package/dist/index.js.map +1 -1
- package/dist/init-PFNPS6XO.js +15 -0
- package/dist/lifecycle-G7OAC4ZZ.js +12 -0
- package/dist/{login-TIIX5V4O.js → login-ZEIH7KIH.js} +4 -4
- package/dist/{menu-S3WDS4JY.js → menu-4X5S37OK.js} +21 -21
- package/dist/plan-QLYHRYCV.js +71 -0
- package/dist/plan-QLYHRYCV.js.map +1 -0
- package/dist/push-3NDLL7US.js +16 -0
- package/dist/{refs-RY7H3J7L.js → refs-IWZ5GP7Q.js} +5 -5
- package/dist/{remove-EQQCDJRU.js → remove-YDJ7JTPR.js} +6 -6
- package/dist/report-JS7Z42FD.js +58 -0
- package/dist/report-JS7Z42FD.js.map +1 -0
- package/dist/results-HCXQH7IY.js +17 -0
- package/dist/{review-7E7JVMMV.js → review-BGGNVL6L.js} +3 -3
- package/dist/{ship-MRBHWFZR.js → ship-C22SGFUD.js} +6 -6
- package/dist/skills-UBPQOTDQ.js +18 -0
- package/dist/status-6IODQYHV.js +12 -0
- package/dist/{update-67QDJ6GF.js → update-SAHMBHIZ.js} +3 -3
- package/package.json +4 -5
- package/dist/chunk-BJQJGLOB.js.map +0 -1
- package/dist/chunk-DDWYTOX4.js.map +0 -1
- package/dist/chunk-DUIJ5DTV.js.map +0 -1
- package/dist/chunk-OYM64FMD.js +0 -63
- package/dist/chunk-OYM64FMD.js.map +0 -1
- package/dist/chunk-PNPOOAHF.js.map +0 -1
- package/dist/chunk-RYDA7PQF.js.map +0 -1
- package/dist/create-AEJVXN25.js +0 -18
- package/dist/dev-W2JGUV2A.js +0 -11
- package/dist/doctor-D3KOGOX6.js +0 -14
- package/dist/init-UBUDSJBD.js +0 -15
- package/dist/lifecycle-ZLZUTASA.js +0 -12
- package/dist/plan-G2A55FR7.js +0 -135
- package/dist/plan-G2A55FR7.js.map +0 -1
- package/dist/push-OJX4F2BH.js +0 -16
- package/dist/report-6WNO576N.js +0 -69
- package/dist/report-6WNO576N.js.map +0 -1
- package/dist/results-ZDOCWN6U.js +0 -21
- package/dist/skills-JJOKGNO5.js +0 -13
- package/dist/status-SATP23WK.js +0 -12
- /package/dist/{chunk-B6FITBWN.js.map → chunk-6OXCLYOI.js.map} +0 -0
- /package/dist/{chunk-NMN5YGNP.js.map → chunk-7EB5WOYE.js.map} +0 -0
- /package/dist/{chunk-E5VH4BQX.js.map → chunk-AZJEZFOB.js.map} +0 -0
- /package/dist/{chunk-5C24F2ZN.js.map → chunk-BSWCWCYP.js.map} +0 -0
- /package/dist/{chunk-GVARYUL3.js.map → chunk-D7KVM4L7.js.map} +0 -0
- /package/dist/{chunk-3RVNT2HA.js.map → chunk-ECV5QR6H.js.map} +0 -0
- /package/dist/{chunk-OHA2M7QR.js.map → chunk-IFCSJYXN.js.map} +0 -0
- /package/dist/{chunk-LT4JP3IF.js.map → chunk-IGYK7N2F.js.map} +0 -0
- /package/dist/{chunk-EYYLDI5J.js.map → chunk-NTAIRQP6.js.map} +0 -0
- /package/dist/{chunk-PLXDG4B5.js.map → chunk-PLZRB3VX.js.map} +0 -0
- /package/dist/{chunk-KMO5GGGC.js.map → chunk-XVWJZJSF.js.map} +0 -0
- /package/dist/{ci-ZQZ6RBUJ.js.map → ci-4OC23DTI.js.map} +0 -0
- /package/dist/{create-AEJVXN25.js.map → create-NCBDS2YG.js.map} +0 -0
- /package/dist/{dev-W2JGUV2A.js.map → dev-7FXVGFL6.js.map} +0 -0
- /package/dist/{doctor-D3KOGOX6.js.map → doctor-E4KLPZZI.js.map} +0 -0
- /package/dist/{holdout-BWVTTLEY.js.map → holdout-OKHR2CKW.js.map} +0 -0
- /package/dist/{init-UBUDSJBD.js.map → init-PFNPS6XO.js.map} +0 -0
- /package/dist/{lifecycle-ZLZUTASA.js.map → lifecycle-G7OAC4ZZ.js.map} +0 -0
- /package/dist/{login-TIIX5V4O.js.map → login-ZEIH7KIH.js.map} +0 -0
- /package/dist/{menu-S3WDS4JY.js.map → menu-4X5S37OK.js.map} +0 -0
- /package/dist/{push-OJX4F2BH.js.map → push-3NDLL7US.js.map} +0 -0
- /package/dist/{refs-RY7H3J7L.js.map → refs-IWZ5GP7Q.js.map} +0 -0
- /package/dist/{remove-EQQCDJRU.js.map → remove-YDJ7JTPR.js.map} +0 -0
- /package/dist/{results-ZDOCWN6U.js.map → results-HCXQH7IY.js.map} +0 -0
- /package/dist/{review-7E7JVMMV.js.map → review-BGGNVL6L.js.map} +0 -0
- /package/dist/{ship-MRBHWFZR.js.map → ship-C22SGFUD.js.map} +0 -0
- /package/dist/{skills-JJOKGNO5.js.map → skills-UBPQOTDQ.js.map} +0 -0
- /package/dist/{status-SATP23WK.js.map → status-6IODQYHV.js.map} +0 -0
- /package/dist/{update-67QDJ6GF.js.map → update-SAHMBHIZ.js.map} +0 -0
|
@@ -4,15 +4,15 @@ import {
|
|
|
4
4
|
readSource,
|
|
5
5
|
setTopLevel,
|
|
6
6
|
writeConfigChecked
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-6OXCLYOI.js";
|
|
8
8
|
import {
|
|
9
9
|
requireConfig
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-PLZRB3VX.js";
|
|
11
11
|
import {
|
|
12
12
|
c,
|
|
13
13
|
fail,
|
|
14
14
|
printJson
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-EJC4E3VD.js";
|
|
16
16
|
|
|
17
17
|
// src/commands/holdout.ts
|
|
18
18
|
import { relative } from "path";
|
|
@@ -41,4 +41,4 @@ async function holdout(action, value, flags) {
|
|
|
41
41
|
export {
|
|
42
42
|
holdout
|
|
43
43
|
};
|
|
44
|
-
//# sourceMappingURL=holdout-
|
|
44
|
+
//# sourceMappingURL=holdout-OKHR2CKW.js.map
|
package/dist/index.js
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import {
|
|
3
3
|
offerUpdateAfterCommand,
|
|
4
4
|
startUpdateCheck
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-IFCSJYXN.js";
|
|
6
6
|
import {
|
|
7
7
|
c,
|
|
8
8
|
errorJson,
|
|
9
9
|
fail
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-EJC4E3VD.js";
|
|
11
11
|
|
|
12
12
|
// src/index.ts
|
|
13
13
|
import { createRequire } from "module";
|
|
@@ -23,13 +23,13 @@ Usage
|
|
|
23
23
|
splithub start|pause|finish <id>
|
|
24
24
|
splithub status all experiments with a verdict headline
|
|
25
25
|
splithub results <id> full verdict for one experiment
|
|
26
|
-
splithub plan visitors a test needs: --baseline 0.05 --mde 0.1 [--variants 2] [<id> for days at its traffic]
|
|
26
|
+
splithub plan visitors a test needs (asks SplitHub Cloud, no account needed): --baseline 0.05 --mde 0.1 [--variants 2] [<id> for days at its traffic]
|
|
27
27
|
splithub refs <id> files and lines that use the experiment and its goal
|
|
28
28
|
splithub ship <id> --keep <v> finish, remove from the config and rewrite the code to the kept variant (--dry-run shows the diff)
|
|
29
29
|
splithub remove <id> remove an experiment from the config (archived in the cloud when connected)
|
|
30
30
|
splithub holdout set <percent> keep a share of visitors out of every test to measure the long-term impact (0-50; --goal); holdout off removes it
|
|
31
31
|
splithub review [<id>] AI reviews stored in the cloud (Pro: at start, on verdict changes, on finish, or on demand)
|
|
32
|
-
splithub report status and verdicts as Markdown (used by the GitHub workflow)
|
|
32
|
+
splithub report status and verdicts as Markdown, raw numbers when self-hosted (used by the GitHub workflow)
|
|
33
33
|
splithub ci init write .github/workflows/splithub.yml (checks on PRs, results comment on a schedule)
|
|
34
34
|
splithub dev [--url] [--hold] open the app with ?sh_debug=1 (console + panel: variants, reasons, events) and watch results
|
|
35
35
|
splithub doctor check the installation
|
|
@@ -124,60 +124,60 @@ async function main() {
|
|
|
124
124
|
return;
|
|
125
125
|
}
|
|
126
126
|
if (!command) {
|
|
127
|
-
if (process.stdin.isTTY && process.stdout.isTTY && !values.json) return (await import("./menu-
|
|
127
|
+
if (process.stdin.isTTY && process.stdout.isTTY && !values.json) return (await import("./menu-4X5S37OK.js")).menu(values);
|
|
128
128
|
console.log(HELP.trimEnd());
|
|
129
129
|
return;
|
|
130
130
|
}
|
|
131
131
|
switch (command) {
|
|
132
132
|
case "init":
|
|
133
|
-
return (await import("./init-
|
|
133
|
+
return (await import("./init-PFNPS6XO.js")).init(values);
|
|
134
134
|
case "create":
|
|
135
|
-
return (await import("./create-
|
|
135
|
+
return (await import("./create-NCBDS2YG.js")).create(values);
|
|
136
136
|
case "start":
|
|
137
137
|
case "pause":
|
|
138
138
|
case "finish":
|
|
139
|
-
return (await import("./lifecycle-
|
|
139
|
+
return (await import("./lifecycle-G7OAC4ZZ.js")).lifecycle(command, arg, values);
|
|
140
140
|
case "status":
|
|
141
|
-
return (await import("./status-
|
|
141
|
+
return (await import("./status-6IODQYHV.js")).status(values);
|
|
142
142
|
case "results":
|
|
143
|
-
return (await import("./results-
|
|
143
|
+
return (await import("./results-HCXQH7IY.js")).results(arg, values);
|
|
144
144
|
case "plan":
|
|
145
|
-
return (await import("./plan-
|
|
145
|
+
return (await import("./plan-QLYHRYCV.js")).plan(arg, values);
|
|
146
146
|
case "refs":
|
|
147
|
-
return (await import("./refs-
|
|
147
|
+
return (await import("./refs-IWZ5GP7Q.js")).refs(arg, values);
|
|
148
148
|
case "remove":
|
|
149
|
-
return (await import("./remove-
|
|
149
|
+
return (await import("./remove-YDJ7JTPR.js")).remove(arg, values);
|
|
150
150
|
case "ship":
|
|
151
|
-
return (await import("./ship-
|
|
151
|
+
return (await import("./ship-C22SGFUD.js")).ship(arg, values);
|
|
152
152
|
case "report":
|
|
153
|
-
return (await import("./report-
|
|
153
|
+
return (await import("./report-JS7Z42FD.js")).report(values);
|
|
154
154
|
case "ci":
|
|
155
155
|
if (arg !== "init") fail("USAGE", `Unknown "ci ${arg ?? ""}".`, "Run npx splithub ci init.");
|
|
156
|
-
return (await import("./ci-
|
|
156
|
+
return (await import("./ci-4OC23DTI.js")).ciInit(values);
|
|
157
157
|
case "holdout":
|
|
158
|
-
return (await import("./holdout-
|
|
158
|
+
return (await import("./holdout-OKHR2CKW.js")).holdout(arg, third, values);
|
|
159
159
|
case "review":
|
|
160
|
-
return (await import("./review-
|
|
160
|
+
return (await import("./review-BGGNVL6L.js")).review(arg, values);
|
|
161
161
|
case "dev":
|
|
162
|
-
return (await import("./dev-
|
|
162
|
+
return (await import("./dev-7FXVGFL6.js")).dev(values);
|
|
163
163
|
case "doctor":
|
|
164
|
-
return (await import("./doctor-
|
|
164
|
+
return (await import("./doctor-E4KLPZZI.js")).doctor(values);
|
|
165
165
|
case "update":
|
|
166
|
-
return (await import("./update-
|
|
166
|
+
return (await import("./update-SAHMBHIZ.js")).update(values);
|
|
167
167
|
case "skills":
|
|
168
|
-
return (await import("./skills-
|
|
168
|
+
return (await import("./skills-UBPQOTDQ.js")).skills(values);
|
|
169
169
|
case "push":
|
|
170
|
-
return (await import("./push-
|
|
170
|
+
return (await import("./push-3NDLL7US.js")).push(values);
|
|
171
171
|
case "pull":
|
|
172
|
-
return (await import("./push-
|
|
172
|
+
return (await import("./push-3NDLL7US.js")).pull(values);
|
|
173
173
|
case "login":
|
|
174
|
-
return (await import("./login-
|
|
174
|
+
return (await import("./login-ZEIH7KIH.js")).login(values);
|
|
175
175
|
case "logout":
|
|
176
|
-
return (await import("./login-
|
|
176
|
+
return (await import("./login-ZEIH7KIH.js")).logout(values);
|
|
177
177
|
case "whoami":
|
|
178
|
-
return (await import("./login-
|
|
178
|
+
return (await import("./login-ZEIH7KIH.js")).whoami(values);
|
|
179
179
|
case "projects":
|
|
180
|
-
return (await import("./login-
|
|
180
|
+
return (await import("./login-ZEIH7KIH.js")).projects(values);
|
|
181
181
|
default:
|
|
182
182
|
fail("USAGE", `Unknown command "${command}".`, "Run npx splithub --help for the list.");
|
|
183
183
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { createRequire } from 'node:module';\nimport { parseArgs } from 'node:util';\nimport { errorJson, fail } from './errors';\nimport { c } from './ui';\nimport { offerUpdateAfterCommand, startUpdateCheck } from './update';\n\n// Started before the command so the registry answer is usually in by the time it ends.\nconst updateCheck = startUpdateCheck({ argv: process.argv.slice(2), env: process.env, stdinTTY: process.stdin.isTTY, stdoutTTY: process.stdout.isTTY });\n\nconst HELP = `\n${c.bold('splithub')} — A/B testing for agent-built apps\n\nUsage\n splithub interactive menu: set up, create, results, start/pause, push — step by step\n splithub init set up config, framework files, agent docs\n splithub create add an experiment (wizard, or flags for agents)\n splithub start|pause|finish <id>\n splithub status all experiments with a verdict headline\n splithub results <id> full verdict for one experiment\n splithub plan visitors a test needs: --baseline 0.05 --mde 0.1 [--variants 2] [<id> for days at its traffic]\n splithub refs <id> files and lines that use the experiment and its goal\n splithub ship <id> --keep <v> finish, remove from the config and rewrite the code to the kept variant (--dry-run shows the diff)\n splithub remove <id> remove an experiment from the config (archived in the cloud when connected)\n splithub holdout set <percent> keep a share of visitors out of every test to measure the long-term impact (0-50; --goal); holdout off removes it\n splithub review [<id>] AI reviews stored in the cloud (Pro: at start, on verdict changes, on finish, or on demand)\n splithub report status and verdicts as Markdown (used by the GitHub workflow)\n splithub ci init write .github/workflows/splithub.yml (checks on PRs, results comment on a schedule)\n splithub dev [--url] [--hold] open the app with ?sh_debug=1 (console + panel: variants, reasons, events) and watch results\n splithub doctor check the installation\n splithub update [--yes] update splithub (and the project's @splithub/* packages) to the latest release; --json only reports\n splithub skills [--mcp] install / refresh agent skills (library, A/B testing, API, MCP, self-hosting, ship the winner, full loop); --mcp registers the MCP server\n splithub login [--project <name|id>] connect this directory to a SplitHub Cloud project (sign-in link, no secrets typed)\n splithub projects every directory connected on this machine and its project\n splithub whoami the project this directory is connected to\n splithub logout disconnect this directory\n splithub push [--dry-run] upload splithub.config.ts to SplitHub Cloud (--dry-run: check and show what would change)\n splithub pull show the config stored in the cloud\n\ncreate flags\n --kind value|component|redirect|mvt --id <key> --goal <goal> --status running|draft --description \"...\" --yes\n value / component / redirect: --variants control,b --weights 50,50\n value: --value control=\"Old text\" --value b=\"New text\" (repeatable)\n redirect: --match /path --to control=/ --to b=/new (repeatable)\n mvt: --factor headline=old:Old,new:New --factor button=blue:#2563eb,green:#16a34a (repeatable; first level = control)\n limits: --traffic 50 (percent of visitors) --max-visitors 10000 --min-days 3 (opt-in days before a verdict, 0-30, default 0) --good-sample 5000 (visitors for a good sample) --start / --end <ISO date>\n metrics: --secondary pricing_view,signup --guardrail refunds:higher,errors (must not get worse; :higher when a rise is bad)\n layers: --layer checkout:0-50 (tests in one layer never share a visitor; ranges must not overlap)\n\ninit flags\n --mode self|cloud --db sqlite|postgres|mysql|custom (self mode) --key pk_... --no-install --no-login --no-mcp --github-action --yes\n (cloud mode without a saved login prints a link; approve it in the browser and init continues)\n\nGlobal\n --url <url> results endpoint (default: $SPLITHUB_URL, the cloud API in cloud mode, else the local dev server)\n --token <token> admin token (self: $SPLITHUB_ADMIN_TOKEN) or project API key (cloud: $SPLITHUB_API_KEY, else the key saved by \"splithub login\")\n --api <url> cloud API base (default: https://go.splithub.io/v1 or $SPLITHUB_API)\n --json one line of JSON (for agents); errors are { error, code, hint? } and exit 1\n -v, --version\n -h, --help\n`;\n\nasync function main(): Promise<void> {\n const { values, positionals } = parseArgs({\n allowPositionals: true,\n options: {\n url: { type: 'string' },\n api: { type: 'string' },\n token: { type: 'string' },\n json: { type: 'boolean', default: false },\n yes: { type: 'boolean', short: 'y', default: false },\n help: { type: 'boolean', short: 'h', default: false },\n version: { type: 'boolean', short: 'v', default: false },\n mode: { type: 'string' },\n db: { type: 'string' },\n key: { type: 'string' },\n 'no-install': { type: 'boolean', default: false },\n 'no-login': { type: 'boolean', default: false },\n 'no-mcp': { type: 'boolean', default: false },\n 'no-open': { type: 'boolean', default: false },\n hold: { type: 'boolean', default: false },\n mcp: { type: 'boolean', default: false },\n force: { type: 'boolean', default: false },\n kind: { type: 'string' },\n id: { type: 'string' },\n variants: { type: 'string' },\n weights: { type: 'string' },\n goal: { type: 'string' },\n value: { type: 'string', multiple: true },\n match: { type: 'string' },\n to: { type: 'string', multiple: true },\n factor: { type: 'string', multiple: true },\n status: { type: 'string' },\n description: { type: 'string' },\n traffic: { type: 'string' },\n 'max-visitors': { type: 'string' },\n 'min-days': { type: 'string' },\n 'good-sample': { type: 'string' },\n start: { type: 'string' },\n end: { type: 'string' },\n project: { type: 'string' },\n keep: { type: 'string' },\n 'dry-run': { type: 'boolean', default: false },\n baseline: { type: 'string' },\n mde: { type: 'string' },\n 'github-action': { type: 'boolean', default: false },\n secondary: { type: 'string', multiple: true },\n guardrail: { type: 'string', multiple: true },\n layer: { type: 'string' },\n },\n });\n const [command, arg, third] = positionals;\n if (values.help) {\n console.log(HELP.trimEnd());\n return;\n }\n if (values.version) {\n // dist/index.js sits next to the package.json that npm installed.\n const { version } = createRequire(import.meta.url)('../package.json') as { version: string };\n console.log(values.json ? JSON.stringify({ version }) : version);\n return;\n }\n if (!command) {\n // A terminal → the interactive menu; a pipe or an agent → the help text.\n if (process.stdin.isTTY && process.stdout.isTTY && !values.json) return (await import('./commands/menu')).menu(values);\n console.log(HELP.trimEnd());\n return;\n }\n // Each command loads on demand: `splithub status` never pays for the wizard or the TypeScript compiler.\n switch (command) {\n case 'init':\n return (await import('./commands/init')).init(values);\n case 'create':\n return (await import('./commands/create')).create(values);\n case 'start':\n case 'pause':\n case 'finish':\n return (await import('./commands/lifecycle')).lifecycle(command, arg, values);\n case 'status':\n return (await import('./commands/status')).status(values);\n case 'results':\n return (await import('./commands/results')).results(arg, values);\n case 'plan':\n return (await import('./commands/plan')).plan(arg, values);\n case 'refs':\n return (await import('./commands/refs')).refs(arg, values);\n case 'remove':\n return (await import('./commands/remove')).remove(arg, values);\n case 'ship':\n return (await import('./commands/ship')).ship(arg, values);\n case 'report':\n return (await import('./commands/report')).report(values);\n case 'ci':\n if (arg !== 'init') fail('USAGE', `Unknown \"ci ${arg ?? ''}\".`, 'Run npx splithub ci init.');\n return (await import('./commands/ci')).ciInit(values);\n case 'holdout':\n return (await import('./commands/holdout')).holdout(arg, third, values);\n case 'review':\n return (await import('./commands/review')).review(arg, values);\n case 'dev':\n return (await import('./commands/dev')).dev(values);\n case 'doctor':\n return (await import('./commands/doctor')).doctor(values);\n case 'update':\n return (await import('./commands/update')).update(values);\n case 'skills':\n return (await import('./commands/skills')).skills(values);\n case 'push':\n return (await import('./commands/push')).push(values);\n case 'pull':\n return (await import('./commands/push')).pull(values);\n case 'login':\n return (await import('./commands/login')).login(values);\n case 'logout':\n return (await import('./commands/login')).logout(values);\n case 'whoami':\n return (await import('./commands/login')).whoami(values);\n case 'projects':\n return (await import('./commands/login')).projects(values);\n default:\n fail('USAGE', `Unknown command \"${command}\".`, 'Run npx splithub --help for the list.');\n }\n}\n\nmain()\n .then(() => offerUpdateAfterCommand(updateCheck))\n .catch((error: unknown) => {\n const body = errorJson(error);\n if (process.argv.includes('--json')) console.log(JSON.stringify(body));\n else {\n console.error(c.red(`error: ${body.error}`));\n if (body.hint) console.error(c.dim(body.hint));\n }\n process.exit(1);\n });\n"],"mappings":";;;;;;;;;;;;AAAA,SAAS,qBAAqB;AAC9B,SAAS,iBAAiB;AAM1B,IAAM,cAAc,iBAAiB,EAAE,MAAM,QAAQ,KAAK,MAAM,CAAC,GAAG,KAAK,QAAQ,KAAK,UAAU,QAAQ,MAAM,OAAO,WAAW,QAAQ,OAAO,MAAM,CAAC;AAEtJ,IAAM,OAAO;AAAA,EACX,EAAE,KAAK,UAAU,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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B,CAAC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { createRequire } from 'node:module';\nimport { parseArgs } from 'node:util';\nimport { errorJson, fail } from './errors';\nimport { c } from './ui';\nimport { offerUpdateAfterCommand, startUpdateCheck } from './update';\n\n// Started before the command so the registry answer is usually in by the time it ends.\nconst updateCheck = startUpdateCheck({ argv: process.argv.slice(2), env: process.env, stdinTTY: process.stdin.isTTY, stdoutTTY: process.stdout.isTTY });\n\nconst HELP = `\n${c.bold('splithub')} — A/B testing for agent-built apps\n\nUsage\n splithub interactive menu: set up, create, results, start/pause, push — step by step\n splithub init set up config, framework files, agent docs\n splithub create add an experiment (wizard, or flags for agents)\n splithub start|pause|finish <id>\n splithub status all experiments with a verdict headline\n splithub results <id> full verdict for one experiment\n splithub plan visitors a test needs (asks SplitHub Cloud, no account needed): --baseline 0.05 --mde 0.1 [--variants 2] [<id> for days at its traffic]\n splithub refs <id> files and lines that use the experiment and its goal\n splithub ship <id> --keep <v> finish, remove from the config and rewrite the code to the kept variant (--dry-run shows the diff)\n splithub remove <id> remove an experiment from the config (archived in the cloud when connected)\n splithub holdout set <percent> keep a share of visitors out of every test to measure the long-term impact (0-50; --goal); holdout off removes it\n splithub review [<id>] AI reviews stored in the cloud (Pro: at start, on verdict changes, on finish, or on demand)\n splithub report status and verdicts as Markdown, raw numbers when self-hosted (used by the GitHub workflow)\n splithub ci init write .github/workflows/splithub.yml (checks on PRs, results comment on a schedule)\n splithub dev [--url] [--hold] open the app with ?sh_debug=1 (console + panel: variants, reasons, events) and watch results\n splithub doctor check the installation\n splithub update [--yes] update splithub (and the project's @splithub/* packages) to the latest release; --json only reports\n splithub skills [--mcp] install / refresh agent skills (library, A/B testing, API, MCP, self-hosting, ship the winner, full loop); --mcp registers the MCP server\n splithub login [--project <name|id>] connect this directory to a SplitHub Cloud project (sign-in link, no secrets typed)\n splithub projects every directory connected on this machine and its project\n splithub whoami the project this directory is connected to\n splithub logout disconnect this directory\n splithub push [--dry-run] upload splithub.config.ts to SplitHub Cloud (--dry-run: check and show what would change)\n splithub pull show the config stored in the cloud\n\ncreate flags\n --kind value|component|redirect|mvt --id <key> --goal <goal> --status running|draft --description \"...\" --yes\n value / component / redirect: --variants control,b --weights 50,50\n value: --value control=\"Old text\" --value b=\"New text\" (repeatable)\n redirect: --match /path --to control=/ --to b=/new (repeatable)\n mvt: --factor headline=old:Old,new:New --factor button=blue:#2563eb,green:#16a34a (repeatable; first level = control)\n limits: --traffic 50 (percent of visitors) --max-visitors 10000 --min-days 3 (opt-in days before a verdict, 0-30, default 0) --good-sample 5000 (visitors for a good sample) --start / --end <ISO date>\n metrics: --secondary pricing_view,signup --guardrail refunds:higher,errors (must not get worse; :higher when a rise is bad)\n layers: --layer checkout:0-50 (tests in one layer never share a visitor; ranges must not overlap)\n\ninit flags\n --mode self|cloud --db sqlite|postgres|mysql|custom (self mode) --key pk_... --no-install --no-login --no-mcp --github-action --yes\n (cloud mode without a saved login prints a link; approve it in the browser and init continues)\n\nGlobal\n --url <url> results endpoint (default: $SPLITHUB_URL, the cloud API in cloud mode, else the local dev server)\n --token <token> admin token (self: $SPLITHUB_ADMIN_TOKEN) or project API key (cloud: $SPLITHUB_API_KEY, else the key saved by \"splithub login\")\n --api <url> cloud API base (default: https://go.splithub.io/v1 or $SPLITHUB_API)\n --json one line of JSON (for agents); errors are { error, code, hint? } and exit 1\n -v, --version\n -h, --help\n`;\n\nasync function main(): Promise<void> {\n const { values, positionals } = parseArgs({\n allowPositionals: true,\n options: {\n url: { type: 'string' },\n api: { type: 'string' },\n token: { type: 'string' },\n json: { type: 'boolean', default: false },\n yes: { type: 'boolean', short: 'y', default: false },\n help: { type: 'boolean', short: 'h', default: false },\n version: { type: 'boolean', short: 'v', default: false },\n mode: { type: 'string' },\n db: { type: 'string' },\n key: { type: 'string' },\n 'no-install': { type: 'boolean', default: false },\n 'no-login': { type: 'boolean', default: false },\n 'no-mcp': { type: 'boolean', default: false },\n 'no-open': { type: 'boolean', default: false },\n hold: { type: 'boolean', default: false },\n mcp: { type: 'boolean', default: false },\n force: { type: 'boolean', default: false },\n kind: { type: 'string' },\n id: { type: 'string' },\n variants: { type: 'string' },\n weights: { type: 'string' },\n goal: { type: 'string' },\n value: { type: 'string', multiple: true },\n match: { type: 'string' },\n to: { type: 'string', multiple: true },\n factor: { type: 'string', multiple: true },\n status: { type: 'string' },\n description: { type: 'string' },\n traffic: { type: 'string' },\n 'max-visitors': { type: 'string' },\n 'min-days': { type: 'string' },\n 'good-sample': { type: 'string' },\n start: { type: 'string' },\n end: { type: 'string' },\n project: { type: 'string' },\n keep: { type: 'string' },\n 'dry-run': { type: 'boolean', default: false },\n baseline: { type: 'string' },\n mde: { type: 'string' },\n 'github-action': { type: 'boolean', default: false },\n secondary: { type: 'string', multiple: true },\n guardrail: { type: 'string', multiple: true },\n layer: { type: 'string' },\n },\n });\n const [command, arg, third] = positionals;\n if (values.help) {\n console.log(HELP.trimEnd());\n return;\n }\n if (values.version) {\n // dist/index.js sits next to the package.json that npm installed.\n const { version } = createRequire(import.meta.url)('../package.json') as { version: string };\n console.log(values.json ? JSON.stringify({ version }) : version);\n return;\n }\n if (!command) {\n // A terminal → the interactive menu; a pipe or an agent → the help text.\n if (process.stdin.isTTY && process.stdout.isTTY && !values.json) return (await import('./commands/menu')).menu(values);\n console.log(HELP.trimEnd());\n return;\n }\n // Each command loads on demand: `splithub status` never pays for the wizard or the TypeScript compiler.\n switch (command) {\n case 'init':\n return (await import('./commands/init')).init(values);\n case 'create':\n return (await import('./commands/create')).create(values);\n case 'start':\n case 'pause':\n case 'finish':\n return (await import('./commands/lifecycle')).lifecycle(command, arg, values);\n case 'status':\n return (await import('./commands/status')).status(values);\n case 'results':\n return (await import('./commands/results')).results(arg, values);\n case 'plan':\n return (await import('./commands/plan')).plan(arg, values);\n case 'refs':\n return (await import('./commands/refs')).refs(arg, values);\n case 'remove':\n return (await import('./commands/remove')).remove(arg, values);\n case 'ship':\n return (await import('./commands/ship')).ship(arg, values);\n case 'report':\n return (await import('./commands/report')).report(values);\n case 'ci':\n if (arg !== 'init') fail('USAGE', `Unknown \"ci ${arg ?? ''}\".`, 'Run npx splithub ci init.');\n return (await import('./commands/ci')).ciInit(values);\n case 'holdout':\n return (await import('./commands/holdout')).holdout(arg, third, values);\n case 'review':\n return (await import('./commands/review')).review(arg, values);\n case 'dev':\n return (await import('./commands/dev')).dev(values);\n case 'doctor':\n return (await import('./commands/doctor')).doctor(values);\n case 'update':\n return (await import('./commands/update')).update(values);\n case 'skills':\n return (await import('./commands/skills')).skills(values);\n case 'push':\n return (await import('./commands/push')).push(values);\n case 'pull':\n return (await import('./commands/push')).pull(values);\n case 'login':\n return (await import('./commands/login')).login(values);\n case 'logout':\n return (await import('./commands/login')).logout(values);\n case 'whoami':\n return (await import('./commands/login')).whoami(values);\n case 'projects':\n return (await import('./commands/login')).projects(values);\n default:\n fail('USAGE', `Unknown command \"${command}\".`, 'Run npx splithub --help for the list.');\n }\n}\n\nmain()\n .then(() => offerUpdateAfterCommand(updateCheck))\n .catch((error: unknown) => {\n const body = errorJson(error);\n if (process.argv.includes('--json')) console.log(JSON.stringify(body));\n else {\n console.error(c.red(`error: ${body.error}`));\n if (body.hint) console.error(c.dim(body.hint));\n }\n process.exit(1);\n });\n"],"mappings":";;;;;;;;;;;;AAAA,SAAS,qBAAqB;AAC9B,SAAS,iBAAiB;AAM1B,IAAM,cAAc,iBAAiB,EAAE,MAAM,QAAQ,KAAK,MAAM,CAAC,GAAG,KAAK,QAAQ,KAAK,UAAU,QAAQ,MAAM,OAAO,WAAW,QAAQ,OAAO,MAAM,CAAC;AAEtJ,IAAM,OAAO;AAAA,EACX,EAAE,KAAK,UAAU,CAAC;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;A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chunk-LK3NRAHA.js";
|
|
5
|
+
import "./chunk-BSWCWCYP.js";
|
|
6
|
+
import "./chunk-X5AV7YBR.js";
|
|
7
|
+
import "./chunk-BQAWJPIK.js";
|
|
8
|
+
import "./chunk-ZND3T67D.js";
|
|
9
|
+
import "./chunk-NTAIRQP6.js";
|
|
10
|
+
import "./chunk-PLZRB3VX.js";
|
|
11
|
+
import "./chunk-EJC4E3VD.js";
|
|
12
|
+
export {
|
|
13
|
+
init
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=init-PFNPS6XO.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
lifecycle
|
|
4
|
+
} from "./chunk-ECV5QR6H.js";
|
|
5
|
+
import "./chunk-6OXCLYOI.js";
|
|
6
|
+
import "./chunk-ZND3T67D.js";
|
|
7
|
+
import "./chunk-PLZRB3VX.js";
|
|
8
|
+
import "./chunk-EJC4E3VD.js";
|
|
9
|
+
export {
|
|
10
|
+
lifecycle
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=lifecycle-G7OAC4ZZ.js.map
|
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
logout,
|
|
6
6
|
projects,
|
|
7
7
|
whoami
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-BSWCWCYP.js";
|
|
9
|
+
import "./chunk-ZND3T67D.js";
|
|
10
|
+
import "./chunk-EJC4E3VD.js";
|
|
11
11
|
export {
|
|
12
12
|
deviceLogin,
|
|
13
13
|
login,
|
|
@@ -15,4 +15,4 @@ export {
|
|
|
15
15
|
projects,
|
|
16
16
|
whoami
|
|
17
17
|
};
|
|
18
|
-
//# sourceMappingURL=login-
|
|
18
|
+
//# sourceMappingURL=login-ZEIH7KIH.js.map
|
|
@@ -1,53 +1,53 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
lifecycle
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ECV5QR6H.js";
|
|
5
5
|
import {
|
|
6
6
|
pull,
|
|
7
7
|
push
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-XVWJZJSF.js";
|
|
9
9
|
import {
|
|
10
10
|
status
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-5VFCW4FI.js";
|
|
12
12
|
import {
|
|
13
13
|
results
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-VKLZJRYW.js";
|
|
15
15
|
import {
|
|
16
16
|
create
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-AZJEZFOB.js";
|
|
18
18
|
import {
|
|
19
19
|
dev
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-7EB5WOYE.js";
|
|
21
21
|
import {
|
|
22
22
|
doctor
|
|
23
|
-
} from "./chunk-
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-
|
|
26
|
-
import "./chunk-
|
|
23
|
+
} from "./chunk-IGYK7N2F.js";
|
|
24
|
+
import "./chunk-D7KVM4L7.js";
|
|
25
|
+
import "./chunk-IFCSJYXN.js";
|
|
26
|
+
import "./chunk-6OXCLYOI.js";
|
|
27
27
|
import {
|
|
28
28
|
init
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-LK3NRAHA.js";
|
|
30
30
|
import {
|
|
31
31
|
login,
|
|
32
32
|
logout
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-BSWCWCYP.js";
|
|
34
|
+
import {
|
|
35
|
+
skills
|
|
36
|
+
} from "./chunk-X5AV7YBR.js";
|
|
37
|
+
import "./chunk-BQAWJPIK.js";
|
|
34
38
|
import {
|
|
35
39
|
cloudTarget,
|
|
36
40
|
fetchStatus,
|
|
37
41
|
loadCredential,
|
|
38
42
|
resolveTarget
|
|
39
|
-
} from "./chunk-
|
|
40
|
-
import
|
|
41
|
-
skills
|
|
42
|
-
} from "./chunk-RYDA7PQF.js";
|
|
43
|
-
import "./chunk-DDWYTOX4.js";
|
|
44
|
-
import "./chunk-EYYLDI5J.js";
|
|
43
|
+
} from "./chunk-ZND3T67D.js";
|
|
44
|
+
import "./chunk-NTAIRQP6.js";
|
|
45
45
|
import {
|
|
46
46
|
detectProject
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-PLZRB3VX.js";
|
|
48
48
|
import {
|
|
49
49
|
c
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-EJC4E3VD.js";
|
|
51
51
|
|
|
52
52
|
// src/commands/menu.ts
|
|
53
53
|
import * as p from "@clack/prompts";
|
|
@@ -160,4 +160,4 @@ async function menu(flags) {
|
|
|
160
160
|
export {
|
|
161
161
|
menu
|
|
162
162
|
};
|
|
163
|
-
//# sourceMappingURL=menu-
|
|
163
|
+
//# sourceMappingURL=menu-4X5S37OK.js.map
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
cloudTarget,
|
|
4
|
+
fetchPlan,
|
|
5
|
+
fetchStatus,
|
|
6
|
+
resolveTarget
|
|
7
|
+
} from "./chunk-ZND3T67D.js";
|
|
8
|
+
import {
|
|
9
|
+
detectProject
|
|
10
|
+
} from "./chunk-PLZRB3VX.js";
|
|
11
|
+
import {
|
|
12
|
+
CliError,
|
|
13
|
+
c,
|
|
14
|
+
fail,
|
|
15
|
+
printJson
|
|
16
|
+
} from "./chunk-EJC4E3VD.js";
|
|
17
|
+
|
|
18
|
+
// src/commands/plan.ts
|
|
19
|
+
function num(flags, name) {
|
|
20
|
+
const v = flags[name];
|
|
21
|
+
if (typeof v !== "string" || v === "") return void 0;
|
|
22
|
+
const n = Number(v.replace(/%$/, "")) / (v.endsWith("%") ? 100 : 1);
|
|
23
|
+
if (!Number.isFinite(n)) fail("INVALID_FLAG", `--${name} "${v}" isn't a number.`);
|
|
24
|
+
return n;
|
|
25
|
+
}
|
|
26
|
+
async function requestPlan(flags, baseline, mde, variants) {
|
|
27
|
+
if (!(baseline > 0 && baseline < 1)) fail("INVALID_FLAG", `--baseline ${baseline} must be a rate between 0 and 1.`, "For example --baseline 0.05 for 5% of visitors converting today.");
|
|
28
|
+
if (!(mde > 0)) fail("INVALID_FLAG", `--mde ${mde} must be above 0.`, "The smallest relative lift worth finding, e.g. --mde 0.1 for +10%.");
|
|
29
|
+
if (!Number.isInteger(variants) || variants < 2) fail("INVALID_FLAG", "--variants must be a whole number of 2 or more.");
|
|
30
|
+
const target = cloudTarget(flags);
|
|
31
|
+
try {
|
|
32
|
+
return await fetchPlan(target, { baseline, mde, variants });
|
|
33
|
+
} catch (error) {
|
|
34
|
+
if (error instanceof CliError && error.code === "UNREACHABLE") fail("UNREACHABLE", `Planning a test needs SplitHub Cloud, and we can't reach ${target.url} right now.`, "Check your connection and try again. No account needed.");
|
|
35
|
+
if (error instanceof CliError && error.code === "API_ERROR") fail("INVALID_FLAG", error.message, error.hint);
|
|
36
|
+
throw error;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
async function plan(id, flags) {
|
|
40
|
+
const baseline = num(flags, "baseline");
|
|
41
|
+
const mde = num(flags, "mde");
|
|
42
|
+
if (baseline === void 0 || mde === void 0) fail("USAGE", "Pass --baseline (conversion rate today) and --mde (smallest lift worth finding).", "For example: npx splithub plan --baseline 0.05 --mde 0.1");
|
|
43
|
+
const p = await requestPlan(flags, baseline, mde, num(flags, "variants") ?? 2);
|
|
44
|
+
let traffic = null;
|
|
45
|
+
if (id) {
|
|
46
|
+
const data = await fetchStatus(resolveTarget(flags, detectProject())).catch(() => null);
|
|
47
|
+
const row = data?.experiments.find((e) => e.experiment === id);
|
|
48
|
+
if (data && !row) fail("EXPERIMENT_NOT_FOUND", `There's no experiment "${id}" in the results.`, "See the ids with npx splithub status.");
|
|
49
|
+
if (row) {
|
|
50
|
+
const perDay = row.days > 0 ? row.visitors / row.days : 0;
|
|
51
|
+
traffic = { experiment: id, visitors: row.visitors, days: row.days, perDay: Math.round(perDay), daysLeft: perDay > 0 ? Math.max(0, Math.ceil((p.total - row.visitors) / perDay)) : null };
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (flags.json) {
|
|
55
|
+
printJson({ ...p, traffic });
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
console.log(`${c.bold(p.perVariant.toLocaleString("en-US"))} visitors per variant, ${p.total.toLocaleString("en-US")} in all`);
|
|
59
|
+
console.log(c.dim(`to find a ${(p.mde * 100).toFixed(0)}% lift on a ${(p.baseline * 100).toFixed(1)}% rate (${Math.round(p.confidence * 100)}% confidence, 80% power, safe to check daily)`));
|
|
60
|
+
if (id && !traffic) console.log(c.dim(`Couldn't read ${id}'s traffic, so no days estimate. Sign in (npx splithub login) or start your app.`));
|
|
61
|
+
if (traffic) {
|
|
62
|
+
if (traffic.daysLeft === null) console.log(c.yellow(`${id} has no visitors yet, so there's no pace to go by.`));
|
|
63
|
+
else if (traffic.daysLeft === 0) console.log(c.green(`${id} already has enough visitors (${traffic.visitors.toLocaleString("en-US")}).`));
|
|
64
|
+
else console.log(`About ${traffic.daysLeft} more days for ${id} at ${traffic.perDay.toLocaleString("en-US")} visitors a day.`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
export {
|
|
68
|
+
plan,
|
|
69
|
+
requestPlan
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=plan-QLYHRYCV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/plan.ts"],"sourcesContent":["// `splithub plan`: sample size for a planned test. SplitHub Cloud sizes it (GET /plan, no login\n// needed); with an experiment id and access to its numbers, the CLI adds the days at its pace.\nimport { cloudTarget, fetchPlan, fetchStatus, resolveTarget, type PlanResult } from '../api';\nimport { CliError, fail, printJson } from '../errors';\nimport { detectProject } from '../project';\nimport { c } from '../ui';\nimport type { Flags } from './init';\n\nfunction num(flags: Flags, name: string): number | undefined {\n const v = flags[name];\n if (typeof v !== 'string' || v === '') return undefined;\n const n = Number(v.replace(/%$/, '')) / (v.endsWith('%') ? 100 : 1);\n if (!Number.isFinite(n)) fail('INVALID_FLAG', `--${name} \"${v}\" isn't a number.`);\n return n;\n}\n\nexport type Plan = PlanResult;\n\n/** Ask SplitHub Cloud for the sample size. Bad numbers are INVALID_FLAG; no connection says planning needs the cloud. */\nexport async function requestPlan(flags: Flags, baseline: number, mde: number, variants: number): Promise<Plan> {\n if (!(baseline > 0 && baseline < 1)) fail('INVALID_FLAG', `--baseline ${baseline} must be a rate between 0 and 1.`, 'For example --baseline 0.05 for 5% of visitors converting today.');\n if (!(mde > 0)) fail('INVALID_FLAG', `--mde ${mde} must be above 0.`, 'The smallest relative lift worth finding, e.g. --mde 0.1 for +10%.');\n if (!Number.isInteger(variants) || variants < 2) fail('INVALID_FLAG', '--variants must be a whole number of 2 or more.');\n const target = cloudTarget(flags);\n try {\n return await fetchPlan(target, { baseline, mde, variants });\n } catch (error) {\n if (error instanceof CliError && error.code === 'UNREACHABLE') fail('UNREACHABLE', `Planning a test needs SplitHub Cloud, and we can't reach ${target.url} right now.`, 'Check your connection and try again. No account needed.');\n if (error instanceof CliError && error.code === 'API_ERROR') fail('INVALID_FLAG', error.message, error.hint);\n throw error;\n }\n}\n\n/** `splithub plan --baseline 0.05 --mde 0.1 [--variants 2] [<id>]` */\nexport async function plan(id: string | undefined, flags: Flags): Promise<void> {\n const baseline = num(flags, 'baseline');\n const mde = num(flags, 'mde');\n if (baseline === undefined || mde === undefined) fail('USAGE', 'Pass --baseline (conversion rate today) and --mde (smallest lift worth finding).', 'For example: npx splithub plan --baseline 0.05 --mde 0.1');\n const p = await requestPlan(flags, baseline, mde, num(flags, 'variants') ?? 2);\n\n // With an experiment id: days at its current traffic, when its numbers are readable (signed in, or the app running).\n let traffic: { experiment: string; visitors: number; days: number; perDay: number; daysLeft: number | null } | null = null;\n if (id) {\n const data = await fetchStatus(resolveTarget(flags, detectProject())).catch(() => null);\n const row = data?.experiments.find((e) => e.experiment === id);\n if (data && !row) fail('EXPERIMENT_NOT_FOUND', `There's no experiment \"${id}\" in the results.`, 'See the ids with npx splithub status.');\n if (row) {\n const perDay = row.days > 0 ? row.visitors / row.days : 0;\n traffic = { experiment: id, visitors: row.visitors, days: row.days, perDay: Math.round(perDay), daysLeft: perDay > 0 ? Math.max(0, Math.ceil((p.total - row.visitors) / perDay)) : null };\n }\n }\n\n if (flags.json) {\n printJson({ ...p, traffic });\n return;\n }\n console.log(`${c.bold(p.perVariant.toLocaleString('en-US'))} visitors per variant, ${p.total.toLocaleString('en-US')} in all`);\n console.log(c.dim(`to find a ${(p.mde * 100).toFixed(0)}% lift on a ${(p.baseline * 100).toFixed(1)}% rate (${Math.round(p.confidence * 100)}% confidence, 80% power, safe to check daily)`));\n if (id && !traffic) console.log(c.dim(`Couldn't read ${id}'s traffic, so no days estimate. Sign in (npx splithub login) or start your app.`));\n if (traffic) {\n if (traffic.daysLeft === null) console.log(c.yellow(`${id} has no visitors yet, so there's no pace to go by.`));\n else if (traffic.daysLeft === 0) console.log(c.green(`${id} already has enough visitors (${traffic.visitors.toLocaleString('en-US')}).`));\n else console.log(`About ${traffic.daysLeft} more days for ${id} at ${traffic.perDay.toLocaleString('en-US')} visitors a day.`);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAQA,SAAS,IAAI,OAAc,MAAkC;AAC3D,QAAM,IAAI,MAAM,IAAI;AACpB,MAAI,OAAO,MAAM,YAAY,MAAM,GAAI,QAAO;AAC9C,QAAM,IAAI,OAAO,EAAE,QAAQ,MAAM,EAAE,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,MAAM;AACjE,MAAI,CAAC,OAAO,SAAS,CAAC,EAAG,MAAK,gBAAgB,KAAK,IAAI,KAAK,CAAC,mBAAmB;AAChF,SAAO;AACT;AAKA,eAAsB,YAAY,OAAc,UAAkB,KAAa,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VX.js";
|
|
10
|
+
import "./chunk-EJC4E3VD.js";
|
|
11
|
+
export {
|
|
12
|
+
configDiff,
|
|
13
|
+
pull,
|
|
14
|
+
push
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=push-3NDLL7US.js.map
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
findRefs
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-D7KVM4L7.js";
|
|
5
5
|
import {
|
|
6
6
|
loadConfig
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-6OXCLYOI.js";
|
|
8
8
|
import {
|
|
9
9
|
requireConfig
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-PLZRB3VX.js";
|
|
11
11
|
import {
|
|
12
12
|
c,
|
|
13
13
|
fail,
|
|
14
14
|
printJson
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-EJC4E3VD.js";
|
|
16
16
|
|
|
17
17
|
// src/commands/refs.ts
|
|
18
18
|
async function refs(id, flags) {
|
|
@@ -41,4 +41,4 @@ Another experiment also measures "${result.goal}": keep its track() calls.`));
|
|
|
41
41
|
export {
|
|
42
42
|
refs
|
|
43
43
|
};
|
|
44
|
-
//# sourceMappingURL=refs-
|
|
44
|
+
//# sourceMappingURL=refs-IWZ5GP7Q.js.map
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
findRefs
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-D7KVM4L7.js";
|
|
5
5
|
import {
|
|
6
6
|
loadConfig,
|
|
7
7
|
readSource,
|
|
8
8
|
removeExperiment,
|
|
9
9
|
writeConfigChecked
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-6OXCLYOI.js";
|
|
11
11
|
import {
|
|
12
12
|
archiveLive
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-ZND3T67D.js";
|
|
14
14
|
import {
|
|
15
15
|
requireConfig
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-PLZRB3VX.js";
|
|
17
17
|
import {
|
|
18
18
|
c,
|
|
19
19
|
fail,
|
|
20
20
|
printJson
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-EJC4E3VD.js";
|
|
22
22
|
|
|
23
23
|
// src/commands/remove.ts
|
|
24
24
|
import { relative } from "path";
|
|
@@ -51,4 +51,4 @@ export {
|
|
|
51
51
|
remove,
|
|
52
52
|
removeFromConfig
|
|
53
53
|
};
|
|
54
|
-
//# sourceMappingURL=remove-
|
|
54
|
+
//# sourceMappingURL=remove-YDJ7JTPR.js.map
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
fetchReport,
|
|
4
|
+
fetchResults,
|
|
5
|
+
fetchStatus,
|
|
6
|
+
isRawResults,
|
|
7
|
+
resolveTarget
|
|
8
|
+
} from "./chunk-ZND3T67D.js";
|
|
9
|
+
import {
|
|
10
|
+
detectProject
|
|
11
|
+
} from "./chunk-PLZRB3VX.js";
|
|
12
|
+
import {
|
|
13
|
+
pct,
|
|
14
|
+
printJson
|
|
15
|
+
} from "./chunk-EJC4E3VD.js";
|
|
16
|
+
|
|
17
|
+
// src/commands/report.ts
|
|
18
|
+
var cell = (s) => s.replace(/\|/g, "\\|").replace(/\n/g, " ");
|
|
19
|
+
var title = (id) => id === "__holdout" ? "Holdout: long-term impact" : `\`${cell(id)}\``;
|
|
20
|
+
function rawReportMarkdown(data, details) {
|
|
21
|
+
const out = [`### SplitHub \xB7 ${cell(data.project)}`, ""];
|
|
22
|
+
if (data.experiments.length === 0) {
|
|
23
|
+
out.push("No experiments yet. Run `npx splithub create` in your app.");
|
|
24
|
+
return out.join("\n");
|
|
25
|
+
}
|
|
26
|
+
out.push("| Experiment | Status | Visitors | Days |", "|---|---|---:|---:|");
|
|
27
|
+
for (const r of data.experiments) out.push(`| ${title(r.experiment)} | ${r.status} | ${r.visitors.toLocaleString("en-US")} | ${r.days || "\u2013"} |`);
|
|
28
|
+
for (const d of details) {
|
|
29
|
+
const revenue = d.variants.some((v) => v.revenue !== void 0);
|
|
30
|
+
out.push("", `#### ${title(d.experiment)} \xB7 goal \`${cell(d.goal ?? "none")}\``, "");
|
|
31
|
+
out.push(`| Variant | Visitors | Conversions | Rate |${revenue ? " Revenue |" : ""}`, `|---|---:|---:|---:|${revenue ? "---:|" : ""}`);
|
|
32
|
+
d.variants.forEach((v, i) => out.push(`| ${cell(v.variant)}${i === 0 ? " (control)" : ""} | ${v.visitors} | ${v.conversions} | ${pct(v.rate)} |${revenue ? ` ${v.revenue === void 0 ? "\u2013" : v.revenue.toFixed(2)} |` : ""}`));
|
|
33
|
+
}
|
|
34
|
+
const analysis = data.analysis ?? details[0]?.analysis;
|
|
35
|
+
if (analysis) out.push("", `_${analysis.message} [SplitHub Cloud](${analysis.url})_`);
|
|
36
|
+
return out.join("\n");
|
|
37
|
+
}
|
|
38
|
+
async function selfHostedReport(target, data) {
|
|
39
|
+
const worth = data.experiments.filter((e) => e.goal && (e.status === "running" || e.status === "finished" || e.status === "paused"));
|
|
40
|
+
const details = await Promise.all(worth.map((e) => fetchResults(target, e.experiment).catch(() => null)));
|
|
41
|
+
return { project: data.project, markdown: rawReportMarkdown(data, details.filter((d) => d !== null && isRawResults(d))) };
|
|
42
|
+
}
|
|
43
|
+
async function report(flags) {
|
|
44
|
+
const target = resolveTarget(flags, detectProject());
|
|
45
|
+
let out;
|
|
46
|
+
if (target.cloud) out = await fetchReport(target);
|
|
47
|
+
else {
|
|
48
|
+
const data = await fetchStatus(target);
|
|
49
|
+
out = data.analysis?.available === false ? await selfHostedReport(target, data) : await fetchReport(target);
|
|
50
|
+
}
|
|
51
|
+
if (flags.json) printJson({ project: out.project, markdown: out.markdown });
|
|
52
|
+
else console.log(out.markdown);
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
rawReportMarkdown,
|
|
56
|
+
report
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=report-JS7Z42FD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/report.ts"],"sourcesContent":["// `splithub report`: status and verdicts as Markdown, for a PR or issue comment\n// (the GitHub workflow from `ci init` posts it) or anywhere Markdown renders.\n// SplitHub Cloud writes the report; a self-hosted endpoint gets a raw-numbers table built here.\nimport { fetchReport, fetchResults, fetchStatus, isRawResults, resolveTarget, type RawResults, type StatusData, type Target } from '../api';\nimport { printJson } from '../errors';\nimport { detectProject } from '../project';\nimport { pct } from '../ui';\nimport type { Flags } from './init';\n\nconst cell = (s: string) => s.replace(/\\|/g, '\\\\|').replace(/\\n/g, ' ');\nconst title = (id: string) => (id === '__holdout' ? 'Holdout: long-term impact' : `\\`${cell(id)}\\``);\n\n/** Raw numbers only: no verdicts, which come with SplitHub Cloud. */\nexport function rawReportMarkdown(data: StatusData, details: RawResults[]): string {\n const out: string[] = [`### SplitHub · ${cell(data.project)}`, ''];\n if (data.experiments.length === 0) {\n out.push('No experiments yet. Run `npx splithub create` in your app.');\n return out.join('\\n');\n }\n out.push('| Experiment | Status | Visitors | Days |', '|---|---|---:|---:|');\n for (const r of data.experiments) out.push(`| ${title(r.experiment)} | ${r.status} | ${r.visitors.toLocaleString('en-US')} | ${r.days || '–'} |`);\n for (const d of details) {\n const revenue = d.variants.some((v) => v.revenue !== undefined);\n out.push('', `#### ${title(d.experiment)} · goal \\`${cell(d.goal ?? 'none')}\\``, '');\n out.push(`| Variant | Visitors | Conversions | Rate |${revenue ? ' Revenue |' : ''}`, `|---|---:|---:|---:|${revenue ? '---:|' : ''}`);\n d.variants.forEach((v, i) => out.push(`| ${cell(v.variant)}${i === 0 ? ' (control)' : ''} | ${v.visitors} | ${v.conversions} | ${pct(v.rate)} |${revenue ? ` ${v.revenue === undefined ? '–' : v.revenue.toFixed(2)} |` : ''}`));\n }\n const analysis = data.analysis ?? details[0]?.analysis;\n if (analysis) out.push('', `_${analysis.message} [SplitHub Cloud](${analysis.url})_`);\n return out.join('\\n');\n}\n\nasync function selfHostedReport(target: Target, data: StatusData): Promise<{ project: string; markdown: string }> {\n const worth = data.experiments.filter((e) => e.goal && (e.status === 'running' || e.status === 'finished' || e.status === 'paused'));\n const details = await Promise.all(worth.map((e) => fetchResults(target, e.experiment).catch(() => null)));\n return { project: data.project, markdown: rawReportMarkdown(data, details.filter((d): d is RawResults => d !== null && isRawResults(d))) };\n}\n\nexport async function report(flags: Flags): Promise<void> {\n const target = resolveTarget(flags, detectProject());\n let out: { project: string; markdown: string };\n if (target.cloud) out = await fetchReport(target);\n else {\n // --url can point at either kind of server: the status answer says which.\n const data = await fetchStatus(target);\n out = data.analysis?.available === false ? await selfHostedReport(target, data) : await fetchReport(target);\n }\n if (flags.json) printJson({ project: out.project, markdown: out.markdown });\n else console.log(out.markdown);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AASA,IAAM,OAAO,CAAC,MAAc,EAAE,QAAQ,OAAO,KAAK,EAAE,QAAQ,OAAO,GAAG;AACtE,IAAM,QAAQ,CAAC,OAAgB,OAAO,cAAc,8BAA8B,KAAK,KAAK,EAAE,CAAC;AAGxF,SAAS,kBAAkB,MAAkB,SAA+B;AACjF,QAAM,MAAgB,CAAC,qBAAkB,KAAK,KAAK,OAAO,CAAC,IAAI,EAAE;AACjE,MAAI,KAAK,YAAY,WAAW,GAAG;AACjC,QAAI,KAAK,4DAA4D;AACrE,WAAO,IAAI,KAAK,IAAI;AAAA,EACtB;AACA,MAAI,KAAK,6CAA6C,qBAAqB;AAC3E,aAAW,KAAK,KAAK,YAAa,KAAI,KAAK,KAAK,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,MAAM,MAAM,EAAE,SAAS,eAAe,OAAO,CAAC,MAAM,EAAE,QAAQ,QAAG,IAAI;AAChJ,aAAW,KAAK,SAAS;AACvB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M,YAAY,MAAM;AAAA,OAC3C;AAEH,UAAM,OAAO,MAAM,YAAY,MAAM;AACrC,UAAM,KAAK,UAAU,cAAc,QAAQ,MAAM,iBAAiB,QAAQ,IAAI,IAAI,MAAM,YAAY,MAAM;AAAA,EAC5G;AACA,MAAI,MAAM,KAAM,WAAU,EAAE,SAAS,IAAI,SAAS,UAAU,IAAI,SAAS,CAAC;AAAA,MACrE,SAAQ,IAAI,IAAI,QAAQ;AAC/B;","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
HOLDOUT,
|
|
4
|
+
analysisLine,
|
|
5
|
+
metricsText,
|
|
6
|
+
results
|
|
7
|
+
} from "./chunk-VKLZJRYW.js";
|
|
8
|
+
import "./chunk-ZND3T67D.js";
|
|
9
|
+
import "./chunk-PLZRB3VX.js";
|
|
10
|
+
import "./chunk-EJC4E3VD.js";
|
|
11
|
+
export {
|
|
12
|
+
HOLDOUT,
|
|
13
|
+
analysisLine,
|
|
14
|
+
metricsText,
|
|
15
|
+
results
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=results-HCXQH7IY.js.map
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
apiError,
|
|
4
4
|
requireCloudToken
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-ZND3T67D.js";
|
|
6
6
|
import {
|
|
7
7
|
c
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-EJC4E3VD.js";
|
|
9
9
|
|
|
10
10
|
// src/commands/review.ts
|
|
11
11
|
async function review(key, flags) {
|
|
@@ -31,4 +31,4 @@ async function review(key, flags) {
|
|
|
31
31
|
export {
|
|
32
32
|
review
|
|
33
33
|
};
|
|
34
|
-
//# sourceMappingURL=review-
|
|
34
|
+
//# sourceMappingURL=review-BGGNVL6L.js.map
|