/*
Growth block schema (RFC-0027) and shared context schema for the system manifest.
Exports growthVendorSchema as the canonical vendor config shape, reused by @warpgogol/werkstatt-site/growth/config.ts.
- Do not introduce app-specific runtime composition or deployment behavior into this reusable package source file.
- RFC-0303 Phase 3: extracted from schemas/system.ts as part of the domain split.
- RFC-1097: step 6 — compass.migrate codemod run
Mechanical v1 to v2 header migration across the workspace: 942 files rewritten — CHANGE_SUMMARY windows collapsed into history, forbidden v1 blocks stripped, KEY_DECISIONS seeded from @ai-invariant comments (5 files) or TODO placeholders (103 files), blocks reordered to canonical order.
- RFC-1097: sweep — werkstatt-engine clean
Sweep batch 4: 73 Compass headers on headerless engine files (certification, component-runtime, isolation, evolution, testing), real KEY_DECISIONS on 75 files (kernel, cache, dht, swim, gitmesh, runtime), ~80 purpose expansions (CONTRACT-02/PURPOSE-02), non-goals on 13 CONTRACT-03 files, CS-07 history literal fix repo-wide (253 files). Policy: .template.ts/.template.astro excludedPaths. werkstatt-engine now 0 diagnostics.
*/
import { z } from "zod";
export const systemSharedContextSchema = z.object({
requiredPageIds: z.array(z.string().min(1)).optional().default([]),
});
/**
* Vendor adapter binding — the canonical schema for the `growth.vendor` block.
* Shared by systemGrowthSchema (ontology) and GrowthConfigSchema (@warpgogol/werkstatt-site/growth/config.ts).
*
* adapter: id of the GrowthAdapter package (e.g. "null", "matomo").
* options: vendor-specific key/value pairs forwarded to GrowthAdapter.init().
*/
export const growthVendorSchema = z.object({
adapter: z.string().min(1),
options: z.record(z.string(), z.string()).optional().default({}),
});
export type GrowthVendor = z.infer;
/**
* The `growth:` block in src/content/system.md. Activates the vendor-agnostic growth
* layer for this app. When absent, is omitted and no events
* are emitted (null-adapter mode).
*
* Example src/content/system.md growth block:
* growth:
* vendor:
* adapter: matomo
* options:
* proxyBaseUrl: /_wg/analytics/
* siteId: "1"
* privacyProfile: bannerfrei-v1
* funnels:
* - donation-intent-to-confirmation
* experiments: []
*/
export const systemGrowthSchema = z.object({
/**
* Vendor adapter binding — uses the canonical growthVendorSchema.
*/
vendor: growthVendorSchema,
/**
* Funnel ids to activate for this app.
* Each id must match a file in packages/werkstatt-site/src/domain/ontology/growth/funnels/.yaml.
* Validated by growth.funnel.validate.
*/
funnels: z
.array(z.string().regex(/^[a-z][a-z0-9-]*$/))
.optional()
.default([]),
/**
* Experiment ids available for this app.
* Each id must match a file in packages/werkstatt-site/src/domain/ontology/growth/experiments/.yaml.
* Active experiment assignment per page is resolved server-side.
* Validated by growth.experiment.validate.
*/
experiments: z
.array(z.string().regex(/^[a-z][a-z0-9-]*$/))
.optional()
.default([]),
});
export type SystemGrowth = z.infer;