@orkestrel/scaffold 0.0.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.
- package/LICENSE +21 -0
- package/README.md +114 -0
- package/dist/bin/scaffold.js +1539 -0
- package/dist/bin/scaffold.js.map +1 -0
- package/dist/host/AGENTS.md +939 -0
- package/dist/host/CLAUDE.md +495 -0
- package/dist/host/LICENSE +21 -0
- package/dist/host/claude/agents/builder.md +48 -0
- package/dist/host/claude/agents/checker.md +37 -0
- package/dist/host/claude/agents/composer.md +64 -0
- package/dist/host/claude/agents/grok.md +50 -0
- package/dist/host/claude/agents/orkestrel.md +236 -0
- package/dist/host/claude/agents/planner.md +44 -0
- package/dist/host/claude/agents/researcher.md +38 -0
- package/dist/host/claude/agents/reviewer.md +47 -0
- package/dist/host/claude/agents/scout.md +35 -0
- package/dist/host/claude/agents/verifier.md +34 -0
- package/dist/host/claude/settings.json +26 -0
- package/dist/host/dotfiles/editorconfig +17 -0
- package/dist/host/dotfiles/gitattributes +3 -0
- package/dist/host/dotfiles/gitignore +40 -0
- package/dist/host/dotfiles/oxfmtrc.json +18 -0
- package/dist/host/dotfiles/oxlintignore +20 -0
- package/dist/host/dotfiles/oxlintrc.json +58 -0
- package/dist/host/dotfiles/prettierignore +5 -0
- package/dist/host/github/workflows/ci.yml +64 -0
- package/dist/host/guides/src/guide.md +312 -0
- package/dist/host/guides/src/scaffold.md +2152 -0
- package/dist/host/manifest.json +137 -0
- package/dist/host/scripts/cursor.sh +74 -0
- package/dist/host/scripts/deps.sh +38 -0
- package/dist/host/scripts/ollama.sh +163 -0
- package/dist/src/core/index.cjs +3728 -0
- package/dist/src/core/index.cjs.map +1 -0
- package/dist/src/core/index.d.cts +1941 -0
- package/dist/src/core/index.d.ts +1941 -0
- package/dist/src/core/index.js +3636 -0
- package/dist/src/core/index.js.map +1 -0
- package/dist/src/server/index.cjs +1595 -0
- package/dist/src/server/index.cjs.map +1 -0
- package/dist/src/server/index.d.cts +779 -0
- package/dist/src/server/index.d.ts +779 -0
- package/dist/src/server/index.js +1572 -0
- package/dist/src/server/index.js.map +1 -0
- package/package.json +113 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["#vendored","#emitter","#assertAlive","#run","#destroyed","#overrideQuestions","#dependencyQuestions","#pointerArtifacts","#plans","#emitter","#pin","#assertAlive","#destroyed"],"sources":["../../../src/core/constants.ts","../../../src/core/errors.ts","../../../src/core/shapers.ts","../../../src/core/validators.ts","../../../src/core/parsers.ts","../../../src/core/helpers.ts","../../../src/core/templates.ts","../../../src/core/compilers.ts","../../../src/core/Compiler.ts","../../../src/core/PlanManager.ts","../../../src/core/factories.ts"],"sourcesContent":["/** The three `Surface` values, frozen — compose with `literalOf(...)` / `parseEnum(...)`. */\nexport const SURFACES = Object.freeze(['core', 'browser', 'server'] as const)\n\n/** The three `Origin` values, frozen. */\nexport const ORIGINS = Object.freeze(['host', 'template', 'computed'] as const)\n\n/** The seven `Group` values, frozen — the artifact-group selection vocabulary. */\nexport const GROUPS = Object.freeze([\n\t'manifest',\n\t'configs',\n\t'source',\n\t'tests',\n\t'guides',\n\t'docs',\n\t'orchestration',\n] as const)\n\n/** The four `Category` values, frozen. */\nexport const CATEGORIES = Object.freeze(['type', 'constant', 'factory', 'entity'] as const)\n\n/** The four `Freshness` values, frozen — the currency axis `Sync` reports on. */\nexport const FRESHNESS = Object.freeze(['current', 'behind', 'missing', 'failed'] as const)\n\n/** The pipeline phases in order, frozen. */\nexport const COMPILE_STAGES = Object.freeze(['draft', 'gate', 'pin'] as const)\n\n/**\n * The per-surface variant matrix as data: per `Surface`, its `configs/src`\n * files, Vitest project label, `exports` subpath, and build formats — the\n * per-surface layer `blueprintToPlan` reads BENEATH the manifest/exports\n * combination rules it applies on top.\n */\nexport const SURFACE_MATRIX = Object.freeze({\n\tcore: Object.freeze({\n\t\tconfigs: Object.freeze([\n\t\t\t'configs/src/vite.core.config.ts',\n\t\t\t'configs/src/tsconfig.core.json',\n\t\t] as const),\n\t\tproject: 'src:core',\n\t\tpath: '.',\n\t\tformats: Object.freeze(['es', 'cjs'] as const),\n\t}),\n\tbrowser: Object.freeze({\n\t\tconfigs: Object.freeze([\n\t\t\t'configs/src/vite.browser.config.ts',\n\t\t\t'configs/src/tsconfig.browser.json',\n\t\t] as const),\n\t\tproject: 'src:browser',\n\t\tpath: './browser',\n\t\tformats: Object.freeze(['es'] as const),\n\t}),\n\tserver: Object.freeze({\n\t\tconfigs: Object.freeze([\n\t\t\t'configs/src/vite.server.config.ts',\n\t\t\t'configs/src/tsconfig.server.json',\n\t\t] as const),\n\t\tproject: 'src:server',\n\t\tpath: './server',\n\t\tformats: Object.freeze(['es', 'cjs'] as const),\n\t}),\n} as const)\n\n/**\n * The byte-copied host artifact paths, frozen.\n *\n * @remarks\n * The root docs (`AGENTS.md` / `CLAUDE.md`), `LICENSE`, `.claude`, the three\n * SessionStart hook scripts (`scripts/deps.sh` / `scripts/cursor.sh` /\n * `scripts/ollama.sh`), the line's seven byte-identical root dotfiles,\n * `.github/workflows/ci.yml`, and the two guides-grouped mirrors every repo\n * carries: the line-wide dev-tooling guide (`guides/src/guide.md`) and the\n * scaffold engine's own self-guide (`guides/src/scaffold.md`).\n */\nexport const HOST_PATHS = Object.freeze([\n\t'AGENTS.md',\n\t'CLAUDE.md',\n\t'LICENSE',\n\t'.claude',\n\t'scripts/deps.sh',\n\t'scripts/cursor.sh',\n\t'scripts/ollama.sh',\n\t'.editorconfig',\n\t'.gitattributes',\n\t'.gitignore',\n\t'.oxfmtrc.json',\n\t'.oxlintrc.json',\n\t'.oxlintignore',\n\t'.prettierignore',\n\t'.github/workflows/ci.yml',\n\t'guides/src/guide.md',\n\t'guides/src/scaffold.md',\n] as const)\n\n/** The package-name RegExp — lowercase alphanumeric-with-hyphens, letter-first. */\nexport const NAME_PATTERN = /^[a-z][a-z0-9-]*$/\n\n/**\n * The `@orkestrel/*` dependency-name RegExp — every `Dependency.name` must be\n * scoped to `@orkestrel` and NAME_PATTERN-shaped after the scope, closing the\n * traversal vector a hand-built `../`-laced name would open through\n * `Compiler.#pointerArtifacts`' `guides/src/<short>.md` path derivation.\n */\nexport const DEPENDENCY_NAME_PATTERN = /^@orkestrel\\/[a-z][a-z0-9-]*$/\n\n/**\n * The `extras` dependency-name RegExp — a strict npm package-name shape: an\n * optional single `@scope/` prefix, then lowercase letters, digits, hyphens,\n * dots, and underscores (never leading, never adjacent to the scope slash).\n * Broader than `DEPENDENCY_NAME_PATTERN` on purpose: `extras` names are\n * manifest-content only (`devDependenciesFor` keys `devDependencies` with\n * them, `Compiler.#pointerArtifacts` never reads them for a path), so they\n * carry no traversal vector — no `..`, no backslash, and the single optional\n * `/` is fixed to the one scope boundary, so the shape stays structurally\n * incapable of escaping a derived path even though it accepts any valid npm\n * package name (unscoped or externally-scoped), not just `@orkestrel/*`.\n */\nexport const EXTRA_NAME_PATTERN = /^(?:@[a-z0-9][a-z0-9._-]*\\/)?[a-z0-9][a-z0-9._-]*$/\n\n/** The starting version the `blueprint` builder fills. */\nexport const DEFAULT_VERSION = '0.0.1'\n\n/** The `engines.node` range the `blueprint` builder fills. */\nexport const DEFAULT_ENGINES = '>=22'\n\n/** The devDependency range generated packages pin `@orkestrel/scaffold` at. */\nexport const SCAFFOLD_RANGE = '^0.0.1'\n\n/** The default id for a `Compiler` orchestrator. */\nexport const COMPILER_ID = 'compiler'\n","import type { ScaffoldErrorCode } from './types.js'\n\n/**\n * Carries a `ScaffoldErrorCode` + optional `context` (AGENTS §12).\n *\n * @remarks\n * Throws are reserved for caller misuse: `createBlueprint` on off-contract\n * data throws `INVALID`, any method after `destroy()` throws `DESTROYED`, and\n * on the server surface a non-vacant target throws `TARGET` while a failed\n * write throws `WRITE`. A failing gate is NOT an error — it fails closed into\n * an incomplete `Scaffolding` whose `failures` carry a `BLOCKED` marker.\n *\n * @example\n * ```ts\n * import { ScaffoldError, isScaffoldError } from '@orkestrel/scaffold'\n *\n * try {\n * \tthrow new ScaffoldError('INVALID', 'Blueprint failed the exact-record contract')\n * } catch (error) {\n * \tif (isScaffoldError(error)) error.code // 'INVALID'\n * }\n * ```\n */\nexport class ScaffoldError extends Error {\n\treadonly code: ScaffoldErrorCode\n\treadonly context?: unknown\n\n\tconstructor(code: ScaffoldErrorCode, message: string, context?: unknown) {\n\t\tsuper(message)\n\t\tthis.name = 'ScaffoldError'\n\t\tthis.code = code\n\t\tthis.context = context\n\t}\n}\n\n/**\n * Narrow a caught value to a `ScaffoldError`.\n *\n * @param value - The caught value to narrow.\n * @returns `true` when `value` is a {@link ScaffoldError}.\n *\n * @example\n * ```ts\n * import { isScaffoldError } from '@orkestrel/scaffold'\n *\n * isScaffoldError(new Error('plain')) // false\n * ```\n */\nexport function isScaffoldError(value: unknown): value is ScaffoldError {\n\treturn value instanceof ScaffoldError\n}\n","import {\n\tarrayShape,\n\tbooleanShape,\n\tintegerShape,\n\tliteralShape,\n\tobjectShape,\n\toptionalShape,\n\tstringShape,\n} from '@orkestrel/contract'\nimport { CATEGORIES, FRESHNESS, GROUPS, ORIGINS, SURFACES } from './constants.js'\n\n/**\n * Build the `Dependency` object shape.\n *\n * @returns A fresh `ContractShape` describing `{ name, range, optional? }`.\n */\nexport function dependencyShape() {\n\treturn objectShape({\n\t\tname: stringShape({ min: 1 }),\n\t\trange: stringShape({ min: 1 }),\n\t\toptional: optionalShape(booleanShape()),\n\t})\n}\n\n/**\n * Build the `Override` object shape.\n *\n * @returns A fresh `ContractShape` describing `{ path, content }`.\n */\nexport function overrideShape() {\n\treturn objectShape({\n\t\tpath: stringShape({ min: 1 }),\n\t\tcontent: stringShape({ min: 1 }),\n\t})\n}\n\n/**\n * Build the `Blueprint` object shape.\n *\n * @remarks\n * `surfaces` is a `literalShape(SURFACES)` array with `min: 1`; `name` is a\n * plain `min: 1` string, NOT pattern-constrained, so `generate` stays\n * satisfiable — the `NAME_PATTERN` law lives in the semantic pass\n * (`validateBlueprint`), never in this compiled contract. `peers` and `extras`\n * are `dependencyShape()` arrays alongside `dependencies` — the cross-array\n * uniqueness and overlap rules also live in `validateBlueprint`.\n *\n * @returns A fresh `ContractShape` describing the closed `Blueprint` spec.\n */\nexport function blueprintShape() {\n\treturn objectShape({\n\t\tname: stringShape({ min: 1 }),\n\t\tdescription: optionalShape(stringShape()),\n\t\tkeywords: arrayShape(stringShape()),\n\t\tsurfaces: arrayShape(literalShape(SURFACES), { min: 1 }),\n\t\tdependencies: arrayShape(dependencyShape()),\n\t\tpeers: arrayShape(dependencyShape()),\n\t\textras: arrayShape(dependencyShape()),\n\t\tversion: stringShape({ min: 1 }),\n\t\tengines: stringShape({ min: 1 }),\n\t\toverrides: arrayShape(overrideShape()),\n\t})\n}\n\n/**\n * Build the `Member` object shape.\n *\n * @returns A fresh `ContractShape` describing `{ name, category, summary, surface }`.\n */\nexport function memberShape() {\n\treturn objectShape({\n\t\tname: stringShape({ min: 1 }),\n\t\tcategory: literalShape(CATEGORIES),\n\t\tsummary: stringShape({ min: 1 }),\n\t\tsurface: literalShape(SURFACES),\n\t})\n}\n\n/**\n * Build the `Artifact` object shape.\n *\n * @remarks\n * `origin` is a `literalShape(ORIGINS)`; `content` and `source` are both\n * optional (the `origin` axis decides which one a given artifact carries).\n *\n * @returns A fresh `ContractShape` describing one planned file.\n */\nexport function artifactShape() {\n\treturn objectShape({\n\t\tpath: stringShape({ min: 1 }),\n\t\tgroup: literalShape(GROUPS),\n\t\torigin: literalShape(ORIGINS),\n\t\tsurface: optionalShape(literalShape(SURFACES)),\n\t\tcontent: optionalShape(stringShape()),\n\t\tsource: optionalShape(stringShape()),\n\t})\n}\n\n/**\n * Build the whole `Plan` object shape.\n *\n * @remarks\n * Composes {@link blueprintShape} and {@link artifactShape}; `trace` and\n * `hash` are optional (filled by the pin).\n *\n * @returns A fresh `ContractShape` describing the compiled, ordered plan.\n */\nexport function planShape() {\n\treturn objectShape({\n\t\tblueprint: blueprintShape(),\n\t\tgroups: arrayShape(literalShape(GROUPS)),\n\t\tartifacts: arrayShape(artifactShape()),\n\t\ttrace: optionalShape(stringShape()),\n\t\thash: optionalShape(stringShape()),\n\t})\n}\n\n/**\n * Build the `SyncReport` object shape.\n *\n * @remarks\n * `guides` / `versions` are array sub-shapes, each with a\n * `literalShape(FRESHNESS)` `freshness` field; `isSyncReport` /\n * `parseSyncReport` compile from it.\n *\n * @returns A fresh `ContractShape` describing the whole sync outcome.\n */\nexport function syncReportShape() {\n\treturn objectShape({\n\t\ttarget: stringShape({ min: 1 }),\n\t\tguides: arrayShape(\n\t\t\tobjectShape({\n\t\t\t\tname: stringShape({ min: 1 }),\n\t\t\t\tpath: stringShape({ min: 1 }),\n\t\t\t\tcontent: stringShape(),\n\t\t\t\tfreshness: literalShape(FRESHNESS),\n\t\t\t\tnote: optionalShape(stringShape()),\n\t\t\t}),\n\t\t),\n\t\tversions: arrayShape(\n\t\t\tobjectShape({\n\t\t\t\tname: stringShape({ min: 1 }),\n\t\t\t\trange: stringShape({ min: 1 }),\n\t\t\t\tlatest: stringShape(),\n\t\t\t\tfreshness: literalShape(FRESHNESS),\n\t\t\t\tnote: optionalShape(stringShape()),\n\t\t\t}),\n\t\t),\n\t\tclean: booleanShape(),\n\t\tfailed: integerShape({ min: 0 }),\n\t})\n}\n","import type { Guard } from '@orkestrel/contract'\nimport type {\n\tArtifact,\n\tBlueprint,\n\tDependency,\n\tMember,\n\tOverride,\n\tPlan,\n\tSyncReport,\n} from './types.js'\nimport { createContract } from '@orkestrel/contract'\nimport {\n\tartifactShape,\n\tblueprintShape,\n\tdependencyShape,\n\tmemberShape,\n\toverrideShape,\n\tplanShape,\n\tsyncReportShape,\n} from './shapers.js'\n\n/**\n * Narrow a value to a `Dependency` — `name` and `range` non-empty strings.\n *\n * @remarks\n * Compiled from {@link dependencyShape} via `createContract` (AGENTS §14) — a\n * total `Guard`, adversarial input returns `false`, never throws.\n */\nexport const isDependency: Guard<Dependency> = createContract(dependencyShape()).is\n\n/**\n * Narrow a value to an `Override` — `path` and `content` non-empty strings.\n *\n * @remarks\n * Compiled from {@link overrideShape} via `createContract` (AGENTS §14) — a\n * total `Guard`, adversarial input returns `false`, never throws.\n */\nexport const isOverride: Guard<Override> = createContract(overrideShape()).is\n\n/**\n * Narrow a value to a `Blueprint` — `surfaces` on-vocabulary and non-empty,\n * `name` a non-empty string.\n *\n * @remarks\n * Compiled from {@link blueprintShape} via `createContract` (AGENTS §14) —\n * the `NAME_PATTERN` law is the semantic pass's (`validateBlueprint`), not\n * this shape's; a total `Guard`, adversarial input returns `false`, never\n * throws.\n */\nexport const isBlueprint: Guard<Blueprint> = createContract(blueprintShape()).is\n\n/**\n * Narrow a value to a `Member` — `category` and `surface` on-vocabulary.\n *\n * @remarks\n * Compiled from {@link memberShape} via `createContract` (AGENTS §14) — a\n * total `Guard`, adversarial input returns `false`, never throws.\n */\nexport const isMember: Guard<Member> = createContract(memberShape()).is\n\n/**\n * Narrow a value to an `Artifact` — `group` / `origin` on-vocabulary.\n *\n * @remarks\n * Compiled from {@link artifactShape} via `createContract` (AGENTS §14) — a\n * total `Guard`, adversarial input returns `false`, never throws.\n */\nexport const isArtifact: Guard<Artifact> = createContract(artifactShape()).is\n\n/**\n * Narrow a value to a `Plan` — the whole exact-record contract, section\n * guards composed.\n *\n * @remarks\n * Compiled from {@link planShape} via `createContract` (AGENTS §14) — a\n * total `Guard`, adversarial input returns `false`, never throws.\n */\nexport const isPlan: Guard<Plan> = createContract(planShape()).is\n\n/**\n * Narrow a value to a `SyncReport` — the whole exact-record sync contract,\n * `guide` / `version` sections composed.\n *\n * @remarks\n * Compiled from {@link syncReportShape} via `createContract` (AGENTS §14) — a\n * total `Guard`, adversarial input returns `false`, never throws.\n */\nexport const isSyncReport: Guard<SyncReport> = createContract(syncReportShape()).is\n","import { createContract } from '@orkestrel/contract'\nimport type { Blueprint, Plan, SyncReport } from './types.js'\nimport { blueprintShape, planShape, syncReportShape } from './shapers.js'\n\n/**\n * Parse a `Blueprint` from `unknown` (or a JSON string), else `undefined`.\n *\n * @remarks\n * The coercing counterpart of {@link isBlueprint}, compiled from the same\n * {@link blueprintShape} via `createContract` (AGENTS §14) — a guard-valid\n * value round-trips unchanged, an off-contract value returns `undefined`,\n * and this never throws, including on malformed JSON text.\n *\n * @param input - The value (or JSON string) to parse.\n * @returns A `Blueprint`, else `undefined`.\n */\nexport const parseBlueprint: (input: unknown) => Blueprint | undefined = (\n\t(contract) => (input: unknown) => {\n\t\tif (typeof input !== 'string') return contract.parse(input)\n\t\ttry {\n\t\t\treturn contract.parse(JSON.parse(input))\n\t\t} catch {\n\t\t\treturn undefined\n\t\t}\n\t}\n)(createContract(blueprintShape()))\n\n/**\n * Parse a `Plan` from `unknown` (or a JSON string), else `undefined`.\n *\n * @remarks\n * The coercing counterpart of {@link isPlan}, compiled from the same\n * {@link planShape} via `createContract` (AGENTS §14) — a guard-valid value\n * round-trips unchanged, an off-contract value returns `undefined`, and this\n * never throws, including on malformed JSON text.\n *\n * @param input - The value (or JSON string) to parse.\n * @returns A `Plan`, else `undefined`.\n */\nexport const parsePlan: (input: unknown) => Plan | undefined = ((contract) => (input: unknown) => {\n\tif (typeof input !== 'string') return contract.parse(input)\n\ttry {\n\t\treturn contract.parse(JSON.parse(input))\n\t} catch {\n\t\treturn undefined\n\t}\n})(createContract(planShape()))\n\n/**\n * Parse a `SyncReport` from `unknown` (or a JSON string), else `undefined`.\n *\n * @remarks\n * The coercing counterpart of {@link isSyncReport}, compiled from the same\n * {@link syncReportShape} via `createContract` (AGENTS §14) — a guard-valid\n * value round-trips unchanged, an off-contract value returns `undefined`,\n * and this never throws, including on malformed JSON text.\n *\n * @param input - The value (or JSON string) to parse.\n * @returns A `SyncReport`, else `undefined`.\n */\nexport const parseSyncReport: (input: unknown) => SyncReport | undefined = (\n\t(contract) => (input: unknown) => {\n\t\tif (typeof input !== 'string') return contract.parse(input)\n\t\ttry {\n\t\t\treturn contract.parse(JSON.parse(input))\n\t\t} catch {\n\t\t\treturn undefined\n\t\t}\n\t}\n)(createContract(syncReportShape()))\n","import type { TableAlign, TableNode } from '@orkestrel/markdown'\nimport type {\n\tAudit,\n\tBlueprint,\n\tCatalogEntry,\n\tCategory,\n\tDependency,\n\tDrift,\n\tFinding,\n\tFreshness,\n\tGroup,\n\tMember,\n\tOverride,\n\tPlan,\n\tPlanSummary,\n\tQuestion,\n\tSurface,\n\tSyncReport,\n\tValidation,\n} from './types.js'\nimport { parseInline, renderMarkdown } from '@orkestrel/markdown'\nimport {\n\tDEFAULT_ENGINES,\n\tDEFAULT_VERSION,\n\tDEPENDENCY_NAME_PATTERN,\n\tEXTRA_NAME_PATTERN,\n\tNAME_PATTERN,\n\tSURFACES,\n} from './constants.js'\n\n/**\n * Build a fresh `Dependency`.\n *\n * @param name - The `@orkestrel/*` package name.\n * @param range - The semver range.\n * @param optional - Whether this dependency is optional; meaningful only when\n * used as a `Blueprint` peer. Omitted entirely when absent.\n * @returns A `Dependency` with `name` / `range` set, `optional` included only when passed.\n *\n * @example\n * ```ts\n * import { dependency } from '@orkestrel/scaffold'\n *\n * dependency('@orkestrel/contract', '^0.0.5') // { name: '@orkestrel/contract', range: '^0.0.5' }\n * dependency('@orkestrel/database', '^0.0.5', true) // optional: true\n * ```\n */\nexport function dependency(name: string, range: string, optional?: boolean): Dependency {\n\treturn optional === undefined ? { name, range } : { name, range, optional }\n}\n\n/**\n * Build a fresh `Override`.\n *\n * @param path - The artifact-relative path the override replaces.\n * @param content - The replacement content.\n * @returns An `Override` with both fields set.\n *\n * @example\n * ```ts\n * import { override } from '@orkestrel/scaffold'\n *\n * override('README.md', '# router\\n') // { path: 'README.md', content: '# router\\n' }\n * ```\n */\nexport function override(path: string, content: string): Override {\n\treturn { path, content }\n}\n\n/**\n * Build a fresh `Member`.\n *\n * @param name - The declared export name.\n * @param category - The `Member`'s `Category`.\n * @param summary - A one-line description.\n * @param surface - The owning `Surface`; defaults `'core'`.\n * @returns A `Member` with every field set.\n *\n * @example\n * ```ts\n * import { member } from '@orkestrel/scaffold'\n *\n * member('RouterOptions', 'type', 'Options for creating a Router.') // surface: 'core'\n * ```\n */\nexport function member(\n\tname: string,\n\tcategory: Category,\n\tsummary: string,\n\tsurface: Surface = 'core',\n): Member {\n\treturn { name, category, summary, surface }\n}\n\n/**\n * Build a fresh `Blueprint` from a name and a partial of the rest.\n *\n * @param name - The package name.\n * @param options - A partial of the remaining `Blueprint` fields.\n * @remarks\n * `version` / `engines` default `DEFAULT_VERSION` / `DEFAULT_ENGINES`, `surfaces`\n * defaults `['core']`, and `keywords` / `dependencies` / `peers` / `extras` /\n * `overrides` default `[]`. `description` is OMITTED entirely when absent, so\n * the result round-trips the exact-record `Blueprint` guard.\n * @returns A complete `Blueprint`.\n *\n * @example\n * ```ts\n * import { blueprint } from '@orkestrel/scaffold'\n *\n * blueprint('router').version // '0.0.1'\n * ```\n */\nexport function blueprint(name: string, options?: Partial<Omit<Blueprint, 'name'>>): Blueprint {\n\tconst base: Blueprint = {\n\t\tname,\n\t\tkeywords: options?.keywords ?? [],\n\t\tsurfaces: options?.surfaces ?? ['core'],\n\t\tdependencies: options?.dependencies ?? [],\n\t\tpeers: options?.peers ?? [],\n\t\textras: options?.extras ?? [],\n\t\tversion: options?.version ?? DEFAULT_VERSION,\n\t\tengines: options?.engines ?? DEFAULT_ENGINES,\n\t\toverrides: options?.overrides ?? [],\n\t}\n\treturn options?.description === undefined ? base : { ...base, description: options.description }\n}\n\n/**\n * Derive the PascalCase entity name from a lowercase-hyphen package name.\n *\n * @param name - A lowercase-hyphen package name.\n * @returns The PascalCase entity name — hyphens are word breaks.\n *\n * @example\n * ```ts\n * import { pascalCase } from '@orkestrel/scaffold'\n *\n * pascalCase('my-router') // 'MyRouter'\n * ```\n */\nexport function pascalCase(name: string): string {\n\treturn name\n\t\t.split('-')\n\t\t.filter((word) => word.length > 0)\n\t\t.map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n\t\t.join('')\n}\n\n/**\n * Derive the declared public `Member[]` from a blueprint.\n *\n * @param spec - The blueprint to derive members from.\n * @remarks\n * The canonical per-surface inventory is the four `Category` buckets applied to\n * the package's PascalCase entity name: an `Options` type, an `Interface` type,\n * a `create*` factory, a default-id constant, and the entity itself. Standalone\n * helpers, validators, and shapers are hand-authored in implementation, not\n * scaffolded.\n * @returns The declared `Member[]`, one set per surface.\n *\n * @example\n * ```ts\n * import { blueprint, blueprintToMembers } from '@orkestrel/scaffold'\n *\n * blueprintToMembers(blueprint('router'))[0] // { name: 'Router', category: 'entity', … }\n * ```\n */\nexport function blueprintToMembers(spec: Blueprint): readonly Member[] {\n\tconst pascal = pascalCase(spec.name)\n\tconst screaming = pascal.replace(/([a-z0-9])([A-Z])/g, '$1_$2').toUpperCase()\n\tconst members: Member[] = []\n\tfor (const surface of spec.surfaces) {\n\t\tmembers.push(member(pascal, 'entity', `The ${pascal} entity.`, surface))\n\t\tmembers.push(member(`${pascal}Options`, 'type', `Options for creating a ${pascal}.`, surface))\n\t\tmembers.push(member(`${pascal}Interface`, 'type', `The ${pascal} contract.`, surface))\n\t\tmembers.push(member(`create${pascal}`, 'factory', `Create a ${pascal}.`, surface))\n\t\tmembers.push(member(`${screaming}_ID`, 'constant', `The default id for a ${pascal}.`, surface))\n\t}\n\treturn members\n}\n\n/**\n * Extract the `@orkestrel/<name>` package names from a catalog markdown\n * block/table, in row order.\n *\n * @param text - The markdown block/table text (the `orkestrel.md` embedded\n * catalog shape — GFM table rows opening `| @orkestrel/<name>`).\n * @remarks\n * Pure line-scan: a row matches when, after trimming, it starts with\n * `| @orkestrel/` followed by a `NAME_PATTERN`-shaped short name and a cell\n * boundary (`|` or whitespace) — the same row shape `runCatalog`'s shrink\n * count previously matched inline; this is the single source both consume.\n * Returns `[]` when the text has no markers/rows (never throws).\n * @returns The full `@orkestrel/<name>` names found, in order.\n *\n * @example\n * ```ts\n * import { catalogNames } from '@orkestrel/scaffold'\n *\n * catalogNames('| @orkestrel/contract | ... |\\n| @orkestrel/emitter | ... |')\n * // ['@orkestrel/contract', '@orkestrel/emitter']\n * ```\n */\nexport function catalogNames(text: string): readonly string[] {\n\tconst rowPattern = /^\\|\\s*(@orkestrel\\/[a-z][a-z0-9-]*)(?=\\s|\\|)/\n\tconst names: string[] = []\n\tfor (const line of text.split('\\n')) {\n\t\tconst match = rowPattern.exec(line.trimStart())\n\t\tif (match !== null && match[1] !== undefined) names.push(match[1])\n\t}\n\treturn names\n}\n\n/**\n * Build a formatter-width-aligned GFM table string from header and row cells.\n *\n * @param header - The header cell strings, in column order.\n * @param rows - The body rows, each a list of cell strings matching `header`'s column count.\n * @param align - Optional per-column alignment; defaults every column to `'none'`.\n * @remarks\n * Builds a `TableNode` (each cell parsed with `parseInline`) and serializes it\n * through `renderMarkdown`, which contributes the structure — `\\|`-escaping any\n * literal pipe and emitting the alignment delimiter row — at a flat 1-space\n * cell padding. This function then re-pads BOTH the cells AND the delimiter row\n * to per-column codepoint width, matching oxfmt's markdown re-padding.\n * @returns The aligned GFM table string.\n *\n * @example\n * ```ts\n * import { alignTable } from '@orkestrel/scaffold'\n *\n * alignTable(['API', 'Kind'], [['`createRouter`', 'function']])\n * // '| API | Kind |\\n| --------------- | -------- |\\n| `createRouter` | function |'\n * ```\n */\nexport function alignTable(\n\theader: readonly string[],\n\trows: readonly (readonly string[])[],\n\talign?: readonly TableAlign[],\n): string {\n\tconst columns = header.length\n\tconst alignment: readonly TableAlign[] = align ?? header.map(() => 'none' as const)\n\tconst node: TableNode = {\n\t\telement: 'table',\n\t\theader: header.map((cell) => parseInline(cell)),\n\t\trows: rows.map((row) => row.map((cell) => parseInline(cell))),\n\t\talign: alignment,\n\t}\n\tconst rendered = renderMarkdown(node)\n\tconst lines = rendered.split('\\n')\n\tconst headerCells = splitTableRow(lines[0] ?? '')\n\tconst bodyCells = lines.slice(2).map((line) => splitTableRow(line))\n\tconst widths: number[] = []\n\tfor (let column = 0; column < columns; column += 1) {\n\t\tlet width = Array.from(headerCells[column] ?? '').length\n\t\tfor (const row of bodyCells) {\n\t\t\tconst length = Array.from(row[column] ?? '').length\n\t\t\tif (length > width) width = length\n\t\t}\n\t\twidths.push(Math.max(3, width))\n\t}\n\tconst headerLine = `| ${headerCells.map((cell, index) => padCell(cell, widths[index] ?? 3)).join(' | ')} |`\n\tconst delimiterLine = `| ${alignment.map((columnAlign, index) => delimiterCell(columnAlign, widths[index] ?? 3)).join(' | ')} |`\n\tconst bodyLines = bodyCells.map(\n\t\t(row) => `| ${row.map((cell, index) => padCell(cell, widths[index] ?? 3)).join(' | ')} |`,\n\t)\n\treturn [headerLine, delimiterLine, ...bodyLines].join('\\n')\n}\n\n/**\n * Split one rendered GFM table row into its trimmed cell strings.\n *\n * @param line - A single rendered table line (header, delimiter, or body row).\n * @remarks\n * Splits on an UNESCAPED `|` (a `\\|` is a literal pipe inside a cell, not a\n * column boundary), then drops the leading/trailing empty segments the\n * boundary pipes produce and trims each remaining cell.\n * @returns The row's cell strings, in column order.\n *\n * @example\n * ```ts\n * import { splitTableRow } from '@orkestrel/scaffold'\n *\n * splitTableRow('| a | b |') // ['a', 'b']\n * ```\n */\nexport function splitTableRow(line: string): readonly string[] {\n\tconst parts = line.split(/(?<!\\\\)\\|/)\n\treturn parts.slice(1, -1).map((part) => part.trim())\n}\n\n/**\n * Right-pad a cell to a codepoint width, oxfmt-style.\n *\n * @param text - The cell text.\n * @param width - The target codepoint width.\n * @remarks\n * Measures via `Array.from` (codepoints, not UTF-16 code units) so a\n * surrogate-pair or wide codepoint counts once, matching oxfmt's own\n * width math. A cell already at or past `width` is returned unchanged.\n * @returns `text` padded with trailing spaces to `width` codepoints.\n *\n * @example\n * ```ts\n * import { padCell } from '@orkestrel/scaffold'\n *\n * padCell('ab', 5) // 'ab '\n * ```\n */\nexport function padCell(text: string, width: number): string {\n\tconst length = Array.from(text).length\n\treturn length >= width ? text : text + ' '.repeat(width - length)\n}\n\n/**\n * Build one delimiter-row cell for a GFM table column.\n *\n * @param columnAlign - The column's `TableAlign`.\n * @param width - The column's codepoint width.\n * @remarks\n * `'left'` prefixes `:`, `'right'` suffixes `:`, `'center'` wraps both ends,\n * `'none'` is plain dashes — one dash per width unit, `:` markers consuming\n * a dash slot rather than adding to `width`.\n * @returns The delimiter cell string for this column.\n *\n * @example\n * ```ts\n * import { delimiterCell } from '@orkestrel/scaffold'\n *\n * delimiterCell('left', 5) // ':----'\n * ```\n */\nexport function delimiterCell(columnAlign: TableAlign, width: number): string {\n\tif (columnAlign === 'left') return `:${'-'.repeat(width - 1)}`\n\tif (columnAlign === 'right') return `${'-'.repeat(width - 1)}:`\n\tif (columnAlign === 'center') return `:${'-'.repeat(width - 2)}:`\n\treturn '-'.repeat(width)\n}\n\n/**\n * Project a `Plan` into a `PlanSummary`.\n *\n * @param plan - The plan to summarize.\n * @returns The artifact tally by `origin`, the surfaces, and the covered groups.\n *\n * @example\n * ```ts\n * import { planToSummary } from '@orkestrel/scaffold'\n *\n * planToSummary(plan) // { name: 'router', artifacts: 21, host: 12, template: 6, computed: 3, … }\n * ```\n */\nexport function planToSummary(plan: Plan): PlanSummary {\n\tlet host = 0\n\tlet template = 0\n\tlet computed = 0\n\tfor (const artifact of plan.artifacts) {\n\t\tif (artifact.origin === 'host') host += 1\n\t\telse if (artifact.origin === 'template') template += 1\n\t\telse computed += 1\n\t}\n\treturn {\n\t\tname: plan.blueprint.name,\n\t\tsurfaces: plan.blueprint.surfaces,\n\t\tgroups: plan.groups,\n\t\tartifacts: plan.artifacts.length,\n\t\thost,\n\t\ttemplate,\n\t\tcomputed,\n\t}\n}\n\n/**\n * Project a `Plan` into a copy-ready markdown review document.\n *\n * @param plan - The plan to review.\n * @returns The artifact table by group, the members table, and the summary — the diff-first dry run.\n *\n * @example\n * ```ts\n * import { planToReview } from '@orkestrel/scaffold'\n *\n * planToReview(plan) // '# Scaffolding router\\n## Artifacts\\n| Path | Group | Origin |\\n…'\n * ```\n */\nexport function planToReview(plan: Plan): string {\n\tconst summary = planToSummary(plan)\n\tconst members = blueprintToMembers(plan.blueprint)\n\tconst artifactTable = alignTable(\n\t\t['Path', 'Group', 'Origin'],\n\t\tplan.artifacts.map((artifact) => [artifact.path, artifact.group, artifact.origin]),\n\t)\n\tconst memberTable = alignTable(\n\t\t['Name', 'Category', 'Surface'],\n\t\tmembers.map((entry) => [entry.name, entry.category, entry.surface]),\n\t)\n\treturn [\n\t\t`# Scaffolding ${plan.blueprint.name}`,\n\t\t'',\n\t\t'## Artifacts',\n\t\t'',\n\t\tartifactTable,\n\t\t'',\n\t\t'## Members',\n\t\t'',\n\t\tmemberTable,\n\t\t'',\n\t\t'## Summary',\n\t\t'',\n\t\t`- surfaces: ${summary.surfaces.join(', ')}`,\n\t\t`- groups: ${summary.groups.join(', ')}`,\n\t\t`- artifacts: ${summary.artifacts} (host: ${summary.host}, template: ${summary.template}, computed: ${summary.computed})`,\n\t].join('\\n')\n}\n\n/**\n * Project an `Audit` into a markdown drift report.\n *\n * @param audit - The audit to report.\n * @returns Findings grouped by `drift`, `aligned` entries elided — what `repair` will touch.\n *\n * @example\n * ```ts\n * import { auditToReview } from '@orkestrel/scaffold'\n *\n * auditToReview(audit) // '# Audit\\n\\n- clean: false\\n…\\n## stale\\n\\n| Path | Group |\\n…'\n * ```\n */\nexport function auditToReview(audit: Audit): string {\n\tconst groups: Record<Drift, Finding[]> = { aligned: [], stale: [], missing: [], foreign: [] }\n\tfor (const finding of audit.findings) groups[finding.drift].push(finding)\n\tconst sections: string[] = [\n\t\t'# Audit',\n\t\t'',\n\t\t`- clean: ${audit.clean}`,\n\t\t`- drifted: ${audit.drifted}`,\n\t\t`- missing: ${audit.missing}`,\n\t\t`- foreign: ${audit.foreign}`,\n\t]\n\tfor (const drift of ['stale', 'missing', 'foreign'] as const) {\n\t\tconst findings = groups[drift]\n\t\tif (findings.length === 0) continue\n\t\tsections.push(\n\t\t\t'',\n\t\t\t`## ${drift}`,\n\t\t\t'',\n\t\t\talignTable(\n\t\t\t\t['Path', 'Group'],\n\t\t\t\tfindings.map((finding) => [finding.path, finding.group]),\n\t\t\t),\n\t\t)\n\t}\n\treturn sections.join('\\n')\n}\n\n/**\n * Test whether a `Freshness` verdict counts toward \"behind\".\n *\n * @param freshness - The freshness verdict to test.\n * @returns `true` iff `freshness` is `'behind'`.\n *\n * @example\n * ```ts\n * import { isBehind } from '@orkestrel/scaffold'\n *\n * isBehind('behind') // true\n * isBehind('current') // false\n * ```\n */\nexport function isBehind(freshness: Freshness): boolean {\n\treturn freshness === 'behind'\n}\n\n/**\n * Project a `SyncReport` into a markdown freshness report.\n *\n * @param report - The sync report to render.\n * @returns Guides and versions each in their own table, via `alignTable` — the sibling of `auditToReview`.\n *\n * @example\n * ```ts\n * import { syncToReview } from '@orkestrel/scaffold'\n *\n * syncToReview(report) // '# Sync — 2 behind\\n## Guides\\n| Name | Freshness |\\n…'\n * ```\n */\nexport function syncToReview(report: SyncReport): string {\n\tconst behind =\n\t\treport.guides.filter((guide) => isBehind(guide.freshness)).length +\n\t\treport.versions.filter((version) => isBehind(version.freshness)).length\n\tconst sections: string[] = [\n\t\t`# Sync — ${behind} behind`,\n\t\t'',\n\t\t`- clean: ${report.clean}`,\n\t\t`- failed: ${report.failed}`,\n\t]\n\tif (report.guides.length > 0) {\n\t\tsections.push(\n\t\t\t'',\n\t\t\t'## Guides',\n\t\t\t'',\n\t\t\talignTable(\n\t\t\t\t['Name', 'Freshness'],\n\t\t\t\treport.guides.map((guide) => [guide.name, guide.freshness]),\n\t\t\t),\n\t\t)\n\t}\n\tif (report.versions.length > 0) {\n\t\tsections.push(\n\t\t\t'',\n\t\t\t'## Versions',\n\t\t\t'',\n\t\t\talignTable(\n\t\t\t\t['Name', 'Range', 'Latest', 'Freshness'],\n\t\t\t\treport.versions.map((version) => [\n\t\t\t\t\tversion.name,\n\t\t\t\t\tversion.range,\n\t\t\t\t\tversion.latest,\n\t\t\t\t\tversion.freshness,\n\t\t\t\t]),\n\t\t\t),\n\t\t)\n\t}\n\treturn sections.join('\\n')\n}\n\n/**\n * Project a fleet package catalog into a markdown table — the block\n * `.claude/agents/orkestrel.md`'s catalog markers wrap.\n *\n * @param entries - The catalog rows to render.\n * @remarks\n * Deduplicated by `name` (a later entry for a repeated name wins), then\n * code-unit sorted by `name`. An empty `description` renders as `—` (an em\n * dash), never a blank cell. Deterministic — same input, same output, every\n * time — via `alignTable`; trailing-newline terminated.\n * @returns The aligned GFM table string.\n *\n * @example\n * ```ts\n * import { catalogToBlock } from '@orkestrel/scaffold'\n *\n * catalogToBlock([\n * \t{ name: '@orkestrel/router', version: '0.0.5', description: 'A tiny hash-router.' },\n * \t{ name: '@orkestrel/contract', version: '0.0.5', description: '' },\n * ])\n * // '| Package | Version | Description |\\n| … |\\n| @orkestrel/contract | 0.0.5 | — |\\n…'\n * ```\n */\nexport function catalogToBlock(entries: readonly CatalogEntry[]): string {\n\tconst merged = new Map<string, CatalogEntry>()\n\tfor (const entry of entries) merged.set(entry.name, entry)\n\tconst sorted = [...merged.values()].sort((a, b) =>\n\t\ta.name < b.name ? -1 : a.name > b.name ? 1 : 0,\n\t)\n\tconst table = alignTable(\n\t\t['Package', 'Version', 'Description'],\n\t\tsorted.map((entry) => [\n\t\t\tentry.name,\n\t\t\tentry.version,\n\t\t\tentry.description.length === 0 ? '—' : entry.description,\n\t\t]),\n\t)\n\treturn `${table}\\n`\n}\n\n/**\n * Infer a foreign path's `Group` from its leading path segment.\n *\n * @param path - The target-relative path to classify.\n * @remarks\n * Ordered prefix match — `src/`, `tests/`, `guides/`, `docs/`, `configs/`,\n * then `.github/` / `scripts/` as `'orchestration'`, then the two manifest\n * files by exact name. Anything else (a root-level, prefix-less file) falls\n * through to `'configs'`.\n * @returns The inferred `Group` for `path`.\n *\n * @example\n * ```ts\n * import { inferGroup } from '@orkestrel/scaffold'\n *\n * inferGroup('src/core/index.ts') // 'source'\n * inferGroup('mystery.config.ts') // 'configs'\n * ```\n */\nexport function inferGroup(path: string): Group {\n\tif (path.startsWith('src/')) return 'source'\n\tif (path.startsWith('tests/')) return 'tests'\n\tif (path.startsWith('guides/')) return 'guides'\n\tif (path.startsWith('docs/')) return 'docs'\n\tif (path.startsWith('configs/')) return 'configs'\n\tif (path.startsWith('.github/') || path.startsWith('scripts/')) return 'orchestration'\n\tif (path === 'package.json' || path === 'package-lock.json') return 'manifest'\n\treturn 'configs'\n}\n\n/**\n * Diff a plan's artifacts against a target's current content.\n *\n * @param plan - The plan whose artifacts are the source of truth.\n * @param current - The target's current content, keyed by artifact-relative path.\n * @remarks\n * A `template` / `computed` artifact whose rendered content the target does not\n * match is `stale`; one the target lacks is `missing`; a target file the plan\n * does not own is `foreign`. A `host`-origin artifact is audited by PRESENCE\n * only — `missing` or `aligned`, never `stale` — UNLESS it has been hydrated\n * with its real host bytes (`hydratePlan`'s `content`), in which case it is\n * content-compared exactly like a `template` / `computed` artifact and CAN be\n * `stale`. A degrade-path or directory-shaped host artifact (never hydrated)\n * stays presence-only.\n * @returns The `Audit` of drift findings — pure, no I/O.\n *\n * @example\n * ```ts\n * import { diffPlan } from '@orkestrel/scaffold'\n *\n * diffPlan(plan, current) // { findings: [...], clean: false, complete: true, drifted: 1, missing: 20, foreign: 0 }\n * ```\n */\nexport function diffPlan(plan: Plan, current: Readonly<Record<string, string>>): Audit {\n\tconst findings: Finding[] = []\n\tconst owned = new Set<string>()\n\tfor (const artifact of plan.artifacts) {\n\t\towned.add(artifact.path)\n\t\tconst seen = current[artifact.path]\n\t\tif (artifact.origin === 'host') {\n\t\t\tlet drift: Drift\n\t\t\tif (seen === undefined) drift = 'missing'\n\t\t\telse if (artifact.content === undefined) drift = 'aligned'\n\t\t\telse drift = seen === artifact.content ? 'aligned' : 'stale'\n\t\t\tfindings.push({ path: artifact.path, group: artifact.group, drift })\n\t\t\tcontinue\n\t\t}\n\t\tif (seen === undefined)\n\t\t\tfindings.push({ path: artifact.path, group: artifact.group, drift: 'missing' })\n\t\telse if (seen === artifact.content)\n\t\t\tfindings.push({ path: artifact.path, group: artifact.group, drift: 'aligned' })\n\t\telse findings.push({ path: artifact.path, group: artifact.group, drift: 'stale' })\n\t}\n\tfor (const path of Object.keys(current)) {\n\t\tif (owned.has(path)) continue\n\t\tfindings.push({ path, group: inferGroup(path), drift: 'foreign' })\n\t}\n\tlet drifted = 0\n\tlet missing = 0\n\tlet foreign = 0\n\tfor (const finding of findings) {\n\t\tif (finding.drift === 'stale') drifted += 1\n\t\telse if (finding.drift === 'missing') missing += 1\n\t\telse if (finding.drift === 'foreign') foreign += 1\n\t}\n\treturn {\n\t\tfindings,\n\t\tclean: drifted === 0 && missing === 0 && foreign === 0,\n\t\tcomplete: true,\n\t\tquestions: [],\n\t\tdrifted,\n\t\tmissing,\n\t\tforeign,\n\t}\n}\n\n/**\n * Validate one dependency-shaped array under the name/range/duplicate rules.\n *\n * @param field - The `Question.field` to attribute a violation to (`'dependencies'` / `'peers'` / `'extras'`).\n * @param items - The `Dependency[]` to check.\n * @remarks\n * Pure — takes no closed-over `questions` array to mutate; the caller\n * concatenates the returned `questions` and inspects the returned `seen` set\n * to apply the cross-array (`dependencies` vs `peers` vs `extras`) overlap\n * rules `validateBlueprint` layers on top. `field === 'extras'` validates\n * names against `EXTRA_NAME_PATTERN` (broader — any valid npm package name);\n * `'dependencies'` and `'peers'` keep `DEPENDENCY_NAME_PATTERN` (closed to\n * `@orkestrel/*`) — the path-derived arrays stay orkestrel-closed, since only\n * `dependencies`/`peers` names ever reach `Compiler.#pointerArtifacts`' path\n * derivation; `extras` names are manifest-content only.\n * @returns The violations found and the set of names seen, in encounter order.\n *\n * @example\n * ```ts\n * import { validateDependencyArray } from '@orkestrel/scaffold'\n *\n * validateDependencyArray('dependencies', [{ name: '', range: '^1' }])\n * // { questions: [{ field: 'dependencies', text: 'A dependency name must not be empty', … }], seen: Set(0) {} }\n * ```\n */\nexport function validateDependencyArray(\n\tfield: string,\n\titems: readonly Dependency[],\n): { readonly questions: readonly Question[]; readonly seen: ReadonlySet<string> } {\n\tconst pattern = field === 'extras' ? EXTRA_NAME_PATTERN : DEPENDENCY_NAME_PATTERN\n\tconst questions: Question[] = []\n\tconst seen = new Set<string>()\n\tfor (const item of items) {\n\t\tif (item.name.length === 0) {\n\t\t\tquestions.push({ field, text: 'A dependency name must not be empty', blocking: true })\n\t\t} else if (!pattern.test(item.name)) {\n\t\t\tquestions.push({\n\t\t\t\tfield,\n\t\t\t\ttext: `Dependency name \"${item.name}\" must match ${pattern.source}`,\n\t\t\t\tblocking: true,\n\t\t\t})\n\t\t}\n\t\tif (item.range.length === 0) {\n\t\t\tquestions.push({\n\t\t\t\tfield,\n\t\t\t\ttext: `Dependency \"${item.name}\" is missing a version range`,\n\t\t\t\tblocking: true,\n\t\t\t})\n\t\t}\n\t\tif (seen.has(item.name)) {\n\t\t\tquestions.push({\n\t\t\t\tfield,\n\t\t\t\ttext: `Dependency \"${item.name}\" is declared more than once`,\n\t\t\t\tblocking: true,\n\t\t\t})\n\t\t}\n\t\tseen.add(item.name)\n\t}\n\treturn { questions, seen }\n}\n\n/**\n * The semantic pass over a blueprint.\n *\n * @param spec - The blueprint to validate.\n * @remarks\n * Checks the name against `NAME_PATTERN`, non-empty on-vocabulary `surfaces`\n * with no repeats (a repeat would produce duplicate members); a single\n * surface — `core`-only, `server`-only, `browser`-only — is a fully\n * first-class declaration (`rootViteConfig` retargets the root export and\n * runs the surface's own factory as the base, no `core` involved), but a\n * `browser`+`server` declaration with no `core` has no defined configuration\n * class `rootViteConfig` / `singleSurfaceViteConfig` can shape — that ONE\n * exemplar-less combination is a blocking question (without this gate it\n * would silently drop a surface at `rootViteConfig`'s dispatch while the\n * manifest still references it). And well-formed `dependencies` / `peers` /\n * `extras` (non-empty name/range, no duplicate names within an array):\n * `dependencies` and `peers` names are shaped `DEPENDENCY_NAME_PATTERN`\n * (closed to `@orkestrel/*`) — a NAME-shaped law at the gate that closes the\n * traversal vector a hand-built `../`-laced dependency name would open\n * through `Compiler.#pointerArtifacts`'s path derivation; `extras` names are\n * shaped `EXTRA_NAME_PATTERN` instead — broader (any valid npm package name),\n * safe because `extras` never feeds a path, only `devDependencies` content. A\n * name appearing in both `dependencies` and `peers` is a blocking question\n * (npm forbids sensibly declaring the same package both ways), and an\n * `extras` name may overlap neither `dependencies` nor `peers`.\n * @returns A `Validation` — never throws.\n *\n * @example\n * ```ts\n * import { validateBlueprint } from '@orkestrel/scaffold'\n *\n * validateBlueprint(blueprint('router')) // { valid: true, questions: [], warnings: [] }\n * ```\n */\nexport function validateBlueprint(spec: Blueprint): Validation {\n\t// The published `@orkestrel/<name>` scope adds 11 characters; npm caps a\n\t// package name at 214, so the bare `name` field must fit within 214 - 11.\n\tconst MAX_NAME_LENGTH = 203\n\tconst VERSION_PATTERN = /^\\d+\\.\\d+\\.\\d+$/\n\tconst ENGINES_PATTERN = /^>=\\d+$/\n\tconst questions: Question[] = []\n\tif (!NAME_PATTERN.test(spec.name)) {\n\t\tquestions.push({\n\t\t\tfield: 'name',\n\t\t\ttext: `Name \"${spec.name}\" must match ${NAME_PATTERN.source}`,\n\t\t\tblocking: true,\n\t\t})\n\t}\n\tif (spec.name.length > MAX_NAME_LENGTH) {\n\t\tquestions.push({\n\t\t\tfield: 'name',\n\t\t\ttext: `Name \"${spec.name}\" is ${spec.name.length} characters — the published @orkestrel/<name> must fit npm's 214-character limit (max ${MAX_NAME_LENGTH})`,\n\t\t\tblocking: true,\n\t\t})\n\t}\n\tif (!VERSION_PATTERN.test(spec.version)) {\n\t\tquestions.push({\n\t\t\tfield: 'version',\n\t\t\ttext: `Version \"${spec.version}\" must match ${VERSION_PATTERN.source}`,\n\t\t\tblocking: true,\n\t\t})\n\t}\n\tif (!ENGINES_PATTERN.test(spec.engines)) {\n\t\tquestions.push({\n\t\t\tfield: 'engines',\n\t\t\ttext: `Engines \"${spec.engines}\" must match ${ENGINES_PATTERN.source}`,\n\t\t\tblocking: true,\n\t\t})\n\t}\n\tconst seenOverridePaths = new Set<string>()\n\tfor (const item of spec.overrides) {\n\t\tif (seenOverridePaths.has(item.path)) {\n\t\t\tquestions.push({\n\t\t\t\tfield: 'overrides',\n\t\t\t\ttext: `Override path \"${item.path}\" is declared more than once`,\n\t\t\t\tblocking: true,\n\t\t\t})\n\t\t}\n\t\tseenOverridePaths.add(item.path)\n\t\tif (item.content.length === 0) {\n\t\t\tquestions.push({\n\t\t\t\tfield: 'overrides',\n\t\t\t\ttext: `Override path \"${item.path}\" has empty content`,\n\t\t\t\tblocking: true,\n\t\t\t})\n\t\t}\n\t}\n\tif (spec.surfaces.length === 0) {\n\t\tquestions.push({ field: 'surfaces', text: 'At least one surface is required', blocking: true })\n\t} else {\n\t\tfor (const surface of spec.surfaces) {\n\t\t\tif (!SURFACES.includes(surface)) {\n\t\t\t\tquestions.push({\n\t\t\t\t\tfield: 'surfaces',\n\t\t\t\t\ttext: `Surface \"${surface}\" is not recognized`,\n\t\t\t\t\tblocking: true,\n\t\t\t\t\tcandidates: [...SURFACES],\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t\tif (new Set(spec.surfaces).size !== spec.surfaces.length) {\n\t\t\tquestions.push({\n\t\t\t\tfield: 'surfaces',\n\t\t\t\ttext: 'Surfaces must not repeat — a repeat produces duplicate members',\n\t\t\t\tblocking: true,\n\t\t\t})\n\t\t}\n\t\tif (spec.surfaces.length > 1 && !spec.surfaces.includes('core')) {\n\t\t\tquestions.push({\n\t\t\t\tfield: 'surfaces',\n\t\t\t\ttext: 'The browser+server combination without core has no defined configuration class — declare core alongside them, or declare a single surface',\n\t\t\t\tblocking: true,\n\t\t\t})\n\t\t}\n\t}\n\tconst dependenciesResult = validateDependencyArray('dependencies', spec.dependencies)\n\tconst peersResult = validateDependencyArray('peers', spec.peers)\n\tconst extrasResult = validateDependencyArray('extras', spec.extras)\n\tquestions.push(\n\t\t...dependenciesResult.questions,\n\t\t...peersResult.questions,\n\t\t...extrasResult.questions,\n\t)\n\tconst seenDependencies = dependenciesResult.seen\n\tconst seenPeers = peersResult.seen\n\tconst seenExtras = extrasResult.seen\n\tfor (const name of seenPeers) {\n\t\tif (seenDependencies.has(name)) {\n\t\t\tquestions.push({\n\t\t\t\tfield: 'peers',\n\t\t\t\ttext: `Dependency \"${name}\" is declared in both \"dependencies\" and \"peers\"`,\n\t\t\t\tblocking: true,\n\t\t\t})\n\t\t}\n\t}\n\tfor (const name of seenExtras) {\n\t\tif (seenDependencies.has(name)) {\n\t\t\tquestions.push({\n\t\t\t\tfield: 'extras',\n\t\t\t\ttext: `Dependency \"${name}\" is declared in both \"dependencies\" and \"extras\"`,\n\t\t\t\tblocking: true,\n\t\t\t})\n\t\t}\n\t\tif (seenPeers.has(name)) {\n\t\t\tquestions.push({\n\t\t\t\tfield: 'extras',\n\t\t\t\ttext: `Dependency \"${name}\" is declared in both \"peers\" and \"extras\"`,\n\t\t\t\tblocking: true,\n\t\t\t})\n\t\t}\n\t}\n\treturn { valid: questions.length === 0, questions, warnings: [] }\n}\n\n/**\n * Narrow an unknown value to a plain (non-array, non-null) JSON object.\n *\n * @param value - The value to narrow.\n * @returns `true` iff `value` is a non-null, non-array object.\n *\n * @example\n * ```ts\n * import { isRecord } from '@orkestrel/scaffold'\n *\n * isRecord({ a: 1 }) // true\n * isRecord([1, 2]) // false\n * isRecord(null) // false\n * ```\n */\nexport function isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\n/**\n * Parse a `package.json` text into its declared `@orkestrel/*` dependencies.\n *\n * @param manifestText - The `package.json` file content.\n * @remarks\n * Reads `dependencies`, `devDependencies`, and `peerDependencies` (ALL three,\n * in that order), keeps only `DEPENDENCY_NAME_PATTERN`-shaped names,\n * deduplicated (first occurrence wins). Malformed JSON, a non-object root, or\n * a non-object/non-string section entry is skipped, never thrown.\n * @returns The declared `Dependency[]` — pure, never throws.\n *\n * @example\n * ```ts\n * import { manifestToDependencies } from '@orkestrel/scaffold'\n *\n * manifestToDependencies('{\"dependencies\":{\"@orkestrel/contract\":\"^0.0.5\"}}')\n * // [{ name: '@orkestrel/contract', range: '^0.0.5' }]\n * ```\n */\nexport function manifestToDependencies(manifestText: string): readonly Dependency[] {\n\tlet parsed: unknown\n\ttry {\n\t\tparsed = JSON.parse(manifestText)\n\t} catch {\n\t\treturn []\n\t}\n\tif (!isRecord(parsed)) return []\n\tconst seen = new Set<string>()\n\tconst dependencies: Dependency[] = []\n\tfor (const section of ['dependencies', 'devDependencies', 'peerDependencies'] as const) {\n\t\tconst entries = parsed[section]\n\t\tif (!isRecord(entries)) continue\n\t\tfor (const [name, range] of Object.entries(entries)) {\n\t\t\tif (typeof range !== 'string') continue\n\t\t\tif (!DEPENDENCY_NAME_PATTERN.test(name)) continue\n\t\t\tif (seen.has(name)) continue\n\t\t\tseen.add(name)\n\t\t\tdependencies.push({ name, range })\n\t\t}\n\t}\n\treturn dependencies\n}\n\n/**\n * Compare a declared range to the registry latest.\n *\n * @param range - The declared semver range.\n * @param latest - The registry's latest published version.\n * @remarks\n * The `0.0.x` exact-pin law: `'current'` iff `range`'s `^0.0.N` exact pin\n * equals `latest`, else `'behind'`. The `'missing'` / `'failed'` verdicts\n * come from the fetch layer, never this pure comparison.\n * @returns `'current'` or `'behind'`.\n *\n * @example\n * ```ts\n * import { rangeToFreshness } from '@orkestrel/scaffold'\n *\n * rangeToFreshness('^0.0.5', '0.0.5') // 'current' — pinned to latest\n * rangeToFreshness('^0.0.5', '0.0.7') // 'behind' — a newer patch is published\n * ```\n */\nexport function rangeToFreshness(range: string, latest: string): Freshness {\n\tconst pinned = range.replace(/^\\^/, '')\n\treturn pinned === latest ? 'current' : 'behind'\n}\n\n/**\n * Compute a canonical FNV-1a digest of a text string.\n *\n * @param text - The text to digest.\n * @remarks\n * The 32-bit FNV-1a offset basis/prime, `Math.imul` for the wraparound\n * multiply, rendered as an 8-hex-digit zero-padded lowercase string —\n * deterministic, no clocks or randomness.\n * @returns The 8-hex-digit FNV-1a digest of `text`.\n *\n * @example\n * ```ts\n * import { computeHash } from '@orkestrel/scaffold'\n *\n * computeHash('hello-world') // '428d118e'\n * ```\n */\nexport function computeHash(text: string): string {\n\tlet hash = 0x811c9dc5\n\tfor (let index = 0; index < text.length; index += 1) {\n\t\thash ^= text.charCodeAt(index)\n\t\thash = Math.imul(hash, 0x01000193)\n\t}\n\treturn (hash >>> 0).toString(16).padStart(8, '0')\n}\n\n/**\n * Serialize a value to a canonical, key-order-INDEPENDENT JSON-like string.\n *\n * @param value - The value to stringify.\n * @remarks\n * Object keys sort code-unit; array order is preserved. So two\n * logically-equal blueprints built with their fields in a different\n * construction order still hash identically once fed through `computeHash`.\n * @returns The canonical string form of `value`.\n *\n * @example\n * ```ts\n * import { stableStringify } from '@orkestrel/scaffold'\n *\n * stableStringify({ b: 1, a: 2 }) // '{\"a\":2,\"b\":1}'\n * ```\n */\nexport function stableStringify(value: unknown): string {\n\tif (Array.isArray(value)) return `[${value.map((item) => stableStringify(item)).join(',')}]`\n\tif (typeof value === 'object' && value !== null) {\n\t\tconst entries = Object.entries(value).sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))\n\t\treturn `{${entries.map(([key, entry]) => `${JSON.stringify(key)}:${stableStringify(entry)}`).join(',')}}`\n\t}\n\treturn JSON.stringify(value)\n}\n\n/**\n * Return a fresh `Plan` with `trace` and `hash` filled.\n *\n * @param plan - The plan to pin.\n * @remarks\n * `hash` is a canonical `computeHash` digest of the plan's\n * blueprint/groups/artifacts, serialized through `stableStringify` —\n * deterministic, no clocks or randomness. `trace` is a one-line derivation\n * summary built from the plan's own `PlanSummary`.\n * @returns The plan with `trace` and `hash` filled.\n *\n * @example\n * ```ts\n * import { pinPlan } from '@orkestrel/scaffold'\n *\n * pinPlan(plan).trace // 'router · core+browser · groups:7 · artifacts:21'\n * ```\n */\nexport function pinPlan(plan: Plan): Plan {\n\tconst canonical = stableStringify({\n\t\tblueprint: plan.blueprint,\n\t\tgroups: plan.groups,\n\t\tartifacts: plan.artifacts,\n\t})\n\tconst summary = planToSummary(plan)\n\tconst trace = `${plan.blueprint.name} · ${summary.surfaces.join('+')} · groups:${summary.groups.length} · artifacts:${summary.artifacts}`\n\treturn { ...plan, trace, hash: computeHash(canonical) }\n}\n","import type { TemplateDefinition } from '@orkestrel/template'\n\n/**\n * The shipped, versioned `TemplateDefinition` data behind every\n * `template`-origin artifact `blueprintToPlan` renders.\n *\n * @remarks\n * The generated-minimal stub prose/source, expressed as `{{name}}` /\n * `{{pascal}}` `{{token}}` placeholders for `@orkestrel/template`'s pure\n * `fillTemplate` LEAF. Only genuinely templated PROSE / source artifacts live\n * here — the token-collision boundary (AGENTS §14, this guide's Contract\n * invariant 3) keeps every STRUCTURAL file (`package.json`, the tsconfigs,\n * the vite configs) `computed` inside `blueprintToPlan` instead, so a literal\n * `{{…}}` in a config can never be mistaken for a placeholder. A convention\n * change here is a version bump of this package, never a hand-edit of a\n * scaffolded repo's copy.\n */\nexport const TEMPLATES: Readonly<Record<string, TemplateDefinition>> = (() => {\n\t// The `content` strings below are rendered FILE TEXT (README / guide / stub\n\t// prose and source), so every embedded declaration keyword is interpolated\n\t// rather than typed literally at column 0 — the doc↔source parity scan\n\t// (AGENTS §22) reads this file's own source lines, and a flush-left\n\t// `export function foo` inside a template string is indistinguishable from\n\t// a real module-scope export to that line-based scan. Interpolating the\n\t// keyword keeps the emitted bytes identical while keeping this file's own\n\t// declaration surface exactly the one export it documents.\n\tconst EXPORT_KEYWORD = 'export'\n\tconst CONST_KEYWORD = 'const'\n\tconst IMPORT_KEYWORD = 'import'\n\tconst FUNCTION_KEYWORD = 'function'\n\treturn Object.freeze({\n\t\treadme: Object.freeze({\n\t\t\tid: 'readme',\n\t\t\tname: 'readme',\n\t\t\tsummary: \"The package root README — install, usage, and the guide's pointer.\",\n\t\t\tcategory: 'docs',\n\t\t\tplaceholders: Object.freeze([\n\t\t\t\tObject.freeze({ name: 'name', description: 'The lowercase-hyphen package name.' }),\n\t\t\t\tObject.freeze({ name: 'pascal', description: 'The PascalCase entity name.' }),\n\t\t\t]),\n\t\t\tcontent: `# @orkestrel/{{name}}\n\nTODO: one-line description. Part of the \\`@orkestrel\\` line.\n\n## Install\n\n\\`\\`\\`sh\nnpm install @orkestrel/{{name}}\n\\`\\`\\`\n\n## Usage\n\n\\`\\`\\`ts\nimport { create{{pascal}} } from '@orkestrel/{{name}}'\n\n${CONST_KEYWORD} instance = create{{pascal}}({ id: 'example' })\n\\`\\`\\`\n\n## Guide\n\nFor the full surface, see [\\`guides/src/{{name}}.md\\`](guides/src/{{name}}.md).\n\n## License\n\nMIT © [Orkestrel](https://github.com/orkestrel) — see [LICENSE](./LICENSE).\n`,\n\t\t}),\n\t\tguide: Object.freeze({\n\t\t\tid: 'guide',\n\t\t\tname: 'guide',\n\t\t\tsummary: \"The package's own guide stub, with its Surface tables filled in.\",\n\t\t\tcategory: 'guides',\n\t\t\tplaceholders: Object.freeze([\n\t\t\t\tObject.freeze({ name: 'name', description: 'The lowercase-hyphen package name.' }),\n\t\t\t\tObject.freeze({ name: 'pascal', description: 'The PascalCase entity name.' }),\n\t\t\t\tObject.freeze({\n\t\t\t\t\tname: 'primary',\n\t\t\t\t\tdescription: 'The primary Surface (`core` when declared, else the sole surface).',\n\t\t\t\t}),\n\t\t\t\tObject.freeze({\n\t\t\t\t\tname: 'source',\n\t\t\t\t\tdescription: 'The rendered \"Source: …\" fragment over every declared surface.',\n\t\t\t\t}),\n\t\t\t\tObject.freeze({\n\t\t\t\t\tname: 'barrel',\n\t\t\t\t\tdescription: 'The rendered \"Surfaced through …\" sentence.',\n\t\t\t\t}),\n\t\t\t\tObject.freeze({\n\t\t\t\t\tname: 'tests',\n\t\t\t\t\tdescription: 'The rendered per-surface Tests section body.',\n\t\t\t\t}),\n\t\t\t\tObject.freeze({ name: 'factories', description: 'The rendered Factories surface table.' }),\n\t\t\t\tObject.freeze({ name: 'entities', description: 'The rendered Entities surface table.' }),\n\t\t\t\tObject.freeze({ name: 'types', description: 'The rendered Types surface table.' }),\n\t\t\t]),\n\t\t\tcontent: `# {{pascal}}\n\n> TODO: one-paragraph description of \\`{{pascal}}\\` — what it is, what problem it\n> solves, and how it fits the \\`@orkestrel\\` line. Source: {{source}}.\n> {{barrel}}\n\n## Surface\n\nTODO: a short intro line, then a minimal usage example:\n\n\\`\\`\\`ts\nimport { create{{pascal}} } from '@src/{{primary}}'\n\n${CONST_KEYWORD} instance = create{{pascal}}({ id: 'example' })\n\\`\\`\\`\n\n### Factories\n\n{{factories}}\n\n### Entities\n\n{{entities}}\n\n### Types\n\n{{types}}\n\n## Tests\n\n{{tests}}\n\n## See also\n\n- [\\`AGENTS.md\\`](../../AGENTS.md) — the rules.\n- [\\`guide.md\\`](guide.md) — the mirrored guide for \\`@orkestrel/guide\\`, the\n devDependency powering this repo's guides-parity test suite.\n- [\\`README.md\\`](../README.md) — the guides index.\n`,\n\t\t}),\n\t\tguidesReadme: Object.freeze({\n\t\t\tid: 'guidesReadme',\n\t\t\tname: 'guidesReadme',\n\t\t\tsummary: 'The dual-axis guides index — by concept and by directory.',\n\t\t\tcategory: 'guides',\n\t\t\tplaceholders: Object.freeze([\n\t\t\t\tObject.freeze({ name: 'concept', description: 'The rendered by-concept index table.' }),\n\t\t\t\tObject.freeze({\n\t\t\t\t\tname: 'directory',\n\t\t\t\t\tdescription: 'The rendered by-directory index table.',\n\t\t\t\t}),\n\t\t\t]),\n\t\t\tcontent: `# Guides\n\nA dual-axis index into this repository's guides — by concept, and by directory (AGENTS §22).\n\n## By concept\n\n{{concept}}\n\n## By directory\n\n{{directory}}\n\n## Dependency reference\n\n[\\`src/guide.md\\`](src/guide.md) is a byte-identical mirror of the guide for\n\\`@orkestrel/guide\\` — the devDependency powering this repo's guides-parity test\nsuite (\\`tests/guides/src/parity.test.ts\\`). It documents **that package's**\nsurface (\\`Guide\\` / \\`Source\\`, the manifest and comparison helpers), not anything\nsourced in this repo; it is kept here so a reader of the parity suite can see\nthe primitives it is built from without leaving this guide set.\n\n## See also\n\n- [\\`AGENTS.md\\`](../AGENTS.md) — the rules; §22 documentation-as-contracts.\n`,\n\t\t}),\n\t\ttypes: Object.freeze({\n\t\t\tid: 'types',\n\t\t\tname: 'types',\n\t\t\tsummary: 'The generated-minimal `src/core/types.ts` stub.',\n\t\t\tcategory: 'source',\n\t\t\tplaceholders: Object.freeze([\n\t\t\t\tObject.freeze({ name: 'pascal', description: 'The PascalCase entity name.' }),\n\t\t\t]),\n\t\t\tcontent: `/** Options for \\`create{{pascal}}\\`. */\n${EXPORT_KEYWORD} interface {{pascal}}Options {\n\treadonly id?: string\n}\n\n/** A working \\`{{pascal}}\\` — pure data, no behavior. */\n${EXPORT_KEYWORD} interface {{pascal}}Interface {\n\treadonly id: string\n}\n`,\n\t\t}),\n\t\tentity: Object.freeze({\n\t\t\tid: 'entity',\n\t\t\tname: 'entity',\n\t\t\tsummary: 'The generated-minimal `src/core/{Pascal}.ts` entity stub.',\n\t\t\tcategory: 'source',\n\t\t\tplaceholders: Object.freeze([\n\t\t\t\tObject.freeze({ name: 'pascal', description: 'The PascalCase entity name.' }),\n\t\t\t]),\n\t\t\tcontent: `import type { {{pascal}}Interface, {{pascal}}Options } from './types.js'\n\n/**\n * A working \\`{{pascal}}\\` — pure data, no behavior.\n *\n * @example\n * \\`\\`\\`ts\n * const instance = new {{pascal}}({ id: 'example' })\n * \\`\\`\\`\n */\n${EXPORT_KEYWORD} class {{pascal}} implements {{pascal}}Interface {\n\treadonly id: string\n\n\tconstructor(options: {{pascal}}Options = {}) {\n\t\tthis.id = typeof options.id === 'string' ? options.id : crypto.randomUUID()\n\t}\n}\n`,\n\t\t}),\n\t\tfactories: Object.freeze({\n\t\t\tid: 'factories',\n\t\t\tname: 'factories',\n\t\t\tsummary: 'The generated-minimal `src/core/factories.ts` stub.',\n\t\t\tcategory: 'source',\n\t\t\tplaceholders: Object.freeze([\n\t\t\t\tObject.freeze({ name: 'pascal', description: 'The PascalCase entity name.' }),\n\t\t\t]),\n\t\t\tcontent: `import type { {{pascal}}Interface, {{pascal}}Options } from './types.js'\nimport { {{pascal}} } from './{{pascal}}.js'\n\n/**\n * Create a \\`{{pascal}}Interface\\`.\n *\n * @param options - An optional \\`id\\` (defaults to a random UUID)\n * @returns A working {@link {{pascal}}Interface}\n *\n * @example\n * \\`\\`\\`ts\n * import { create{{pascal}} } from '@src/core'\n *\n * ${CONST_KEYWORD} instance = create{{pascal}}({ id: 'example' })\n * \\`\\`\\`\n */\n${EXPORT_KEYWORD} function create{{pascal}}(options: {{pascal}}Options = {}): {{pascal}}Interface {\n\treturn new {{pascal}}(options)\n}\n`,\n\t\t}),\n\t\tindex: Object.freeze({\n\t\t\tid: 'index',\n\t\t\tname: 'index',\n\t\t\tsummary: 'The generated-minimal `src/core/index.ts` barrel stub.',\n\t\t\tcategory: 'source',\n\t\t\tplaceholders: Object.freeze([\n\t\t\t\tObject.freeze({ name: 'pascal', description: 'The PascalCase entity name.' }),\n\t\t\t]),\n\t\t\tcontent: `export type * from './types.js'\nexport * from './{{pascal}}.js'\nexport * from './factories.js'\n`,\n\t\t}),\n\t\tsetup: Object.freeze({\n\t\t\tid: 'setup',\n\t\t\tname: 'setup',\n\t\t\tsummary: 'The generated-minimal `tests/setup.ts` recorder helper — no placeholders.',\n\t\t\tcategory: 'tests',\n\t\t\tplaceholders: Object.freeze([]),\n\t\t\tcontent: `// ── Call recorder (a real callback, not a mock) ──────────────────────────────\n//\n// AGENTS §16.1: when a test only needs to count calls or inspect arguments, use a\n// recorder — a real listener that records every invocation — rather than a test-\n// framework spy. \\`handler\\` is a genuine callback; \\`calls\\` is each invocation's\n// argument tuple, in order.\n\n/** A real call-recording callback over an argument tuple (AGENTS §16.1). */\n${EXPORT_KEYWORD} interface TestRecorderInterface<TArgs extends readonly unknown[]> {\n\treadonly calls: readonly TArgs[]\n\treadonly count: number\n\treadonly handler: (...args: TArgs) => void\n\tclear(): void\n}\n\n/**\n * Create a {@link TestRecorderInterface} — a real callback that records each\n * invocation's arguments, for asserting what fired and with what (AGENTS §16.1).\n *\n * @typeParam TArgs - The argument tuple the recorded handler receives\n * @returns A recorder whose \\`handler\\` records into \\`calls\\`\n */\n${EXPORT_KEYWORD} function createRecorder<TArgs extends readonly unknown[]>(): TestRecorderInterface<TArgs> {\n\tconst calls: TArgs[] = []\n\treturn {\n\t\tget calls() {\n\t\t\treturn calls\n\t\t},\n\t\tget count() {\n\t\t\treturn calls.length\n\t\t},\n\t\thandler(...args: TArgs) {\n\t\t\tcalls.push(args)\n\t\t},\n\t\tclear() {\n\t\t\tcalls.length = 0\n\t\t},\n\t}\n}\n`,\n\t\t}),\n\t\tsetupServer: Object.freeze({\n\t\t\tid: 'setupServer',\n\t\t\tname: 'setupServer',\n\t\t\tsummary: 'The generated-minimal `tests/setupServer.ts` node-only helper — no placeholders.',\n\t\t\tcategory: 'tests',\n\t\t\tplaceholders: Object.freeze([]),\n\t\t\tcontent: `// AGENTS §16.1: node-only test helpers anchor \\`node:fs\\` fixture loaders to\n// this workspace root rather than a relative path, so a loader works\n// regardless of the running test file's directory depth. Add server-specific\n// fixtures/helpers here as this surface grows beyond the shared recorder in\n// tests/setup.ts.\n\n${IMPORT_KEYWORD} { fileURLToPath } from 'node:url'\n\n/** The workspace root, for anchoring \\`node:fs\\` fixture loaders (AGENTS §16.1). */\n${EXPORT_KEYWORD} ${CONST_KEYWORD} WORKSPACE_ROOT = fileURLToPath(new URL('../', import.meta.url))\n`,\n\t\t}),\n\t\tsetupBrowser: Object.freeze({\n\t\t\tid: 'setupBrowser',\n\t\t\tname: 'setupBrowser',\n\t\t\tsummary: 'The generated-minimal `tests/setupBrowser.ts` DOM-only helper — no placeholders.',\n\t\t\tcategory: 'tests',\n\t\t\tplaceholders: Object.freeze([]),\n\t\t\tcontent: `// AGENTS §16.1: DOM/browser-only test helpers (builders, CSS assertion\n// primitives) go here as this surface grows fixtures beyond the shared\n// recorder in tests/setup.ts.\n\n// TODO: [Browser] add browser/DOM test helpers as this surface grows.\nexport {}\n`,\n\t\t}),\n\t\tentityTest: Object.freeze({\n\t\t\tid: 'entityTest',\n\t\t\tname: 'entityTest',\n\t\t\tsummary: 'The generated-minimal `tests/src/<surface>/{Pascal}.test.ts` stub.',\n\t\t\tcategory: 'tests',\n\t\t\tplaceholders: Object.freeze([\n\t\t\t\tObject.freeze({ name: 'pascal', description: 'The PascalCase entity name.' }),\n\t\t\t\tObject.freeze({\n\t\t\t\t\tname: 'surface',\n\t\t\t\t\tdescription: 'The owning Surface (`core`/`browser`/`server`).',\n\t\t\t\t}),\n\t\t\t]),\n\t\t\tcontent: `import type { {{pascal}}Interface } from '@src/{{surface}}'\nimport { {{pascal}} } from '@src/{{surface}}'\nimport { describe, expect, it } from 'vitest'\n\n// The {{pascal}} entity — id assignment (explicit / generated) and independence\n// across instances. Factory-level assertions live in factories.test.ts.\n\ndescribe('{{pascal}}', () => {\n\tit('round-trips an explicit id', () => {\n\t\tconst instance: {{pascal}}Interface = new {{pascal}}({ id: 'example' })\n\n\t\texpect(instance.id).toBe('example')\n\t})\n\n\tit('generates a non-empty id when none is given', () => {\n\t\tconst instance = new {{pascal}}()\n\n\t\texpect(typeof instance.id).toBe('string')\n\t\texpect(instance.id.length).toBeGreaterThan(0)\n\t})\n\n\tit('gives distinct instances distinct generated ids', () => {\n\t\tconst a = new {{pascal}}()\n\t\tconst b = new {{pascal}}()\n\n\t\texpect(a.id).not.toBe(b.id)\n\t})\n})\n`,\n\t\t}),\n\t\tfactoriesTest: Object.freeze({\n\t\t\tid: 'factoriesTest',\n\t\t\tname: 'factoriesTest',\n\t\t\tsummary: 'The generated-minimal `tests/src/<surface>/factories.test.ts` stub.',\n\t\t\tcategory: 'tests',\n\t\t\tplaceholders: Object.freeze([\n\t\t\t\tObject.freeze({ name: 'pascal', description: 'The PascalCase entity name.' }),\n\t\t\t\tObject.freeze({\n\t\t\t\t\tname: 'surface',\n\t\t\t\t\tdescription: 'The owning Surface (`core`/`browser`/`server`).',\n\t\t\t\t}),\n\t\t\t]),\n\t\t\tcontent: `import type { {{pascal}}Interface } from '@src/{{surface}}'\nimport { create{{pascal}}, {{pascal}} } from '@src/{{surface}}'\nimport { describe, expect, expectTypeOf, it } from 'vitest'\n\n// The {{pascal}} factory — that \\`create{{pascal}}\\` returns a working {{pascal}}Interface\n// backed by a real {{pascal}} instance.\n\ndescribe('create{{pascal}}', () => {\n\tit('returns a {{pascal}} instance', () => {\n\t\tconst instance = create{{pascal}}()\n\n\t\texpect(instance).toBeInstanceOf({{pascal}})\n\t})\n\n\tit('honors the id option', () => {\n\t\t${CONST_KEYWORD} instance = create{{pascal}}({ id: 'example' })\n\n\t\texpect(instance.id).toBe('example')\n\t})\n\n\tit('create{{pascal}} returns a {{pascal}}Interface', () => {\n\t\texpectTypeOf(create{{pascal}}()).toEqualTypeOf<{{pascal}}Interface>()\n\t})\n})\n`,\n\t\t}),\n\t\tparityTest: Object.freeze({\n\t\t\tid: 'parityTest',\n\t\t\tname: 'parityTest',\n\t\t\tsummary: 'The consumer-side guides-parity drop-in — `tests/guides/src/parity.test.ts`.',\n\t\t\tcategory: 'tests',\n\t\t\tplaceholders: Object.freeze([\n\t\t\t\tObject.freeze({ name: 'name', description: 'The lowercase-hyphen package name.' }),\n\t\t\t\tObject.freeze({\n\t\t\t\t\tname: 'specifiers',\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t'The computed SELF_SPECIFIERS / SPECIFIER_MODULES / exportsFor block, one shape for every surface count.',\n\t\t\t\t}),\n\t\t\t]),\n\t\t\tcontent: `// The consumer-side guides-parity drop-in: runs \\`@orkestrel/guide\\`'s\n// checks against this repo's own \\`guides/README.md\\` manifest.\n\n${IMPORT_KEYWORD} { describe, expect, it } from 'vitest'\n${IMPORT_KEYWORD} { readdirSync, readFileSync } from 'node:fs'\n${IMPORT_KEYWORD} { fileURLToPath } from 'node:url'\n${IMPORT_KEYWORD} { join } from 'node:path'\n${IMPORT_KEYWORD} {\n\tcreateGuide,\n\tcreateSource,\n\tfenceImports,\n\tfindMissing,\n\tfindUnexampled,\n\tisExternalLink,\n\tmissingSymbols,\n\tparseManifest,\n\tresolveLink,\n\tsymbolKey,\n} from '@orkestrel/guide'\n\n${CONST_KEYWORD} ROOT = fileURLToPath(new URL('../../../', import.meta.url))\n${CONST_KEYWORD} WALK_DIRS = ['src', 'guides', 'tests']\n\n${FUNCTION_KEYWORD} walk(dir: string, acc: Record<string, string>): void {\n\tfor (const entry of readdirSync(join(ROOT, dir), { withFileTypes: true })) {\n\t\tconst relative = \\`\\${dir}/\\${entry.name}\\`\n\t\tif (entry.isDirectory()) {\n\t\t\twalk(relative, acc)\n\t\t\tcontinue\n\t\t}\n\t\tif (!entry.name.endsWith('.ts') && !entry.name.endsWith('.md')) continue\n\t\tacc[relative] = readFileSync(join(ROOT, relative), 'utf8')\n\t}\n}\n\n${CONST_KEYWORD} files: Record<string, string> = {}\nfor (const dir of WALK_DIRS) walk(dir, files)\nfiles['AGENTS.md'] = readFileSync(join(ROOT, 'AGENTS.md'), 'utf8')\n\n${FUNCTION_KEYWORD} readText(relative: string): string {\n\tconst text = files[relative]\n\tif (text === undefined) throw new Error(\\`Missing file: \\${relative}\\`)\n\treturn text\n}\n\n${CONST_KEYWORD} manifest = parseManifest(readText('guides/README.md'), 'guides')\n\n{{specifiers}}\n\nit('manifest lists at least one guide', () => {\n\texpect(manifest.length).toBeGreaterThan(0)\n})\n\nfor (const entry of manifest) {\n\tconst guide = createGuide(readText(entry.spec))\n\tconst source = createSource({ files, module: entry.source })\n\n\tdescribe(\\`\\${entry.concept}\\`, () => {\n\t\tit('extracts a non-empty documented surface', () => {\n\t\t\texpect(guide.surface().length).toBeGreaterThan(0)\n\t\t})\n\t\tit('documents every source export', () => {\n\t\t\texpect(missingSymbols(source.exports(), guide.surface())).toEqual([])\n\t\t})\n\t\tit('documents only real exports', () => {\n\t\t\texpect(missingSymbols(guide.surface(), source.exports())).toEqual([])\n\t\t})\n\n\t\tit('exposes no hidden module-scope declarations', () => {\n\t\t\texpect(source.hidden().map(symbolKey)).toEqual([])\n\t\t})\n\n\t\tfor (const group of guide.methods()) {\n\t\t\tconst members = source.methods(group.interface)\n\t\t\tconst entity = group.interface.replace(/Interface$/, '')\n\t\t\tdescribe(\\`\\${group.interface}\\`, () => {\n\t\t\t\tit('documents at least one method', () => {\n\t\t\t\t\texpect(group.methods.length).toBeGreaterThan(0)\n\t\t\t\t})\n\t\t\t\tit('documents every interface method', () => {\n\t\t\t\t\texpect(findMissing(members, group.methods)).toEqual([])\n\t\t\t\t})\n\t\t\t\tit('documents no phantom method', () => {\n\t\t\t\t\texpect(findMissing(group.methods, members)).toEqual([])\n\t\t\t\t})\n\t\t\t\tit(\\`\\${entity} exposes no undocumented method\\`, () => {\n\t\t\t\t\tconst extra =\n\t\t\t\t\t\tentity === group.interface ? [] : findMissing(source.methods(entity), group.methods)\n\t\t\t\t\texpect(extra).toEqual([])\n\t\t\t\t})\n\t\t\t})\n\t\t}\n\n\t\tit('documents an example for every Surface function', () => {\n\t\t\tconst fences = guide.patterns()\n\t\t\tconst names = guide\n\t\t\t\t.surface()\n\t\t\t\t.filter((symbol) => symbol.kind === 'function')\n\t\t\t\t.map((symbol) => symbol.name)\n\t\t\texpect(findUnexampled(names, fences, source.examples())).toEqual([])\n\t\t})\n\n\t\tfor (const group of guide.methods()) {\n\t\t\tconst entity = group.interface.replace(/Interface$/, '')\n\t\t\tdescribe(\\`\\${group.interface} examples\\`, () => {\n\t\t\t\tit('documents an example for every method', () => {\n\t\t\t\t\tconst fences = guide.patterns()\n\t\t\t\t\tconst examples =\n\t\t\t\t\t\tentity === group.interface\n\t\t\t\t\t\t\t? source.examples(group.interface)\n\t\t\t\t\t\t\t: source.examples(group.interface).concat(source.examples(entity))\n\t\t\t\t\texpect(findUnexampled(group.methods, fences, examples)).toEqual([])\n\t\t\t\t})\n\t\t\t})\n\t\t}\n\n\t\tit('imports only real exports in every \\`\\`\\`ts fence', () => {\n\t\t\tfor (const fence of guide.patterns()) {\n\t\t\t\tfor (const { specifier, names } of fenceImports(fence)) {\n\t\t\t\t\tif (!SELF_SPECIFIERS.includes(specifier)) continue\n\t\t\t\t\texpect(findMissing(names, exportsFor(specifier))).toEqual([])\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\n\t\tit('resolves every relative link', () => {\n\t\t\tconst broken = guide\n\t\t\t\t.links()\n\t\t\t\t.filter((href) => !isExternalLink(href))\n\t\t\t\t.map((href) => resolveLink(entry.spec, href))\n\t\t\t\t.filter((path) => !source.exists(path))\n\t\t\texpect(broken).toEqual([])\n\t\t})\n\t\tit('links only to test files that exist', () => {\n\t\t\tconst missing = guide\n\t\t\t\t.tests()\n\t\t\t\t.map((href) => resolveLink(entry.spec, href))\n\t\t\t\t.filter((path) => !source.exists(path))\n\t\t\texpect(missing).toEqual([])\n\t\t})\n\t})\n}\n`,\n\t\t}),\n\t} as const)\n})()\n","import type { Artifact, Blueprint, Dependency, Group, Member, Plan, Surface } from './types.js'\nimport { fillTemplate } from '@orkestrel/template'\nimport { GROUPS, HOST_PATHS, SCAFFOLD_RANGE, SURFACE_MATRIX } from './constants.js'\nimport { alignTable, blueprintToMembers, pascalCase, pinPlan } from './helpers.js'\nimport { TEMPLATES } from './templates.js'\n\n/**\n * Resolve the `Group` a byte-copied `HOST_PATHS` entry belongs to.\n *\n * @param path - A `HOST_PATHS` entry.\n * @returns The owning `Group`.\n *\n * @example\n * ```ts\n * hostGroup('AGENTS.md') // 'docs'\n * hostGroup('.claude') // 'orchestration'\n * ```\n */\nexport function hostGroup(path: string): Group {\n\tif (path === 'AGENTS.md' || path === 'CLAUDE.md' || path === 'LICENSE') {\n\t\treturn 'docs'\n\t}\n\tif (\n\t\tpath === '.claude' ||\n\t\tpath === 'scripts/deps.sh' ||\n\t\tpath === 'scripts/cursor.sh' ||\n\t\tpath === 'scripts/ollama.sh' ||\n\t\tpath === '.github/workflows/ci.yml'\n\t) {\n\t\treturn 'orchestration'\n\t}\n\tif (path === 'guides/src/guide.md' || path === 'guides/src/scaffold.md') return 'guides'\n\treturn 'configs'\n}\n\n/**\n * Fill one `TEMPLATES` entry into a `template`-origin `Artifact`, optionally\n * tagged with the owning `Surface` (source/tests artifacts that live under a\n * declared surface's tree).\n *\n * @param path - The artifact's output path.\n * @param group - The artifact's `Group`.\n * @param id - The `TEMPLATES` entry id to fill.\n * @param values - The placeholder values to fill the template with.\n * @param surface - The owning `Surface`, when the artifact lives under a declared surface's tree.\n * @returns The filled `template`-origin `Artifact`.\n *\n * @example\n * ```ts\n * fillArtifact('README.md', 'docs', 'readme', { name: 'router', pascal: 'Router' })\n * // { path: 'README.md', group: 'docs', origin: 'template', content: '# router\\n…' }\n * ```\n */\nexport function fillArtifact(\n\tpath: string,\n\tgroup: Group,\n\tid: string,\n\tvalues: Readonly<Record<string, unknown>>,\n\tsurface?: Surface,\n): Artifact {\n\tconst definition = TEMPLATES[id]\n\tif (!definition) throw new Error(`Unknown template id: ${id}`)\n\tconst content = fillTemplate(definition.content, values, {\n\t\tmissing: 'error',\n\t\tplaceholders: definition.placeholders,\n\t})\n\treturn surface === undefined\n\t\t? { path, group, origin: 'template', content }\n\t\t: { path, group, origin: 'template', surface, content }\n}\n\n/**\n * Classify a blueprint's surfaces into the manifest/exports variant class.\n *\n * @param surfaces - The declared `Surface[]`.\n * @returns The sole declared `Surface`, or `'multi'` when two or more are declared.\n *\n * @example\n * ```ts\n * surfaceVariant(['core']) // 'core'\n * surfaceVariant(['core', 'server']) // 'multi'\n * ```\n */\nexport function surfaceVariant(surfaces: readonly Surface[]): Surface | 'multi' {\n\tif (surfaces.length > 1) return 'multi'\n\tconst [only] = surfaces\n\treturn only ?? 'core'\n}\n\n/**\n * Build the `main` / `module` / top-level `types` entry fields.\n *\n * @param surfaces - The declared `Surface[]`.\n * @returns The `package.json` `main` / `module` / optional `types` fields.\n *\n * @example\n * ```ts\n * entryFields(['browser']).main // './dist/src/browser/index.js'\n * ```\n */\nexport function entryFields(surfaces: readonly Surface[]): {\n\treadonly main: string\n\treadonly module: string\n\treadonly types?: string\n} {\n\tconst variant = surfaceVariant(surfaces)\n\tif (variant === 'multi') {\n\t\treturn { main: './dist/src/core/index.cjs', module: './dist/src/core/index.js' }\n\t}\n\tconst root: Surface = variant\n\tif (root === 'browser') {\n\t\treturn {\n\t\t\tmain: './dist/src/browser/index.js',\n\t\t\tmodule: './dist/src/browser/index.js',\n\t\t\ttypes: './dist/src/browser/index.d.ts',\n\t\t}\n\t}\n\tif (root === 'server') {\n\t\treturn {\n\t\t\tmain: './dist/src/server/index.cjs',\n\t\t\tmodule: './dist/src/server/index.js',\n\t\t\ttypes: './dist/src/server/index.d.ts',\n\t\t}\n\t}\n\treturn {\n\t\tmain: './dist/src/core/index.cjs',\n\t\tmodule: './dist/src/core/index.js',\n\t\ttypes: './dist/src/core/index.d.ts',\n\t}\n}\n\n/**\n * One dual-format (`import` + `require`) `exports` condition block.\n *\n * @param path - The extensionless dist path to point both conditions at.\n * @returns The dual `import`/`require` exports condition object.\n *\n * @example\n * ```ts\n * dualCondition('./dist/src/core/index')\n * // { import: { types: '….d.ts', default: '….js' }, require: { types: '….d.cts', default: '….cjs' } }\n * ```\n */\nexport function dualCondition(path: string): Readonly<Record<string, unknown>> {\n\treturn {\n\t\timport: { types: `${path}.d.ts`, default: `${path}.js` },\n\t\trequire: { types: `${path}.d.cts`, default: `${path}.cjs` },\n\t}\n}\n\n/**\n * Build the `package.json` `exports` map.\n *\n * @param surfaces - The declared `Surface[]`.\n * @returns The `package.json` `exports` map.\n *\n * @example\n * ```ts\n * exportsMap(['core'])['.'] // dual import/require condition block\n * ```\n */\nexport function exportsMap(surfaces: readonly Surface[]): Readonly<Record<string, unknown>> {\n\tconst variant = surfaceVariant(surfaces)\n\tif (variant === 'browser') {\n\t\treturn {\n\t\t\t'.': {\n\t\t\t\ttypes: './dist/src/browser/index.d.ts',\n\t\t\t\timport: './dist/src/browser/index.js',\n\t\t\t\tdefault: './dist/src/browser/index.js',\n\t\t\t},\n\t\t\t'./package.json': './package.json',\n\t\t}\n\t}\n\tif (variant === 'server') {\n\t\treturn { '.': dualCondition('./dist/src/server/index'), './package.json': './package.json' }\n\t}\n\tif (variant === 'core') {\n\t\treturn { '.': dualCondition('./dist/src/core/index'), './package.json': './package.json' }\n\t}\n\tconst map: Record<string, unknown> = { '.': dualCondition('./dist/src/core/index') }\n\tfor (const surface of surfaces) {\n\t\tif (surface === 'core') continue\n\t\tconst row = SURFACE_MATRIX[surface]\n\t\tif (surface === 'browser') {\n\t\t\tmap[row.path] = {\n\t\t\t\timport: {\n\t\t\t\t\ttypes: './dist/src/browser/index.d.ts',\n\t\t\t\t\tdefault: './dist/src/browser/index.js',\n\t\t\t\t},\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tmap[row.path] = dualCondition(`./dist/src/${surface}/index`)\n\t}\n\tmap['./package.json'] = './package.json'\n\treturn map\n}\n\n/**\n * A code-unit (not locale-sensitive) comparator — matches the `keywords` sort\n * and keeps ordering stable across locales/environments.\n *\n * @param a - The first string.\n * @param b - The second string.\n * @returns `-1` / `0` / `1` per code-unit order.\n *\n * @example\n * ```ts\n * [...['b', 'a']].sort(compareCodeUnit) // ['a', 'b']\n * ```\n */\nexport function compareCodeUnit(a: string, b: string): number {\n\treturn a < b ? -1 : a > b ? 1 : 0\n}\n\n/**\n * The devDependency baseline — every repo in the line carries the same set\n * (`@vitest/browser-playwright` included regardless of a browser surface: both\n * @orkestrel/middleware, core+server, and @orkestrel/router, core+browser+server,\n * ship it — grounded, not conditional). A package's `extras` (code-unit sorted)\n * merge in on top, the extras' declared range winning on a name collision with\n * the baseline.\n *\n * @param extras - The blueprint's package-specific `extras` `Dependency[]`.\n * @returns The merged `devDependencies` record.\n *\n * @example\n * ```ts\n * devDependenciesFor([])['typescript'] // '^6.0.3'\n * ```\n */\nexport function devDependenciesFor(\n\textras: readonly Dependency[],\n): Readonly<Record<string, string>> {\n\tconst baseline: Record<string, string> = {\n\t\t'@microsoft/api-extractor': '^7.58.11',\n\t\t'@orkestrel/guide': '^0.0.5',\n\t\t'@orkestrel/scaffold': SCAFFOLD_RANGE,\n\t\t'@types/node': '^26.1.1',\n\t\t'@vitest/browser-playwright': '^4.1.10',\n\t\toxfmt: '^0.59.0',\n\t\toxlint: '^1.74.0',\n\t\ttypescript: '^6.0.3',\n\t\tvite: '^8.1.5',\n\t\t'vite-plugin-dts': '^5.0.3',\n\t\tvitest: '^4.1.10',\n\t}\n\tfor (const extra of [...extras].sort((a, b) => compareCodeUnit(a.name, b.name))) {\n\t\tbaseline[extra.name] = extra.range\n\t}\n\treturn baseline\n}\n\n/**\n * Compute the `package.json` artifact's `content`, applying the manifest and\n * exports combination rules over a blueprint's surfaces — grounded against the\n * live @orkestrel/middleware (core+server) and @orkestrel/router\n * (core+browser+server) exemplars.\n *\n * @param spec - The `Blueprint` to derive the manifest from.\n * @returns The `package.json` file content, newline-terminated.\n *\n * @example\n * ```ts\n * packageManifest(blueprint('router')) // '{\\n\\t\"name\": \"@orkestrel/router\",\\n…}\\n'\n * ```\n */\nexport function packageManifest(spec: Blueprint): string {\n\tconst entry = entryFields(spec.surfaces)\n\tconst dependencies: Record<string, string> = {}\n\tfor (const dep of [...spec.dependencies].sort((a, b) => compareCodeUnit(a.name, b.name))) {\n\t\tdependencies[dep.name] = dep.range\n\t}\n\tconst peerDependencies: Record<string, string> = {}\n\tfor (const peer of [...spec.peers].sort((a, b) => compareCodeUnit(a.name, b.name))) {\n\t\tpeerDependencies[peer.name] = peer.range\n\t}\n\tconst peerDependenciesMeta: Record<string, { readonly optional: true }> = {}\n\tfor (const peer of spec.peers) {\n\t\tif (peer.optional === true) peerDependenciesMeta[peer.name] = { optional: true }\n\t}\n\n\t// Scripts are built by sequential assignment so aggregate + per-surface\n\t// keys interleave in the exact live-package insertion order (`check:src`\n\t// immediately followed by each `check:src:<surface>`, and so on).\n\tconst scripts: Record<string, string> = {\n\t\tclean: \"node -e \\\"try{require('node:fs').rmSync('dist',{recursive:true,force:true})}catch{}\\\"\",\n\t\tcopy: \"node -e \\\"const fs=require('node:fs'),p=require('node:path'),a=process.argv[1],b=process.argv[2];fs.mkdirSync(p.dirname(b),{recursive:true});fs.cpSync(a,b,{force:true});console.log('Copied: '+a+' to '+b)\\\"\",\n\t\t'tmp:txt':\n\t\t\t\"node -e \\\"const fs=require('node:fs'),p=require('node:path');function walk(d){for(const e of fs.readdirSync(d,{withFileTypes:true})){const f=p.join(d,e.name);if(e.isDirectory()){walk(f)}else if(!e.name.endsWith('.md')&&!e.name.endsWith('.txt')){const t=f+'.txt';if(!fs.existsSync(t)){fs.renameSync(f,t)}else{console.warn('Skipping '+f+' — target exists: '+t)}}}}try{walk('tmp')}catch(e){if(e.code!=='ENOENT')throw e}\\\"\",\n\t\tscaffold: 'scaffold',\n\t\tlint: 'oxlint --config .oxlintrc.json --fix .',\n\t\tcheck: 'tsc --noEmit --project tsconfig.json && npm run check:src',\n\t\t'check:src': spec.surfaces.map((surface) => `npm run check:src:${surface}`).join(' && '),\n\t}\n\tfor (const surface of spec.surfaces) {\n\t\tscripts[`check:src:${surface}`] = `tsc --noEmit -p configs/src/tsconfig.${surface}.json`\n\t}\n\tscripts.format = 'oxfmt --config .oxfmtrc.json --write .'\n\tscripts['format:check'] = 'oxfmt --config .oxfmtrc.json --check .'\n\tscripts['lint:check'] = 'oxlint --config .oxlintrc.json .'\n\tscripts.test = 'npm run test:src && npm run test:guides'\n\tscripts['test:src'] =\n\t\t'vitest run --config vite.config.ts --no-cache --reporter=dot ' +\n\t\tspec.surfaces.map((surface) => `--project src:${surface}`).join(' ')\n\tfor (const surface of spec.surfaces) {\n\t\tscripts[`test:src:${surface}`] =\n\t\t\t`vitest run --config vite.config.ts --no-cache --reporter=dot --project src:${surface}`\n\t}\n\tscripts['test:guides'] = 'vitest run --config vite.config.ts --reporter=dot --project guides'\n\tscripts.build = 'npm run clean && npm run build:src'\n\tscripts['build:src'] = spec.surfaces.map((surface) => `npm run build:src:${surface}`).join(' && ')\n\tfor (const surface of spec.surfaces) {\n\t\tscripts[`build:src:${surface}`] =\n\t\t\tsurface === 'browser'\n\t\t\t\t? `vite build --config configs/src/vite.${surface}.config.ts`\n\t\t\t\t: `vite build --config configs/src/vite.${surface}.config.ts && npm run copy dist/src/${surface}/index.d.ts dist/src/${surface}/index.d.cts`\n\t}\n\tscripts.prepublishOnly =\n\t\t'npm run format:check && npm run lint:check && npm run check && npm run build && npm test'\n\n\tconst manifest: Record<string, unknown> = {\n\t\tname: `@orkestrel/${spec.name}`,\n\t\tversion: spec.version,\n\t\tdescription: spec.description ?? 'TODO: one-line description. Part of the @orkestrel line.',\n\t\tkeywords: [...spec.keywords].sort(),\n\t\thomepage: `https://github.com/orkestrel/${spec.name}#readme`,\n\t\tbugs: `https://github.com/orkestrel/${spec.name}/issues`,\n\t\tlicense: 'MIT',\n\t\trepository: { type: 'git', url: `git+https://github.com/orkestrel/${spec.name}.git` },\n\t\tfiles: ['dist', 'README.md'],\n\t\ttype: 'module',\n\t\tsideEffects: false,\n\t\tmain: entry.main,\n\t\tmodule: entry.module,\n\t\t...(entry.types ? { types: entry.types } : {}),\n\t\texports: exportsMap(spec.surfaces),\n\t\tpublishConfig: { access: 'public' },\n\t\tscripts,\n\t\tdependencies,\n\t\tdevDependencies: devDependenciesFor(spec.extras),\n\t\t...(Object.keys(peerDependencies).length > 0 ? { peerDependencies } : {}),\n\t\t...(Object.keys(peerDependenciesMeta).length > 0 ? { peerDependenciesMeta } : {}),\n\t\tengines: { node: spec.engines },\n\t}\n\treturn `${JSON.stringify(manifest, undefined, '\\t')}\\n`\n}\n\n/**\n * The root `tsconfig.json` — one `@src/<surface>` path alias per declared\n * surface, in declared order.\n *\n * @param surfaces - The declared `Surface[]`.\n * @returns The root `tsconfig.json` file content, newline-terminated.\n *\n * @example\n * ```ts\n * rootTsconfig(['core']) // '{\\n\\t\"compilerOptions\": {…}\\n}\\n'\n * ```\n */\nexport function rootTsconfig(surfaces: readonly Surface[]): string {\n\tconst paths: Record<string, readonly string[]> = {}\n\tfor (const surface of surfaces) paths[`@src/${surface}`] = [`./src/${surface}/index.ts`]\n\tconst config = {\n\t\tcompilerOptions: {\n\t\t\ttarget: 'ESNext',\n\t\t\tmodule: 'ESNext',\n\t\t\tmoduleResolution: 'bundler',\n\t\t\tlib: ['ESNext', 'DOM', 'DOM.Iterable'],\n\t\t\ttypes: ['node', 'vite/client', 'vitest/globals'],\n\t\t\tmoduleDetection: 'force',\n\t\t\tresolveJsonModule: true,\n\t\t\tstrict: true,\n\t\t\tnoImplicitOverride: true,\n\t\t\tnoFallthroughCasesInSwitch: true,\n\t\t\tforceConsistentCasingInFileNames: true,\n\t\t\tskipLibCheck: true,\n\t\t\tnoEmit: true,\n\t\t\tpaths,\n\t\t},\n\t\texclude: ['node_modules', 'dist', 'tmp'],\n\t}\n\treturn `${JSON.stringify(config, undefined, '\\t')}\\n`\n}\n\n/**\n * The rendered import / `resolve` header block every `rootViteConfig` shape\n * prefixes — the Playwright import lines + `createBrowserProvider` appear\n * only when `needsPlaywright`, per the three grounded `rootViteConfig`\n * shapes: unconditional for a multi-surface blueprint, conditional on the\n * sole surface being `'browser'` for a single non-`core` surface, absent for\n * `core`-only.\n *\n * @param needsPlaywright - Whether this shape ships a browser test project (and so needs Playwright).\n * @returns The rendered header block, newline-terminated.\n *\n * @example\n * ```ts\n * viteHeader(false).includes('@vitest/browser-playwright') // false\n * viteHeader(true).includes('@vitest/browser-playwright') // true\n * ```\n */\nexport function viteHeader(needsPlaywright: boolean): string {\n\t// Rendered blocks below are generated FILE TEXT, so every embedded\n\t// declaration keyword is interpolated rather than typed literally at\n\t// column 0 — the doc↔source parity scan (AGENTS §22) reads this file's\n\t// own source lines, and a flush-left `export const foo` inside a\n\t// template string is indistinguishable from a real module-scope export\n\t// to that line-based scan; interpolating the keyword keeps the emitted\n\t// bytes identical while keeping this file's own declaration surface\n\t// exactly the one export it documents.\n\tconst EXPORT_KEYWORD = 'export'\n\tconst CONST_KEYWORD = 'const'\n\n\t// The Playwright-import lines + `createBrowserProvider` — present only\n\t// when `needsPlaywright`.\n\tconst playwrightImports = needsPlaywright\n\t\t? `import { globSync } from 'node:fs'\nimport { playwright } from '@vitest/browser-playwright'\n`\n\t\t: ''\n\tconst browserProviderFn = needsPlaywright\n\t\t? `\n${EXPORT_KEYWORD} function createBrowserProvider() {\n\tconst { PLAYWRIGHT_EXECUTABLE_PATH, PLAYWRIGHT_WS_ENDPOINT, PLAYWRIGHT_CHANNEL } = process.env\n\tif (PLAYWRIGHT_EXECUTABLE_PATH)\n\t\treturn playwright({ launchOptions: { executablePath: PLAYWRIGHT_EXECUTABLE_PATH } })\n\tif (PLAYWRIGHT_WS_ENDPOINT)\n\t\treturn playwright({ connectOptions: { wsEndpoint: PLAYWRIGHT_WS_ENDPOINT } })\n\tif (PLAYWRIGHT_CHANNEL) return playwright({ launchOptions: { channel: PLAYWRIGHT_CHANNEL } })\n\tif (process.platform === 'linux') {\n\t\tfor (const pattern of [\n\t\t\t'/opt/pw-browsers/chromium',\n\t\t\t'/opt/pw-browsers/chromium-*/chrome-linux64/chrome',\n\t\t\t'/opt/pw-browsers/chromium-*/chrome-linux/chrome',\n\t\t]) {\n\t\t\tconst [executablePath] = globSync(pattern).sort().reverse()\n\t\t\tif (executablePath) return playwright({ launchOptions: { executablePath } })\n\t\t}\n\t}\n\tconst channel = process.platform === 'win32' ? 'msedge' : 'chrome'\n\treturn playwright({ launchOptions: { channel } })\n}\n`\n\t\t: ''\n\treturn `import type { UserConfig } from 'vite'\nimport { defineConfig, mergeConfig } from 'vitest/config'\nimport tsconfig from './tsconfig.json' with { type: 'json' }\nimport { fileURLToPath, URL } from 'node:url'\n${playwrightImports}\n${EXPORT_KEYWORD} function resolveWorkspacePath(relativePath: string): string {\n\treturn fileURLToPath(new URL(relativePath, import.meta.url))\n}\n${browserProviderFn}\n${CONST_KEYWORD} resolve = {\n\talias: Object.entries(tsconfig.compilerOptions.paths).reduce(\n\t\t(a, [k, v]) => Object.assign(a, { [k]: resolveWorkspacePath(v[0]) }),\n\t\t{},\n\t),\n}\n`\n}\n\n/**\n * The single non-`core` surface's factory IS the base (Shape 3 of\n * `rootViteConfig`) — the surface's own `viteHeader` (Playwright only when\n * `surface === 'browser'`, per the live sqlite/indexeddb exemplars) prefixes\n * the surface-specific `srcBrowser` / `srcServer` + `guides` projects export.\n *\n * @param surface - The sole declared non-`core` surface.\n * @returns The root `vite.config.ts` file content for a single non-`core` surface, newline-terminated.\n *\n * @example\n * ```ts\n * singleSurfaceViteConfig('server').includes('srcServer') // true\n * ```\n */\nexport function singleSurfaceViteConfig(surface: 'browser' | 'server'): string {\n\t// Rendered blocks below are generated FILE TEXT, so every embedded\n\t// declaration keyword is interpolated rather than typed literally at\n\t// column 0 — the doc↔source parity scan (AGENTS §22) reads this file's\n\t// own source lines, and a flush-left `export const foo` inside a\n\t// template string is indistinguishable from a real module-scope export\n\t// to that line-based scan; interpolating the keyword keeps the emitted\n\t// bytes identical while keeping this file's own declaration surface\n\t// exactly the one export it documents.\n\tconst EXPORT_KEYWORD = 'export'\n\tconst header = viteHeader(surface === 'browser')\n\tif (surface === 'browser') {\n\t\treturn `${header}\n${EXPORT_KEYWORD} const srcBrowser = (config?: UserConfig): UserConfig =>\n\tmergeConfig(\n\t\t{\n\t\t\tresolve,\n\t\t\tbuild: {\n\t\t\t\temptyOutDir: true,\n\t\t\t\tsourcemap: true,\n\t\t\t\tminify: false,\n\t\t\t\tlib: {\n\t\t\t\t\tentry: resolveWorkspacePath('src/browser/index.ts'),\n\t\t\t\t\tformats: ['es'],\n\t\t\t\t\tfileName: () => 'index.js',\n\t\t\t\t},\n\t\t\t\toutDir: 'dist/src/browser',\n\t\t\t\trolldownOptions: {\n\t\t\t\t\texternal: (id: string) => id.startsWith('@orkestrel/'),\n\t\t\t\t},\n\t\t\t},\n\t\t\ttest: {\n\t\t\t\tname: { label: 'src:browser', color: 'yellow' },\n\t\t\t\tinclude: ['tests/src/browser/**/*.test.ts'],\n\t\t\t\tsetupFiles: ['./tests/setup.ts', './tests/setupBrowser.ts'],\n\t\t\t\tbrowser: {\n\t\t\t\t\tenabled: true,\n\t\t\t\t\tprovider: createBrowserProvider(),\n\t\t\t\t\tinstances: [{ browser: 'chromium', headless: true }],\n\t\t\t\t},\n\t\t\t\tfileParallelism: false,\n\t\t\t},\n\t\t},\n\t\tconfig ?? {},\n\t)\n\n${EXPORT_KEYWORD} const guides = (config?: UserConfig): UserConfig =>\n\tsrcBrowser(\n\t\tmergeConfig(\n\t\t\t{\n\t\t\t\ttest: {\n\t\t\t\t\tname: { label: 'guides', color: 'green' },\n\t\t\t\t\tinclude: ['tests/guides/**/*.test.ts'],\n\t\t\t\t\texclude: ['tests/src/**/*.test.ts', 'tests/setup.test.ts'],\n\t\t\t\t\tenvironment: 'node',\n\t\t\t\t\tbrowser: { enabled: false },\n\t\t\t\t},\n\t\t\t},\n\t\t\tconfig ?? {},\n\t\t),\n\t)\n\nexport default defineConfig({\n\tresolve,\n\ttest: {\n\t\tprojects: [srcBrowser, guides],\n\t},\n})\n`\n\t}\n\treturn `${header}\n${EXPORT_KEYWORD} const srcServer = (config?: UserConfig): UserConfig =>\n\tmergeConfig(\n\t\t{\n\t\t\tresolve,\n\t\t\tbuild: {\n\t\t\t\temptyOutDir: true,\n\t\t\t\tsourcemap: true,\n\t\t\t\tminify: false,\n\t\t\t\tlib: {\n\t\t\t\t\tentry: resolveWorkspacePath('src/server/index.ts'),\n\t\t\t\t\tformats: ['es', 'cjs'],\n\t\t\t\t\tfileName: (format: string) => (format === 'es' ? 'index.js' : 'index.cjs'),\n\t\t\t\t},\n\t\t\t\toutDir: 'dist/src/server',\n\t\t\t\ttarget: 'node24',\n\t\t\t\trolldownOptions: {\n\t\t\t\t\texternal: (id: string) => id.startsWith('node:') || id.startsWith('@orkestrel/'),\n\t\t\t\t},\n\t\t\t},\n\t\t\ttest: {\n\t\t\t\tname: { label: 'src:server', color: 'red' },\n\t\t\t\tinclude: ['tests/src/server/**/*.test.ts'],\n\t\t\t\tsetupFiles: ['./tests/setup.ts', './tests/setupServer.ts'],\n\t\t\t\tenvironment: 'node',\n\t\t\t\tbrowser: { enabled: false },\n\t\t\t},\n\t\t},\n\t\tconfig ?? {},\n\t)\n\n${EXPORT_KEYWORD} const guides = (config?: UserConfig): UserConfig =>\n\tsrcServer(\n\t\tmergeConfig(\n\t\t\t{\n\t\t\t\ttest: {\n\t\t\t\t\tname: { label: 'guides', color: 'green' },\n\t\t\t\t\tinclude: ['tests/guides/**/*.test.ts'],\n\t\t\t\t\texclude: ['tests/src/**/*.test.ts', 'tests/setup.test.ts'],\n\t\t\t\t},\n\t\t\t},\n\t\t\tconfig ?? {},\n\t\t),\n\t)\n\nexport default defineConfig({\n\tresolve,\n\ttest: {\n\t\tprojects: [srcServer, guides],\n\t},\n})\n`\n}\n\n/**\n * The root `vite.config.ts` — three grounded shapes, chosen by a blueprint's\n * `surfaces`:\n * 1. `core`-only — `srcCore` + `guides`, no Playwright at all (the live\n * timeout exemplar: no browser project exists anywhere in the file).\n * 2. Multi-surface (2+ surfaces, always including `core` per the live\n * middleware/router exemplars) — `srcCore` is the shared base;\n * `srcBrowser` / `srcServer` extend it and externalize `@src/core` to\n * the sibling build. Playwright ships UNCONDITIONALLY (middleware\n * carries it with no browser surface — grounded, not conditional).\n * 3. A single non-`core` surface (`browser`-only / `server`-only) — the\n * surface factory itself IS the base (no `srcCore` to extend, so no\n * dead `@src/core` externalize/remap either — there is no sibling\n * core build), per the live sqlite (server-only) / indexeddb\n * (browser-only) exemplars. Playwright ships only when the sole\n * surface is `browser` (it must run its own tests in a real browser).\n *\n * @param surfaces - The declared `Surface[]`.\n * @returns The root `vite.config.ts` file content, newline-terminated.\n *\n * @example\n * ```ts\n * rootViteConfig(['core']).includes('srcCore') // true\n * ```\n */\nexport function rootViteConfig(surfaces: readonly Surface[]): string {\n\t// Rendered blocks below are generated FILE TEXT, so every embedded\n\t// declaration keyword is interpolated rather than typed literally at\n\t// column 0 — the doc↔source parity scan (AGENTS §22) reads this file's\n\t// own source lines, and a flush-left `export const foo` inside a\n\t// template string is indistinguishable from a real module-scope export\n\t// to that line-based scan; interpolating the keyword keeps the emitted\n\t// bytes identical while keeping this file's own declaration surface\n\t// exactly the one export it documents.\n\tconst EXPORT_KEYWORD = 'export'\n\tconst hasCore = surfaces.includes('core')\n\tconst nonCore = surfaces.filter((surface) => surface !== 'core')\n\tconst needsPlaywright = surfaces.length > 1 || surfaces.includes('browser')\n\tconst header = viteHeader(needsPlaywright)\n\n\tif (!hasCore) {\n\t\tconst [onlySurface] = nonCore\n\t\tif (onlySurface === 'browser' || onlySurface === 'server') {\n\t\t\treturn singleSurfaceViteConfig(onlySurface)\n\t\t}\n\t}\n\n\t// Shape 1 (no `nonCore` entries) / Shape 2 (1-2 `nonCore` entries) —\n\t// `srcCore` is always the shared base; `srcBrowser` / `srcServer` extend\n\t// it and externalize `@src/core` to the sibling build.\n\tconst browserBlock = `\n${EXPORT_KEYWORD} const srcBrowser = (config?: UserConfig): UserConfig =>\n\tsrcCore(\n\t\tmergeConfig(\n\t\t\t{\n\t\t\t\tbuild: {\n\t\t\t\t\tlib: {\n\t\t\t\t\t\tentry: resolveWorkspacePath('src/browser/index.ts'),\n\t\t\t\t\t\tformats: ['es'],\n\t\t\t\t\t\tfileName: () => 'index.js',\n\t\t\t\t\t},\n\t\t\t\t\toutDir: 'dist/src/browser',\n\t\t\t\t\trolldownOptions: {\n\t\t\t\t\t\texternal: (id: string) => id === '@src/core' || id.startsWith('@orkestrel/'),\n\t\t\t\t\t\toutput: { paths: { '@src/core': '../core/index.js' } },\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\ttest: {\n\t\t\t\t\tname: { label: 'src:browser', color: 'yellow' },\n\t\t\t\t\tinclude: ['tests/src/browser/**/*.test.ts'],\n\t\t\t\t\texclude: ['tests/src/core/**/*.test.ts'],\n\t\t\t\t\tsetupFiles: ['./tests/setup.ts', './tests/setupBrowser.ts'],\n\t\t\t\t\tbrowser: {\n\t\t\t\t\t\tenabled: true,\n\t\t\t\t\t\tprovider: createBrowserProvider(),\n\t\t\t\t\t\tinstances: [{ browser: 'chromium', headless: true }],\n\t\t\t\t\t},\n\t\t\t\t\tfileParallelism: false,\n\t\t\t\t},\n\t\t\t},\n\t\t\tconfig ?? {},\n\t\t),\n\t)\n`\n\tconst serverBlock = `\n${EXPORT_KEYWORD} const srcServer = (config?: UserConfig): UserConfig =>\n\tsrcCore(\n\t\tmergeConfig(\n\t\t\t{\n\t\t\t\tbuild: {\n\t\t\t\t\tlib: {\n\t\t\t\t\t\tentry: resolveWorkspacePath('src/server/index.ts'),\n\t\t\t\t\t\tformats: ['es', 'cjs'],\n\t\t\t\t\t\tfileName: (format: string) => (format === 'es' ? 'index.js' : 'index.cjs'),\n\t\t\t\t\t},\n\t\t\t\t\toutDir: 'dist/src/server',\n\t\t\t\t\ttarget: 'node24',\n\t\t\t\t\trolldownOptions: {\n\t\t\t\t\t\texternal: (id: string) =>\n\t\t\t\t\t\t\tid === '@src/core' || id.startsWith('node:') || id.startsWith('@orkestrel/'),\n\t\t\t\t\t\toutput: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tformat: 'es',\n\t\t\t\t\t\t\t\tentryFileNames: 'index.js',\n\t\t\t\t\t\t\t\tpaths: { '@src/core': '../core/index.js' },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tformat: 'cjs',\n\t\t\t\t\t\t\t\tentryFileNames: 'index.cjs',\n\t\t\t\t\t\t\t\tpaths: { '@src/core': '../core/index.cjs' },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\ttest: {\n\t\t\t\t\tname: { label: 'src:server', color: 'red' },\n\t\t\t\t\tinclude: ['tests/src/server/**/*.test.ts'],\n\t\t\t\t\texclude: ['tests/src/core/**/*.test.ts'],\n\t\t\t\t\tsetupFiles: ['./tests/setup.ts', './tests/setupServer.ts'],\n\t\t\t\t},\n\t\t\t},\n\t\t\tconfig ?? {},\n\t\t),\n\t)\n`\n\tconst blocks = nonCore\n\t\t.map((surface) => (surface === 'browser' ? browserBlock : serverBlock))\n\t\t.join('')\n\tconst projectNames = [\n\t\t...(hasCore ? ['srcCore'] : []),\n\t\t...nonCore.map((surface) => `src${pascalCase(surface)}`),\n\t\t'guides',\n\t]\n\treturn `${header}\n${EXPORT_KEYWORD} const srcCore = (config?: UserConfig): UserConfig =>\n\tmergeConfig(\n\t\t{\n\t\t\tresolve,\n\t\t\tbuild: {\n\t\t\t\temptyOutDir: true,\n\t\t\t\tsourcemap: true,\n\t\t\t\tminify: false,\n\t\t\t},\n\t\t\ttest: {\n\t\t\t\tname: { label: 'src:core', color: 'magenta' },\n\t\t\t\tinclude: ['tests/src/core/**/*.test.ts'],\n\t\t\t\tsetupFiles: ['./tests/setup.ts'],\n\t\t\t\tenvironment: 'node',\n\t\t\t\tbrowser: { enabled: false },\n\t\t\t},\n\t\t},\n\t\tconfig ?? {},\n\t)\n\n${EXPORT_KEYWORD} const guides = (config?: UserConfig): UserConfig =>\n\tsrcCore(\n\t\tmergeConfig(\n\t\t\t{\n\t\t\t\ttest: {\n\t\t\t\t\tname: { label: 'guides', color: 'green' },\n\t\t\t\t\tinclude: ['tests/guides/**/*.test.ts'],\n\t\t\t\t\texclude: ['tests/src/**/*.test.ts', 'tests/setup.test.ts'],\n\t\t\t\t},\n\t\t\t},\n\t\t\tconfig ?? {},\n\t\t),\n\t)\n${blocks}\nexport default defineConfig({\n\tresolve,\n\ttest: {\n\t\tprojects: [${projectNames.join(', ')}],\n\t},\n})\n`\n}\n\n/**\n * `configs/src/tsconfig.core.json` — unchanged core shape.\n *\n * @returns The core surface `tsconfig` file content, newline-terminated.\n *\n * @example\n * ```ts\n * coreTsconfig().includes('\"rootDir\": \"../../src/core\"') // true\n * ```\n */\nexport function coreTsconfig(): string {\n\tconst config = {\n\t\textends: '../../tsconfig.json',\n\t\tcompilerOptions: {\n\t\t\tlib: ['ESNext'],\n\t\t\tnoEmit: false,\n\t\t\tdeclaration: true,\n\t\t\temitDeclarationOnly: true,\n\t\t\trootDir: '../../src/core',\n\t\t\toutDir: '../../dist/src/core',\n\t\t},\n\t\tinclude: ['../../src/core/**/*.ts'],\n\t}\n\treturn `${JSON.stringify(config, undefined, '\\t')}\\n`\n}\n\n/**\n * `configs/src/vite.core.config.ts` — inlines its own `build.lib` /\n * `rollupOptions` (core's `srcCore` root export carries no build.lib).\n *\n * @returns The core surface `vite.config.ts` file content, newline-terminated.\n *\n * @example\n * ```ts\n * coreViteConfig().includes('srcCore(') // true\n * ```\n */\nexport function coreViteConfig(): string {\n\treturn `import { defineConfig } from 'vite'\nimport dts from 'vite-plugin-dts'\nimport { srcCore, resolveWorkspacePath } from '../../vite.config'\n\nexport default defineConfig(\n\tsrcCore({\n\t\tplugins: [\n\t\t\tdts({\n\t\t\t\ttsconfigPath: resolveWorkspacePath('configs/src/tsconfig.core.json'),\n\t\t\t\tbundleTypes: true,\n\t\t\t}),\n\t\t],\n\t\tbuild: {\n\t\t\tlib: {\n\t\t\t\tentry: resolveWorkspacePath('src/core/index.ts'),\n\t\t\t\tformats: ['es', 'cjs'],\n\t\t\t\tfileName: (format) => (format === 'es' ? 'index.js' : 'index.cjs'),\n\t\t\t},\n\t\t\toutDir: 'dist/src/core',\n\t\t\trollupOptions: {\n\t\t\t\texternal: [/^node:/, /^@orkestrel\\\\//],\n\t\t\t},\n\t\t},\n\t}),\n)\n`\n}\n\n/**\n * `configs/src/tsconfig.<browser|server>.json` — `rootDir`/`outDir` point at\n * the whole `src`/`dist/src` tree (not a per-surface subfolder), per the live\n * middleware/router exemplars.\n *\n * @param surface - The non-`core` surface to derive the `tsconfig` for.\n * @returns The surface `tsconfig` file content, newline-terminated.\n *\n * @example\n * ```ts\n * surfaceTsconfig('server').includes('\"rootDir\": \"../../src\"') // true\n * ```\n */\nexport function surfaceTsconfig(surface: 'browser' | 'server'): string {\n\tconst config = {\n\t\textends: '../../tsconfig.json',\n\t\tcompilerOptions: {\n\t\t\tlib: surface === 'browser' ? ['ESNext', 'DOM', 'DOM.Iterable'] : ['ESNext'],\n\t\t\ttypes: surface === 'browser' ? ['vite/client'] : ['node'],\n\t\t\tnoEmit: false,\n\t\t\tdeclaration: true,\n\t\t\temitDeclarationOnly: true,\n\t\t\trootDir: '../../src',\n\t\t\toutDir: '../../dist/src',\n\t\t},\n\t\tinclude: [`../../src/${surface}/**/*.ts`],\n\t}\n\treturn `${JSON.stringify(config, undefined, '\\t')}\\n`\n}\n\n/**\n * `configs/src/vite.<browser|server>.config.ts` — a thin `dts`-only wrapper;\n * `build.lib` / externals live in the root `srcBrowser` / `srcServer` export\n * instead (per the live exemplars).\n *\n * @param surface - The non-`core` surface to derive the `vite.config.ts` for.\n * @returns The surface `vite.config.ts` file content, newline-terminated.\n *\n * @example\n * ```ts\n * surfaceViteConfig('browser').includes('srcBrowser') // true\n * ```\n */\nexport function surfaceViteConfig(surface: 'browser' | 'server'): string {\n\tconst anchor = surface === 'browser' ? 'srcBrowser' : 'srcServer'\n\treturn `import { defineConfig } from 'vite'\nimport dts from 'vite-plugin-dts'\nimport { ${anchor}, resolveWorkspacePath } from '../../vite.config'\n\n// Types are bundled inline by vite-plugin-dts (see configs/src/vite.core.config.ts\n// for the same pattern).\nexport default defineConfig(\n\t${anchor}({\n\t\tplugins: [\n\t\t\tdts({\n\t\t\t\ttsconfigPath: resolveWorkspacePath('configs/src/tsconfig.${surface}.json'),\n\t\t\t\tbundleTypes: true,\n\t\t\t}),\n\t\t],\n\t}),\n)\n`\n}\n\n/**\n * Draft the `configs` group's `computed` artifacts — the root\n * `tsconfig.json` / `vite.config.ts` plus each declared surface's\n * `configs/src/*` pair, grounded against the live middleware (core+server)\n * and router (core+browser+server) exemplars.\n *\n * @param spec - The `Blueprint` to derive config artifacts from.\n * @returns The `configs` group's `Artifact[]`.\n *\n * @example\n * ```ts\n * configArtifacts(blueprint('router')).length // 4\n * ```\n */\nexport function configArtifacts(spec: Blueprint): readonly Artifact[] {\n\tconst artifacts: Artifact[] = [\n\t\t{\n\t\t\tpath: 'tsconfig.json',\n\t\t\tgroup: 'configs',\n\t\t\torigin: 'computed',\n\t\t\tcontent: rootTsconfig(spec.surfaces),\n\t\t},\n\t\t{\n\t\t\tpath: 'vite.config.ts',\n\t\t\tgroup: 'configs',\n\t\t\torigin: 'computed',\n\t\t\tcontent: rootViteConfig(spec.surfaces),\n\t\t},\n\t]\n\tfor (const surface of spec.surfaces) {\n\t\tconst row = SURFACE_MATRIX[surface]\n\t\tfor (const path of row.configs) {\n\t\t\tconst isTsconfig = path.endsWith('.json')\n\t\t\tconst content =\n\t\t\t\tsurface === 'core'\n\t\t\t\t\t? isTsconfig\n\t\t\t\t\t\t? coreTsconfig()\n\t\t\t\t\t\t: coreViteConfig()\n\t\t\t\t\t: isTsconfig\n\t\t\t\t\t\t? surfaceTsconfig(surface)\n\t\t\t\t\t\t: surfaceViteConfig(surface)\n\t\t\tartifacts.push({ path, group: 'configs', origin: 'computed', surface, content })\n\t\t}\n\t}\n\treturn artifacts\n}\n\n/**\n * Draft the `source` group's `template` artifacts — the generated-minimal\n * `src/<surface>/*` stubs, one full {types, <Pascal>, factories, index} set\n * PER declared surface (never assuming `core`), filled from `TEMPLATES` with\n * `missing: 'error'`. `blueprintToMembers` already declares a full entity +\n * factory per surface (AGENTS §5's per-surface centralized-file pattern), so\n * every surface gets the same uniform stub shape.\n *\n * @param spec - The `Blueprint` to derive source stubs from.\n * @param pascal - The package's PascalCase entity name.\n * @returns The `source` group's `Artifact[]`.\n *\n * @example\n * ```ts\n * sourceArtifacts(blueprint('router'), 'Router').length // 4\n * ```\n */\nexport function sourceArtifacts(spec: Blueprint, pascal: string): readonly Artifact[] {\n\tconst values = { pascal }\n\tconst artifacts: Artifact[] = []\n\tfor (const surface of spec.surfaces) {\n\t\tartifacts.push(\n\t\t\tfillArtifact(`src/${surface}/types.ts`, 'source', 'types', values, surface),\n\t\t\tfillArtifact(`src/${surface}/${pascal}.ts`, 'source', 'entity', values, surface),\n\t\t\tfillArtifact(`src/${surface}/factories.ts`, 'source', 'factories', values, surface),\n\t\t\tfillArtifact(`src/${surface}/index.ts`, 'source', 'index', values, surface),\n\t\t)\n\t}\n\treturn artifacts\n}\n\n/**\n * Build the computed `SELF_SPECIFIERS` / `SPECIFIER_MODULES` / `exportsFor`\n * block the `parityTest` template's `{{specifiers}}` placeholder fills —\n * ONE shape for every surface count (grounded against the live single-surface\n * websocket/indexeddb and multi-surface router/middleware exemplars, which\n * both resolve a fence's specifier through a `SPECIFIER_MODULES` map rather\n * than a single-module lookup). The bare `@orkestrel/<name>` specifier\n * resolves to the PRIMARY surface — `core` when declared, else the sole\n * declared surface.\n *\n * @param spec - The `Blueprint` to derive the parity specifiers block from.\n * @returns The computed `parityTest` `{{specifiers}}` block content.\n *\n * @example\n * ```ts\n * paritySpecifiers(blueprint('router')).includes('SELF_SPECIFIERS') // true\n * ```\n */\nexport function paritySpecifiers(spec: Blueprint): string {\n\t// Keyword tokens keep the emitted declarations out of column 0 of THIS\n\t// file's raw text, which the guides-parity scanner reads.\n\tconst CONST_KEYWORD = 'const'\n\tconst FUNCTION_KEYWORD = 'function'\n\tconst primary: Surface = spec.surfaces.includes('core') ? 'core' : (spec.surfaces[0] ?? 'core')\n\tconst packageSpecifier = `@orkestrel/${spec.name}`\n\tconst selfSpecifiers = [packageSpecifier, ...spec.surfaces.map((surface) => `@src/${surface}`)]\n\tconst modules: Record<string, string> = { [packageSpecifier]: `src/${primary}` }\n\tfor (const surface of spec.surfaces) modules[`@src/${surface}`] = `src/${surface}`\n\tconst specifierList = selfSpecifiers.map((specifier) => `'${specifier}'`).join(', ')\n\tconst moduleLines = Object.entries(modules)\n\t\t.map(([specifier, module]) => `\\t'${specifier}': '${module}',`)\n\t\t.join('\\n')\n\treturn `const SELF_SPECIFIERS = [${specifierList}]\n\n${CONST_KEYWORD} SPECIFIER_MODULES: Readonly<Record<string, string>> = {\n${moduleLines}\n}\n${CONST_KEYWORD} specifierSources = new Map<string, ReturnType<typeof createSource>>()\n${FUNCTION_KEYWORD} exportsFor(specifier: string): readonly string[] {\n\tconst module = SPECIFIER_MODULES[specifier]\n\tif (module === undefined) return []\n\tlet source = specifierSources.get(module)\n\tif (source === undefined) {\n\t\tsource = createSource({ files, module })\n\t\tspecifierSources.set(module, source)\n\t}\n\treturn source.exports().map((symbol) => symbol.name)\n}`\n}\n\n/**\n * Draft the `tests` group's `template` artifacts — the shared recorder\n * setup, one environment-specific setup file per non-`core` surface\n * (`setupServer.ts` / `setupBrowser.ts`, grounded against the live\n * exemplars' setup-file naming), the generated-minimal entity / factory test\n * stubs PER declared surface, and the surface-aware guides-parity drop-in.\n *\n * @param spec - The `Blueprint` to derive test stubs from.\n * @param pascal - The package's PascalCase entity name.\n * @returns The `tests` group's `Artifact[]`.\n *\n * @example\n * ```ts\n * testArtifacts(blueprint('router'), 'Router').length // 3\n * ```\n */\nexport function testArtifacts(spec: Blueprint, pascal: string): readonly Artifact[] {\n\tconst artifacts: Artifact[] = [fillArtifact('tests/setup.ts', 'tests', 'setup', {})]\n\tif (spec.surfaces.includes('server')) {\n\t\tartifacts.push(fillArtifact('tests/setupServer.ts', 'tests', 'setupServer', {}, 'server'))\n\t}\n\tif (spec.surfaces.includes('browser')) {\n\t\tartifacts.push(fillArtifact('tests/setupBrowser.ts', 'tests', 'setupBrowser', {}, 'browser'))\n\t}\n\tfor (const surface of spec.surfaces) {\n\t\tconst values = { pascal, surface }\n\t\tartifacts.push(\n\t\t\tfillArtifact(\n\t\t\t\t`tests/src/${surface}/${pascal}.test.ts`,\n\t\t\t\t'tests',\n\t\t\t\t'entityTest',\n\t\t\t\tvalues,\n\t\t\t\tsurface,\n\t\t\t),\n\t\t\tfillArtifact(\n\t\t\t\t`tests/src/${surface}/factories.test.ts`,\n\t\t\t\t'tests',\n\t\t\t\t'factoriesTest',\n\t\t\t\tvalues,\n\t\t\t\tsurface,\n\t\t\t),\n\t\t)\n\t}\n\tartifacts.push(\n\t\tfillArtifact('tests/guides/src/parity.test.ts', 'tests', 'parityTest', {\n\t\t\tname: spec.name,\n\t\t\tspecifiers: paritySpecifiers(spec),\n\t\t}),\n\t)\n\treturn artifacts\n}\n\n/**\n * Build an `alignTable` markdown table over a member category's rows, deduped\n * by name — `blueprintToMembers` declares one full member set PER surface, so\n * a multi-surface blueprint carries byte-identical name/summary rows once per\n * surface; the one guide (AGENTS §22) lists each declared member once,\n * grouped across its surfaces.\n *\n * @param category - The `Member['category']` to filter rows by.\n * @param members - The blueprint's derived `Member[]` (previously closed over by the caller).\n * @returns The aligned markdown table for the category's deduped members.\n *\n * @example\n * ```ts\n * guideMemberTable('entity', blueprintToMembers(blueprint('router'))).includes('Router') // true\n * ```\n */\nexport function guideMemberTable(category: Member['category'], members: readonly Member[]): string {\n\tconst seen = new Set<string>()\n\tconst rows: string[][] = []\n\tfor (const item of members) {\n\t\tif (item.category !== category) continue\n\t\tif (seen.has(item.name)) continue\n\t\tseen.add(item.name)\n\t\trows.push([`\\`${item.name}\\``, item.summary])\n\t}\n\treturn alignTable(['API', 'Summary'], rows)\n}\n\n/**\n * Draft the `guides` group's artifacts — the package's own filled guide stub,\n * the guides index, and any vendored dependency guide mirrors.\n *\n * @param spec - The `Blueprint` to derive guide artifacts from.\n * @param pascal - The package's PascalCase entity name.\n * @param members - The blueprint's derived `Member[]`.\n * @returns The `guides` group's `Artifact[]`.\n *\n * @example\n * ```ts\n * guideArtifacts(blueprint('router'), 'Router', blueprintToMembers(blueprint('router'))).length // 2\n * ```\n */\nexport function guideArtifacts(\n\tspec: Blueprint,\n\tpascal: string,\n\tmembers: readonly Member[],\n): readonly Artifact[] {\n\t// The seven runtime `@orkestrel/*` guide mirrors this repo itself vendors\n\t// byte-identically (this guide's Contract invariant 7) —\n\t// the only dependency names a scaffolded package's `guides/src/<dep>.md`\n\t// mirror can be a `host`-origin byte copy for.\n\tconst vendoredGuides: readonly string[] = [\n\t\t'@orkestrel/contract',\n\t\t'@orkestrel/emitter',\n\t\t'@orkestrel/markdown',\n\t\t'@orkestrel/template',\n\t\t'@orkestrel/terminal',\n\t\t'@orkestrel/console',\n\t\t'@orkestrel/guide',\n\t]\n\n\tconst primary: Surface = spec.surfaces.includes('core') ? 'core' : (spec.surfaces[0] ?? 'core')\n\tconst source = spec.surfaces\n\t\t.map((surface) => `[\\`src/${surface}\\`](../../src/${surface})`)\n\t\t.join(', ')\n\tconst barrel =\n\t\tspec.surfaces.length === 1\n\t\t\t? `Surfaced through the \\`@src/${primary}\\` barrel.`\n\t\t\t: `Surfaced through the \\`@orkestrel/${spec.name}\\` barrel (aliased ${spec.surfaces.map((surface) => `\\`@src/${surface}\\``).join(' / ')} inside this repo).`\n\tconst tests = spec.surfaces\n\t\t.map(\n\t\t\t(surface) =>\n\t\t\t\t`- [\\`tests/src/${surface}/${pascal}.test.ts\\`](../../tests/src/${surface}/${pascal}.test.ts) —\\n id assignment (explicit / generated) and independence across instances.\\n- [\\`tests/src/${surface}/factories.test.ts\\`](../../tests/src/${surface}/factories.test.ts) —\\n \\`create${pascal}\\` returns a working \\`${pascal}Interface\\` backed by a real \\`${pascal}\\`.`,\n\t\t)\n\t\t.join('\\n')\n\n\tconst artifacts: Artifact[] = [\n\t\tfillArtifact(`guides/src/${spec.name}.md`, 'guides', 'guide', {\n\t\t\tname: spec.name,\n\t\t\tpascal,\n\t\t\tprimary,\n\t\t\tsource,\n\t\t\tbarrel,\n\t\t\ttests,\n\t\t\tfactories: guideMemberTable('factory', members),\n\t\t\tentities: guideMemberTable('entity', members),\n\t\t\ttypes: guideMemberTable('type', members),\n\t\t}),\n\t\tfillArtifact('guides/README.md', 'guides', 'guidesReadme', {\n\t\t\tconcept: alignTable(\n\t\t\t\t['Concept', 'Spec', 'Source', 'Tests'],\n\t\t\t\t[\n\t\t\t\t\t[\n\t\t\t\t\t\tpascal,\n\t\t\t\t\t\t`[\\`${spec.name}.md\\`](src/${spec.name}.md)`,\n\t\t\t\t\t\tspec.surfaces.map((surface) => `[\\`src/${surface}\\`](../src/${surface})`).join(', '),\n\t\t\t\t\t\tspec.surfaces\n\t\t\t\t\t\t\t.map((surface) => `[\\`tests/src/${surface}\\`](../tests/src/${surface})`)\n\t\t\t\t\t\t\t.join(', '),\n\t\t\t\t\t],\n\t\t\t\t],\n\t\t\t),\n\t\t\tdirectory: alignTable(\n\t\t\t\t['Directory', 'Guide'],\n\t\t\t\tspec.surfaces.map((surface) => [\n\t\t\t\t\t`src/${surface}`,\n\t\t\t\t\t`[\\`${spec.name}.md\\`](src/${spec.name}.md)`,\n\t\t\t\t]),\n\t\t\t),\n\t\t}),\n\t]\n\tfor (const dep of spec.dependencies) {\n\t\tif (!vendoredGuides.includes(dep.name)) continue\n\t\tconst short = dep.name.replace('@orkestrel/', '')\n\t\tartifacts.push({\n\t\t\tpath: `guides/src/${short}.md`,\n\t\t\tgroup: 'guides',\n\t\t\torigin: 'host',\n\t\t\tsource: `guides/src/${short}.md`,\n\t\t})\n\t}\n\treturn artifacts\n}\n\n/**\n * Apply a blueprint's `overrides` over a drafted artifact list — an override\n * REPLACES the matching artifact's `content` in place; an override matching\n * no planned artifact, or targeting a `host`-origin path, is left unapplied\n * here (the gate stage surfaces it as a blocking question — this leaf only\n * performs the replacement half of the rule).\n *\n * @param artifacts - The drafted `Artifact[]`.\n * @param overrides - The blueprint's `overrides`.\n * @returns The artifact list with matching overrides applied.\n *\n * @example\n * ```ts\n * applyOverrides(artifacts, [override('README.md', '# custom')])[0].content // '# custom'\n * ```\n */\nexport function applyOverrides(\n\tartifacts: readonly Artifact[],\n\toverrides: Blueprint['overrides'],\n): readonly Artifact[] {\n\tif (overrides.length === 0) return artifacts\n\tconst byPath = new Map(overrides.map((override) => [override.path, override.content]))\n\treturn artifacts.map((artifact) => {\n\t\tif (artifact.origin === 'host') return artifact\n\t\tconst content = byPath.get(artifact.path)\n\t\treturn content === undefined ? artifact : { ...artifact, content }\n\t})\n}\n\n/**\n * The full pure compilation: draft a blueprint's artifacts — the manifest and\n * exports combination rules over the per-surface `SURFACE_MATRIX` rows, plus\n * `HOST_PATHS` and `overrides` — then pin.\n *\n * @param blueprint - The `Blueprint` to compile.\n * @param groups - An optional `Group[]` selection (default: all groups).\n * @returns The drafted, pinned `Plan`.\n *\n * @example\n * ```ts\n * const plan = blueprintToPlan(blueprint('router', { surfaces: ['core'] }))\n * plan.artifacts.length // every file the package needs\n * ```\n */\nexport function blueprintToPlan(blueprint: Blueprint, groups?: readonly Group[]): Plan {\n\tconst selected = groups && groups.length > 0 ? groups : GROUPS\n\tconst pascal = pascalCase(blueprint.name)\n\tconst members = blueprintToMembers(blueprint)\n\tconst artifacts: Artifact[] = []\n\n\tif (selected.includes('manifest')) {\n\t\tartifacts.push({\n\t\t\tpath: 'package.json',\n\t\t\tgroup: 'manifest',\n\t\t\torigin: 'computed',\n\t\t\tcontent: packageManifest(blueprint),\n\t\t})\n\t}\n\tif (selected.includes('configs')) artifacts.push(...configArtifacts(blueprint))\n\tif (selected.includes('source')) artifacts.push(...sourceArtifacts(blueprint, pascal))\n\tif (selected.includes('tests')) artifacts.push(...testArtifacts(blueprint, pascal))\n\tif (selected.includes('guides')) artifacts.push(...guideArtifacts(blueprint, pascal, members))\n\tif (selected.includes('docs')) {\n\t\tartifacts.push(fillArtifact('README.md', 'docs', 'readme', { name: blueprint.name, pascal }))\n\t}\n\n\tfor (const path of HOST_PATHS) {\n\t\tconst group = hostGroup(path)\n\t\tif (!selected.includes(group)) continue\n\t\tartifacts.push({ path, group, origin: 'host', source: path })\n\t}\n\n\tconst draft: Plan = {\n\t\tblueprint,\n\t\tgroups: [...selected],\n\t\tartifacts: applyOverrides(artifacts, blueprint.overrides),\n\t}\n\treturn pinPlan(draft)\n}\n","import type {\n\tArtifact,\n\tAudit,\n\tBlueprint,\n\tCompileFailure,\n\tCompileRecord,\n\tCompilerEventMap,\n\tCompilerInterface,\n\tCompilerOptions,\n\tGroup,\n\tPlan,\n\tQuestion,\n\tScaffolding,\n} from './types.js'\nimport type { EmitterInterface } from '@orkestrel/emitter'\nimport { Emitter } from '@orkestrel/emitter'\nimport { blueprintToPlan } from './compilers.js'\nimport { diffPlan, pinPlan, validateBlueprint } from './helpers.js'\nimport { ScaffoldError } from './errors.js'\n\n/**\n * The compilation orchestrator — runs the fixed three-stage `[draft, gate,\n * pin]` pipeline over a `Blueprint` and the pure `audit` projection, owning a\n * typed `emitter` (AGENTS §13).\n *\n * @remarks\n * `compile` and `audit` are genuinely synchronous and pure; the gate fails\n * CLOSED — a blueprint failing `validateBlueprint`, or carrying an override\n * that matches no planned artifact or targets a `host`-origin path, yields a\n * visible incomplete `Scaffolding` (`plan` absent, `questions` populated)\n * rather than throwing. A dependency outside the vendored guide set surfaces\n * a non-blocking `Question` and a `host`-origin pointer artifact instead of a\n * fabricated mirror. `compile` emits `compile` only for a complete\n * compilation and `block` for a gated one; `audit` emits `block` (when gated)\n * then `audit`, never `compile`. After `destroy()` every method but the\n * getter and `destroy` itself throws `ScaffoldError('DESTROYED', …)`.\n *\n * @example\n * ```ts\n * import { blueprint, Compiler } from '@src/core'\n *\n * const compiler = new Compiler()\n * const scaffolding = compiler.compile(blueprint('router', { surfaces: ['core'] }))\n * scaffolding.complete // true\n * compiler.destroy()\n * ```\n */\nexport class Compiler implements CompilerInterface {\n\t// The six runtime `@orkestrel/*` dependencies (plus `guide`) this package\n\t// vendors a byte-identical `guides/src/<dep>.md` mirror for (Contract\n\t// invariant 7). Any other dependency yields no fabricated mirror — a\n\t// `host`-origin pointer artifact plus a non-blocking `Question` instead.\n\tstatic readonly #vendored: readonly string[] = Object.freeze([\n\t\t'@orkestrel/contract',\n\t\t'@orkestrel/emitter',\n\t\t'@orkestrel/markdown',\n\t\t'@orkestrel/template',\n\t\t'@orkestrel/terminal',\n\t\t'@orkestrel/console',\n\t\t'@orkestrel/guide',\n\t])\n\n\treadonly #emitter: Emitter<CompilerEventMap>\n\t#destroyed = false\n\n\tconstructor(options?: CompilerOptions) {\n\t\tthis.#emitter = new Emitter<CompilerEventMap>({ on: options?.on, error: options?.error })\n\t}\n\n\tget emitter(): EmitterInterface<CompilerEventMap> {\n\t\treturn this.#emitter\n\t}\n\n\t/**\n\t * Run the three-stage pipeline over a `Blueprint`, returning a complete or\n\t * visible-incomplete `Scaffolding`.\n\t *\n\t * @param blueprint - The `Blueprint` to compile.\n\t * @param groups - Optional `Group` selection scoping the plan to those\n\t * artifact groups; absent means the full plan.\n\t * @returns The `Scaffolding` outcome of this compile.\n\t *\n\t * @example\n\t * ```ts\n\t * const scaffolding = compiler.compile(blueprint('timeout', { surfaces: ['core'] }))\n\t * scaffolding.stages.map((record) => record.stage) // ['draft', 'gate', 'pin']\n\t * ```\n\t */\n\tcompile(blueprint: Blueprint, groups?: readonly Group[]): Scaffolding {\n\t\tthis.#assertAlive()\n\t\tconst scaffolding = this.#run(blueprint, groups)\n\t\tif (scaffolding.complete) this.#emitter.emit('compile', scaffolding)\n\t\telse this.#emitter.emit('block', scaffolding.questions)\n\t\treturn scaffolding\n\t}\n\n\t/**\n\t * Compile the blueprint, then diff the resulting plan against the\n\t * caller-supplied current target content.\n\t *\n\t * @param blueprint - The `Blueprint` to compile and audit.\n\t * @param current - The target's current content, keyed by artifact path.\n\t * @param groups - Optional `Group` selection scoping the audit to those\n\t * artifact groups; absent means the full plan.\n\t * @returns The `Audit` outcome — a gated blueprint returns `complete: false`\n\t * with the gate's blocking `questions` and zero findings.\n\t *\n\t * @example\n\t * ```ts\n\t * const audit = compiler.audit(blueprint('timeout', { surfaces: ['core'] }), {})\n\t * audit.missing // every artifact — nothing exists at the target yet\n\t * ```\n\t */\n\taudit(\n\t\tblueprint: Blueprint,\n\t\tcurrent: Readonly<Record<string, string>>,\n\t\tgroups?: readonly Group[],\n\t): Audit {\n\t\tthis.#assertAlive()\n\t\tconst scaffolding = this.#run(blueprint, groups)\n\t\tif (!scaffolding.complete || scaffolding.plan === undefined) {\n\t\t\tthis.#emitter.emit('block', scaffolding.questions)\n\t\t\tconst result: Audit = {\n\t\t\t\tfindings: [],\n\t\t\t\tclean: false,\n\t\t\t\tcomplete: false,\n\t\t\t\tquestions: scaffolding.questions,\n\t\t\t\tdrifted: 0,\n\t\t\t\tmissing: 0,\n\t\t\t\tforeign: 0,\n\t\t\t}\n\t\t\tthis.#emitter.emit('audit', result)\n\t\t\treturn result\n\t\t}\n\t\tconst result = diffPlan(scaffolding.plan, current)\n\t\tthis.#emitter.emit('audit', result)\n\t\treturn result\n\t}\n\n\t/** Idempotent teardown — emits `destroy`, then destroys the emitter LAST. */\n\tdestroy(): void {\n\t\tif (this.#destroyed) return\n\t\tthis.#destroyed = true\n\t\tthis.#emitter.emit('destroy')\n\t\tthis.#emitter.destroy()\n\t}\n\n\t// The shared pipeline behind `compile` / `audit` — computes the `Scaffolding`\n\t// WITHOUT choreographing the `compile` / `block` / `audit` events, since the\n\t// two public methods each own a different emission sequence.\n\t#run(blueprint: Blueprint, groups?: readonly Group[]): Scaffolding {\n\t\tconst stages: CompileRecord[] = []\n\t\tconst failures: CompileFailure[] = []\n\n\t\tlet draft: Plan | undefined\n\t\ttry {\n\t\t\tdraft = blueprintToPlan(blueprint, groups)\n\t\t\tstages.push({ stage: 'draft', input: blueprint, output: draft, failed: false })\n\t\t} catch (error) {\n\t\t\tconst message = error instanceof Error ? error.message : String(error)\n\t\t\tstages.push({\n\t\t\t\tstage: 'draft',\n\t\t\t\tinput: blueprint,\n\t\t\t\toutput: undefined,\n\t\t\t\tfailed: true,\n\t\t\t\terror: message,\n\t\t\t})\n\t\t\tfailures.push({ stage: 'draft', code: 'INVALID', message })\n\t\t\tthis.#emitter.emit('error', error)\n\t\t\tstages.push({\n\t\t\t\tstage: 'gate',\n\t\t\t\tinput: undefined,\n\t\t\t\toutput: undefined,\n\t\t\t\tfailed: true,\n\t\t\t\terror: 'Skipped: draft failed',\n\t\t\t})\n\t\t\tstages.push({\n\t\t\t\tstage: 'pin',\n\t\t\t\tinput: undefined,\n\t\t\t\toutput: undefined,\n\t\t\t\tfailed: true,\n\t\t\t\terror: 'Skipped: draft failed',\n\t\t\t})\n\t\t\treturn {\n\t\t\t\tblueprint,\n\t\t\t\tquestions: [],\n\t\t\t\tstages,\n\t\t\t\tfailures,\n\t\t\t\tcomplete: false,\n\t\t\t\tdigest: '',\n\t\t\t}\n\t\t}\n\n\t\tconst validation = validateBlueprint(blueprint)\n\t\tconst overrideQuestions = this.#overrideQuestions(blueprint, draft.artifacts)\n\t\tconst dependencyQuestions = this.#dependencyQuestions(blueprint)\n\t\tconst blocking = [...validation.questions, ...overrideQuestions]\n\t\tconst questions: Question[] = [...blocking, ...dependencyQuestions]\n\t\tstages.push({\n\t\t\tstage: 'gate',\n\t\t\tinput: draft,\n\t\t\toutput: { blocking: blocking.length, questions },\n\t\t\tfailed: blocking.length > 0,\n\t\t})\n\n\t\tif (blocking.length > 0) {\n\t\t\tconst message = `${blocking.length} blocking question${blocking.length === 1 ? '' : 's'}`\n\t\t\tfailures.push({ stage: 'gate', code: 'BLOCKED', message })\n\t\t\tstages.push({\n\t\t\t\tstage: 'pin',\n\t\t\t\tinput: undefined,\n\t\t\t\toutput: undefined,\n\t\t\t\tfailed: true,\n\t\t\t\terror: 'Skipped: gate blocked',\n\t\t\t})\n\t\t\treturn { blueprint, questions, stages, failures, complete: false, digest: '' }\n\t\t}\n\n\t\ttry {\n\t\t\tconst pointers = this.#pointerArtifacts(blueprint)\n\t\t\tconst plan = pinPlan({ ...draft, artifacts: [...draft.artifacts, ...pointers] })\n\t\t\tstages.push({ stage: 'pin', input: draft, output: plan, failed: false })\n\t\t\treturn {\n\t\t\t\tblueprint,\n\t\t\t\tplan,\n\t\t\t\tquestions,\n\t\t\t\tstages,\n\t\t\t\tfailures,\n\t\t\t\tcomplete: true,\n\t\t\t\tdigest: plan.hash ?? '',\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconst message = error instanceof Error ? error.message : String(error)\n\t\t\tstages.push({ stage: 'pin', input: draft, output: undefined, failed: true, error: message })\n\t\t\tfailures.push({ stage: 'pin', code: 'INVALID', message })\n\t\t\tthis.#emitter.emit('error', error)\n\t\t\treturn { blueprint, questions, stages, failures, complete: false, digest: '' }\n\t\t}\n\t}\n\n\t// Blocking questions for overrides matching no planned artifact, or\n\t// targeting a host-origin path — the fail-closed override rule.\n\t#overrideQuestions(blueprint: Blueprint, artifacts: readonly Artifact[]): readonly Question[] {\n\t\tconst byPath = new Map(artifacts.map((artifact) => [artifact.path, artifact]))\n\t\tconst questions: Question[] = []\n\t\tfor (const item of blueprint.overrides) {\n\t\t\tconst artifact = byPath.get(item.path)\n\t\t\tif (artifact === undefined) {\n\t\t\t\tquestions.push({\n\t\t\t\t\tfield: 'overrides',\n\t\t\t\t\ttext: `Override path \"${item.path}\" matches no planned artifact`,\n\t\t\t\t\tblocking: true,\n\t\t\t\t})\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (artifact.origin === 'host') {\n\t\t\t\tquestions.push({\n\t\t\t\t\tfield: 'overrides',\n\t\t\t\t\ttext: `Override path \"${item.path}\" targets a host-origin artifact`,\n\t\t\t\t\tblocking: true,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t\treturn questions\n\t}\n\n\t// Non-blocking questions for a dependency outside the vendored guide set.\n\t#dependencyQuestions(blueprint: Blueprint): readonly Question[] {\n\t\tconst questions: Question[] = []\n\t\tfor (const item of blueprint.dependencies) {\n\t\t\tif (Compiler.#vendored.includes(item.name)) continue\n\t\t\tquestions.push({\n\t\t\t\tfield: 'dependencies',\n\t\t\t\ttext: `Dependency \"${item.name}\" is not vendored — sync its guides/src mirror from that repo at HEAD`,\n\t\t\t\tblocking: false,\n\t\t\t})\n\t\t}\n\t\treturn questions\n\t}\n\n\t// A host-origin pointer artifact per non-vendored dependency (Contract invariant 7).\n\t#pointerArtifacts(blueprint: Blueprint): readonly Artifact[] {\n\t\tconst artifacts: Artifact[] = []\n\t\tfor (const item of blueprint.dependencies) {\n\t\t\tif (Compiler.#vendored.includes(item.name)) continue\n\t\t\tconst short = item.name.replace('@orkestrel/', '')\n\t\t\tconst path = `guides/src/${short}.md`\n\t\t\tartifacts.push({ path, group: 'guides', origin: 'host', source: path })\n\t\t}\n\t\treturn artifacts\n\t}\n\n\t#assertAlive(): void {\n\t\tif (this.#destroyed) throw new ScaffoldError('DESTROYED', 'Compiler has been destroyed')\n\t}\n}\n","import type {\n\tPlan,\n\tPlanManagerEventMap,\n\tPlanManagerInterface,\n\tPlanManagerOptions,\n\tPlanRecord,\n} from './types.js'\nimport type { EmitterInterface } from '@orkestrel/emitter'\nimport { Emitter } from '@orkestrel/emitter'\nimport { pinPlan } from './helpers.js'\nimport { ScaffoldError } from './errors.js'\n\n/**\n * The self-owning, versioned/hashed plan registry (AGENTS §9).\n *\n * @remarks\n * `add` re-pins the plan and mints the record's `id` from its own content\n * `hash` — deterministic, no randomness. Re-adding a plan whose content is\n * unchanged resolves to the SAME id and returns the existing record\n * untouched (`version` stays put); a plan whose content differs mints a\n * fresh id at `version: 1`. The array overload of `remove` is declared FIRST\n * (AGENTS §9.2) so an id list resolves to the batch form; the batch form is\n * ALL-OR-NOTHING. After `destroy()` every method but the getters and\n * `destroy` itself throws `ScaffoldError('DESTROYED', …)`.\n *\n * @example\n * ```ts\n * import { blueprint, blueprintToPlan, PlanManager } from '@src/core'\n *\n * const plans = new PlanManager()\n * const record = plans.add(blueprintToPlan(blueprint('budget', { surfaces: ['core'] })))\n * record.id === record.hash // true — id minted from content\n * plans.destroy()\n * ```\n */\nexport class PlanManager implements PlanManagerInterface {\n\treadonly #plans = new Map<string, PlanRecord>()\n\treadonly #emitter: Emitter<PlanManagerEventMap>\n\t#destroyed = false\n\n\tconstructor(options?: PlanManagerOptions) {\n\t\tthis.#emitter = new Emitter<PlanManagerEventMap>({ on: options?.on, error: options?.error })\n\t\tfor (const plan of options?.plans ?? []) {\n\t\t\tconst record = this.#pin(plan)\n\t\t\tthis.#plans.set(record.id, record)\n\t\t}\n\t}\n\n\tget emitter(): EmitterInterface<PlanManagerEventMap> {\n\t\treturn this.#emitter\n\t}\n\n\tget size(): number {\n\t\treturn this.#plans.size\n\t}\n\n\t/**\n\t * Whether a plan with the given id is registered.\n\t *\n\t * @param id - The plan record id.\n\t * @returns `true` when `id` is registered.\n\t */\n\thas(id: string): boolean {\n\t\tthis.#assertAlive()\n\t\treturn this.#plans.has(id)\n\t}\n\n\t/**\n\t * Look up one registered plan record by id (AGENTS §9.1 singular accessor).\n\t *\n\t * @param id - The plan record id.\n\t * @returns The `PlanRecord`, or `undefined` when unregistered.\n\t */\n\tplan(id: string): PlanRecord | undefined {\n\t\tthis.#assertAlive()\n\t\treturn this.#plans.get(id)\n\t}\n\n\t/**\n\t * List every registered plan record (AGENTS §9.1 plural accessor).\n\t *\n\t * @returns A snapshot array of every registered `PlanRecord`.\n\t */\n\tplans(): readonly PlanRecord[] {\n\t\tthis.#assertAlive()\n\t\treturn [...this.#plans.values()]\n\t}\n\n\t/**\n\t * Register (or re-register) one plan, mints the record's id from its\n\t * content hash.\n\t *\n\t * @param plan - The `Plan` to register.\n\t * @returns The registered `PlanRecord`.\n\t *\n\t * @example\n\t * ```ts\n\t * const record = plans.add(blueprintToPlan(blueprint('budget', { surfaces: ['core'] })))\n\t * record.version // 1\n\t * ```\n\t */\n\tadd(plan: Plan): PlanRecord {\n\t\tthis.#assertAlive()\n\t\tconst record = this.#pin(plan)\n\t\tconst existing = this.#plans.get(record.id)\n\t\tconst final = existing ?? record\n\t\tthis.#plans.set(final.id, final)\n\t\tthis.#emitter.emit('add', final.id)\n\t\treturn final\n\t}\n\n\t/**\n\t * Remove one, several, or every registered plan (AGENTS §9.2 batch\n\t * overloads) — array overload declared first so a list resolves to the\n\t * batch form.\n\t *\n\t * @remarks\n\t * `remove()` removes every registered plan, emitting `remove` once per id.\n\t * `remove(id)` removes one plan, emitting `remove` and returning `true`\n\t * when it existed, `false` otherwise. `remove(ids)` is ALL-OR-NOTHING: if\n\t * any listed id is unregistered, the collection is left untouched and\n\t * `false` is returned.\n\t *\n\t * @param target - Omit to remove all, a single id, or a list of ids.\n\t * @returns `boolean` for the single-id / list-of-ids forms; `void` for the remove-all form.\n\t */\n\tremove(ids: readonly string[]): boolean\n\tremove(id: string): boolean\n\tremove(): void\n\tremove(target?: string | readonly string[]): boolean | void {\n\t\tthis.#assertAlive()\n\t\tif (target === undefined) {\n\t\t\tfor (const id of this.#plans.keys()) this.#emitter.emit('remove', id)\n\t\t\tthis.#plans.clear()\n\t\t\treturn\n\t\t}\n\t\tif (typeof target === 'string') {\n\t\t\tif (!this.#plans.has(target)) return false\n\t\t\tthis.#plans.delete(target)\n\t\t\tthis.#emitter.emit('remove', target)\n\t\t\treturn true\n\t\t}\n\t\tfor (const id of target) if (!this.#plans.has(id)) return false\n\t\tfor (const id of target) {\n\t\t\tthis.#plans.delete(id)\n\t\t\tthis.#emitter.emit('remove', id)\n\t\t}\n\t\treturn true\n\t}\n\n\t/** Idempotent teardown — clears the collection, emits `destroy`, then destroys the emitter LAST. */\n\tdestroy(): void {\n\t\tif (this.#destroyed) return\n\t\tthis.#destroyed = true\n\t\tthis.#plans.clear()\n\t\tthis.#emitter.emit('destroy')\n\t\tthis.#emitter.destroy()\n\t}\n\n\t// Re-pin a plan and mint its record — the content hash IS the id, so an\n\t// unchanged plan always resolves to the same record.\n\t#pin(plan: Plan): PlanRecord {\n\t\tconst pinned = pinPlan(plan)\n\t\tconst hash = pinned.hash ?? ''\n\t\treturn { id: hash, plan: pinned, version: 1, hash }\n\t}\n\n\t#assertAlive(): void {\n\t\tif (this.#destroyed) throw new ScaffoldError('DESTROYED', 'PlanManager has been destroyed')\n\t}\n}\n","import type {\n\tBlueprint,\n\tCompilerInterface,\n\tCompilerOptions,\n\tPlanManagerInterface,\n\tPlanManagerOptions,\n} from './types.js'\nimport { Compiler } from './Compiler.js'\nimport { PlanManager } from './PlanManager.js'\nimport { blueprint } from './helpers.js'\nimport { isBlueprint } from './validators.js'\nimport { validateBlueprint } from './helpers.js'\nimport { ScaffoldError } from './errors.js'\n\n/**\n * Create a `CompilerInterface` — the compilation orchestrator.\n *\n * @param options - `CompilerOptions` — `on` initial event listeners, `error` the listener-error handler.\n * @returns A fresh `Compiler`.\n *\n * @example\n * ```ts\n * import { createCompiler } from '@src/core'\n *\n * const compiler = createCompiler()\n * compiler.destroy()\n * ```\n */\nexport function createCompiler(options?: CompilerOptions): CompilerInterface {\n\treturn new Compiler(options)\n}\n\n/**\n * Create a working `PlanManagerInterface`.\n *\n * @param options - `PlanManagerOptions` — `plans` to seed the registry, `on` / `error` for the emitter.\n * @returns A fresh `PlanManager`.\n *\n * @example\n * ```ts\n * import { createPlanManager } from '@src/core'\n *\n * const plans = createPlanManager()\n * plans.size // 0\n * plans.destroy()\n * ```\n */\nexport function createPlanManager(options?: PlanManagerOptions): PlanManagerInterface {\n\treturn new PlanManager(options)\n}\n\n/**\n * Validate and return a `Blueprint` from plain data.\n *\n * @param data - A `name` plus a partial of the remaining `Blueprint` fields.\n * @remarks\n * Fills the builder defaults, then checks BOTH the exact-record shape\n * (`isBlueprint`) and the semantic pass (`validateBlueprint`) — so an\n * off-`NAME_PATTERN` name throws here too.\n * @returns The validated `Blueprint`.\n * @throws {@link ScaffoldError} coded `INVALID` when the structure or the\n * semantic pass fails.\n *\n * @example\n * ```ts\n * import { createBlueprint } from '@src/core'\n *\n * createBlueprint({ name: 'Router', surfaces: [] }) // throws ScaffoldError('INVALID', …)\n * ```\n */\nexport function createBlueprint(data: Partial<Blueprint> & { readonly name: string }): Blueprint {\n\tconst candidate = blueprint(data.name, data)\n\tif (!isBlueprint(candidate)) {\n\t\tthrow new ScaffoldError('INVALID', 'Blueprint failed the exact-record contract', {\n\t\t\tname: data.name,\n\t\t})\n\t}\n\tconst validation = validateBlueprint(candidate)\n\tif (!validation.valid) {\n\t\tthrow new ScaffoldError('INVALID', 'Blueprint failed validation', {\n\t\t\tquestions: validation.questions,\n\t\t})\n\t}\n\treturn candidate\n}\n"],"mappings":";;;;;;;AACA,IAAa,WAAW,OAAO,OAAO;CAAC;CAAQ;CAAW;AAAQ,CAAU;;AAG5E,IAAa,UAAU,OAAO,OAAO;CAAC;CAAQ;CAAY;AAAU,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