export type Database = "turso" | "postgres" | "sqlite"; export type PackageManager = "pnpm" | "npm" | "yarn" | "bun"; /** * Industry templates the CLI knows about. Each maps to: * - the seed-data slug in industry-templates//seed-data.ts * - a set of default brand.mode + brand.features values * * Customers can still override any field after scaffold by editing * brand.config.ts directly. These are starting points, not constraints. */ export type TemplateSlug = "website-corporate" | "coffee" | "sunglasses" | "agent-marketplace" | "generic"; export declare const TEMPLATE_SLUGS: ReadonlyArray; /** * Per-template defaults written into brand.config.ts after download. * Keys mirror brand.config.ts shape (mode + features.*). */ export type TemplateDefaults = { mode: "website" | "webshop" | "agent-marketplace"; features: { webshop: boolean; acp: boolean; a2a: boolean; adminAgenticDashboard: boolean; /** * WebMCP in-browser agent tools. Webshop templates scaffold with this ON * ("WebMCP-native out of the box"): the flag is runtime-tier with an * ecommerce precondition, the registrar no-ops in browsers without * document.modelContext, and flag-off renders stay byte-identical — so * the flip is inert everywhere except an agent-capable browser on an * actual webshop. */ webMcp: boolean; }; }; export declare const TEMPLATE_DEFAULTS: Readonly>; export declare function isTemplateSlug(value: unknown): value is TemplateSlug; export declare function detectPackageManager(): PackageManager; export declare function generateAuthSecret(): string; export declare function patchEnvLocal(targetDir: string, authSecret: string): void; export declare function titleCase(projectName: string): string; /** * Domains the ENGINE uses for its OWN identity. Any of these sitting in a * config VALUE is upstream identity that must never reach a customer scaffold. * * Why this is a list and not one literal: the engine rebranded teloz.net → * cartwright.app in #289 ("rebrand repo identity Teloz → Cartwright"), and this * stripper still only knew `teloz.net`. The exact leak its docblock was written * to prevent came straight back under the new domain — every scaffold shipped * `url: "https://cartwright.app"` as its CANONICAL url, `admin@cartwright.app` * as the seeded admin login, and `kontakt@cartwright.app` on its /contact page. * A new engine domain must be ADDED here, never swapped in. */ export declare const ENGINE_DOMAINS: ReadonlyArray; /** * Replace engine domains inside QUOTED STRING VALUES only, skipping comment * lines. A blunt global replace would rewrite the documentation URLs the config * deliberately carries (`… on cartwright.app`, `pricing landerer på * cartwright.app`), turning helpful pointers into dead example.com links. * Measured on a v0.54.0 scaffold: 7 identity fields must change, 3 comment * mentions must not. * * Operating per line on quoted spans also covers array elements (e.g. * `sameAs: [...]`), which a `field:`-anchored regex would miss. */ /** A comment line, for the purposes of both patchers below. */ export declare function isCommentLine(line: string): boolean; /** * Blank every comment line, preserving length so indices still address the * original. Lets a regex be run "as if" comments did not exist and the result * spliced back into the real text — see patchBrandConfigSameAs. */ export declare function maskCommentLines(src: string): string; export declare function stripEngineDomains(src: string): string; export declare function patchBrandConfigContent(original: string, projectName: string): string; /** * Strip the upstream template's hardcoded Teloz footer attribution from a * components/Footer.tsx source string. The footer hardcodes "Ejet og drevet af * Teloz ApS" (→ teloz.net) plus a personal GitHub link (Teloz1870) — correct * for the engine repo (which IS the Teloz site) but wrong on every customer's * footer. These are pure-text replacements, so they never introduce unused * variables or break the customer's build. * * FORWARD-COMPAT (engine "first impression" PR): the engine is moving the * footer owner line into brand-config fields (`brand.legalName` + * `brand.footer.ownerUrl`) and rendering them via i18n. On such templates * Footer.tsx no longer hardcodes any Teloz text, so every replacement below * silently no-ops — which is correct, because the config fields are already * de-Telozified by patchBrandConfigContent (its global "Teloz ApS"→storeName * and teloz.net→example.com replacements cover legalName + ownerUrl). Both * template generations are therefore handled fail-soft with no extra code. */ export declare function patchFooterContent(original: string, storeName: string): string; /** * Apply the per-template defaults to a brand.config.ts source string. * Patches: * - industryTemplate: "" * - mode: "" * - features.webshop, features.acp, features.a2a, features.adminAgenticDashboard, * features.webMcp * * The replacements are regex-anchored to the exact field shape produced by * the upstream brand.config.ts. If that shape ever changes the regexes here * will silently no-op (no replacement) — the corresponding unit test catches * that case. */ export declare function patchBrandConfigForTemplate(original: string, template: TemplateSlug): string; /** * Result of a fail-soft "first impression" codemod: the (possibly) patched * source plus human-readable warnings for every anchor that didn't match * (template drift). Warnings are shown in a non-fatal note — the scaffold * must always complete (same philosophy as profile-light's PruneResult). */ export type PatchResult = { src: string; warnings: string[]; }; export declare const SCAFFOLD_CURRENCIES: readonly ["USD", "EUR", "GBP", "DKK", "SEK", "NOK"]; export type ScaffoldCurrency = (typeof SCAFFOLD_CURRENCIES)[number]; export declare const SCAFFOLD_COUNTRIES: readonly ["US", "GB", "DE", "DK", "SE", "NO"]; export type ScaffoldCountry = (typeof SCAFFOLD_COUNTRIES)[number]; export declare function isScaffoldCurrency(value: string): value is ScaffoldCurrency; export declare function isScaffoldCountry(value: string): value is ScaffoldCountry; /** Patch country + base currency independently from language. */ export declare function patchBrandConfigForMarket(original: string, currency: ScaffoldCurrency, country: ScaffoldCountry): PatchResult; /** * English-first scaffolds (owner decision 2026-06-11: scaffolds are born * en-only; the engine repo keeps da-first because it IS the live Teloz site). * Patches brand.config.ts: * - locales: ["da", "en"] as const → ["en"] as const * - defaultLocale: "da" → "en" * - footer.tagline (Danish "Bygget med Cartwright Engine …") → English * - footer.disclaimer → " · All rights reserved." * * i18n/routing.ts reads locales + defaultLocale straight from brand config, * so nothing else needs to move. Every replacement is anchored to the shape * the v0.35.x template ships; a non-matching anchor warns and skips (never * crashes), so the CLI keeps working against future templates that already * changed these fields. */ export declare function patchBrandConfigForEnglishFirst(original: string, storeName: string): PatchResult; /** * De-Teloz the website-mode hero copy (brand.config.ts `website` object) so a * fresh scaffold's first H1 isn't Teloz's studio pitch: * - eyebrow "v0.6 launch" → "" (stale launch badge) * - headline "Ship software that ships itself" → "Welcome to " * - tagline "A studio template built on …" → neutral one-liner * * Deliberately anchored on the EXACT Teloz strings (not the keys) so a * template whose copy already changed warns + skips instead of clobbering. * valueProps/features/steps arrays are NOT touched — multi-line regex over * those is fragile, and the engine's first-run Welcome Canvas owns the first * render anyway (setup/AI rewrites the rest). */ export declare function patchWebsiteCopyForScaffold(original: string, storeName: string): PatchResult; /** * Arm the first-run experience in the scaffolded prisma/seed.ts: * `setupComplete: true` → `setupComplete: false`. * * The template's seed marks setupComplete=true (Solbrillen-legacy: an * existing shop must not re-trigger the wizard), which on a FRESH scaffold * means the documented "first login → /admin/setup wizard" never fires AND * the engine's first-run Welcome Canvas predicate can never arm. Flipping it * repairs both. Safe on re-seed: the upsert's `update: {}` never un-completes * a shop that finished setup. Fail-soft: warns on drift, never crashes. */ export declare function patchSeedSetupComplete(original: string): PatchResult; /** * Flip `firstRunWelcome: false` → `true` in the scaffolded brand.config.ts so * the engine's first-run Welcome Canvas shows on the customer's first visit. * * CROSS-PR COMPATIBILITY: the flag ships with the engine's Welcome Canvas PR * (default false → canaries immune). Templates at or below v0.35.1 don't have * the key at all — in that case this warns + skips so the CLI works against * both current and future templates (the established drift philosophy). * Already-true is a silent no-op (idempotent). */ export declare function patchBrandConfigForFirstRunWelcome(original: string): PatchResult; /** * Set the look's skin as the explicit design pack (`--look `): * `designSlug: undefined as string | undefined` → `designSlug: "" as …`. * * Config beats DB in the engine's design resolution (lib/theme.ts * getActiveDesign: brand.designSlug ?? row.designSlug ?? inference), so this * is the trusted, committable way to pin the design — exactly what * /admin/designs tells customers to do by hand. Anchored on the template's * exact field shape (incl. a previously-set quoted value, so the patch is * idempotent); drift warns + skips per the established fail-soft contract. * The caller validates `skin` as a kebab-case slug before this runs. */ export declare function patchBrandConfigDesignSlug(original: string, skin: string): PatchResult; /** * Neutralize the Teloz agency pitch in footer.githubUrl (brand.config.ts). * * v0.36.0 (engine PR #222) moved the footer's GitHub link from hardcoded JSX * into `footer.githubUrl`, defaulting to Teloz's personal GitHub profile — * correct for the engine repo (which IS the Teloz site), an identity leak on * every customer scaffold. Patch it to "" (the customer sets their own later); * patchFooterGithubUrlGate hides the footer block while it's empty. * * Fail-soft across template generations: a pre-v0.36.0 template has no * `githubUrl` field at all (its hardcoded link is stripped by * patchFooterContent) — warn + skip. A field already holding `""` is the * intended end state and is a silent no-op. A field holding some OTHER * non-empty value is left alone but now WARNS: that shape is indistinguishable * from a drifted anchor, and treating it silently is how v0.52.0's repo-path * URL shipped in every customer footer unnoticed. */ export declare function patchBrandConfigGithubUrl(original: string): PatchResult; /** * Empty `company.sameAs` on a scaffold. * * schema.org `sameAs` is an IDENTITY assertion: it tells Google and every AI * crawler that the listed profiles ARE this organization. The engine ships * Cartwright's own two — the template repo and the npm package — and * `app/layout.tsx` puts them straight into the Organization JSON-LD. Left in * place, every customer site publishes machine-readable structured data * claiming their company is the same entity as our repo. That is a worse leak * than the footer link, because it is aimed at machines and is believed. * * The engine already knows: `lib/trust-content-audit.ts` raises "Replace * Cartwright's default company.sameAs profiles…" as a finding. But an audit the * customer must read and act on is not a substitute for the scaffolder simply * not shipping it — stripping upstream identity is this file's whole job. * * A fresh shop has no authority profiles, so `[]` is the honest value; the * customer fills it in when they have some. Fail-soft: an already-empty array * is a silent no-op, a customised list is preserved AND reported (see the * githubUrl branch for why silence is not an option), and a missing field warns. */ export declare function patchBrandConfigSameAs(original: string): PatchResult; /** * Set `company.legalName` to the store name on a scaffold. * * The engine's own config says `legalName: "Cartwright"` (it used to say * "Teloz ApS", which `patchBrandConfigContent`'s `.replaceAll("Teloz ApS", …)` * still covers for older `--ref`s). Nothing rewrote the new value, so every * scaffold published OUR name as its legal entity: in the Organization JSON-LD * `legalName`, the footer owner line and the terms pages. No warning fired, * because no anchor failed — the old one simply matched nothing. The engine's * guard `tests/guards/identity-not-ours.test.ts` lists it in `KNOWN_LEAKS`. * * The store name is the honest placeholder: the customer replaces it with * their registered company name (ApS/Ltd/…) the day they have one. * * Anchored on the exact engine value, on non-comment lines only. Fail-soft: * no field (a template that predates `company`) is a silent no-op, a value * already equal to the store name or empty is a silent no-op, and any OTHER * value is kept AND reported — silence is how this leak shipped. */ export declare function patchBrandConfigLegalName(original: string, storeName: string): PatchResult; /** * Gate the footer's "GitHub Profile" block on `brand.footer.githubUrl` being * non-empty. The v0.36.0 template renders the unconditionally, so after * patchBrandConfigGithubUrl sets the URL to "" the footer would otherwise show * a dead "GitHub Profile" link with an empty href. Wrapping (not deleting) * keeps the block working the moment the customer fills in their own URL — * config-true, same philosophy as patchCatalogFiltersContent's length guards. * * Fail-soft: pre-v0.36.0 templates hardcode the href (no * `{brand.footer.githubUrl}` anchor) — their link is already stripped by * patchFooterContent, so warn + skip is correct there too. */ export declare function patchFooterGithubUrlGate(original: string): PatchResult; /** * De-Teloz the SaaSHome marketing copy in a messages/.json source. * Called once per locale file; a file is OK as long as one locale anchor * matches (en.json never contains the Danish string and vice versa). If the * field is already Teloz-free, leave it untouched and silent. Warn only when * an unknown Teloz-bearing variant remains, because that could leak agency * identity into a new customer's rendered payload. */ export declare function patchMessagesCartwrightCopy(original: string): PatchResult; /** * De-Danish the AI assistant floating button. In website mode * (ecommerceEnabled=false) the template ignores the English brand.ai.* labels * and hardcodes Danish fallbacks — so an en-only scaffold renders * "SPØRG AI KONSULENTEN" (uppercased by CSS) on every page. Route both texts * through brand.ai.* instead: config-true (the customer edits one field, both * modes follow) and English out of the box on v0.36.0 templates. * `ecommerceEnabled` stays used (className + panel prop), so the build is safe. * * Only load-bearing for refs BELOW v0.52.0. From v0.52.0 the engine routes both * texts through `tSf(...)`/messages, so the anchors miss by design and the patch * silently no-ops instead of warning. See the comment inside. */ export declare function patchAIStylistButtonContent(original: string): PatchResult; /** * The template's HeroVideo hardcodes tags for /hero/hero-v4.webm+mp4, * which are demo-specific assets NOT shipped in the base template — so a fresh * scaffold 404s on both. Removing the tags leaves a poster-only