splithub 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/{analytics-TRB4FPA5.js → analytics-BVBZVSCN.js} +8 -4
  2. package/dist/{chunk-SPXUP3WA.js → chunk-7DFMYJTC.js} +33 -7
  3. package/dist/chunk-7DFMYJTC.js.map +1 -0
  4. package/dist/{chunk-BEQ74VTG.js → chunk-NYWJZKOO.js} +2 -2
  5. package/dist/{chunk-MIHX7XYV.js → chunk-OXVLWFSD.js} +9 -6
  6. package/dist/chunk-OXVLWFSD.js.map +1 -0
  7. package/dist/{chunk-EVTPXMLO.js → chunk-U7Z5VYNX.js} +13 -8
  8. package/dist/chunk-U7Z5VYNX.js.map +1 -0
  9. package/dist/{chunk-QBQKQH6S.js → chunk-VVJ4WRAB.js} +2 -2
  10. package/dist/{chunk-FOHCW2J3.js → chunk-VY342F4X.js} +3 -3
  11. package/dist/{chunk-F5ESBFEN.js → chunk-WMZLKY6J.js} +2 -2
  12. package/dist/{connect-TCBFW2NT.js → connect-BVXKCJNO.js} +11 -6
  13. package/dist/connect-BVXKCJNO.js.map +1 -0
  14. package/dist/{create-GM5H72LW.js → create-IBVKGS3D.js} +3 -3
  15. package/dist/index.js +12 -10
  16. package/dist/index.js.map +1 -1
  17. package/dist/{init-WHK4EV37.js → init-HRCQ5WAA.js} +4 -4
  18. package/dist/{menu-QYXFUWNE.js → menu-7EZD5NDF.js} +8 -8
  19. package/dist/{push-UV4O66QR.js → push-L2IRGUDM.js} +2 -2
  20. package/dist/{remove-PYYPRP3R.js → remove-PVVTBBWX.js} +3 -2
  21. package/dist/remove-PVVTBBWX.js.map +1 -0
  22. package/dist/{ship-3TDWAQIJ.js → ship-UP6DLCJN.js} +3 -2
  23. package/dist/ship-UP6DLCJN.js.map +1 -0
  24. package/dist/{skills-LVIFTOTI.js → skills-J6X6DULX.js} +3 -3
  25. package/package.json +3 -3
  26. package/dist/chunk-EVTPXMLO.js.map +0 -1
  27. package/dist/chunk-MIHX7XYV.js.map +0 -1
  28. package/dist/chunk-SPXUP3WA.js.map +0 -1
  29. package/dist/connect-TCBFW2NT.js.map +0 -1
  30. package/dist/remove-PYYPRP3R.js.map +0 -1
  31. package/dist/ship-3TDWAQIJ.js.map +0 -1
  32. /package/dist/{analytics-TRB4FPA5.js.map → analytics-BVBZVSCN.js.map} +0 -0
  33. /package/dist/{chunk-BEQ74VTG.js.map → chunk-NYWJZKOO.js.map} +0 -0
  34. /package/dist/{chunk-QBQKQH6S.js.map → chunk-VVJ4WRAB.js.map} +0 -0
  35. /package/dist/{chunk-FOHCW2J3.js.map → chunk-VY342F4X.js.map} +0 -0
  36. /package/dist/{chunk-F5ESBFEN.js.map → chunk-WMZLKY6J.js.map} +0 -0
  37. /package/dist/{create-GM5H72LW.js.map → create-IBVKGS3D.js.map} +0 -0
  38. /package/dist/{init-WHK4EV37.js.map → init-HRCQ5WAA.js.map} +0 -0
  39. /package/dist/{menu-QYXFUWNE.js.map → menu-7EZD5NDF.js.map} +0 -0
  40. /package/dist/{push-UV4O66QR.js.map → push-L2IRGUDM.js.map} +0 -0
  41. /package/dist/{skills-LVIFTOTI.js.map → skills-J6X6DULX.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  analytics
4
- } from "./chunk-SPXUP3WA.js";
4
+ } from "./chunk-7DFMYJTC.js";
5
5
  import {
6
6
  domains
7
7
  } from "./chunk-CAFWOX3S.js";
@@ -234,4 +234,4 @@ export {
234
234
  analyticsMenu,
235
235
  domainsMenu
236
236
  };
237
- //# sourceMappingURL=chunk-F5ESBFEN.js.map
237
+ //# sourceMappingURL=chunk-WMZLKY6J.js.map
@@ -2,10 +2,12 @@
2
2
  import {
3
3
  propertyChoices,
4
4
  propertySnippets
5
- } from "./chunk-F5ESBFEN.js";
5
+ } from "./chunk-WMZLKY6J.js";
6
6
  import {
7
- addProperty
8
- } from "./chunk-SPXUP3WA.js";
7
+ addProperty,
8
+ afterAdded,
9
+ printLive
10
+ } from "./chunk-7DFMYJTC.js";
9
11
  import "./chunk-CAFWOX3S.js";
10
12
  import "./chunk-FDSNZRQQ.js";
11
13
  import {
@@ -146,6 +148,7 @@ async function connect(given, flags) {
146
148
  const name = str(flags.name);
147
149
  let key = given;
148
150
  let created = false;
151
+ let live = "skipped";
149
152
  if (!key && !name) {
150
153
  if (interactive) {
151
154
  const picked = await p.select({
@@ -169,25 +172,27 @@ async function connect(given, flags) {
169
172
  label = typed.trim() || project.name;
170
173
  }
171
174
  key ??= newPropertyId();
172
- await addProperty(key, { ...flags, name: label ?? (given ? void 0 : project.name) });
175
+ live = (await addProperty(key, { ...flags, name: label ?? (given ? void 0 : project.name) })).live;
173
176
  created = true;
174
177
  }
175
178
  const wired = wireProvider(project.root, key, Boolean(flags.force));
176
179
  const publicKey = typeof config.storage.key === "string" && String(config.storage.key).startsWith("pk_") ? String(config.storage.key) : null;
177
180
  const snippets = trackSnippets(project.framework, key, publicKey);
178
181
  const configFile = relative(project.root, project.configFile);
179
- const next = [...created && cloud ? ["npx splithub push"] : [], "deploy the app (development never sends to the cloud)", cloud ? `npx splithub analytics realtime ${key}` : `npx splithub analytics ${key}`];
182
+ const next = [...created ? afterAdded(cloud, live) : [], "deploy the app (development never sends to the cloud)", cloud ? `npx splithub analytics realtime ${key}` : `npx splithub analytics ${key}`];
180
183
  if (flags.json)
181
184
  return printJson({
182
185
  property: key,
183
186
  created,
184
187
  configFile: created ? configFile : null,
188
+ live: created ? live : null,
185
189
  wired,
186
190
  snippets,
187
191
  next
188
192
  });
189
193
  const ok = (s) => console.log(`${c.green("\u2714")} ${s}`);
190
194
  ok(created ? `property ${c.bold(key)} added to ${c.dim(configFile)}` : `using property ${c.bold(key)}`);
195
+ if (created) printLive(cloud, live);
191
196
  if (wired.status === "added") ok(`named on the provider in ${c.dim(`${wired.file}:${wired.line}`)}`);
192
197
  else if (wired.status === "already") ok(`already named on the provider in ${c.dim(`${wired.file}:${wired.line}`)}`);
193
198
  else if (wired.status === "other") console.log(c.yellow(`! ${wired.file}:${wired.line} already sends to ${wired.current}. Run again with --force to switch to ${key}.`));
@@ -217,4 +222,4 @@ export {
217
222
  wireProvider,
218
223
  wireSource
219
224
  };
220
- //# sourceMappingURL=connect-TCBFW2NT.js.map
225
+ //# sourceMappingURL=connect-BVXKCJNO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/connect.ts"],"sourcesContent":["// splithub analytics connect — set up analytics in this app the way `init` sets up experiments:\n// pick (or create) a property, name it on the app's SplitHub provider, show how to send events.\n//\n// splithub analytics connect pick one, or create one when there is none\n// splithub analytics connect sh-x1h78w use this property (added to the config when it is new)\n// splithub analytics connect --name \"Site\" create a new one\n// --force replace another property already named on the provider\n//\n// React / Next.js: `property=\"sh-…\"` is added to the one <SplitHubProvider> / <SplitHubNextProvider>\n// found in the code. Anything else: the sh.js tag to paste. Self-hosted projects keep their properties\n// in splithub.config.ts; the cloud also knows the ones made in the dashboard.\nimport * as p from '@clack/prompts';\nimport { newPropertyId } from '@splithub/core';\nimport { readFileSync, writeFileSync } from 'node:fs';\nimport { relative } from 'node:path';\nimport { cloudTarget, request } from '../api';\nimport { loadConfig } from '../config-file';\nimport { fail, printJson } from '../errors';\nimport { listSourceFiles, requireConfig, type Framework } from '../project';\nimport { c } from '../ui';\nimport { addProperty, afterAdded, printLive } from './analytics';\nimport { str } from './analytics-reports';\nimport type { Flags } from './init';\nimport { propertyChoices, propertySnippets, type PropertyChoice } from './menu-analytics';\n\nexport type WireStatus = 'added' | 'already' | 'other' | 'none' | 'many';\nexport interface WireResult {\n status: WireStatus;\n file?: string;\n line?: number;\n /** The property already named on the provider (status other / already). */\n current?: string;\n /** Every provider found (status many). */\n files?: string[];\n}\n\nconst PROVIDER = /<SplitHub(?:Next)?Provider\\b/g;\n\n/** The opening tag starting at `start`: up to the first `>` outside braces and strings. */\nfunction tagEnd(src: string, start: number): number {\n let depth = 0;\n let quote: string | null = null;\n for (let i = start; i < src.length; i++) {\n const ch = src[i]!;\n if (quote) {\n if (ch === quote && src[i - 1] !== '\\\\') quote = null;\n } else if (ch === '\"' || ch === \"'\" || ch === '`') quote = ch;\n else if (ch === '{') depth++;\n else if (ch === '}') depth--;\n else if (ch === '>' && depth === 0) return i;\n }\n return -1;\n}\n\n/**\n * Names `key` on the provider in `src`: `property=\"key\"` right after the component name. Returns the\n * new source (null when nothing changes) and what it found. Pure, so it is tested without files.\n */\nexport function wireSource(\n src: string,\n key: string,\n force = false\n): {\n source: string | null;\n status: Exclude<WireStatus, 'none' | 'many'>;\n current?: string;\n index: number;\n} | null {\n const hits = [...src.matchAll(PROVIDER)];\n if (hits.length !== 1) return null;\n const at = hits[0]!.index!;\n const end = tagEnd(src, at);\n if (end < 0) return null;\n const tag = src.slice(at, end);\n const existing = /\\sproperty=(?:\\{\\s*)?([\"'`])([^\"'`]*)\\1(?:\\s*\\})?|\\sproperty=\\{[^}]*\\}/.exec(tag);\n if (existing) {\n const current = existing[2] ?? existing[0].trim().slice('property='.length);\n if (current === key) return { source: null, status: 'already', current, index: at };\n if (!force) return { source: null, status: 'other', current, index: at };\n const from = at + existing.index;\n return {\n source: `${src.slice(0, from)} property=\"${key}\"${src.slice(from + existing[0].length)}`,\n status: 'added',\n current,\n index: at,\n };\n }\n const name = at + hits[0]![0].length;\n return {\n source: `${src.slice(0, name)} property=\"${key}\"${src.slice(name)}`,\n status: 'added',\n index: at,\n };\n}\n\n/** Finds the app's SplitHub provider and names the property on it. */\nexport function wireProvider(root: string, key: string, force = false): WireResult {\n const found: Array<{ file: string; src: string; count: number }> = [];\n for (const file of listSourceFiles(root)) {\n if (!/\\.(tsx|jsx)$/.test(file)) continue;\n let src: string;\n try {\n src = readFileSync(file, 'utf8');\n } catch {\n continue;\n }\n const count = [...src.matchAll(PROVIDER)].length;\n if (count) found.push({ file, src, count });\n }\n const rel = (f: string) => relative(root, f).replace(/\\\\/g, '/');\n if (found.length === 0) return { status: 'none' };\n if (found.length > 1 || found[0]!.count > 1) return { status: 'many', files: found.map((f) => rel(f.file)) };\n const { file, src } = found[0]!;\n const out = wireSource(src, key, force);\n if (!out) return { status: 'many', files: [rel(file)] };\n const line = src.slice(0, out.index).split('\\n').length;\n if (out.source !== null) writeFileSync(file, out.source, 'utf8');\n return {\n status: out.status,\n file: rel(file),\n line,\n ...(out.current ? { current: out.current } : {}),\n };\n}\n\n/** How to send events once the property is named, per setup. */\nexport function trackSnippets(framework: Framework, key: string, publicKey?: string | null): { provider: string; script: string; track: string; identify: string } {\n const s = propertySnippets(key, publicKey);\n const provider = framework === 'next' ? s.provider.replace('<SplitHubProvider', '<SplitHubNextProvider') : s.provider;\n return {\n provider,\n script: s.script,\n track: `import { useTrack } from '@splithub/react';\\n\\nconst track = useTrack();\\ntrack('Signup', { plan: 'pro' }); // any name; props are optional`,\n identify: `import { useIdentify } from '@splithub/react';\\n\\nconst identify = useIdentify();\\nidentify(user.id, { plan: 'pro' }); // after sign-in; identify(null) on sign-out`,\n };\n}\n\nasync function knownProperties(flags: Flags, configFile: string, cloud: boolean): Promise<PropertyChoice[]> {\n const config = await loadConfig(configFile);\n const local = (config.properties ?? []).map((prop) => ({\n value: prop.key,\n label: prop.name ? `${prop.name} (${prop.key})` : prop.key,\n hint: prop.status,\n status: prop.status,\n }));\n if (!cloud) return local;\n const t = cloudTarget(flags);\n if (!t.token) return local;\n try {\n const remote = propertyChoices(await request<{ properties: Array<Record<string, unknown>> }>(t, '/properties'));\n return [...remote, ...local.filter((l) => !remote.some((r) => r.value === l.value))];\n } catch {\n return local;\n }\n}\n\nexport async function connect(given: string | undefined, flags: Flags): Promise<void> {\n const project = requireConfig();\n const config = await loadConfig(project.configFile);\n const cloud = config.storage.mode === 'cloud';\n const interactive = !flags.json && !flags.yes && process.stdin.isTTY && process.stdout.isTTY;\n const known = await knownProperties(flags, project.configFile, cloud);\n const name = str(flags.name);\n\n let key = given;\n let created = false;\n let live = 'skipped';\n if (!key && !name) {\n if (interactive) {\n const picked = await p.select<string>({\n message: 'Which property should this app send to?',\n options: [...known.map(({ value, label, hint }) => ({ value, label, hint })), { value: '__new', label: 'Create a new property' }],\n });\n if (p.isCancel(picked)) return;\n if (picked !== '__new') key = picked;\n } else if (known.length === 1) key = known[0]!.value;\n else if (known.length > 1) fail('USAGE', `This project has ${known.length} properties: ${known.map((k) => k.value).join(', ')}.`, 'Pick one: npx splithub analytics connect <id>, or create one with --name \"Site\".');\n }\n if (!key || !known.some((k) => k.value === key)) {\n let label = name;\n if (!label && !key && interactive) {\n const typed = await p.text({\n message: 'Name of the property',\n placeholder: project.name,\n defaultValue: project.name,\n });\n if (p.isCancel(typed)) return;\n label = typed.trim() || project.name;\n }\n key ??= newPropertyId();\n live = (await addProperty(key, { ...flags, name: label ?? (given ? undefined : project.name) })).live;\n created = true;\n }\n\n const wired = wireProvider(project.root, key, Boolean(flags.force));\n const publicKey = typeof (config.storage as { key?: unknown }).key === 'string' && String((config.storage as { key?: unknown }).key).startsWith('pk_') ? String((config.storage as { key: string }).key) : null;\n const snippets = trackSnippets(project.framework, key, publicKey);\n const configFile = relative(project.root, project.configFile);\n const next = [...(created ? afterAdded(cloud, live) : []), 'deploy the app (development never sends to the cloud)', cloud ? `npx splithub analytics realtime ${key}` : `npx splithub analytics ${key}`];\n if (flags.json)\n return printJson({\n property: key,\n created,\n configFile: created ? configFile : null,\n live: created ? live : null,\n wired,\n snippets,\n next,\n });\n\n const ok = (s: string) => console.log(`${c.green('✔')} ${s}`);\n ok(created ? `property ${c.bold(key)} added to ${c.dim(configFile)}` : `using property ${c.bold(key)}`);\n if (created) printLive(cloud, live);\n if (wired.status === 'added') ok(`named on the provider in ${c.dim(`${wired.file}:${wired.line}`)}`);\n else if (wired.status === 'already') ok(`already named on the provider in ${c.dim(`${wired.file}:${wired.line}`)}`);\n else if (wired.status === 'other') console.log(c.yellow(`! ${wired.file}:${wired.line} already sends to ${wired.current}. Run again with --force to switch to ${key}.`));\n else if (wired.status === 'many') console.log(c.yellow(`! More than one SplitHub provider (${wired.files?.join(', ')}): add property=\"${key}\" to the one that wraps the app.`));\n else if (project.framework === 'unknown') console.log(`\\nPaste this into the <head> of every page:\\n ${c.cyan(snippets.script)}`);\n else console.log(`\\nNo SplitHub provider in the code yet. Wrap the app once:\\n ${c.cyan(snippets.provider)}\\nNo SDK? The script tag works too:\\n ${c.cyan(snippets.script)}`);\n console.log(`\\n${c.bold('Send events')} ${c.dim('(pageviews are sent for you)')}`);\n if (project.framework === 'unknown' && wired.status === 'none') console.log(` ${c.cyan(\"window.splithub.track('Signup', { plan: 'pro' })\")}`);\n else\n console.log(\n snippets.track\n .split('\\n')\n .map((l) => ` ${c.cyan(l)}`)\n .join('\\n')\n );\n console.log(c.dim(`\\nTie visits to your users: useIdentify() (sh.js: splithub.identify(id)). Mark an event as a goal to count it as a conversion.`));\n console.log(c.dim(`Next: ${next.join(', then ')}.`));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,YAAY,OAAO;AACnB,SAAS,qBAAqB;AAC9B,SAAS,cAAc,qBAAqB;AAC5C,SAAS,gBAAgB;AAsBzB,IAAM,WAAW;AAGjB,SAAS,OAAO,KAAa,OAAuB;AAClD,MAAI,QAAQ;AACZ,MAAI,QAAuB;AAC3B,WAAS,IAAI,OAAO,IAAI,IAAI,QAAQ,KAAK;AACvC,UAAM,KAAK,IAAI,CAAC;AAChB,QAAI,OAAO;AACT,UAAI,OAAO,SAAS,IAAI,IAAI,CAAC,MAAM,KAAM,SAAQ;AAAA,IACnD,WAAW,OAAO,OAAO,OAAO,OAAO,OAAO,IAAK,SAAQ;AAAA,aAClD,OAAO,IAAK;AAAA,aACZ,OAAO,IAAK;AAAA,aACZ,OAAO,OAAO,UAAU,EAAG,QAAO;AAAA,EAC7C;AACA,SAAO;AACT;AAMO,SAAS,WACd,KACA,KACA,QAAQ,OAMD;AACP,QAAM,OAAO,CAAC,GAAG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AM,WAAW,OAAQ,SAAQ,IAAI,KAAK,EAAE,KAAK,kDAAkD,CAAC,EAAE;AAAA;AAE3I,YAAQ;AAAA,MACN,SAAS,MACN,MAAM,IAAI,EACV,IAAI,CAAC,MAAM,KAAK,EAAE,KAAK,CAAC,CAAC,EAAE,EAC3B,KAAK,IAAI;AAAA,IACd;AACF,UAAQ,IAAI,EAAE,IAAI;AAAA,6HAAgI,CAAC;AACnJ,UAAQ,IAAI,EAAE,IAAI,SAAS,KAAK,KAAK,SAAS,CAAC,GAAG,CAAC;AACrD;","names":["file","src"]}
@@ -4,9 +4,9 @@ import {
4
4
  parseExtras,
5
5
  parseLimits,
6
6
  parseWeights
7
- } from "./chunk-QBQKQH6S.js";
7
+ } from "./chunk-VVJ4WRAB.js";
8
8
  import "./chunk-ILEPMQNT.js";
9
- import "./chunk-MIHX7XYV.js";
9
+ import "./chunk-OXVLWFSD.js";
10
10
  import "./chunk-MUDDASN6.js";
11
11
  import "./chunk-ZISCJRR5.js";
12
12
  export {
@@ -15,4 +15,4 @@ export {
15
15
  parseLimits,
16
16
  parseWeights
17
17
  };
18
- //# sourceMappingURL=create-GM5H72LW.js.map
18
+ //# sourceMappingURL=create-IBVKGS3D.js.map
package/dist/index.js CHANGED
@@ -40,7 +40,7 @@ Experiments
40
40
  Analytics
41
41
  splithub analytics connect pick or create a property and name it on the app's provider (or get the sh.js tag); [<id>] [--name "Site"] [--force]
42
42
  splithub analytics [<id>] every property, or one: visitors, pages, sources, events, goals (--by page|source|channel|country|event|goal|variant --experiment <key>|trait --key <name>, --days 7, --from --to, --filter country=DE, --compare [year|<from>..<to>])
43
- splithub analytics create --name "Site" add a property (id generated, like sh-x1h78w); pause|resume|archive|restore|remove|events <id>
43
+ splithub analytics create --name "Site" add a property (id generated, like sh-x1h78w; live in the cloud at once, no push); pause|resume|archive|restore|remove|events <id>
44
44
  splithub analytics funnel <id> --steps "page:/,event:Signup,goal:paid" visitors per step, conversion, drop-off (--within visit|7d|30d, --by <dimension>)
45
45
  splithub analytics paths <id> --page /pricing [--prev] where visitors go next (or came from)
46
46
  splithub analytics retention <id> who comes back, per weekly cohort (--start visit|event:<name>|goal:<key>, --return visit|event:<name>, --period day|week)
@@ -61,6 +61,7 @@ Notes, links, alerts, domains (SplitHub Cloud)
61
61
 
62
62
  Project
63
63
  splithub push [--dry-run] upload splithub.config.ts to SplitHub Cloud (--dry-run: check and show what would change)
64
+ experiments the cloud has that the file lacks are kept; --prune removes them
64
65
  a key that already belonged to another experiment stops the push: --replace <keys> (new experiment, old numbers cleared) or --same <keys> (same experiment, numbers stay)
65
66
  splithub pull show the config stored in the cloud
66
67
  splithub report status and verdicts as Markdown, raw numbers when self-hosted (used by the GitHub workflow)
@@ -142,6 +143,7 @@ async function main() {
142
143
  project: { type: "string" },
143
144
  keep: { type: "string" },
144
145
  "dry-run": { type: "boolean", default: false },
146
+ prune: { type: "boolean", default: false },
145
147
  baseline: { type: "string" },
146
148
  mde: { type: "string" },
147
149
  "github-action": { type: "boolean", default: false },
@@ -203,15 +205,15 @@ async function main() {
203
205
  return;
204
206
  }
205
207
  if (!command) {
206
- if (process.stdin.isTTY && process.stdout.isTTY && !values.json) return (await import("./menu-QYXFUWNE.js")).menu(values);
208
+ if (process.stdin.isTTY && process.stdout.isTTY && !values.json) return (await import("./menu-7EZD5NDF.js")).menu(values);
207
209
  console.log(HELP.trimEnd());
208
210
  return;
209
211
  }
210
212
  switch (command) {
211
213
  case "init":
212
- return (await import("./init-WHK4EV37.js")).init(values);
214
+ return (await import("./init-HRCQ5WAA.js")).init(values);
213
215
  case "create":
214
- return (await import("./create-GM5H72LW.js")).create(values);
216
+ return (await import("./create-IBVKGS3D.js")).create(values);
215
217
  case "start":
216
218
  case "pause":
217
219
  case "finish":
@@ -227,9 +229,9 @@ async function main() {
227
229
  case "refs":
228
230
  return (await import("./refs-5DTSKMXU.js")).refs(arg, values);
229
231
  case "remove":
230
- return (await import("./remove-PYYPRP3R.js")).remove(arg, values);
232
+ return (await import("./remove-PVVTBBWX.js")).remove(arg, values);
231
233
  case "ship":
232
- return (await import("./ship-3TDWAQIJ.js")).ship(arg, values);
234
+ return (await import("./ship-UP6DLCJN.js")).ship(arg, values);
233
235
  case "report":
234
236
  return (await import("./report-JVMKVZTS.js")).report(values);
235
237
  case "ci":
@@ -239,7 +241,7 @@ async function main() {
239
241
  return (await import("./holdout-JJEP6673.js")).holdout(arg, third, values);
240
242
  case "analytics":
241
243
  case "properties":
242
- return (await import("./analytics-TRB4FPA5.js")).analytics(positionals.slice(1), values);
244
+ return (await import("./analytics-BVBZVSCN.js")).analytics(positionals.slice(1), values);
243
245
  case "notes":
244
246
  return (await import("./notes-BASGWNNX.js")).notes(positionals.slice(1), values);
245
247
  case "links":
@@ -257,11 +259,11 @@ async function main() {
257
259
  case "update":
258
260
  return (await import("./update-XF7HWJ3A.js")).update(values);
259
261
  case "skills":
260
- return (await import("./skills-LVIFTOTI.js")).skills(values);
262
+ return (await import("./skills-J6X6DULX.js")).skills(values);
261
263
  case "push":
262
- return (await import("./push-UV4O66QR.js")).push(values);
264
+ return (await import("./push-L2IRGUDM.js")).push(values);
263
265
  case "pull":
264
- return (await import("./push-UV4O66QR.js")).pull(values);
266
+ return (await import("./push-L2IRGUDM.js")).pull(values);
265
267
  case "login":
266
268
  return (await import("./login-OT77MNKL.js")).login(values);
267
269
  case "logout":
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')} — experiments and analytics for agent-built apps\n\nUsage\n splithub the menu: experiments, analytics, links, alerts, notes, domains — pick what you need\n\nExperiments\n splithub init set up config, framework files, agent docs\n splithub create add an experiment (wizard, or flags for agents); its goal can be any event you track()\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 a slice: --from --to (first-exposure days) --filter country=DE (country, region, city, device, os, browser,\n language, host, source, channel, utm_*, landing); one view: --by <dimension> (lift per segment),\n --timeline (per day), --engagement (bounce, visit length per variant), --events (every goal and event\n per variant, lift vs control); --export with --by <dimension> or --events writes CSV\n splithub events --experiment <id> latest raw events of an experiment (--type exposure|goal, --limit 50, --before <ms>, --from --to, --filter)\n splithub plan visitors an experiment 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 experiment 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\nAnalytics\n splithub analytics connect pick or create a property and name it on the app's provider (or get the sh.js tag); [<id>] [--name \"Site\"] [--force]\n splithub analytics [<id>] every property, or one: visitors, pages, sources, events, goals (--by page|source|channel|country|event|goal|variant --experiment <key>|trait --key <name>, --days 7, --from --to, --filter country=DE, --compare [year|<from>..<to>])\n splithub analytics create --name \"Site\" add a property (id generated, like sh-x1h78w); pause|resume|archive|restore|remove|events <id>\n splithub analytics funnel <id> --steps \"page:/,event:Signup,goal:paid\" visitors per step, conversion, drop-off (--within visit|7d|30d, --by <dimension>)\n splithub analytics paths <id> --page /pricing [--prev] where visitors go next (or came from)\n splithub analytics retention <id> who comes back, per weekly cohort (--start visit|event:<name>|goal:<key>, --return visit|event:<name>, --period day|week)\n splithub analytics realtime|props|export <id> visitors now; an event's props (--event <name> [--key <prop>]); CSV to stdout (--by <dimension>|day, --raw)\n splithub analytics segments saved filters: --save <name> country=DE ..., --delete <id|name>; any report takes --segment <name>\n\nNotes, links, alerts, domains (SplitHub Cloud)\n splithub notes what happened on a day (--experiment <key> | --property <id>, --kind note|issue|win, --days 30)\n splithub notes add \"<text>\" [--kind issue|win] [--experiment <key> | --property <id>] [--day YYYY-MM-DD]; notes edit <id> \"<text>\", notes delete <id>\n splithub links short links and their clicks; links <id|slug> for one link's clicks\n splithub links create <url> [<url> ...] [--slug spring] [--name \"Spring sale\"] [--weights 70,30]; links edit|pause|resume|delete <id|slug>\n splithub alerts alert rules (they run on Pro) and recent alerts; alerts enable|disable|delete|test <id>\n splithub alerts add <condition> srm | winner | loser --lift 10 | exposures --visitors N | conversions --conversions N | duration --days N | no_events --hours 24\n | quota --percent 80 | usage --every 1000 | traffic_drop|traffic_spike --property <id> --percent 50\n | goal_silent --property <id> --goal <key> --hours 24 | event_count --property <id> [--event <name>] --count N [--repeat]\n (--experiment <key>, --name, --cooldown <hours>, --disabled, --pause, --finish, --drop-loser)\n splithub domains which domains may send events, per experiment and property; domains set experiment|property <id> <domain...>, domains clear experiment|property <id>\n\nProject\n splithub push [--dry-run] upload splithub.config.ts to SplitHub Cloud (--dry-run: check and show what would change)\n a key that already belonged to another experiment stops the push: --replace <keys> (new experiment, old numbers cleared) or --same <keys> (same experiment, numbers stay)\n splithub pull show the config stored in the cloud\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, analytics, 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\ncreate flags\n --kind value|component|redirect|mvt --id <key> --goal <goal> --status running|draft --name \"Hero headline\" --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 (experiments 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 // `--compare` alone means the period right before; it takes a value only when one follows (year, previous, from..to).\n const args = process.argv.slice(2).map((a, i, all) => (a === '--compare' && !/^(previous|year)$|\\.\\./.test(all[i + 1] ?? '') ? '--compare=previous' : a));\n const { values, positionals } = parseArgs({\n args,\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 name: { type: 'string' },\n replace: { type: 'string' },\n same: { 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 goals: { type: 'string' },\n by: { type: 'string' },\n days: { type: 'string' },\n from: { type: 'string' },\n filter: { type: 'string', multiple: true },\n limit: { type: 'string' },\n compare: { type: 'string' },\n segment: { type: 'string' },\n steps: { type: 'string' },\n within: { type: 'string' },\n page: { type: 'string' },\n prev: { type: 'boolean', default: false },\n return: { type: 'string' },\n period: { type: 'string' },\n event: { type: 'string' },\n raw: { type: 'boolean', default: false },\n save: { type: 'string' },\n delete: { type: 'string' },\n day: { type: 'string' },\n property: { type: 'string' },\n experiment: { type: 'string' },\n slug: { type: 'string' },\n every: { type: 'string' },\n count: { type: 'string' },\n percent: { type: 'string' },\n hours: { type: 'string' },\n visitors: { type: 'string' },\n conversions: { type: 'string' },\n lift: { type: 'string' },\n 'min-visitors': { type: 'string' },\n cooldown: { type: 'string' },\n repeat: { type: 'boolean', default: false },\n disabled: { type: 'boolean', default: false },\n pause: { type: 'boolean', default: false },\n finish: { type: 'boolean', default: false },\n 'drop-loser': { type: 'boolean', default: false },\n timeline: { type: 'boolean', default: false },\n engagement: { type: 'boolean', default: false },\n events: { type: 'boolean', default: false },\n export: { type: 'boolean', default: false },\n type: { type: 'string' },\n before: { 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 'events':\n return (await import('./commands/experiment-reports')).experimentEvents(typeof values.experiment === 'string' ? values.experiment : 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 'analytics':\n case 'properties':\n return (await import('./commands/analytics')).analytics(positionals.slice(1), values);\n case 'notes':\n return (await import('./commands/notes')).notes(positionals.slice(1), values);\n case 'links':\n return (await import('./commands/links')).links(positionals.slice(1), values);\n case 'alerts':\n return (await import('./commands/alerts')).alerts(positionals.slice(1), values);\n case 'domains':\n return (await import('./commands/domains')).domains(positionals.slice(1), 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.scope && !body.error.includes(body.scope)) console.error(c.dim(`Missing scope: ${body.scope}`));\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;A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AAG,SAAQ,IAAI,KAAK,UAAU,IAAI,CAAC;AAAA,OAChE;AACH,YAAQ,MAAM,EAAE,IAAI,UAAU,KAAK,KAAK,EAAE,CAAC;AAC3C,QAAI,KAAK,SAAS,CAAC,KAAK,MAAM,SAAS,KAAK,KAAK,EAAG,SAAQ,MAAM,EAAE,IAAI,kBAAkB,KAAK,KAAK,EAAE,CAAC;AACvG,QAAI,KAAK,KAAM,SAAQ,MAAM,EAAE,IAAI,KAAK,IAAI,CAAC;AAAA,EAC/C;AACA,UAAQ,KAAK,CAAC;AAChB,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')} — experiments and analytics for agent-built apps\n\nUsage\n splithub the menu: experiments, analytics, links, alerts, notes, domains — pick what you need\n\nExperiments\n splithub init set up config, framework files, agent docs\n splithub create add an experiment (wizard, or flags for agents); its goal can be any event you track()\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 a slice: --from --to (first-exposure days) --filter country=DE (country, region, city, device, os, browser,\n language, host, source, channel, utm_*, landing); one view: --by <dimension> (lift per segment),\n --timeline (per day), --engagement (bounce, visit length per variant), --events (every goal and event\n per variant, lift vs control); --export with --by <dimension> or --events writes CSV\n splithub events --experiment <id> latest raw events of an experiment (--type exposure|goal, --limit 50, --before <ms>, --from --to, --filter)\n splithub plan visitors an experiment 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 experiment 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\nAnalytics\n splithub analytics connect pick or create a property and name it on the app's provider (or get the sh.js tag); [<id>] [--name \"Site\"] [--force]\n splithub analytics [<id>] every property, or one: visitors, pages, sources, events, goals (--by page|source|channel|country|event|goal|variant --experiment <key>|trait --key <name>, --days 7, --from --to, --filter country=DE, --compare [year|<from>..<to>])\n splithub analytics create --name \"Site\" add a property (id generated, like sh-x1h78w; live in the cloud at once, no push); pause|resume|archive|restore|remove|events <id>\n splithub analytics funnel <id> --steps \"page:/,event:Signup,goal:paid\" visitors per step, conversion, drop-off (--within visit|7d|30d, --by <dimension>)\n splithub analytics paths <id> --page /pricing [--prev] where visitors go next (or came from)\n splithub analytics retention <id> who comes back, per weekly cohort (--start visit|event:<name>|goal:<key>, --return visit|event:<name>, --period day|week)\n splithub analytics realtime|props|export <id> visitors now; an event's props (--event <name> [--key <prop>]); CSV to stdout (--by <dimension>|day, --raw)\n splithub analytics segments saved filters: --save <name> country=DE ..., --delete <id|name>; any report takes --segment <name>\n\nNotes, links, alerts, domains (SplitHub Cloud)\n splithub notes what happened on a day (--experiment <key> | --property <id>, --kind note|issue|win, --days 30)\n splithub notes add \"<text>\" [--kind issue|win] [--experiment <key> | --property <id>] [--day YYYY-MM-DD]; notes edit <id> \"<text>\", notes delete <id>\n splithub links short links and their clicks; links <id|slug> for one link's clicks\n splithub links create <url> [<url> ...] [--slug spring] [--name \"Spring sale\"] [--weights 70,30]; links edit|pause|resume|delete <id|slug>\n splithub alerts alert rules (they run on Pro) and recent alerts; alerts enable|disable|delete|test <id>\n splithub alerts add <condition> srm | winner | loser --lift 10 | exposures --visitors N | conversions --conversions N | duration --days N | no_events --hours 24\n | quota --percent 80 | usage --every 1000 | traffic_drop|traffic_spike --property <id> --percent 50\n | goal_silent --property <id> --goal <key> --hours 24 | event_count --property <id> [--event <name>] --count N [--repeat]\n (--experiment <key>, --name, --cooldown <hours>, --disabled, --pause, --finish, --drop-loser)\n splithub domains which domains may send events, per experiment and property; domains set experiment|property <id> <domain...>, domains clear experiment|property <id>\n\nProject\n splithub push [--dry-run] upload splithub.config.ts to SplitHub Cloud (--dry-run: check and show what would change)\n experiments the cloud has that the file lacks are kept; --prune removes them\n a key that already belonged to another experiment stops the push: --replace <keys> (new experiment, old numbers cleared) or --same <keys> (same experiment, numbers stay)\n splithub pull show the config stored in the cloud\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, analytics, 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\ncreate flags\n --kind value|component|redirect|mvt --id <key> --goal <goal> --status running|draft --name \"Hero headline\" --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 (experiments 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 // `--compare` alone means the period right before; it takes a value only when one follows (year, previous, from..to).\n const args = process.argv.slice(2).map((a, i, all) => (a === '--compare' && !/^(previous|year)$|\\.\\./.test(all[i + 1] ?? '') ? '--compare=previous' : a));\n const { values, positionals } = parseArgs({\n args,\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 name: { type: 'string' },\n replace: { type: 'string' },\n same: { 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 prune: { 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 goals: { type: 'string' },\n by: { type: 'string' },\n days: { type: 'string' },\n from: { type: 'string' },\n filter: { type: 'string', multiple: true },\n limit: { type: 'string' },\n compare: { type: 'string' },\n segment: { type: 'string' },\n steps: { type: 'string' },\n within: { type: 'string' },\n page: { type: 'string' },\n prev: { type: 'boolean', default: false },\n return: { type: 'string' },\n period: { type: 'string' },\n event: { type: 'string' },\n raw: { type: 'boolean', default: false },\n save: { type: 'string' },\n delete: { type: 'string' },\n day: { type: 'string' },\n property: { type: 'string' },\n experiment: { type: 'string' },\n slug: { type: 'string' },\n every: { type: 'string' },\n count: { type: 'string' },\n percent: { type: 'string' },\n hours: { type: 'string' },\n visitors: { type: 'string' },\n conversions: { type: 'string' },\n lift: { type: 'string' },\n 'min-visitors': { type: 'string' },\n cooldown: { type: 'string' },\n repeat: { type: 'boolean', default: false },\n disabled: { type: 'boolean', default: false },\n pause: { type: 'boolean', default: false },\n finish: { type: 'boolean', default: false },\n 'drop-loser': { type: 'boolean', default: false },\n timeline: { type: 'boolean', default: false },\n engagement: { type: 'boolean', default: false },\n events: { type: 'boolean', default: false },\n export: { type: 'boolean', default: false },\n type: { type: 'string' },\n before: { 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 'events':\n return (await import('./commands/experiment-reports')).experimentEvents(typeof values.experiment === 'string' ? values.experiment : 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 'analytics':\n case 'properties':\n return (await import('./commands/analytics')).analytics(positionals.slice(1), values);\n case 'notes':\n return (await import('./commands/notes')).notes(positionals.slice(1), values);\n case 'links':\n return (await import('./commands/links')).links(positionals.slice(1), values);\n case 'alerts':\n return (await import('./commands/alerts')).alerts(positionals.slice(1), values);\n case 'domains':\n return (await import('./commands/domains')).domains(positionals.slice(1), 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.scope && !body.error.includes(body.scope)) console.error(c.dim(`Missing scope: ${body.scope}`));\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;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;AAoFpB,eAAe,OAAsB;AAEnC,QAAM,OAAO,QAAQ,KAAK,MAAM,CAAC,EAAE,IAAI,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#!/usr/bin/env node
2
2
  import {
3
3
  init
4
- } from "./chunk-FOHCW2J3.js";
4
+ } from "./chunk-VY342F4X.js";
5
5
  import "./chunk-RMWW4YMN.js";
6
6
  import "./chunk-NFZZSF4M.js";
7
- import "./chunk-BEQ74VTG.js";
8
- import "./chunk-MIHX7XYV.js";
7
+ import "./chunk-NYWJZKOO.js";
8
+ import "./chunk-OXVLWFSD.js";
9
9
  import "./chunk-MUDDASN6.js";
10
10
  import "./chunk-4OQEIP33.js";
11
11
  import "./chunk-ZISCJRR5.js";
12
12
  export {
13
13
  init
14
14
  };
15
- //# sourceMappingURL=init-WHK4EV37.js.map
15
+ //# sourceMappingURL=init-HRCQ5WAA.js.map
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  pull,
4
4
  push
5
- } from "./chunk-EVTPXMLO.js";
5
+ } from "./chunk-U7Z5VYNX.js";
6
6
  import {
7
7
  status
8
8
  } from "./chunk-GIYKIJKW.js";
@@ -11,7 +11,7 @@ import {
11
11
  } from "./chunk-QCFQFDEB.js";
12
12
  import {
13
13
  init
14
- } from "./chunk-FOHCW2J3.js";
14
+ } from "./chunk-VY342F4X.js";
15
15
  import "./chunk-RMWW4YMN.js";
16
16
  import {
17
17
  lifecycle
@@ -20,8 +20,8 @@ import {
20
20
  analyticsMenu,
21
21
  domainsMenu,
22
22
  pickProperty
23
- } from "./chunk-F5ESBFEN.js";
24
- import "./chunk-SPXUP3WA.js";
23
+ } from "./chunk-WMZLKY6J.js";
24
+ import "./chunk-7DFMYJTC.js";
25
25
  import "./chunk-CAFWOX3S.js";
26
26
  import {
27
27
  alerts,
@@ -33,7 +33,7 @@ import {
33
33
  } from "./chunk-SHKXD2C6.js";
34
34
  import {
35
35
  create
36
- } from "./chunk-QBQKQH6S.js";
36
+ } from "./chunk-VVJ4WRAB.js";
37
37
  import {
38
38
  dev
39
39
  } from "./chunk-6GP534WA.js";
@@ -58,8 +58,8 @@ import {
58
58
  } from "./chunk-NFZZSF4M.js";
59
59
  import {
60
60
  skills
61
- } from "./chunk-BEQ74VTG.js";
62
- import "./chunk-MIHX7XYV.js";
61
+ } from "./chunk-NYWJZKOO.js";
62
+ import "./chunk-OXVLWFSD.js";
63
63
  import {
64
64
  detectProject
65
65
  } from "./chunk-MUDDASN6.js";
@@ -723,4 +723,4 @@ export {
723
723
  menuOptions,
724
724
  parseFilterInput
725
725
  };
726
- //# sourceMappingURL=menu-QYXFUWNE.js.map
726
+ //# sourceMappingURL=menu-7EZD5NDF.js.map
@@ -3,7 +3,7 @@ import {
3
3
  configDiff,
4
4
  pull,
5
5
  push
6
- } from "./chunk-EVTPXMLO.js";
6
+ } from "./chunk-U7Z5VYNX.js";
7
7
  import "./chunk-ILEPMQNT.js";
8
8
  import "./chunk-MUDDASN6.js";
9
9
  import "./chunk-4OQEIP33.js";
@@ -13,4 +13,4 @@ export {
13
13
  pull,
14
14
  push
15
15
  };
16
- //# sourceMappingURL=push-UV4O66QR.js.map
16
+ //# sourceMappingURL=push-L2IRGUDM.js.map
@@ -36,7 +36,8 @@ async function remove(id, flags) {
36
36
  const project = requireConfig();
37
37
  const { configFile, cloud, mode } = await removeFromConfig(id, flags);
38
38
  const left = findRefs(project.root, null, id).refs;
39
- const next = [mode === "cloud" ? "npx splithub push" : null, left.length ? `remove the ${left.length} line(s) in the code that still use "${id}" (npx splithub refs ${id})` : null].filter(Boolean).join(", then ");
39
+ const pushStep = mode !== "cloud" ? null : cloud === "archived" || cloud === "finished" ? "npx splithub push" : "npx splithub push --prune";
40
+ const next = [pushStep, left.length ? `remove the ${left.length} line(s) in the code that still use "${id}" (npx splithub refs ${id})` : null].filter(Boolean).join(", then ");
40
41
  if (flags.json) {
41
42
  printJson({ experiment: id, removed: true, configFile, cloud, refs: left, ...next ? { next } : {} });
42
43
  return;
@@ -51,4 +52,4 @@ export {
51
52
  remove,
52
53
  removeFromConfig
53
54
  };
54
- //# sourceMappingURL=remove-PYYPRP3R.js.map
55
+ //# sourceMappingURL=remove-PVVTBBWX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/remove.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport { archiveLive } from '../api';\nimport { loadConfig, readSource, removeExperiment, writeConfigChecked } from '../config-file';\nimport { fail, printJson } from '../errors';\nimport { requireConfig } from '../project';\nimport { findRefs } from '../refs';\nimport { c } from '../ui';\nimport type { Flags } from './init';\n\n/**\n * Take an experiment out of splithub.config.ts. In cloud mode it is also set to\n * finished, so visitors stop entering it right away and its numbers stay readable.\n */\nexport async function removeFromConfig(id: string, flags: Flags): Promise<{ configFile: string; cloud: string; mode: string }> {\n const project = requireConfig();\n const before = await loadConfig(project.configFile);\n if (!before.experiments.some((e) => e.key === id)) fail('EXPERIMENT_NOT_FOUND', `There's no experiment \"${id}\" in the config.`, 'See the ids with npx splithub status.');\n const original = readSource(project.configFile);\n await writeConfigChecked(project.configFile, original, removeExperiment(original, id), (config) => (config.experiments.some((e) => e.key === id) ? `\"${id}\" is still in the config` : config.experiments.length !== before.experiments.length - 1 ? 'another experiment went missing' : null));\n const cloud = before.storage.mode === 'cloud' ? await archiveLive(flags, id) : 'skipped';\n return { configFile: relative(project.root, project.configFile), cloud, mode: before.storage.mode };\n}\n\n/** `splithub remove <id>` */\nexport async function remove(id: string | undefined, flags: Flags): Promise<void> {\n if (!id) fail('USAGE', 'Which experiment? npx splithub remove <id>');\n const project = requireConfig();\n const { configFile, cloud, mode } = await removeFromConfig(id, flags);\n const left = findRefs(project.root, null, id).refs;\n // Archived in the cloud, a push drops it; otherwise the push keeps it unless it prunes.\n const pushStep = mode !== 'cloud' ? null : cloud === 'archived' || cloud === 'finished' ? 'npx splithub push' : 'npx splithub push --prune';\n const next = [pushStep, left.length ? `remove the ${left.length} line(s) in the code that still use \"${id}\" (npx splithub refs ${id})` : null].filter(Boolean).join(', then ');\n if (flags.json) {\n printJson({ experiment: id, removed: true, configFile, cloud, refs: left, ...(next ? { next } : {}) });\n return;\n }\n console.log(`${c.green('✔')} removed ${c.bold(id)} from ${configFile}`);\n if (cloud === 'archived' || cloud === 'finished') console.log(`${c.green('✔')} ${cloud} in the cloud; its numbers stay readable`);\n else if (cloud !== 'skipped') console.log(c.yellow(`! ${cloud}`));\n for (const r of left) console.log(` ${c.cyan(`${r.file}:${r.line}`)} ${r.text}`);\n if (next) console.log(c.dim(`Next: ${next}.`));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,gBAAgB;AAazB,eAAsB,iBAAiB,IAAY,OAA4E;AAC7H,QAAM,UAAU,cAAc;AAC9B,QAAM,SAAS,MAAM,WAAW,QAAQ,UAAU;AAClD,MAAI,CAAC,OAAO,YAAY,KAAK,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAG,MAAK,wBAAwB,0BAA0B,EAAE,oBAAoB,uCAAuC;AACvK,QAAM,WAAW,WAAW,QAAQ,UAAU;AAC9C,QAAM,mBAAmB,QAAQ,YAAY,UAAU,iBAAiB,UAAU,EAAE,GAAG,CAAC,WAAY,OAAO,YAAY,KAAK,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,IAAI,EAAE,6BAA6B,OAAO,YAAY,WAAW,OAAO,YAAY,SAAS,IAAI,oCAAoC,IAAK;AAC7R,QAAM,QAAQ,OAAO,QAAQ,SAAS,UAAU,MAAM,YAAY,OAAO,EAAE,IAAI;AAC/E,SAAO,EAAE,YAAY,SAAS,QAAQ,MAAM,QAAQ,UAAU,GAAG,OAAO,MAAM,OAAO,QAAQ,KAAK;AACpG;AAGA,eAAsB,OAAO,IAAwB,OAA6B;AAChF,MAAI,CAAC,GAAI,MAAK,SAAS,4CAA4C;AACnE,QAAM,UAAU,cAAc;AAC9B,QAAM,EAAE,YAAY,OAAO,KAAK,IAAI,MAAM,iBAAiB,IAAI,KAAK;AACpE,QAAM,OAAO,SAAS,QAAQ,MAAM,MAAM,EAAE,EAAE;AAE9C,QAAM,WAAW,SAAS,UAAU,OAAO,UAAU,cAAc,UAAU,aAAa,sBAAsB;AAChH,QAAM,OAAO,CAAC,UAAU,KAAK,SAAS,cAAc,KAAK,MAAM,wCAAwC,EAAE,wBAAwB,EAAE,MAAM,IAAI,EAAE,OAAO,OAAO,EAAE,KAAK,SAAS;AAC7K,MAAI,MAAM,MAAM;AACd,cAAU,EAAE,YAAY,IAAI,SAAS,MAAM,YAAY,OAAO,MAAM,MAAM,GAAI,OAAO,EAAE,KAAK,IAAI,CAAC,EAAG,CAAC;AACrG;AAAA,EACF;AACA,UAAQ,IAAI,GAAG,EAAE,MAAM,QAAG,CAAC,YAAY,EAAE,KAAK,EAAE,CAAC,SAAS,UAAU,EAAE;AACtE,MAAI,UAAU,cAAc,UAAU,WAAY,SAAQ,IAAI,GAAG,EAAE,MAAM,QAAG,CAAC,IAAI,KAAK,0CAA0C;AAAA,WACvH,UAAU,UAAW,SAAQ,IAAI,EAAE,OAAO,KAAK,KAAK,EAAE,CAAC;AAChE,aAAW,KAAK,KAAM,SAAQ,IAAI,KAAK,EAAE,KAAK,GAAG,EAAE,IAAI,IAAI,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE;AACjF,MAAI,KAAM,SAAQ,IAAI,EAAE,IAAI,SAAS,IAAI,GAAG,CAAC;AAC/C;","names":[]}
@@ -410,7 +410,8 @@ async function ship(id, flags) {
410
410
  const goalRefs = exp.goal ? findRefs(project.root, config, id).refs.filter((r) => r.match === "goal") : [];
411
411
  const goalNote = exp.goal ? config.experiments.some((e) => e.key !== id && e.goal === exp.goal) ? `Keep track('${exp.goal}'): another experiment measures it.` : `Nothing else measures "${exp.goal}". Remove its track() calls and the goal if you no longer need it.` : null;
412
412
  const loser = exp.kind === "component" ? `Delete the components only the other variants used (e.g. splithub/${id}/).` : exp.kind === "redirect" ? `Make the kept page the real one: ${String(variant.to ?? "")}.` : null;
413
- const next = [config.storage.mode === "cloud" ? "npx splithub push" : null, "npx splithub doctor", "the project's typecheck and tests", loser, goalNote].filter((x) => Boolean(x));
413
+ const pushStep = config.storage.mode !== "cloud" ? null : live === "archived" || live === "finished" ? "npx splithub push" : "npx splithub push --prune";
414
+ const next = [pushStep, "npx splithub doctor", "the project's typecheck and tests", loser, goalNote].filter((x) => Boolean(x));
414
415
  const diff = [configDiff, ...changes.map((ch) => ch.diff)].join("");
415
416
  const out = {
416
417
  experiment: id,
@@ -447,4 +448,4 @@ async function ship(id, flags) {
447
448
  export {
448
449
  ship
449
450
  };
450
- //# sourceMappingURL=ship-3TDWAQIJ.js.map
451
+ //# sourceMappingURL=ship-UP6DLCJN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/ship.ts","../src/codemod.ts","../src/diff.ts"],"sourcesContent":["// `splithub ship <id> --keep <variant> [--dry-run]`: finish the test, remove it from the\n// config and rewrite the code so it behaves like the kept variant. Returns the diff and\n// whatever it could not rewrite safely.\nimport { readFileSync, writeFileSync } from 'node:fs';\nimport { createRequire } from 'node:module';\nimport { join, relative } from 'node:path';\nimport type * as TS from 'typescript';\nimport { archiveLive } from '../api';\nimport { shipSource, type Leftover } from '../codemod';\nimport { loadConfig, readSource, removeExperiment, writeConfigChecked } from '../config-file';\nimport { unifiedDiff } from '../diff';\nimport { fail, printJson } from '../errors';\nimport { grepFiles, listSourceFiles, quoted, requireConfig } from '../project';\nimport { findRefs } from '../refs';\nimport { c } from '../ui';\nimport type { Flags } from './init';\n\n/** TypeScript from the user's project first (same version as their code), else ours. */\nasync function loadTypeScript(root: string): Promise<typeof TS> {\n try {\n return createRequire(join(root, 'package.json'))('typescript') as typeof TS;\n } catch {\n try {\n const mod = (await import('typescript')) as typeof TS & { default?: typeof TS };\n return mod.default ?? mod;\n } catch {\n fail('TYPESCRIPT_MISSING', '`splithub ship` rewrites code with the TypeScript compiler, and it is not installed here.', 'Run npm install -D typescript (any 5.x), then retry.');\n }\n }\n}\n\nexport interface ShipFile {\n file: string;\n diff: string;\n leftovers: Leftover[];\n}\n\nexport async function ship(id: string | undefined, flags: Flags): Promise<void> {\n if (!id) fail('USAGE', 'Which experiment? npx splithub ship <id> --keep <variant>');\n const keep = typeof flags.keep === 'string' ? flags.keep : '';\n const project = requireConfig();\n const config = await loadConfig(project.configFile);\n const exp = config.experiments.find((e) => e.key === id);\n if (!exp) fail('EXPERIMENT_NOT_FOUND', `There's no experiment \"${id}\" in the config.`, 'See the ids with npx splithub status.');\n if (!keep) fail('USAGE', 'Which variant stays? Pass --keep <variant>.', `Variants of ${id}: ${exp.variants.map((v) => v.key).join(', ')}. Read the verdict first: npx splithub results ${id}.`);\n const variant = exp.variants.find((v) => v.key === keep);\n if (!variant) fail('VARIANT_NOT_FOUND', `\"${id}\" has no variant \"${keep}\".`, `Pick one of: ${exp.variants.map((v) => v.key).join(', ')}.`);\n const dryRun = Boolean(flags['dry-run']);\n\n const ts = await loadTypeScript(project.root);\n const hasValue = exp.kind === 'value' || exp.kind === 'mvt';\n const target = { id, keep, value: (variant as { value?: unknown }).value, hasValue };\n\n // Rewrite in memory first: nothing is written unless the config change works too.\n const files = grepFiles(listSourceFiles(project.root), id).filter((f) => !/(^|[\\\\/])splithub\\.config\\.[mc]?[jt]s$/.test(f));\n const changes: Array<ShipFile & { abs: string; output: string }> = [];\n const leftovers: Array<Leftover & { file: string }> = [];\n for (const abs of files) {\n const source = readFileSync(abs, 'utf8');\n if (!quoted(id).some((q) => source.includes(q))) continue;\n const rel = relative(project.root, abs).replace(/\\\\/g, '/');\n const r = shipSource(ts, abs, source, target);\n for (const l of r.leftovers) leftovers.push({ file: rel, ...l });\n if (r.changed) changes.push({ file: rel, abs, output: r.output, diff: unifiedDiff(rel, source, r.output), leftovers: r.leftovers });\n }\n\n const configRel = relative(project.root, project.configFile).replace(/\\\\/g, '/');\n const original = readSource(project.configFile);\n const updatedConfig = removeExperiment(original, id);\n const configDiff = unifiedDiff(configRel, original, updatedConfig);\n\n let live = 'skipped';\n if (!dryRun) {\n await writeConfigChecked(project.configFile, original, updatedConfig, (loaded) => (loaded.experiments.some((e) => e.key === id) ? `\"${id}\" is still in the config` : null));\n for (const ch of changes) writeFileSync(ch.abs, ch.output, 'utf8');\n if (config.storage.mode === 'cloud') live = await archiveLive(flags, id);\n }\n\n // Goals: keep track() calls when another experiment still measures the goal.\n const goalRefs = exp.goal ? findRefs(project.root, config, id).refs.filter((r) => r.match === 'goal') : [];\n const goalNote = exp.goal ? (config.experiments.some((e) => e.key !== id && e.goal === exp.goal) ? `Keep track('${exp.goal}'): another experiment measures it.` : `Nothing else measures \"${exp.goal}\". Remove its track() calls and the goal if you no longer need it.`) : null;\n const loser = exp.kind === 'component' ? `Delete the components only the other variants used (e.g. splithub/${id}/).` : exp.kind === 'redirect' ? `Make the kept page the real one: ${String((variant as { to?: unknown }).to ?? '')}.` : null;\n // Archived in the cloud, a push drops it; otherwise the push keeps it unless it prunes.\n const pushStep = config.storage.mode !== 'cloud' ? null : live === 'archived' || live === 'finished' ? 'npx splithub push' : 'npx splithub push --prune';\n const next = [pushStep, 'npx splithub doctor', \"the project's typecheck and tests\", loser, goalNote].filter((x): x is string => Boolean(x));\n\n const diff = [configDiff, ...changes.map((ch) => ch.diff)].join('');\n const out = {\n experiment: id,\n kept: keep,\n kind: exp.kind,\n dryRun,\n finished: dryRun ? false : true,\n live,\n configFile: configRel,\n files: changes.map((ch) => ch.file),\n diff,\n leftovers,\n goal: exp.goal ?? null,\n goalRefs: goalRefs.length,\n next,\n };\n if (flags.json) {\n printJson(out);\n return;\n }\n console.log(diff || c.dim('No code changes.'));\n if (leftovers.length) {\n console.log(c.yellow(`${leftovers.length} place(s) to finish by hand:`));\n for (const l of leftovers) console.log(` ${c.cyan(`${l.file}:${l.line}`)} ${l.text} ${c.dim(l.reason)}`);\n }\n if (dryRun) console.log(c.dim(`Dry run: nothing changed. Run it without --dry-run to apply.`));\n else {\n console.log(`${c.green('✔')} kept ${c.bold(keep)}, removed ${c.bold(id)} from ${configRel}${changes.length ? ` and rewrote ${changes.length} file(s)` : ''}`);\n if (live === 'archived' || live === 'finished') console.log(`${c.green('✔')} ${live} in the cloud; its numbers stay readable`);\n else if (live !== 'skipped') console.log(c.yellow(`! ${live}`));\n }\n console.log(c.dim(`Next: ${next.join(' · ')}`));\n}\n","// `splithub ship` codemod: rewrite source so it behaves like the kept variant, with\n// no experiment left. Built on the TypeScript compiler API (passed in, so the CLI only\n// loads it for `ship`). Works in passes: each pass makes the edits it can see, the next\n// pass re-parses and simplifies what the previous one produced, until nothing changes.\nimport type * as TS from 'typescript';\n\nexport interface ShipTarget {\n id: string;\n keep: string;\n /** The kept variant's value (value and mvt experiments). */\n value?: unknown;\n hasValue: boolean;\n}\n\nexport interface Leftover {\n line: number;\n text: string;\n reason: string;\n}\n\nexport interface CodemodResult {\n output: string;\n changed: boolean;\n leftovers: Leftover[];\n}\n\nconst TRUE = '__splithubShipTrue__';\nconst FALSE = '__splithubShipFalse__';\nconst SDK_NAMES = new Set(['Experiment', 'Variant', 'useVariant', 'useValue']);\n\ninterface Edit {\n start: number;\n end: number;\n text: string;\n}\n\n/** A JS/TS literal for a variant value. */\nexport function literal(value: unknown): string {\n if (typeof value === 'string') return `'${value.replace(/\\\\/g, '\\\\\\\\').replace(/'/g, \"\\\\'\").replace(/\\n/g, '\\\\n')}'`;\n if (value === undefined) return 'undefined';\n return JSON.stringify(value);\n}\n\nfunction scriptKind(ts: typeof TS, file: string): TS.ScriptKind {\n if (/\\.tsx$/.test(file)) return ts.ScriptKind.TSX;\n if (/\\.jsx$/.test(file)) return ts.ScriptKind.JSX;\n if (/\\.[mc]?js$/.test(file)) return ts.ScriptKind.JSX;\n return ts.ScriptKind.TS;\n}\n\nfunction applyEdits(source: string, edits: Edit[]): string {\n // Outermost first; drop edits nested in (or overlapping) one already taken. The next pass gets them.\n const sorted = [...edits].sort((a, b) => a.start - b.start || b.end - a.end);\n const taken: Edit[] = [];\n for (const e of sorted) if (!taken.some((t) => e.start < t.end && e.end > t.start)) taken.push(e);\n let out = source;\n for (const e of taken.sort((a, b) => b.start - a.start)) out = out.slice(0, e.start) + e.text + out.slice(e.end);\n return out;\n}\n\nfunction indentOf(source: string, pos: number): string {\n const lineStart = source.lastIndexOf('\\n', pos - 1) + 1;\n return /^[ \\t]*/.exec(source.slice(lineStart))![0];\n}\n\n/** Shift lines 2..n of `text` left so content written at `from` indentation sits at `to`. */\nfunction reindent(text: string, from: string, to: string): string {\n if (from.length <= to.length) return text;\n const cut = from.length - to.length;\n return text\n .split('\\n')\n .map((line, i) => (i === 0 ? line : line.replace(new RegExp(`^[ \\\\t]{0,${cut}}`), '')))\n .join('\\n');\n}\n\n/** Remove a whole statement, its line included when it stands alone. */\nfunction removeStatement(source: string, node: TS.Node, sf: TS.SourceFile): Edit {\n const start = node.getStart(sf);\n const lineStart = source.lastIndexOf('\\n', start - 1) + 1;\n const from = source.slice(lineStart, start).trim() === '' ? lineStart : start;\n let end = node.end;\n const lineEnd = source.indexOf('\\n', end);\n if (source.slice(end, lineEnd < 0 ? source.length : lineEnd).trim() === '' && from === lineStart) end = lineEnd < 0 ? source.length : lineEnd + 1;\n return { start: from, end, text: '' };\n}\n\nfunction stringValue(ts: typeof TS, node: TS.Node | undefined): string | null {\n if (!node) return null;\n if (ts.isStringLiteral(node) || ts.isNoSubstitutionTemplateLiteral(node)) return node.text;\n if (ts.isJsxExpression(node) && node.expression) return stringValue(ts, node.expression);\n if (ts.isParenthesizedExpression(node)) return stringValue(ts, node.expression);\n return null;\n}\n\nfunction jsxAttr(ts: typeof TS, el: TS.JsxOpeningLikeElement, name: string): string | null {\n for (const p of el.attributes.properties) {\n if (ts.isJsxAttribute(p) && p.name.getText() === name) return stringValue(ts, p.initializer);\n }\n return null;\n}\n\nfunction tagName(el: TS.JsxOpeningLikeElement): string {\n const t = el.tagName.getText();\n return t.slice(t.lastIndexOf('.') + 1);\n}\n\nfunction skipParensUp(ts: typeof TS, node: TS.Node): TS.Node {\n let n = node;\n while (n.parent && ts.isParenthesizedExpression(n.parent)) n = n.parent;\n return n;\n}\n\nconst EQ_KINDS = (ts: typeof TS) => [ts.SyntaxKind.EqualsEqualsEqualsToken, ts.SyntaxKind.EqualsEqualsToken, ts.SyntaxKind.ExclamationEqualsEqualsToken, ts.SyntaxKind.ExclamationEqualsToken];\n\n/** `x === 'k'` / `'k' !== x` where x is `node`: the edit that turns it into a marker. */\nfunction comparisonEdit(ts: typeof TS, node: TS.Node, keep: string, sf: TS.SourceFile): Edit | null {\n const n = skipParensUp(ts, node);\n const p = n.parent;\n if (!p || !ts.isBinaryExpression(p) || !EQ_KINDS(ts).includes(p.operatorToken.kind)) return null;\n const other = p.left === n ? p.right : p.left;\n const lit = stringValue(ts, other);\n if (lit === null) return null;\n const negate = p.operatorToken.kind === ts.SyntaxKind.ExclamationEqualsEqualsToken || p.operatorToken.kind === ts.SyntaxKind.ExclamationEqualsToken;\n const result = (lit === keep) !== negate;\n return { start: p.getStart(sf), end: p.end, text: result ? TRUE : FALSE };\n}\n\n/** `switch (x) { case 'k': ... }` where x is `node`: keep the matching branch's statements. */\nfunction switchEdit(ts: typeof TS, node: TS.Node, keep: string, source: string, sf: TS.SourceFile): Edit | null {\n const n = skipParensUp(ts, node);\n const sw = n.parent;\n if (!sw || !ts.isSwitchStatement(sw) || sw.expression !== n) return null;\n const clauses = sw.caseBlock.clauses;\n let idx = clauses.findIndex((c) => ts.isCaseClause(c) && stringValue(ts, c.expression) === keep);\n if (idx < 0) idx = clauses.findIndex((c) => ts.isDefaultClause(c));\n if (idx < 0) return removeStatement(source, sw, sf);\n const stmts: TS.Statement[] = [];\n for (let i = idx; i < clauses.length; i++) {\n const c = clauses[i]!;\n stmts.push(...c.statements);\n if (c.statements.length) break;\n }\n // A block clause `case 'a': { ... }` reads like its body.\n const flat = stmts.length === 1 && ts.isBlock(stmts[0]!) ? [...(stmts[0] as TS.Block).statements] : stmts;\n const body = flat.filter((s, i) => !(i === flat.length - 1 && ts.isBreakStatement(s) && !s.label));\n if (body.length === 0) return removeStatement(source, sw, sf);\n const indent = indentOf(source, sw.getStart(sf));\n const text = reindent(source.slice(body[0]!.getStart(sf), body[body.length - 1]!.end), indentOf(source, body[0]!.getStart(sf)), indent);\n const declares = body.some((s) => ts.isVariableStatement(s) || ts.isFunctionDeclaration(s) || ts.isClassDeclaration(s));\n return { start: sw.getStart(sf), end: sw.end, text: declares ? `{\\n${indent} ${text.split('\\n').join(`\\n `)}\\n${indent}}` : text };\n}\n\nfunction isJsxChildPosition(ts: typeof TS, node: TS.Node): boolean {\n const p = node.parent;\n return Boolean(p && (ts.isJsxElement(p) || ts.isJsxFragment(p)));\n}\n\n/** What replaces `<Experiment>`: the kept `<Variant>`'s children. */\nfunction variantContent(ts: typeof TS, exp: TS.JsxElement, kept: TS.JsxElement | TS.JsxSelfClosingElement | undefined, source: string, sf: TS.SourceFile): string {\n const children = kept && ts.isJsxElement(kept) ? kept.children.filter((c) => !(ts.isJsxText(c) && c.containsOnlyTriviaWhiteSpaces)) : [];\n const inJsx = isJsxChildPosition(ts, exp);\n if (children.length === 0) return inJsx ? '' : 'null';\n const first = children[0]!;\n const last = children[children.length - 1]!;\n const startAt = ts.isJsxText(first) ? first.pos + (source.slice(first.pos, first.end).length - source.slice(first.pos, first.end).trimStart().length) : first.getStart(sf);\n const endAt = ts.isJsxText(last) ? last.end - (source.slice(last.pos, last.end).length - source.slice(last.pos, last.end).trimEnd().length) : last.end;\n const raw = reindent(source.slice(startAt, endAt), indentOf(source, startAt), indentOf(source, exp.getStart(sf)));\n if (inJsx) return raw;\n if (children.length === 1) {\n const only = children[0]!;\n if (ts.isJsxElement(only) || ts.isJsxSelfClosingElement(only) || ts.isJsxFragment(only)) return raw;\n if (ts.isJsxExpression(only)) return only.expression ? `(${only.expression.getText(sf)})` : 'null';\n }\n return `<>${raw}</>`;\n}\n\n/** Simplify around a marker left by a comparison. */\nfunction markerEdit(ts: typeof TS, node: TS.Identifier, source: string, sf: TS.SourceFile): Edit | null {\n const value = node.text === TRUE;\n const n = skipParensUp(ts, node);\n const p = n.parent;\n if (!p) return null;\n const text = (x: TS.Node) => x.getText(sf);\n if (ts.isPrefixUnaryExpression(p) && p.operator === ts.SyntaxKind.ExclamationToken) return { start: p.getStart(sf), end: p.end, text: value ? FALSE : TRUE };\n if (ts.isConditionalExpression(p) && p.condition === n) {\n const branch = value ? p.whenTrue : p.whenFalse;\n const outer = skipParensUp(ts, p);\n // {cond ? <A /> : <B />} in JSX becomes <A /> itself.\n const jsx = ts.isJsxElement(branch) || ts.isJsxSelfClosingElement(branch) || ts.isJsxFragment(branch);\n if (jsx && outer.parent && ts.isJsxExpression(outer.parent) && isJsxChildPosition(ts, outer.parent)) return { start: outer.parent.getStart(sf), end: outer.parent.end, text: text(branch) };\n return { start: p.getStart(sf), end: p.end, text: text(branch) };\n }\n if (ts.isBinaryExpression(p)) {\n const op = p.operatorToken.kind;\n if (op === ts.SyntaxKind.AmpersandAmpersandToken && p.left === n) {\n if (value) return { start: p.getStart(sf), end: p.end, text: text(p.right) };\n const outer = skipParensUp(ts, p);\n if (outer.parent && ts.isJsxExpression(outer.parent)) return removeStatement(source, outer.parent, sf);\n return { start: p.getStart(sf), end: p.end, text: FALSE };\n }\n if (op === ts.SyntaxKind.AmpersandAmpersandToken && p.right === n && value) return { start: p.getStart(sf), end: p.end, text: text(p.left) };\n if (op === ts.SyntaxKind.BarBarToken && p.left === n) return { start: p.getStart(sf), end: p.end, text: value ? TRUE : text(p.right) };\n if (op === ts.SyntaxKind.BarBarToken && p.right === n && !value) return { start: p.getStart(sf), end: p.end, text: text(p.left) };\n }\n if (ts.isIfStatement(p) && p.expression === n) {\n const branch = value ? p.thenStatement : p.elseStatement;\n const inBlock = p.parent && (ts.isBlock(p.parent) || ts.isSourceFile(p.parent) || ts.isCaseClause(p.parent) || ts.isDefaultClause(p.parent));\n if (!branch) return inBlock ? removeStatement(source, p, sf) : { start: p.getStart(sf), end: p.end, text: '{}' };\n if (inBlock && ts.isBlock(branch)) {\n if (branch.statements.length === 0) return removeStatement(source, p, sf);\n const declares = branch.statements.some((s) => ts.isVariableStatement(s) || ts.isFunctionDeclaration(s) || ts.isClassDeclaration(s));\n if (!declares) {\n const first = branch.statements[0]!.getStart(sf);\n const body = source.slice(first, branch.statements[branch.statements.length - 1]!.end);\n return { start: p.getStart(sf), end: p.end, text: reindent(body, indentOf(source, first), indentOf(source, p.getStart(sf))) };\n }\n }\n return { start: p.getStart(sf), end: p.end, text: text(branch) };\n }\n return null;\n}\n\nfunction isUseCall(ts: typeof TS, node: TS.Node, name: string, id: string): node is TS.CallExpression {\n if (!ts.isCallExpression(node)) return false;\n const callee = node.expression;\n const calleeName = ts.isIdentifier(callee) ? callee.text : ts.isPropertyAccessExpression(callee) ? callee.name.text : null;\n return calleeName === name && stringValue(ts, node.arguments[0]) === id;\n}\n\nfunction enclosingScope(ts: typeof TS, node: TS.Node): TS.Node {\n let n: TS.Node = node.parent;\n while (n && !ts.isFunctionLike(n) && !ts.isSourceFile(n)) n = n.parent;\n return n;\n}\n\nfunction onePass(ts: typeof TS, file: string, source: string, target: ShipTarget, leftovers: Map<string, Leftover>): string {\n const sf = ts.createSourceFile(file, source, ts.ScriptTarget.Latest, true, scriptKind(ts, file));\n const edits: Edit[] = [];\n const note = (node: TS.Node, reason: string) => {\n const line = sf.getLineAndCharacterOfPosition(node.getStart(sf)).line + 1;\n const text = source.split('\\n')[line - 1]?.trim() ?? '';\n leftovers.set(`${text}|${reason}`, { line, text, reason });\n };\n const visit = (node: TS.Node): void => {\n // <Experiment id=\"...\"> … </Experiment>\n if (ts.isJsxElement(node) && tagName(node.openingElement) === 'Experiment' && jsxAttr(ts, node.openingElement, 'id') === target.id) {\n const variants = node.children.filter((c): c is TS.JsxElement | TS.JsxSelfClosingElement => (ts.isJsxElement(c) && tagName(c.openingElement) === 'Variant') || (ts.isJsxSelfClosingElement(c) && tagName(c) === 'Variant'));\n const kept = variants.find((v) => jsxAttr(ts, ts.isJsxElement(v) ? v.openingElement : v, 'name') === target.keep);\n if (!kept) note(node, `no <Variant name=\"${target.keep}\"> in this <Experiment>`);\n else {\n edits.push({ start: node.getStart(sf), end: node.end, text: variantContent(ts, node, kept, source, sf) });\n return;\n }\n }\n // useValue('<id>') / sh.value('<id>')\n if (isUseCall(ts, node, 'useValue', target.id) || isUseCall(ts, node, 'value', target.id)) {\n if (target.hasValue) edits.push({ start: node.getStart(sf), end: node.end, text: literal(target.value) });\n else note(node, 'reads a value, but this experiment has no values');\n return;\n }\n // useVariant('<id>')\n if (isUseCall(ts, node, 'useVariant', target.id)) {\n const direct = comparisonEdit(ts, node, target.keep, sf) ?? switchEdit(ts, node, target.keep, source, sf);\n if (direct) edits.push(direct);\n else {\n const decl = skipParensUp(ts, node).parent;\n if (decl && ts.isVariableDeclaration(decl) && ts.isIdentifier(decl.name)) {\n const name = decl.name.text;\n const scope = enclosingScope(ts, decl);\n const refs: TS.Identifier[] = [];\n const find = (n: TS.Node): void => {\n if (ts.isIdentifier(n) && n.text === name && n !== decl.name && !(ts.isPropertyAccessExpression(n.parent) && n.parent.name === n) && !(ts.isPropertyAssignment(n.parent) && n.parent.name === n)) refs.push(n);\n ts.forEachChild(n, find);\n };\n find(scope);\n const rewrites = refs.map((r) => comparisonEdit(ts, r, target.keep, sf) ?? switchEdit(ts, r, target.keep, source, sf)).filter((e): e is Edit => e !== null);\n if (rewrites.length) edits.push(...rewrites);\n else if (refs.length === 0 && ts.isVariableDeclarationList(decl.parent) && decl.parent.declarations.length === 1 && ts.isVariableStatement(decl.parent.parent)) edits.push(removeStatement(source, decl.parent.parent, sf));\n else edits.push({ start: node.getStart(sf), end: node.end, text: literal(target.keep) });\n } else edits.push({ start: node.getStart(sf), end: node.end, text: literal(target.keep) });\n }\n return;\n }\n if (ts.isIdentifier(node) && (node.text === TRUE || node.text === FALSE)) {\n const e = markerEdit(ts, node, source, sf);\n if (e) edits.push(e);\n }\n ts.forEachChild(node, visit);\n };\n visit(sf);\n return applyEdits(source, edits);\n}\n\n/** Drop now-unused Experiment / Variant / useVariant / useValue imports from @splithub/*. */\nfunction cleanImports(ts: typeof TS, file: string, source: string): string {\n const sf = ts.createSourceFile(file, source, ts.ScriptTarget.Latest, true, scriptKind(ts, file));\n const used = new Map<string, number>();\n const count = (n: TS.Node): void => {\n if (ts.isImportDeclaration(n)) return;\n if (ts.isIdentifier(n)) used.set(n.text, (used.get(n.text) ?? 0) + 1);\n ts.forEachChild(n, count);\n };\n count(sf);\n const edits: Edit[] = [];\n for (const st of sf.statements) {\n if (!ts.isImportDeclaration(st) || !ts.isStringLiteral(st.moduleSpecifier) || !st.moduleSpecifier.text.startsWith('@splithub/')) continue;\n const named = st.importClause?.namedBindings;\n if (!named || !ts.isNamedImports(named)) continue;\n const drop = named.elements.filter((el) => SDK_NAMES.has((el.propertyName ?? el.name).text) && !used.get(el.name.text));\n if (drop.length === 0) continue;\n const keepEls = named.elements.filter((el) => !drop.includes(el));\n if (keepEls.length === 0 && !st.importClause?.name) edits.push(removeStatement(source, st, sf));\n else if (keepEls.length === 0) edits.push({ start: st.importClause!.name!.end, end: named.end, text: '' });\n else edits.push({ start: named.getStart(sf), end: named.end, text: `{ ${keepEls.map((e) => e.getText(sf)).join(', ')} }` });\n }\n return applyEdits(source, edits);\n}\n\n/** Rewrite one file for the kept variant. */\nexport function shipSource(ts: typeof TS, file: string, source: string, target: ShipTarget): CodemodResult {\n const leftovers = new Map<string, Leftover>();\n let current = source;\n for (let i = 0; i < 12; i++) {\n const next = onePass(ts, file, current, target, leftovers);\n if (next === current) break;\n current = next;\n }\n current = current.split(TRUE).join('true').split(FALSE).join('false');\n const changed = current !== source;\n if (changed) current = cleanImports(ts, file, current);\n // Whatever still names the experiment needs a human (or agent) look.\n const quotes = [`'${target.id}'`, `\"${target.id}\"`, `\\`${target.id}\\``];\n const remaining = new Map<number, Leftover>();\n current.split('\\n').forEach((text, i) => {\n if (quotes.some((q) => text.includes(q))) remaining.set(i + 1, { line: i + 1, text: text.trim(), reason: [...leftovers.values()].find((l) => l.text === text.trim())?.reason ?? \"still mentions the experiment; rewrite it by hand\" });\n });\n return { output: current, changed, leftovers: [...remaining.values()] };\n}\n","/** Unified diff of two texts (3 lines of context), enough for a human or an agent to review. */\nexport function unifiedDiff(file: string, a: string, b: string, context = 3): string {\n if (a === b) return '';\n const x = a.split('\\n');\n const y = b.split('\\n');\n // Common prefix / suffix first, LCS only on the middle: edits are small.\n let pre = 0;\n while (pre < x.length && pre < y.length && x[pre] === y[pre]) pre++;\n let suf = 0;\n while (suf < x.length - pre && suf < y.length - pre && x[x.length - 1 - suf] === y[y.length - 1 - suf]) suf++;\n const xm = x.slice(pre, x.length - suf);\n const ym = y.slice(pre, y.length - suf);\n const n = xm.length;\n const m = ym.length;\n const lcs: number[][] = Array.from({ length: n + 1 }, () => new Array<number>(m + 1).fill(0));\n for (let i = n - 1; i >= 0; i--) for (let j = m - 1; j >= 0; j--) lcs[i]![j] = xm[i] === ym[j] ? lcs[i + 1]![j + 1]! + 1 : Math.max(lcs[i + 1]![j]!, lcs[i]![j + 1]!);\n type Op = { t: ' ' | '-' | '+'; s: string; ai: number; bi: number };\n const ops: Op[] = [];\n for (let k = 0; k < pre; k++) ops.push({ t: ' ', s: x[k]!, ai: k, bi: k });\n let i = 0;\n let j = 0;\n while (i < n || j < m) {\n if (i < n && j < m && xm[i] === ym[j]) {\n ops.push({ t: ' ', s: xm[i]!, ai: pre + i, bi: pre + j });\n i++;\n j++;\n } else if (j < m && (i >= n || lcs[i]![j + 1]! > lcs[i + 1]![j]!)) {\n ops.push({ t: '+', s: ym[j]!, ai: pre + i, bi: pre + j });\n j++;\n } else {\n ops.push({ t: '-', s: xm[i]!, ai: pre + i, bi: pre + j });\n i++;\n }\n }\n for (let k = 0; k < suf; k++) ops.push({ t: ' ', s: x[x.length - suf + k]!, ai: x.length - suf + k, bi: y.length - suf + k });\n\n const out = [`--- a/${file}`, `+++ b/${file}`];\n let k = 0;\n while (k < ops.length) {\n if (ops[k]!.t === ' ') {\n k++;\n continue;\n }\n const start = Math.max(0, k - context);\n let end = k;\n // Extend the hunk while changes are within 2×context of each other.\n for (;;) {\n while (end < ops.length && ops[end]!.t !== ' ') end++;\n let next = end;\n while (next < ops.length && ops[next]!.t === ' ') next++;\n if (next < ops.length && next - end <= context * 2) end = next;\n else break;\n }\n const stop = Math.min(ops.length, end + context);\n const hunk = ops.slice(start, stop);\n const aLen = hunk.filter((o) => o.t !== '+').length;\n const bLen = hunk.filter((o) => o.t !== '-').length;\n out.push(`@@ -${hunk[0]!.ai + 1},${aLen} +${hunk[0]!.bi + 1},${bLen} @@`);\n for (const o of hunk) out.push(`${o.t}${o.s}`);\n k = stop;\n }\n return out.join('\\n') + '\\n';\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,SAAS,cAAc,qBAAqB;AAC5C,SAAS,qBAAqB;AAC9B,SAAS,MAAM,gBAAgB;;;ACqB/B,IAAM,OAAO;AACb,IAAM,QAAQ;AACd,IAAM,YAAY,oBAAI,IAAI,CAAC,cAAc,WAAW,cAAc,UAAU,CAAC;AAStE,SAAS,QAAQ,OAAwB;AAC9C,MAAI,OAAO,UAAU,SAAU,QAAO,IAAI,MAAM,QAAQ,OAAO,MAAM,EAAE,QAAQ,MAAM,KAAK,EAAE,QAAQ,OAAO,KAAK,CAAC;AACjH,MAAI,UAAU,OAAW,QAAO;AAChC,SAAO,KAAK,UAAU,KAAK;AAC7B;AAEA,SAAS,WAAW,IAAe,MAA6B;AAC9D,MAAI,SAAS,KAAK,IAAI,EAAG,QAAO,GAAG,WAAW;AAC9C,MAAI,SAAS,KAAK,IAAI,EAAG,QAAO,GAAG,WAAW;AAC9C,MAAI,aAAa,KAAK,IAAI,EAAG,QAAO,GAAG,WAAW;AAClD,SAAO,GAAG,WAAW;AACvB;AAEA,SAAS,WAAW,QAAgB,OAAuB;AAEzD,QAAM,SAAS,CAAC,GAAG,KAAK,EAAE,KAAK,CAAC,GAAG,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG;AAC3E,QAAM,QAAgB,CAAC;AACvB,aAAW,KAAK,OAAQ,KAAI,CAAC,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AG,EAAE,MAAM,QAAG,CAAC,SAAS,EAAE,KAAK,IAAI,CAAC,aAAa,EAAE,KAAK,EAAE,CAAC,SAAS,SAAS,GAAG,QAAQ,SAAS,gBAAgB,QAAQ,MAAM,aAAa,EAAE,EAAE;AAC5J,QAAI,SAAS,cAAc,SAAS,WAAY,SAAQ,IAAI,GAAG,EAAE,MAAM,QAAG,CAAC,IAAI,IAAI,0CAA0C;AAAA,aACpH,SAAS,UAAW,SAAQ,IAAI,EAAE,OAAO,KAAK,IAAI,EAAE,CAAC;AAAA,EAChE;AACA,UAAQ,IAAI,EAAE,IAAI,SAAS,KAAK,KAAK,QAAK,CAAC,EAAE,CAAC;AAChD;","names":["c","i","j","k"]}
@@ -4,8 +4,8 @@ import {
4
4
  installSkills,
5
5
  loadSkillFiles,
6
6
  skills
7
- } from "./chunk-BEQ74VTG.js";
8
- import "./chunk-MIHX7XYV.js";
7
+ } from "./chunk-NYWJZKOO.js";
8
+ import "./chunk-OXVLWFSD.js";
9
9
  import "./chunk-MUDDASN6.js";
10
10
  import "./chunk-4OQEIP33.js";
11
11
  import "./chunk-ZISCJRR5.js";
@@ -15,4 +15,4 @@ export {
15
15
  loadSkillFiles,
16
16
  skills
17
17
  };
18
- //# sourceMappingURL=skills-LVIFTOTI.js.map
18
+ //# sourceMappingURL=skills-J6X6DULX.js.map