splithub 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/dist/{alerts-RXUG22S7.js → alerts-WOWJ3MZV.js} +4 -4
- package/dist/{analytics-BS3Z6HEF.js → analytics-ZGLVQDIL.js} +6 -6
- package/dist/{chunk-5UN2NKIF.js → chunk-3V6SD74H.js} +9 -9
- package/dist/chunk-3V6SD74H.js.map +1 -0
- package/dist/{chunk-OX3FZH2C.js → chunk-4AZ2EOIY.js} +6 -5
- package/dist/chunk-4AZ2EOIY.js.map +1 -0
- package/dist/{chunk-5JKDO4IN.js → chunk-4DPMTGNP.js} +3 -3
- package/dist/chunk-4DPMTGNP.js.map +1 -0
- package/dist/{chunk-OZZDQP37.js → chunk-5R6543RT.js} +7 -7
- package/dist/chunk-5R6543RT.js.map +1 -0
- package/dist/{chunk-RBV5NIMY.js → chunk-7ADMC5F3.js} +3 -3
- package/dist/chunk-7ADMC5F3.js.map +1 -0
- package/dist/{chunk-OXQZJCAC.js → chunk-BDCKWKJB.js} +37 -37
- package/dist/chunk-BDCKWKJB.js.map +1 -0
- package/dist/{chunk-CAFWOX3S.js → chunk-BLEJ5DOY.js} +2 -2
- package/dist/chunk-BLEJ5DOY.js.map +1 -0
- package/dist/{chunk-XTHEBWKY.js → chunk-DOPSOUUT.js} +7 -7
- package/dist/chunk-DOPSOUUT.js.map +1 -0
- package/dist/{chunk-YZPQK4N7.js → chunk-GWWJHAH4.js} +4 -4
- package/dist/chunk-GWWJHAH4.js.map +1 -0
- package/dist/{chunk-4OQEIP33.js → chunk-H5GMGCOT.js} +3 -3
- package/dist/chunk-H5GMGCOT.js.map +1 -0
- package/dist/{chunk-YRHCGHV7.js → chunk-I5YYG3NU.js} +3 -3
- package/dist/chunk-I5YYG3NU.js.map +1 -0
- package/dist/{chunk-FCV7PQN6.js → chunk-IIX2EISO.js} +4 -4
- package/dist/chunk-IIX2EISO.js.map +1 -0
- package/dist/{chunk-G2URJ423.js → chunk-ISEVDVKJ.js} +3 -3
- package/dist/chunk-ISEVDVKJ.js.map +1 -0
- package/dist/{chunk-XCWKBO5S.js → chunk-JFRRGBZU.js} +7 -7
- package/dist/chunk-JFRRGBZU.js.map +1 -0
- package/dist/{chunk-WQETHW5W.js → chunk-JQA3WWEQ.js} +4 -4
- package/dist/chunk-JQA3WWEQ.js.map +1 -0
- package/dist/{chunk-7SLMC74Z.js → chunk-K5GDEVMA.js} +16 -9
- package/dist/chunk-K5GDEVMA.js.map +1 -0
- package/dist/{chunk-Z2LTGGUG.js → chunk-KWL6EUML.js} +3 -3
- package/dist/chunk-KWL6EUML.js.map +1 -0
- package/dist/{chunk-XWVEN3MM.js → chunk-LF4ZI43E.js} +3 -3
- package/dist/{chunk-3LVJOBZP.js → chunk-NZ4RSQ56.js} +3 -3
- package/dist/{chunk-3LVJOBZP.js.map → chunk-NZ4RSQ56.js.map} +1 -1
- package/dist/{chunk-VLHSGWBW.js → chunk-PWLTCKEC.js} +7 -7
- package/dist/chunk-PWLTCKEC.js.map +1 -0
- package/dist/{chunk-TBOAI6R7.js → chunk-Q5LYYWYC.js} +15 -15
- package/dist/chunk-Q5LYYWYC.js.map +1 -0
- package/dist/{chunk-45VJUM7P.js → chunk-VMYL36BP.js} +3 -3
- package/dist/{chunk-NFZZSF4M.js → chunk-XT7Z5GY2.js} +2 -2
- package/dist/{ci-W72GPWEB.js → ci-G4IQPM5K.js} +2 -2
- package/dist/{connect-UHAZVDEZ.js → connect-BICSF6XG.js} +12 -12
- package/dist/connect-BICSF6XG.js.map +1 -0
- package/dist/{create-GJKGCXTJ.js → create-7VLV2H67.js} +4 -4
- package/dist/{dev-4O4ZVVKH.js → dev-3CPW4LTF.js} +3 -3
- package/dist/{doctor-MB3F72TI.js → doctor-L7NTDL2E.js} +5 -5
- package/dist/domains-J5SKVM6S.js +10 -0
- package/dist/{experiment-reports-WMODMYBX.js → experiment-reports-AN4S7PYS.js} +5 -5
- package/dist/{holdout-DAYEAW7R.js → holdout-BRW4HAT7.js} +2 -2
- package/dist/index.js +34 -34
- package/dist/index.js.map +1 -1
- package/dist/init-Q234CCOT.js +19 -0
- package/dist/lifecycle-RROP7JMK.js +12 -0
- package/dist/{links-JWPXODYS.js → links-DYSFIVRV.js} +4 -4
- package/dist/{login-OT77MNKL.js → login-JIH5576K.js} +3 -3
- package/dist/{menu-ZQ2XWIW6.js → menu-TCO6OVKR.js} +27 -27
- package/dist/menu-TCO6OVKR.js.map +1 -0
- package/dist/{notes-QN5XW2TI.js → notes-KHLQUNEF.js} +4 -4
- package/dist/{plan-UHBAQXRB.js → plan-BYRG2YK6.js} +3 -3
- package/dist/plan-BYRG2YK6.js.map +1 -0
- package/dist/{push-QE4QNPFH.js → push-6MOHROGS.js} +4 -4
- package/dist/{refs-OHRAWIMW.js → refs-5RMWQPHX.js} +2 -2
- package/dist/{remove-ZQKXHLFS.js → remove-C65D4VDA.js} +3 -3
- package/dist/{report-E6EJECSP.js → report-Z5XHK5D6.js} +4 -4
- package/dist/report-Z5XHK5D6.js.map +1 -0
- package/dist/{results-OJJKMZ4O.js → results-3UYAU4OP.js} +6 -6
- package/dist/{review-GIYBPVP3.js → review-FOE4IIXA.js} +2 -2
- package/dist/{ship-FP4QMHLA.js → ship-6HWSIA2E.js} +3 -3
- package/dist/{skills-4G73YN3S.js → skills-RBRC7UWI.js} +4 -4
- package/dist/status-RLKOX6NA.js +17 -0
- package/package.json +4 -4
- package/dist/chunk-4OQEIP33.js.map +0 -1
- package/dist/chunk-5JKDO4IN.js.map +0 -1
- package/dist/chunk-5UN2NKIF.js.map +0 -1
- package/dist/chunk-7SLMC74Z.js.map +0 -1
- package/dist/chunk-CAFWOX3S.js.map +0 -1
- package/dist/chunk-FCV7PQN6.js.map +0 -1
- package/dist/chunk-G2URJ423.js.map +0 -1
- package/dist/chunk-OX3FZH2C.js.map +0 -1
- package/dist/chunk-OXQZJCAC.js.map +0 -1
- package/dist/chunk-OZZDQP37.js.map +0 -1
- package/dist/chunk-RBV5NIMY.js.map +0 -1
- package/dist/chunk-TBOAI6R7.js.map +0 -1
- package/dist/chunk-VLHSGWBW.js.map +0 -1
- package/dist/chunk-WQETHW5W.js.map +0 -1
- package/dist/chunk-XCWKBO5S.js.map +0 -1
- package/dist/chunk-XTHEBWKY.js.map +0 -1
- package/dist/chunk-YRHCGHV7.js.map +0 -1
- package/dist/chunk-YZPQK4N7.js.map +0 -1
- package/dist/chunk-Z2LTGGUG.js.map +0 -1
- package/dist/connect-UHAZVDEZ.js.map +0 -1
- package/dist/domains-CR34APOD.js +0 -10
- package/dist/init-ZTGN3IJF.js +0 -19
- package/dist/lifecycle-A6CEBOE4.js +0 -12
- package/dist/menu-ZQ2XWIW6.js.map +0 -1
- package/dist/plan-UHBAQXRB.js.map +0 -1
- package/dist/report-E6EJECSP.js.map +0 -1
- package/dist/status-SDXLN4SE.js +0 -17
- /package/dist/{alerts-RXUG22S7.js.map → alerts-WOWJ3MZV.js.map} +0 -0
- /package/dist/{analytics-BS3Z6HEF.js.map → analytics-ZGLVQDIL.js.map} +0 -0
- /package/dist/{chunk-XWVEN3MM.js.map → chunk-LF4ZI43E.js.map} +0 -0
- /package/dist/{chunk-45VJUM7P.js.map → chunk-VMYL36BP.js.map} +0 -0
- /package/dist/{chunk-NFZZSF4M.js.map → chunk-XT7Z5GY2.js.map} +0 -0
- /package/dist/{ci-W72GPWEB.js.map → ci-G4IQPM5K.js.map} +0 -0
- /package/dist/{create-GJKGCXTJ.js.map → create-7VLV2H67.js.map} +0 -0
- /package/dist/{dev-4O4ZVVKH.js.map → dev-3CPW4LTF.js.map} +0 -0
- /package/dist/{doctor-MB3F72TI.js.map → doctor-L7NTDL2E.js.map} +0 -0
- /package/dist/{domains-CR34APOD.js.map → domains-J5SKVM6S.js.map} +0 -0
- /package/dist/{experiment-reports-WMODMYBX.js.map → experiment-reports-AN4S7PYS.js.map} +0 -0
- /package/dist/{holdout-DAYEAW7R.js.map → holdout-BRW4HAT7.js.map} +0 -0
- /package/dist/{init-ZTGN3IJF.js.map → init-Q234CCOT.js.map} +0 -0
- /package/dist/{lifecycle-A6CEBOE4.js.map → lifecycle-RROP7JMK.js.map} +0 -0
- /package/dist/{links-JWPXODYS.js.map → links-DYSFIVRV.js.map} +0 -0
- /package/dist/{login-OT77MNKL.js.map → login-JIH5576K.js.map} +0 -0
- /package/dist/{notes-QN5XW2TI.js.map → notes-KHLQUNEF.js.map} +0 -0
- /package/dist/{push-QE4QNPFH.js.map → push-6MOHROGS.js.map} +0 -0
- /package/dist/{refs-OHRAWIMW.js.map → refs-5RMWQPHX.js.map} +0 -0
- /package/dist/{remove-ZQKXHLFS.js.map → remove-C65D4VDA.js.map} +0 -0
- /package/dist/{results-OJJKMZ4O.js.map → results-3UYAU4OP.js.map} +0 -0
- /package/dist/{review-GIYBPVP3.js.map → review-FOE4IIXA.js.map} +0 -0
- /package/dist/{ship-FP4QMHLA.js.map → ship-6HWSIA2E.js.map} +0 -0
- /package/dist/{skills-4G73YN3S.js.map → skills-RBRC7UWI.js.map} +0 -0
- /package/dist/{status-SDXLN4SE.js.map → status-RLKOX6NA.js.map} +0 -0
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-CB2SJFHK.js";
|
|
5
5
|
import {
|
|
6
6
|
writeWorkflow
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-3V6SD74H.js";
|
|
8
8
|
import {
|
|
9
9
|
appPackages,
|
|
10
10
|
appProviderSnippet,
|
|
@@ -14,19 +14,19 @@ import {
|
|
|
14
14
|
nativeSetup,
|
|
15
15
|
patchAppEntry,
|
|
16
16
|
screenTracking
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-NZ4RSQ56.js";
|
|
18
18
|
import {
|
|
19
19
|
deviceLogin
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-XT7Z5GY2.js";
|
|
21
21
|
import {
|
|
22
22
|
installSkills,
|
|
23
23
|
loadSkillFiles
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-DOPSOUUT.js";
|
|
25
25
|
import {
|
|
26
26
|
configTemplate,
|
|
27
27
|
nextMiddlewareTemplate,
|
|
28
28
|
nextRouteTemplate
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-BDCKWKJB.js";
|
|
30
30
|
import {
|
|
31
31
|
detectProject,
|
|
32
32
|
installCommand
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
import {
|
|
35
35
|
cloudTarget,
|
|
36
36
|
loadCredential
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-H5GMGCOT.js";
|
|
38
38
|
import {
|
|
39
39
|
c
|
|
40
40
|
} from "./chunk-ZISCJRR5.js";
|
|
@@ -50,7 +50,7 @@ var DB_KINDS = ["sqlite", "postgres", "mysql", "custom"];
|
|
|
50
50
|
var PG_STORE = `import { countsFromRow, propertyCountsFromRows, propertyCountsSql, storedEventFromRow, variantCountsSql, type ExperimentSummary, type PropertyCounts, type Store, type StoredEvent, type StoreVariantCounts } from '@splithub/node';
|
|
51
51
|
import { Pool } from 'pg';
|
|
52
52
|
|
|
53
|
-
//
|
|
53
|
+
// sh2 events in your Postgres. Run once (or add to your migrations):
|
|
54
54
|
export const SCHEMA_SQL = \`
|
|
55
55
|
CREATE TABLE IF NOT EXISTS splithub_events (
|
|
56
56
|
id text PRIMARY KEY,
|
|
@@ -77,7 +77,7 @@ CREATE INDEX IF NOT EXISTS splithub_events_goal ON splithub_events (type, goal,
|
|
|
77
77
|
ALTER TABLE splithub_events ADD COLUMN IF NOT EXISTS platform text, ADD COLUMN IF NOT EXISTS app_version text;
|
|
78
78
|
\`;
|
|
79
79
|
|
|
80
|
-
// The attribution rule shared by every
|
|
80
|
+
// The attribution rule shared by every sh2 store (first exposure, 60 s clock skew, 50 goals per visitor and day).
|
|
81
81
|
const counts = variantCountsSql({ dialect: 'postgres', table: 'splithub_events' });
|
|
82
82
|
// Analytics properties: pageviews, events, engagement and identify rows share the table; raw counts
|
|
83
83
|
// only (users = distinct ids sent with identify).
|
|
@@ -137,7 +137,7 @@ export function pgStore(pool: Pool = new Pool({ connectionString: process.env.DA
|
|
|
137
137
|
var MYSQL_STORE = `import { countsFromRow, propertyCountsFromRows, propertyCountsSql, storedEventFromRow, variantCountsSql, type ExperimentSummary, type PropertyCounts, type Store, type StoredEvent, type StoreVariantCounts } from '@splithub/node';
|
|
138
138
|
import mysql, { type Pool } from 'mysql2/promise';
|
|
139
139
|
|
|
140
|
-
//
|
|
140
|
+
// sh2 events in your MySQL / MariaDB / PlanetScale. Run once (or add to your migrations):
|
|
141
141
|
export const SCHEMA_SQL = \`
|
|
142
142
|
CREATE TABLE IF NOT EXISTS splithub_events (
|
|
143
143
|
id VARCHAR(64) PRIMARY KEY,
|
|
@@ -162,7 +162,7 @@ CREATE TABLE IF NOT EXISTS splithub_events (
|
|
|
162
162
|
);
|
|
163
163
|
\`;
|
|
164
164
|
|
|
165
|
-
// The attribution rule shared by every
|
|
165
|
+
// The attribution rule shared by every sh2 store (first exposure, 60 s clock skew, 50 goals per visitor and day).
|
|
166
166
|
const counts = variantCountsSql({ dialect: 'mysql', table: 'splithub_events' });
|
|
167
167
|
// Analytics properties: pageviews, events, engagement and identify rows share the table; raw counts
|
|
168
168
|
// only (users = distinct ids sent with identify).
|
|
@@ -311,14 +311,14 @@ async function init(flags) {
|
|
|
311
311
|
const notes = [];
|
|
312
312
|
let mode = str(flags.mode);
|
|
313
313
|
if (native && mode === "self") {
|
|
314
|
-
notes.push("Native apps read their experiments from
|
|
314
|
+
notes.push("Native apps read their experiments from sh2 Cloud, so this project is set up for the cloud.");
|
|
315
315
|
mode = "cloud";
|
|
316
316
|
}
|
|
317
317
|
if (!mode) {
|
|
318
318
|
if (yes || native) mode = project.app ? "cloud" : "self";
|
|
319
319
|
else {
|
|
320
320
|
const self = { value: "self", label: "My own database (self-hosted)", hint: rn ? "your server keeps the events; experiments ship with each release" : "free forever, nothing leaves your infra" };
|
|
321
|
-
const cloud = { value: "cloud", label: "
|
|
321
|
+
const cloud = { value: "cloud", label: "sh2 Cloud", hint: rn ? "start and change experiments without a store release" : "hosted dashboard, no server code" };
|
|
322
322
|
const picked = await p.select({ message: "Where should events be stored?", options: rn ? [cloud, self] : [self, cloud] });
|
|
323
323
|
if (p.isCancel(picked)) return cancel2();
|
|
324
324
|
mode = picked;
|
|
@@ -347,7 +347,7 @@ async function init(flags) {
|
|
|
347
347
|
key ??= saved.publicKey ?? void 0;
|
|
348
348
|
connected = { projectName: saved.projectName, projectId: saved.projectId };
|
|
349
349
|
} else if (!process.env.SPLITHUB_API_KEY && !flags["no-login"]) {
|
|
350
|
-
if (!json) p.log.step("Connect to
|
|
350
|
+
if (!json) p.log.step("Connect to sh2 Cloud");
|
|
351
351
|
try {
|
|
352
352
|
const cred = await deviceLogin({
|
|
353
353
|
api,
|
|
@@ -410,7 +410,7 @@ Code ${c.green(s.userCode)} \xB7 sign in, pick or create the project, approve.`,
|
|
|
410
410
|
}
|
|
411
411
|
let mcp = !flags["no-mcp"];
|
|
412
412
|
if (!yes && !json && mcp) {
|
|
413
|
-
const want = await p.confirm({ message: "Register the
|
|
413
|
+
const want = await p.confirm({ message: "Register the sh2 MCP server for Claude Code / Cursor (.mcp.json, .cursor/mcp.json)?", initialValue: true });
|
|
414
414
|
if (p.isCancel(want)) return cancel2();
|
|
415
415
|
mcp = want;
|
|
416
416
|
}
|
|
@@ -507,4 +507,4 @@ export {
|
|
|
507
507
|
importPath,
|
|
508
508
|
init
|
|
509
509
|
};
|
|
510
|
-
//# sourceMappingURL=chunk-
|
|
510
|
+
//# sourceMappingURL=chunk-Q5LYYWYC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/init.ts","../src/templates-store.ts"],"sourcesContent":["import * as p from '@clack/prompts';\nimport { execSync } from 'node:child_process';\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport { dirname, join, relative } from 'node:path';\nimport { cloudTarget } from '../api';\nimport { appPackages, appProviderSnippet, findAppEntry, isNativeApp, isReactNativeApp, nativeSetup, patchAppEntry, screenTracking, type EntryPatch } from '../app-setup';\nimport { findTypeScript } from '../typescript';\nimport { loadCredential } from '../credentials';\nimport { detectProject, installCommand } from '../project';\nimport { deviceLogin } from './login';\nimport { configTemplate, nextMiddlewareTemplate, nextRouteTemplate } from '../templates';\nimport { DB_KINDS, runtimePackages, storeTemplate, storeUsage, type DbKind } from '../templates-store';\nimport { installSkills, loadSkillFiles } from './skills';\nimport { writeWorkflow } from './ci';\nimport { c } from '../ui';\n\nexport type Flags = Record<string, string | boolean | string[] | undefined>;\n\nfunction str(v: unknown): string | undefined {\n return typeof v === 'string' ? v : undefined;\n}\n\nfunction writeIfMissing(file: string, content: string, created: string[], skipped: string[]): void {\n if (existsSync(file)) {\n skipped.push(file);\n return;\n }\n mkdirSync(dirname(file), { recursive: true });\n writeFileSync(file, content, 'utf8');\n created.push(file);\n}\n\nexport function importPath(fromFile: string, toFile: string): string {\n let rel = relative(dirname(fromFile), toFile).replace(/\\\\/g, '/').replace(/\\.(ts|mts|js|mjs)$/, '');\n if (!rel.startsWith('.')) rel = `./${rel}`;\n return rel;\n}\n\n// Vite apps run the SDK in the browser; this plugin prints what each experiment does in the dev server's terminal.\nconst VITE_PLUGIN_HINT = `// vite.config.ts\nimport { splithub } from '@splithub/core/vite';\n\nexport default defineConfig({ plugins: [react(), splithub()] });`;\n\nexport async function init(flags: Flags): Promise<void> {\n const yes = Boolean(flags.yes);\n const json = Boolean(flags.json);\n const project = detectProject();\n const created: string[] = [];\n const skipped: string[] = [];\n\n if (!json) p.intro(c.bold('splithub init'));\n\n // Apps: React Native / Expo get the npm package and a wrapped entry; native iOS / Android get install lines.\n const rn = isReactNativeApp(project.app);\n const native = isNativeApp(project.app);\n const notes: string[] = [];\n\n let mode = str(flags.mode) as 'self' | 'cloud' | undefined;\n if (native && mode === 'self') {\n notes.push('Native apps read their experiments from sh2 Cloud, so this project is set up for the cloud.');\n mode = 'cloud';\n }\n if (!mode) {\n // An app cannot reach a self-hosted endpoint without a server URL, and only the cloud starts experiments without a release.\n if (yes || native) mode = project.app ? 'cloud' : 'self';\n else {\n const self = { value: 'self', label: 'My own database (self-hosted)', hint: rn ? 'your server keeps the events; experiments ship with each release' : 'free forever, nothing leaves your infra' };\n const cloud = { value: 'cloud', label: 'sh2 Cloud', hint: rn ? 'start and change experiments without a store release' : 'hosted dashboard, no server code' };\n const picked = await p.select({ message: 'Where should events be stored?', options: rn ? [cloud, self] : [self, cloud] });\n if (p.isCancel(picked)) return cancel();\n mode = picked as 'self' | 'cloud';\n }\n }\n\n // Cloud: connect this directory to a project. A saved login or SPLITHUB_API_KEY\n // is enough; otherwise run the device flow — print a link, the human signs in\n // and picks (or creates) the project, the CLI gets the keys. Works when an\n // agent runs init: it relays the link, the user clicks it.\n // Self mode: which database keeps the events. sqlite needs nothing; postgres / mysql\n // get a ready Store in splithub/store.ts; custom gets a documented stub.\n let db: DbKind = (DB_KINDS as string[]).includes(str(flags.db) ?? '') ? (str(flags.db) as DbKind) : 'sqlite';\n if (mode === 'self' && !project.app && !flags.db && !yes) {\n const picked = await p.select({\n message: 'Where should events be stored?',\n options: [\n { value: 'sqlite', label: 'SQLite file (zero setup)', hint: './splithub.db via node:sqlite' },\n { value: 'postgres', label: 'Postgres', hint: 'pg + DATABASE_URL, table splithub_events' },\n { value: 'mysql', label: 'MySQL / MariaDB / PlanetScale', hint: 'mysql2 + DATABASE_URL' },\n { value: 'custom', label: 'My own store (Prisma, Drizzle, Supabase, Mongo…)', hint: 'a stub with the three methods to fill in' },\n ],\n });\n if (p.isCancel(picked)) return cancel();\n db = picked as DbKind;\n }\n\n let key = str(flags.key);\n let connected: { projectName: string | null; projectId: string | null } | null = null;\n if (mode === 'cloud') {\n const api = cloudTarget(flags).url;\n const saved = loadCredential(api, project.root);\n if (saved) {\n key ??= saved.publicKey ?? undefined;\n connected = { projectName: saved.projectName, projectId: saved.projectId };\n } else if (!process.env.SPLITHUB_API_KEY && !flags['no-login']) {\n if (!json) p.log.step('Connect to sh2 Cloud');\n try {\n const cred = await deviceLogin({\n api,\n root: project.root,\n json,\n onCode: json\n ? (s) => console.log(JSON.stringify({ step: 'approve', verifyUrl: s.verifyUrl, userCode: s.userCode, expiresIn: s.expiresIn, hint: 'Show this link to the user and wait; init continues once approved.' }))\n : (s) => p.note(`${c.cyan(s.verifyUrl)}\\n\\nCode ${c.green(s.userCode)} · sign in, pick or create the project, approve.`, 'Open this link'),\n });\n key ??= cred.publicKey ?? undefined;\n connected = { projectName: cred.projectName, projectId: cred.projectId };\n if (!json) p.log.success(`connected to ${c.cyan(cred.projectName ?? cred.projectId ?? 'project')}`);\n } catch (error) {\n if (!json) p.log.warn(`not connected: ${error instanceof Error ? error.message : String(error)}. Run ${c.cyan('npx splithub login')} later.`);\n }\n }\n // An API key in the environment (CI, agents) identifies the project: ask the cloud for its public key.\n if (!key && process.env.SPLITHUB_API_KEY) {\n try {\n const res = await fetch(`${api}/config`, { headers: { authorization: `Bearer ${process.env.SPLITHUB_API_KEY}` } });\n const body = (await res.json().catch(() => ({}))) as { publicKey?: string };\n if (typeof body.publicKey === 'string' && body.publicKey.startsWith('pk_')) {\n key = body.publicKey;\n connected ??= { projectName: null, projectId: null };\n }\n } catch {\n // offline: the first push writes the key into the config anyway\n }\n }\n if (!key && !yes) {\n const k = await p.text({ message: 'Cloud public key (pk_...), leave empty to set later via NEXT_PUBLIC_SPLITHUB_KEY', placeholder: 'pk_' });\n if (p.isCancel(k)) return cancel();\n key = k || undefined;\n }\n }\n\n // 1. config\n // Native apps never read the file (the SDK gets experiments from the cloud), so they get none.\n const configFile = project.configFile ?? join(project.root, 'splithub.config.ts');\n if (!native) writeIfMissing(configFile, configTemplate(project.name, mode, key, { app: rn }), created, skipped);\n\n // 2a. store for self mode (postgres / mysql / custom); sqlite needs no file. An app's events go to a server set up on its own.\n const storeBody = mode === 'self' && !project.app ? storeTemplate(db) : null;\n if (rn && mode === 'self') notes.push('Self-hosted: the app sends to storage.endpoint in the config. Point it at your server, and run npx splithub init --mode self there for the ingest route.');\n\n // 2b. app entry: wrap it in <SplitHubProvider>, with screen tracking.\n const screens = screenTracking(project);\n let entry: { file: string | null; patch: EntryPatch } | null = null;\n if (rn) {\n const file = findAppEntry(project.root, project.expoRouter);\n const ts = file ? await findTypeScript(project.root) : null;\n if (!file) entry = { file: null, patch: { source: null, status: 'manual', screens: false, reason: project.expoRouter ? 'no app/_layout.tsx' : 'no App.tsx' } };\n else if (!ts) entry = { file, patch: { source: null, status: 'manual', screens: false, reason: 'TypeScript is not installed, so the entry was left as it is' } };\n else {\n const patch = patchAppEntry(ts, file, readFileSync(file, 'utf8'), { configImport: importPath(file, configFile), screens });\n if (patch.source !== null) writeFileSync(file, patch.source, 'utf8');\n entry = { file, patch };\n }\n }\n const storeFile = storeBody ? join(project.root, 'splithub', 'store.ts') : null;\n if (storeFile && storeBody) writeIfMissing(storeFile, storeBody, created, skipped);\n\n // 2. framework files\n if (project.framework === 'next') {\n const mwFile = join(project.root, project.hasSrc ? 'src/middleware.ts' : 'middleware.ts');\n writeIfMissing(mwFile, nextMiddlewareTemplate(importPath(mwFile, configFile)), created, skipped);\n if (mode === 'self' && project.appDir) {\n const routeFile = join(project.root, project.appDir, 'api/splithub/[[...path]]/route.ts');\n writeIfMissing(routeFile, nextRouteTemplate(importPath(routeFile, configFile), storeUsage(db, storeFile ? importPath(routeFile, storeFile) : '')), created, skipped);\n }\n }\n\n // 3. agent skills (+ MCP server registration): the agent learns the library, how to test\n // well, the API and the MCP tools from .claude/skills/*; Cursor gets the rule file.\n let mcp = !flags['no-mcp'];\n if (!yes && !json && mcp) {\n const want = await p.confirm({ message: 'Register the sh2 MCP server for Claude Code / Cursor (.mcp.json, .cursor/mcp.json)?', initialValue: true });\n if (p.isCancel(want)) return cancel();\n mcp = want;\n }\n const skillsResult = installSkills(project.root, { mcp, ...(await loadSkillFiles(flags)) });\n created.push(...skillsResult.written, ...skillsResult.mcp.map((f) => `${f} (MCP server)`));\n skipped.push(...skillsResult.skipped);\n\n // 3b. GitHub workflow: checks on PRs, results comment on a schedule.\n if (flags['github-action']) {\n const wf = writeWorkflow(project.root, Boolean(flags.force));\n (wf.written ? created : skipped).push(join(project.root, wf.file));\n }\n\n // 4. dependencies\n const pkgs = rn ? appPackages(project) : null;\n const runtime = pkgs ? pkgs.runtime : ['@splithub/react', '@splithub/core'];\n if (project.framework === 'next' && !rn) runtime.push('@splithub/next');\n if (mode === 'self' && !project.app) runtime.push('@splithub/node', ...runtimePackages(db));\n const installRuntime = installCommand(project.packageManager, runtime);\n // Expo picks the native module version that matches the app's SDK.\n const installExpo = pkgs?.expo.length ? `npx expo install ${pkgs.expo.join(' ')}` : null;\n const installDev = installCommand(project.packageManager, ['splithub'], true);\n const commands = native ? [] : [installRuntime, ...(installExpo ? [installExpo] : []), installDev];\n let installed = false;\n if (!flags['no-install'] && commands.length) {\n const go = yes ? true : await p.confirm({ message: `Install packages now? (${commands.slice(0, -1).join(' && ')})` });\n if (p.isCancel(go)) return cancel();\n if (go) {\n const s = json ? null : p.spinner();\n s?.start('Installing');\n try {\n for (const cmd of commands) execSync(cmd, { cwd: project.root, stdio: json ? 'ignore' : 'inherit' });\n installed = true;\n s?.stop('Installed');\n } catch (error) {\n s?.stop('Install failed; run it manually');\n if (!json) p.log.error(error instanceof Error ? error.message : String(error));\n }\n }\n }\n\n const entryFile = entry?.file ?? join(project.root, project.expoRouter ? 'app/_layout.tsx' : 'App.tsx');\n const nativeKit = native ? nativeSetup(project.app as 'ios' | 'android', key ?? null) : null;\n const providerHint = nativeKit\n ? `${nativeKit.install}\\n\\n${nativeKit.quickStart}`\n : rn\n ? appProviderSnippet(importPath(entryFile, configFile), screens)\n : project.framework === 'next'\n ? `// ${project.appDir ?? 'app'}/layout.tsx\\nimport { SplitHubNextProvider } from '@splithub/next/client';\\nimport { getSplitHub } from '@splithub/next/server';\\nimport config from '${importPath(join(project.root, project.appDir ?? 'app', 'layout.tsx'), configFile)}';\\n\\nexport default async function RootLayout({ children }) {\\n const sh = await getSplitHub(config);\\n return <html><body><SplitHubNextProvider config={config} visitorId={sh.visitorId ?? undefined} remoteOverrides={sh.overrides}>{children}</SplitHubNextProvider></body></html>;\\n}`\n : `// main.tsx\\nimport { SplitHubProvider } from '@splithub/react';\\nimport config from './splithub.config';\\n\\n<SplitHubProvider config={config}><App /></SplitHubProvider>`;\n\n const warning =\n mode === 'cloud' && !key\n ? native\n ? 'No public key yet: run `npx splithub login` (or pass --key pk_…, dashboard → Setup) and put it in SplitHub.start.'\n : `No public key yet: storage.key falls back to process.env.${rn ? 'EXPO_PUBLIC_SPLITHUB_KEY' : 'NEXT_PUBLIC_SPLITHUB_KEY'}. It is written into the config by the first \\`npx splithub push\\`, by \\`npx splithub login\\` (saved with the credentials), or pass --key pk_… (dashboard → Setup); SPLITHUB_API_KEY in the environment also resolves it.`\n : null;\n if (rn && entry?.file && entry.patch.status === 'added') created.push(`${entry.file} (wrapped in <SplitHubProvider>${entry.patch.screens && screens ? ', screens tracked' : ''})`);\n if (rn && entry?.patch.status === 'added' && !entry.patch.screens && screens) notes.push(`Screens: add <NavigationScreens /> inside your <NavigationContainer> (from @splithub/react-native).`);\n if (rn && !screens) notes.push(\"Screens: call useScreen('Home') in each screen (from @splithub/react-native).\");\n if (project.app) notes.push('Experiments in splithub.config.ts ship inside the app binary. Create them in the dashboard to start them without a store release.');\n const app = project.app\n ? {\n kind: project.app,\n screens: rn ? screens ?? 'useScreen' : null,\n entry: entry ? { file: entry.file ? relative(project.root, entry.file).replace(/\\\\/g, '/') : null, status: entry.patch.status, screens: entry.patch.screens, ...(entry.patch.reason ? { reason: entry.patch.reason } : {}) } : null,\n ...(nativeKit ? { install: nativeKit.install, quickStart: nativeKit.quickStart } : {}),\n }\n : null;\n const providerDone = entry?.patch.status === 'added' || entry?.patch.status === 'already';\n const summary = { project: project.name, framework: project.framework, app, mode, db: mode === 'self' && !project.app ? db : null, connected, publicKey: key ?? null, warning, notes, created, skipped, installed, installCommands: installed ? [] : commands, nextStep: providerDone ? null : providerHint, ...(project.framework === 'vite' && !rn ? { vitePlugin: VITE_PLUGIN_HINT } : {}) };\n\n if (json) {\n console.log(JSON.stringify(summary));\n return;\n }\n if (warning) p.log.warn(warning);\n for (const note of notes) p.log.info(note);\n if (mode === 'self' && !project.app && db !== 'sqlite') p.note(db === 'custom' ? 'Fill in the three methods in splithub/store.ts (the comments say what each must return).' : `Set DATABASE_URL and run the SCHEMA_SQL from splithub/store.ts once (or add it to your migrations).`, `Database: ${db}`);\n if (created.length) p.note(created.map((f) => relative(project.root, f) || f).join('\\n'), 'Created');\n if (skipped.length) p.note(skipped.map((f) => relative(project.root, f)).join('\\n'), 'Already present, left untouched');\n if (!installed && commands.length) p.note(commands.join('\\n'), 'Install');\n if (nativeKit) {\n p.note(nativeKit.install, project.app === 'ios' ? 'Add the Swift package' : 'Add the Gradle dependency');\n p.note(nativeKit.quickStart, 'Quick start');\n p.outro(`Next: create an experiment in the dashboard, then ${c.cyan('npx splithub status')} and ${c.cyan('npx splithub results <id>')} read it here.`);\n return;\n }\n if (rn && entry?.patch.status === 'manual') p.log.warn(`Left ${entry.file ? relative(project.root, entry.file) : 'the entry'} as it is: ${entry.patch.reason}. Add the provider by hand.`);\n if (!providerDone) p.note(providerHint, 'Wrap your app once');\n if (project.framework === 'vite' && !rn) p.note(VITE_PLUGIN_HINT, 'Notes in your dev terminal');\n const analyticsNext = rn ? `, ${c.cyan('npx splithub analytics connect')} for screens and retention` : '';\n p.outro(`Next: ${c.cyan('npx splithub create')} to add your first experiment, ${c.cyan('npx splithub push')} to sync it${analyticsNext}, ${c.cyan('npx splithub doctor')} to verify.`);\n}\n\n\nfunction cancel(): void {\n p.cancel('Cancelled.');\n process.exit(0);\n}\n","// Store templates for self-hosted mode: `splithub init --mode self --db postgres|mysql|custom`\n// writes splithub/store.ts from one of these. Each implements the Store interface\n// from @splithub/node (insertEvents, variantCounts, summaries, and the raw analytics\n// reads propertyCounts / propertyEvents) with the same\n// attribution rule as the cloud, through variantCountsSql from @splithub/node.\n\nexport type DbKind = 'sqlite' | 'postgres' | 'mysql' | 'custom';\nexport const DB_KINDS: DbKind[] = ['sqlite', 'postgres', 'mysql', 'custom'];\n\nexport const PG_STORE = `import { countsFromRow, propertyCountsFromRows, propertyCountsSql, storedEventFromRow, variantCountsSql, type ExperimentSummary, type PropertyCounts, type Store, type StoredEvent, type StoreVariantCounts } from '@splithub/node';\nimport { Pool } from 'pg';\n\n// sh2 events in your Postgres. Run once (or add to your migrations):\nexport const SCHEMA_SQL = \\`\nCREATE TABLE IF NOT EXISTS splithub_events (\n id text PRIMARY KEY,\n type text NOT NULL, -- exposure | goal | page | event | engage | identify (analytics rows: experiment = property, goal = event name)\n experiment text,\n variant text,\n goal text,\n visitor_id text NOT NULL,\n session_id text NOT NULL,\n ts bigint NOT NULL, -- client clock, unix ms\n url text,\n props jsonb,\n received_at bigint NOT NULL, -- server clock, unix ms\n host text,\n country text,\n device text,\n browser text,\n platform text, -- web | ios | android | macos | windows | linux\n app_version text -- the app's version; null on websites\n);\nCREATE INDEX IF NOT EXISTS splithub_events_exp ON splithub_events (type, experiment, visitor_id, ts);\nCREATE INDEX IF NOT EXISTS splithub_events_goal ON splithub_events (type, goal, visitor_id, ts);\n-- Tables from before the app columns (the store also adds them on its first insert):\nALTER TABLE splithub_events ADD COLUMN IF NOT EXISTS platform text, ADD COLUMN IF NOT EXISTS app_version text;\n\\`;\n\n// The attribution rule shared by every sh2 store (first exposure, 60 s clock skew, 50 goals per visitor and day).\nconst counts = variantCountsSql({ dialect: 'postgres', table: 'splithub_events' });\n// Analytics properties: pageviews, events, engagement and identify rows share the table; raw counts\n// only (users = distinct ids sent with identify).\nconst prop = propertyCountsSql({ dialect: 'postgres', table: 'splithub_events' });\n\nexport function pgStore(pool: Pool = new Pool({ connectionString: process.env.DATABASE_URL })): Store {\n // A table made before the app columns gets them on the first insert. Without ALTER rights they are left out.\n let appColumns: Promise<boolean> | null = null;\n const ensureAppColumns = (): Promise<boolean> =>\n (appColumns ??= (async () => {\n const have = async () =>\n (await pool.query(\"SELECT column_name FROM information_schema.columns WHERE table_schema = current_schema() AND table_name = 'splithub_events' AND column_name IN ('platform', 'app_version')\")).rows.length === 2;\n if (await have()) return true;\n await pool.query('ALTER TABLE splithub_events ADD COLUMN IF NOT EXISTS platform text, ADD COLUMN IF NOT EXISTS app_version text').catch(() => undefined);\n return have();\n })().catch(() => false));\n return {\n async insertEvents(events: StoredEvent[]) {\n if (events.length === 0) return 0;\n const app = await ensureAppColumns();\n const cols = app ? 17 : 15;\n const values: unknown[] = [];\n const rows = events.map((e, i) => {\n values.push(e.id, e.type, e.experiment, e.variant, e.goal, e.visitorId, e.sessionId, e.ts, e.url, e.props ? JSON.stringify(e.props) : null, e.receivedAt, e.host ?? null, e.country ?? null, e.device ?? null, e.browser ?? null);\n if (app) values.push(e.platform ?? null, e.app_version ?? null);\n return '(' + Array.from({ length: cols }, (_, j) => '$' + (i * cols + j + 1)).join(', ') + ')';\n });\n const r = await pool.query(\n 'INSERT INTO splithub_events (id, type, experiment, variant, goal, visitor_id, session_id, ts, url, props, received_at, host, country, device, browser' + (app ? ', platform, app_version' : '') + ') VALUES ' + rows.join(', ') + ' ON CONFLICT (id) DO NOTHING',\n values\n );\n return r.rowCount ?? 0;\n },\n async variantCounts(experiment: string, goal: string): Promise<StoreVariantCounts[]> {\n const r = await pool.query(counts.sql, counts.bind({ experiment, goal }));\n return r.rows.map(countsFromRow);\n },\n async summaries(): Promise<ExperimentSummary[]> {\n const r = await pool.query(\n \\`SELECT experiment, COUNT(*)::int AS exposures, COUNT(DISTINCT visitor_id)::int AS visitors, MIN(ts)::bigint AS first_ts, MAX(ts)::bigint AS last_ts\n FROM splithub_events WHERE type = 'exposure' GROUP BY experiment\\`\n );\n return r.rows.map((x) => ({ experiment: String(x.experiment), exposures: Number(x.exposures), visitors: Number(x.visitors), firstExposureAt: x.first_ts == null ? null : Number(x.first_ts), lastExposureAt: x.last_ts == null ? null : Number(x.last_ts) }));\n },\n async propertyCounts(property: string, since: number, until?: number): Promise<PropertyCounts> {\n const [totals, events] = await Promise.all([pool.query(prop.totals.sql, prop.totals.bind({ property, since, until })), pool.query(prop.events.sql, prop.events.bind({ property, since, until }))]);\n return propertyCountsFromRows(totals.rows[0], events.rows);\n },\n async propertyEvents(property: string, { before, limit }: { before: number; limit: number }): Promise<StoredEvent[]> {\n const r = await pool.query(prop.rows.sql, prop.rows.bind({ property, before, limit }));\n return r.rows.map(storedEventFromRow);\n },\n close: () => pool.end(),\n };\n}\n`;\n\nexport const MYSQL_STORE = `import { countsFromRow, propertyCountsFromRows, propertyCountsSql, storedEventFromRow, variantCountsSql, type ExperimentSummary, type PropertyCounts, type Store, type StoredEvent, type StoreVariantCounts } from '@splithub/node';\nimport mysql, { type Pool } from 'mysql2/promise';\n\n// sh2 events in your MySQL / MariaDB / PlanetScale. Run once (or add to your migrations):\nexport const SCHEMA_SQL = \\`\nCREATE TABLE IF NOT EXISTS splithub_events (\n id VARCHAR(64) PRIMARY KEY,\n type VARCHAR(16) NOT NULL, -- exposure | goal | page | event | engage | identify\n experiment VARCHAR(64) NULL,\n variant VARCHAR(64) NULL,\n goal VARCHAR(64) NULL,\n visitor_id VARCHAR(64) NOT NULL,\n session_id VARCHAR(64) NOT NULL,\n ts BIGINT NOT NULL,\n url VARCHAR(512) NULL,\n props JSON NULL,\n received_at BIGINT NOT NULL,\n host VARCHAR(255) NULL,\n country VARCHAR(8) NULL,\n device VARCHAR(16) NULL,\n browser VARCHAR(32) NULL,\n platform VARCHAR(16) NULL, -- web | ios | android | macos | windows | linux\n app_version VARCHAR(32) NULL, -- the app's version; null on websites\n INDEX splithub_events_exp (type, experiment, visitor_id, ts),\n INDEX splithub_events_goal (type, goal, visitor_id, ts)\n);\n\\`;\n\n// The attribution rule shared by every sh2 store (first exposure, 60 s clock skew, 50 goals per visitor and day).\nconst counts = variantCountsSql({ dialect: 'mysql', table: 'splithub_events' });\n// Analytics properties: pageviews, events, engagement and identify rows share the table; raw counts\n// only (users = distinct ids sent with identify).\nconst prop = propertyCountsSql({ dialect: 'mysql', table: 'splithub_events' });\n\nexport function mysqlStore(pool: Pool = mysql.createPool(process.env.DATABASE_URL ?? '')): Store {\n // A table made before the app columns gets them on the first insert. Without ALTER rights they are left out.\n let appColumns: Promise<boolean> | null = null;\n const ensureAppColumns = (): Promise<boolean> =>\n (appColumns ??= (async () => {\n const have = async () => {\n const [rows] = await pool.query(\"SELECT COLUMN_NAME AS name FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'splithub_events' AND COLUMN_NAME IN ('platform', 'app_version')\");\n return new Set((rows as Array<{ name: string }>).map((r) => r.name));\n };\n const found = await have();\n if (!found.has('platform')) await pool.query('ALTER TABLE splithub_events ADD COLUMN platform VARCHAR(16) NULL').catch(() => undefined);\n if (!found.has('app_version')) await pool.query('ALTER TABLE splithub_events ADD COLUMN app_version VARCHAR(32) NULL').catch(() => undefined);\n return (await have()).size === 2;\n })().catch(() => false));\n return {\n async insertEvents(events: StoredEvent[]) {\n if (events.length === 0) return 0;\n const app = await ensureAppColumns();\n const values = events.map((e) => [e.id, e.type, e.experiment, e.variant, e.goal, e.visitorId, e.sessionId, e.ts, e.url, e.props ? JSON.stringify(e.props) : null, e.receivedAt, e.host ?? null, e.country ?? null, e.device ?? null, e.browser ?? null, ...(app ? [e.platform ?? null, e.app_version ?? null] : [])]);\n const [r] = await pool.query(\n 'INSERT IGNORE INTO splithub_events (id, type, experiment, variant, goal, visitor_id, session_id, ts, url, props, received_at, host, country, device, browser' + (app ? ', platform, app_version' : '') + ') VALUES ?',\n [values]\n );\n return (r as { affectedRows: number }).affectedRows;\n },\n async variantCounts(experiment: string, goal: string): Promise<StoreVariantCounts[]> {\n const [rows] = await pool.query(counts.sql, counts.bind({ experiment, goal }));\n return (rows as Array<Record<string, unknown>>).map(countsFromRow);\n },\n async summaries(): Promise<ExperimentSummary[]> {\n const [rows] = await pool.query(\n \\`SELECT experiment, COUNT(*) AS exposures, COUNT(DISTINCT visitor_id) AS visitors, MIN(ts) AS first_ts, MAX(ts) AS last_ts\n FROM splithub_events WHERE type = 'exposure' GROUP BY experiment\\`\n );\n return (rows as Array<Record<string, unknown>>).map((x) => ({ experiment: String(x.experiment), exposures: Number(x.exposures), visitors: Number(x.visitors), firstExposureAt: x.first_ts == null ? null : Number(x.first_ts), lastExposureAt: x.last_ts == null ? null : Number(x.last_ts) }));\n },\n async propertyCounts(property: string, since: number, until?: number): Promise<PropertyCounts> {\n const [[totals], [events]] = await Promise.all([pool.query(prop.totals.sql, prop.totals.bind({ property, since, until })), pool.query(prop.events.sql, prop.events.bind({ property, since, until }))]);\n return propertyCountsFromRows((totals as Array<Record<string, unknown>>)[0], events as Array<Record<string, unknown>>);\n },\n async propertyEvents(property: string, { before, limit }: { before: number; limit: number }): Promise<StoredEvent[]> {\n const [rows] = await pool.query(prop.rows.sql, prop.rows.bind({ property, before, limit }));\n return (rows as Array<Record<string, unknown>>).map(storedEventFromRow);\n },\n close: () => pool.end(),\n };\n}\n`;\n\nexport const CUSTOM_STORE = `import { attributeVariants, type ExperimentSummary, type Store, type StoredEvent, type StoreVariantCounts } from '@splithub/node';\n\n/**\n * Your own store (Prisma, Drizzle, Supabase, Mongo, anything). Three methods.\n * Attribution rule (keep it, so results match the dashboard):\n * a visitor counts once per experiment, in the variant of their earliest\n * exposure (same ts: smallest variant key), and converts when they sent the\n * goal at or after that exposure (60 s of clock skew allowed); only the first\n * 50 events of one goal per visitor and UTC day count; count unique visitors.\n * SQL database: run variantCountsSql({ dialect }) from @splithub/node.\n * Anything else: load the experiment's exposures and the goal's events and\n * return attributeVariants(events, experiment, goal).\n * Columns worth keeping: id (unique, dedupe on it), type, experiment, variant,\n * goal, visitor_id, session_id, ts, url, props (json), received_at, host,\n * country, device, browser, platform (web | ios | android | macos | windows | linux)\n * and app_version (apps only).\n * Analytics (optional): \\`page\\`, \\`event\\`, \\`engage\\` and \\`identify\\` rows carry the\n * property key in \\`experiment\\` (and the event name in \\`goal\\`); engage props are\n * { ms, scroll }, identify props { uid, traits }. Store them like the others and add\n * propertyCounts(property, since, until?) (or run propertyCountsSql, which also counts users)\n * to read them with \\`splithub analytics\\`.\n */\nexport function customStore(): Store {\n return {\n async insertEvents(events: StoredEvent[]): Promise<number> {\n // Insert, skipping ids that already exist. Return how many were inserted.\n throw new Error('implement insertEvents ' + events.length);\n },\n async variantCounts(experiment: string, goal: string): Promise<StoreVariantCounts[]> {\n // Per variant: exposures, conversions, revenueSum and revenueSumSq (per-visitor revenue).\n // Load the exposures of this experiment and the events of this goal, then apply the shared rule.\n const events: StoredEvent[] = [];\n if (events.length === 0) throw new Error('implement variantCounts ' + experiment + ' ' + goal);\n return attributeVariants(events, experiment, goal);\n },\n async summaries(): Promise<ExperimentSummary[]> {\n // Per experiment: exposures, unique visitors, first and last exposure ts (unix ms).\n throw new Error('implement summaries');\n },\n };\n}\n`;\n\nexport function storeTemplate(db: DbKind): string | null {\n return db === 'postgres' ? PG_STORE : db === 'mysql' ? MYSQL_STORE : db === 'custom' ? CUSTOM_STORE : null;\n}\n\n/** Import line + factory call used by the route template. */\nexport function storeUsage(db: DbKind, storeImport: string): { imports: string; factory: string } {\n switch (db) {\n case 'postgres':\n return { imports: `import { pgStore } from '${storeImport}';`, factory: 'pgStore()' };\n case 'mysql':\n return { imports: `import { mysqlStore } from '${storeImport}';`, factory: 'mysqlStore()' };\n case 'custom':\n return { imports: `import { customStore } from '${storeImport}';`, factory: 'customStore()' };\n default:\n return { imports: `import { sqliteStore } from '@splithub/adapter-sqlite';`, factory: `sqliteStore({ file: process.env.SPLITHUB_DB ?? './splithub.db' })` };\n }\n}\n\nexport function runtimePackages(db: DbKind): string[] {\n return db === 'postgres' ? ['pg'] : db === 'mysql' ? ['mysql2'] : db === 's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AAe;AACtB,EAAE,SAAO,YAAY;AACrB,UAAQ,KAAK,CAAC;AAChB;","names":["cancel","note"]}
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
readSource,
|
|
5
5
|
setExperimentStatus,
|
|
6
6
|
writeConfigChecked
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-K5GDEVMA.js";
|
|
8
8
|
import {
|
|
9
9
|
requireConfig
|
|
10
10
|
} from "./chunk-6K3MHBT7.js";
|
|
11
11
|
import {
|
|
12
12
|
applyLiveStatus
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-H5GMGCOT.js";
|
|
14
14
|
import {
|
|
15
15
|
c,
|
|
16
16
|
fail,
|
|
@@ -51,4 +51,4 @@ async function lifecycle(command, id, flags) {
|
|
|
51
51
|
export {
|
|
52
52
|
lifecycle
|
|
53
53
|
};
|
|
54
|
-
//# sourceMappingURL=chunk-
|
|
54
|
+
//# sourceMappingURL=chunk-VMYL36BP.js.map
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
removeCredential,
|
|
9
9
|
requireCloudToken,
|
|
10
10
|
saveCredential
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-H5GMGCOT.js";
|
|
12
12
|
import {
|
|
13
13
|
CliError,
|
|
14
14
|
c,
|
|
@@ -110,4 +110,4 @@ export {
|
|
|
110
110
|
whoami,
|
|
111
111
|
projects
|
|
112
112
|
};
|
|
113
|
-
//# sourceMappingURL=chunk-
|
|
113
|
+
//# sourceMappingURL=chunk-XT7Z5GY2.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
ciInit,
|
|
5
5
|
workflowTemplate,
|
|
6
6
|
writeWorkflow
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-3V6SD74H.js";
|
|
8
8
|
import "./chunk-6K3MHBT7.js";
|
|
9
9
|
import "./chunk-ZISCJRR5.js";
|
|
10
10
|
export {
|
|
@@ -13,4 +13,4 @@ export {
|
|
|
13
13
|
workflowTemplate,
|
|
14
14
|
writeWorkflow
|
|
15
15
|
};
|
|
16
|
-
//# sourceMappingURL=ci-
|
|
16
|
+
//# sourceMappingURL=ci-G4IQPM5K.js.map
|
|
@@ -2,24 +2,24 @@
|
|
|
2
2
|
import {
|
|
3
3
|
propertyChoices,
|
|
4
4
|
propertySnippets
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-JFRRGBZU.js";
|
|
6
6
|
import {
|
|
7
7
|
addProperty,
|
|
8
8
|
afterAdded,
|
|
9
9
|
printLive
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-PWLTCKEC.js";
|
|
11
|
+
import "./chunk-BLEJ5DOY.js";
|
|
12
|
+
import "./chunk-ISEVDVKJ.js";
|
|
13
13
|
import {
|
|
14
14
|
str
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-GWWJHAH4.js";
|
|
16
16
|
import {
|
|
17
17
|
RN_PACKAGE,
|
|
18
18
|
isReactNativeApp
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-NZ4RSQ56.js";
|
|
20
20
|
import {
|
|
21
21
|
loadConfig
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-K5GDEVMA.js";
|
|
23
23
|
import {
|
|
24
24
|
listSourceFiles,
|
|
25
25
|
requireConfig
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
import {
|
|
28
28
|
cloudTarget,
|
|
29
29
|
request
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-H5GMGCOT.js";
|
|
31
31
|
import {
|
|
32
32
|
c,
|
|
33
33
|
fail,
|
|
@@ -204,15 +204,15 @@ async function connect(given, flags) {
|
|
|
204
204
|
if (wired.status === "added") ok(`named on the provider in ${c.dim(`${wired.file}:${wired.line}`)}`);
|
|
205
205
|
else if (wired.status === "already") ok(`already named on the provider in ${c.dim(`${wired.file}:${wired.line}`)}`);
|
|
206
206
|
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}.`));
|
|
207
|
-
else if (wired.status === "many") console.log(c.yellow(`! More than one
|
|
207
|
+
else if (wired.status === "many") console.log(c.yellow(`! More than one sh2 provider (${wired.files?.join(", ")}): add property="${key}" to the one that wraps the app.`));
|
|
208
208
|
else if (project.app) console.log(`
|
|
209
|
-
No
|
|
209
|
+
No sh2 provider in the code yet: run npx splithub init, or wrap the app once:
|
|
210
210
|
${c.cyan(snippets.provider)}`);
|
|
211
211
|
else if (project.framework === "unknown") console.log(`
|
|
212
212
|
Paste this into the <head> of every page:
|
|
213
213
|
${c.cyan(snippets.script)}`);
|
|
214
214
|
else console.log(`
|
|
215
|
-
No
|
|
215
|
+
No sh2 provider in the code yet. Wrap the app once:
|
|
216
216
|
${c.cyan(snippets.provider)}
|
|
217
217
|
No SDK? The script tag works too:
|
|
218
218
|
${c.cyan(snippets.script)}`);
|
|
@@ -235,4 +235,4 @@ export {
|
|
|
235
235
|
wireProvider,
|
|
236
236
|
wireSource
|
|
237
237
|
};
|
|
238
|
-
//# sourceMappingURL=connect-
|
|
238
|
+
//# sourceMappingURL=connect-BICSF6XG.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 sh2 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 { isReactNativeApp, RN_PACKAGE } from '../app-setup';\nimport { listSourceFiles, requireConfig, type AppKind, 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 sh2 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, app: AppKind | null = null): { provider: string; script: string; track: string; identify: string; screen?: string } {\n const s = propertySnippets(key, publicKey);\n const provider = framework === 'next' && !app ? s.provider.replace('<SplitHubProvider', '<SplitHubNextProvider') : s.provider;\n // React Native re-exports the hooks of @splithub/react; an app has no sh.js.\n const from = isReactNativeApp(app) ? RN_PACKAGE : '@splithub/react';\n return {\n provider,\n script: app ? '' : s.script,\n track: `import { useTrack } from '${from}';\\n\\nconst track = useTrack();\\ntrack('Signup', { plan: 'pro' }); // any name; props are optional`,\n identify: `import { useIdentify } from '${from}';\\n\\nconst identify = useIdentify();\\nidentify(user.id, { plan: 'pro' }); // after sign-in; identify(null) on sign-out`,\n ...(app ? { screen: `import { useScreen } from '${RN_PACKAGE}';\\n\\nuseScreen('Settings'); // screens without a navigation tracker` } : {}),\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, project.app);\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 sh2 provider (${wired.files?.join(', ')}): add property=\"${key}\" to the one that wraps the app.`));\n else if (project.app) console.log(`\\nNo sh2 provider in the code yet: run npx splithub init, or wrap the app once:\\n ${c.cyan(snippets.provider)}`);\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 sh2 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(project.app ? '(screens come from the screen tracker, or useScreen)' : '(pageviews are sent for you)')}`);\n if (project.framework === 'unknown' && !project.app && 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 if (snippets.screen) console.log(`\\n${snippets.screen.split('\\n').map((l) => ` ${c.cyan(l)}`).join('\\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;AAuBzB,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,IAAI,SAAS,QAAQ,CAAC;AACvC,MAAI,KAAK,WAAW,EAAG,QAAO;AAC9B,QAAM,KAAK,KAAK,CAAC,EAAG;AACpB,QAAM,MAAM,OAAO,KAAK,EAAE;AAC1B,MAAI,MAAM,EAAG,QAAO;AACpB,QAAM,MAAM,IAAI,MAAM,IAAI,GAAG;AAC7B,QAAM,WAAW,yEAAyE,KA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AAI,EAAE,IAAI,QAAQ,MAAM,yDAAyD,8BAA8B,CAAC,EAAE;AACxJ,MAAI,QAAQ,cAAc,aAAa,CAAC,QAAQ,OAAO,MAAM,WAAW,OAAQ,SAAQ,IAAI,KAAK,EAAE,KAAK,kDAAkD,CAAC,EAAE;AAAA;AAE3J,YAAQ;AAAA,MACN,SAAS,MACN,MAAM,IAAI,EACV,IAAI,CAAC,MAAM,KAAK,EAAE,KAAK,CAAC,CAAC,EAAE,EAC3B,KAAK,IAAI;AAAA,IACd;AACF,MAAI,SAAS,OAAQ,SAAQ,IAAI;AAAA,EAAK,SAAS,OAAO,MAAM,IAAI,EAAE,IAAI,CAAC,MAAM,KAAK,EAAE,KAAK,CAAC,CAAC,EAAE,EAAE,KAAK,IAAI,CAAC,EAAE;AAC3G,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-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-LF4ZI43E.js";
|
|
8
|
+
import "./chunk-K5GDEVMA.js";
|
|
9
|
+
import "./chunk-BDCKWKJB.js";
|
|
10
10
|
import "./chunk-6K3MHBT7.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-
|
|
18
|
+
//# sourceMappingURL=create-7VLV2H67.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
dev
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-7ADMC5F3.js";
|
|
5
5
|
import "./chunk-6K3MHBT7.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-H5GMGCOT.js";
|
|
7
7
|
import "./chunk-ZISCJRR5.js";
|
|
8
8
|
export {
|
|
9
9
|
dev
|
|
10
10
|
};
|
|
11
|
-
//# sourceMappingURL=dev-
|
|
11
|
+
//# sourceMappingURL=dev-3CPW4LTF.js.map
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
import {
|
|
3
3
|
appChecks,
|
|
4
4
|
doctor
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-5R6543RT.js";
|
|
6
6
|
import "./chunk-4B2SGVPD.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-NZ4RSQ56.js";
|
|
8
8
|
import "./chunk-HFIBLDUA.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-K5GDEVMA.js";
|
|
10
10
|
import "./chunk-6K3MHBT7.js";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-H5GMGCOT.js";
|
|
12
12
|
import "./chunk-ZISCJRR5.js";
|
|
13
13
|
export {
|
|
14
14
|
appChecks,
|
|
15
15
|
doctor
|
|
16
16
|
};
|
|
17
|
-
//# sourceMappingURL=doctor-
|
|
17
|
+
//# sourceMappingURL=doctor-L7NTDL2E.js.map
|
|
@@ -19,11 +19,11 @@ import {
|
|
|
19
19
|
timelineTable,
|
|
20
20
|
visitLength,
|
|
21
21
|
wantsSlice
|
|
22
|
-
} from "./chunk-
|
|
23
|
-
import "./chunk-
|
|
24
|
-
import "./chunk-
|
|
22
|
+
} from "./chunk-IIX2EISO.js";
|
|
23
|
+
import "./chunk-ISEVDVKJ.js";
|
|
24
|
+
import "./chunk-GWWJHAH4.js";
|
|
25
25
|
import "./chunk-6K3MHBT7.js";
|
|
26
|
-
import "./chunk-
|
|
26
|
+
import "./chunk-H5GMGCOT.js";
|
|
27
27
|
import "./chunk-ZISCJRR5.js";
|
|
28
28
|
export {
|
|
29
29
|
EXPERIMENT_BY,
|
|
@@ -46,4 +46,4 @@ export {
|
|
|
46
46
|
visitLength,
|
|
47
47
|
wantsSlice
|
|
48
48
|
};
|
|
49
|
-
//# sourceMappingURL=experiment-reports-
|
|
49
|
+
//# sourceMappingURL=experiment-reports-AN4S7PYS.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
readSource,
|
|
5
5
|
setTopLevel,
|
|
6
6
|
writeConfigChecked
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-K5GDEVMA.js";
|
|
8
8
|
import {
|
|
9
9
|
requireConfig
|
|
10
10
|
} from "./chunk-6K3MHBT7.js";
|
|
@@ -42,4 +42,4 @@ async function holdout(action, value, flags) {
|
|
|
42
42
|
export {
|
|
43
43
|
holdout
|
|
44
44
|
};
|
|
45
|
-
//# sourceMappingURL=holdout-
|
|
45
|
+
//# sourceMappingURL=holdout-BRW4HAT7.js.map
|