@fabricorg/experiments 0.5.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.
@@ -0,0 +1,102 @@
1
+ import { ExperimentModule } from '@fabricorg/experiments-module';
2
+ import { LocalWarehouse } from '@fabricorg/experiments-warehouse';
3
+ import { ExperimentSpec } from '@fabricorg/experiments-domain';
4
+
5
+ interface Workspace {
6
+ root: string;
7
+ fxDir: string;
8
+ storeFile: string;
9
+ warehouseDir: string;
10
+ manifestFile: string;
11
+ module: ExperimentModule;
12
+ warehouse: LocalWarehouse;
13
+ }
14
+ declare function loadWorkspace(cwd?: string): Promise<Workspace>;
15
+
16
+ interface LoadedExperimentSpec {
17
+ path: string;
18
+ spec: ExperimentSpec;
19
+ }
20
+ declare function loadExperimentDir(dir: string): Promise<LoadedExperimentSpec[]>;
21
+ declare function loadExperimentFile(path: string): Promise<ExperimentSpec>;
22
+
23
+ declare function cmdValidate(dir: string): Promise<number>;
24
+
25
+ interface ApplyOptions {
26
+ ownerId?: string;
27
+ approverId?: string;
28
+ tenantId?: string;
29
+ /** Show plan but do not invoke actions. */
30
+ dryRun?: boolean;
31
+ /** Required to apply experiment deletes (YAML removal → kill action). */
32
+ allowDeletes?: boolean;
33
+ }
34
+ declare function cmdApply(dir: string, options?: ApplyOptions): Promise<number>;
35
+
36
+ interface ReportOptions {
37
+ tenantId?: string;
38
+ metricEventName?: string;
39
+ level?: number;
40
+ }
41
+ declare function cmdReport(experimentId: string, options?: ReportOptions): Promise<number>;
42
+
43
+ interface KillOptions {
44
+ reason: string;
45
+ tenantId?: string;
46
+ actorId?: string;
47
+ }
48
+ declare function cmdKill(experimentId: string, options: KillOptions): Promise<number>;
49
+
50
+ interface DevOptions {
51
+ port?: number;
52
+ tenantId?: string;
53
+ }
54
+ /**
55
+ * `fx dev` — the M1 product moment.
56
+ *
57
+ * One process, one log stream:
58
+ * - HTTP server on localhost:<port>
59
+ * - GET /manifest → current manifest JSON (content-hash checksum)
60
+ * - POST /v1/exposure → schema-validated, forwarded to LocalWarehouse
61
+ * - POST /v1/conversion → schema-validated, forwarded to LocalWarehouse
62
+ * - GET /healthz → liveness
63
+ * - LocalWarehouse persisted under .fx/warehouse/
64
+ * - Control plane persisted under .fx/store.json (FileStore — single-writer dev only)
65
+ *
66
+ * Manifest version increments only when content (contentHash) actually changes.
67
+ * Out-of-process mutations (`fx apply` / `fx kill`) are picked up on the next
68
+ * /manifest request because publishManifest reads the FileStore each time.
69
+ */
70
+ declare function cmdDev(options?: DevOptions): Promise<number>;
71
+
72
+ interface PlanOptions {
73
+ tenantId?: string;
74
+ ownerId?: string;
75
+ approverId?: string;
76
+ allowDeletes?: boolean;
77
+ json?: boolean;
78
+ }
79
+ /**
80
+ * `fx plan` — Terraform-style preview. Exit codes:
81
+ * 0 no changes
82
+ * 2 changes pending (or blocked)
83
+ * 1 error
84
+ */
85
+ declare function cmdPlan(dir: string, options?: PlanOptions): Promise<number>;
86
+
87
+ interface PublishOptions {
88
+ tenantId?: string;
89
+ /** When set, also POSTs the signed manifest to a manifest-worker /admin/publish endpoint. */
90
+ remoteUrl?: string;
91
+ /** Bearer token for the remote /admin/publish endpoint. */
92
+ adminToken?: string;
93
+ keyId?: string;
94
+ }
95
+ /**
96
+ * `fx publish` — sign the current manifest with the dev keypair (auto-generated
97
+ * under .fx/keys/) and write it to .fx/manifest.json. Optionally POST it to a
98
+ * deployed manifest-worker via `--remote-url` + `--admin-token`.
99
+ */
100
+ declare function cmdPublish(options?: PublishOptions): Promise<number>;
101
+
102
+ export { type LoadedExperimentSpec, type Workspace, cmdApply, cmdDev, cmdKill, cmdPlan, cmdPublish, cmdReport, cmdValidate, loadExperimentDir, loadExperimentFile, loadWorkspace };
@@ -0,0 +1,102 @@
1
+ import { ExperimentModule } from '@fabricorg/experiments-module';
2
+ import { LocalWarehouse } from '@fabricorg/experiments-warehouse';
3
+ import { ExperimentSpec } from '@fabricorg/experiments-domain';
4
+
5
+ interface Workspace {
6
+ root: string;
7
+ fxDir: string;
8
+ storeFile: string;
9
+ warehouseDir: string;
10
+ manifestFile: string;
11
+ module: ExperimentModule;
12
+ warehouse: LocalWarehouse;
13
+ }
14
+ declare function loadWorkspace(cwd?: string): Promise<Workspace>;
15
+
16
+ interface LoadedExperimentSpec {
17
+ path: string;
18
+ spec: ExperimentSpec;
19
+ }
20
+ declare function loadExperimentDir(dir: string): Promise<LoadedExperimentSpec[]>;
21
+ declare function loadExperimentFile(path: string): Promise<ExperimentSpec>;
22
+
23
+ declare function cmdValidate(dir: string): Promise<number>;
24
+
25
+ interface ApplyOptions {
26
+ ownerId?: string;
27
+ approverId?: string;
28
+ tenantId?: string;
29
+ /** Show plan but do not invoke actions. */
30
+ dryRun?: boolean;
31
+ /** Required to apply experiment deletes (YAML removal → kill action). */
32
+ allowDeletes?: boolean;
33
+ }
34
+ declare function cmdApply(dir: string, options?: ApplyOptions): Promise<number>;
35
+
36
+ interface ReportOptions {
37
+ tenantId?: string;
38
+ metricEventName?: string;
39
+ level?: number;
40
+ }
41
+ declare function cmdReport(experimentId: string, options?: ReportOptions): Promise<number>;
42
+
43
+ interface KillOptions {
44
+ reason: string;
45
+ tenantId?: string;
46
+ actorId?: string;
47
+ }
48
+ declare function cmdKill(experimentId: string, options: KillOptions): Promise<number>;
49
+
50
+ interface DevOptions {
51
+ port?: number;
52
+ tenantId?: string;
53
+ }
54
+ /**
55
+ * `fx dev` — the M1 product moment.
56
+ *
57
+ * One process, one log stream:
58
+ * - HTTP server on localhost:<port>
59
+ * - GET /manifest → current manifest JSON (content-hash checksum)
60
+ * - POST /v1/exposure → schema-validated, forwarded to LocalWarehouse
61
+ * - POST /v1/conversion → schema-validated, forwarded to LocalWarehouse
62
+ * - GET /healthz → liveness
63
+ * - LocalWarehouse persisted under .fx/warehouse/
64
+ * - Control plane persisted under .fx/store.json (FileStore — single-writer dev only)
65
+ *
66
+ * Manifest version increments only when content (contentHash) actually changes.
67
+ * Out-of-process mutations (`fx apply` / `fx kill`) are picked up on the next
68
+ * /manifest request because publishManifest reads the FileStore each time.
69
+ */
70
+ declare function cmdDev(options?: DevOptions): Promise<number>;
71
+
72
+ interface PlanOptions {
73
+ tenantId?: string;
74
+ ownerId?: string;
75
+ approverId?: string;
76
+ allowDeletes?: boolean;
77
+ json?: boolean;
78
+ }
79
+ /**
80
+ * `fx plan` — Terraform-style preview. Exit codes:
81
+ * 0 no changes
82
+ * 2 changes pending (or blocked)
83
+ * 1 error
84
+ */
85
+ declare function cmdPlan(dir: string, options?: PlanOptions): Promise<number>;
86
+
87
+ interface PublishOptions {
88
+ tenantId?: string;
89
+ /** When set, also POSTs the signed manifest to a manifest-worker /admin/publish endpoint. */
90
+ remoteUrl?: string;
91
+ /** Bearer token for the remote /admin/publish endpoint. */
92
+ adminToken?: string;
93
+ keyId?: string;
94
+ }
95
+ /**
96
+ * `fx publish` — sign the current manifest with the dev keypair (auto-generated
97
+ * under .fx/keys/) and write it to .fx/manifest.json. Optionally POST it to a
98
+ * deployed manifest-worker via `--remote-url` + `--admin-token`.
99
+ */
100
+ declare function cmdPublish(options?: PublishOptions): Promise<number>;
101
+
102
+ export { type LoadedExperimentSpec, type Workspace, cmdApply, cmdDev, cmdKill, cmdPlan, cmdPublish, cmdReport, cmdValidate, loadExperimentDir, loadExperimentFile, loadWorkspace };
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { cmdApply, cmdDev, cmdKill, cmdPlan, cmdPublish, cmdReport, cmdValidate, loadExperimentDir, loadExperimentFile, loadWorkspace } from './chunk-CZAJ7SGJ.js';
2
+ //# sourceMappingURL=index.js.map
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
package/package.json ADDED
@@ -0,0 +1,73 @@
1
+ {
2
+ "name": "@fabricorg/experiments",
3
+ "version": "0.5.1",
4
+ "description": "Fabric Experiments CLI (fx) — validate, plan, apply, run, publish, report, and kill governed A/B tests locally.",
5
+ "keywords": [
6
+ "ab-testing",
7
+ "experimentation",
8
+ "feature-flags",
9
+ "growth",
10
+ "fabric",
11
+ "cli",
12
+ "fx"
13
+ ],
14
+ "license": "MIT",
15
+ "author": "Fabric",
16
+ "homepage": "https://experiments.fabric.pro",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "https://github.com/Fabric-Pro/fabric-experiments.git",
20
+ "directory": "packages/cli"
21
+ },
22
+ "bugs": {
23
+ "url": "https://github.com/Fabric-Pro/fabric-experiments/issues"
24
+ },
25
+ "type": "module",
26
+ "sideEffects": false,
27
+ "engines": {
28
+ "node": ">=22"
29
+ },
30
+ "publishConfig": {
31
+ "registry": "https://registry.npmjs.org",
32
+ "access": "public"
33
+ },
34
+ "main": "./dist/index.cjs",
35
+ "types": "./dist/index.d.ts",
36
+ "module": "./dist/index.js",
37
+ "bin": {
38
+ "fx": "./dist/bin/fx.js",
39
+ "fabric-experiments": "./dist/bin/fx.js"
40
+ },
41
+ "exports": {
42
+ ".": {
43
+ "import": { "types": "./dist/index.d.ts", "default": "./dist/index.js" },
44
+ "require": { "types": "./dist/index.d.cts", "default": "./dist/index.cjs" }
45
+ }
46
+ },
47
+ "files": [
48
+ "dist",
49
+ "README.md",
50
+ "LICENSE"
51
+ ],
52
+ "scripts": {
53
+ "build": "tsup",
54
+ "type-check": "tsc --noEmit",
55
+ "test": "vitest run --passWithNoTests",
56
+ "clean": "rm -rf dist",
57
+ "prepublishOnly": "pnpm clean && pnpm build && pnpm test"
58
+ },
59
+ "dependencies": {
60
+ "yaml": "^2.6.1"
61
+ },
62
+ "devDependencies": {
63
+ "@fabricorg/experiments-domain": "workspace:*",
64
+ "@fabricorg/experiments-manifest-signing": "workspace:*",
65
+ "@fabricorg/experiments-module": "workspace:*",
66
+ "@fabricorg/experiments-plan": "workspace:*",
67
+ "@fabricorg/experiments-stats": "workspace:*",
68
+ "@fabricorg/experiments-warehouse": "workspace:*",
69
+ "tsup": "^8.3.5",
70
+ "typescript": "^5.8.3",
71
+ "vitest": "^2.1.8"
72
+ }
73
+ }