@orkestrel/scaffold 0.0.39 → 0.0.40
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["#emitter","#assertAlive","#accept","#scaffold","#select","#destroyed","#draft","#gate","#error"],"sources":["../../../src/core/constants.ts","../../../src/core/templates.ts","../../../src/core/errors.ts","../../../src/core/validators.ts","../../../src/core/cloners.ts","../../../src/core/parsers.ts","../../../src/core/helpers.ts","../../../src/core/compilers.ts","../../../src/core/Compiler.ts","../../../src/core/factories.ts"],"sourcesContent":["import type { AppDefinition, BuildFormat, Environment, Group, SrcDefinition } from './types.js'\n\n/**\n * The three `Environment` values, frozen.\n *\n * @remarks\n * A blueprint's `src` and `app` axes are caller-supplied, so the gate measures\n * each selection against this list and reports it as the accepted candidates\n * when it rejects one. It is also the key order the per-environment matrices\n * are read in.\n */\nexport const ENVIRONMENTS: readonly Environment[] = Object.freeze(['core', 'browser', 'server'])\n\n/**\n * The seven `Group` values in plan order, frozen.\n *\n * @remarks\n * A compile that names no groups covers every one of them, so this list is the\n * default selection as well as the accepted candidates for a rejected one. The\n * order is the order a plan lists its artifacts in.\n */\nexport const GROUPS: readonly Group[] = Object.freeze([\n\t'manifest',\n\t'configs',\n\t'source',\n\t'tests',\n\t'guides',\n\t'docs',\n\t'orchestration',\n])\n\n/**\n * The build and export settings each published `src` environment contributes, frozen.\n *\n * @remarks\n * Per environment: the thin configuration files it adds under `configs/src`,\n * its Vitest project label, its `exports` subpath, and the module formats it\n * builds. Core alone occupies the package root, so it is the only environment\n * whose subpath is `.`; browser ships ES only because no CommonJS consumer\n * reaches it.\n */\nexport const SRC_MATRIX: Readonly<Record<Environment, SrcDefinition>> = Object.freeze({\n\tcore: Object.freeze({\n\t\tconfigs: Object.freeze(['configs/src/vite.core.config.ts', 'configs/src/tsconfig.core.json']),\n\t\tproject: 'src:core',\n\t\tpath: '.',\n\t\tformats: Object.freeze<BuildFormat[]>(['es', 'cjs']),\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]),\n\t\tproject: 'src:browser',\n\t\tpath: './browser',\n\t\tformats: Object.freeze<BuildFormat[]>(['es']),\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]),\n\t\tproject: 'src:server',\n\t\tpath: './server',\n\t\tformats: Object.freeze<BuildFormat[]>(['es', 'cjs']),\n\t}),\n})\n\n/**\n * The configuration and runtime-entry settings each private `app` environment contributes, frozen.\n *\n * @remarks\n * An application environment declares no exports, so it carries a runtime\n * entry instead of a subpath and formats. Core carries none because it is\n * shared logic the other two import rather than a host that runs.\n */\nexport const APP_MATRIX: Readonly<Record<Environment, AppDefinition>> = Object.freeze({\n\tcore: Object.freeze({\n\t\tconfigs: Object.freeze(['configs/app/tsconfig.core.json']),\n\t\tproject: 'app:core',\n\t}),\n\tbrowser: Object.freeze({\n\t\tconfigs: Object.freeze([\n\t\t\t'configs/app/vite.browser.config.ts',\n\t\t\t'configs/app/tsconfig.browser.json',\n\t\t]),\n\t\tproject: 'app:browser',\n\t\tentry: 'app/browser/index.html',\n\t}),\n\tserver: Object.freeze({\n\t\tconfigs: Object.freeze([\n\t\t\t'configs/app/vite.server.config.ts',\n\t\t\t'configs/app/tsconfig.server.json',\n\t\t]),\n\t\tproject: 'app:server',\n\t\tentry: 'app/server/main.ts',\n\t}),\n})\n\n/** The configuration files a workspace that ships its own executable adds, frozen. */\nexport const BIN_CONFIGS: readonly string[] = Object.freeze([\n\t'configs/src/vite.bin.config.ts',\n\t'configs/src/tsconfig.bin.json',\n])\n\n/** The executable entry whose presence makes a workspace `bin`. */\nexport const BIN_ENTRY_PATH = 'src/bin/main.ts'\n\n/**\n * The paths byte-copied from the vendored data root, frozen.\n *\n * @remarks\n * These are the files the fleet shares verbatim: the root instruction\n * documents, the licence, the canonical orchestration contract every harness\n * bridge points at, the four harness directories, the session hook scripts,\n * the shared policy register, the byte-identical root dotfiles, and the two\n * guide mirrors a generated workspace starts from. A directory entry vendors\n * everything beneath it.\n *\n * A plan carries the subset its target selects, which is why the list is a\n * candidate set rather than a plan: a workspace never mirrors its own guide.\n */\nexport const HOST_PATHS: readonly string[] = Object.freeze([\n\t'AGENTS.md',\n\t'CLAUDE.md',\n\t'LICENSE',\n\t'.agents/orchestration.md',\n\t'.agents/skills',\n\t'.claude/agents',\n\t'.claude/rules',\n\t'.claude/skills',\n\t'.claude/settings.json',\n\t'.codex/agents',\n\t'.codex/config.toml',\n\t'.cursor/mcp.json',\n\t'.cursor/rules',\n\t'.mcp.json',\n\t'scripts/deps.sh',\n\t'scripts/cursor.sh',\n\t'scripts/codex.sh',\n\t'scripts/ollama.sh',\n\t'tests/setupPolicy.ts',\n\t'tests/policy.test.ts',\n\t'tests/config.test.ts',\n\t'configs/helpers.ts',\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'guides/guide.md',\n\t'guides/scaffold.md',\n])\n\n/**\n * The vendored paths whose present bytes belong to each workspace, frozen.\n *\n * @remarks\n * These paths are copied into a workspace when absent and are never compared\n * or replaced while present. A workspace therefore stops receiving later\n * canonical updates to them. `.gitignore` takes that trade because its correct\n * rules differ by workspace, so scaffold cannot own its bytes.\n */\nexport const WORKSPACE_OWNED_PATHS: readonly string[] = Object.freeze(['.gitignore'])\n\n/**\n * The vendored paths a target receives with its executable bit set, frozen.\n *\n * @remarks\n * Declared rather than read from the staging host's filesystem, because that\n * reading is not portable: Windows carries no executable bit, so a host staged\n * there reports every file non-executable and every target receives hooks it\n * cannot run. Declaring the set here makes one checkout stage one manifest on\n * every host.\n *\n * Every entry is also a {@link HOST_PATHS} member or sits beneath one. A file\n * that must run when a target invokes it belongs here the moment it is vendored.\n */\nexport const EXECUTABLE_PATHS: readonly string[] = Object.freeze([\n\t'scripts/codex.sh',\n\t'scripts/cursor.sh',\n\t'scripts/deps.sh',\n\t'scripts/ollama.sh',\n])\n\n/**\n * The path prefixes whose contents instruct or wire an agent, frozen.\n *\n * @remarks\n * A path is grouped by what it governs rather than by where it sits: anything\n * beneath one of these prefixes is `orchestration`, and everything else that is\n * not source, tests, guides, docs, or a manifest is `configs`. A vendored path\n * and a foreign path found in a target are classified against the same list, so\n * a new harness directory is admitted once.\n */\nexport const ORCHESTRATION_PATH_PREFIXES: readonly string[] = Object.freeze([\n\t'.agents/',\n\t'.claude/',\n\t'.codex/',\n\t'.cursor/',\n\t'.github/',\n\t'scripts/',\n])\n\n/**\n * The exact root filenames that wire an agent bench rather than the toolchain, frozen.\n *\n * @remarks\n * `.mcp.json` registers MCP servers for the harness. It sits among the root\n * dotfiles but governs agents, so it groups with the harness bridges.\n */\nexport const ORCHESTRATION_PATH_NAMES: readonly string[] = Object.freeze(['.mcp.json'])\n\n/**\n * The agent file whose marker-bounded package table the catalog verb alone owns.\n *\n * @remarks\n * It is vendored like every other host artifact but claimed by presence rather\n * than content, so a consumer's own edits to the file survive every verb and\n * only the catalog verb rewrites the region inside the markers.\n */\nexport const CATALOG_AGENT_PATH = '.claude/agents/orkestrel.md'\n\n/** The provisioner skeleton a workspace with declared service vendors is given once. */\nexport const SERVICE_SCRIPT_PATH = 'scripts/service.sh'\n\n/** The shared Vitest global-setup module whose presence makes a workspace `global`. */\nexport const GLOBAL_SETUP_PATH = 'tests/setupGlobal.ts'\n\n/** The guide-parity proof whose presence selects the planned `guides` project. */\nexport const GUIDES_TEST_PATH = 'tests/guides.test.ts'\n\n/** The packed-package proof whose presence makes a workspace `distribution`. */\nexport const DISTRIBUTION_TEST_PATH = 'tests/distribution.test.ts'\n\n/** The cross-environment composition proof whose presence makes a workspace `integration`. */\nexport const INTEGRATION_TEST_PATH = 'tests/integration.test.ts'\n\n/** The official-tooling drift proof whose presence makes a workspace `conformance`. */\nexport const CONFORMANCE_TEST_PATH = 'tests/conformance.test.ts'\n\n/** The live-service readiness module whose presence makes a workspace `service`. */\nexport const SERVICE_SETUP_PATH = 'tests/setupService.ts'\n\n/** The include the live-service project covers, which is a directory rather than one proof. */\nexport const SERVICE_TEST_INCLUDE = 'tests/service/**/*.test.ts'\n\n/** The Vite wrapper whose presence makes a workspace `showcase`. */\nexport const SHOWCASE_CONFIG_PATH = 'configs/app/vite.showcase.config.ts'\n\n/** The bare workspace name syntax: lowercase alphanumeric with hyphens, letter first. */\nexport const NAME_PATTERN = /^[a-z][a-z0-9-]*$/\n\n/**\n * The runtime dependency name syntax: the `@orkestrel` scope and a bare name.\n *\n * @remarks\n * A dependency name reaches a path, because a workspace's guide mirror is\n * derived from it. Fixing the scope and forbidding everything but the bare name\n * after it is what stops a hand-built name from escaping the directory the\n * mirror belongs in.\n */\nexport const DEPENDENCY_NAME_PATTERN = /^@orkestrel\\/[a-z][a-z0-9-]*$/\n\n/**\n * The development extra name syntax: any valid npm package name.\n *\n * @remarks\n * Wider than a runtime dependency name on purpose. An extra is manifest content\n * and never reaches a path, so it may carry any scope or no scope at all. The\n * single optional `/` is still fixed to the one scope boundary, and neither `..`\n * nor a backslash is admitted, so the shape cannot express a traversal even\n * though it accepts far more names.\n */\nexport const EXTRA_NAME_PATTERN = /^(?:@[a-z0-9][a-z0-9._-]*\\/)?[a-z0-9][a-z0-9._-]*$/\n\n/** The exact three-component version syntax a blueprint declares. */\nexport const VERSION_PATTERN = /^(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)$/\n\n/**\n * The exact caret-pinned pre-1.0 range accepted for an `@orkestrel/*` runtime dependency.\n *\n * @remarks\n * Pre-1.0 means any `0.x`, not `0.0.x`. The narrower form would refuse the first\n * fleet package to reach `0.1.0`, and `catalog` pins to whatever the registry\n * publishes, so a single minor release would block every later run against a\n * workspace that had already been pinned to it.\n */\nexport const ORKESTREL_RANGE_PATTERN = /^\\^0\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)$/\n\n/** The registry-only semver subset accepted for a development extra's range. */\nexport const EXTRA_RANGE_PATTERN =\n\t/^(?:\\^|~)?(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)(?:-(?:0|[1-9]\\d*|\\d*[A-Za-z-][0-9A-Za-z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[A-Za-z-][0-9A-Za-z-]*))*)?$/\n\n/** The minimum-Node engine syntax a blueprint declares. */\nexport const ENGINES_PATTERN = /^>=(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)$/\n\n/** Exact lowercase hexadecimal bytes: two digits per byte, and empty content is valid. */\nexport const HEX_PATTERN = /^(?:[0-9a-f]{2})*$/\n\n/** Unicode controls, formatting controls, and line and paragraph separators rejected in text. */\nexport const CONTROL_CHARACTER_PATTERN = /[\\p{Cc}\\p{Cf}\\p{Zl}\\p{Zp}]/u\n\n/** Visible characters a target-relative path and a Markdown path cell both forbid. */\nexport const INVALID_PATH_CHARACTER_PATTERN = /[<>:\"|?*\\\\]/\n\n/**\n * Maximum bare workspace name length.\n *\n * @remarks\n * The registry caps a whole package name at 214 characters and the generated\n * scope `@orkestrel/` spends 11 of them.\n */\nexport const MAX_NAME_LENGTH = 203\n\n/** Maximum dependency package name length, scope included, as the registry caps it. */\nexport const MAX_DEPENDENCY_NAME_LENGTH = 214\n\n/** Maximum length of one declared package range. */\nexport const MAX_RANGE_LENGTH = 2_048\n\n/** Maximum length of one path, matching the longest a supported filesystem accepts. */\nexport const MAX_PATH_LENGTH = 32_767\n\n/** Maximum items accepted in one public collection. */\nexport const MAX_COLLECTION_ITEMS = 1_000\n\n/** Columns one emitted line may occupy, matching `printWidth` in `.oxfmtrc.json`. */\nexport const PRINT_WIDTH = 100\n\n/** Columns one tab occupies when the formatter measures a line, matching `tabWidth`. */\nexport const TAB_WIDTH = 2\n\n/** Maximum findings one audit can produce from a bounded plan and snapshot. */\nexport const MAX_AUDIT_FINDINGS = MAX_COLLECTION_ITEMS * 2\n\n/** Maximum bytes accepted for one artifact. */\nexport const MAX_ARTIFACT_BYTES = 5_242_880\n\n/** Maximum length of the hexadecimal string carrying one artifact's bytes. */\nexport const MAX_ARTIFACT_HEX_LENGTH = MAX_ARTIFACT_BYTES * 2\n\n/** Maximum bytes accepted for one package or vendored-host manifest. */\nexport const MAX_MANIFEST_BYTES = 1_048_576\n\n/** Maximum bytes retained across one whole plan or audit. */\nexport const MAX_TOTAL_ARTIFACT_BYTES = 104_857_600\n\n/** The oldest Node version the generated toolchain supports. */\nexport const MINIMUM_NODE_VERSION = '22.12.0'\n\n/** The version a workspace starts at. */\nexport const DEFAULT_VERSION = '0.0.1'\n\n/** The `engines.node` range a workspace starts with. */\nexport const DEFAULT_ENGINES = `>=${MINIMUM_NODE_VERSION}`\n\n/** The tooling versions scaffold and every generated workspace share. */\nexport const BASE_DEV_DEPENDENCIES: Readonly<Record<string, string>> = Object.freeze({\n\t'@orkestrel/guide': '^0.0.12',\n\t'@orkestrel/scaffold': '^0.0.39',\n\t'@orkestrel/test': '^0.0.6',\n\t'@types/node': '^26.2.0',\n\toxfmt: '^0.62.0',\n\toxlint: '^1.77.0',\n\ttypescript: '^6.0.3',\n\tvite: '~8.2.0',\n\tvitest: '^4.1.10',\n})\n\n/** The development dependencies that emit declarations for published source or an executable. */\nexport const DECLARATION_DEV_DEPENDENCIES: Readonly<Record<string, string>> = Object.freeze({\n\t'@microsoft/api-extractor': '^7.58.12',\n\t'vite-plugin-dts': '^5.0.3',\n})\n\n/** The development dependencies a published browser `src` environment adds. */\nexport const SOURCE_BROWSER_DEV_DEPENDENCIES: Readonly<Record<string, string>> = Object.freeze({\n\t'@vitest/browser-playwright': '^4.1.10',\n\tplaywright: '^1.62.1',\n})\n\n/** The development dependency every private `app` environment adds. */\nexport const APP_DEV_DEPENDENCIES: Readonly<Record<string, string>> = Object.freeze({\n\t'@orkestrel/contract': '^0.0.12',\n})\n\n/** The development dependencies a private Vue browser application adds. */\nexport const APP_BROWSER_DEV_DEPENDENCIES: Readonly<Record<string, string>> = Object.freeze({\n\t...SOURCE_BROWSER_DEV_DEPENDENCIES,\n\t'@orkestrel/html': '^0.0.4',\n\t'@vitejs/plugin-vue': '^6.0.8',\n\tvue: '^3.5.40',\n\t'vue-tsc': '^3.3.7',\n})\n\n/**\n * The development dependency used only by the optional single-file showcase build.\n *\n * @example\n * ```ts\n * import { SHOWCASE_DEV_DEPENDENCIES } from '@orkestrel/scaffold'\n *\n * SHOWCASE_DEV_DEPENDENCIES['vite-plugin-singlefile'] // '^2.3.3'\n * ```\n */\nexport const SHOWCASE_DEV_DEPENDENCIES: Readonly<Record<string, string>> = Object.freeze({\n\t'vite-plugin-singlefile': '^2.3.3',\n})\n\n/** The development dependencies a private server application adds. */\nexport const APP_SERVER_DEV_DEPENDENCIES: Readonly<Record<string, string>> = Object.freeze({\n\t'@orkestrel/emitter': '^0.0.7',\n\t'@orkestrel/middleware': '^0.0.13',\n\t'@orkestrel/router': '^0.0.10',\n\t'@orkestrel/server': '^0.0.13',\n})\n","import {\n\tBIN_ENTRY_PATH,\n\tCONFORMANCE_TEST_PATH,\n\tDISTRIBUTION_TEST_PATH,\n\tGUIDES_TEST_PATH,\n\tINTEGRATION_TEST_PATH,\n\tSERVICE_TEST_INCLUDE,\n} from './constants.js'\n\n/**\n * Formatter-stable template text for every configuration artifact.\n *\n * @remarks\n * Builders in `compilers.ts` fill these definitions through\n * `@orkestrel/template`. Fixed `lib` and `types` rows stay in the artifact\n * template that owns their scope. Only selection-dependent spans are filled.\n * App configs are check-only, so they include their mirrored tests and exact\n * setup modules. Source configs stay source-only because they emit declarations\n * under `rootDir`; widening them would emit declarations for tests.\n *\n * @example\n * ```ts\n * import { CONFIG_TEMPLATES } from '@orkestrel/scaffold'\n *\n * CONFIG_TEMPLATES.root.tsconfig.startsWith('{') // true\n * ```\n */\nexport const CONFIG_TEMPLATES = Object.freeze({\n\troot: Object.freeze({\n\t\ttsconfig: `{\n\t\"compilerOptions\": {\n\t\t\"target\": \"ESNext\",\n\t\t\"module\": \"ESNext\",\n\t\t\"moduleResolution\": \"bundler\",\n\t\t\"allowImportingTsExtensions\": true,\n\t\t\"lib\": [\"ESNext\", \"DOM\", \"DOM.Iterable\"],\n\t\t\"types\": [\"node\", \"vite/client\", \"vitest/globals\"],\n\t\t\"moduleDetection\": \"force\",\n\t\t\"resolveJsonModule\": true,\n\t\t\"strict\": true,\n\t\t\"verbatimModuleSyntax\": true,\n\t\t\"noUncheckedIndexedAccess\": true,\n\t\t\"noUncheckedSideEffectImports\": true,\n\t\t\"exactOptionalPropertyTypes\": true,\n\t\t\"noUnusedLocals\": true,\n\t\t\"noUnusedParameters\": true,\n\t\t\"noImplicitOverride\": true,\n\t\t\"noFallthroughCasesInSwitch\": true,\n\t\t\"forceConsistentCasingInFileNames\": true,\n\t\t\"skipLibCheck\": true,\n\t\t\"noEmit\": true,\n\t\t\"paths\": {\n{{paths}}\n\t\t}\n\t},\n\t\"exclude\": [\"node_modules\", \"dist\", \"tmp\"]\n}\n`,\n\t\tvite: `import type { {{viteTypes}} } from 'vite'\n{{imports}}import { defineConfig, mergeConfig } from 'vitest/config'\nimport tsconfig from './tsconfig.json' with { type: 'json' }\n{{helpers}}{{browsers}}import { fileURLToPath, URL } from 'node:url'\n\n{{options}}export function resolveWorkspacePath(relativePath: string): string {\n\treturn fileURLToPath(new URL(relativePath, import.meta.url))\n}\n\nconst resolve = {\n\talias: Object.entries(tsconfig.compilerOptions.paths).reduce((aliases, [key, values]) => {\n\t\tconst [path] = values\n\t\tif (path === undefined) throw new Error('tsconfig path alias ' + key + ' has no target')\n\t\treturn Object.assign(aliases, { [key]: resolveWorkspacePath(path) })\n\t}, {}),\n}\n\n{{factories}}export default defineConfig({\n\tresolve,\n\ttest: {\n{{projects}}\n\t},\n})\n`,\n\t}),\n\tfactories: Object.freeze({\n\t\tsrc: Object.freeze({\n\t\t\tcore: `export const srcCore = (options?: UserConfig): UserConfig =>\n\tmergeConfig(\n\t\t{\n\t\t\tresolve,\n\t\t\tpublicDir: false,\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\toptions ?? {},\n\t)\n`,\n\t\t\tbrowser: `export const srcBrowser = (options?: UserConfig): UserConfig =>\n\tmergeConfig(\n\t\t{\n\t\t\tresolve,\n\t\t\tpublicDir: false,\n\t\t\tplugins: [outputBoundary('dist/src/browser'), environmentBoundary('src/browser')],\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\t{{external}}\n{{output}}\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{{exclude}}\t\t\t\tsetupFiles: ['./tests/setup.ts', './tests/setupBrowser.ts'],\n{{global}}\n\t\t\t\tbrowser: {\n\t\t\t\t\tenabled: true,\n\t\t\t\t\tprovider: playwright(browserOptions),\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\toptions ?? {},\n\t)\n`,\n\t\t\tserver: `export const srcServer = (options?: UserConfig): UserConfig =>\n\tmergeConfig(\n\t\t{\n\t\t\tresolve,\n\t\t\tpublicDir: false,\n\t\t\tplugins: [outputBoundary('dist/src/server'), environmentBoundary('src/server')],\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: 'node22',\n\t\t\t\trolldownOptions: {\n\t\t\t\t\tplatform: 'node',\n\t\t\t\t\t{{external}}\n{{output}}\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{{exclude}}\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\toptions ?? {},\n\t)\n`,\n\t\t\tbin: `export const srcBin = (options?: UserConfig): UserConfig =>\n\tmergeConfig(\n\t\t{\n\t\t\tresolve,\n\t\t\tpublicDir: false,\n\t\t\tplugins: [outputBoundary('dist/bin')],\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('${BIN_ENTRY_PATH}'),\n\t\t\t\t\tformats: ['es'],\n\t\t\t\t\tfileName: () => 'main.js',\n\t\t\t\t},\n\t\t\t\toutDir: 'dist/bin',\n\t\t\t\ttarget: 'node22',\n\t\t\t\trolldownOptions: { external: [/^node:/, /^@orkestrel\\\\//, /^@src\\\\//] },\n\t\t\t},\n\t\t\ttest: {\n\t\t\t\tname: { label: 'src:bin', color: 'yellow' },\n\t\t\t\tinclude: ['tests/src/bin/**/*.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\t// A bin test drives the real executable over a real temporary repository, so it\n\t\t\t\t// spends seconds in process startup and filesystem work rather than milliseconds.\n\t\t\t\t// Vitest's five-second default clears one alone and times out under a full suite.\n\t\t\t\ttestTimeout: 15_000,\n\t\t\t},\n\t\t},\n\t\toptions ?? {},\n\t)\n`,\n\t\t}),\n\t\tapp: Object.freeze({\n\t\t\tcore: `export const appCore = (options?: UserConfig): UserConfig =>\n\tmergeConfig(\n\t\t{\n\t\t\tresolve,\n\t\t\tpublicDir: false,\n\t\t\tplugins: [environmentBoundary('app/core')],\n\t\t\ttest: {\n\t\t\t\tname: { label: 'app:core', color: 'cyan' },\n\t\t\t\tinclude: ['tests/app/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\toptions ?? {},\n\t)\n`,\n\t\t\tbrowser: `function applicationBrowser(showcase: boolean): UserConfig {\n\tconst output = showcase ? 'dist/showcase' : 'dist/app/browser'\n{{showcasePlugins}}\treturn {\n\t\tresolve,\n{{plugins}}\t\troot: resolveWorkspacePath('app/browser'),\n\t\tpublicDir: false,\n\t\tbuild: {\n{{showcaseBuild}}\t\t\temptyOutDir: true,\n\t\t\toutDir: resolveWorkspacePath(output),\n\t\t\trolldownOptions: { input: resolveWorkspacePath('app/browser/index.html') },\n\t\t},\n\t\ttest: {\n\t\t\tname: { label: 'app:browser', color: 'blue' },\n\t\t\troot: resolveWorkspacePath('.'),\n\t\t\tdir: resolveWorkspacePath('.'),\n\t\t\tinclude: ['tests/app/browser/**/*.test.ts'],\n\t\t\tsetupFiles: ['./tests/setup.ts', './tests/setupBrowser.ts'],\n\t\t\tbrowser: {\n\t\t\t\tenabled: true,\n\t\t\t\tprovider: playwright(browserOptions),\n\t\t\t\tinstances: [{ browser: 'chromium', headless: true }],\n\t\t\t},\n\t\t\tfileParallelism: false,\n\t\t},\n\t}\n}\n\nexport function appBrowser(): UserConfig {\n\treturn applicationBrowser(false)\n}\n{{showcaseFactory}}`,\n\t\t\tserver: `export const appServer = (options?: UserConfig): UserConfig =>\n\tmergeConfig(\n\t\t{\n\t\t\tresolve,\n\t\t\tpublicDir: false,\n\t\t\tplugins: [outputBoundary('dist/app/server'), environmentBoundary('app/server')],\n\t\t\tbuild: {\n\t\t\t\temptyOutDir: true,\n\t\t\t\tlib: {\n\t\t\t\t\tentry: resolveWorkspacePath('app/server/main.ts'),\n\t\t\t\t\tformats: ['cjs'],\n\t\t\t\t\tfileName: () => 'main.cjs',\n\t\t\t\t},\n\t\t\t\toutDir: resolveWorkspacePath('dist/app/server'),\n\t\t\t\ttarget: 'node22',\n\t\t\t\trolldownOptions: { external: (id: string) => id.startsWith('node:') },\n\t\t\t},\n\t\t\ttest: {\n\t\t\t\tname: { label: 'app:server', color: 'green' },\n\t\t\t\tinclude: ['tests/app/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\toptions ?? {},\n\t)\n`,\n\t\t}),\n\t\tpolicy: `export const policy = (options?: UserConfig): UserConfig =>\n\tmergeConfig(\n\t\t{\n\t\t\tresolve,\n\t\t\ttest: {\n\t\t\t\tname: { label: 'policy', color: 'white' },\n\t\t\t\tinclude: ['tests/policy.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\toptions ?? {},\n\t)\n`,\n\t\tconfig: `export const config = (options?: UserConfig): UserConfig =>\n\tmergeConfig(\n\t\t{\n\t\t\tresolve,\n\t\t\ttest: {\n\t\t\t\tname: { label: 'config', color: 'yellow' },\n\t\t\t\tinclude: ['tests/config.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\toptions ?? {},\n\t)\n`,\n\t\tguides: `export const guides = (options?: UserConfig): UserConfig =>\n\tmergeConfig(\n\t\t{\n\t\t\tresolve,\n\t\t\ttest: {\n\t\t\t\tname: { label: 'guides', color: 'green' },\n\t\t\t\tinclude: ['${GUIDES_TEST_PATH}'],\n\t\t\t\texclude: ['tests/src/**/*.test.ts', 'tests/app/**/*.test.ts', 'tests/setup.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\toptions ?? {},\n\t)\n`,\n\t\tconformance: `// Where this package drifts from the official tooling it stays compatible with.\n// The subject is this package, so the proof is hermetic and stays in \\`npm test\\`.\nexport const conformance = (options?: UserConfig): UserConfig =>\n\tmergeConfig(\n\t\t{\n\t\t\tresolve,\n\t\t\ttest: {\n\t\t\t\tname: { label: 'conformance', color: 'magenta' },\n\t\t\t\tinclude: ['${CONFORMANCE_TEST_PATH}'],\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\toptions ?? {},\n\t)\n`,\n\t\tservice: `// The live external services this package drives. It starts nothing itself:\n// \\`scripts/service.sh\\` provisions, \\`tests/setupService.ts\\` proves readiness, and\n// the project stays out of \\`npm test\\` because a real service answers it.\nexport const service = (options?: UserConfig): UserConfig =>\n\tmergeConfig(\n\t\t{\n\t\t\tresolve,\n\t\t\ttest: {\n\t\t\t\tname: { label: 'service', color: 'red' },\n\t\t\t\tinclude: ['${SERVICE_TEST_INCLUDE}'],\n\t\t\t\tsetupFiles: ['./tests/setup.ts', './tests/setupService.ts'],\n\t\t\t\tenvironment: 'node',\n\t\t\t\tbrowser: { enabled: false },\n\t\t\t\ttestTimeout: 120_000,\n\t\t\t\thookTimeout: 120_000,\n\t\t\t\tfileParallelism: false,\n\t\t\t},\n\t\t},\n\t\toptions ?? {},\n\t)\n`,\n\t\tdistribution: `export const distribution = (options?: UserConfig): UserConfig =>\n\tmergeConfig(\n\t\t{\n\t\t\tresolve,\n\t\t\ttest: {\n\t\t\t\tname: { label: 'distribution', color: 'cyan' },\n\t\t\t\tinclude: ['${DISTRIBUTION_TEST_PATH}'],\n\t\t\t\tsetupFiles: ['./tests/setup.ts'],\n\t\t\t\tenvironment: 'node',\n\t\t\t\ttestTimeout: 120_000,\n\t\t\t\thookTimeout: 120_000,\n\t\t\t\tfileParallelism: false,\n\t\t\t},\n\t\t},\n\t\toptions ?? {},\n\t)\n`,\n\t\tprobe: `// A workbench, not a proof. No gate selects this project.\nexport const probe = (options?: UserConfig): UserConfig =>\n\tmergeConfig(\n\t\t{\n\t\t\tresolve,\n\t\t\ttest: {\n\t\t\t\tname: { label: 'probe', color: 'gray' },\n\t\t\t\tinclude: ['tmp/probe/**/*.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\toptions ?? {},\n\t)\n`,\n\t\tintegration: `export const integration = (options?: UserConfig): UserConfig =>\n\tmergeConfig(\n\t\t{\n\t\t\tresolve,\n\t\t\ttest: {\n\t\t\t\tname: { label: 'integration', color: 'blue' },\n\t\t\t\tinclude: ['${INTEGRATION_TEST_PATH}'],\n\t\t\t\tsetupFiles: ['./tests/setup.ts'],\n{{global}}\t\t\t\tenvironment: 'node',\n\t\t\t},\n\t\t},\n\t\toptions ?? {},\n\t)\n`,\n\t}),\n\ttsconfigs: Object.freeze({\n\t\tsrc: Object.freeze({\n\t\t\tcore: `{\n\t\"extends\": \"../../tsconfig.json\",\n\t\"compilerOptions\": {\n\t\t\"lib\": [\"ESNext\", \"WebWorker\"],\n\t\t\"types\": [],\n\t\t\"noEmit\": false,\n\t\t\"declaration\": true,\n\t\t\"emitDeclarationOnly\": true,\n\t\t\"rootDir\": \"../../src/core\",\n\t\t\"outDir\": \"../../dist/src/core\"\n\t},\n\t\"include\": [\n\t\t\"../../src/core/**/*.cts\",\n\t\t\"../../src/core/**/*.mts\",\n\t\t\"../../src/core/**/*.ts\",\n\t\t\"../../src/core/**/*.tsx\"\n\t]\n}\n`,\n\t\t\tbrowser: `{\n\t\"extends\": \"../../tsconfig.json\",\n\t\"compilerOptions\": {\n\t\t\"lib\": [\"ESNext\", \"DOM\", \"DOM.Iterable\"],\n\t\t\"types\": [\"vite/client\"],\n\t\t\"noEmit\": false,\n\t\t\"declaration\": true,\n\t\t\"emitDeclarationOnly\": true,\n\t\t\"rootDir\": \"../../src\",\n\t\t\"outDir\": \"../../dist/src\"\n\t},\n\t\"include\": [\n\t\t\"../../src/browser/**/*.cts\",\n\t\t\"../../src/browser/**/*.mts\",\n\t\t\"../../src/browser/**/*.ts\",\n\t\t\"../../src/browser/**/*.tsx\"\n\t]\n}\n`,\n\t\t\tserver: `{\n\t\"extends\": \"../../tsconfig.json\",\n\t\"compilerOptions\": {\n\t\t\"lib\": [\"ESNext\"],\n\t\t\"types\": [\"node\"],\n\t\t\"noEmit\": false,\n\t\t\"declaration\": true,\n\t\t\"emitDeclarationOnly\": true,\n\t\t\"rootDir\": \"../../src\",\n\t\t\"outDir\": \"../../dist/src\"\n\t},\n\t\"include\": [\n\t\t\"../../src/server/**/*.cts\",\n\t\t\"../../src/server/**/*.mts\",\n\t\t\"../../src/server/**/*.ts\",\n\t\t\"../../src/server/**/*.tsx\"\n\t]\n}\n`,\n\t\t}),\n\t\tapp: Object.freeze({\n\t\t\tcore: `{\n\t\"extends\": \"../../tsconfig.json\",\n\t\"compilerOptions\": {\n\t\t\"lib\": [\"ESNext\", \"WebWorker\"],\n\t\t\"types\": []\n\t},\n\t\"include\": [\n\t\t\"../../app/core/**/*.cts\",\n\t\t\"../../app/core/**/*.mts\",\n\t\t\"../../app/core/**/*.ts\",\n\t\t\"../../app/core/**/*.tsx\",\n\t\t\"../../tests/app/core/**/*.cts\",\n\t\t\"../../tests/app/core/**/*.mts\",\n\t\t\"../../tests/app/core/**/*.ts\",\n\t\t\"../../tests/app/core/**/*.tsx\",\n\t\t\"../../tests/setup.ts\"\n\t]\n}\n`,\n\t\t\tbrowser: `{\n\t\"extends\": \"../../tsconfig.json\",\n\t\"compilerOptions\": {\n\t\t\"lib\": [\"ESNext\", \"DOM\", \"DOM.Iterable\"],\n\t\t\"types\": [\"vite/client\", \"vue\"]\n\t},\n\t\"include\": [\n{{include}}\n\t]\n}\n`,\n\t\t\tserver: `{\n\t\"extends\": \"../../tsconfig.json\",\n\t\"compilerOptions\": {\n\t\t\"lib\": [\"ESNext\"],\n\t\t\"types\": [\"node\"]\n\t},\n\t\"include\": [\n{{include}}\n\t]\n}\n`,\n\t\t}),\n\t\tbin: `{\n\t\"extends\": \"../../tsconfig.json\",\n\t\"compilerOptions\": {\n\t\t\"lib\": [\"ESNext\"],\n\t\t\"types\": [\"node\"],\n\t\t\"noEmit\": false,\n\t\t\"declaration\": true,\n\t\t\"emitDeclarationOnly\": true,\n\t\t\"rootDir\": \"../../src\",\n\t\t\"outDir\": \"../../dist/bin\"\n\t},\n\t\"include\": [\n\t\t\"../../src/bin/**/*.cts\",\n\t\t\"../../src/bin/**/*.mts\",\n\t\t\"../../src/bin/**/*.ts\",\n\t\t\"../../src/bin/**/*.tsx\"\n\t]\n}\n`,\n\t}),\n\tvites: Object.freeze({\n\t\tsrc: Object.freeze({\n\t\t\tcore: `import { defineConfig } from 'vite'\nimport dts from 'vite-plugin-dts'\nimport { environmentBoundary, outputBoundary } from '../helpers.js'\nimport { srcCore, resolveWorkspacePath } from '../../vite.config.ts'\n\nexport default defineConfig(\n\tsrcCore({\n\t\tpublicDir: false,\n\t\tplugins: [\n\t\t\toutputBoundary('dist/src/core'),\n\t\t\tenvironmentBoundary('src/core'),\n\t\t\tdts({\n\t\t\t\ttsconfigPath: resolveWorkspacePath('configs/src/tsconfig.core.json'),\n\t\t\t\tbundleTypes: {\n\t\t\t\t\textractorConfig: {\n\t\t\t\t\t\tcompiler: {\n\t\t\t\t\t\t\toverrideTsconfig: {\n\t\t\t\t\t\t\t\tcompilerOptions: { types: ['node'] },\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}),\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\trolldownOptions: { external: [/^node:/, /^@orkestrel\\\\//] },\n\t\t},\n\t}),\n)\n`,\n\t\t\tbrowser: `import { defineConfig } from 'vite'\nimport dts from 'vite-plugin-dts'\nimport { srcBrowser, resolveWorkspacePath } from '../../vite.config.ts'\n\n// vite-plugin-dts rolls this face into one declaration, and the roll-up reaches\n// src/core through a relative source path the tarball does not carry. The path\n// keeps each source module's own depth, so a module in a browser subfolder emits\n// one that leaves dist/src entirely. The rewrite below externalizes core through\n// the package's own published root export, on the final roll-up only.\nexport default defineConfig(\n\tsrcBrowser({\n\t\tplugins: [\n\t\t\tdts({\n\t\t\t\ttsconfigPath: resolveWorkspacePath('configs/src/tsconfig.browser.json'),\n\t\t\t\tbundleTypes: true,\n\t\t\t\tbeforeWriteFile: (path, content) => ({\n\t\t\t\t\tcontent: /[\\\\\\\\/]dist[\\\\\\\\/]src[\\\\\\\\/]browser[\\\\\\\\/]index\\\\.d\\\\.ts$/.test(path)\n{{replacement}}\n\t\t\t\t\t\t: content,\n\t\t\t\t}),\n\t\t\t}),\n\t\t],\n\t}),\n)\n`,\n\t\t\tserver: `import { defineConfig } from 'vite'\nimport dts from 'vite-plugin-dts'\nimport { srcServer, resolveWorkspacePath } from '../../vite.config.ts'\n\n// vite-plugin-dts rolls this face into one declaration, and the roll-up reaches\n// src/core through a relative source path the tarball does not carry. The rewrite\n// below externalizes core through the package's own published root export, on the\n// final roll-up only.\nexport default defineConfig(\n\tsrcServer({\n\t\tplugins: [\n\t\t\tdts({\n\t\t\t\ttsconfigPath: resolveWorkspacePath('configs/src/tsconfig.server.json'),\n\t\t\t\tbundleTypes: true,\n\t\t\t\tbeforeWriteFile: (path, content) => ({\n\t\t\t\t\tcontent: /[\\\\\\\\/]dist[\\\\\\\\/]src[\\\\\\\\/]server[\\\\\\\\/]index\\\\.d\\\\.ts$/.test(path)\n{{replacement}}\n\t\t\t\t\t\t: content,\n\t\t\t\t}),\n\t\t\t}),\n\t\t],\n\t}),\n)\n`,\n\t\t}),\n\t\tbin: `import { defineConfig } from 'vite'\nimport { srcBin } from '../../vite.config.ts'\n\n// The \\`scaffold\\` executable build — a single ESM lib file, no declarations (an\n// executable ships no types), with the \\`#!/usr/bin/env node\\` shebang re-emitted via\n// \\`output.banner\\` (rolldown strips shebangs from source during bundling), and\n// \\`output.paths\\` rewriting the externalized \\`@src/*\\` specifiers to the built sibling\n// src environments (relative to \\`dist/bin/\\`), so the emitted bin resolves at runtime.\nexport default defineConfig(\n\tsrcBin({\n\t\tbuild: {\n\t\t\trolldownOptions: {\n\t\t\t\toutput: {\n\t\t\t\t\tbanner: '#!/usr/bin/env node',\n{{paths}}\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}),\n)\n`,\n\t\tapp: Object.freeze({\n\t\t\tbrowser: `import { defineConfig } from 'vite'\nimport { appBrowser } from '../../vite.config.ts'\n\nexport default defineConfig(appBrowser())\n`,\n\t\t\tserver: `import { defineConfig } from 'vite'\nimport { appServer } from '../../vite.config.ts'\n\nexport default defineConfig(appServer())\n`,\n\t\t\tshowcase: `import { defineConfig } from 'vite'\nimport { appShowcase } from '../../vite.config.ts'\n\nexport default defineConfig(appShowcase())\n`,\n\t\t}),\n\t}),\n\tbrowsers: `// A generated browser workspace resolves its own Chromium here rather than in\n// \\`configs/helpers.ts\\`, because that leaf is vendored byte-identical to every\n// workspace and most of them declare no \\`playwright\\` to import.\n\nimport type { PlaywrightProviderOptions } from '@vitest/browser-playwright'\nimport { chromium } from 'playwright'\nimport { accessSync, constants as FS_CONSTANTS, globSync, readdirSync, statSync } from 'node:fs'\nimport { basename, dirname, join, resolve as resolvePath } from 'node:path'\n\n/**\n * Chromium executable layouts inside a \\`chromium-<revision>\\` browsers-directory entry, per\n * platform.\n *\n * @remarks\n * The current Playwright build ships Chrome for Testing on macOS. The trailing \\`Chromium.app\\`\n * layouts are what earlier builds shipped, so the list spans Playwright versions instead of\n * pinning to the installed one.\n */\nexport const CHROMIUM_LAYOUTS = Object.freeze([\n\t'chrome-linux/chrome',\n\t'chrome-linux64/chrome',\n\t'chrome-win/chrome.exe',\n\t'chrome-win64/chrome.exe',\n\t'chrome-mac-x64/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing',\n\t'chrome-mac-arm64/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing',\n\t'chrome-mac/Chromium.app/Contents/MacOS/Chromium',\n\t'chrome-mac-arm64/Chromium.app/Contents/MacOS/Chromium',\n])\n\n/** The \\`chromium-<revision>\\` entry name Playwright installs one managed build into. */\nexport const CHROMIUM_ENTRY_PATTERN = /^chromium-\\\\d+$/\n\n/** The revision number carried by any path containing a \\`chromium-<revision>\\` segment. */\nexport const CHROMIUM_REVISION_PATTERN = /chromium-(\\\\d+)/\n\n/** The directory a managed Linux container installs its bundled Playwright browsers into. */\nexport const BUNDLED_BROWSERS_ROOT = '/opt/pw-browsers'\n\n/**\n * Bundled Chromium layouts under the managed-container browsers root, as glob patterns.\n *\n * @remarks\n * The revision directory and its inner layout both drift across Playwright builds, and the\n * container also carries a top-level \\`chromium\\` alias, so every known shape is globbed.\n */\nexport const BUNDLED_CHROMIUM_LAYOUTS = Object.freeze([\n\t'chromium',\n\t'chromium-*/chrome-linux64/chrome',\n\t'chromium-*/chrome-linux/chrome',\n])\n\n/** Stable Playwright Chromium channels and their standard executable layouts. */\nexport const SYSTEM_BROWSER_CHANNELS = Object.freeze([\n\tObject.freeze({\n\t\tchannel: 'chrome',\n\t\tlayouts: Object.freeze({\n\t\t\tlinux: '/opt/google/chrome/chrome',\n\t\t\tdarwin: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',\n\t\t\twin32: Object.freeze(['Google', 'Chrome', 'Application', 'chrome.exe']),\n\t\t}),\n\t}),\n\tObject.freeze({\n\t\tchannel: 'msedge',\n\t\tlayouts: Object.freeze({\n\t\t\tlinux: '/opt/microsoft/msedge/msedge',\n\t\t\tdarwin: '/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge',\n\t\t\twin32: Object.freeze(['Microsoft', 'Edge', 'Application', 'msedge.exe']),\n\t\t}),\n\t}),\n])\n\n/**\n * Determine whether a path identifies an executable regular file.\n *\n * @param path - The filesystem path to inspect.\n * @returns Whether the path is a regular file with execute access.\n *\n * @example\n * \\`\\`\\`ts\n * isBrowserExecutable('/opt/google/chrome/chrome')\n * \\`\\`\\`\n */\nexport function isBrowserExecutable(path: string): boolean {\n\ttry {\n\t\tif (!statSync(path).isFile()) return false\n\t\taccessSync(path, FS_CONSTANTS.X_OK)\n\t\treturn true\n\t} catch {\n\t\treturn false\n\t}\n}\n\n/**\n * Order two Chromium paths so the highest revision sorts first.\n *\n * @param left - The first path or directory entry to compare.\n * @param right - The second path or directory entry to compare.\n * @returns A negative number when \\`left\\` sorts first, positive when \\`right\\` does.\n *\n * @remarks\n * Revisions are numbers, so \\`chromium-1200\\` outranks \\`chromium-999\\` despite sorting below it\n * lexically. A path carrying no revision falls back to descending name order.\n *\n * @example\n * \\`\\`\\`ts\n * ['chromium-999', 'chromium-1200'].sort(compareRevisions)\n * \\`\\`\\`\n */\nexport function compareRevisions(left: string, right: string): number {\n\tconst leftRevision = CHROMIUM_REVISION_PATTERN.exec(left)?.[1]\n\tconst rightRevision = CHROMIUM_REVISION_PATTERN.exec(right)?.[1]\n\tif (leftRevision === undefined || rightRevision === undefined) return right.localeCompare(left)\n\treturn Number(rightRevision) - Number(leftRevision)\n}\n\n/**\n * Read the executable path of Playwright's pinned Chromium revision.\n *\n * @returns The pinned executable path, or \\`undefined\\` when this platform has none.\n *\n * @remarks\n * Playwright throws rather than returning a path when the current platform carries no initialized\n * executable, and an unguarded call would fail configuration evaluation for every project.\n *\n * @example\n * \\`\\`\\`ts\n * resolvePinnedBrowser()\n * \\`\\`\\`\n */\nexport function resolvePinnedBrowser(): string | undefined {\n\ttry {\n\t\tconst pinned = chromium.executablePath()\n\t\treturn pinned.length === 0 ? undefined : pinned\n\t} catch {\n\t\treturn undefined\n\t}\n}\n\n/**\n * Resolve a launchable Playwright-managed Chromium executable: the pinned revision when installed,\n * otherwise a \\`chromium\\` / \\`chromium.exe\\` alias or any other \\`chromium-*\\` revision under the same\n * Playwright browsers directory. A pinned-revision miss is not Chromium absence — managed\n * containers ship one usable build, often behind a revision-agnostic alias, for many Playwright\n * versions.\n *\n * @param pinned - The executable path for Playwright's pinned Chromium revision.\n * @returns The managed executable path, or \\`undefined\\` when none is executable.\n *\n * @example\n * \\`\\`\\`ts\n * resolveManagedBrowser('/root/.cache/ms-playwright/chromium-1234/chrome-linux64/chrome')\n * \\`\\`\\`\n */\nexport function resolveManagedBrowser(pinned: string): string | undefined {\n\tif (isBrowserExecutable(pinned)) return pinned\n\tlet revisionRoot = dirname(pinned)\n\tfor (;;) {\n\t\tif (CHROMIUM_ENTRY_PATTERN.test(basename(revisionRoot))) break\n\t\tconst parent = dirname(revisionRoot)\n\t\tif (parent === revisionRoot) return undefined\n\t\trevisionRoot = parent\n\t}\n\tconst browsersRoot = dirname(revisionRoot)\n\tfor (const alias of ['chromium', 'chromium.exe']) {\n\t\tconst candidate = resolvePath(browsersRoot, alias)\n\t\tif (isBrowserExecutable(candidate)) return candidate\n\t}\n\tlet entries: readonly string[]\n\ttry {\n\t\tentries = readdirSync(browsersRoot)\n\t} catch {\n\t\treturn undefined\n\t}\n\tconst revisions = entries\n\t\t.filter((entry) => CHROMIUM_ENTRY_PATTERN.test(entry))\n\t\t.sort(compareRevisions)\n\tfor (const revision of revisions) {\n\t\tfor (const layout of CHROMIUM_LAYOUTS) {\n\t\t\tconst candidate = resolvePath(browsersRoot, revision, layout)\n\t\t\tif (isBrowserExecutable(candidate)) return candidate\n\t\t}\n\t}\n\treturn undefined\n}\n\n/**\n * Resolve the Chromium a managed Linux container bundles outside the Playwright cache.\n *\n * @param platform - The Node platform the container runs on.\n * @param root - The bundled browsers directory to search.\n * @returns The highest matching executable path, or \\`undefined\\` when none is executable.\n *\n * @example\n * \\`\\`\\`ts\n * resolveBundledBrowser('linux', BUNDLED_BROWSERS_ROOT)\n * \\`\\`\\`\n */\nexport function resolveBundledBrowser(platform: NodeJS.Platform, root: string): string | undefined {\n\tif (platform !== 'linux') return undefined\n\tfor (const layout of BUNDLED_CHROMIUM_LAYOUTS) {\n\t\tlet matches: readonly string[]\n\t\ttry {\n\t\t\tmatches = globSync(layout, { cwd: root })\n\t\t} catch {\n\t\t\treturn undefined\n\t\t}\n\t\tfor (const match of [...matches].sort(compareRevisions)) {\n\t\t\tconst candidate = resolvePath(root, match)\n\t\t\tif (isBrowserExecutable(candidate)) return candidate\n\t\t}\n\t}\n\treturn undefined\n}\n\n/**\n * Resolve the first installed stable system Chromium channel.\n *\n * @param platform - The Node platform whose standard layouts should be probed.\n * @param environment - The process environment supplying Windows installation roots.\n * @returns \\`chrome\\`, then \\`msedge\\`, or \\`undefined\\` when neither is executable.\n *\n * @example\n * \\`\\`\\`ts\n * resolveSystemBrowser(process.platform, process.env)\n * \\`\\`\\`\n */\nexport function resolveSystemBrowser(\n\tplatform: NodeJS.Platform,\n\tenvironment: NodeJS.ProcessEnv,\n): string | undefined {\n\tif (platform !== 'linux' && platform !== 'darwin' && platform !== 'win32') return undefined\n\tconst roots = new Set<string>()\n\tif (platform === 'win32') {\n\t\tfor (const root of [\n\t\t\tenvironment.LOCALAPPDATA,\n\t\t\tenvironment.PROGRAMFILES,\n\t\t\tenvironment['PROGRAMFILES(X86)'],\n\t\t]) {\n\t\t\tif (root !== undefined && root.length > 0) roots.add(root)\n\t\t}\n\t\tconst homeDrive = environment.HOMEDRIVE\n\t\tif (homeDrive !== undefined && homeDrive.length > 0) {\n\t\t\troots.add(join(homeDrive, 'Program Files'))\n\t\t\troots.add(join(homeDrive, 'Program Files (x86)'))\n\t\t}\n\t}\n\tfor (const browser of SYSTEM_BROWSER_CHANNELS) {\n\t\tif (platform === 'win32') {\n\t\t\tfor (const root of roots) {\n\t\t\t\tif (isBrowserExecutable(join(root, ...browser.layouts.win32))) return browser.channel\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tif (isBrowserExecutable(browser.layouts[platform])) return browser.channel\n\t}\n\treturn undefined\n}\n\n/**\n * Resolve Playwright provider options for whatever browser this host can actually launch.\n *\n * @param pinned - The executable path for Playwright's pinned Chromium revision, when it has one.\n * @param platform - The Node platform whose standard layouts should be probed.\n * @param environment - The process environment supplying operator overrides and Windows roots.\n * @param root - The managed-container bundled browsers directory to search.\n * @returns Provider options naming an executable, a WebSocket endpoint, or a channel.\n *\n * @remarks\n * Precedence, most important first: \\`PLAYWRIGHT_EXECUTABLE_PATH\\`, \\`PLAYWRIGHT_WS_ENDPOINT\\`,\n * \\`PLAYWRIGHT_CHANNEL\\`, the managed Playwright Chromium, the container's bundled Chromium, a\n * verified system channel, then the platform default channel. An operator override outranks\n * discovery and is returned exactly as given: none of those three environment values is checked\n * against the filesystem, because verifying an override would defeat the override. The pinned\n * managed revision outranks anything found on the host because it is deterministic. The installed\n * pinned revision returns empty options so Playwright keeps its own default launch semantics. Only\n * a discovered system channel is verified before it is named. The platform default is unverified\n * as well and exists only as a last resort: Windows takes \\`msedge\\`, which ships with the OS and\n * never collides with a foreground Chrome.\n *\n * @example\n * \\`\\`\\`ts\n * resolveBrowser(resolvePinnedBrowser(), process.platform, process.env)\n * \\`\\`\\`\n */\nexport function resolveBrowser(\n\tpinned: string | undefined,\n\tplatform: NodeJS.Platform,\n\tenvironment: NodeJS.ProcessEnv,\n\troot: string = BUNDLED_BROWSERS_ROOT,\n): PlaywrightProviderOptions {\n\tconst executable = environment.PLAYWRIGHT_EXECUTABLE_PATH\n\tif (executable !== undefined && executable.length > 0) {\n\t\treturn { launchOptions: { executablePath: executable } }\n\t}\n\tconst endpoint = environment.PLAYWRIGHT_WS_ENDPOINT\n\tif (endpoint !== undefined && endpoint.length > 0) {\n\t\treturn { connectOptions: { wsEndpoint: endpoint } }\n\t}\n\tconst requested = environment.PLAYWRIGHT_CHANNEL\n\tif (requested !== undefined && requested.length > 0) {\n\t\treturn { launchOptions: { channel: requested } }\n\t}\n\tconst managed = pinned === undefined ? undefined : resolveManagedBrowser(pinned)\n\tif (managed !== undefined) {\n\t\treturn managed === pinned ? {} : { launchOptions: { executablePath: managed } }\n\t}\n\tconst bundled = resolveBundledBrowser(platform, root)\n\tif (bundled !== undefined) return { launchOptions: { executablePath: bundled } }\n\tconst fallback = platform === 'win32' ? 'msedge' : 'chrome'\n\treturn { launchOptions: { channel: resolveSystemBrowser(platform, environment) ?? fallback } }\n}\n`,\n})\n\n/**\n * Formatter-stable template text for source, test, document, guide, and service artifacts.\n *\n * @remarks\n * Builders in `compilers.ts` fill every varying span through\n * `@orkestrel/template`. Empty barrels, entries, and setup modules are\n * intentional: the generated workspace starts with no sample domain API, while\n * each selected Vitest project gets a real test that proves its barrel has no\n * starter exports. An entry starts empty for the same reason its barrel does,\n * and because the vendored lint config refuses an unassigned import outside a\n * stylesheet, so a starter `import './index.js'` would fail the workspace's own\n * `lint:check` on the day it is written.\n *\n * @example\n * ```ts\n * import { ARTIFACT_TEMPLATES } from '@orkestrel/scaffold'\n *\n * ARTIFACT_TEMPLATES.source.empty // ''\n * ```\n */\nexport const ARTIFACT_TEMPLATES = Object.freeze({\n\tsource: Object.freeze({\n\t\tempty: '',\n\t\tbrowser: `<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<meta charset=\"UTF-8\" />\n\t\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n\t\t<title>Application</title>\n\t</head>\n\t<body>\n\t\t<script type=\"module\" src=\"/main.ts\"></script>\n\t</body>\n</html>\n`,\n\t}),\n\ttests: Object.freeze({\n\t\tsetup: '',\n\t\tglobal: `export function setup(): void {}\n`,\n\t\tentry: `import * as entry from {{specifier}}\nimport { describe, expect, it } from 'vitest'\n\ndescribe({{label}}, () => {\n\tit('has no starter exports', () => {\n\t\texpect(Object.keys(entry)).toStrictEqual([])\n\t})\n})\n`,\n\t\tbin: `import { describe, expect, it } from 'vitest'\n\ndescribe('bin entry', () => {\n\tit('has no starter exports', async () => {\n{{import}}\n\t\texpect(Object.keys(entry)).toStrictEqual([])\n\t})\n})\n`,\n\t\tintegration: `{{imports}}import { describe, expect, it } from 'vitest'\n\ndescribe('workspace integration', () => {\n\tit('loads every selected public barrel together as a composition seed', () => {\n\t\t// Replace this empty-barrel seed with one observable flow that passes one\n\t\t// environment's public result into another.\n\t\t{{actual}}{{expected}})\n\t})\n})\n`,\n\t}),\n\tdocs: Object.freeze({\n\t\treadme: `# {{package}}\n\n{{description}}\n\n## Development\n\n\\`\\`\\`sh\nnpm install\nnpm test\n\\`\\`\\`\n`,\n\t}),\n\tguides: Object.freeze({\n\t\treadme: `# Guides\n\n## By concept\n\n- Package\n - Spec: Not created. Create this file when the workspace has a public surface:\n \\`guides/{{guide}}.md\\`\n - Source:\n{{source}}\n - Tests:\n{{tests}}\n\n## By directory\n\n{{directories}}\n`,\n\t}),\n\torchestration: Object.freeze({\n\t\tservice: `#!/usr/bin/env sh\nset -eu\n\nprintf '%s\\\\n' \\\\\n{{vendors}}\n`,\n\t}),\n})\n","import type { ScaffoldErrorCode } from './types.js'\n\n/**\n * The one error this package throws, carrying the coded reason it was raised.\n *\n * @remarks\n * Each code names one cause: `INVALID` for off-contract input, `DESTROYED` for\n * any call made after teardown, `TARGET` for a destination that is not what the\n * caller's observation said it was, `WRITE` for a mutation that could not be\n * completed, `FETCH` for an upstream read that produced no answer the caller can\n * be given, and `BLOCKED` for a refused blueprint.\n *\n * `BLOCKED` covers both refusals a blueprint can meet, because they are one fact\n * — this blueprint will not be built — and the questions say which. The compiler\n * answers its refusal rather than throwing it: the gate fails closed, returns the\n * questions that closed it, and records `BLOCKED` on its stage, so a caller reads\n * that refusal from the value it asked for. A verb that creates a workspace\n * throws it, because it chose the shape and has nothing to hand back. A blocking\n * question closed the gate; a non-blocking one is a shape this package can\n * describe and declines to create.\n *\n * `context` carries whatever the raising site can say about the failure. It is\n * `unknown` because nothing narrows it usefully at the catch site; read it for\n * a report, never branch on it.\n *\n * @example\n * ```ts\n * import { ScaffoldError, isScaffoldError } from '@orkestrel/scaffold'\n *\n * try {\n * \tthrow new ScaffoldError('INVALID', 'Blueprint is not an exact record')\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\t/**\n\t * Construct a coded scaffold error.\n\t *\n\t * @param code - The coded reason the error is raised.\n\t * @param message - What went wrong, in one sentence.\n\t * @param context - Whatever the raising site can say about the failure.\n\t */\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 {@link 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 * isScaffoldError(undefined) // false\n * ```\n */\nexport function isScaffoldError(value: unknown): value is ScaffoldError {\n\treturn value instanceof ScaffoldError\n}\n","import type { Guard } from '@orkestrel/contract'\nimport type { EmitterHooks } from '@orkestrel/emitter'\nimport type {\n\tArtifact,\n\tAudit,\n\tBlueprint,\n\tCatalogEntry,\n\tCompilerEventMap,\n\tCompilerOptions,\n\tDependency,\n\tEnvironment,\n\tFinding,\n\tGroup,\n\tMirror,\n\tOverride,\n\tPlan,\n\tQuestion,\n\tSnapshot,\n} from './types.js'\nimport {\n\tandOf,\n\tarrayOf,\n\tenumerableKeys,\n\tholds,\n\tisArray,\n\tisBoolean,\n\tisFunction,\n\tisRecord,\n\tisString,\n\tliteralOf,\n\trecordOf,\n\tstringOf,\n\tunionOf,\n} from '@orkestrel/contract'\nimport {\n\tCONTROL_CHARACTER_PATTERN,\n\tDEPENDENCY_NAME_PATTERN,\n\tENVIRONMENTS,\n\tGROUPS,\n\tHEX_PATTERN,\n\tINVALID_PATH_CHARACTER_PATTERN,\n\tMAX_ARTIFACT_BYTES,\n\tMAX_ARTIFACT_HEX_LENGTH,\n\tMAX_AUDIT_FINDINGS,\n\tMAX_COLLECTION_ITEMS,\n\tMAX_DEPENDENCY_NAME_LENGTH,\n\tMAX_NAME_LENGTH,\n\tMAX_PATH_LENGTH,\n\tMAX_RANGE_LENGTH,\n} from './constants.js'\n\n/**\n * Narrow a value to a logical target-relative path.\n *\n * @param value - The candidate path.\n * @returns `true` for a bounded relative path with no traversal, empty segment,\n * control character, or reserved syntax character.\n *\n * @remarks\n * Every path this package reads or writes passes here, so one law covers a\n * planned artifact, an override target, an audit finding, a guide mirror, and a\n * snapshot key. Rejecting `..`, a leading `/`, and a backslash at the guard is\n * what stops a caller-supplied path from naming a destination outside the\n * target. Host-location validation is a separate server boundary: this guard\n * does not reject a device spelling, a trailing dot or space, or a segment that\n * exceeds a host filesystem's byte ceiling.\n *\n * @example\n * ```ts\n * import { isPath } from '@orkestrel/scaffold'\n *\n * isPath('configs/src/tsconfig.core.json') // true\n * isPath('../secrets') // false\n * ```\n */\nexport function isPath(value: unknown): value is string {\n\treturn holds(() => {\n\t\tif (!isString(value) || value.length === 0 || value.length > MAX_PATH_LENGTH) return false\n\t\tif (CONTROL_CHARACTER_PATTERN.test(value)) return false\n\t\tif (INVALID_PATH_CHARACTER_PATTERN.test(value)) return false\n\t\tfor (const segment of value.split('/')) {\n\t\t\tif (segment === '' || segment === '.' || segment === '..') return false\n\t\t}\n\t\treturn true\n\t})\n}\n\n/**\n * Narrow a value to exact lowercase hexadecimal bytes within one artifact's limit.\n *\n * @remarks\n * Two digits per byte, so an odd length is refused and empty content is valid.\n * The bound is exact rather than approximate: the encoding is ASCII, so the\n * string's length is twice the byte count it stands for.\n *\n * @example\n * ```ts\n * import { isHex } from '@orkestrel/scaffold'\n *\n * isHex('68690a') // true\n * isHex('68690A') // false\n * ```\n */\nexport const isHex: Guard<string> = stringOf({\n\tmax: MAX_ARTIFACT_HEX_LENGTH,\n\tpattern: HEX_PATTERN,\n})\n\n/**\n * Narrow a value to text this package will accept as one artifact's content.\n *\n * @remarks\n * The bound is a code-unit ceiling rather than a byte count, because a string\n * of more code units than {@link MAX_ARTIFACT_BYTES} cannot encode within that\n * budget under any encoding this package writes. The exact UTF-8 measurement\n * belongs to the compiler and the writer, which are the two places the bytes\n * are actually produced.\n */\nexport const isContent: Guard<string> = stringOf({ max: MAX_ARTIFACT_BYTES })\n\n/**\n * Narrow a value to an array within the limit one public collection accepts.\n *\n * @param value - The candidate collection.\n * @returns `true` for an array of no more than `MAX_COLLECTION_ITEMS` items.\n *\n * @remarks\n * Compose this ahead of an element guard so the item count is settled before\n * anything walks the items. A hostile `length` accessor answers `false` here\n * rather than escaping as a thrown error.\n *\n * @example\n * ```ts\n * import { isCollection } from '@orkestrel/scaffold'\n *\n * isCollection(['manifest']) // true\n * isCollection('manifest') // false\n * ```\n */\nexport function isCollection(value: unknown): value is readonly unknown[] {\n\treturn holds(() => isArray(value) && value.length <= MAX_COLLECTION_ITEMS)\n}\n\n/**\n * Narrow a value to one {@link Environment} a workspace may select.\n *\n * @example\n * ```ts\n * import { isEnvironment } from '@orkestrel/scaffold'\n *\n * isEnvironment('browser') // true\n * isEnvironment('worker') // false\n * ```\n */\nexport const isEnvironment: Guard<Environment> = literalOf(ENVIRONMENTS)\n\n/**\n * Narrow a value to one {@link Group} a plan selects over.\n *\n * @example\n * ```ts\n * import { isGroup } from '@orkestrel/scaffold'\n *\n * isGroup('manifest') // true\n * isGroup('readme') // false\n * ```\n */\nexport const isGroup: Guard<Group> = literalOf(GROUPS)\n\n/** Narrow a value to a bounded group selection. */\nexport const isGroups: Guard<readonly Group[]> = andOf(isCollection, arrayOf(isGroup))\n\n/**\n * Narrow a value to the scoped package name a runtime dependency carries.\n *\n * @remarks\n * A dependency name reaches a path, because a workspace's guide mirror is\n * derived from it. Fixing the scope and admitting nothing but a bare name after\n * it is what keeps that derivation inside the directory the mirror belongs in.\n * A blueprint's development extras are deliberately wider and are measured by\n * the gate instead, which is why {@link isDependency} does not apply this.\n *\n * @example\n * ```ts\n * import { isDependencyName } from '@orkestrel/scaffold'\n *\n * isDependencyName('@orkestrel/router') // true\n * isDependencyName('@orkestrel/../etc') // false\n * ```\n */\nexport const isDependencyName: Guard<string> = stringOf({\n\tmax: MAX_DEPENDENCY_NAME_LENGTH,\n\tpattern: DEPENDENCY_NAME_PATTERN,\n})\n\n/**\n * Narrow a value to a {@link Dependency}.\n *\n * @remarks\n * Structural and bounded: which names and ranges a blueprint may declare is a\n * gate law, reported as a {@link Question} carrying its accepted candidates, so\n * refusing it here would replace an answerable question with a bare `false`.\n *\n * @example\n * ```ts\n * import { isDependency } from '@orkestrel/scaffold'\n *\n * isDependency({ name: '@orkestrel/emitter', range: '^0.0.5' }) // true\n * isDependency({ name: '@orkestrel/emitter' }) // false\n * ```\n */\nexport const isDependency: Guard<Dependency> = recordOf(\n\t{\n\t\tname: stringOf({ min: 1, max: MAX_DEPENDENCY_NAME_LENGTH }),\n\t\trange: stringOf({ min: 1, max: MAX_RANGE_LENGTH }),\n\t\toptional: isBoolean,\n\t},\n\t['optional'],\n)\n\n/**\n * Narrow a value to an {@link Override}.\n *\n * @remarks\n * Whether the path names a planned artifact is a gate law; whether it names a\n * destination at all is this guard's.\n *\n * @example\n * ```ts\n * import { isOverride } from '@orkestrel/scaffold'\n *\n * isOverride({ path: 'README.md', content: '# Title\\n' }) // true\n * ```\n */\nexport const isOverride: Guard<Override> = recordOf({ path: isPath, content: isContent })\n\n/**\n * Narrow a value to a {@link Blueprint}.\n *\n * @remarks\n * The whole closed record, its literal axes, and the count and length bounds\n * this package admits. The syntactic laws over a name, a version, a range, and\n * an engines floor stay with the gate, which reports each one as a\n * {@link Question} instead of refusing the value outright.\n *\n * @example\n * ```ts\n * import { isBlueprint } from '@orkestrel/scaffold'\n *\n * isBlueprint({ name: 'router', src: ['core'] }) // false — not the whole record\n * ```\n */\nexport const isBlueprint: Guard<Blueprint> = recordOf(\n\t{\n\t\tname: stringOf({ min: 1, max: MAX_NAME_LENGTH }),\n\t\tdescription: isString,\n\t\tkeywords: andOf(isCollection, arrayOf(isString)),\n\t\tsrc: andOf(isCollection, arrayOf(isEnvironment)),\n\t\tapp: andOf(isCollection, arrayOf(isEnvironment)),\n\t\tdependencies: andOf(isCollection, arrayOf(isDependency)),\n\t\tpeers: andOf(isCollection, arrayOf(isDependency)),\n\t\textras: andOf(isCollection, arrayOf(isDependency)),\n\t\tversion: isString,\n\t\tengines: isString,\n\t\toverrides: andOf(isCollection, arrayOf(isOverride)),\n\t\tbin: isBoolean,\n\t\tguides: isBoolean,\n\t\tdistribution: isBoolean,\n\t\tintegration: isBoolean,\n\t\tconformance: isBoolean,\n\t\tservice: isBoolean,\n\t\tvendors: andOf(isCollection, arrayOf(isString)),\n\t\tglobal: isBoolean,\n\t\tshowcase: isBoolean,\n\t},\n\t['description'],\n)\n\n/**\n * Narrow a value to an {@link Artifact}.\n *\n * @remarks\n * One branch per way content is produced, discriminated by `origin` and\n * narrowed by `ownership`. Each branch declares only the keys its branch has,\n * so a host artifact carrying `content`, a hydrated artifact carrying anything\n * but `content` ownership, and a template artifact carrying `hex` are all\n * refused rather than admitted to the wrong branch.\n *\n * @example\n * ```ts\n * import { isArtifact } from '@orkestrel/scaffold'\n *\n * isArtifact({ path: 'AGENTS.md', group: 'docs', ownership: 'presence', origin: 'host' }) // true\n * ```\n */\nexport const isArtifact: Guard<Artifact> = unionOf(\n\trecordOf(\n\t\t{\n\t\t\tpath: isPath,\n\t\t\tgroup: isGroup,\n\t\t\townership: literalOf('presence', 'birth'),\n\t\t\tenvironment: isEnvironment,\n\t\t\torigin: literalOf('host'),\n\t\t\tsource: isPath,\n\t\t},\n\t\t['environment', 'source'],\n\t),\n\trecordOf(\n\t\t{\n\t\t\tpath: isPath,\n\t\t\tgroup: isGroup,\n\t\t\townership: literalOf('content'),\n\t\t\tenvironment: isEnvironment,\n\t\t\torigin: literalOf('host'),\n\t\t\tsource: isPath,\n\t\t\thex: isHex,\n\t\t},\n\t\t['environment', 'source'],\n\t),\n\trecordOf(\n\t\t{\n\t\t\tpath: isPath,\n\t\t\tgroup: isGroup,\n\t\t\townership: literalOf('content', 'presence', 'birth'),\n\t\t\tenvironment: isEnvironment,\n\t\t\torigin: literalOf('template', 'computed'),\n\t\t\tcontent: isContent,\n\t\t},\n\t\t['environment'],\n\t),\n)\n\n/**\n * Narrow a value to a {@link Plan}.\n *\n * @remarks\n * A plan reaches the writer, and the writer has no question channel, so this\n * carries the whole law of the value: every artifact path, every claimed byte,\n * and the blueprint it was compiled from.\n */\nexport const isPlan: Guard<Plan> = recordOf(\n\t{\n\t\tblueprint: isBlueprint,\n\t\tgroups: isGroups,\n\t\tartifacts: andOf(isCollection, arrayOf(isArtifact)),\n\t\thash: isHex,\n\t},\n\t['hash'],\n)\n\n/**\n * Narrow a value to a {@link Question}.\n *\n * @example\n * ```ts\n * import { isQuestion } from '@orkestrel/scaffold'\n *\n * isQuestion({ field: 'src', message: 'Unknown environment', blocking: true }) // true\n * ```\n */\nexport const isQuestion: Guard<Question> = recordOf(\n\t{\n\t\tfield: isString,\n\t\tmessage: isString,\n\t\tblocking: isBoolean,\n\t\tcandidates: andOf(isCollection, arrayOf(isString)),\n\t},\n\t['candidates'],\n)\n\n/**\n * Narrow a value to a {@link Finding}.\n *\n * @remarks\n * `observed` is required exactly where the mutation it precedes is held to it,\n * absent where the destination had no bytes to record, and optional where the\n * comparison may not have been made. Planned findings require `ownership`;\n * foreign findings forbid it because no artifact was planned for their path.\n *\n * That is the whole claim. This guard proves the shape a reader may destructure\n * and nothing about whether the verdict is one an audit could have reached: the\n * correlation between `ownership`, `drift`, and `observed` belongs to\n * {@link inferDrift}, and it is re-derived at the verb that acts on the finding.\n */\nexport const isFinding: Guard<Finding> = unionOf(\n\trecordOf({\n\t\tpath: isPath,\n\t\tgroup: isGroup,\n\t\townership: literalOf('content', 'presence', 'birth'),\n\t\tdrift: literalOf('stale'),\n\t\tobserved: isHex,\n\t}),\n\trecordOf({\n\t\tpath: isPath,\n\t\tgroup: isGroup,\n\t\tdrift: literalOf('foreign'),\n\t\tobserved: isHex,\n\t}),\n\trecordOf({\n\t\tpath: isPath,\n\t\tgroup: isGroup,\n\t\townership: literalOf('content', 'presence', 'birth'),\n\t\tdrift: literalOf('missing'),\n\t}),\n\trecordOf(\n\t\t{\n\t\t\tpath: isPath,\n\t\t\tgroup: isGroup,\n\t\t\townership: literalOf('content', 'presence', 'birth'),\n\t\t\tdrift: literalOf('aligned'),\n\t\t\tobserved: isHex,\n\t\t},\n\t\t['observed'],\n\t),\n)\n\n/**\n * Narrow a value to an {@link Audit}.\n *\n * @remarks\n * An audit reaches the writer and the destructive verb, so it is guarded as\n * strictly as the plan beside it. Findings use the sum of the two producer\n * bounds: one per planned artifact, then one per unplanned snapshot path.\n */\nexport const isAudit: Guard<Audit> = recordOf({\n\tfindings: andOf(\n\t\t(value: unknown): value is readonly unknown[] =>\n\t\t\tholds(() => isArray(value) && value.length <= MAX_AUDIT_FINDINGS),\n\t\tarrayOf(isFinding),\n\t),\n\tquestions: andOf(isCollection, arrayOf(isQuestion)),\n})\n\n/**\n * Narrow a value to a {@link Mirror}.\n *\n * @remarks\n * `content` is the fetched guide text and `observed` is the local mirror's\n * exact bytes, so the two carry different laws: one is content this package\n * writes, the other is the precondition that write is held to.\n */\nexport const isMirror: Guard<Mirror> = unionOf(\n\trecordOf(\n\t\t{\n\t\t\tname: isDependencyName,\n\t\t\tpath: isPath,\n\t\t\tlookup: literalOf('found'),\n\t\t\tcontent: isContent,\n\t\t\tobserved: isHex,\n\t\t},\n\t\t['observed'],\n\t),\n\trecordOf(\n\t\t{\n\t\t\tname: isDependencyName,\n\t\t\tpath: isPath,\n\t\t\tlookup: literalOf('missing', 'failed'),\n\t\t\tnote: isString,\n\t\t\tobserved: isHex,\n\t\t},\n\t\t['observed'],\n\t),\n)\n\n/**\n * Narrow a value to a {@link CatalogEntry}.\n *\n * @remarks\n * A row that found no version carries the cause instead, and neither branch may\n * carry the other's field.\n */\nexport const isCatalogEntry: Guard<CatalogEntry> = unionOf(\n\trecordOf({\n\t\tname: isDependencyName,\n\t\tlookup: literalOf('found'),\n\t\tversion: isString,\n\t\tdependencies: andOf(isCollection, arrayOf(isDependency)),\n\t}),\n\trecordOf({\n\t\tname: isDependencyName,\n\t\tlookup: literalOf('missing', 'failed'),\n\t\tnote: isString,\n\t}),\n)\n\n/**\n * Narrow a value to a {@link Snapshot}.\n *\n * @param value - The candidate target snapshot.\n * @returns `true` for a bounded plain record whose every key is a path and\n * whose every value is exact lowercase hexadecimal bytes.\n *\n * @remarks\n * Read through the shared total key lens, so a hostile `ownKeys` trap and a\n * throwing accessor both answer `false` rather than escaping. There is no\n * dictionary combinator upstream to compose this from: the key law and the\n * value law are both this package's own.\n *\n * @example\n * ```ts\n * import { isSnapshot } from '@orkestrel/scaffold'\n *\n * isSnapshot({ 'AGENTS.md': '68690a' }) // true\n * isSnapshot({ 'AGENTS.md': 'hi' }) // false\n * ```\n */\nexport function isSnapshot(value: unknown): value is Snapshot {\n\treturn holds(() => {\n\t\tif (!isRecord(value)) return false\n\t\tconst keys = enumerableKeys(value)\n\t\tif (keys === undefined || keys.length > MAX_COLLECTION_ITEMS) return false\n\t\tfor (const key of keys) {\n\t\t\tif (!isPath(key) || !isHex(value[key])) return false\n\t\t}\n\t\treturn true\n\t})\n}\n\n/**\n * Narrow a value to the compiler's initial listener record.\n *\n * @remarks\n * Every event is optional and every declared value is a function. A key outside\n * the compiler's event map is refused, so a listener wired to a misspelled\n * event fails at construction instead of never firing.\n */\nexport const isCompilerHooks: Guard<EmitterHooks<CompilerEventMap>> = recordOf(\n\t{\n\t\tcompile: isFunction,\n\t\taudit: isFunction,\n\t\tblock: isFunction,\n\t\terror: isFunction,\n\t\tdestroy: isFunction,\n\t},\n\ttrue,\n)\n\n/**\n * Narrow a value to {@link CompilerOptions}.\n *\n * @example\n * ```ts\n * import { isCompilerOptions } from '@orkestrel/scaffold'\n *\n * isCompilerOptions({}) // true\n * isCompilerOptions({ retries: 2 }) // false\n * ```\n */\nexport const isCompilerOptions: Guard<CompilerOptions> = recordOf(\n\t{ on: isCompilerHooks, error: isFunction },\n\ttrue,\n)\n","import type { JSONValue } from '@orkestrel/contract'\nimport { attempt, cloneJSONValue } from '@orkestrel/contract'\n\n/**\n * Snapshot an untrusted value into exact JSON data the caller owns.\n *\n * @param value - The untrusted value to take ownership of.\n * @returns A deeply frozen copy sharing nothing with `value`, or `undefined`\n * when the value is not exact acyclic JSON data.\n *\n * @remarks\n * This fixes the order every boundary in this package reads a caller's value\n * in: snapshot first, then guard the snapshot. A guard reads `value[key]`, so a\n * property backed by an accessor can answer one thing while the guard runs and\n * another while the accepted value is used, and no guard closes that race from\n * inside. The snapshot closes it. The installed `cloneJSONValue` refuses any\n * property that is not an own enumerable data property, so an accessor never\n * reaches the guard at all, and it reads every value it keeps exactly once from\n * that property's descriptor. What the guard measures is what every later read\n * returns.\n *\n * The result is a frozen null-prototype record or a frozen intrinsic array, and\n * this package's guards accept both, so the snapshot passes `isBlueprint`,\n * `isSnapshot`, and the parsers derived from them unchanged.\n *\n * Ownership is refused rather than raised. A value carrying a function, an\n * `undefined`, a symbol key, a cycle, a non-finite number, or more nodes than\n * `@orkestrel/contract` admits answers `undefined`, which leaves each caller\n * free to decide what a refusal means — the compiler throws `INVALID`, the gate\n * asks a `Question` — and keeps `ScaffoldError` the only error this package\n * throws.\n *\n * The node ceiling is the installed package's `CLONE_NODE_LIMIT`, and it counts\n * every record, array, and leaf the snapshot would contain, so it bounds breadth\n * and depth together. This package declares no ceiling of its own beside it: a\n * local number no code here can enforce could only disagree with the one that\n * binds.\n *\n * @example\n * ```ts\n * import { cloneValue, parseBlueprint } from '@orkestrel/scaffold'\n *\n * const owned = parseBlueprint(cloneValue(input))\n * ```\n */\nexport function cloneValue(value: unknown): JSONValue | undefined {\n\tconst outcome = attempt(() => cloneJSONValue(value))\n\treturn outcome.success ? outcome.value : undefined\n}\n","import type { Blueprint, CompilerOptions, Group, Snapshot } from './types.js'\nimport { isBlueprint, isCompilerOptions, isGroups, isSnapshot } from './validators.js'\n\n/**\n * Coerce an untrusted value to a {@link Blueprint}.\n *\n * @param value - The value to parse.\n * @returns The blueprint, or `undefined` when the value is not one.\n *\n * @remarks\n * Derived from {@link isBlueprint}, which is what makes the pair sound in both\n * directions: a guard-valid value is returned unchanged, and every value this\n * returns satisfies that guard. The reference is returned rather than copied,\n * so a caller that means to own the value clones it.\n *\n * @example\n * ```ts\n * import { parseBlueprint } from '@orkestrel/scaffold'\n *\n * parseBlueprint({ name: 'router' }) // undefined\n * ```\n */\nexport function parseBlueprint(value: unknown): Blueprint | undefined {\n\treturn isBlueprint(value) ? value : undefined\n}\n\n/**\n * Coerce an untrusted value to a group selection.\n *\n * @param value - The value to parse.\n * @returns The selection, or `undefined` when the value is not one.\n *\n * @remarks\n * Derived from {@link isGroups}. Order and repetition are preserved: which\n * groups a plan finally covers, and in which order, is the compiler's to decide\n * from `GROUPS`, not this boundary's.\n *\n * @example\n * ```ts\n * import { parseGroups } from '@orkestrel/scaffold'\n *\n * parseGroups(['manifest', 'configs']) // ['manifest', 'configs']\n * parseGroups(['readme']) // undefined\n * ```\n */\nexport function parseGroups(value: unknown): readonly Group[] | undefined {\n\treturn isGroups(value) ? value : undefined\n}\n\n/**\n * Coerce an untrusted value to a {@link Snapshot}.\n *\n * @param value - The value to parse.\n * @returns The snapshot, or `undefined` when the value is not one.\n *\n * @remarks\n * Derived from {@link isSnapshot}.\n *\n * @example\n * ```ts\n * import { parseSnapshot } from '@orkestrel/scaffold'\n *\n * parseSnapshot({ 'AGENTS.md': '68690a' }) // { 'AGENTS.md': '68690a' }\n * parseSnapshot({ 'AGENTS.md': null }) // undefined\n * ```\n */\nexport function parseSnapshot(value: unknown): Snapshot | undefined {\n\treturn isSnapshot(value) ? value : undefined\n}\n\n/**\n * Coerce an untrusted value to {@link CompilerOptions}.\n *\n * @param value - The value to parse.\n * @returns The options, or `undefined` when the value is not an option bag.\n *\n * @remarks\n * Derived from {@link isCompilerOptions}. Absence is not an option bag, so\n * `undefined` in returns `undefined` out and a constructor reads that as the\n * defaults rather than as a refusal.\n *\n * @example\n * ```ts\n * import { parseCompilerOptions } from '@orkestrel/scaffold'\n *\n * parseCompilerOptions({ on: { compile: () => {} } }) // the same record\n * parseCompilerOptions({ on: { compiled: () => {} } }) // undefined\n * ```\n */\nexport function parseCompilerOptions(value: unknown): CompilerOptions | undefined {\n\treturn isCompilerOptions(value) ? value : undefined\n}\n","import type {\n\tArtifact,\n\tCatalogEntry,\n\tDependency,\n\tDrift,\n\tFinding,\n\tGroup,\n\tOwnership,\n\tPlan,\n\tPlanSummary,\n} from './types.js'\nimport { compareValues, isRecord, isString, limitEntries, parseJSON } from '@orkestrel/contract'\nimport {\n\tDEPENDENCY_NAME_PATTERN,\n\tENGINES_PATTERN,\n\tEXTRA_RANGE_PATTERN,\n\tGROUPS,\n\tMAX_COLLECTION_ITEMS,\n\tMAX_DEPENDENCY_NAME_LENGTH,\n\tMAX_MANIFEST_BYTES,\n\tMAX_RANGE_LENGTH,\n\tMINIMUM_NODE_VERSION,\n\tORCHESTRATION_PATH_NAMES,\n\tORCHESTRATION_PATH_PREFIXES,\n\tPRINT_WIDTH,\n\tTAB_WIDTH,\n\tVERSION_PATTERN,\n} from './constants.js'\n\n/**\n * Encode bytes as exact lowercase hexadecimal text.\n *\n * @param bytes - The bytes to encode.\n * @returns Two lowercase hexadecimal digits per input byte, and `''` for no bytes.\n *\n * @remarks\n * The encoding every byte claim in this package is stated in, so a plan, an\n * audit finding, and a snapshot all compare as text rather than as buffers.\n * `Uint8Array.prototype.toHex` is not available on the oldest Node this package\n * supports, so the digits are produced here.\n *\n * @example\n * ```ts\n * import { bytesToHex } from '@orkestrel/scaffold'\n *\n * bytesToHex(new Uint8Array([0x68, 0x69, 0x0a])) // '68690a'\n * ```\n */\nexport function bytesToHex(bytes: Uint8Array): string {\n\tlet hex = ''\n\tfor (const byte of bytes) hex += byte.toString(16).padStart(2, '0')\n\treturn hex\n}\n\n/**\n * Encode text as the exact lowercase hexadecimal form of its UTF-8 bytes.\n *\n * @param content - The text to encode.\n * @returns The hexadecimal form of the text's exact UTF-8 bytes.\n *\n * @remarks\n * This is the single conversion from an artifact's content to the bytes a\n * comparison is made against, so a template or computed artifact is measured in\n * the same units as a vendored one. Encoding is `TextEncoder`, which every\n * supported host provides, so core stays host-independent.\n *\n * @example\n * ```ts\n * import { contentToHex } from '@orkestrel/scaffold'\n *\n * contentToHex('hi\\n') // '68690a'\n * ```\n */\nexport function contentToHex(content: string): string {\n\treturn bytesToHex(new TextEncoder().encode(content))\n}\n\n/**\n * Count the UTF-8 bytes text encodes to.\n *\n * @param content - The text to measure.\n * @returns The exact number of UTF-8 bytes.\n *\n * @remarks\n * Counted rather than encoded, so measuring a value against a ceiling never\n * allocates the bytes it is about to refuse. An unpaired surrogate counts as\n * the three bytes `TextEncoder` writes for the replacement character, so the\n * count matches {@link contentToHex} for every string.\n *\n * @example\n * ```ts\n * import { computeBytes } from '@orkestrel/scaffold'\n *\n * computeBytes('hi\\n') // 3\n * computeBytes('€') // 3\n * ```\n */\nexport function computeBytes(content: string): number {\n\tlet bytes = 0\n\tfor (const character of content) {\n\t\tconst code = character.codePointAt(0) ?? 0\n\t\tbytes += code <= 0x7f ? 1 : code <= 0x7ff ? 2 : code <= 0xffff ? 3 : 4\n\t}\n\treturn bytes\n}\n\n/**\n * Compute the deterministic content identity of text.\n *\n * @param text - The text to digest.\n * @returns Sixteen lowercase hexadecimal digits.\n *\n * @remarks\n * The 64-bit FNV-1a fold over the text's UTF-16 code units, which is the\n * identity a pinned plan carries. It reads no clock and no randomness, so the\n * same text answers the same digits on every host and every run.\n *\n * It is an identity, not a security digest: it says two values are the same\n * value, never that nobody could have built a second value answering the same\n * digits. Core cannot do better synchronously — the only cryptographic digest a\n * host-independent scope reaches is `crypto.subtle`, which is asynchronous, and\n * the compiler is synchronous by contract.\n *\n * @example\n * ```ts\n * import { computeHash } from '@orkestrel/scaffold'\n *\n * computeHash('') // 'cbf29ce484222325'\n * ```\n */\nexport function computeHash(text: string): string {\n\tlet hash = 0xcbf29ce484222325n\n\tfor (let index = 0; index < text.length; index += 1) {\n\t\thash = BigInt.asUintN(64, (hash ^ BigInt(text.charCodeAt(index))) * 0x100000001b3n)\n\t}\n\treturn hash.toString(16).padStart(16, '0')\n}\n\n/**\n * Test whether a path instructs or wires an agent rather than the toolchain.\n *\n * @param path - The target-relative path to test.\n * @returns `true` when the path is beneath a harness directory or is one of the\n * exact root filenames that wires an agent bench.\n *\n * @remarks\n * The one home of the orchestration membership rule. A vendored path and a\n * foreign path found in a target are both classified through here, so a new\n * harness directory is admitted once in `ORCHESTRATION_PATH_PREFIXES` and every\n * caller follows.\n *\n * @example\n * ```ts\n * import { matchesOrchestrationPath } from '@orkestrel/scaffold'\n *\n * matchesOrchestrationPath('.claude/rules/names.md') // true\n * matchesOrchestrationPath('.mcp.json') // true\n * matchesOrchestrationPath('.oxlintrc.json') // false\n * ```\n */\nexport function matchesOrchestrationPath(path: string): boolean {\n\tif (ORCHESTRATION_PATH_NAMES.includes(path)) return true\n\treturn ORCHESTRATION_PATH_PREFIXES.some((prefix) => path.startsWith(prefix))\n}\n\n/**\n * Infer the {@link Group} a path belongs to.\n *\n * @param path - The target-relative path to classify.\n * @returns The group that owns the path.\n *\n * @remarks\n * A path is grouped by what it governs rather than by where it sits. The two\n * manifest files are named exactly; anything\n * {@link matchesOrchestrationPath} accepts is orchestration; `src` and `app`\n * are source; `tests`, `guides`, and `docs` carry their own names; the licence\n * and a root Markdown document are docs; and everything else is configuration.\n * A vendored path and a foreign path found in a target are classified here\n * alike, so the plan and the audit never disagree about what a path is.\n *\n * @example\n * ```ts\n * import { inferGroup } from '@orkestrel/scaffold'\n *\n * inferGroup('src/core/index.ts') // 'source'\n * inferGroup('AGENTS.md') // 'docs'\n * inferGroup('.editorconfig') // 'configs'\n * ```\n */\nexport function inferGroup(path: string): Group {\n\tif (path === 'package.json' || path === 'package-lock.json') return 'manifest'\n\tif (matchesOrchestrationPath(path)) return 'orchestration'\n\tif (path.startsWith('src/') || path.startsWith('app/')) return 'source'\n\tif (path.startsWith('tests/')) return 'tests'\n\tif (path.startsWith('guides/')) return 'guides'\n\tif (path.startsWith('docs/')) return 'docs'\n\t// The licence and the root instruction documents are the workspace's own prose.\n\tif (path === 'LICENSE') return 'docs'\n\tif (!path.includes('/') && path.endsWith('.md')) return 'docs'\n\treturn 'configs'\n}\n\n/**\n * Serialize one string as a single-quoted TypeScript literal.\n *\n * @param value - The string to serialize.\n * @returns A complete single-quoted literal with line-breaking and delimiter\n * characters escaped.\n *\n * @remarks\n * Configuration templates insert blueprint-derived strings into TypeScript.\n * Keeping this one serializer at that boundary prevents a name from becoming\n * syntax and preserves oxfmt's configured single-quote fixed point.\n *\n * @example\n * ```ts\n * import { serializeTypeScriptString } from '@orkestrel/scaffold'\n *\n * serializeTypeScriptString(\"it's\") // `'it\\\\'s'`\n * ```\n */\nexport function serializeTypeScriptString(value: string): string {\n\tlet serialized = \"'\"\n\tfor (let index = 0; index < value.length; index += 1) {\n\t\tconst code = value.charCodeAt(index)\n\t\tconst character = value.charAt(index)\n\t\tif (character === \"'\") serialized += \"\\\\'\"\n\t\telse if (character === '\\\\') serialized += '\\\\\\\\'\n\t\telse if (character === '\\b') serialized += '\\\\b'\n\t\telse if (character === '\\f') serialized += '\\\\f'\n\t\telse if (character === '\\n') serialized += '\\\\n'\n\t\telse if (character === '\\r') serialized += '\\\\r'\n\t\telse if (character === '\\t') serialized += '\\\\t'\n\t\telse if (code === 0x2028) serialized += '\\\\u2028'\n\t\telse if (code === 0x2029) serialized += '\\\\u2029'\n\t\telse if (code < 0x20 || (code >= 0xd800 && code <= 0xdfff)) {\n\t\t\tconst next = value.charCodeAt(index + 1)\n\t\t\tif (code >= 0xd800 && code <= 0xdbff && next >= 0xdc00 && next <= 0xdfff) {\n\t\t\t\tserialized += `${character}${value.charAt(index + 1)}`\n\t\t\t\tindex += 1\n\t\t\t} else serialized += `\\\\u${code.toString(16).padStart(4, '0')}`\n\t\t} else serialized += character\n\t}\n\treturn `${serialized}'`\n}\n\n/**\n * Derive the guide mirror path a package name answers for.\n *\n * @param name - A bare or `@orkestrel`-scoped package name.\n * @returns The mirror path, `guides/<bare name>.md`.\n *\n * @remarks\n * The single shape of a mirror path, read by the fetch that fills one and by\n * the plan that leaves the target's own guide out of its host set. Only the\n * segment after the final `/` is used, so the scope never reaches the path.\n * Whether the derived path is safe to write is `isPath`'s answer and the gate's,\n * which is why `DEPENDENCY_NAME_PATTERN` closes the name to a bare scoped one\n * before it ever arrives here.\n *\n * @example\n * ```ts\n * import { nameToGuide } from '@orkestrel/scaffold'\n *\n * nameToGuide('@orkestrel/router') // 'guides/router.md'\n * nameToGuide('scaffold') // 'guides/scaffold.md'\n * ```\n */\nexport function nameToGuide(name: string): string {\n\treturn `guides/${name.slice(name.lastIndexOf('/') + 1)}.md`\n}\n\n/**\n * Test whether one emitted line fits the vendored formatter width.\n *\n * @param line - One emitted line, leading tabs included.\n * @returns `true` when the expanded line fits.\n *\n * @remarks\n * A generator writes source the formatter then reads back, so a line packed\n * past the vendored width is rewrapped on the next `format` run and the emitted\n * bytes stop matching the plan the audit compares against. The generator\n * therefore measures a candidate line and chooses the shape the formatter would\n * have chosen. Tabs are expanded first because the formatter counts them as\n * `TAB_WIDTH` columns rather than as one character.\n *\n * @example\n * ```ts\n * import { matchesPrintWidth } from '@orkestrel/scaffold'\n *\n * matchesPrintWidth('\\t\\tprojects: [core],') // true\n * ```\n */\nexport function matchesPrintWidth(line: string): boolean {\n\treturn line.replaceAll('\\t', ' '.repeat(TAB_WIDTH)).length <= PRINT_WIDTH\n}\n\n/**\n * Derive the declaration rewrite a published face's `beforeWriteFile` applies.\n *\n * @param name - The workspace's own bare package name.\n * @returns The ternary consequent an emitted `vite.{browser,server}.config.ts`\n * fills its `{{replacement}}` span with, indented for that span.\n *\n * @remarks\n * `vite-plugin-dts` rolls a face into one declaration and keeps each source\n * module's own relative depth, so a nested module emits a path that escapes\n * `dist/src` and a flat one resolves only by luck. Both faces rewrite the same\n * relative core path to the package's published root export, so the branch is\n * derived once here. The extension alternation is what the two permitted import\n * spellings produce: an `@src/core` alias resolves to the core source module and\n * prints `.ts`, while a relative import prints the `.js` specifier it was\n * written with. The formatter keeps the call on one line only while the line it\n * prints measures inside the vendored width, and the workspace name is what\n * varies, so the shape is chosen by measuring the candidate: a tab prints as the\n * vendored two columns, and the gate admits a name long enough to push the\n * joined call past 100.\n *\n * @example\n * ```ts\n * import { nameToRewrite } from '@orkestrel/scaffold'\n *\n * nameToRewrite('router').includes(\"'@orkestrel/router'\") // true\n * ```\n */\nexport function nameToRewrite(name: string): string {\n\tconst specifier = serializeTypeScriptString(`@orkestrel/${name}`)\n\tconst pattern = '/(?:\\\\.\\\\.\\\\/)+core\\\\/index\\\\.[jt]s/g'\n\tconst joined = `\\t\\t\\t\\t\\t\\t? content.replaceAll(${pattern}, ${specifier})`\n\tif (matchesPrintWidth(joined)) return joined\n\treturn [\n\t\t'\\t\\t\\t\\t\\t\\t? content.replaceAll(',\n\t\t`\\t\\t\\t\\t\\t\\t\\t\\t${pattern},`,\n\t\t`\\t\\t\\t\\t\\t\\t\\t\\t${specifier},`,\n\t\t'\\t\\t\\t\\t\\t\\t\\t)',\n\t].join('\\n')\n}\n\n/**\n * Select the host paths a named workspace vendors.\n *\n * @param paths - The candidate host paths, in their declared order.\n * @param name - The target workspace's own bare package name.\n * @returns Every candidate except the workspace's own guide, in input order.\n *\n * @remarks\n * `HOST_PATHS` is a candidate set rather than a plan, because a workspace never\n * mirrors its own guide: that file is the workspace's own product, and vendoring\n * it would have the target overwrite its guide with the copy it published.\n *\n * @example\n * ```ts\n * import { HOST_PATHS, selectHostPaths } from '@orkestrel/scaffold'\n *\n * selectHostPaths(HOST_PATHS, 'scaffold').includes('guides/scaffold.md') // false\n * ```\n */\nexport function selectHostPaths(paths: readonly string[], name: string): readonly string[] {\n\tconst guide = nameToGuide(name)\n\treturn paths.filter((path) => path !== guide)\n}\n\n/**\n * Select the groups a compile covers, in plan order.\n *\n * @param groups - The requested selection; every group when absent.\n * @returns The requested groups in `GROUPS` order, without repeats.\n *\n * @remarks\n * A caller's selection is data, so it arrives in whatever order and with\n * whatever repeats the caller wrote. Plan order is this package's, so the\n * selection is read as membership and the order comes from `GROUPS`. An empty\n * selection covers nothing, which is a caller asking for an empty plan rather\n * than a caller asking for everything.\n *\n * @example\n * ```ts\n * import { selectGroups } from '@orkestrel/scaffold'\n *\n * selectGroups(['tests', 'manifest', 'tests']) // ['manifest', 'tests']\n * selectGroups() // every group, in plan order\n * ```\n */\nexport function selectGroups(groups?: readonly Group[]): readonly Group[] {\n\tconst selection = groups ?? GROUPS\n\treturn GROUPS.filter((group) => selection.includes(group))\n}\n\n/**\n * Project an artifact to the exact bytes it claims, as hexadecimal.\n *\n * @param artifact - The planned artifact to read.\n * @returns The claimed bytes, or `undefined` when the artifact claims none.\n *\n * @remarks\n * A hydrated artifact carries its vendored source's bytes directly; a template\n * or computed artifact carries text, which is encoded here. An unhydrated host\n * artifact claims no bytes at all, and answers `undefined` rather than an empty\n * string, because no bytes and no content are different facts.\n *\n * @example\n * ```ts\n * import { artifactToHex } from '@orkestrel/scaffold'\n *\n * artifactToHex({\n * \tpath: 'README.md',\n * \tgroup: 'docs',\n * \townership: 'birth',\n * \torigin: 'template',\n * \tcontent: 'hi\\n',\n * }) // '68690a'\n * ```\n */\nexport function artifactToHex(artifact: Artifact): string | undefined {\n\tif (artifact.origin !== 'host') return contentToHex(artifact.content)\n\treturn artifact.hex\n}\n\n/**\n * Infer how one target path compares to the artifact planned for it.\n *\n * @param artifact - The planned artifact.\n * @param observed - The destination's exact bytes as hexadecimal; absent when\n * the destination holds no file.\n * @returns `aligned`, `stale`, or `missing`.\n *\n * @remarks\n * Ownership decides the comparison and nothing else does. A `birth`-owned\n * artifact is never compared and is always aligned, so a file the workspace has\n * outgrown is never reported as drift. A `presence`-owned artifact compares\n * existence only. A `content`-owned artifact compares bytes, and it always\n * carries the bytes to compare, so the comparison can always be made.\n *\n * `foreign` is not answerable here: it describes a path the plan does not own,\n * so no artifact exists to pass in.\n *\n * @example\n * ```ts\n * import type { Artifact } from '@orkestrel/scaffold'\n * import { inferDrift } from '@orkestrel/scaffold'\n *\n * const artifact: Artifact = {\n * \tpath: 'README.md',\n * \tgroup: 'docs',\n * \townership: 'content',\n * \torigin: 'computed',\n * \tcontent: 'hi\\n',\n * }\n *\n * inferDrift(artifact, '68690a') // 'aligned'\n * inferDrift(artifact, '6279650a') // 'stale'\n * inferDrift(artifact) // 'missing'\n * ```\n */\nexport function inferDrift(artifact: Artifact, observed?: string): Exclude<Drift, 'foreign'> {\n\tif (artifact.ownership === 'birth') return 'aligned'\n\tif (observed === undefined) return 'missing'\n\tif (artifact.ownership === 'presence') return 'aligned'\n\treturn observed === artifactToHex(artifact) ? 'aligned' : 'stale'\n}\n\n/**\n * Test whether {@link inferDrift} could have produced a finding for an ownership.\n *\n * @param ownership - What scaffold claims at the planned path.\n * @param finding - The audit verdict to test.\n * @returns Whether the ownership and verdict are reachable through {@link inferDrift}.\n *\n * @remarks\n * This predicate keeps the comparison law beside the reachability law it\n * restates. A mutation uses it so a refusal can distinguish an impossible\n * verdict from a target that genuinely moved after its audit.\n */\nexport function matchesDriftReachability(ownership: Ownership, finding: Finding): boolean {\n\tif (finding.drift === 'aligned') return ownership === 'birth' || finding.observed !== undefined\n\tif (finding.drift === 'missing') return ownership !== 'birth'\n\treturn finding.drift === 'stale' && ownership === 'content'\n}\n\n/**\n * Project a catalog into the layers it publishes in.\n *\n * @param entries - The catalog rows to order.\n * @returns One layer per round, each holding the names publishable together,\n * sorted within the layer; a name whose edges never resolve is omitted.\n *\n * @remarks\n * A layer is a deterministic function of the catalog's own edges, so it is\n * computed here rather than stored on a row that could disagree with them.\n * Only RUNTIME edges between catalogued packages count: a development\n * dependency reaches no consumer, so it constrains nothing about publish order,\n * and an edge leaving the fleet is a package this catalog does not publish.\n *\n * The order matters because these packages are `0.0.x`, where a caret pins one\n * exact release. Publishing a dependent before its dependency leaves the\n * dependent pinned to the older release, and two ranges that disagree install\n * two copies of one package that the compiler reads as two distinct types.\n *\n * A cycle cannot be published in rounds, so its members are omitted rather than\n * placed in an order that would be wrong. An absent name is the report: compare\n * the returned names against the catalog to find one.\n *\n * @example\n * ```ts\n * import { catalogToLayers } from '@orkestrel/scaffold'\n *\n * catalogToLayers(entries)[0] // the names that depend on nothing in the fleet\n * ```\n */\nexport function catalogToLayers(\n\tentries: readonly CatalogEntry[],\n): ReadonlyArray<readonly string[]> {\n\tconst published = new Set(\n\t\tentries.filter((entry) => entry.lookup === 'found').map((entry) => entry.name),\n\t)\n\tconst pending = new Map<string, Set<string>>()\n\tfor (const entry of entries) {\n\t\tif (entry.lookup !== 'found') continue\n\t\tconst edges = entry.dependencies.map((dependency) => dependency.name)\n\t\tpending.set(entry.name, new Set(edges.filter((name) => published.has(name))))\n\t}\n\tconst layers: string[][] = []\n\twhile (pending.size > 0) {\n\t\tconst ready = [...pending].filter(([, edges]) => edges.size === 0).map(([name]) => name)\n\t\tif (ready.length === 0) break\n\t\tfor (const name of ready) pending.delete(name)\n\t\tfor (const edges of pending.values()) for (const name of ready) edges.delete(name)\n\t\tlayers.push(ready.sort())\n\t}\n\treturn layers\n}\n\n/**\n * Project a plan into its tally by artifact origin.\n *\n * @param plan - The plan to summarize.\n * @returns The workspace's name, both environment axes, the covered groups, and\n * one count per origin.\n *\n * @remarks\n * Lossy on purpose: the summary is what a report prints, and it holds nothing a\n * caller could mistake for the plan itself. The counts are derived on each call\n * rather than stored on the plan, so they cannot disagree with the artifacts\n * beside them.\n *\n * @example\n * ```ts\n * import { planToSummary } from '@orkestrel/scaffold'\n *\n * planToSummary(plan).computed // the number of computed artifacts\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\tsrc: plan.blueprint.src,\n\t\tapp: plan.blueprint.app,\n\t\tgroups: plan.groups,\n\t\thost,\n\t\ttemplate,\n\t\tcomputed,\n\t}\n}\n\n/**\n * Extract the three numeric components of an exact version.\n *\n * @param version - The candidate version text.\n * @returns The major, minor, and patch numbers, or `undefined` when the text is\n * not the exact three-component syntax.\n *\n * @remarks\n * Deliberately narrow: a prerelease or build suffix is not extracted, because\n * this package compares released versions and refusing to read one is honest\n * where guessing its precedence would not be.\n *\n * @example\n * ```ts\n * import { extractVersion } from '@orkestrel/scaffold'\n *\n * extractVersion('0.0.23') // [0, 0, 23]\n * extractVersion('1.2.3-beta.1') // undefined\n * ```\n */\nexport function extractVersion(\n\tversion: string,\n): readonly [major: number, minor: number, patch: number] | undefined {\n\tif (!VERSION_PATTERN.test(version)) return undefined\n\tconst [major, minor, patch] = version.split('.').map((component) => Number(component))\n\tif (major === undefined || minor === undefined || patch === undefined) return undefined\n\treturn [major, minor, patch]\n}\n\n/**\n * Compare two versions by their numeric components.\n *\n * @param left - The version ordered first when it compares lower.\n * @param right - The version compared against.\n * @returns `-1`, `1`, or `0` as `left` sorts before, after, or with `right`.\n *\n * @remarks\n * Major, then minor, then patch, each compared as a number so `0.0.10` sorts\n * above `0.0.9`. The function is total: a version this package cannot read\n * sorts below one it can, and two unreadable versions fall back to a code-unit\n * comparison, so an ordering is never decided by which side failed to parse.\n *\n * @example\n * ```ts\n * import { compareVersions } from '@orkestrel/scaffold'\n *\n * compareVersions('0.0.9', '0.0.10') // -1\n * compareVersions('1.2.3', '1.2.3') // 0\n * ```\n */\nexport function compareVersions(left: string, right: string): number {\n\tconst first = extractVersion(left)\n\tconst second = extractVersion(right)\n\tif (first === undefined || second === undefined) {\n\t\tif (first !== undefined) return 1\n\t\tif (second !== undefined) return -1\n\t\treturn compareValues(left, right)\n\t}\n\tfor (let index = 0; index < first.length; index += 1) {\n\t\tconst order = compareValues(first[index] ?? 0, second[index] ?? 0)\n\t\tif (order !== 0) return order\n\t}\n\treturn 0\n}\n\n/**\n * Test whether a declared range already admits a published version.\n *\n * @param range - The declared dependency range.\n * @param latest - The version the registry reported as latest.\n * @returns `true` when the range admits that version.\n *\n * @remarks\n * The one place this comparison is made. A `Release` records the declared range\n * and the reported version and stores no verdict beside them, because a stored\n * verdict could only disagree with the two fields it sits next to.\n *\n * Readability is decided first, and it is `EXTRA_RANGE_PATTERN`: an optional\n * caret or tilde over three numeric components and an optional prerelease\n * suffix. That pattern already covers every `ORKESTREL_RANGE_PATTERN` range and\n * every `VERSION_PATTERN` version, so the subset is stated once rather than\n * assembled here. Text outside it is never admitted, including text handed in on\n * both sides, so an unreadable declaration surfaces as work instead of matching\n * itself.\n *\n * The accepted subset is the one that pattern admits: an exact pin, a tilde\n * range, and a caret range. An exact pin is satisfied by that version alone. A\n * tilde range holds the minor and admits a later patch. A caret range holds the\n * leading nonzero component, which is why `^0.0.5` is an exact pin and `^0.5.3`\n * admits `0.5.4` but not `0.6.0`.\n *\n * Identity is the door a prerelease passes through, and the only one: this\n * package does not order prerelease precedence, so `1.2.3-beta.1` is satisfied\n * by that exact string and by nothing else. The version side needs no separate\n * readability test, because identity already proves it equals a readable\n * declaration and every other branch reads it through {@link extractVersion}.\n *\n * @example\n * ```ts\n * import { matchesRange } from '@orkestrel/scaffold'\n *\n * matchesRange('^0.0.5', '0.0.5') // true\n * matchesRange('^0.0.5', '0.0.7') // false\n * matchesRange('~8.2.0', '8.2.4') // true\n * matchesRange('^7.58.12', '7.60.0') // true\n * matchesRange('not-a-range', 'not-a-range') // false\n * ```\n */\nexport function matchesRange(range: string, latest: string): boolean {\n\tif (!EXTRA_RANGE_PATTERN.test(range)) return false\n\tconst operator = range.startsWith('^') || range.startsWith('~') ? range.slice(0, 1) : ''\n\tconst declared = range.slice(operator.length)\n\tif (declared === latest) return true\n\tif (operator === '') return false\n\tconst left = extractVersion(declared)\n\tconst right = extractVersion(latest)\n\tif (left === undefined || right === undefined) return false\n\tif (left[0] !== right[0]) return false\n\tif (operator === '^' && left[0] === 0 && left[1] === 0) return false\n\tif ((operator === '~' || left[0] === 0) && left[1] !== right[1]) return false\n\treturn compareVersions(latest, declared) >= 0\n}\n\n/**\n * Test whether a declared engines floor is at or above the supported minimum.\n *\n * @param engines - The declared `engines.node` range.\n * @returns `true` when the range is the accepted syntax and its floor is at or\n * above `MINIMUM_NODE_VERSION`.\n *\n * @remarks\n * The declaration states a floor, so the comparison is against the oldest Node\n * the generated toolchain supports rather than against a published version. The\n * `>=` prefix is read here, so no caller repeats the offset.\n *\n * @example\n * ```ts\n * import { matchesEngines } from '@orkestrel/scaffold'\n *\n * matchesEngines('>=22.12.0') // true\n * matchesEngines('>=20.0.0') // false\n * matchesEngines('22.12.0') // false\n * ```\n */\nexport function matchesEngines(engines: string): boolean {\n\tif (!ENGINES_PATTERN.test(engines)) return false\n\treturn compareVersions(engines.slice(2), MINIMUM_NODE_VERSION) >= 0\n}\n\n/**\n * Project a package manifest's text to its own name.\n *\n * @param manifest - The `package.json` text.\n * @returns The declared name, or `undefined` when the text is oversized,\n * malformed, not an object, or carries no bounded string name.\n *\n * @remarks\n * Never throws: a manifest is a file a target owns, so unreadable is an answer\n * rather than a fault. The name is bounded by the registry's own package-name\n * ceiling, because it reaches a path through {@link nameToGuide}.\n *\n * @example\n * ```ts\n * import { manifestToName } from '@orkestrel/scaffold'\n *\n * manifestToName('{\"name\":\"@orkestrel/router\"}') // '@orkestrel/router'\n * manifestToName('{') // undefined\n * ```\n */\nexport function manifestToName(manifest: string): string | undefined {\n\tif (computeBytes(manifest) > MAX_MANIFEST_BYTES) return undefined\n\tconst parsed = parseJSON(manifest)\n\tif (!isRecord(parsed)) return undefined\n\tconst name = parsed.name\n\tif (!isString(name) || name.length === 0 || name.length > MAX_DEPENDENCY_NAME_LENGTH) {\n\t\treturn undefined\n\t}\n\treturn name\n}\n\n/**\n * Project a package manifest's text to the `@orkestrel/*` packages it declares.\n *\n * @param manifest - The `package.json` text.\n * @returns One dependency per declared `@orkestrel` package, in section order,\n * with the first declaration of a repeated name winning.\n *\n * @remarks\n * Runtime, development, and peer sections are read in that order, because a\n * package the fleet publishes is upstream of this workspace wherever it is\n * declared. Every other name is skipped rather than refused: a workspace's\n * unrelated dependencies are not this package's to report on.\n *\n * Never throws, and every row it returns satisfies `isDependency` while the\n * list satisfies `isCollection`, so the result crosses the compiler's own\n * boundary without a second cleaning.\n *\n * @example\n * ```ts\n * import { manifestToDependencies } from '@orkestrel/scaffold'\n *\n * manifestToDependencies('{\"dependencies\":{\"@orkestrel/emitter\":\"^0.0.5\",\"vite\":\"~8.2.0\"}}')\n * // [{ name: '@orkestrel/emitter', range: '^0.0.5' }]\n * ```\n */\nexport function manifestToDependencies(manifest: string): readonly Dependency[] {\n\tif (computeBytes(manifest) > MAX_MANIFEST_BYTES) return []\n\tconst parsed = parseJSON(manifest)\n\tif (!isRecord(parsed)) return []\n\tconst dependencies: Dependency[] = []\n\tconst seen = new Set<string>()\n\tfor (const section of ['dependencies', 'devDependencies', 'peerDependencies']) {\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 (seen.has(name)) continue\n\t\t\tif (!DEPENDENCY_NAME_PATTERN.test(name) || name.length > MAX_DEPENDENCY_NAME_LENGTH) continue\n\t\t\tif (!isString(range) || range.length === 0 || range.length > MAX_RANGE_LENGTH) continue\n\t\t\tseen.add(name)\n\t\t\tdependencies.push({ name, range })\n\t\t}\n\t}\n\treturn limitEntries(dependencies, MAX_COLLECTION_ITEMS)\n}\n","import type {\n\tArtifact,\n\tBuildFormat,\n\tBlueprint,\n\tContentArtifact,\n\tDependency,\n\tEnvironment,\n\tFinding,\n\tOverride,\n\tPlan,\n\tQuestion,\n\tSnapshot,\n\tViteMachinery,\n} from './types.js'\nimport { attempt, canonicalStringify, compareValues, sortValues } from '@orkestrel/contract'\nimport { fillTemplate } from '@orkestrel/template'\nimport {\n\tAPP_BROWSER_DEV_DEPENDENCIES,\n\tAPP_DEV_DEPENDENCIES,\n\tAPP_MATRIX,\n\tAPP_SERVER_DEV_DEPENDENCIES,\n\tBASE_DEV_DEPENDENCIES,\n\tBIN_CONFIGS,\n\tBIN_ENTRY_PATH,\n\tDECLARATION_DEV_DEPENDENCIES,\n\tDEPENDENCY_NAME_PATTERN,\n\tENVIRONMENTS,\n\tEXTRA_NAME_PATTERN,\n\tEXTRA_RANGE_PATTERN,\n\tGLOBAL_SETUP_PATH,\n\tHOST_PATHS,\n\tINTEGRATION_TEST_PATH,\n\tMAX_ARTIFACT_BYTES,\n\tMAX_COLLECTION_ITEMS,\n\tMAX_TOTAL_ARTIFACT_BYTES,\n\tNAME_PATTERN,\n\tORKESTREL_RANGE_PATTERN,\n\tSERVICE_SCRIPT_PATH,\n\tSERVICE_SETUP_PATH,\n\tSHOWCASE_CONFIG_PATH,\n\tSHOWCASE_DEV_DEPENDENCIES,\n\tSOURCE_BROWSER_DEV_DEPENDENCIES,\n\tSRC_MATRIX,\n\tVERSION_PATTERN,\n} from './constants.js'\nimport {\n\tcomputeBytes,\n\tcomputeHash,\n\tinferDrift,\n\tinferGroup,\n\tmatchesEngines,\n\tmatchesPrintWidth,\n\tnameToRewrite,\n\tserializeTypeScriptString,\n\tselectHostPaths,\n} from './helpers.js'\nimport { ARTIFACT_TEMPLATES, CONFIG_TEMPLATES } from './templates.js'\n\n/**\n * Select the single published environment a package root points at.\n *\n * @param src - The declared published environments.\n * @returns That environment, or `undefined` when the selection declares none or\n * several.\n *\n * @remarks\n * A workspace publishing exactly one environment puts it at the package root,\n * so its entry fields and its `'.'` export condition both name that\n * environment's build. A workspace publishing several puts core at the root and\n * gives every other environment a subpath, so there is no single root to name.\n * Both callers read the same answer, which is why the branch is decided once\n * here rather than twice.\n *\n * @example\n * ```ts\n * import { srcToRoot } from '@orkestrel/scaffold'\n *\n * srcToRoot(['browser']) // 'browser'\n * srcToRoot(['core', 'server']) // undefined\n * ```\n */\nexport function srcToRoot(src: readonly Environment[]): Environment | undefined {\n\tif (src.length !== 1) return undefined\n\treturn src[0]\n}\n\n/**\n * Build one `exports` condition block for a built environment.\n *\n * @param path - The extensionless `dist` path both conditions point at.\n * @param formats - The module formats that environment builds.\n * @returns The condition block: an `import` condition always, and a `require`\n * condition only where a CommonJS build exists.\n *\n * @remarks\n * The formats decide the shape, so no caller repeats the rule. An environment\n * that builds ES only publishes an `import` condition alone rather than a\n * `default` one, because a `default` condition answers `require` too and would\n * hand a CommonJS consumer a module its loader cannot read.\n *\n * @example\n * ```ts\n * import { pathToCondition } from '@orkestrel/scaffold'\n *\n * pathToCondition('./dist/src/browser/index', ['es'])\n * // { import: { types: './dist/src/browser/index.d.ts', default: './dist/src/browser/index.js' } }\n * ```\n */\nexport function pathToCondition(\n\tpath: string,\n\tformats: readonly BuildFormat[],\n): Readonly<Record<string, unknown>> {\n\tconst module = { types: `${path}.d.ts`, default: `${path}.js` }\n\tif (!formats.includes('cjs')) return { import: module }\n\treturn { import: module, require: { types: `${path}.d.cts`, default: `${path}.cjs` } }\n}\n\n/**\n * Project a published selection into the manifest's entry fields.\n *\n * @param src - The declared published environments.\n * @returns The `main` and `module` fields, plus `types` when one environment\n * owns the package root.\n *\n * @remarks\n * `main` follows the root environment's own formats, so an environment that\n * builds ES only points both fields at the same file rather than promising a\n * CommonJS build that never runs. A selection with several environments carries\n * no top-level `types`, because each environment declares its own under its\n * subpath and a single top-level field could only name one of them.\n *\n * @example\n * ```ts\n * import { srcToEntry } from '@orkestrel/scaffold'\n *\n * srcToEntry(['core']).main // './dist/src/core/index.cjs'\n * srcToEntry(['browser']).main // './dist/src/browser/index.js'\n * ```\n */\nexport function srcToEntry(src: readonly Environment[]): {\n\treadonly main: string\n\treadonly module: string\n\treadonly types?: string\n} {\n\tconst root = srcToRoot(src)\n\tconst environment = root ?? 'core'\n\tconst base = `./dist/src/${environment}/index`\n\tconst main = SRC_MATRIX[environment].formats.includes('cjs') ? `${base}.cjs` : `${base}.js`\n\tif (root === undefined) return { main, module: `${base}.js` }\n\treturn { main, module: `${base}.js`, types: `${base}.d.ts` }\n}\n\n/**\n * Project a published selection into the manifest's `exports` map.\n *\n * @param src - The declared published environments.\n * @returns The map, keyed by subpath in `ENVIRONMENTS` order.\n *\n * @remarks\n * One environment owns the package root and every other declared environment\n * takes the subpath its `SRC_MATRIX` row names, so the map never invents a\n * subpath. `./package.json` is published alongside, which is what lets a\n * consumer's tooling read the manifest of a package whose exports are otherwise\n * closed. A selection publishing nothing answers an empty map rather than a\n * core-rooted one, because a workspace with no published environment declares\n * no exports at all.\n *\n * @example\n * ```ts\n * import { srcToExports } from '@orkestrel/scaffold'\n *\n * Object.keys(srcToExports(['core', 'server'])) // ['.', './server', './package.json']\n * srcToExports([]) // {}\n * ```\n */\nexport function srcToExports(src: readonly Environment[]): Readonly<Record<string, unknown>> {\n\tif (src.length === 0) return {}\n\tconst map: Record<string, unknown> = {}\n\tconst root = srcToRoot(src)\n\tconst environment = root ?? 'core'\n\tmap['.'] = pathToCondition(`./dist/src/${environment}/index`, SRC_MATRIX[environment].formats)\n\tif (root === undefined) {\n\t\tfor (const declared of ENVIRONMENTS) {\n\t\t\tif (declared === 'core' || !src.includes(declared)) continue\n\t\t\tconst row = SRC_MATRIX[declared]\n\t\t\tmap[row.path] = pathToCondition(`./dist/src/${declared}/index`, row.formats)\n\t\t}\n\t}\n\tmap['./package.json'] = './package.json'\n\treturn map\n}\n\n/**\n * Project a blueprint into the development dependencies its manifest declares.\n *\n * @param blueprint - The workspace specification.\n * @returns The merged set, sorted by package name.\n *\n * @remarks\n * The shared toolchain is the baseline every generated workspace carries, and\n * each declared axis adds the set its host needs. A declared extra or peer is\n * applied after those, so a workspace that pins a range for a package the\n * conditional sets also name gets the range it declared. An extra that restates\n * a shared toolchain pin never reaches here, because the gate refuses it.\n *\n * A peer is declared here as well as under `peerDependencies`, because a peer is\n * not installed by the workspace that declares it and developing against one\n * requires it present. A runtime dependency is the opposite case and is removed:\n * it is already installed, so a second declaration would state one fact twice\n * and the two ranges would be free to disagree.\n *\n * A workspace never declares itself, so its own package name is removed. That\n * matters for a workspace named after a package the baseline already carries:\n * the baseline is a list of what a workspace consumes, and a workspace does not\n * consume itself.\n *\n * @example\n * ```ts\n * import { blueprintToDevDependencies, createBlueprint } from '@orkestrel/scaffold'\n *\n * const blueprint = createBlueprint('router', { src: ['core'] })\n *\n * blueprintToDevDependencies(blueprint).typescript // the shared TypeScript pin\n * ```\n */\nexport function blueprintToDevDependencies(blueprint: Blueprint): Readonly<Record<string, string>> {\n\tconst merged: Record<string, string> = {\n\t\t...BASE_DEV_DEPENDENCIES,\n\t\t...(blueprint.src.length > 0 || blueprint.bin ? DECLARATION_DEV_DEPENDENCIES : {}),\n\t\t...(blueprint.src.includes('browser') ? SOURCE_BROWSER_DEV_DEPENDENCIES : {}),\n\t\t...(blueprint.app.length > 0 ? APP_DEV_DEPENDENCIES : {}),\n\t\t...(blueprint.app.includes('browser') ? APP_BROWSER_DEV_DEPENDENCIES : {}),\n\t\t...(blueprint.showcase && blueprint.app.includes('browser') ? SHOWCASE_DEV_DEPENDENCIES : {}),\n\t\t...(blueprint.app.includes('server') ? APP_SERVER_DEV_DEPENDENCIES : {}),\n\t}\n\tfor (const extra of blueprint.extras) merged[extra.name] = extra.range\n\tfor (const peer of blueprint.peers) merged[peer.name] = peer.range\n\tconst own = blueprint.src.length > 0 ? `@orkestrel/${blueprint.name}` : blueprint.name\n\tconst runtime = new Set(blueprint.dependencies.map((dependency) => dependency.name))\n\treturn Object.fromEntries(\n\t\tObject.entries(merged)\n\t\t\t.filter(([name]) => name !== own && !runtime.has(name))\n\t\t\t.sort(([left], [right]) => compareValues(left, right)),\n\t)\n}\n\n/**\n * Project a blueprint into the scripts its manifest declares.\n *\n * @param blueprint - The workspace specification.\n * @returns The scripts, in the order the manifest lists them.\n *\n * @remarks\n * Each script is the workspace-level contract the repository rules fix, narrowed\n * to the axes the blueprint declares: a check and a test script per declared\n * environment, an aggregate over each axis, the policy and configuration\n * proofs every workspace can pass before it has a public API, and one build per\n * target that actually builds.\n *\n * A publishing workspace isolates distribution and live-service proofs from\n * `test` and runs them from `prepublishOnly` instead. A private workspace has\n * no publish lifecycle, so it omits distribution and runs a live-service proof\n * from `test`. Integration and conformance stay in `test` because they neither\n * pack nor install the workspace and drive no external service. A conformance\n * run may start a server, but it starts its own and reaches it over loopback,\n * so the run stays hermetic.\n *\n * The configuration paths interpolated here are the same ones `SRC_MATRIX` and\n * `APP_MATRIX` list as each environment's configuration files, so a rename in\n * either matrix is a rename in both places.\n *\n * @example\n * ```ts\n * import { blueprintToScripts, createBlueprint } from '@orkestrel/scaffold'\n *\n * const blueprint = createBlueprint('router', { src: ['core'] })\n *\n * blueprintToScripts(blueprint)['format:check'] // 'oxfmt --config .oxfmtrc.json --check .'\n * ```\n */\nexport function blueprintToScripts(blueprint: Blueprint): Readonly<Record<string, string>> {\n\tconst publishes = blueprint.src.length > 0\n\t// Distribution requires the published source it packs, so the declared flag\n\t// alone never selects it.\n\tconst distributes = blueprint.distribution && publishes\n\tconst integrates = blueprint.integration\n\tconst compiles = publishes || blueprint.bin\n\tconst runtime = blueprint.app.filter((environment) => environment !== 'core')\n\tconst vitest = 'vitest run --config vite.config.ts --no-cache --reporter=dot'\n\tconst scripts: Record<string, string> = {\n\t\tclean: \"node -e \\\"require('node:fs').rmSync('dist',{recursive:true,force:true})\\\"\",\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\tformat: 'oxfmt --config .oxfmtrc.json --write .',\n\t\t'format:check': 'oxfmt --config .oxfmtrc.json --check .',\n\t\tlint: 'oxlint --config .oxlintrc.json --fix .',\n\t\t'lint:check': 'oxlint --config .oxlintrc.json --deny-warnings .',\n\t\tcheck: [\n\t\t\t'tsc --noEmit --project tsconfig.json',\n\t\t\t...(compiles ? ['npm run check:src'] : []),\n\t\t\t...(blueprint.app.length > 0 ? ['npm run check:app'] : []),\n\t\t].join(' && '),\n\t}\n\tif (compiles) {\n\t\tscripts['check:src'] = [\n\t\t\t...blueprint.src.map((environment) => `npm run check:src:${environment}`),\n\t\t\t...(blueprint.bin ? ['npm run check:src:bin'] : []),\n\t\t].join(' && ')\n\t\tfor (const environment of blueprint.src) {\n\t\t\tscripts[`check:src:${environment}`] =\n\t\t\t\t`tsc --noEmit -p configs/src/tsconfig.${environment}.json`\n\t\t}\n\t\tif (blueprint.bin) scripts['check:src:bin'] = 'tsc --noEmit -p configs/src/tsconfig.bin.json'\n\t}\n\tif (blueprint.app.length > 0) {\n\t\tscripts['check:app'] = blueprint.app\n\t\t\t.map((environment) => `npm run check:app:${environment}`)\n\t\t\t.join(' && ')\n\t\tfor (const environment of blueprint.app) {\n\t\t\tscripts[`check:app:${environment}`] =\n\t\t\t\tenvironment === 'browser'\n\t\t\t\t\t? 'vue-tsc --noEmit -p configs/app/tsconfig.browser.json'\n\t\t\t\t\t: `tsc --noEmit -p configs/app/tsconfig.${environment}.json`\n\t\t}\n\t}\n\tscripts.test = [\n\t\t...(compiles ? ['npm run test:src'] : []),\n\t\t...(blueprint.app.length > 0 ? ['npm run test:app'] : []),\n\t\t'npm run test:policy',\n\t\t'npm run test:config',\n\t\t...(blueprint.guides ? ['npm run test:guides'] : []),\n\t\t...(blueprint.conformance ? ['npm run test:conformance'] : []),\n\t\t...(integrates ? ['npm run test:integration'] : []),\n\t\t...(!publishes && blueprint.service ? ['npm run test:service'] : []),\n\t].join(' && ')\n\tif (compiles) {\n\t\tscripts['test:src'] = [\n\t\t\tvitest,\n\t\t\t...blueprint.src.map((environment) => `--project ${SRC_MATRIX[environment].project}`),\n\t\t\t...(blueprint.bin ? ['--project src:bin'] : []),\n\t\t].join(' ')\n\t\tfor (const environment of blueprint.src) {\n\t\t\tscripts[`test:src:${environment}`] = `${vitest} --project ${SRC_MATRIX[environment].project}`\n\t\t}\n\t\tif (blueprint.bin) scripts['test:src:bin'] = `${vitest} --project src:bin`\n\t}\n\tif (blueprint.app.length > 0) {\n\t\tscripts['test:app'] = [\n\t\t\tvitest,\n\t\t\t...blueprint.app.map((environment) => `--project ${APP_MATRIX[environment].project}`),\n\t\t].join(' ')\n\t\tfor (const environment of blueprint.app) {\n\t\t\tscripts[`test:app:${environment}`] = `${vitest} --project ${APP_MATRIX[environment].project}`\n\t\t}\n\t}\n\tscripts['test:policy'] = `${vitest} --project policy`\n\tscripts['test:config'] = `${vitest} --project config`\n\tif (blueprint.guides) scripts['test:guides'] = `${vitest} --project guides`\n\tif (blueprint.conformance) scripts['test:conformance'] = `${vitest} --project conformance`\n\tscripts['test:probe'] =\n\t\t'vitest run --config vite.config.ts --no-cache --reporter=verbose --project probe'\n\tif (distributes) scripts['test:distribution'] = `${vitest} --project distribution`\n\tif (integrates) scripts['test:integration'] = `${vitest} --project integration`\n\tif (blueprint.service) scripts['test:service'] = `${vitest} --project service`\n\tscripts.build = [\n\t\t'npm run clean',\n\t\t...(compiles ? ['npm run build:src'] : []),\n\t\t...(blueprint.app.length > 0 ? ['npm run build:app'] : []),\n\t].join(' && ')\n\tif (compiles) {\n\t\tscripts['build:src'] = [\n\t\t\t...blueprint.src.map((environment) => `npm run build:src:${environment}`),\n\t\t\t...(blueprint.bin ? ['npm run build:src:bin'] : []),\n\t\t].join(' && ')\n\t\tfor (const environment of blueprint.src) {\n\t\t\tconst build = `vite build --config configs/src/vite.${environment}.config.ts`\n\t\t\tscripts[`build:src:${environment}`] = SRC_MATRIX[environment].formats.includes('cjs')\n\t\t\t\t? `${build} && npm run copy dist/src/${environment}/index.d.ts dist/src/${environment}/index.d.cts`\n\t\t\t\t: build\n\t\t}\n\t\tif (blueprint.bin) {\n\t\t\tscripts['build:src:bin'] = 'vite build --config configs/src/vite.bin.config.ts'\n\t\t}\n\t}\n\tif (blueprint.app.length > 0) {\n\t\tscripts['build:app'] =\n\t\t\truntime.length > 0\n\t\t\t\t? runtime.map((environment) => `npm run build:app:${environment}`).join(' && ')\n\t\t\t\t: 'npm run check:app:core'\n\t\tfor (const environment of runtime) {\n\t\t\tscripts[`build:app:${environment}`] =\n\t\t\t\t`vite build --config configs/app/vite.${environment}.config.ts`\n\t\t}\n\t}\n\tif (blueprint.app.includes('browser')) {\n\t\tscripts.dev = 'vite --config configs/app/vite.browser.config.ts'\n\t\tif (blueprint.showcase) {\n\t\t\tscripts.showcase = `vite --config ${SHOWCASE_CONFIG_PATH}`\n\t\t\tscripts['build:showcase'] = `vite build --config ${SHOWCASE_CONFIG_PATH}`\n\t\t\tscripts.show =\n\t\t\t\t'npm run format && npm run build:showcase && npm run copy dist/showcase/index.html demo/showcase.html'\n\t\t}\n\t}\n\tif (blueprint.app.includes('server')) {\n\t\tscripts.serve = 'node dist/app/server/main.cjs'\n\t\tscripts['serve:build'] = 'npm run build:app:server && npm run serve'\n\t}\n\tif (publishes) {\n\t\tscripts.prepublishOnly = [\n\t\t\t'npm run format:check && npm run lint:check && npm run check && npm run build && npm test',\n\t\t\t...(distributes ? ['npm run test:distribution -- --mode release'] : []),\n\t\t\t...(blueprint.service ? ['npm run test:service'] : []),\n\t\t].join(' && ')\n\t}\n\treturn scripts\n}\n\n/**\n * Compile a blueprint into its `package.json` content.\n *\n * @param blueprint - The workspace specification.\n * @returns The manifest text, newline-terminated.\n *\n * @remarks\n * A workspace declaring a published environment is scoped and public; one\n * declaring none is a private application and carries neither a scope, a\n * publication block, nor a repository. Declared dependencies and peers are\n * emitted in name order so the same blueprint answers the same bytes, and\n * `peerDependenciesMeta` carries only the peers marked optional.\n *\n * The text is `JSON.stringify` at tab indentation with a trailing newline,\n * which is the formatter's own fixed point for a manifest: `oxfmt` keeps every\n * `package.json` array expanded, so no width-aware collapse applies here. That\n * is not true of the workspace's other JSON, which is why this is the one JSON\n * artifact serialized directly.\n *\n * The artifact carrying this text is claimed by birth. A workspace owns its own\n * manifest once it exists: its description, its keywords, and any script it\n * added are the consumer's, so a repair that replaced the file would take them.\n * The one part scaffold keeps current afterwards is the declared `@orkestrel/*`\n * range set, and that is a region with its own writer rather than a claim over\n * the file's bytes.\n *\n * @example\n * ```ts\n * import { blueprintToManifest, createBlueprint } from '@orkestrel/scaffold'\n *\n * const blueprint = createBlueprint('router', { src: ['core'] })\n *\n * blueprintToManifest(blueprint).endsWith('}\\n') // true\n * ```\n */\nexport function blueprintToManifest(blueprint: Blueprint): string {\n\tconst publishes = blueprint.src.length > 0\n\tconst name = publishes ? `@orkestrel/${blueprint.name}` : blueprint.name\n\tconst dependencies: Record<string, string> = {}\n\tfor (const dependency of [...blueprint.dependencies].sort((left, right) =>\n\t\tcompareValues(left.name, right.name),\n\t)) {\n\t\tdependencies[dependency.name] = dependency.range\n\t}\n\tconst peerDependencies: Record<string, string> = {}\n\tconst peerDependenciesMeta: Record<string, { readonly optional: true }> = {}\n\tfor (const peer of [...blueprint.peers].sort((left, right) =>\n\t\tcompareValues(left.name, right.name),\n\t)) {\n\t\tpeerDependencies[peer.name] = peer.range\n\t\tif (peer.optional === true) peerDependenciesMeta[peer.name] = { optional: true }\n\t}\n\tconst entry = srcToEntry(blueprint.src)\n\tconst manifest: Record<string, unknown> = {\n\t\tname,\n\t\tversion: blueprint.version,\n\t\t...(publishes ? {} : { private: true }),\n\t\tdescription:\n\t\t\tblueprint.description ??\n\t\t\t(publishes ? `The ${name} package.` : `The ${blueprint.name} application.`),\n\t\tkeywords: sortValues(blueprint.keywords),\n\t\t...(publishes\n\t\t\t? {\n\t\t\t\t\thomepage: `https://github.com/orkestrel/${blueprint.name}#readme`,\n\t\t\t\t\tbugs: `https://github.com/orkestrel/${blueprint.name}/issues`,\n\t\t\t\t}\n\t\t\t: {}),\n\t\tlicense: 'MIT',\n\t\t...(publishes\n\t\t\t? {\n\t\t\t\t\trepository: {\n\t\t\t\t\t\ttype: 'git',\n\t\t\t\t\t\turl: `git+https://github.com/orkestrel/${blueprint.name}.git`,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t: {}),\n\t\t...(blueprint.bin ? { bin: { [blueprint.name]: './dist/bin/main.js' } } : {}),\n\t\tfiles: blueprint.bin\n\t\t\t? ['dist/src', 'dist/bin', 'README.md']\n\t\t\t: publishes\n\t\t\t\t? ['dist/src', 'README.md']\n\t\t\t\t: ['dist/app', 'README.md'],\n\t\ttype: 'module',\n\t\t...(publishes\n\t\t\t? {\n\t\t\t\t\tsideEffects: blueprint.bin ? [`./${BIN_ENTRY_PATH}`, './dist/bin/main.js'] : false,\n\t\t\t\t\tmain: entry.main,\n\t\t\t\t\tmodule: entry.module,\n\t\t\t\t\t...(entry.types === undefined ? {} : { types: entry.types }),\n\t\t\t\t\texports: srcToExports(blueprint.src),\n\t\t\t\t\tpublishConfig: { access: 'public' },\n\t\t\t\t}\n\t\t\t: {}),\n\t\tscripts: blueprintToScripts(blueprint),\n\t\tdependencies,\n\t\tdevDependencies: blueprintToDevDependencies(blueprint),\n\t\t...(Object.keys(peerDependencies).length > 0 ? { peerDependencies } : {}),\n\t\t...(Object.keys(peerDependenciesMeta).length > 0 ? { peerDependenciesMeta } : {}),\n\t\tengines: { node: blueprint.engines },\n\t}\n\treturn `${JSON.stringify(manifest, undefined, '\\t')}\\n`\n}\n\n/**\n * Derive the host-specific machinery a generated root Vite configuration carries.\n *\n * @param blueprint - The workspace specification.\n * @returns The four pipelines the generated configuration selects.\n *\n * @remarks\n * The sole derivation of that set: every renderer reads it rather than\n * recomputing an axis of its own. Nothing here selects a boundary guarantee,\n * because the environment-boundary plugin, its module-graph audit, and\n * stylesheet rejection ship in every shape.\n *\n * `output` is the one derived fact rather than a declared one. A workspace\n * builds when it publishes a library, ships an executable, or runs an\n * application host, and only a workspace that builds has an output directory to\n * contain. `showcase` requires the browser application it projects, so the\n * declared flag alone never selects it.\n *\n * @example\n * ```ts\n * import { blueprintToMachinery, createBlueprint } from '@orkestrel/scaffold'\n *\n * const blueprint = createBlueprint('router', { app: ['browser'] })\n *\n * blueprintToMachinery(blueprint).vue // true\n * ```\n */\nexport function blueprintToMachinery(blueprint: Blueprint): ViteMachinery {\n\tconst hosted = blueprint.app.some((environment) => environment !== 'core')\n\treturn {\n\t\tbrowser: blueprint.src.includes('browser') || blueprint.app.includes('browser'),\n\t\tvue: blueprint.app.includes('browser'),\n\t\toutput: blueprint.src.length > 0 || blueprint.bin || hosted,\n\t\tshowcase: blueprint.showcase && blueprint.app.includes('browser'),\n\t}\n}\n\n/**\n * Compile the root TypeScript configuration for a blueprint.\n *\n * @param blueprint - The workspace specification.\n * @returns Formatter-stable `tsconfig.json` text.\n *\n * @example\n * ```ts\n * import { blueprintToRootTsconfig, createBlueprint } from '@orkestrel/scaffold'\n *\n * const blueprint = createBlueprint('router', { src: ['core'] })\n *\n * blueprintToRootTsconfig(blueprint).startsWith('{') // true\n * ```\n */\nexport function blueprintToRootTsconfig(blueprint: Blueprint): string {\n\tconst aliases: string[] = []\n\tfor (const environment of ENVIRONMENTS) {\n\t\tif (blueprint.src.includes(environment)) {\n\t\t\taliases.push(`\"@src/${environment}\": [\"./src/${environment}/index.ts\"]`)\n\t\t}\n\t}\n\tfor (const environment of ENVIRONMENTS) {\n\t\tif (blueprint.app.includes(environment)) {\n\t\t\taliases.push(`\"@app/${environment}\": [\"./app/${environment}/index.ts\"]`)\n\t\t}\n\t}\n\tconst paths = aliases\n\t\t.map((alias, index) => `\\t\\t\\t${alias}${index === aliases.length - 1 ? '' : ','}`)\n\t\t.join('\\n')\n\treturn fillTemplate(CONFIG_TEMPLATES.root.tsconfig, { paths })\n}\n\n/**\n * Compile the root Vite and Vitest configuration for a blueprint.\n *\n * @param blueprint - The workspace specification.\n * @returns Formatter-stable `vite.config.ts` text.\n *\n * @remarks\n * The static root skeleton and each project factory are template data. This\n * function computes only selection, fixed conditional blocks, escaped\n * blueprint strings, and the formatter-measured project-array layout.\n *\n * @example\n * ```ts\n * import { blueprintToRootVite, createBlueprint } from '@orkestrel/scaffold'\n *\n * const blueprint = createBlueprint('router', { src: ['core'] })\n *\n * blueprintToRootVite(blueprint).includes('defineConfig') // true\n * ```\n */\nexport function blueprintToRootVite(blueprint: Blueprint): string {\n\tconst machinery = blueprintToMachinery(blueprint)\n\tconst publishes = blueprint.src.length > 0\n\t// Distribution requires the published source it packs, so the declared flag\n\t// alone never selects it.\n\tconst distributes = blueprint.distribution && publishes\n\tconst imports: string[] = []\n\tif (machinery.browser) imports.push(\"import { playwright } from '@vitest/browser-playwright'\")\n\tif (machinery.vue) imports.push(\"import vue from '@vitejs/plugin-vue'\")\n\tif (machinery.showcase) imports.push(\"import { viteSingleFile } from 'vite-plugin-singlefile'\")\n\n\tconst factories: string[] = []\n\tconst projects: string[] = []\n\tif (blueprint.src.includes('core')) {\n\t\tfactories.push(CONFIG_TEMPLATES.factories.src.core)\n\t\tprojects.push('srcCore')\n\t}\n\tif (blueprint.src.includes('browser')) {\n\t\tconst core = blueprint.src.includes('core')\n\t\tfactories.push(\n\t\t\tfillTemplate(CONFIG_TEMPLATES.factories.src.browser, {\n\t\t\t\texternal: core\n\t\t\t\t\t? \"external: (id: string) => id === '@src/core' || id.startsWith('@orkestrel/'),\"\n\t\t\t\t\t: \"external: (id: string) => id.startsWith('@orkestrel/'),\",\n\t\t\t\toutput: core\n\t\t\t\t\t? \"\\t\\t\\t\\t\\toutput: { paths: { '@src/core': '../core/index.js' } },\"\n\t\t\t\t\t: '\\t\\t\\t\\t\\toutput: {},',\n\t\t\t\texclude: core ? \"\\t\\t\\t\\texclude: ['tests/src/core/**/*.test.ts'],\\n\" : '',\n\t\t\t\t// A browser test runs in the browser, so it cannot start a Node fixture\n\t\t\t\t// for itself. That is the case a global setup exists for, and it is why\n\t\t\t\t// this project takes the same span the integration project does.\n\t\t\t\tglobal: blueprint.global ? \"\\t\\t\\t\\tglobalSetup: ['./tests/setupGlobal.ts'],\\n\" : '',\n\t\t\t}),\n\t\t)\n\t\tprojects.push('srcBrowser')\n\t}\n\tif (blueprint.src.includes('server')) {\n\t\tconst core = blueprint.src.includes('core')\n\t\tfactories.push(\n\t\t\tfillTemplate(CONFIG_TEMPLATES.factories.src.server, {\n\t\t\t\t// The formatter reprints this arrow from its syntax tree, so each\n\t\t\t\t// selection is written the way it measures at the emitted indentation:\n\t\t\t\t// the core predicate carries a third test and passes the vendored\n\t\t\t\t// width, and the one without core fits on the line it starts on.\n\t\t\t\texternal: core\n\t\t\t\t\t? `external: (id: string) =>\n\t\t\t\t\t\tid === '@src/core' || id.startsWith('node:') || id.startsWith('@orkestrel/'),`\n\t\t\t\t\t: \"external: (id: string) => id.startsWith('node:') || id.startsWith('@orkestrel/'),\",\n\t\t\t\toutput: core\n\t\t\t\t\t? `\\t\\t\\t\\t\\toutput: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tformat: 'es',\n\t\t\t\t\t\t\tentryFileNames: 'index.js',\n\t\t\t\t\t\t\tpaths: { '@src/core': '../core/index.js' },\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tformat: 'cjs',\n\t\t\t\t\t\t\tentryFileNames: 'index.cjs',\n\t\t\t\t\t\t\tpaths: { '@src/core': '../core/index.cjs' },\n\t\t\t\t\t\t},\n\t\t\t\t\t],`\n\t\t\t\t\t: '\\t\\t\\t\\t\\toutput: {},',\n\t\t\t\texclude: core ? \"\\t\\t\\t\\texclude: ['tests/src/core/**/*.test.ts'],\\n\" : '',\n\t\t\t}),\n\t\t)\n\t\tprojects.push('srcServer')\n\t}\n\tif (blueprint.bin) {\n\t\tfactories.push(CONFIG_TEMPLATES.factories.src.bin)\n\t\tprojects.push('srcBin')\n\t}\n\tif (blueprint.app.includes('core')) {\n\t\tfactories.push(CONFIG_TEMPLATES.factories.app.core)\n\t\tprojects.push('appCore')\n\t}\n\tif (blueprint.app.includes('browser')) {\n\t\t// The formatter reprints an array from its syntax tree and joins one that\n\t\t// fits the vendored width, so the base plugin array is emitted joined when\n\t\t// the showcase plugins are absent.\n\t\tconst showcasePlugins = machinery.showcase\n\t\t\t? `\tconst showcasePlugins: PluginOption[] = showcase\n\t\t? [\n\t\t\t\tviteSingleFile({\n\t\t\t\t\tremoveViteModuleLoader: true,\n\t\t\t\t\tuseRecommendedBuildConfig: true,\n\t\t\t\t}),\n\t\t\t\t{\n\t\t\t\t\tname: 'orkestrel-showcase-html',\n\t\t\t\t\ttransformIndexHtml: {\n\t\t\t\t\t\torder: 'post',\n\t\t\t\t\t\thandler(html) {\n\t\t\t\t\t\t\tconst stamp = new Date().toISOString()\n\t\t\t\t\t\t\treturn html.replace(\n\t\t\t\t\t\t\t\t'</head>',\n\t\t\t\t\t\t\t\t'\\t\\t<meta name=\"build-id\" content=\"' + stamp + '\" />\\\\n\\t</head>',\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]\n\t\t: []\n`\n\t\t\t: ''\n\t\tconst plugins = machinery.showcase\n\t\t\t? `\\t\\tplugins: [\n\t\t\toutputBoundary(output),\n\t\t\tenvironmentBoundary('app/browser'),\n\t\t\tvue(),\n\t\t\t...showcasePlugins,\n\t\t],\n`\n\t\t\t: \"\\t\\tplugins: [outputBoundary(output), environmentBoundary('app/browser'), vue()],\\n\"\n\t\tconst showcaseBuild = machinery.showcase\n\t\t\t? `\\t\\t\\t...(showcase\n\t\t\t\t? {\n\t\t\t\t\t\tcssMinify: 'lightningcss',\n\t\t\t\t\t\tminify: 'oxc',\n\t\t\t\t\t\tmodulePreload: false,\n\t\t\t\t\t\treportCompressedSize: false,\n\t\t\t\t\t\tsourcemap: false,\n\t\t\t\t\t\ttarget: 'esnext',\n\t\t\t\t\t}\n\t\t\t\t: { assetsInlineLimit: 0 }),\n`\n\t\t\t: '\\t\\t\\tassetsInlineLimit: 0,\\n'\n\t\tconst showcaseFactory = machinery.showcase\n\t\t\t? `\nexport function appShowcase(): UserConfig {\n\treturn applicationBrowser(true)\n}\n`\n\t\t\t: ''\n\t\tfactories.push(\n\t\t\tfillTemplate(CONFIG_TEMPLATES.factories.app.browser, {\n\t\t\t\tplugins,\n\t\t\t\tshowcasePlugins,\n\t\t\t\tshowcaseBuild,\n\t\t\t\tshowcaseFactory,\n\t\t\t}),\n\t\t)\n\t\t// Every other factory takes an optional override, which is the shape Vitest's\n\t\t// own project type reads as a configuration function and calls with a\n\t\t// `ConfigEnv`. This one takes no argument, so it is neither: the row carries\n\t\t// the configuration it returns rather than the factory itself.\n\t\tprojects.push('appBrowser()')\n\t}\n\tif (blueprint.app.includes('server')) {\n\t\tfactories.push(CONFIG_TEMPLATES.factories.app.server)\n\t\tprojects.push('appServer')\n\t}\n\tfactories.push(CONFIG_TEMPLATES.factories.policy)\n\tprojects.push('policy')\n\tfactories.push(CONFIG_TEMPLATES.factories.config)\n\tprojects.push('config')\n\tif (blueprint.guides) {\n\t\tfactories.push(CONFIG_TEMPLATES.factories.guides)\n\t\tprojects.push('guides')\n\t}\n\tif (blueprint.conformance) {\n\t\tfactories.push(CONFIG_TEMPLATES.factories.conformance)\n\t\tprojects.push('conformance')\n\t}\n\tif (blueprint.service) {\n\t\tfactories.push(CONFIG_TEMPLATES.factories.service)\n\t\tprojects.push('service')\n\t}\n\tif (distributes) {\n\t\tfactories.push(CONFIG_TEMPLATES.factories.distribution)\n\t\tprojects.push('distribution')\n\t}\n\tif (blueprint.integration) {\n\t\tfactories.push(\n\t\t\tfillTemplate(CONFIG_TEMPLATES.factories.integration, {\n\t\t\t\tglobal: blueprint.global ? \"\\t\\t\\t\\tglobalSetup: ['./tests/setupGlobal.ts'],\\n\" : '',\n\t\t\t}),\n\t\t)\n\t\tprojects.push('integration')\n\t}\n\tfactories.push(CONFIG_TEMPLATES.factories.probe)\n\tprojects.push('probe')\n\n\tconst joinedProjects = `\\t\\tprojects: [${projects.join(', ')}],`\n\tconst projectRows = matchesPrintWidth(joinedProjects)\n\t\t? joinedProjects\n\t\t: `\\t\\tprojects: [\n${projects.map((project) => `\\t\\t\\t${project},`).join('\\n')}\n\t\\t],`\n\t// The boundary plugins a selection reaches are read off the factories it\n\t// emitted rather than restated as a second selection rule, so the generated\n\t// config imports what it uses and passes its own lint gate. A core-only\n\t// workspace builds nothing and bounds no environment, so it imports neither.\n\tconst body = `${factories.join('\\n')}\\n`\n\tconst boundaries = ['environmentBoundary', 'outputBoundary'].filter((boundary) =>\n\t\tbody.includes(boundary),\n\t)\n\treturn fillTemplate(CONFIG_TEMPLATES.root.vite, {\n\t\tviteTypes: machinery.showcase ? 'PluginOption, UserConfig' : 'UserConfig',\n\t\timports: imports.length === 0 ? '' : `${imports.join('\\n')}\\n`,\n\t\thelpers:\n\t\t\tboundaries.length === 0\n\t\t\t\t? ''\n\t\t\t\t: `import { ${boundaries.join(', ')} } from './configs/helpers.js'\\n`,\n\t\t// The provider options are resolved once for the whole configuration, and\n\t\t// only a selection that emits `configs/browsers.ts` can name them.\n\t\tbrowsers: machinery.browser\n\t\t\t? \"import { resolveBrowser, resolvePinnedBrowser } from './configs/browsers.js'\\n\"\n\t\t\t: '',\n\t\toptions: machinery.browser\n\t\t\t? 'const browserOptions = resolveBrowser(resolvePinnedBrowser(), process.platform, process.env)\\n\\n'\n\t\t\t: '',\n\t\tfactories: body,\n\t\tprojects: projectRows,\n\t})\n}\n\n/**\n * Compile every artifact in the `configs` group.\n *\n * @param blueprint - The workspace specification.\n * @returns Root and selected wrapper artifacts in matrix order.\n *\n * @example\n * ```ts\n * import { blueprintToConfigArtifacts, createBlueprint } from '@orkestrel/scaffold'\n *\n * const blueprint = createBlueprint('router', { src: ['core'] })\n *\n * blueprintToConfigArtifacts(blueprint)[0]?.path // 'tsconfig.json'\n * ```\n */\nexport function blueprintToConfigArtifacts(blueprint: Blueprint): readonly Artifact[] {\n\tconst artifacts: Artifact[] = [\n\t\t{\n\t\t\tpath: 'tsconfig.json',\n\t\t\tgroup: 'configs',\n\t\t\townership: 'content',\n\t\t\torigin: 'template',\n\t\t\tcontent: blueprintToRootTsconfig(blueprint),\n\t\t},\n\t\t{\n\t\t\tpath: 'vite.config.ts',\n\t\t\tgroup: 'configs',\n\t\t\townership: 'content',\n\t\t\torigin: 'template',\n\t\t\tcontent: blueprintToRootVite(blueprint),\n\t\t},\n\t]\n\t// The browser resolver is its own leaf rather than a block inside the vendored\n\t// `configs/helpers.ts`, because that file is byte-identical in every workspace\n\t// and only a browser selection declares the `playwright` it imports.\n\tif (blueprintToMachinery(blueprint).browser) {\n\t\tartifacts.push({\n\t\t\tpath: 'configs/browsers.ts',\n\t\t\tgroup: 'configs',\n\t\t\townership: 'content',\n\t\t\torigin: 'template',\n\t\t\tcontent: CONFIG_TEMPLATES.browsers,\n\t\t})\n\t}\n\tfor (const environment of blueprint.src) {\n\t\tfor (const path of SRC_MATRIX[environment].configs) {\n\t\t\tlet content: string = CONFIG_TEMPLATES.vites.src.core\n\t\t\tif (path === 'configs/src/tsconfig.core.json') content = CONFIG_TEMPLATES.tsconfigs.src.core\n\t\t\telse if (path === 'configs/src/vite.browser.config.ts') {\n\t\t\t\tcontent = fillTemplate(CONFIG_TEMPLATES.vites.src.browser, {\n\t\t\t\t\treplacement: nameToRewrite(blueprint.name),\n\t\t\t\t})\n\t\t\t} else if (path === 'configs/src/tsconfig.browser.json') {\n\t\t\t\tcontent = CONFIG_TEMPLATES.tsconfigs.src.browser\n\t\t\t} else if (path === 'configs/src/vite.server.config.ts') {\n\t\t\t\tcontent = fillTemplate(CONFIG_TEMPLATES.vites.src.server, {\n\t\t\t\t\treplacement: nameToRewrite(blueprint.name),\n\t\t\t\t})\n\t\t\t} else if (path === 'configs/src/tsconfig.server.json') {\n\t\t\t\tcontent = CONFIG_TEMPLATES.tsconfigs.src.server\n\t\t\t}\n\t\t\tartifacts.push({\n\t\t\t\tpath,\n\t\t\t\tgroup: 'configs',\n\t\t\t\townership: 'content',\n\t\t\t\torigin: 'template',\n\t\t\t\tenvironment,\n\t\t\t\tcontent,\n\t\t\t})\n\t\t}\n\t}\n\tif (blueprint.bin) {\n\t\tconst paths = blueprint.src.map(\n\t\t\t(environment) => `\\t\\t\\t\\t\\t\\t'@src/${environment}': '../src/${environment}/index.js',`,\n\t\t)\n\t\tconst renderedPaths =\n\t\t\tpaths.length === 0\n\t\t\t\t? '\\t\\t\\t\\t\\tpaths: {},'\n\t\t\t\t: `\\t\\t\\t\\t\\tpaths: {\n${paths.join('\\n')}\n\t\t\t\t\t},`\n\t\tfor (const path of BIN_CONFIGS) {\n\t\t\tartifacts.push({\n\t\t\t\tpath,\n\t\t\t\tgroup: 'configs',\n\t\t\t\townership: 'content',\n\t\t\t\torigin: 'template',\n\t\t\t\tcontent:\n\t\t\t\t\tpath === 'configs/src/tsconfig.bin.json'\n\t\t\t\t\t\t? CONFIG_TEMPLATES.tsconfigs.bin\n\t\t\t\t\t\t: fillTemplate(CONFIG_TEMPLATES.vites.bin, { paths: renderedPaths }),\n\t\t\t})\n\t\t}\n\t}\n\tfor (const environment of blueprint.app) {\n\t\tfor (const path of APP_MATRIX[environment].configs) {\n\t\t\tlet content: string = CONFIG_TEMPLATES.tsconfigs.app.core\n\t\t\tif (path === 'configs/app/vite.browser.config.ts') {\n\t\t\t\tcontent = CONFIG_TEMPLATES.vites.app.browser\n\t\t\t} else if (path === 'configs/app/tsconfig.browser.json') {\n\t\t\t\tconst include = [\n\t\t\t\t\t'../../app/browser/**/*.cts',\n\t\t\t\t\t'../../app/browser/**/*.mts',\n\t\t\t\t\t'../../app/browser/**/*.ts',\n\t\t\t\t\t'../../app/browser/**/*.tsx',\n\t\t\t\t\t'../../app/browser/**/*.vue',\n\t\t\t\t]\n\t\t\t\tif (blueprint.app.includes('core')) {\n\t\t\t\t\tinclude.push(\n\t\t\t\t\t\t'../../app/core/**/*.cts',\n\t\t\t\t\t\t'../../app/core/**/*.mts',\n\t\t\t\t\t\t'../../app/core/**/*.ts',\n\t\t\t\t\t\t'../../app/core/**/*.tsx',\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tinclude.push(\n\t\t\t\t\t'../../tests/app/browser/**/*.cts',\n\t\t\t\t\t'../../tests/app/browser/**/*.mts',\n\t\t\t\t\t'../../tests/app/browser/**/*.ts',\n\t\t\t\t\t'../../tests/app/browser/**/*.tsx',\n\t\t\t\t\t'../../tests/app/browser/**/*.vue',\n\t\t\t\t\t'../../tests/setup.ts',\n\t\t\t\t\t'../../tests/setupBrowser.ts',\n\t\t\t\t)\n\t\t\t\tcontent = fillTemplate(CONFIG_TEMPLATES.tsconfigs.app.browser, {\n\t\t\t\t\tinclude: include\n\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t(entry, index) =>\n\t\t\t\t\t\t\t\t`\\t\\t${JSON.stringify(entry)}${index === include.length - 1 ? '' : ','}`,\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.join('\\n'),\n\t\t\t\t})\n\t\t\t} else if (path === 'configs/app/vite.server.config.ts') {\n\t\t\t\tcontent = CONFIG_TEMPLATES.vites.app.server\n\t\t\t} else if (path === 'configs/app/tsconfig.server.json') {\n\t\t\t\tconst include = [\n\t\t\t\t\t'../../app/server/**/*.cts',\n\t\t\t\t\t'../../app/server/**/*.mts',\n\t\t\t\t\t'../../app/server/**/*.ts',\n\t\t\t\t\t'../../app/server/**/*.tsx',\n\t\t\t\t]\n\t\t\t\tif (blueprint.app.includes('core')) {\n\t\t\t\t\tinclude.push(\n\t\t\t\t\t\t'../../app/core/**/*.cts',\n\t\t\t\t\t\t'../../app/core/**/*.mts',\n\t\t\t\t\t\t'../../app/core/**/*.ts',\n\t\t\t\t\t\t'../../app/core/**/*.tsx',\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tinclude.push(\n\t\t\t\t\t'../../tests/app/server/**/*.cts',\n\t\t\t\t\t'../../tests/app/server/**/*.mts',\n\t\t\t\t\t'../../tests/app/server/**/*.ts',\n\t\t\t\t\t'../../tests/app/server/**/*.tsx',\n\t\t\t\t\t'../../tests/setup.ts',\n\t\t\t\t\t'../../tests/setupServer.ts',\n\t\t\t\t)\n\t\t\t\tcontent = fillTemplate(CONFIG_TEMPLATES.tsconfigs.app.server, {\n\t\t\t\t\tinclude: include\n\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t(entry, index) =>\n\t\t\t\t\t\t\t\t`\\t\\t${JSON.stringify(entry)}${index === include.length - 1 ? '' : ','}`,\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.join('\\n'),\n\t\t\t\t})\n\t\t\t}\n\t\t\tartifacts.push({\n\t\t\t\tpath,\n\t\t\t\tgroup: 'configs',\n\t\t\t\townership: 'content',\n\t\t\t\torigin: 'template',\n\t\t\t\tenvironment,\n\t\t\t\tcontent,\n\t\t\t})\n\t\t}\n\t}\n\tif (blueprint.showcase && blueprint.app.includes('browser')) {\n\t\tartifacts.push({\n\t\t\tpath: SHOWCASE_CONFIG_PATH,\n\t\t\tgroup: 'configs',\n\t\t\townership: 'content',\n\t\t\torigin: 'template',\n\t\t\tenvironment: 'browser',\n\t\t\tcontent: CONFIG_TEMPLATES.vites.app.showcase,\n\t\t})\n\t}\n\treturn artifacts\n}\n\n/**\n * Compile every artifact in the `source` group.\n *\n * @param blueprint - The workspace specification.\n * @returns Empty published barrels, selected application entries, and the optional bin entry.\n *\n * @remarks\n * The barrels and every runtime entry intentionally hold nothing. A generated\n * sample entity is too easy to mistake for package implementation, so the\n * scaffold establishes only the selected environment boundaries. An application\n * entry is empty for the same reason the bin entry is, and because the vendored\n * lint config refuses an unassigned import outside a stylesheet, so the entry\n * cannot start by importing its barrel for effect either.\n *\n * @example\n * ```ts\n * import { blueprintToSourceArtifacts, createBlueprint } from '@orkestrel/scaffold'\n *\n * const blueprint = createBlueprint('router', { src: ['core'] })\n *\n * blueprintToSourceArtifacts(blueprint).every(({ group }) => group === 'source') // true\n * ```\n */\nexport function blueprintToSourceArtifacts(blueprint: Blueprint): readonly ContentArtifact[] {\n\tconst artifacts: ContentArtifact[] = []\n\tfor (const environment of blueprint.src) {\n\t\tartifacts.push({\n\t\t\tpath: `src/${environment}/index.ts`,\n\t\t\tgroup: 'source',\n\t\t\townership: 'birth',\n\t\t\torigin: 'template',\n\t\t\tenvironment,\n\t\t\tcontent: ARTIFACT_TEMPLATES.source.empty,\n\t\t})\n\t}\n\tfor (const environment of blueprint.app) {\n\t\tartifacts.push({\n\t\t\tpath: `app/${environment}/index.ts`,\n\t\t\tgroup: 'source',\n\t\t\townership: 'birth',\n\t\t\torigin: 'template',\n\t\t\tenvironment,\n\t\t\tcontent: ARTIFACT_TEMPLATES.source.empty,\n\t\t})\n\t\tif (environment === 'browser') {\n\t\t\tartifacts.push(\n\t\t\t\t{\n\t\t\t\t\tpath: 'app/browser/main.ts',\n\t\t\t\t\tgroup: 'source',\n\t\t\t\t\townership: 'birth',\n\t\t\t\t\torigin: 'template',\n\t\t\t\t\tenvironment,\n\t\t\t\t\tcontent: ARTIFACT_TEMPLATES.source.empty,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tpath: 'app/browser/index.html',\n\t\t\t\t\tgroup: 'source',\n\t\t\t\t\townership: 'birth',\n\t\t\t\t\torigin: 'template',\n\t\t\t\t\tenvironment,\n\t\t\t\t\tcontent: ARTIFACT_TEMPLATES.source.browser,\n\t\t\t\t},\n\t\t\t)\n\t\t} else if (environment === 'server') {\n\t\t\tartifacts.push({\n\t\t\t\tpath: 'app/server/main.ts',\n\t\t\t\tgroup: 'source',\n\t\t\t\townership: 'birth',\n\t\t\t\torigin: 'template',\n\t\t\t\tenvironment,\n\t\t\t\tcontent: ARTIFACT_TEMPLATES.source.empty,\n\t\t\t})\n\t\t}\n\t}\n\tif (blueprint.bin) {\n\t\tartifacts.push({\n\t\t\tpath: BIN_ENTRY_PATH,\n\t\t\tgroup: 'source',\n\t\t\townership: 'birth',\n\t\t\torigin: 'template',\n\t\t\tcontent: ARTIFACT_TEMPLATES.source.empty,\n\t\t})\n\t}\n\treturn artifacts\n}\n\n/**\n * Compile every artifact in the `tests` group that is not vendored from the host.\n *\n * @param blueprint - The workspace specification.\n * @returns Shared setup modules, axis tests, and the optional integration seed.\n *\n * @remarks\n * `tests/setupPolicy.ts`, `tests/policy.test.ts`, and `tests/config.test.ts` are\n * fleet-invariant host artifacts and therefore do not appear here. A guide\n * proof is not emitted while the workspace intentionally has empty barrels and\n * no package guide. The integration seed follows its structural flag and loads\n * every selected environment through its public barrel.\n *\n * The conformance proof is not emitted either, for the reason the guide proof\n * is not: it names an official artifact only the package knows, so a generated\n * placeholder would read as a proof while measuring nothing. `service` emits its\n * readiness setup alone, because the root configuration names that module by\n * path.\n *\n * @example\n * ```ts\n * import { blueprintToTestArtifacts, createBlueprint } from '@orkestrel/scaffold'\n *\n * const blueprint = createBlueprint('router', { src: ['core'] })\n *\n * blueprintToTestArtifacts(blueprint)[0]?.path // 'tests/setup.ts'\n * ```\n */\nexport function blueprintToTestArtifacts(blueprint: Blueprint): readonly ContentArtifact[] {\n\tconst artifacts: ContentArtifact[] = [\n\t\t{\n\t\t\tpath: 'tests/setup.ts',\n\t\t\tgroup: 'tests',\n\t\t\townership: 'birth',\n\t\t\torigin: 'template',\n\t\t\tcontent: ARTIFACT_TEMPLATES.tests.setup,\n\t\t},\n\t]\n\tif (blueprint.src.includes('browser') || blueprint.app.includes('browser')) {\n\t\tartifacts.push({\n\t\t\tpath: 'tests/setupBrowser.ts',\n\t\t\tgroup: 'tests',\n\t\t\townership: 'birth',\n\t\t\torigin: 'template',\n\t\t\tenvironment: 'browser',\n\t\t\tcontent: ARTIFACT_TEMPLATES.tests.setup,\n\t\t})\n\t}\n\tif (blueprint.src.includes('server') || blueprint.app.includes('server') || blueprint.bin) {\n\t\tartifacts.push({\n\t\t\tpath: 'tests/setupServer.ts',\n\t\t\tgroup: 'tests',\n\t\t\townership: 'birth',\n\t\t\torigin: 'template',\n\t\t\tenvironment: 'server',\n\t\t\tcontent: ARTIFACT_TEMPLATES.tests.setup,\n\t\t})\n\t}\n\t// The live-service project names this module in `setupFiles`, so a registered\n\t// project whose setup module is absent fails to load at all. The suite beneath\n\t// `tests/service` is not emitted beside it: what a live proof drives is the\n\t// package's own service, which this package cannot write for it.\n\tif (blueprint.service) {\n\t\tartifacts.push({\n\t\t\tpath: SERVICE_SETUP_PATH,\n\t\t\tgroup: 'tests',\n\t\t\townership: 'birth',\n\t\t\torigin: 'template',\n\t\t\tcontent: ARTIFACT_TEMPLATES.tests.setup,\n\t\t})\n\t}\n\tif (blueprint.global) {\n\t\tartifacts.push({\n\t\t\tpath: GLOBAL_SETUP_PATH,\n\t\t\tgroup: 'tests',\n\t\t\townership: 'birth',\n\t\t\torigin: 'template',\n\t\t\tcontent: ARTIFACT_TEMPLATES.tests.global,\n\t\t})\n\t}\n\tfor (const environment of blueprint.src) {\n\t\tartifacts.push({\n\t\t\tpath: `tests/src/${environment}/index.test.ts`,\n\t\t\tgroup: 'tests',\n\t\t\townership: 'birth',\n\t\t\torigin: 'template',\n\t\t\tenvironment,\n\t\t\tcontent: fillTemplate(ARTIFACT_TEMPLATES.tests.entry, {\n\t\t\t\tspecifier: serializeTypeScriptString(`@src/${environment}`),\n\t\t\t\tlabel: serializeTypeScriptString(`src ${environment} entry`),\n\t\t\t}),\n\t\t})\n\t}\n\tif (blueprint.bin) {\n\t\tconst specifier = serializeTypeScriptString('../../../src/bin/main.js')\n\t\tconst joined = `\\t\\tconst entry = await import(${specifier})`\n\t\tconst statement = matchesPrintWidth(joined)\n\t\t\t? joined\n\t\t\t: `\\t\\tconst entry =\\n\\t\\t\\tawait import(${specifier})`\n\t\tartifacts.push({\n\t\t\tpath: 'tests/src/bin/main.test.ts',\n\t\t\tgroup: 'tests',\n\t\t\townership: 'birth',\n\t\t\torigin: 'template',\n\t\t\tcontent: fillTemplate(ARTIFACT_TEMPLATES.tests.bin, { import: statement }),\n\t\t})\n\t}\n\tfor (const environment of blueprint.app) {\n\t\tartifacts.push({\n\t\t\tpath: `tests/app/${environment}/index.test.ts`,\n\t\t\tgroup: 'tests',\n\t\t\townership: 'birth',\n\t\t\torigin: 'template',\n\t\t\tenvironment,\n\t\t\tcontent: fillTemplate(ARTIFACT_TEMPLATES.tests.entry, {\n\t\t\t\tspecifier: serializeTypeScriptString(`@app/${environment}`),\n\t\t\t\tlabel: serializeTypeScriptString(`app ${environment} entry`),\n\t\t\t}),\n\t\t})\n\t}\n\tif (blueprint.integration) {\n\t\tconst imports: string[] = []\n\t\tconst entries: string[] = []\n\t\tfor (const environment of blueprint.src) {\n\t\t\tconst entry =\n\t\t\t\tenvironment === 'core' ? 'srcCore' : environment === 'browser' ? 'srcBrowser' : 'srcServer'\n\t\t\timports.push(`import * as ${entry} from '@src/${environment}'`)\n\t\t\tentries.push(entry)\n\t\t}\n\t\tfor (const environment of blueprint.app) {\n\t\t\tconst entry =\n\t\t\t\tenvironment === 'core' ? 'appCore' : environment === 'browser' ? 'appBrowser' : 'appServer'\n\t\t\timports.push(`import * as ${entry} from '@app/${environment}'`)\n\t\t\tentries.push(entry)\n\t\t}\n\t\tconst joined = `expect([${entries.map((entry) => `Object.keys(${entry})`).join(', ')}]).toStrictEqual(`\n\t\tconst actual = matchesPrintWidth(`\\t\\t${joined}[`)\n\t\t\t? joined\n\t\t\t: `expect([\\n${entries.map((entry) => `\\t\\t\\tObject.keys(${entry}),`).join('\\n')}\\n\\t\\t]).toStrictEqual(`\n\t\tconst expectedInline = `[${entries.map(() => '[]').join(', ')}]`\n\t\tconst expected =\n\t\t\tactual !== joined || matchesPrintWidth(`\\t\\t${joined}${expectedInline})`)\n\t\t\t\t? expectedInline\n\t\t\t\t: `[\\n${entries.map(() => '\\t\\t\\t[],').join('\\n')}\\n\\t\\t]`\n\t\tartifacts.push({\n\t\t\tpath: INTEGRATION_TEST_PATH,\n\t\t\tgroup: 'tests',\n\t\t\townership: 'birth',\n\t\t\torigin: 'template',\n\t\t\tcontent: fillTemplate(ARTIFACT_TEMPLATES.tests.integration, {\n\t\t\t\timports: `${imports.join('\\n')}\\n`,\n\t\t\t\tactual,\n\t\t\t\texpected,\n\t\t\t}),\n\t\t})\n\t}\n\treturn artifacts\n}\n\n/**\n * Compile the generated workspace's guide index.\n *\n * @param blueprint - The workspace specification.\n * @returns One birth-owned guide index carrying the concept and directory views.\n */\nexport function blueprintToGuideArtifacts(blueprint: Blueprint): readonly ContentArtifact[] {\n\tconst source: string[] = []\n\tconst tests: string[] = []\n\tconst directories: string[] = []\n\tconst guide = `guides/${blueprint.name}.md`\n\tfor (const environment of blueprint.src) {\n\t\tsource.push(` - [\\`src/${environment}\\`](../src/${environment})`)\n\t\ttests.push(` - [\\`tests/src/${environment}\\`](../tests/src/${environment})`)\n\t\tdirectories.push(\n\t\t\t`- [\\`src/${environment}\\`](../src/${environment})\\n - Guide: Not created. Create this file when the workspace has a public surface:\\n \\`${guide}\\`\\n - Tests: [\\`tests/src/${environment}\\`](../tests/src/${environment})`,\n\t\t)\n\t}\n\tif (blueprint.bin) {\n\t\tsource.push(' - [`src/bin`](../src/bin)')\n\t\ttests.push(' - [`tests/src/bin`](../tests/src/bin)')\n\t\tdirectories.push(\n\t\t\t`- [\\`src/bin\\`](../src/bin)\\n - Guide: Not created. Create this file when the workspace has a public surface:\\n \\`${guide}\\`\\n - Tests: [\\`tests/src/bin\\`](../tests/src/bin)`,\n\t\t)\n\t}\n\tfor (const environment of blueprint.app) {\n\t\tsource.push(` - [\\`app/${environment}\\`](../app/${environment})`)\n\t\ttests.push(` - [\\`tests/app/${environment}\\`](../tests/app/${environment})`)\n\t\tdirectories.push(\n\t\t\t`- [\\`app/${environment}\\`](../app/${environment})\\n - Guide: Not created. Create this file when the workspace has a public surface:\\n \\`${guide}\\`\\n - Tests: [\\`tests/app/${environment}\\`](../tests/app/${environment})`,\n\t\t)\n\t}\n\treturn [\n\t\t{\n\t\t\tpath: 'guides/README.md',\n\t\t\tgroup: 'guides',\n\t\t\townership: 'birth',\n\t\t\torigin: 'template',\n\t\t\tcontent: fillTemplate(ARTIFACT_TEMPLATES.guides.readme, {\n\t\t\t\tsource: source.join('\\n'),\n\t\t\t\ttests: tests.join('\\n'),\n\t\t\t\tdirectories: directories.join('\\n'),\n\t\t\t\tguide: blueprint.name,\n\t\t\t}),\n\t\t},\n\t]\n}\n\n/**\n * Compile the generated workspace's root documentation.\n *\n * @param blueprint - The workspace specification.\n * @returns One birth-owned package front page.\n */\nexport function blueprintToDocumentArtifacts(blueprint: Blueprint): readonly ContentArtifact[] {\n\tconst publishes = blueprint.src.length > 0\n\tconst name = publishes ? `@orkestrel/${blueprint.name}` : blueprint.name\n\tconst description =\n\t\tblueprint.description ?? (publishes ? `The ${name} package.` : `The ${name} application.`)\n\treturn [\n\t\t{\n\t\t\tpath: 'README.md',\n\t\t\tgroup: 'docs',\n\t\t\townership: 'birth',\n\t\t\torigin: 'template',\n\t\t\tcontent: fillTemplate(ARTIFACT_TEMPLATES.docs.readme, {\n\t\t\t\tpackage: name,\n\t\t\t\tdescription,\n\t\t\t}),\n\t\t},\n\t]\n}\n\n/**\n * Compile the blueprint-dependent orchestration artifacts.\n *\n * @param blueprint - The workspace specification.\n * @returns A vendor inventory script when vendors are declared, otherwise none.\n *\n * @remarks\n * A vendor name does not describe startup, readiness, or cleanup. The script\n * therefore records only the declared inventory and does not invent a service\n * runner or test project.\n */\nexport function blueprintToOrchestrationArtifacts(\n\tblueprint: Blueprint,\n): readonly ContentArtifact[] {\n\tif (blueprint.vendors.length === 0) return []\n\tconst vendors = blueprint.vendors\n\t\t.map((vendor, index) => `\\t'${vendor}'${index === blueprint.vendors.length - 1 ? '' : ' \\\\'}`)\n\t\t.join('\\n')\n\treturn [\n\t\t{\n\t\t\tpath: SERVICE_SCRIPT_PATH,\n\t\t\tgroup: 'orchestration',\n\t\t\townership: 'birth',\n\t\t\torigin: 'template',\n\t\t\tcontent: fillTemplate(ARTIFACT_TEMPLATES.orchestration.service, { vendors }),\n\t\t},\n\t]\n}\n\n/**\n * Compile the vendored host artifacts a named workspace plans.\n *\n * @param name - The target workspace's own bare package name.\n * @returns One artifact per vendored path, in `HOST_PATHS` order.\n *\n * @remarks\n * Every artifact is claimed by presence, which is the strongest claim a pure\n * compile can make: core cannot read the vendored data root, so it cannot carry\n * the bytes a content claim would have to be checked against. Reading that root\n * is what promotes the ones scaffold owns the bytes of.\n *\n * `source` is left absent because it falls back to `path`, and every vendored\n * path is stored under the name it is written to. The group comes from\n * {@link inferGroup}, so a vendored path and a foreign path found in a target\n * are classified by one rule and a plan never disagrees with the audit beside\n * it.\n *\n * @example\n * ```ts\n * import { nameToHostArtifacts } from '@orkestrel/scaffold'\n *\n * nameToHostArtifacts('router').some((artifact) => artifact.path === 'AGENTS.md') // true\n * nameToHostArtifacts('router').some((artifact) => artifact.path === 'guides/router.md') // false\n * ```\n */\nexport function nameToHostArtifacts(name: string): readonly Artifact[] {\n\treturn selectHostPaths(HOST_PATHS, name).map((path): Artifact => ({\n\t\tpath,\n\t\tgroup: inferGroup(path),\n\t\townership: 'presence',\n\t\torigin: 'host',\n\t}))\n}\n\n/**\n * Replace the content of every drafted artifact an override names.\n *\n * @param artifacts - The drafted artifacts.\n * @param overrides - The blueprint's overrides.\n * @returns The artifacts with each matching override applied, in input order.\n *\n * @remarks\n * An override replaces an artifact's whole content and never merges into it.\n * A host-origin artifact carries no content to replace, so it passes through\n * untouched; which overrides are legal at all is\n * {@link overridesToQuestions}'s answer, so an illegal one is reported rather\n * than silently dropped here.\n *\n * @example\n * ```ts\n * import { applyOverrides, blueprintToConfigArtifacts, createBlueprint } from '@orkestrel/scaffold'\n *\n * const artifacts = blueprintToConfigArtifacts(createBlueprint('router', { src: ['core'] }))\n *\n * applyOverrides(artifacts, [{ path: 'README.md', content: '# Title\\n' }])\n * ```\n */\nexport function applyOverrides(\n\tartifacts: readonly Artifact[],\n\toverrides: readonly Override[],\n): readonly Artifact[] {\n\tif (overrides.length === 0) return artifacts\n\tconst replacements = 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 = replacements.get(artifact.path)\n\t\treturn content === undefined ? artifact : { ...artifact, content }\n\t})\n}\n\n/**\n * Compute a plan's content identity.\n *\n * @param plan - The plan to identify.\n * @returns Sixteen lowercase hexadecimal digits, or `undefined` when the plan\n * carries a value JSON cannot encode.\n *\n * @remarks\n * The identity covers the blueprint the plan was compiled from, the groups it\n * covers, and its ordered artifacts. It deliberately excludes `hash` itself,\n * which is what lets a pinned plan be re-identified and compared without\n * stripping a field first.\n *\n * The projection is canonical, so two plans that differ only in key order\n * answer the same digits. Nothing here reads a clock or randomness, and the\n * refusal is total: a value that cannot be read answers `undefined` rather than\n * escaping as a thrown error, and a caller decides what an unidentifiable plan\n * means.\n *\n * @example\n * ```ts\n * import { createBlueprint, createCompiler, planToHash } from '@orkestrel/scaffold'\n *\n * const { plan } = createCompiler().compile(createBlueprint('router', { src: ['core'] }))\n *\n * plan === undefined ? undefined : planToHash(plan)?.length // 16\n * ```\n */\nexport function planToHash(plan: Plan): string | undefined {\n\tconst outcome = attempt(() =>\n\t\tcanonicalStringify({\n\t\t\tblueprint: plan.blueprint,\n\t\t\tgroups: plan.groups,\n\t\t\tartifacts: plan.artifacts,\n\t\t}),\n\t)\n\tif (!outcome.success || outcome.value === undefined) return undefined\n\treturn computeHash(outcome.value)\n}\n\n/**\n * Project one planned artifact and the bytes found at its path into a verdict.\n *\n * @param artifact - The planned artifact.\n * @param observed - The destination's exact bytes as hexadecimal; absent when\n * the destination holds no file.\n * @returns The finding, carrying the artifact's ownership and `observed`\n * exactly where bytes were read.\n *\n * @remarks\n * The comparison itself is {@link inferDrift}'s, so ownership decides it here\n * exactly as it does everywhere else. This adds only the shape: a missing\n * destination has no bytes to record, and every other verdict records the bytes\n * it was given, which is the precondition the mutation that follows is held to.\n * Ownership is copied rather than inferred from drift because aligned findings\n * span all three ownership tiers.\n *\n * `foreign` is not answerable here, because it describes a path no artifact was\n * planned for.\n *\n * @example\n * ```ts\n * import { artifactToFinding } from '@orkestrel/scaffold'\n *\n * artifactToFinding(\n * \t{ path: 'README.md', group: 'docs', ownership: 'content', origin: 'computed', content: 'hi\\n' },\n * \t'6279650a',\n * ) // { path: 'README.md', group: 'docs', ownership: 'content', drift: 'stale', observed: '6279650a' }\n * ```\n */\nexport function artifactToFinding(artifact: Artifact, observed?: string): Finding {\n\tconst path = artifact.path\n\tconst group = artifact.group\n\tconst ownership = artifact.ownership\n\tif (observed === undefined) {\n\t\treturn inferDrift(artifact) === 'aligned'\n\t\t\t? { path, group, ownership, drift: 'aligned' }\n\t\t\t: { path, group, ownership, drift: 'missing' }\n\t}\n\treturn inferDrift(artifact, observed) === 'stale'\n\t\t? { path, group, ownership, drift: 'stale', observed }\n\t\t: { path, group, ownership, drift: 'aligned', observed }\n}\n\n/**\n * Compare a plan against a target's current content.\n *\n * @param plan - The compiled plan.\n * @param current - The target's exact bytes, keyed by artifact-relative path.\n * @returns One finding per planned artifact in plan order, then one `foreign`\n * finding per unplanned path in snapshot order.\n *\n * @remarks\n * The sweep is bounded by the plan's own selection: a path the plan does not own\n * is reported as foreign only when its group is one the plan covers, so a\n * compile narrowed to a few groups never reports the rest of the workspace as\n * unowned. Within a covered group the report is deliberately wide, because\n * `foreign` is the set the destructive verb draws from and the narrowing that\n * set needs — the paths no verb may remove, and what git tracks — belongs to\n * that verb rather than to the comparison.\n *\n * @example\n * ```ts\n * import { createBlueprint, createCompiler, planToFindings } from '@orkestrel/scaffold'\n *\n * const { plan } = createCompiler().compile(createBlueprint('router', { src: ['core'] }))\n *\n * plan === undefined ? [] : planToFindings(plan, { 'AGENTS.md': '68690a' })\n * ```\n */\nexport function planToFindings(plan: Plan, current: Snapshot): readonly Finding[] {\n\tconst findings: Finding[] = []\n\tconst planned = new Set<string>()\n\tfor (const artifact of plan.artifacts) {\n\t\tplanned.add(artifact.path)\n\t\tfindings.push(artifactToFinding(artifact, current[artifact.path]))\n\t}\n\tfor (const [path, observed] of Object.entries(current)) {\n\t\tif (planned.has(path)) continue\n\t\tconst group = inferGroup(path)\n\t\tif (!plan.groups.includes(group)) continue\n\t\tfindings.push({ path, group, drift: 'foreign', observed })\n\t}\n\treturn findings\n}\n\n/**\n * Measure one declared package list against the name and range syntax it accepts.\n *\n * @param dependencies - The declared list.\n * @param field - The blueprint field the list came from, reported on each question.\n * @param name - The package-name syntax the field accepts.\n * @param range - The range syntax the field accepts.\n * @returns One blocking question per rejected name, repeated name, and rejected\n * range, in list order.\n *\n * @remarks\n * The three declared lists differ only in the two syntaxes they accept, so the\n * rules live here once and each caller supplies its own patterns. A runtime\n * dependency name reaches a path through its guide mirror and is fixed to the\n * `@orkestrel` scope; a development extra never reaches a path and admits any\n * valid npm name.\n *\n * Both patterns must be stateless. A global or sticky pattern carries a\n * `lastIndex` between calls, so it would answer differently for the same input\n * depending on what was tested before it.\n *\n * @example\n * ```ts\n * import { DEPENDENCY_NAME_PATTERN, ORKESTREL_RANGE_PATTERN } from '@orkestrel/scaffold'\n * import { dependenciesToQuestions } from '@orkestrel/scaffold'\n *\n * dependenciesToQuestions(\n * \t[{ name: '@orkestrel/router', range: '0.0.8' }],\n * \t'dependencies',\n * \tDEPENDENCY_NAME_PATTERN,\n * \tORKESTREL_RANGE_PATTERN,\n * ).length // 1 — the range is not caret-pinned\n * ```\n */\nexport function dependenciesToQuestions(\n\tdependencies: readonly Dependency[],\n\tfield: string,\n\tname: RegExp,\n\trange: RegExp,\n): readonly Question[] {\n\tconst questions: Question[] = []\n\tconst seen = new Set<string>()\n\tfor (const dependency of dependencies) {\n\t\tif (!name.test(dependency.name)) {\n\t\t\tquestions.push({\n\t\t\t\tfield,\n\t\t\t\tmessage: `${dependency.name} is not a package name ${field} accepts.`,\n\t\t\t\tblocking: true,\n\t\t\t})\n\t\t} else if (seen.has(dependency.name)) {\n\t\t\tquestions.push({\n\t\t\t\tfield,\n\t\t\t\tmessage: `${dependency.name} is declared more than once on ${field}.`,\n\t\t\t\tblocking: true,\n\t\t\t})\n\t\t}\n\t\tseen.add(dependency.name)\n\t\tif (!range.test(dependency.range)) {\n\t\t\tquestions.push({\n\t\t\t\tfield,\n\t\t\t\tmessage: `${dependency.name} declares the range ${dependency.range}, which ${field} does not accept.`,\n\t\t\t\tblocking: true,\n\t\t\t})\n\t\t}\n\t}\n\treturn questions\n}\n\n/**\n * Measure a blueprint against every law its own fields decide.\n *\n * @param blueprint - The workspace specification.\n * @returns One question per rejected field, in blueprint field order, with the\n * rules that span several fields last.\n *\n * @remarks\n * Only the laws a blueprint answers alone are here. The structural record and\n * its bounds are already settled by `isBlueprint`, which refuses a value that is\n * not a blueprint at all; what remains is the syntax of a name, a version, a\n * range, and an engines floor, the combinations the two environment axes admit,\n * and the overlaps between the three declared package lists. The laws that need\n * a drafted plan belong to {@link artifactsToQuestions} and\n * {@link overridesToQuestions}.\n *\n * A question blocks when it describes a workspace this package cannot generate.\n * Three do not, because each describes a workspace it can describe honestly and\n * should not create: a published axis of several environments without core,\n * whose manifest names a core build the workspace never runs; a showcase flag\n * whose required browser axis is absent, which emits nothing; and an\n * integration flag over fewer than two environments, whose seed does emit and\n * has nothing to compose across. Blocking any of them closed the gate for every\n * verb. The verbs that read an existing workspace need the plan the gate\n * refused. The caller that chooses the shape refuses the advisory; the callers\n * that read one report it.\n *\n * The integration advisory counts both axes together, because the proof it\n * seeds spans environments rather than published ones: an application of two\n * environments composes, and a package publishing one does not. Reading either\n * axis alone withdrew the proof from a workspace that does compose.\n *\n * An environment question carries `ENVIRONMENTS` as its candidates, so a caller\n * reads the accepted values from the question instead of from the documentation.\n *\n * @example\n * ```ts\n * import { blueprintToQuestions, createBlueprint } from '@orkestrel/scaffold'\n *\n * const blueprint = createBlueprint('router', { src: ['core'] })\n *\n * blueprintToQuestions(blueprint).length === 0 // true\n * ```\n */\nexport function blueprintToQuestions(blueprint: Blueprint): readonly Question[] {\n\tconst questions: Question[] = []\n\tif (!NAME_PATTERN.test(blueprint.name)) {\n\t\tquestions.push({\n\t\t\tfield: 'name',\n\t\t\tmessage: `${blueprint.name} is not a lowercase alphanumeric name starting with a letter.`,\n\t\t\tblocking: true,\n\t\t})\n\t}\n\tif (!VERSION_PATTERN.test(blueprint.version)) {\n\t\tquestions.push({\n\t\t\tfield: 'version',\n\t\t\tmessage: `${blueprint.version} is not an exact three-component version.`,\n\t\t\tblocking: true,\n\t\t})\n\t}\n\tif (!matchesEngines(blueprint.engines)) {\n\t\tquestions.push({\n\t\t\tfield: 'engines',\n\t\t\tmessage: `${blueprint.engines} is not a supported minimum-Node floor.`,\n\t\t\tblocking: true,\n\t\t})\n\t}\n\tif (blueprint.src.length === 0 && blueprint.app.length === 0) {\n\t\tquestions.push({\n\t\t\tfield: 'src',\n\t\t\tmessage: 'A workspace declares at least one environment on src or app.',\n\t\t\tblocking: true,\n\t\t\tcandidates: ENVIRONMENTS,\n\t\t})\n\t}\n\tif (blueprint.src.length > 1 && !blueprint.src.includes('core')) {\n\t\tquestions.push({\n\t\t\tfield: 'src',\n\t\t\tmessage:\n\t\t\t\t'Several published environments put core at the package root, so this manifest names a core build the workspace never runs. Declare core on src, or publish one environment.',\n\t\t\tblocking: false,\n\t\t\tcandidates: ENVIRONMENTS,\n\t\t})\n\t}\n\tfor (const environment of ENVIRONMENTS) {\n\t\tif (blueprint.src.filter((declared) => declared === environment).length > 1) {\n\t\t\tquestions.push({\n\t\t\t\tfield: 'src',\n\t\t\t\tmessage: `src declares ${environment} more than once.`,\n\t\t\t\tblocking: true,\n\t\t\t\tcandidates: ENVIRONMENTS,\n\t\t\t})\n\t\t}\n\t\tif (blueprint.app.filter((declared) => declared === environment).length > 1) {\n\t\t\tquestions.push({\n\t\t\t\tfield: 'app',\n\t\t\t\tmessage: `app declares ${environment} more than once.`,\n\t\t\t\tblocking: true,\n\t\t\t\tcandidates: ENVIRONMENTS,\n\t\t\t})\n\t\t}\n\t}\n\tif (blueprint.integration && blueprint.src.length + blueprint.app.length < 2) {\n\t\tquestions.push({\n\t\t\tfield: 'integration',\n\t\t\tmessage:\n\t\t\t\t'integration drives features across environments, and this workspace declares fewer than two, so its seed composes nothing.',\n\t\t\tblocking: false,\n\t\t})\n\t}\n\tconst vendors = new Set<string>()\n\tfor (const vendor of blueprint.vendors) {\n\t\tif (!NAME_PATTERN.test(vendor)) {\n\t\t\tquestions.push({\n\t\t\t\tfield: 'vendors',\n\t\t\t\tmessage: `${vendor} is not a lowercase alphanumeric vendor name starting with a letter.`,\n\t\t\t\tblocking: true,\n\t\t\t})\n\t\t} else if (vendors.has(vendor)) {\n\t\t\tquestions.push({\n\t\t\t\tfield: 'vendors',\n\t\t\t\tmessage: `${vendor} is declared more than once on vendors.`,\n\t\t\t\tblocking: true,\n\t\t\t})\n\t\t}\n\t\tvendors.add(vendor)\n\t}\n\tif (blueprint.distribution && blueprint.src.length === 0) {\n\t\tquestions.push({\n\t\t\tfield: 'distribution',\n\t\t\tmessage:\n\t\t\t\t'distribution packs the published source, and this workspace declares none, so it emits nothing.',\n\t\t\tblocking: false,\n\t\t})\n\t}\n\tif (blueprint.showcase && !blueprint.app.includes('browser')) {\n\t\tquestions.push({\n\t\t\tfield: 'showcase',\n\t\t\tmessage:\n\t\t\t\t'showcase projects a browser app, and this workspace declares none, so it emits nothing.',\n\t\t\tblocking: false,\n\t\t})\n\t}\n\tquestions.push(\n\t\t...dependenciesToQuestions(\n\t\t\tblueprint.dependencies,\n\t\t\t'dependencies',\n\t\t\tDEPENDENCY_NAME_PATTERN,\n\t\t\tORKESTREL_RANGE_PATTERN,\n\t\t),\n\t\t...dependenciesToQuestions(\n\t\t\tblueprint.peers,\n\t\t\t'peers',\n\t\t\tDEPENDENCY_NAME_PATTERN,\n\t\t\tORKESTREL_RANGE_PATTERN,\n\t\t),\n\t\t...dependenciesToQuestions(blueprint.extras, 'extras', EXTRA_NAME_PATTERN, EXTRA_RANGE_PATTERN),\n\t)\n\tconst lists: ReadonlyArray<readonly [field: string, list: readonly Dependency[]]> = [\n\t\t['dependencies', blueprint.dependencies],\n\t\t['peers', blueprint.peers],\n\t\t['extras', blueprint.extras],\n\t]\n\tconst declared = new Map<string, string>()\n\tconst own = `@orkestrel/${blueprint.name}`\n\tfor (const [field, list] of lists) {\n\t\tfor (const dependency of list) {\n\t\t\tif (dependency.name === own || dependency.name === blueprint.name) {\n\t\t\t\tquestions.push({\n\t\t\t\t\tfield,\n\t\t\t\t\tmessage: `${dependency.name} is the workspace itself.`,\n\t\t\t\t\tblocking: true,\n\t\t\t\t})\n\t\t\t}\n\t\t\tconst first = declared.get(dependency.name)\n\t\t\tif (first === undefined) declared.set(dependency.name, field)\n\t\t\telse if (first !== field) {\n\t\t\t\tquestions.push({\n\t\t\t\t\tfield,\n\t\t\t\t\tmessage: `${dependency.name} is declared on both ${first} and ${field}.`,\n\t\t\t\t\tblocking: true,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\tfor (const extra of blueprint.extras) {\n\t\tif (Object.hasOwn(BASE_DEV_DEPENDENCIES, extra.name)) {\n\t\t\tquestions.push({\n\t\t\t\tfield: 'extras',\n\t\t\t\tmessage: `${extra.name} is pinned by the shared toolchain, which every workspace carries at one version.`,\n\t\t\t\tblocking: true,\n\t\t\t})\n\t\t}\n\t}\n\treturn questions\n}\n\n/**\n * Measure a drafted artifact list against the laws a whole plan decides.\n *\n * @param artifacts - The drafted artifacts.\n * @returns One blocking question per colliding path and per exceeded ceiling.\n *\n * @remarks\n * Two artifacts claiming one path is a compilation defect rather than a caller's\n * mistake: whichever is written last silently wins, so the plan is refused\n * instead. The ceilings are the ones the plan has to survive being read back\n * through — one artifact's bytes, the count of artifacts one collection admits,\n * and the bytes retained across a whole plan — so a plan that would fail its own\n * guard is refused while the failure can still name the artifact that caused it.\n *\n * A host artifact planned before its bytes are read contributes nothing to the\n * budget, because it claims no bytes to retain.\n *\n * @example\n * ```ts\n * import { artifactsToQuestions, blueprintToConfigArtifacts, createBlueprint } from '@orkestrel/scaffold'\n *\n * const artifacts = blueprintToConfigArtifacts(createBlueprint('router', { src: ['core'] }))\n *\n * artifactsToQuestions(artifacts).length === 0 // true\n * ```\n */\nexport function artifactsToQuestions(artifacts: readonly Artifact[]): readonly Question[] {\n\tconst questions: Question[] = []\n\tconst claimed = new Set<string>()\n\tlet total = 0\n\tfor (const artifact of artifacts) {\n\t\tif (claimed.has(artifact.path)) {\n\t\t\tquestions.push({\n\t\t\t\tfield: 'artifacts',\n\t\t\t\tmessage: `Two artifacts claim ${artifact.path}.`,\n\t\t\t\tblocking: true,\n\t\t\t})\n\t\t}\n\t\tclaimed.add(artifact.path)\n\t\tconst bytes =\n\t\t\tartifact.origin === 'host'\n\t\t\t\t? artifact.hex === undefined\n\t\t\t\t\t? 0\n\t\t\t\t\t: artifact.hex.length / 2\n\t\t\t\t: computeBytes(artifact.content)\n\t\tif (bytes > MAX_ARTIFACT_BYTES) {\n\t\t\tquestions.push({\n\t\t\t\tfield: 'artifacts',\n\t\t\t\tmessage: `${artifact.path} carries ${bytes} bytes, above the ${MAX_ARTIFACT_BYTES} one artifact admits.`,\n\t\t\t\tblocking: true,\n\t\t\t})\n\t\t}\n\t\ttotal += bytes\n\t}\n\tif (artifacts.length > MAX_COLLECTION_ITEMS) {\n\t\tquestions.push({\n\t\t\tfield: 'artifacts',\n\t\t\tmessage: `A plan of ${artifacts.length} artifacts is above the ${MAX_COLLECTION_ITEMS} one collection admits.`,\n\t\t\tblocking: true,\n\t\t})\n\t}\n\tif (total > MAX_TOTAL_ARTIFACT_BYTES) {\n\t\tquestions.push({\n\t\t\tfield: 'artifacts',\n\t\t\tmessage: `A plan of ${total} bytes is above the ${MAX_TOTAL_ARTIFACT_BYTES} one plan retains.`,\n\t\t\tblocking: true,\n\t\t})\n\t}\n\treturn questions\n}\n\n/**\n * Measure a blueprint's overrides against the artifacts drafted for it.\n *\n * @param overrides - The blueprint's overrides.\n * @param artifacts - The drafted artifacts, before overrides are applied.\n * @returns One blocking question per override the draft cannot accept.\n *\n * @remarks\n * An override that matches no planned artifact is a caller expecting a file that\n * does not exist, and applying nothing would leave that expectation\n * unanswered. An override on a host-origin artifact asks this package to\n * rewrite a file it byte-copies from the vendored data root, which it never\n * does. An override on the manifest asks it to rewrite the one artifact the\n * blueprint's own fields decide, so the fields would no longer describe the\n * workspace they generated. Each is refused rather than dropped.\n *\n * @example\n * ```ts\n * import { blueprintToConfigArtifacts, createBlueprint, overridesToQuestions } from '@orkestrel/scaffold'\n *\n * const artifacts = blueprintToConfigArtifacts(createBlueprint('router', { src: ['core'] }))\n *\n * overridesToQuestions([{ path: 'package.json', content: '{}\\n' }], artifacts).length // 1\n * ```\n */\nexport function overridesToQuestions(\n\toverrides: readonly Override[],\n\tartifacts: readonly Artifact[],\n): readonly Question[] {\n\tconst questions: Question[] = []\n\tconst planned = new Map<string, Artifact>()\n\tfor (const artifact of artifacts) {\n\t\tif (!planned.has(artifact.path)) planned.set(artifact.path, artifact)\n\t}\n\tconst seen = new Set<string>()\n\tfor (const override of overrides) {\n\t\tif (seen.has(override.path)) {\n\t\t\tquestions.push({\n\t\t\t\tfield: 'overrides',\n\t\t\t\tmessage: `${override.path} is overridden more than once.`,\n\t\t\t\tblocking: true,\n\t\t\t})\n\t\t}\n\t\tseen.add(override.path)\n\t\tconst artifact = planned.get(override.path)\n\t\tif (artifact === undefined) {\n\t\t\tquestions.push({\n\t\t\t\tfield: 'overrides',\n\t\t\t\tmessage: `${override.path} is not a path this plan carries.`,\n\t\t\t\tblocking: true,\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\t\tif (artifact.origin === 'host') {\n\t\t\tquestions.push({\n\t\t\t\tfield: 'overrides',\n\t\t\t\tmessage: `${override.path} is byte-copied from the vendored data root.`,\n\t\t\t\tblocking: true,\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\t\tif (artifact.group === 'manifest') {\n\t\t\tquestions.push({\n\t\t\t\tfield: 'overrides',\n\t\t\t\tmessage: `${override.path} is the manifest, which the blueprint's own fields decide.`,\n\t\t\t\tblocking: true,\n\t\t\t})\n\t\t}\n\t}\n\treturn questions\n}\n","import type { Parser } from '@orkestrel/contract'\nimport type { EmitterInterface } from '@orkestrel/emitter'\nimport type {\n\tArtifact,\n\tAudit,\n\tBlueprint,\n\tCompileRecord,\n\tCompilerEventMap,\n\tCompilerInterface,\n\tCompilerOptions,\n\tGroup,\n\tPlan,\n\tQuestion,\n\tScaffoldErrorCode,\n\tScaffolding,\n\tSnapshot,\n} from './types.js'\nimport { Emitter } from '@orkestrel/emitter'\nimport { cloneValue } from './cloners.js'\nimport {\n\tapplyOverrides,\n\tartifactsToQuestions,\n\tblueprintToConfigArtifacts,\n\tblueprintToDocumentArtifacts,\n\tblueprintToGuideArtifacts,\n\tblueprintToManifest,\n\tblueprintToOrchestrationArtifacts,\n\tblueprintToQuestions,\n\tblueprintToSourceArtifacts,\n\tblueprintToTestArtifacts,\n\tnameToHostArtifacts,\n\toverridesToQuestions,\n\tplanToFindings,\n\tplanToHash,\n} from './compilers.js'\nimport { GROUPS } from './constants.js'\nimport { ScaffoldError } from './errors.js'\nimport { selectGroups } from './helpers.js'\nimport { parseBlueprint, parseCompilerOptions, parseGroups, parseSnapshot } from './parsers.js'\n\n/**\n * The compile spine: draft, gate, pin, run in that order over a blueprint.\n *\n * @remarks\n * The draft stage assembles the artifacts the selected groups cover. The gate\n * stage measures the blueprint, its overrides, and the drafted artifacts, and\n * refuses on a blocking question. The pin stage gives the plan its content\n * identity. Every stage records its input and its output, and a failed stage\n * records the coded reason beside them; the stages after a failed one never run,\n * so the records stop where the compile stopped.\n *\n * The compile fails closed on one rule: a scaffolding carries a plan exactly\n * when no question blocks. A refused blueprint is answered rather than raised,\n * so a caller reads the refusal from the value it asked for.\n *\n * Both entry points snapshot each caller-supplied value and then guard the\n * snapshot, which is the order `cloneValue` fixes. A value that is not the exact\n * shape is off-contract input rather than an answerable question, so it raises\n * `INVALID`. Structure raises; the laws a well-formed blueprint can still break\n * are the gate's, and they answer with questions.\n *\n * Two consequences of that order are worth stating, because they are the ones a\n * JavaScript caller meets first. A property backed by an accessor is refused\n * rather than read, which is what closes the race a guard cannot close from\n * inside; the accessor never runs. And an optional field present with the value\n * `undefined` is not the exact shape either, which is the same law\n * `exactOptionalPropertyTypes` already states at compile time.\n *\n * Every error this compiler raises is emitted on `error` immediately before it\n * is thrown, so an observer sees a refusal even where the caller catches it.\n *\n * @example\n * ```ts\n * import { createBlueprint, Compiler } from '@orkestrel/scaffold'\n *\n * const compiler = new Compiler()\n * const scaffolding = compiler.compile(createBlueprint('router', { src: ['core'] }))\n * scaffolding.plan?.hash?.length // 16\n * compiler.destroy()\n * ```\n */\nexport class Compiler implements CompilerInterface {\n\treadonly #emitter: Emitter<CompilerEventMap>\n\t#destroyed = false\n\n\t/**\n\t * Construct a compiler.\n\t *\n\t * @param options - The initial listeners and the listener-error handler.\n\t * @throws {@link ScaffoldError} coded `INVALID` when `options` is present but\n\t * is not an option bag this compiler accepts.\n\t *\n\t * @remarks\n\t * The options are guarded and never snapshotted: they carry listeners, and a\n\t * function is not data a snapshot can take ownership of. A key outside the\n\t * event map is refused here, so a listener wired to a misspelled event fails\n\t * at construction instead of never firing.\n\t */\n\tconstructor(options?: CompilerOptions) {\n\t\tconst accepted = parseCompilerOptions(options)\n\t\tif (options !== undefined && accepted === undefined) {\n\t\t\tthrow new ScaffoldError(\n\t\t\t\t'INVALID',\n\t\t\t\t'The options argument is not the exact shape this compiler accepts.',\n\t\t\t\t{ field: 'options' },\n\t\t\t)\n\t\t}\n\t\tthis.#emitter = new Emitter<CompilerEventMap>({\n\t\t\t...(accepted?.on === undefined ? {} : { on: accepted.on }),\n\t\t\t...(accepted?.error === undefined ? {} : { error: accepted.error }),\n\t\t})\n\t}\n\n\t/** The compiler's observation channel. */\n\tget emitter(): EmitterInterface<CompilerEventMap> {\n\t\treturn this.#emitter\n\t}\n\n\t/**\n\t * Compile a blueprint into a plan through the draft, gate, and pin stages.\n\t *\n\t * @param blueprint - The workspace specification to compile.\n\t * @param groups - The artifact groups to cover; every group when absent.\n\t * @returns The scaffolding, carrying a plan only when the gate passed.\n\t * @throws {@link ScaffoldError} coded `INVALID` when an argument is not the\n\t * exact shape, and `DESTROYED` when the compiler has been torn down.\n\t *\n\t * @remarks\n\t * Emits `block` with the questions that closed the gate when the compile\n\t * carries no plan, then `compile` with the whole outcome either way, so an\n\t * observer reads every compile from one event and the refusals from the other.\n\t *\n\t * A plan says the blueprint can be built. It does not say the blueprint should\n\t * be created, and the questions beside it are what this compiler could not\n\t * settle. A caller creating a fresh workspace answers them first and writes\n\t * nothing while any remains, which is the rule the `new` verb applies; a caller\n\t * describing or repairing an existing target carries them through instead.\n\t * Nothing downstream repeats that check, because only the caller knows which of\n\t * the two it is.\n\t *\n\t * @example\n\t * ```ts\n\t * import { createBlueprint, createCompiler } from '@orkestrel/scaffold'\n\t *\n\t * const blueprint = createBlueprint('router', { src: ['core'] })\n\t *\n\t * createCompiler().compile(blueprint, ['manifest']).plan?.artifacts.length // 1\n\t * ```\n\t */\n\tcompile(blueprint: Blueprint, groups?: readonly Group[]): Scaffolding {\n\t\tthis.#assertAlive()\n\t\tconst accepted = this.#accept(blueprint, parseBlueprint, 'blueprint')\n\t\tconst scaffolding = this.#scaffold(accepted, this.#select(groups))\n\t\tif (scaffolding.plan === undefined) this.#emitter.emit('block', scaffolding.questions)\n\t\tthis.#emitter.emit('compile', scaffolding)\n\t\treturn scaffolding\n\t}\n\n\t/**\n\t * Compile a blueprint and compare its plan to a target's current content.\n\t *\n\t * @param blueprint - The workspace specification to compile.\n\t * @param current - The target's exact bytes, keyed by artifact-relative path.\n\t * @param groups - The artifact groups to cover; every group when absent.\n\t * @returns The audit; empty findings and blocking questions when the gate refused.\n\t * @throws {@link ScaffoldError} coded `INVALID` when an argument is not the\n\t * exact shape, and `DESTROYED` when the compiler has been torn down.\n\t *\n\t * @remarks\n\t * A compile that carries no plan says nothing about the target, so the audit\n\t * reports no findings and carries the questions instead. Emits `block` in that\n\t * case, then `audit` with the verdict either way.\n\t *\n\t * Ownership decides each verdict, not absence. A birth-owned path is never\n\t * compared and reads `aligned` against a target holding nothing, while a\n\t * content-owned path with no bytes to read is `missing`. An empty snapshot\n\t * therefore produces both verdicts rather than one.\n\t *\n\t * @example\n\t * ```ts\n\t * import { createBlueprint, createCompiler } from '@orkestrel/scaffold'\n\t *\n\t * const blueprint = createBlueprint('router', { src: ['core'] })\n\t *\n\t * createCompiler().audit(blueprint, {}, ['manifest']).findings[0]?.drift // 'aligned'\n\t * createCompiler().audit(blueprint, {}, ['configs']).findings[0]?.drift // 'missing'\n\t * ```\n\t */\n\taudit(blueprint: Blueprint, current: Snapshot, groups?: readonly Group[]): Audit {\n\t\tthis.#assertAlive()\n\t\tconst accepted = this.#accept(blueprint, parseBlueprint, 'blueprint')\n\t\tconst observed = this.#accept(current, parseSnapshot, 'current')\n\t\tconst scaffolding = this.#scaffold(accepted, this.#select(groups))\n\t\tif (scaffolding.plan === undefined) this.#emitter.emit('block', scaffolding.questions)\n\t\tconst result: Audit = {\n\t\t\tfindings: scaffolding.plan === undefined ? [] : planToFindings(scaffolding.plan, observed),\n\t\t\tquestions: scaffolding.questions,\n\t\t}\n\t\tthis.#emitter.emit('audit', result)\n\t\treturn result\n\t}\n\n\t/**\n\t * Tear the compiler down. Every later call throws, and teardown is idempotent.\n\t *\n\t * @returns Nothing.\n\t *\n\t * @example\n\t * ```ts\n\t * import { createCompiler } from '@orkestrel/scaffold'\n\t *\n\t * const compiler = createCompiler()\n\t * compiler.destroy()\n\t * compiler.emitter.destroyed // true\n\t * ```\n\t */\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 three stages in order, recording each one and stopping at the first\n\t// failure. Both public methods run this and choreograph their own events, so\n\t// an audit never emits a compile's completion.\n\t#scaffold(blueprint: Blueprint, groups: readonly Group[]): Scaffolding {\n\t\tconst stages: CompileRecord[] = []\n\t\tconst draft = this.#draft(blueprint)\n\t\tconst selected: Artifact[] = []\n\t\tfor (const group of groups) {\n\t\t\tfor (const artifact of draft) {\n\t\t\t\tif (artifact.group === group) selected.push(artifact)\n\t\t\t}\n\t\t}\n\t\tconst artifacts = applyOverrides(selected, blueprint.overrides)\n\t\tstages.push({ stage: 'draft', input: { blueprint, groups }, output: artifacts })\n\t\tconst questions = this.#gate(blueprint, draft, artifacts)\n\t\tconst blocking = questions.filter((question) => question.blocking)\n\t\tif (blocking.length > 0) {\n\t\t\tstages.push({\n\t\t\t\tstage: 'gate',\n\t\t\t\tinput: { blueprint, artifacts },\n\t\t\t\toutput: questions,\n\t\t\t\tfailure: {\n\t\t\t\t\tcode: 'BLOCKED',\n\t\t\t\t\tmessage: `The gate refused this blueprint on ${blocking.length} blocking question${blocking.length === 1 ? '' : 's'}.`,\n\t\t\t\t},\n\t\t\t})\n\t\t\treturn { questions, stages }\n\t\t}\n\t\tstages.push({ stage: 'gate', input: { blueprint, artifacts }, output: questions })\n\t\tconst drafted: Plan = { blueprint, groups, artifacts }\n\t\tconst hash = planToHash(drafted)\n\t\tif (hash === undefined) {\n\t\t\t// An unidentifiable plan is a question raised against the plan, so the\n\t\t\t// one fail-closed rule still decides it: no plan travels with a blocking\n\t\t\t// question beside it.\n\t\t\tconst refusal: Question = {\n\t\t\t\tfield: 'plan',\n\t\t\t\tmessage: 'The plan carries a value that cannot be encoded, so it has no identity.',\n\t\t\t\tblocking: true,\n\t\t\t}\n\t\t\tstages.push({\n\t\t\t\tstage: 'pin',\n\t\t\t\tinput: drafted,\n\t\t\t\toutput: undefined,\n\t\t\t\tfailure: { code: 'INVALID', message: refusal.message },\n\t\t\t})\n\t\t\treturn { questions: [...questions, refusal], stages }\n\t\t}\n\t\tconst plan: Plan = { ...drafted, hash }\n\t\tstages.push({ stage: 'pin', input: drafted, output: plan })\n\t\treturn { plan, questions, stages }\n\t}\n\n\t// Every artifact the blueprint drafts, in plan order. The manifest is the one artifact this\n\t// package's own fields decide, and it is claimed by birth because a workspace\n\t// owns its manifest once it exists. Every other drafted path is vendored. The\n\t// compile spine selects groups and applies overrides after this full set exists,\n\t// so override legality never depends on the caller's group selection.\n\t#draft(blueprint: Blueprint): readonly Artifact[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tpath: 'package.json',\n\t\t\t\tgroup: 'manifest',\n\t\t\t\townership: 'birth',\n\t\t\t\torigin: 'computed',\n\t\t\t\tcontent: blueprintToManifest(blueprint),\n\t\t\t},\n\t\t\t...blueprintToConfigArtifacts(blueprint),\n\t\t\t...blueprintToSourceArtifacts(blueprint),\n\t\t\t...blueprintToTestArtifacts(blueprint),\n\t\t\t...blueprintToGuideArtifacts(blueprint),\n\t\t\t...blueprintToDocumentArtifacts(blueprint),\n\t\t\t...blueprintToOrchestrationArtifacts(blueprint),\n\t\t\t...nameToHostArtifacts(blueprint.name),\n\t\t]\n\t}\n\n\t// Blueprint and override laws span the full draft. Artifact bounds measure the\n\t// selected, overridden list the plan will carry.\n\t#gate(\n\t\tblueprint: Blueprint,\n\t\tdraft: readonly Artifact[],\n\t\tartifacts: readonly Artifact[],\n\t): readonly Question[] {\n\t\treturn [\n\t\t\t...blueprintToQuestions(blueprint),\n\t\t\t...overridesToQuestions(blueprint.overrides, draft),\n\t\t\t...artifactsToQuestions(artifacts),\n\t\t]\n\t}\n\n\t// The groups boundary: absence covers every group, a selection is refused\n\t// unless it is one, and what survives is read as membership against `GROUPS`.\n\t#select(groups: readonly Group[] | undefined): readonly Group[] {\n\t\tconst selection =\n\t\t\tgroups === undefined ? undefined : this.#accept(groups, parseGroups, 'groups', GROUPS)\n\t\treturn selectGroups(selection)\n\t}\n\n\t// Snapshot the caller's value, then guard the snapshot. The snapshot is what\n\t// closes the guard/use race: a property backed by an accessor never reaches\n\t// the guard, so what the guard measured is what every later read returns.\n\t#accept<T>(value: unknown, parse: Parser<T>, field: string, candidates?: readonly string[]): T {\n\t\tconst accepted = parse(cloneValue(value))\n\t\tif (accepted !== undefined) return accepted\n\t\tthrow this.#error(\n\t\t\t'INVALID',\n\t\t\t`The ${field} argument is not the exact shape this compiler accepts.`,\n\t\t\tcandidates === undefined ? { field } : { field, candidates },\n\t\t)\n\t}\n\n\t#assertAlive(): void {\n\t\tif (this.#destroyed) throw this.#error('DESTROYED', 'This compiler has been destroyed.')\n\t}\n\n\t// Publish the failure on the observation channel, then hand it back to be\n\t// thrown at the site that decided it.\n\t#error(code: ScaffoldErrorCode, message: string, context?: unknown): ScaffoldError {\n\t\tconst error = new ScaffoldError(code, message, context)\n\t\tthis.#emitter.emit('error', error)\n\t\treturn error\n\t}\n}\n","import type { Blueprint, CompilerInterface, CompilerOptions } from './types.js'\nimport { Compiler } from './Compiler.js'\nimport { cloneValue } from './cloners.js'\nimport { DEFAULT_ENGINES, DEFAULT_VERSION } from './constants.js'\nimport { ScaffoldError } from './errors.js'\nimport { parseBlueprint } from './parsers.js'\n\n/**\n * Construct a {@link Blueprint} from a name and the fields that differ from the defaults.\n *\n * @param name - The bare workspace name.\n * @param input - The fields to set; every omitted field takes its default.\n * @returns The filled blueprint, owned by the caller and sharing nothing with `input`.\n * @throws {@link ScaffoldError} coded `INVALID` when the filled record is not a\n * blueprint.\n *\n * @remarks\n * A blueprint is a closed record, and most of its fields have one sensible\n * starting value: an empty list, a cleared flag, `DEFAULT_VERSION`, and\n * `DEFAULT_ENGINES`. Filling them here is what lets a caller state only what its\n * workspace actually declares.\n *\n * This is the construction door, and {@link parseBlueprint} is the coercing one.\n * They differ in all three of their parts: this fills the defaults and takes a\n * partial specification, where the parser fills nothing and takes an untrusted\n * value; and this refuses by throwing, where the parser refuses by answering\n * `undefined`. What they share is the law — both accept exactly what\n * `isBlueprint` accepts.\n *\n * That law is structural only. Whether the name is a name, the version a\n * version, and the two environment axes a combination this package can generate\n * are the gate's laws, and the gate answers them with {@link Question}s carrying\n * their accepted candidates. Deciding them here as well would state one law in\n * two places and let the two answers disagree, so a blueprint the gate will\n * refuse is still constructible.\n *\n * @example\n * ```ts\n * import { createBlueprint } from '@orkestrel/scaffold'\n *\n * createBlueprint('router', { src: ['core'] }).version // '0.0.1'\n * createBlueprint('Router').name // 'Router' — the gate refuses it, this does not\n * ```\n */\nexport function createBlueprint(name: string, input?: Partial<Omit<Blueprint, 'name'>>): Blueprint {\n\tconst candidate = {\n\t\tname,\n\t\t...(input?.description === undefined ? {} : { description: input.description }),\n\t\tkeywords: input?.keywords ?? [],\n\t\tsrc: input?.src ?? [],\n\t\tapp: input?.app ?? [],\n\t\tdependencies: input?.dependencies ?? [],\n\t\tpeers: input?.peers ?? [],\n\t\textras: input?.extras ?? [],\n\t\tversion: input?.version ?? DEFAULT_VERSION,\n\t\tengines: input?.engines ?? DEFAULT_ENGINES,\n\t\toverrides: input?.overrides ?? [],\n\t\tbin: input?.bin ?? false,\n\t\tguides: input?.guides ?? false,\n\t\tdistribution: input?.distribution ?? false,\n\t\tintegration: input?.integration ?? false,\n\t\tconformance: input?.conformance ?? false,\n\t\tservice: input?.service ?? false,\n\t\tvendors: input?.vendors ?? [],\n\t\tglobal: input?.global ?? false,\n\t\tshowcase: input?.showcase ?? false,\n\t}\n\tconst blueprint = parseBlueprint(cloneValue(candidate))\n\tif (blueprint === undefined) {\n\t\tthrow new ScaffoldError('INVALID', 'The filled record is not a blueprint.', { name })\n\t}\n\treturn blueprint\n}\n\n/**\n * Construct a {@link Compiler}.\n *\n * @param options - The initial listeners and the listener-error handler.\n * @returns The compiler, typed as the contract consumers program against.\n * @throws {@link ScaffoldError} coded `INVALID` when `options` is present but is\n * not an option bag the compiler accepts.\n *\n * @example\n * ```ts\n * import { createCompiler } from '@orkestrel/scaffold'\n *\n * const compiler = createCompiler({ on: { block: (questions) => report(questions) } })\n * compiler.destroy()\n * ```\n */\nexport function createCompiler(options?: CompilerOptions): CompilerInterface {\n\treturn new Compiler(options)\n}\n"],"mappings":";;;;;;;;;;;;;;AAWA,IAAa,eAAuC,OAAO,OAAO;CAAC;CAAQ;CAAW;AAAQ,CAAC;;;;;;;;;AAU/F,IAAa,SAA2B,OAAO,OAAO;CACrD;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;;;;;;;;;;;AAYD,IAAa,aAA2D,OAAO,OAAO;CACrF,MAAM,OAAO,OAAO;EACnB,SAAS,OAAO,OAAO,CAAC,mCAAmC,gCAAgC,CAAC;EAC5F,SAAS;EACT,MAAM;EACN,SAAS,OAAO,OAAsB,CAAC,MAAM,KAAK,CAAC;CACpD,CAAC;CACD,SAAS,OAAO,OAAO;EACtB,SAAS,OAAO,OAAO,CACtB,sCACA,mCACD,CAAC;EACD,SAAS;EACT,MAAM;EACN,SAAS,OAAO,OAAsB,CAAC,IAAI,CAAC;CAC7C,CAAC;CACD,QAAQ,OAAO,OAAO;EACrB,SAAS,OAAO,OAAO,CACtB,qCACA,kCACD,CAAC;EACD,SAAS;EACT,MA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,CAAC;CACtD,IAAI,cAAc,KAAA,GACjB,MAAM,IAAI,cAAc,WAAW,yCAAyC,EAAE,KAAK,CAAC;CAErF,OAAO;AACR;;;;;;;;;;;;;;;;;AAkBA,SAAgB,eAAe,SAA8C;CAC5E,OAAO,IAAI,SAAS,OAAO;AAC5B"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["#emitter","#assertAlive","#accept","#scaffold","#select","#destroyed","#draft","#gate","#error"],"sources":["../../../src/core/constants.ts","../../../src/core/templates.ts","../../../src/core/errors.ts","../../../src/core/validators.ts","../../../src/core/cloners.ts","../../../src/core/parsers.ts","../../../src/core/helpers.ts","../../../src/core/compilers.ts","../../../src/core/Compiler.ts","../../../src/core/factories.ts"],"sourcesContent":["import type { AppDefinition, BuildFormat, Environment, Group, SrcDefinition } from './types.js'\n\n/**\n * The three `Environment` values, frozen.\n *\n * @remarks\n * A blueprint's `src` and `app` axes are caller-supplied, so the gate measures\n * each selection against this list and reports it as the accepted candidates\n * when it rejects one. It is also the key order the per-environment matrices\n * are read in.\n */\nexport const ENVIRONMENTS: readonly Environment[] = Object.freeze(['core', 'browser', 'server'])\n\n/**\n * The seven `Group` values in plan order, frozen.\n *\n * @remarks\n * A compile that names no groups covers every one of them, so this list is the\n * default selection as well as the accepted candidates for a rejected one. The\n * order is the order a plan lists its artifacts in.\n */\nexport const GROUPS: readonly Group[] = Object.freeze([\n\t'manifest',\n\t'configs',\n\t'source',\n\t'tests',\n\t'guides',\n\t'docs',\n\t'orchestration',\n])\n\n/**\n * The build and export settings each published `src` environment contributes, frozen.\n *\n * @remarks\n * Per environment: the thin configuration files it adds under `configs/src`,\n * its Vitest project label, its `exports` subpath, and the module formats it\n * builds. Core alone occupies the package root, so it is the only environment\n * whose subpath is `.`; browser ships ES only because no CommonJS consumer\n * reaches it.\n */\nexport const SRC_MATRIX: Readonly<Record<Environment, SrcDefinition>> = Object.freeze({\n\tcore: Object.freeze({\n\t\tconfigs: Object.freeze(['configs/src/vite.core.config.ts', 'configs/src/tsconfig.core.json']),\n\t\tproject: 'src:core',\n\t\tpath: '.',\n\t\tformats: Object.freeze<BuildFormat[]>(['es', 'cjs']),\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]),\n\t\tproject: 'src:browser',\n\t\tpath: './browser',\n\t\tformats: Object.freeze<BuildFormat[]>(['es']),\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]),\n\t\tproject: 'src:server',\n\t\tpath: './server',\n\t\tformats: Object.freeze<BuildFormat[]>(['es', 'cjs']),\n\t}),\n})\n\n/**\n * The configuration and runtime-entry settings each private `app` environment contributes, frozen.\n *\n * @remarks\n * An application environment declares no exports, so it carries a runtime\n * entry instead of a subpath and formats. Core carries none because it is\n * shared logic the other two import rather than a host that runs.\n */\nexport const APP_MATRIX: Readonly<Record<Environment, AppDefinition>> = Object.freeze({\n\tcore: Object.freeze({\n\t\tconfigs: Object.freeze(['configs/app/tsconfig.core.json']),\n\t\tproject: 'app:core',\n\t}),\n\tbrowser: Object.freeze({\n\t\tconfigs: Object.freeze([\n\t\t\t'configs/app/vite.browser.config.ts',\n\t\t\t'configs/app/tsconfig.browser.json',\n\t\t]),\n\t\tproject: 'app:browser',\n\t\tentry: 'app/browser/index.html',\n\t}),\n\tserver: Object.freeze({\n\t\tconfigs: Object.freeze([\n\t\t\t'configs/app/vite.server.config.ts',\n\t\t\t'configs/app/tsconfig.server.json',\n\t\t]),\n\t\tproject: 'app:server',\n\t\tentry: 'app/server/main.ts',\n\t}),\n})\n\n/** The configuration files a workspace that ships its own executable adds, frozen. */\nexport const BIN_CONFIGS: readonly string[] = Object.freeze([\n\t'configs/src/vite.bin.config.ts',\n\t'configs/src/tsconfig.bin.json',\n])\n\n/** The executable entry whose presence makes a workspace `bin`. */\nexport const BIN_ENTRY_PATH = 'src/bin/main.ts'\n\n/**\n * The paths byte-copied from the vendored data root, frozen.\n *\n * @remarks\n * These are the files the fleet shares verbatim: the root instruction\n * documents, the licence, the canonical orchestration contract every harness\n * bridge points at, the four harness directories, the session hook scripts,\n * the shared policy register, the byte-identical root dotfiles, and the two\n * guide mirrors a generated workspace starts from. A directory entry vendors\n * everything beneath it.\n *\n * A plan carries the subset its target selects, which is why the list is a\n * candidate set rather than a plan: a workspace never mirrors its own guide.\n */\nexport const HOST_PATHS: readonly string[] = Object.freeze([\n\t'AGENTS.md',\n\t'CLAUDE.md',\n\t'LICENSE',\n\t'.agents/orchestration.md',\n\t'.agents/skills',\n\t'.claude/agents',\n\t'.claude/rules',\n\t'.claude/skills',\n\t'.claude/settings.json',\n\t'.codex/agents',\n\t'.codex/config.toml',\n\t'.cursor/mcp.json',\n\t'.cursor/rules',\n\t'.mcp.json',\n\t'scripts/deps.sh',\n\t'scripts/cursor.sh',\n\t'scripts/codex.sh',\n\t'scripts/ollama.sh',\n\t'tests/setupPolicy.ts',\n\t'tests/policy.test.ts',\n\t'tests/config.test.ts',\n\t'configs/helpers.ts',\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'guides/guide.md',\n\t'guides/scaffold.md',\n])\n\n/**\n * The vendored paths whose present bytes belong to each workspace, frozen.\n *\n * @remarks\n * These paths are copied into a workspace when absent and are never compared\n * or replaced while present. A workspace therefore stops receiving later\n * canonical updates to them. `.gitignore` takes that trade because its correct\n * rules differ by workspace, so scaffold cannot own its bytes.\n */\nexport const WORKSPACE_OWNED_PATHS: readonly string[] = Object.freeze(['.gitignore'])\n\n/**\n * The vendored paths a target receives with its executable bit set, frozen.\n *\n * @remarks\n * Declared rather than read from the staging host's filesystem, because that\n * reading is not portable: Windows carries no executable bit, so a host staged\n * there reports every file non-executable and every target receives hooks it\n * cannot run. Declaring the set here makes one checkout stage one manifest on\n * every host.\n *\n * Every entry is also a {@link HOST_PATHS} member or sits beneath one. A file\n * that must run when a target invokes it belongs here the moment it is vendored.\n */\nexport const EXECUTABLE_PATHS: readonly string[] = Object.freeze([\n\t'scripts/codex.sh',\n\t'scripts/cursor.sh',\n\t'scripts/deps.sh',\n\t'scripts/ollama.sh',\n])\n\n/**\n * The path prefixes whose contents instruct or wire an agent, frozen.\n *\n * @remarks\n * A path is grouped by what it governs rather than by where it sits: anything\n * beneath one of these prefixes is `orchestration`, and everything else that is\n * not source, tests, guides, docs, or a manifest is `configs`. A vendored path\n * and a foreign path found in a target are classified against the same list, so\n * a new harness directory is admitted once.\n */\nexport const ORCHESTRATION_PATH_PREFIXES: readonly string[] = Object.freeze([\n\t'.agents/',\n\t'.claude/',\n\t'.codex/',\n\t'.cursor/',\n\t'.github/',\n\t'scripts/',\n])\n\n/**\n * The exact root filenames that wire an agent bench rather than the toolchain, frozen.\n *\n * @remarks\n * `.mcp.json` registers MCP servers for the harness. It sits among the root\n * dotfiles but governs agents, so it groups with the harness bridges.\n */\nexport const ORCHESTRATION_PATH_NAMES: readonly string[] = Object.freeze(['.mcp.json'])\n\n/**\n * The agent file whose marker-bounded package table the catalog verb alone owns.\n *\n * @remarks\n * It is vendored like every other host artifact but claimed by presence rather\n * than content, so a consumer's own edits to the file survive every verb and\n * only the catalog verb rewrites the region inside the markers.\n */\nexport const CATALOG_AGENT_PATH = '.claude/agents/orkestrel.md'\n\n/** The provisioner skeleton a workspace with declared service vendors is given once. */\nexport const SERVICE_SCRIPT_PATH = 'scripts/service.sh'\n\n/** The shared Vitest global-setup module whose presence makes a workspace `global`. */\nexport const GLOBAL_SETUP_PATH = 'tests/setupGlobal.ts'\n\n/** The guide-parity proof whose presence selects the planned `guides` project. */\nexport const GUIDES_TEST_PATH = 'tests/guides.test.ts'\n\n/** The packed-package proof whose presence makes a workspace `distribution`. */\nexport const DISTRIBUTION_TEST_PATH = 'tests/distribution.test.ts'\n\n/** The cross-environment composition proof whose presence makes a workspace `integration`. */\nexport const INTEGRATION_TEST_PATH = 'tests/integration.test.ts'\n\n/** The official-tooling drift proof whose presence makes a workspace `conformance`. */\nexport const CONFORMANCE_TEST_PATH = 'tests/conformance.test.ts'\n\n/** The live-service readiness module whose presence makes a workspace `service`. */\nexport const SERVICE_SETUP_PATH = 'tests/setupService.ts'\n\n/** The include the live-service project covers, which is a directory rather than one proof. */\nexport const SERVICE_TEST_INCLUDE = 'tests/service/**/*.test.ts'\n\n/** The Vite wrapper whose presence makes a workspace `showcase`. */\nexport const SHOWCASE_CONFIG_PATH = 'configs/app/vite.showcase.config.ts'\n\n/** The bare workspace name syntax: lowercase alphanumeric with hyphens, letter first. */\nexport const NAME_PATTERN = /^[a-z][a-z0-9-]*$/\n\n/**\n * The runtime dependency name syntax: the `@orkestrel` scope and a bare name.\n *\n * @remarks\n * A dependency name reaches a path, because a workspace's guide mirror is\n * derived from it. Fixing the scope and forbidding everything but the bare name\n * after it is what stops a hand-built name from escaping the directory the\n * mirror belongs in.\n */\nexport const DEPENDENCY_NAME_PATTERN = /^@orkestrel\\/[a-z][a-z0-9-]*$/\n\n/**\n * The development extra name syntax: any valid npm package name.\n *\n * @remarks\n * Wider than a runtime dependency name on purpose. An extra is manifest content\n * and never reaches a path, so it may carry any scope or no scope at all. The\n * single optional `/` is still fixed to the one scope boundary, and neither `..`\n * nor a backslash is admitted, so the shape cannot express a traversal even\n * though it accepts far more names.\n */\nexport const EXTRA_NAME_PATTERN = /^(?:@[a-z0-9][a-z0-9._-]*\\/)?[a-z0-9][a-z0-9._-]*$/\n\n/** The exact three-component version syntax a blueprint declares. */\nexport const VERSION_PATTERN = /^(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)$/\n\n/**\n * The exact caret-pinned pre-1.0 range accepted for an `@orkestrel/*` runtime dependency.\n *\n * @remarks\n * Pre-1.0 means any `0.x`, not `0.0.x`. The narrower form would refuse the first\n * fleet package to reach `0.1.0`, and `catalog` pins to whatever the registry\n * publishes, so a single minor release would block every later run against a\n * workspace that had already been pinned to it.\n */\nexport const ORKESTREL_RANGE_PATTERN = /^\\^0\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)$/\n\n/** The registry-only semver subset accepted for a development extra's range. */\nexport const EXTRA_RANGE_PATTERN =\n\t/^(?:\\^|~)?(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)(?:-(?:0|[1-9]\\d*|\\d*[A-Za-z-][0-9A-Za-z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[A-Za-z-][0-9A-Za-z-]*))*)?$/\n\n/** The minimum-Node engine syntax a blueprint declares. */\nexport const ENGINES_PATTERN = /^>=(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)$/\n\n/** Exact lowercase hexadecimal bytes: two digits per byte, and empty content is valid. */\nexport const HEX_PATTERN = /^(?:[0-9a-f]{2})*$/\n\n/** Unicode controls, formatting controls, and line and paragraph separators rejected in text. */\nexport const CONTROL_CHARACTER_PATTERN = /[\\p{Cc}\\p{Cf}\\p{Zl}\\p{Zp}]/u\n\n/** Visible characters a target-relative path and a Markdown path cell both forbid. */\nexport const INVALID_PATH_CHARACTER_PATTERN = /[<>:\"|?*\\\\]/\n\n/**\n * Maximum bare workspace name length.\n *\n * @remarks\n * The registry caps a whole package name at 214 characters and the generated\n * scope `@orkestrel/` spends 11 of them.\n */\nexport const MAX_NAME_LENGTH = 203\n\n/** Maximum dependency package name length, scope included, as the registry caps it. */\nexport const MAX_DEPENDENCY_NAME_LENGTH = 214\n\n/** Maximum length of one declared package range. */\nexport const MAX_RANGE_LENGTH = 2_048\n\n/** Maximum length of one path, matching the longest a supported filesystem accepts. */\nexport const MAX_PATH_LENGTH = 32_767\n\n/** Maximum items accepted in one public collection. */\nexport const MAX_COLLECTION_ITEMS = 1_000\n\n/** Columns one emitted line may occupy, matching `printWidth` in `.oxfmtrc.json`. */\nexport const PRINT_WIDTH = 100\n\n/** Columns one tab occupies when the formatter measures a line, matching `tabWidth`. */\nexport const TAB_WIDTH = 2\n\n/** Maximum findings one audit can produce from a bounded plan and snapshot. */\nexport const MAX_AUDIT_FINDINGS = MAX_COLLECTION_ITEMS * 2\n\n/** Maximum bytes accepted for one artifact. */\nexport const MAX_ARTIFACT_BYTES = 5_242_880\n\n/** Maximum length of the hexadecimal string carrying one artifact's bytes. */\nexport const MAX_ARTIFACT_HEX_LENGTH = MAX_ARTIFACT_BYTES * 2\n\n/** Maximum bytes accepted for one package or vendored-host manifest. */\nexport const MAX_MANIFEST_BYTES = 1_048_576\n\n/** Maximum bytes retained across one whole plan or audit. */\nexport const MAX_TOTAL_ARTIFACT_BYTES = 104_857_600\n\n/** The oldest Node version the generated toolchain supports. */\nexport const MINIMUM_NODE_VERSION = '22.12.0'\n\n/** The version a workspace starts at. */\nexport const DEFAULT_VERSION = '0.0.1'\n\n/** The `engines.node` range a workspace starts with. */\nexport const DEFAULT_ENGINES = `>=${MINIMUM_NODE_VERSION}`\n\n/** The tooling versions scaffold and every generated workspace share. */\nexport const BASE_DEV_DEPENDENCIES: Readonly<Record<string, string>> = Object.freeze({\n\t'@orkestrel/guide': '^0.0.12',\n\t'@orkestrel/scaffold': '^0.0.40',\n\t'@orkestrel/test': '^0.0.6',\n\t'@types/node': '^26.2.0',\n\toxfmt: '^0.62.0',\n\toxlint: '^1.77.0',\n\ttypescript: '^6.0.3',\n\tvite: '~8.2.0',\n\tvitest: '^4.1.10',\n})\n\n/** The development dependencies that emit declarations for published source or an executable. */\nexport const DECLARATION_DEV_DEPENDENCIES: Readonly<Record<string, string>> = Object.freeze({\n\t'@microsoft/api-extractor': '^7.58.12',\n\t'vite-plugin-dts': '^5.0.3',\n})\n\n/** The development dependencies a published browser `src` environment adds. */\nexport const SOURCE_BROWSER_DEV_DEPENDENCIES: Readonly<Record<string, string>> = Object.freeze({\n\t'@vitest/browser-playwright': '^4.1.10',\n\tplaywright: '^1.62.1',\n})\n\n/** The development dependency every private `app` environment adds. */\nexport const APP_DEV_DEPENDENCIES: Readonly<Record<string, string>> = Object.freeze({\n\t'@orkestrel/contract': '^0.0.12',\n})\n\n/** The development dependencies a private Vue browser application adds. */\nexport const APP_BROWSER_DEV_DEPENDENCIES: Readonly<Record<string, string>> = Object.freeze({\n\t...SOURCE_BROWSER_DEV_DEPENDENCIES,\n\t'@orkestrel/html': '^0.0.4',\n\t'@vitejs/plugin-vue': '^6.0.8',\n\tvue: '^3.5.40',\n\t'vue-tsc': '^3.3.7',\n})\n\n/**\n * The development dependency used only by the optional single-file showcase build.\n *\n * @example\n * ```ts\n * import { SHOWCASE_DEV_DEPENDENCIES } from '@orkestrel/scaffold'\n *\n * SHOWCASE_DEV_DEPENDENCIES['vite-plugin-singlefile'] // '^2.3.3'\n * ```\n */\nexport const SHOWCASE_DEV_DEPENDENCIES: Readonly<Record<string, string>> = Object.freeze({\n\t'vite-plugin-singlefile': '^2.3.3',\n})\n\n/** The development dependencies a private server application adds. */\nexport const APP_SERVER_DEV_DEPENDENCIES: Readonly<Record<string, string>> = Object.freeze({\n\t'@orkestrel/emitter': '^0.0.7',\n\t'@orkestrel/middleware': '^0.0.13',\n\t'@orkestrel/router': '^0.0.10',\n\t'@orkestrel/server': '^0.0.13',\n})\n","import {\n\tBIN_ENTRY_PATH,\n\tCONFORMANCE_TEST_PATH,\n\tDISTRIBUTION_TEST_PATH,\n\tGUIDES_TEST_PATH,\n\tINTEGRATION_TEST_PATH,\n\tSERVICE_TEST_INCLUDE,\n} from './constants.js'\n\n/**\n * Formatter-stable template text for every configuration artifact.\n *\n * @remarks\n * Builders in `compilers.ts` fill these definitions through\n * `@orkestrel/template`. Fixed `lib` and `types` rows stay in the artifact\n * template that owns their scope. Only selection-dependent spans are filled.\n * App configs are check-only, so they include their mirrored tests and exact\n * setup modules. Source configs stay source-only because they emit declarations\n * under `rootDir`; widening them would emit declarations for tests.\n *\n * @example\n * ```ts\n * import { CONFIG_TEMPLATES } from '@orkestrel/scaffold'\n *\n * CONFIG_TEMPLATES.root.tsconfig.startsWith('{') // true\n * ```\n */\nexport const CONFIG_TEMPLATES = Object.freeze({\n\troot: Object.freeze({\n\t\ttsconfig: `{\n\t\"compilerOptions\": {\n\t\t\"target\": \"ESNext\",\n\t\t\"module\": \"ESNext\",\n\t\t\"moduleResolution\": \"bundler\",\n\t\t\"allowImportingTsExtensions\": true,\n\t\t\"lib\": [\"ESNext\", \"DOM\", \"DOM.Iterable\"],\n\t\t\"types\": [\"node\", \"vite/client\", \"vitest/globals\"],\n\t\t\"moduleDetection\": \"force\",\n\t\t\"resolveJsonModule\": true,\n\t\t\"strict\": true,\n\t\t\"verbatimModuleSyntax\": true,\n\t\t\"noUncheckedIndexedAccess\": true,\n\t\t\"noUncheckedSideEffectImports\": true,\n\t\t\"exactOptionalPropertyTypes\": true,\n\t\t\"noUnusedLocals\": true,\n\t\t\"noUnusedParameters\": true,\n\t\t\"noImplicitOverride\": true,\n\t\t\"noFallthroughCasesInSwitch\": true,\n\t\t\"forceConsistentCasingInFileNames\": true,\n\t\t\"skipLibCheck\": true,\n\t\t\"noEmit\": true,\n\t\t\"paths\": {\n{{paths}}\n\t\t}\n\t},\n\t\"exclude\": [\"node_modules\", \"dist\", \"tmp\"]\n}\n`,\n\t\tvite: `import type { {{viteTypes}} } from 'vite'\n{{imports}}import { defineConfig, mergeConfig } from 'vitest/config'\nimport tsconfig from './tsconfig.json' with { type: 'json' }\n{{helpers}}{{browsers}}import { fileURLToPath, URL } from 'node:url'\n\n{{options}}export function resolveWorkspacePath(relativePath: string): string {\n\treturn fileURLToPath(new URL(relativePath, import.meta.url))\n}\n\nconst resolve = {\n\talias: Object.entries(tsconfig.compilerOptions.paths).reduce((aliases, [key, values]) => {\n\t\tconst [path] = values\n\t\tif (path === undefined) throw new Error('tsconfig path alias ' + key + ' has no target')\n\t\treturn Object.assign(aliases, { [key]: resolveWorkspacePath(path) })\n\t}, {}),\n}\n\n{{factories}}export default defineConfig({\n\tresolve,\n\ttest: {\n{{projects}}\n\t},\n})\n`,\n\t}),\n\tfactories: Object.freeze({\n\t\tsrc: Object.freeze({\n\t\t\tcore: `export const srcCore = (options?: UserConfig): UserConfig =>\n\tmergeConfig(\n\t\t{\n\t\t\tresolve,\n\t\t\tpublicDir: false,\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\toptions ?? {},\n\t)\n`,\n\t\t\tbrowser: `export const srcBrowser = (options?: UserConfig): UserConfig =>\n\tmergeConfig(\n\t\t{\n\t\t\tresolve,\n\t\t\tpublicDir: false,\n\t\t\tplugins: [outputBoundary('dist/src/browser'), environmentBoundary('src/browser')],\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\t{{external}}\n{{output}}\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{{exclude}}\t\t\t\tsetupFiles: ['./tests/setup.ts', './tests/setupBrowser.ts'],\n{{global}}\n\t\t\t\tbrowser: {\n\t\t\t\t\tenabled: true,\n\t\t\t\t\tprovider: playwright(browserOptions),\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\toptions ?? {},\n\t)\n`,\n\t\t\tserver: `export const srcServer = (options?: UserConfig): UserConfig =>\n\tmergeConfig(\n\t\t{\n\t\t\tresolve,\n\t\t\tpublicDir: false,\n\t\t\tplugins: [outputBoundary('dist/src/server'), environmentBoundary('src/server')],\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: 'node22',\n\t\t\t\trolldownOptions: {\n\t\t\t\t\tplatform: 'node',\n\t\t\t\t\t{{external}}\n{{output}}\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{{exclude}}\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\toptions ?? {},\n\t)\n`,\n\t\t\tbin: `export const srcBin = (options?: UserConfig): UserConfig =>\n\tmergeConfig(\n\t\t{\n\t\t\tresolve,\n\t\t\tpublicDir: false,\n\t\t\tplugins: [outputBoundary('dist/bin')],\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('${BIN_ENTRY_PATH}'),\n\t\t\t\t\tformats: ['es'],\n\t\t\t\t\tfileName: () => 'main.js',\n\t\t\t\t},\n\t\t\t\toutDir: 'dist/bin',\n\t\t\t\ttarget: 'node22',\n\t\t\t\trolldownOptions: { external: [/^node:/, /^@orkestrel\\\\//, /^@src\\\\//] },\n\t\t\t},\n\t\t\ttest: {\n\t\t\t\tname: { label: 'src:bin', color: 'yellow' },\n\t\t\t\tinclude: ['tests/src/bin/**/*.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\t// A bin test drives the real executable over a real temporary repository, so it\n\t\t\t\t// spends seconds in process startup and filesystem work rather than milliseconds.\n\t\t\t\t// Vitest's five-second default clears one alone and times out under a full suite.\n\t\t\t\ttestTimeout: 15_000,\n\t\t\t},\n\t\t},\n\t\toptions ?? {},\n\t)\n`,\n\t\t}),\n\t\tapp: Object.freeze({\n\t\t\tcore: `export const appCore = (options?: UserConfig): UserConfig =>\n\tmergeConfig(\n\t\t{\n\t\t\tresolve,\n\t\t\tpublicDir: false,\n\t\t\tplugins: [environmentBoundary('app/core')],\n\t\t\ttest: {\n\t\t\t\tname: { label: 'app:core', color: 'cyan' },\n\t\t\t\tinclude: ['tests/app/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\toptions ?? {},\n\t)\n`,\n\t\t\tbrowser: `function applicationBrowser(showcase: boolean): UserConfig {\n\tconst output = showcase ? 'dist/showcase' : 'dist/app/browser'\n{{showcasePlugins}}\treturn {\n\t\tresolve,\n{{plugins}}\t\troot: resolveWorkspacePath('app/browser'),\n\t\tpublicDir: false,\n\t\tbuild: {\n{{showcaseBuild}}\t\t\temptyOutDir: true,\n\t\t\toutDir: resolveWorkspacePath(output),\n\t\t\trolldownOptions: { input: resolveWorkspacePath('app/browser/index.html') },\n\t\t},\n\t\ttest: {\n\t\t\tname: { label: 'app:browser', color: 'blue' },\n\t\t\troot: resolveWorkspacePath('.'),\n\t\t\tdir: resolveWorkspacePath('.'),\n\t\t\tinclude: ['tests/app/browser/**/*.test.ts'],\n\t\t\tsetupFiles: ['./tests/setup.ts', './tests/setupBrowser.ts'],\n\t\t\tbrowser: {\n\t\t\t\tenabled: true,\n\t\t\t\tprovider: playwright(browserOptions),\n\t\t\t\tinstances: [{ browser: 'chromium', headless: true }],\n\t\t\t},\n\t\t\tfileParallelism: false,\n\t\t},\n\t}\n}\n\nexport function appBrowser(): UserConfig {\n\treturn applicationBrowser(false)\n}\n{{showcaseFactory}}`,\n\t\t\tserver: `export const appServer = (options?: UserConfig): UserConfig =>\n\tmergeConfig(\n\t\t{\n\t\t\tresolve,\n\t\t\tpublicDir: false,\n\t\t\tplugins: [outputBoundary('dist/app/server'), environmentBoundary('app/server')],\n\t\t\tbuild: {\n\t\t\t\temptyOutDir: true,\n\t\t\t\tlib: {\n\t\t\t\t\tentry: resolveWorkspacePath('app/server/main.ts'),\n\t\t\t\t\tformats: ['cjs'],\n\t\t\t\t\tfileName: () => 'main.cjs',\n\t\t\t\t},\n\t\t\t\toutDir: resolveWorkspacePath('dist/app/server'),\n\t\t\t\ttarget: 'node22',\n\t\t\t\trolldownOptions: { external: (id: string) => id.startsWith('node:') },\n\t\t\t},\n\t\t\ttest: {\n\t\t\t\tname: { label: 'app:server', color: 'green' },\n\t\t\t\tinclude: ['tests/app/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\toptions ?? {},\n\t)\n`,\n\t\t}),\n\t\tpolicy: `export const policy = (options?: UserConfig): UserConfig =>\n\tmergeConfig(\n\t\t{\n\t\t\tresolve,\n\t\t\ttest: {\n\t\t\t\tname: { label: 'policy', color: 'white' },\n\t\t\t\tinclude: ['tests/policy.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\toptions ?? {},\n\t)\n`,\n\t\tconfig: `export const config = (options?: UserConfig): UserConfig =>\n\tmergeConfig(\n\t\t{\n\t\t\tresolve,\n\t\t\ttest: {\n\t\t\t\tname: { label: 'config', color: 'yellow' },\n\t\t\t\tinclude: ['tests/config.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\toptions ?? {},\n\t)\n`,\n\t\tguides: `export const guides = (options?: UserConfig): UserConfig =>\n\tmergeConfig(\n\t\t{\n\t\t\tresolve,\n\t\t\ttest: {\n\t\t\t\tname: { label: 'guides', color: 'green' },\n\t\t\t\tinclude: ['${GUIDES_TEST_PATH}'],\n\t\t\t\texclude: ['tests/src/**/*.test.ts', 'tests/app/**/*.test.ts', 'tests/setup.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\toptions ?? {},\n\t)\n`,\n\t\tconformance: `// Where this package drifts from the official tooling it stays compatible with.\n// The subject is this package, so the proof is hermetic and stays in \\`npm test\\`.\nexport const conformance = (options?: UserConfig): UserConfig =>\n\tmergeConfig(\n\t\t{\n\t\t\tresolve,\n\t\t\ttest: {\n\t\t\t\tname: { label: 'conformance', color: 'magenta' },\n\t\t\t\tinclude: ['${CONFORMANCE_TEST_PATH}'],\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\toptions ?? {},\n\t)\n`,\n\t\tservice: `// The live external services this package drives. It starts nothing itself:\n// \\`scripts/service.sh\\` provisions, \\`tests/setupService.ts\\` proves readiness, and\n// the project stays out of \\`npm test\\` because a real service answers it.\nexport const service = (options?: UserConfig): UserConfig =>\n\tmergeConfig(\n\t\t{\n\t\t\tresolve,\n\t\t\ttest: {\n\t\t\t\tname: { label: 'service', color: 'red' },\n\t\t\t\tinclude: ['${SERVICE_TEST_INCLUDE}'],\n\t\t\t\tsetupFiles: ['./tests/setup.ts', './tests/setupService.ts'],\n\t\t\t\tenvironment: 'node',\n\t\t\t\tbrowser: { enabled: false },\n\t\t\t\ttestTimeout: 120_000,\n\t\t\t\thookTimeout: 120_000,\n\t\t\t\tfileParallelism: false,\n\t\t\t},\n\t\t},\n\t\toptions ?? {},\n\t)\n`,\n\t\tdistribution: `export const distribution = (options?: UserConfig): UserConfig =>\n\tmergeConfig(\n\t\t{\n\t\t\tresolve,\n\t\t\ttest: {\n\t\t\t\tname: { label: 'distribution', color: 'cyan' },\n\t\t\t\tinclude: ['${DISTRIBUTION_TEST_PATH}'],\n\t\t\t\tsetupFiles: ['./tests/setup.ts'],\n\t\t\t\tenvironment: 'node',\n\t\t\t\ttestTimeout: 120_000,\n\t\t\t\thookTimeout: 120_000,\n\t\t\t\tfileParallelism: false,\n\t\t\t},\n\t\t},\n\t\toptions ?? {},\n\t)\n`,\n\t\tprobe: `// A workbench, not a proof. No gate selects this project.\nexport const probe = (options?: UserConfig): UserConfig =>\n\tmergeConfig(\n\t\t{\n\t\t\tresolve,\n\t\t\ttest: {\n\t\t\t\tname: { label: 'probe', color: 'gray' },\n\t\t\t\tinclude: ['tmp/probe/**/*.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\toptions ?? {},\n\t)\n`,\n\t\tintegration: `export const integration = (options?: UserConfig): UserConfig =>\n\tmergeConfig(\n\t\t{\n\t\t\tresolve,\n\t\t\ttest: {\n\t\t\t\tname: { label: 'integration', color: 'blue' },\n\t\t\t\tinclude: ['${INTEGRATION_TEST_PATH}'],\n\t\t\t\tsetupFiles: ['./tests/setup.ts'],\n{{global}}\t\t\t\tenvironment: 'node',\n\t\t\t},\n\t\t},\n\t\toptions ?? {},\n\t)\n`,\n\t}),\n\ttsconfigs: Object.freeze({\n\t\tsrc: Object.freeze({\n\t\t\tcore: `{\n\t\"extends\": \"../../tsconfig.json\",\n\t\"compilerOptions\": {\n\t\t\"lib\": [\"ESNext\", \"WebWorker\"],\n\t\t\"types\": [],\n\t\t\"noEmit\": false,\n\t\t\"declaration\": true,\n\t\t\"emitDeclarationOnly\": true,\n\t\t\"rootDir\": \"../../src/core\",\n\t\t\"outDir\": \"../../dist/src/core\"\n\t},\n\t\"include\": [\n\t\t\"../../src/core/**/*.cts\",\n\t\t\"../../src/core/**/*.mts\",\n\t\t\"../../src/core/**/*.ts\",\n\t\t\"../../src/core/**/*.tsx\"\n\t]\n}\n`,\n\t\t\tbrowser: `{\n\t\"extends\": \"../../tsconfig.json\",\n\t\"compilerOptions\": {\n\t\t\"lib\": [\"ESNext\", \"DOM\", \"DOM.Iterable\"],\n\t\t\"types\": [\"vite/client\"],\n\t\t\"noEmit\": false,\n\t\t\"declaration\": true,\n\t\t\"emitDeclarationOnly\": true,\n\t\t\"rootDir\": \"../../src\",\n\t\t\"outDir\": \"../../dist/src\"\n\t},\n\t\"include\": [\n\t\t\"../../src/browser/**/*.cts\",\n\t\t\"../../src/browser/**/*.mts\",\n\t\t\"../../src/browser/**/*.ts\",\n\t\t\"../../src/browser/**/*.tsx\"\n\t]\n}\n`,\n\t\t\tserver: `{\n\t\"extends\": \"../../tsconfig.json\",\n\t\"compilerOptions\": {\n\t\t\"lib\": [\"ESNext\"],\n\t\t\"types\": [\"node\"],\n\t\t\"noEmit\": false,\n\t\t\"declaration\": true,\n\t\t\"emitDeclarationOnly\": true,\n\t\t\"rootDir\": \"../../src\",\n\t\t\"outDir\": \"../../dist/src\"\n\t},\n\t\"include\": [\n\t\t\"../../src/server/**/*.cts\",\n\t\t\"../../src/server/**/*.mts\",\n\t\t\"../../src/server/**/*.ts\",\n\t\t\"../../src/server/**/*.tsx\"\n\t]\n}\n`,\n\t\t}),\n\t\tapp: Object.freeze({\n\t\t\tcore: `{\n\t\"extends\": \"../../tsconfig.json\",\n\t\"compilerOptions\": {\n\t\t\"lib\": [\"ESNext\", \"WebWorker\"],\n\t\t\"types\": []\n\t},\n\t\"include\": [\n\t\t\"../../app/core/**/*.cts\",\n\t\t\"../../app/core/**/*.mts\",\n\t\t\"../../app/core/**/*.ts\",\n\t\t\"../../app/core/**/*.tsx\",\n\t\t\"../../tests/app/core/**/*.cts\",\n\t\t\"../../tests/app/core/**/*.mts\",\n\t\t\"../../tests/app/core/**/*.ts\",\n\t\t\"../../tests/app/core/**/*.tsx\",\n\t\t\"../../tests/setup.ts\"\n\t]\n}\n`,\n\t\t\tbrowser: `{\n\t\"extends\": \"../../tsconfig.json\",\n\t\"compilerOptions\": {\n\t\t\"lib\": [\"ESNext\", \"DOM\", \"DOM.Iterable\"],\n\t\t\"types\": [\"vite/client\", \"vue\"]\n\t},\n\t\"include\": [\n{{include}}\n\t]\n}\n`,\n\t\t\tserver: `{\n\t\"extends\": \"../../tsconfig.json\",\n\t\"compilerOptions\": {\n\t\t\"lib\": [\"ESNext\"],\n\t\t\"types\": [\"node\"]\n\t},\n\t\"include\": [\n{{include}}\n\t]\n}\n`,\n\t\t}),\n\t\tbin: `{\n\t\"extends\": \"../../tsconfig.json\",\n\t\"compilerOptions\": {\n\t\t\"lib\": [\"ESNext\"],\n\t\t\"types\": [\"node\"],\n\t\t\"noEmit\": false,\n\t\t\"declaration\": true,\n\t\t\"emitDeclarationOnly\": true,\n\t\t\"rootDir\": \"../../src\",\n\t\t\"outDir\": \"../../dist/bin\"\n\t},\n\t\"include\": [\n\t\t\"../../src/bin/**/*.cts\",\n\t\t\"../../src/bin/**/*.mts\",\n\t\t\"../../src/bin/**/*.ts\",\n\t\t\"../../src/bin/**/*.tsx\"\n\t]\n}\n`,\n\t}),\n\tvites: Object.freeze({\n\t\tsrc: Object.freeze({\n\t\t\tcore: `import { defineConfig } from 'vite'\nimport dts from 'vite-plugin-dts'\nimport { environmentBoundary, outputBoundary } from '../helpers.js'\nimport { srcCore, resolveWorkspacePath } from '../../vite.config.ts'\n\nexport default defineConfig(\n\tsrcCore({\n\t\tpublicDir: false,\n\t\tplugins: [\n\t\t\toutputBoundary('dist/src/core'),\n\t\t\tenvironmentBoundary('src/core'),\n\t\t\tdts({\n\t\t\t\ttsconfigPath: resolveWorkspacePath('configs/src/tsconfig.core.json'),\n\t\t\t\tbundleTypes: {\n\t\t\t\t\textractorConfig: {\n\t\t\t\t\t\tcompiler: {\n\t\t\t\t\t\t\toverrideTsconfig: {\n\t\t\t\t\t\t\t\tcompilerOptions: { types: ['node'] },\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}),\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\trolldownOptions: { external: [/^node:/, /^@orkestrel\\\\//] },\n\t\t},\n\t}),\n)\n`,\n\t\t\tbrowser: `import { defineConfig } from 'vite'\nimport dts from 'vite-plugin-dts'\nimport { srcBrowser, resolveWorkspacePath } from '../../vite.config.ts'\n\n// vite-plugin-dts rolls this face into one declaration, and the roll-up reaches\n// src/core through a relative source path the tarball does not carry. The path\n// keeps each source module's own depth, so a module in a browser subfolder emits\n// one that leaves dist/src entirely. The rewrite below externalizes core through\n// the package's own published root export, on the final roll-up only.\nexport default defineConfig(\n\tsrcBrowser({\n\t\tplugins: [\n\t\t\tdts({\n\t\t\t\ttsconfigPath: resolveWorkspacePath('configs/src/tsconfig.browser.json'),\n\t\t\t\tbundleTypes: true,\n\t\t\t\tbeforeWriteFile: (path, content) => ({\n\t\t\t\t\tcontent: /[\\\\\\\\/]dist[\\\\\\\\/]src[\\\\\\\\/]browser[\\\\\\\\/]index\\\\.d\\\\.ts$/.test(path)\n{{replacement}}\n\t\t\t\t\t\t: content,\n\t\t\t\t}),\n\t\t\t}),\n\t\t],\n\t}),\n)\n`,\n\t\t\tserver: `import { defineConfig } from 'vite'\nimport dts from 'vite-plugin-dts'\nimport { srcServer, resolveWorkspacePath } from '../../vite.config.ts'\n\n// vite-plugin-dts rolls this face into one declaration, and the roll-up reaches\n// src/core through a relative source path the tarball does not carry. The rewrite\n// below externalizes core through the package's own published root export, on the\n// final roll-up only.\nexport default defineConfig(\n\tsrcServer({\n\t\tplugins: [\n\t\t\tdts({\n\t\t\t\ttsconfigPath: resolveWorkspacePath('configs/src/tsconfig.server.json'),\n\t\t\t\tbundleTypes: true,\n\t\t\t\tbeforeWriteFile: (path, content) => ({\n\t\t\t\t\tcontent: /[\\\\\\\\/]dist[\\\\\\\\/]src[\\\\\\\\/]server[\\\\\\\\/]index\\\\.d\\\\.ts$/.test(path)\n{{replacement}}\n\t\t\t\t\t\t: content,\n\t\t\t\t}),\n\t\t\t}),\n\t\t],\n\t}),\n)\n`,\n\t\t}),\n\t\tbin: `import { defineConfig } from 'vite'\nimport { srcBin } from '../../vite.config.ts'\n\n// The \\`scaffold\\` executable build — a single ESM lib file, no declarations (an\n// executable ships no types), with the \\`#!/usr/bin/env node\\` shebang re-emitted via\n// \\`output.banner\\` (rolldown strips shebangs from source during bundling), and\n// \\`output.paths\\` rewriting the externalized \\`@src/*\\` specifiers to the built sibling\n// src environments (relative to \\`dist/bin/\\`), so the emitted bin resolves at runtime.\nexport default defineConfig(\n\tsrcBin({\n\t\tbuild: {\n\t\t\trolldownOptions: {\n\t\t\t\toutput: {\n\t\t\t\t\tbanner: '#!/usr/bin/env node',\n{{paths}}\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}),\n)\n`,\n\t\tapp: Object.freeze({\n\t\t\tbrowser: `import { defineConfig } from 'vite'\nimport { appBrowser } from '../../vite.config.ts'\n\nexport default defineConfig(appBrowser())\n`,\n\t\t\tserver: `import { defineConfig } from 'vite'\nimport { appServer } from '../../vite.config.ts'\n\nexport default defineConfig(appServer())\n`,\n\t\t\tshowcase: `import { defineConfig } from 'vite'\nimport { appShowcase } from '../../vite.config.ts'\n\nexport default defineConfig(appShowcase())\n`,\n\t\t}),\n\t}),\n\tbrowsers: `// A generated browser workspace resolves its own Chromium here rather than in\n// \\`configs/helpers.ts\\`, because that leaf is vendored byte-identical to every\n// workspace and most of them declare no \\`playwright\\` to import.\n\nimport type { PlaywrightProviderOptions } from '@vitest/browser-playwright'\nimport { chromium } from 'playwright'\nimport { accessSync, constants as FS_CONSTANTS, globSync, readdirSync, statSync } from 'node:fs'\nimport { basename, dirname, join, resolve as resolvePath } from 'node:path'\n\n/**\n * Chromium executable layouts inside a \\`chromium-<revision>\\` browsers-directory entry, per\n * platform.\n *\n * @remarks\n * The current Playwright build ships Chrome for Testing on macOS. The trailing \\`Chromium.app\\`\n * layouts are what earlier builds shipped, so the list spans Playwright versions instead of\n * pinning to the installed one.\n */\nexport const CHROMIUM_LAYOUTS = Object.freeze([\n\t'chrome-linux/chrome',\n\t'chrome-linux64/chrome',\n\t'chrome-win/chrome.exe',\n\t'chrome-win64/chrome.exe',\n\t'chrome-mac-x64/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing',\n\t'chrome-mac-arm64/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing',\n\t'chrome-mac/Chromium.app/Contents/MacOS/Chromium',\n\t'chrome-mac-arm64/Chromium.app/Contents/MacOS/Chromium',\n])\n\n/** The \\`chromium-<revision>\\` entry name Playwright installs one managed build into. */\nexport const CHROMIUM_ENTRY_PATTERN = /^chromium-\\\\d+$/\n\n/** The revision number carried by any path containing a \\`chromium-<revision>\\` segment. */\nexport const CHROMIUM_REVISION_PATTERN = /chromium-(\\\\d+)/\n\n/** The directory a managed Linux container installs its bundled Playwright browsers into. */\nexport const BUNDLED_BROWSERS_ROOT = '/opt/pw-browsers'\n\n/**\n * Bundled Chromium layouts under the managed-container browsers root, as glob patterns.\n *\n * @remarks\n * The revision directory and its inner layout both drift across Playwright builds, and the\n * container also carries a top-level \\`chromium\\` alias, so every known shape is globbed.\n */\nexport const BUNDLED_CHROMIUM_LAYOUTS = Object.freeze([\n\t'chromium',\n\t'chromium-*/chrome-linux64/chrome',\n\t'chromium-*/chrome-linux/chrome',\n])\n\n/** Stable Playwright Chromium channels and their standard executable layouts. */\nexport const SYSTEM_BROWSER_CHANNELS = Object.freeze([\n\tObject.freeze({\n\t\tchannel: 'chrome',\n\t\tlayouts: Object.freeze({\n\t\t\tlinux: '/opt/google/chrome/chrome',\n\t\t\tdarwin: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',\n\t\t\twin32: Object.freeze(['Google', 'Chrome', 'Application', 'chrome.exe']),\n\t\t}),\n\t}),\n\tObject.freeze({\n\t\tchannel: 'msedge',\n\t\tlayouts: Object.freeze({\n\t\t\tlinux: '/opt/microsoft/msedge/msedge',\n\t\t\tdarwin: '/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge',\n\t\t\twin32: Object.freeze(['Microsoft', 'Edge', 'Application', 'msedge.exe']),\n\t\t}),\n\t}),\n])\n\n/**\n * Determine whether a path identifies an executable regular file.\n *\n * @param path - The filesystem path to inspect.\n * @returns Whether the path is a regular file with execute access.\n *\n * @example\n * \\`\\`\\`ts\n * isBrowserExecutable('/opt/google/chrome/chrome')\n * \\`\\`\\`\n */\nexport function isBrowserExecutable(path: string): boolean {\n\ttry {\n\t\tif (!statSync(path).isFile()) return false\n\t\taccessSync(path, FS_CONSTANTS.X_OK)\n\t\treturn true\n\t} catch {\n\t\treturn false\n\t}\n}\n\n/**\n * Order two Chromium paths so the highest revision sorts first.\n *\n * @param left - The first path or directory entry to compare.\n * @param right - The second path or directory entry to compare.\n * @returns A negative number when \\`left\\` sorts first, positive when \\`right\\` does.\n *\n * @remarks\n * Revisions are numbers, so \\`chromium-1200\\` outranks \\`chromium-999\\` despite sorting below it\n * lexically. A path carrying no revision falls back to descending name order.\n *\n * @example\n * \\`\\`\\`ts\n * ['chromium-999', 'chromium-1200'].sort(compareRevisions)\n * \\`\\`\\`\n */\nexport function compareRevisions(left: string, right: string): number {\n\tconst leftRevision = CHROMIUM_REVISION_PATTERN.exec(left)?.[1]\n\tconst rightRevision = CHROMIUM_REVISION_PATTERN.exec(right)?.[1]\n\tif (leftRevision === undefined || rightRevision === undefined) return right.localeCompare(left)\n\treturn Number(rightRevision) - Number(leftRevision)\n}\n\n/**\n * Read the executable path of Playwright's pinned Chromium revision.\n *\n * @returns The pinned executable path, or \\`undefined\\` when this platform has none.\n *\n * @remarks\n * Playwright throws rather than returning a path when the current platform carries no initialized\n * executable, and an unguarded call would fail configuration evaluation for every project.\n *\n * @example\n * \\`\\`\\`ts\n * resolvePinnedBrowser()\n * \\`\\`\\`\n */\nexport function resolvePinnedBrowser(): string | undefined {\n\ttry {\n\t\tconst pinned = chromium.executablePath()\n\t\treturn pinned.length === 0 ? undefined : pinned\n\t} catch {\n\t\treturn undefined\n\t}\n}\n\n/**\n * Resolve a launchable Playwright-managed Chromium executable: the pinned revision when installed,\n * otherwise a \\`chromium\\` / \\`chromium.exe\\` alias or any other \\`chromium-*\\` revision under the same\n * Playwright browsers directory. A pinned-revision miss is not Chromium absence — managed\n * containers ship one usable build, often behind a revision-agnostic alias, for many Playwright\n * versions.\n *\n * @param pinned - The executable path for Playwright's pinned Chromium revision.\n * @returns The managed executable path, or \\`undefined\\` when none is executable.\n *\n * @example\n * \\`\\`\\`ts\n * resolveManagedBrowser('/root/.cache/ms-playwright/chromium-1234/chrome-linux64/chrome')\n * \\`\\`\\`\n */\nexport function resolveManagedBrowser(pinned: string): string | undefined {\n\tif (isBrowserExecutable(pinned)) return pinned\n\tlet revisionRoot = dirname(pinned)\n\tfor (;;) {\n\t\tif (CHROMIUM_ENTRY_PATTERN.test(basename(revisionRoot))) break\n\t\tconst parent = dirname(revisionRoot)\n\t\tif (parent === revisionRoot) return undefined\n\t\trevisionRoot = parent\n\t}\n\tconst browsersRoot = dirname(revisionRoot)\n\tfor (const alias of ['chromium', 'chromium.exe']) {\n\t\tconst candidate = resolvePath(browsersRoot, alias)\n\t\tif (isBrowserExecutable(candidate)) return candidate\n\t}\n\tlet entries: readonly string[]\n\ttry {\n\t\tentries = readdirSync(browsersRoot)\n\t} catch {\n\t\treturn undefined\n\t}\n\tconst revisions = entries\n\t\t.filter((entry) => CHROMIUM_ENTRY_PATTERN.test(entry))\n\t\t.sort(compareRevisions)\n\tfor (const revision of revisions) {\n\t\tfor (const layout of CHROMIUM_LAYOUTS) {\n\t\t\tconst candidate = resolvePath(browsersRoot, revision, layout)\n\t\t\tif (isBrowserExecutable(candidate)) return candidate\n\t\t}\n\t}\n\treturn undefined\n}\n\n/**\n * Resolve the Chromium a managed Linux container bundles outside the Playwright cache.\n *\n * @param platform - The Node platform the container runs on.\n * @param root - The bundled browsers directory to search.\n * @returns The highest matching executable path, or \\`undefined\\` when none is executable.\n *\n * @example\n * \\`\\`\\`ts\n * resolveBundledBrowser('linux', BUNDLED_BROWSERS_ROOT)\n * \\`\\`\\`\n */\nexport function resolveBundledBrowser(platform: NodeJS.Platform, root: string): string | undefined {\n\tif (platform !== 'linux') return undefined\n\tfor (const layout of BUNDLED_CHROMIUM_LAYOUTS) {\n\t\tlet matches: readonly string[]\n\t\ttry {\n\t\t\tmatches = globSync(layout, { cwd: root })\n\t\t} catch {\n\t\t\treturn undefined\n\t\t}\n\t\tfor (const match of [...matches].sort(compareRevisions)) {\n\t\t\tconst candidate = resolvePath(root, match)\n\t\t\tif (isBrowserExecutable(candidate)) return candidate\n\t\t}\n\t}\n\treturn undefined\n}\n\n/**\n * Resolve the first installed stable system Chromium channel.\n *\n * @param platform - The Node platform whose standard layouts should be probed.\n * @param environment - The process environment supplying Windows installation roots.\n * @returns \\`chrome\\`, then \\`msedge\\`, or \\`undefined\\` when neither is executable.\n *\n * @example\n * \\`\\`\\`ts\n * resolveSystemBrowser(process.platform, process.env)\n * \\`\\`\\`\n */\nexport function resolveSystemBrowser(\n\tplatform: NodeJS.Platform,\n\tenvironment: NodeJS.ProcessEnv,\n): string | undefined {\n\tif (platform !== 'linux' && platform !== 'darwin' && platform !== 'win32') return undefined\n\tconst roots = new Set<string>()\n\tif (platform === 'win32') {\n\t\tfor (const root of [\n\t\t\tenvironment.LOCALAPPDATA,\n\t\t\tenvironment.PROGRAMFILES,\n\t\t\tenvironment['PROGRAMFILES(X86)'],\n\t\t]) {\n\t\t\tif (root !== undefined && root.length > 0) roots.add(root)\n\t\t}\n\t\tconst homeDrive = environment.HOMEDRIVE\n\t\tif (homeDrive !== undefined && homeDrive.length > 0) {\n\t\t\troots.add(join(homeDrive, 'Program Files'))\n\t\t\troots.add(join(homeDrive, 'Program Files (x86)'))\n\t\t}\n\t}\n\tfor (const browser of SYSTEM_BROWSER_CHANNELS) {\n\t\tif (platform === 'win32') {\n\t\t\tfor (const root of roots) {\n\t\t\t\tif (isBrowserExecutable(join(root, ...browser.layouts.win32))) return browser.channel\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tif (isBrowserExecutable(browser.layouts[platform])) return browser.channel\n\t}\n\treturn undefined\n}\n\n/**\n * Resolve Playwright provider options for whatever browser this host can actually launch.\n *\n * @param pinned - The executable path for Playwright's pinned Chromium revision, when it has one.\n * @param platform - The Node platform whose standard layouts should be probed.\n * @param environment - The process environment supplying operator overrides and Windows roots.\n * @param root - The managed-container bundled browsers directory to search.\n * @returns Provider options naming an executable, a WebSocket endpoint, or a channel.\n *\n * @remarks\n * Precedence, most important first: \\`PLAYWRIGHT_EXECUTABLE_PATH\\`, \\`PLAYWRIGHT_WS_ENDPOINT\\`,\n * \\`PLAYWRIGHT_CHANNEL\\`, the managed Playwright Chromium, the container's bundled Chromium, a\n * verified system channel, then the platform default channel. An operator override outranks\n * discovery and is returned exactly as given: none of those three environment values is checked\n * against the filesystem, because verifying an override would defeat the override. The pinned\n * managed revision outranks anything found on the host because it is deterministic. The installed\n * pinned revision returns empty options so Playwright keeps its own default launch semantics. Only\n * a discovered system channel is verified before it is named. The platform default is unverified\n * as well and exists only as a last resort: Windows takes \\`msedge\\`, which ships with the OS and\n * never collides with a foreground Chrome.\n *\n * @example\n * \\`\\`\\`ts\n * resolveBrowser(resolvePinnedBrowser(), process.platform, process.env)\n * \\`\\`\\`\n */\nexport function resolveBrowser(\n\tpinned: string | undefined,\n\tplatform: NodeJS.Platform,\n\tenvironment: NodeJS.ProcessEnv,\n\troot: string = BUNDLED_BROWSERS_ROOT,\n): PlaywrightProviderOptions {\n\tconst executable = environment.PLAYWRIGHT_EXECUTABLE_PATH\n\tif (executable !== undefined && executable.length > 0) {\n\t\treturn { launchOptions: { executablePath: executable } }\n\t}\n\tconst endpoint = environment.PLAYWRIGHT_WS_ENDPOINT\n\tif (endpoint !== undefined && endpoint.length > 0) {\n\t\treturn { connectOptions: { wsEndpoint: endpoint } }\n\t}\n\tconst requested = environment.PLAYWRIGHT_CHANNEL\n\tif (requested !== undefined && requested.length > 0) {\n\t\treturn { launchOptions: { channel: requested } }\n\t}\n\tconst managed = pinned === undefined ? undefined : resolveManagedBrowser(pinned)\n\tif (managed !== undefined) {\n\t\treturn managed === pinned ? {} : { launchOptions: { executablePath: managed } }\n\t}\n\tconst bundled = resolveBundledBrowser(platform, root)\n\tif (bundled !== undefined) return { launchOptions: { executablePath: bundled } }\n\tconst fallback = platform === 'win32' ? 'msedge' : 'chrome'\n\treturn { launchOptions: { channel: resolveSystemBrowser(platform, environment) ?? fallback } }\n}\n`,\n})\n\n/**\n * Formatter-stable template text for source, test, document, guide, and service artifacts.\n *\n * @remarks\n * Builders in `compilers.ts` fill every varying span through\n * `@orkestrel/template`. Empty barrels, entries, and setup modules are\n * intentional: the generated workspace starts with no sample domain API, while\n * each selected Vitest project gets a real test that proves its barrel has no\n * starter exports. An entry starts empty for the same reason its barrel does,\n * and because the vendored lint config refuses an unassigned import outside a\n * stylesheet, so a starter `import './index.js'` would fail the workspace's own\n * `lint:check` on the day it is written.\n *\n * @example\n * ```ts\n * import { ARTIFACT_TEMPLATES } from '@orkestrel/scaffold'\n *\n * ARTIFACT_TEMPLATES.source.empty // ''\n * ```\n */\nexport const ARTIFACT_TEMPLATES = Object.freeze({\n\tsource: Object.freeze({\n\t\tempty: '',\n\t\tbrowser: `<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<meta charset=\"UTF-8\" />\n\t\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n\t\t<title>Application</title>\n\t</head>\n\t<body>\n\t\t<script type=\"module\" src=\"/main.ts\"></script>\n\t</body>\n</html>\n`,\n\t}),\n\ttests: Object.freeze({\n\t\tsetup: '',\n\t\tglobal: `export function setup(): void {}\n`,\n\t\tentry: `import * as entry from {{specifier}}\nimport { describe, expect, it } from 'vitest'\n\ndescribe({{label}}, () => {\n\tit('has no starter exports', () => {\n\t\texpect(Object.keys(entry)).toStrictEqual([])\n\t})\n})\n`,\n\t\tbin: `import { describe, expect, it } from 'vitest'\n\ndescribe('bin entry', () => {\n\tit('has no starter exports', async () => {\n{{import}}\n\t\texpect(Object.keys(entry)).toStrictEqual([])\n\t})\n})\n`,\n\t\tintegration: `{{imports}}import { describe, expect, it } from 'vitest'\n\ndescribe('workspace integration', () => {\n\tit('loads every selected public barrel together as a composition seed', () => {\n\t\t// Replace this empty-barrel seed with one observable flow that passes one\n\t\t// environment's public result into another.\n\t\t{{actual}}{{expected}})\n\t})\n})\n`,\n\t}),\n\tdocs: Object.freeze({\n\t\treadme: `# {{package}}\n\n{{description}}\n\n## Development\n\n\\`\\`\\`sh\nnpm install\nnpm test\n\\`\\`\\`\n`,\n\t}),\n\tguides: Object.freeze({\n\t\treadme: `# Guides\n\n## By concept\n\n- Package\n - Spec: Not created. Create this file when the workspace has a public surface:\n \\`guides/{{guide}}.md\\`\n - Source:\n{{source}}\n - Tests:\n{{tests}}\n\n## By directory\n\n{{directories}}\n`,\n\t}),\n\torchestration: Object.freeze({\n\t\tservice: `#!/usr/bin/env sh\nset -eu\n\nprintf '%s\\\\n' \\\\\n{{vendors}}\n`,\n\t}),\n})\n","import type { ScaffoldErrorCode } from './types.js'\n\n/**\n * The one error this package throws, carrying the coded reason it was raised.\n *\n * @remarks\n * Each code names one cause: `INVALID` for off-contract input, `DESTROYED` for\n * any call made after teardown, `TARGET` for a destination that is not what the\n * caller's observation said it was, `WRITE` for a mutation that could not be\n * completed, `FETCH` for an upstream read that produced no answer the caller can\n * be given, and `BLOCKED` for a refused blueprint.\n *\n * `BLOCKED` covers both refusals a blueprint can meet, because they are one fact\n * — this blueprint will not be built — and the questions say which. The compiler\n * answers its refusal rather than throwing it: the gate fails closed, returns the\n * questions that closed it, and records `BLOCKED` on its stage, so a caller reads\n * that refusal from the value it asked for. A verb that creates a workspace\n * throws it, because it chose the shape and has nothing to hand back. A blocking\n * question closed the gate; a non-blocking one is a shape this package can\n * describe and declines to create.\n *\n * `context` carries whatever the raising site can say about the failure. It is\n * `unknown` because nothing narrows it usefully at the catch site; read it for\n * a report, never branch on it.\n *\n * @example\n * ```ts\n * import { ScaffoldError, isScaffoldError } from '@orkestrel/scaffold'\n *\n * try {\n * \tthrow new ScaffoldError('INVALID', 'Blueprint is not an exact record')\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\t/**\n\t * Construct a coded scaffold error.\n\t *\n\t * @param code - The coded reason the error is raised.\n\t * @param message - What went wrong, in one sentence.\n\t * @param context - Whatever the raising site can say about the failure.\n\t */\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 {@link 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 * isScaffoldError(undefined) // false\n * ```\n */\nexport function isScaffoldError(value: unknown): value is ScaffoldError {\n\treturn value instanceof ScaffoldError\n}\n","import type { Guard } from '@orkestrel/contract'\nimport type { EmitterHooks } from '@orkestrel/emitter'\nimport type {\n\tArtifact,\n\tAudit,\n\tBlueprint,\n\tCatalogEntry,\n\tCompilerEventMap,\n\tCompilerOptions,\n\tDependency,\n\tEnvironment,\n\tFinding,\n\tGroup,\n\tMirror,\n\tOverride,\n\tPlan,\n\tQuestion,\n\tSnapshot,\n} from './types.js'\nimport {\n\tandOf,\n\tarrayOf,\n\tenumerableKeys,\n\tholds,\n\tisArray,\n\tisBoolean,\n\tisFunction,\n\tisRecord,\n\tisString,\n\tliteralOf,\n\trecordOf,\n\tstringOf,\n\tunionOf,\n} from '@orkestrel/contract'\nimport {\n\tCONTROL_CHARACTER_PATTERN,\n\tDEPENDENCY_NAME_PATTERN,\n\tENVIRONMENTS,\n\tGROUPS,\n\tHEX_PATTERN,\n\tINVALID_PATH_CHARACTER_PATTERN,\n\tMAX_ARTIFACT_BYTES,\n\tMAX_ARTIFACT_HEX_LENGTH,\n\tMAX_AUDIT_FINDINGS,\n\tMAX_COLLECTION_ITEMS,\n\tMAX_DEPENDENCY_NAME_LENGTH,\n\tMAX_NAME_LENGTH,\n\tMAX_PATH_LENGTH,\n\tMAX_RANGE_LENGTH,\n} from './constants.js'\n\n/**\n * Narrow a value to a logical target-relative path.\n *\n * @param value - The candidate path.\n * @returns `true` for a bounded relative path with no traversal, empty segment,\n * control character, or reserved syntax character.\n *\n * @remarks\n * Every path this package reads or writes passes here, so one law covers a\n * planned artifact, an override target, an audit finding, a guide mirror, and a\n * snapshot key. Rejecting `..`, a leading `/`, and a backslash at the guard is\n * what stops a caller-supplied path from naming a destination outside the\n * target. Host-location validation is a separate server boundary: this guard\n * does not reject a device spelling, a trailing dot or space, or a segment that\n * exceeds a host filesystem's byte ceiling.\n *\n * @example\n * ```ts\n * import { isPath } from '@orkestrel/scaffold'\n *\n * isPath('configs/src/tsconfig.core.json') // true\n * isPath('../secrets') // false\n * ```\n */\nexport function isPath(value: unknown): value is string {\n\treturn holds(() => {\n\t\tif (!isString(value) || value.length === 0 || value.length > MAX_PATH_LENGTH) return false\n\t\tif (CONTROL_CHARACTER_PATTERN.test(value)) return false\n\t\tif (INVALID_PATH_CHARACTER_PATTERN.test(value)) return false\n\t\tfor (const segment of value.split('/')) {\n\t\t\tif (segment === '' || segment === '.' || segment === '..') return false\n\t\t}\n\t\treturn true\n\t})\n}\n\n/**\n * Narrow a value to exact lowercase hexadecimal bytes within one artifact's limit.\n *\n * @remarks\n * Two digits per byte, so an odd length is refused and empty content is valid.\n * The bound is exact rather than approximate: the encoding is ASCII, so the\n * string's length is twice the byte count it stands for.\n *\n * @example\n * ```ts\n * import { isHex } from '@orkestrel/scaffold'\n *\n * isHex('68690a') // true\n * isHex('68690A') // false\n * ```\n */\nexport const isHex: Guard<string> = stringOf({\n\tmax: MAX_ARTIFACT_HEX_LENGTH,\n\tpattern: HEX_PATTERN,\n})\n\n/**\n * Narrow a value to text this package will accept as one artifact's content.\n *\n * @remarks\n * The bound is a code-unit ceiling rather than a byte count, because a string\n * of more code units than {@link MAX_ARTIFACT_BYTES} cannot encode within that\n * budget under any encoding this package writes. The exact UTF-8 measurement\n * belongs to the compiler and the writer, which are the two places the bytes\n * are actually produced.\n */\nexport const isContent: Guard<string> = stringOf({ max: MAX_ARTIFACT_BYTES })\n\n/**\n * Narrow a value to an array within the limit one public collection accepts.\n *\n * @param value - The candidate collection.\n * @returns `true` for an array of no more than `MAX_COLLECTION_ITEMS` items.\n *\n * @remarks\n * Compose this ahead of an element guard so the item count is settled before\n * anything walks the items. A hostile `length` accessor answers `false` here\n * rather than escaping as a thrown error.\n *\n * @example\n * ```ts\n * import { isCollection } from '@orkestrel/scaffold'\n *\n * isCollection(['manifest']) // true\n * isCollection('manifest') // false\n * ```\n */\nexport function isCollection(value: unknown): value is readonly unknown[] {\n\treturn holds(() => isArray(value) && value.length <= MAX_COLLECTION_ITEMS)\n}\n\n/**\n * Narrow a value to one {@link Environment} a workspace may select.\n *\n * @example\n * ```ts\n * import { isEnvironment } from '@orkestrel/scaffold'\n *\n * isEnvironment('browser') // true\n * isEnvironment('worker') // false\n * ```\n */\nexport const isEnvironment: Guard<Environment> = literalOf(ENVIRONMENTS)\n\n/**\n * Narrow a value to one {@link Group} a plan selects over.\n *\n * @example\n * ```ts\n * import { isGroup } from '@orkestrel/scaffold'\n *\n * isGroup('manifest') // true\n * isGroup('readme') // false\n * ```\n */\nexport const isGroup: Guard<Group> = literalOf(GROUPS)\n\n/** Narrow a value to a bounded group selection. */\nexport const isGroups: Guard<readonly Group[]> = andOf(isCollection, arrayOf(isGroup))\n\n/**\n * Narrow a value to the scoped package name a runtime dependency carries.\n *\n * @remarks\n * A dependency name reaches a path, because a workspace's guide mirror is\n * derived from it. Fixing the scope and admitting nothing but a bare name after\n * it is what keeps that derivation inside the directory the mirror belongs in.\n * A blueprint's development extras are deliberately wider and are measured by\n * the gate instead, which is why {@link isDependency} does not apply this.\n *\n * @example\n * ```ts\n * import { isDependencyName } from '@orkestrel/scaffold'\n *\n * isDependencyName('@orkestrel/router') // true\n * isDependencyName('@orkestrel/../etc') // false\n * ```\n */\nexport const isDependencyName: Guard<string> = stringOf({\n\tmax: MAX_DEPENDENCY_NAME_LENGTH,\n\tpattern: DEPENDENCY_NAME_PATTERN,\n})\n\n/**\n * Narrow a value to a {@link Dependency}.\n *\n * @remarks\n * Structural and bounded: which names and ranges a blueprint may declare is a\n * gate law, reported as a {@link Question} carrying its accepted candidates, so\n * refusing it here would replace an answerable question with a bare `false`.\n *\n * @example\n * ```ts\n * import { isDependency } from '@orkestrel/scaffold'\n *\n * isDependency({ name: '@orkestrel/emitter', range: '^0.0.5' }) // true\n * isDependency({ name: '@orkestrel/emitter' }) // false\n * ```\n */\nexport const isDependency: Guard<Dependency> = recordOf(\n\t{\n\t\tname: stringOf({ min: 1, max: MAX_DEPENDENCY_NAME_LENGTH }),\n\t\trange: stringOf({ min: 1, max: MAX_RANGE_LENGTH }),\n\t\toptional: isBoolean,\n\t},\n\t['optional'],\n)\n\n/**\n * Narrow a value to an {@link Override}.\n *\n * @remarks\n * Whether the path names a planned artifact is a gate law; whether it names a\n * destination at all is this guard's.\n *\n * @example\n * ```ts\n * import { isOverride } from '@orkestrel/scaffold'\n *\n * isOverride({ path: 'README.md', content: '# Title\\n' }) // true\n * ```\n */\nexport const isOverride: Guard<Override> = recordOf({ path: isPath, content: isContent })\n\n/**\n * Narrow a value to a {@link Blueprint}.\n *\n * @remarks\n * The whole closed record, its literal axes, and the count and length bounds\n * this package admits. The syntactic laws over a name, a version, a range, and\n * an engines floor stay with the gate, which reports each one as a\n * {@link Question} instead of refusing the value outright.\n *\n * @example\n * ```ts\n * import { isBlueprint } from '@orkestrel/scaffold'\n *\n * isBlueprint({ name: 'router', src: ['core'] }) // false — not the whole record\n * ```\n */\nexport const isBlueprint: Guard<Blueprint> = recordOf(\n\t{\n\t\tname: stringOf({ min: 1, max: MAX_NAME_LENGTH }),\n\t\tdescription: isString,\n\t\tkeywords: andOf(isCollection, arrayOf(isString)),\n\t\tsrc: andOf(isCollection, arrayOf(isEnvironment)),\n\t\tapp: andOf(isCollection, arrayOf(isEnvironment)),\n\t\tdependencies: andOf(isCollection, arrayOf(isDependency)),\n\t\tpeers: andOf(isCollection, arrayOf(isDependency)),\n\t\textras: andOf(isCollection, arrayOf(isDependency)),\n\t\tversion: isString,\n\t\tengines: isString,\n\t\toverrides: andOf(isCollection, arrayOf(isOverride)),\n\t\tbin: isBoolean,\n\t\tguides: isBoolean,\n\t\tdistribution: isBoolean,\n\t\tintegration: isBoolean,\n\t\tconformance: isBoolean,\n\t\tservice: isBoolean,\n\t\tvendors: andOf(isCollection, arrayOf(isString)),\n\t\tglobal: isBoolean,\n\t\tshowcase: isBoolean,\n\t},\n\t['description'],\n)\n\n/**\n * Narrow a value to an {@link Artifact}.\n *\n * @remarks\n * One branch per way content is produced, discriminated by `origin` and\n * narrowed by `ownership`. Each branch declares only the keys its branch has,\n * so a host artifact carrying `content`, a hydrated artifact carrying anything\n * but `content` ownership, and a template artifact carrying `hex` are all\n * refused rather than admitted to the wrong branch.\n *\n * @example\n * ```ts\n * import { isArtifact } from '@orkestrel/scaffold'\n *\n * isArtifact({ path: 'AGENTS.md', group: 'docs', ownership: 'presence', origin: 'host' }) // true\n * ```\n */\nexport const isArtifact: Guard<Artifact> = unionOf(\n\trecordOf(\n\t\t{\n\t\t\tpath: isPath,\n\t\t\tgroup: isGroup,\n\t\t\townership: literalOf('presence', 'birth'),\n\t\t\tenvironment: isEnvironment,\n\t\t\torigin: literalOf('host'),\n\t\t\tsource: isPath,\n\t\t},\n\t\t['environment', 'source'],\n\t),\n\trecordOf(\n\t\t{\n\t\t\tpath: isPath,\n\t\t\tgroup: isGroup,\n\t\t\townership: literalOf('content'),\n\t\t\tenvironment: isEnvironment,\n\t\t\torigin: literalOf('host'),\n\t\t\tsource: isPath,\n\t\t\thex: isHex,\n\t\t},\n\t\t['environment', 'source'],\n\t),\n\trecordOf(\n\t\t{\n\t\t\tpath: isPath,\n\t\t\tgroup: isGroup,\n\t\t\townership: literalOf('content', 'presence', 'birth'),\n\t\t\tenvironment: isEnvironment,\n\t\t\torigin: literalOf('template', 'computed'),\n\t\t\tcontent: isContent,\n\t\t},\n\t\t['environment'],\n\t),\n)\n\n/**\n * Narrow a value to a {@link Plan}.\n *\n * @remarks\n * A plan reaches the writer, and the writer has no question channel, so this\n * carries the whole law of the value: every artifact path, every claimed byte,\n * and the blueprint it was compiled from.\n */\nexport const isPlan: Guard<Plan> = recordOf(\n\t{\n\t\tblueprint: isBlueprint,\n\t\tgroups: isGroups,\n\t\tartifacts: andOf(isCollection, arrayOf(isArtifact)),\n\t\thash: isHex,\n\t},\n\t['hash'],\n)\n\n/**\n * Narrow a value to a {@link Question}.\n *\n * @example\n * ```ts\n * import { isQuestion } from '@orkestrel/scaffold'\n *\n * isQuestion({ field: 'src', message: 'Unknown environment', blocking: true }) // true\n * ```\n */\nexport const isQuestion: Guard<Question> = recordOf(\n\t{\n\t\tfield: isString,\n\t\tmessage: isString,\n\t\tblocking: isBoolean,\n\t\tcandidates: andOf(isCollection, arrayOf(isString)),\n\t},\n\t['candidates'],\n)\n\n/**\n * Narrow a value to a {@link Finding}.\n *\n * @remarks\n * `observed` is required exactly where the mutation it precedes is held to it,\n * absent where the destination had no bytes to record, and optional where the\n * comparison may not have been made. Planned findings require `ownership`;\n * foreign findings forbid it because no artifact was planned for their path.\n *\n * That is the whole claim. This guard proves the shape a reader may destructure\n * and nothing about whether the verdict is one an audit could have reached: the\n * correlation between `ownership`, `drift`, and `observed` belongs to\n * {@link inferDrift}, and it is re-derived at the verb that acts on the finding.\n */\nexport const isFinding: Guard<Finding> = unionOf(\n\trecordOf({\n\t\tpath: isPath,\n\t\tgroup: isGroup,\n\t\townership: literalOf('content', 'presence', 'birth'),\n\t\tdrift: literalOf('stale'),\n\t\tobserved: isHex,\n\t}),\n\trecordOf({\n\t\tpath: isPath,\n\t\tgroup: isGroup,\n\t\tdrift: literalOf('foreign'),\n\t\tobserved: isHex,\n\t}),\n\trecordOf({\n\t\tpath: isPath,\n\t\tgroup: isGroup,\n\t\townership: literalOf('content', 'presence', 'birth'),\n\t\tdrift: literalOf('missing'),\n\t}),\n\trecordOf(\n\t\t{\n\t\t\tpath: isPath,\n\t\t\tgroup: isGroup,\n\t\t\townership: literalOf('content', 'presence', 'birth'),\n\t\t\tdrift: literalOf('aligned'),\n\t\t\tobserved: isHex,\n\t\t},\n\t\t['observed'],\n\t),\n)\n\n/**\n * Narrow a value to an {@link Audit}.\n *\n * @remarks\n * An audit reaches the writer and the destructive verb, so it is guarded as\n * strictly as the plan beside it. Findings use the sum of the two producer\n * bounds: one per planned artifact, then one per unplanned snapshot path.\n */\nexport const isAudit: Guard<Audit> = recordOf({\n\tfindings: andOf(\n\t\t(value: unknown): value is readonly unknown[] =>\n\t\t\tholds(() => isArray(value) && value.length <= MAX_AUDIT_FINDINGS),\n\t\tarrayOf(isFinding),\n\t),\n\tquestions: andOf(isCollection, arrayOf(isQuestion)),\n})\n\n/**\n * Narrow a value to a {@link Mirror}.\n *\n * @remarks\n * `content` is the fetched guide text and `observed` is the local mirror's\n * exact bytes, so the two carry different laws: one is content this package\n * writes, the other is the precondition that write is held to.\n */\nexport const isMirror: Guard<Mirror> = unionOf(\n\trecordOf(\n\t\t{\n\t\t\tname: isDependencyName,\n\t\t\tpath: isPath,\n\t\t\tlookup: literalOf('found'),\n\t\t\tcontent: isContent,\n\t\t\tobserved: isHex,\n\t\t},\n\t\t['observed'],\n\t),\n\trecordOf(\n\t\t{\n\t\t\tname: isDependencyName,\n\t\t\tpath: isPath,\n\t\t\tlookup: literalOf('missing', 'failed'),\n\t\t\tnote: isString,\n\t\t\tobserved: isHex,\n\t\t},\n\t\t['observed'],\n\t),\n)\n\n/**\n * Narrow a value to a {@link CatalogEntry}.\n *\n * @remarks\n * A row that found no version carries the cause instead, and neither branch may\n * carry the other's field.\n */\nexport const isCatalogEntry: Guard<CatalogEntry> = unionOf(\n\trecordOf({\n\t\tname: isDependencyName,\n\t\tlookup: literalOf('found'),\n\t\tversion: isString,\n\t\tdependencies: andOf(isCollection, arrayOf(isDependency)),\n\t}),\n\trecordOf({\n\t\tname: isDependencyName,\n\t\tlookup: literalOf('missing', 'failed'),\n\t\tnote: isString,\n\t}),\n)\n\n/**\n * Narrow a value to a {@link Snapshot}.\n *\n * @param value - The candidate target snapshot.\n * @returns `true` for a bounded plain record whose every key is a path and\n * whose every value is exact lowercase hexadecimal bytes.\n *\n * @remarks\n * Read through the shared total key lens, so a hostile `ownKeys` trap and a\n * throwing accessor both answer `false` rather than escaping. There is no\n * dictionary combinator upstream to compose this from: the key law and the\n * value law are both this package's own.\n *\n * @example\n * ```ts\n * import { isSnapshot } from '@orkestrel/scaffold'\n *\n * isSnapshot({ 'AGENTS.md': '68690a' }) // true\n * isSnapshot({ 'AGENTS.md': 'hi' }) // false\n * ```\n */\nexport function isSnapshot(value: unknown): value is Snapshot {\n\treturn holds(() => {\n\t\tif (!isRecord(value)) return false\n\t\tconst keys = enumerableKeys(value)\n\t\tif (keys === undefined || keys.length > MAX_COLLECTION_ITEMS) return false\n\t\tfor (const key of keys) {\n\t\t\tif (!isPath(key) || !isHex(value[key])) return false\n\t\t}\n\t\treturn true\n\t})\n}\n\n/**\n * Narrow a value to the compiler's initial listener record.\n *\n * @remarks\n * Every event is optional and every declared value is a function. A key outside\n * the compiler's event map is refused, so a listener wired to a misspelled\n * event fails at construction instead of never firing.\n */\nexport const isCompilerHooks: Guard<EmitterHooks<CompilerEventMap>> = recordOf(\n\t{\n\t\tcompile: isFunction,\n\t\taudit: isFunction,\n\t\tblock: isFunction,\n\t\terror: isFunction,\n\t\tdestroy: isFunction,\n\t},\n\ttrue,\n)\n\n/**\n * Narrow a value to {@link CompilerOptions}.\n *\n * @example\n * ```ts\n * import { isCompilerOptions } from '@orkestrel/scaffold'\n *\n * isCompilerOptions({}) // true\n * isCompilerOptions({ retries: 2 }) // false\n * ```\n */\nexport const isCompilerOptions: Guard<CompilerOptions> = recordOf(\n\t{ on: isCompilerHooks, error: isFunction },\n\ttrue,\n)\n","import type { JSONValue } from '@orkestrel/contract'\nimport { attempt, cloneJSONValue } from '@orkestrel/contract'\n\n/**\n * Snapshot an untrusted value into exact JSON data the caller owns.\n *\n * @param value - The untrusted value to take ownership of.\n * @returns A deeply frozen copy sharing nothing with `value`, or `undefined`\n * when the value is not exact acyclic JSON data.\n *\n * @remarks\n * This fixes the order every boundary in this package reads a caller's value\n * in: snapshot first, then guard the snapshot. A guard reads `value[key]`, so a\n * property backed by an accessor can answer one thing while the guard runs and\n * another while the accepted value is used, and no guard closes that race from\n * inside. The snapshot closes it. The installed `cloneJSONValue` refuses any\n * property that is not an own enumerable data property, so an accessor never\n * reaches the guard at all, and it reads every value it keeps exactly once from\n * that property's descriptor. What the guard measures is what every later read\n * returns.\n *\n * The result is a frozen null-prototype record or a frozen intrinsic array, and\n * this package's guards accept both, so the snapshot passes `isBlueprint`,\n * `isSnapshot`, and the parsers derived from them unchanged.\n *\n * Ownership is refused rather than raised. A value carrying a function, an\n * `undefined`, a symbol key, a cycle, a non-finite number, or more nodes than\n * `@orkestrel/contract` admits answers `undefined`, which leaves each caller\n * free to decide what a refusal means — the compiler throws `INVALID`, the gate\n * asks a `Question` — and keeps `ScaffoldError` the only error this package\n * throws.\n *\n * The node ceiling is the installed package's `CLONE_NODE_LIMIT`, and it counts\n * every record, array, and leaf the snapshot would contain, so it bounds breadth\n * and depth together. This package declares no ceiling of its own beside it: a\n * local number no code here can enforce could only disagree with the one that\n * binds.\n *\n * @example\n * ```ts\n * import { cloneValue, parseBlueprint } from '@orkestrel/scaffold'\n *\n * const owned = parseBlueprint(cloneValue(input))\n * ```\n */\nexport function cloneValue(value: unknown): JSONValue | undefined {\n\tconst outcome = attempt(() => cloneJSONValue(value))\n\treturn outcome.success ? outcome.value : undefined\n}\n","import type { Blueprint, CompilerOptions, Group, Snapshot } from './types.js'\nimport { isBlueprint, isCompilerOptions, isGroups, isSnapshot } from './validators.js'\n\n/**\n * Coerce an untrusted value to a {@link Blueprint}.\n *\n * @param value - The value to parse.\n * @returns The blueprint, or `undefined` when the value is not one.\n *\n * @remarks\n * Derived from {@link isBlueprint}, which is what makes the pair sound in both\n * directions: a guard-valid value is returned unchanged, and every value this\n * returns satisfies that guard. The reference is returned rather than copied,\n * so a caller that means to own the value clones it.\n *\n * @example\n * ```ts\n * import { parseBlueprint } from '@orkestrel/scaffold'\n *\n * parseBlueprint({ name: 'router' }) // undefined\n * ```\n */\nexport function parseBlueprint(value: unknown): Blueprint | undefined {\n\treturn isBlueprint(value) ? value : undefined\n}\n\n/**\n * Coerce an untrusted value to a group selection.\n *\n * @param value - The value to parse.\n * @returns The selection, or `undefined` when the value is not one.\n *\n * @remarks\n * Derived from {@link isGroups}. Order and repetition are preserved: which\n * groups a plan finally covers, and in which order, is the compiler's to decide\n * from `GROUPS`, not this boundary's.\n *\n * @example\n * ```ts\n * import { parseGroups } from '@orkestrel/scaffold'\n *\n * parseGroups(['manifest', 'configs']) // ['manifest', 'configs']\n * parseGroups(['readme']) // undefined\n * ```\n */\nexport function parseGroups(value: unknown): readonly Group[] | undefined {\n\treturn isGroups(value) ? value : undefined\n}\n\n/**\n * Coerce an untrusted value to a {@link Snapshot}.\n *\n * @param value - The value to parse.\n * @returns The snapshot, or `undefined` when the value is not one.\n *\n * @remarks\n * Derived from {@link isSnapshot}.\n *\n * @example\n * ```ts\n * import { parseSnapshot } from '@orkestrel/scaffold'\n *\n * parseSnapshot({ 'AGENTS.md': '68690a' }) // { 'AGENTS.md': '68690a' }\n * parseSnapshot({ 'AGENTS.md': null }) // undefined\n * ```\n */\nexport function parseSnapshot(value: unknown): Snapshot | undefined {\n\treturn isSnapshot(value) ? value : undefined\n}\n\n/**\n * Coerce an untrusted value to {@link CompilerOptions}.\n *\n * @param value - The value to parse.\n * @returns The options, or `undefined` when the value is not an option bag.\n *\n * @remarks\n * Derived from {@link isCompilerOptions}. Absence is not an option bag, so\n * `undefined` in returns `undefined` out and a constructor reads that as the\n * defaults rather than as a refusal.\n *\n * @example\n * ```ts\n * import { parseCompilerOptions } from '@orkestrel/scaffold'\n *\n * parseCompilerOptions({ on: { compile: () => {} } }) // the same record\n * parseCompilerOptions({ on: { compiled: () => {} } }) // undefined\n * ```\n */\nexport function parseCompilerOptions(value: unknown): CompilerOptions | undefined {\n\treturn isCompilerOptions(value) ? value : undefined\n}\n","import type {\n\tArtifact,\n\tCatalogEntry,\n\tDependency,\n\tDrift,\n\tFinding,\n\tGroup,\n\tOwnership,\n\tPlan,\n\tPlanSummary,\n} from './types.js'\nimport { compareValues, isRecord, isString, limitEntries, parseJSON } from '@orkestrel/contract'\nimport {\n\tDEPENDENCY_NAME_PATTERN,\n\tENGINES_PATTERN,\n\tEXTRA_RANGE_PATTERN,\n\tGROUPS,\n\tMAX_COLLECTION_ITEMS,\n\tMAX_DEPENDENCY_NAME_LENGTH,\n\tMAX_MANIFEST_BYTES,\n\tMAX_RANGE_LENGTH,\n\tMINIMUM_NODE_VERSION,\n\tORCHESTRATION_PATH_NAMES,\n\tORCHESTRATION_PATH_PREFIXES,\n\tPRINT_WIDTH,\n\tTAB_WIDTH,\n\tVERSION_PATTERN,\n} from './constants.js'\n\n/**\n * Encode bytes as exact lowercase hexadecimal text.\n *\n * @param bytes - The bytes to encode.\n * @returns Two lowercase hexadecimal digits per input byte, and `''` for no bytes.\n *\n * @remarks\n * The encoding every byte claim in this package is stated in, so a plan, an\n * audit finding, and a snapshot all compare as text rather than as buffers.\n * `Uint8Array.prototype.toHex` is not available on the oldest Node this package\n * supports, so the digits are produced here.\n *\n * @example\n * ```ts\n * import { bytesToHex } from '@orkestrel/scaffold'\n *\n * bytesToHex(new Uint8Array([0x68, 0x69, 0x0a])) // '68690a'\n * ```\n */\nexport function bytesToHex(bytes: Uint8Array): string {\n\tlet hex = ''\n\tfor (const byte of bytes) hex += byte.toString(16).padStart(2, '0')\n\treturn hex\n}\n\n/**\n * Encode text as the exact lowercase hexadecimal form of its UTF-8 bytes.\n *\n * @param content - The text to encode.\n * @returns The hexadecimal form of the text's exact UTF-8 bytes.\n *\n * @remarks\n * This is the single conversion from an artifact's content to the bytes a\n * comparison is made against, so a template or computed artifact is measured in\n * the same units as a vendored one. Encoding is `TextEncoder`, which every\n * supported host provides, so core stays host-independent.\n *\n * @example\n * ```ts\n * import { contentToHex } from '@orkestrel/scaffold'\n *\n * contentToHex('hi\\n') // '68690a'\n * ```\n */\nexport function contentToHex(content: string): string {\n\treturn bytesToHex(new TextEncoder().encode(content))\n}\n\n/**\n * Count the UTF-8 bytes text encodes to.\n *\n * @param content - The text to measure.\n * @returns The exact number of UTF-8 bytes.\n *\n * @remarks\n * Counted rather than encoded, so measuring a value against a ceiling never\n * allocates the bytes it is about to refuse. An unpaired surrogate counts as\n * the three bytes `TextEncoder` writes for the replacement character, so the\n * count matches {@link contentToHex} for every string.\n *\n * @example\n * ```ts\n * import { computeBytes } from '@orkestrel/scaffold'\n *\n * computeBytes('hi\\n') // 3\n * computeBytes('€') // 3\n * ```\n */\nexport function computeBytes(content: string): number {\n\tlet bytes = 0\n\tfor (const character of content) {\n\t\tconst code = character.codePointAt(0) ?? 0\n\t\tbytes += code <= 0x7f ? 1 : code <= 0x7ff ? 2 : code <= 0xffff ? 3 : 4\n\t}\n\treturn bytes\n}\n\n/**\n * Compute the deterministic content identity of text.\n *\n * @param text - The text to digest.\n * @returns Sixteen lowercase hexadecimal digits.\n *\n * @remarks\n * The 64-bit FNV-1a fold over the text's UTF-16 code units, which is the\n * identity a pinned plan carries. It reads no clock and no randomness, so the\n * same text answers the same digits on every host and every run.\n *\n * It is an identity, not a security digest: it says two values are the same\n * value, never that nobody could have built a second value answering the same\n * digits. Core cannot do better synchronously — the only cryptographic digest a\n * host-independent scope reaches is `crypto.subtle`, which is asynchronous, and\n * the compiler is synchronous by contract.\n *\n * @example\n * ```ts\n * import { computeHash } from '@orkestrel/scaffold'\n *\n * computeHash('') // 'cbf29ce484222325'\n * ```\n */\nexport function computeHash(text: string): string {\n\tlet hash = 0xcbf29ce484222325n\n\tfor (let index = 0; index < text.length; index += 1) {\n\t\thash = BigInt.asUintN(64, (hash ^ BigInt(text.charCodeAt(index))) * 0x100000001b3n)\n\t}\n\treturn hash.toString(16).padStart(16, '0')\n}\n\n/**\n * Test whether a path instructs or wires an agent rather than the toolchain.\n *\n * @param path - The target-relative path to test.\n * @returns `true` when the path is beneath a harness directory or is one of the\n * exact root filenames that wires an agent bench.\n *\n * @remarks\n * The one home of the orchestration membership rule. A vendored path and a\n * foreign path found in a target are both classified through here, so a new\n * harness directory is admitted once in `ORCHESTRATION_PATH_PREFIXES` and every\n * caller follows.\n *\n * @example\n * ```ts\n * import { matchesOrchestrationPath } from '@orkestrel/scaffold'\n *\n * matchesOrchestrationPath('.claude/rules/names.md') // true\n * matchesOrchestrationPath('.mcp.json') // true\n * matchesOrchestrationPath('.oxlintrc.json') // false\n * ```\n */\nexport function matchesOrchestrationPath(path: string): boolean {\n\tif (ORCHESTRATION_PATH_NAMES.includes(path)) return true\n\treturn ORCHESTRATION_PATH_PREFIXES.some((prefix) => path.startsWith(prefix))\n}\n\n/**\n * Infer the {@link Group} a path belongs to.\n *\n * @param path - The target-relative path to classify.\n * @returns The group that owns the path.\n *\n * @remarks\n * A path is grouped by what it governs rather than by where it sits. The two\n * manifest files are named exactly; anything\n * {@link matchesOrchestrationPath} accepts is orchestration; `src` and `app`\n * are source; `tests`, `guides`, and `docs` carry their own names; the licence\n * and a root Markdown document are docs; and everything else is configuration.\n * A vendored path and a foreign path found in a target are classified here\n * alike, so the plan and the audit never disagree about what a path is.\n *\n * @example\n * ```ts\n * import { inferGroup } from '@orkestrel/scaffold'\n *\n * inferGroup('src/core/index.ts') // 'source'\n * inferGroup('AGENTS.md') // 'docs'\n * inferGroup('.editorconfig') // 'configs'\n * ```\n */\nexport function inferGroup(path: string): Group {\n\tif (path === 'package.json' || path === 'package-lock.json') return 'manifest'\n\tif (matchesOrchestrationPath(path)) return 'orchestration'\n\tif (path.startsWith('src/') || path.startsWith('app/')) return 'source'\n\tif (path.startsWith('tests/')) return 'tests'\n\tif (path.startsWith('guides/')) return 'guides'\n\tif (path.startsWith('docs/')) return 'docs'\n\t// The licence and the root instruction documents are the workspace's own prose.\n\tif (path === 'LICENSE') return 'docs'\n\tif (!path.includes('/') && path.endsWith('.md')) return 'docs'\n\treturn 'configs'\n}\n\n/**\n * Serialize one string as a single-quoted TypeScript literal.\n *\n * @param value - The string to serialize.\n * @returns A complete single-quoted literal with line-breaking and delimiter\n * characters escaped.\n *\n * @remarks\n * Configuration templates insert blueprint-derived strings into TypeScript.\n * Keeping this one serializer at that boundary prevents a name from becoming\n * syntax and preserves oxfmt's configured single-quote fixed point.\n *\n * @example\n * ```ts\n * import { serializeTypeScriptString } from '@orkestrel/scaffold'\n *\n * serializeTypeScriptString(\"it's\") // `'it\\\\'s'`\n * ```\n */\nexport function serializeTypeScriptString(value: string): string {\n\tlet serialized = \"'\"\n\tfor (let index = 0; index < value.length; index += 1) {\n\t\tconst code = value.charCodeAt(index)\n\t\tconst character = value.charAt(index)\n\t\tif (character === \"'\") serialized += \"\\\\'\"\n\t\telse if (character === '\\\\') serialized += '\\\\\\\\'\n\t\telse if (character === '\\b') serialized += '\\\\b'\n\t\telse if (character === '\\f') serialized += '\\\\f'\n\t\telse if (character === '\\n') serialized += '\\\\n'\n\t\telse if (character === '\\r') serialized += '\\\\r'\n\t\telse if (character === '\\t') serialized += '\\\\t'\n\t\telse if (code === 0x2028) serialized += '\\\\u2028'\n\t\telse if (code === 0x2029) serialized += '\\\\u2029'\n\t\telse if (code < 0x20 || (code >= 0xd800 && code <= 0xdfff)) {\n\t\t\tconst next = value.charCodeAt(index + 1)\n\t\t\tif (code >= 0xd800 && code <= 0xdbff && next >= 0xdc00 && next <= 0xdfff) {\n\t\t\t\tserialized += `${character}${value.charAt(index + 1)}`\n\t\t\t\tindex += 1\n\t\t\t} else serialized += `\\\\u${code.toString(16).padStart(4, '0')}`\n\t\t} else serialized += character\n\t}\n\treturn `${serialized}'`\n}\n\n/**\n * Derive the guide mirror path a package name answers for.\n *\n * @param name - A bare or `@orkestrel`-scoped package name.\n * @returns The mirror path, `guides/<bare name>.md`.\n *\n * @remarks\n * The single shape of a mirror path, read by the fetch that fills one and by\n * the plan that leaves the target's own guide out of its host set. Only the\n * segment after the final `/` is used, so the scope never reaches the path.\n * Whether the derived path is safe to write is `isPath`'s answer and the gate's,\n * which is why `DEPENDENCY_NAME_PATTERN` closes the name to a bare scoped one\n * before it ever arrives here.\n *\n * @example\n * ```ts\n * import { nameToGuide } from '@orkestrel/scaffold'\n *\n * nameToGuide('@orkestrel/router') // 'guides/router.md'\n * nameToGuide('scaffold') // 'guides/scaffold.md'\n * ```\n */\nexport function nameToGuide(name: string): string {\n\treturn `guides/${name.slice(name.lastIndexOf('/') + 1)}.md`\n}\n\n/**\n * Test whether one emitted line fits the vendored formatter width.\n *\n * @param line - One emitted line, leading tabs included.\n * @returns `true` when the expanded line fits.\n *\n * @remarks\n * A generator writes source the formatter then reads back, so a line packed\n * past the vendored width is rewrapped on the next `format` run and the emitted\n * bytes stop matching the plan the audit compares against. The generator\n * therefore measures a candidate line and chooses the shape the formatter would\n * have chosen. Tabs are expanded first because the formatter counts them as\n * `TAB_WIDTH` columns rather than as one character.\n *\n * @example\n * ```ts\n * import { matchesPrintWidth } from '@orkestrel/scaffold'\n *\n * matchesPrintWidth('\\t\\tprojects: [core],') // true\n * ```\n */\nexport function matchesPrintWidth(line: string): boolean {\n\treturn line.replaceAll('\\t', ' '.repeat(TAB_WIDTH)).length <= PRINT_WIDTH\n}\n\n/**\n * Derive the declaration rewrite a published face's `beforeWriteFile` applies.\n *\n * @param name - The workspace's own bare package name.\n * @returns The ternary consequent an emitted `vite.{browser,server}.config.ts`\n * fills its `{{replacement}}` span with, indented for that span.\n *\n * @remarks\n * `vite-plugin-dts` rolls a face into one declaration and keeps each source\n * module's own relative depth, so a nested module emits a path that escapes\n * `dist/src` and a flat one resolves only by luck. Both faces rewrite the same\n * relative core path to the package's published root export, so the branch is\n * derived once here. The extension alternation is what the two permitted import\n * spellings produce: an `@src/core` alias resolves to the core source module and\n * prints `.ts`, while a relative import prints the `.js` specifier it was\n * written with. The formatter keeps the call on one line only while the line it\n * prints measures inside the vendored width, and the workspace name is what\n * varies, so the shape is chosen by measuring the candidate: a tab prints as the\n * vendored two columns, and the gate admits a name long enough to push the\n * joined call past 100.\n *\n * @example\n * ```ts\n * import { nameToRewrite } from '@orkestrel/scaffold'\n *\n * nameToRewrite('router').includes(\"'@orkestrel/router'\") // true\n * ```\n */\nexport function nameToRewrite(name: string): string {\n\tconst specifier = serializeTypeScriptString(`@orkestrel/${name}`)\n\tconst pattern = '/(?:\\\\.\\\\.\\\\/)+core\\\\/index\\\\.[jt]s/g'\n\tconst joined = `\\t\\t\\t\\t\\t\\t? content.replaceAll(${pattern}, ${specifier})`\n\tif (matchesPrintWidth(joined)) return joined\n\treturn [\n\t\t'\\t\\t\\t\\t\\t\\t? content.replaceAll(',\n\t\t`\\t\\t\\t\\t\\t\\t\\t\\t${pattern},`,\n\t\t`\\t\\t\\t\\t\\t\\t\\t\\t${specifier},`,\n\t\t'\\t\\t\\t\\t\\t\\t\\t)',\n\t].join('\\n')\n}\n\n/**\n * Select the host paths a named workspace vendors.\n *\n * @param paths - The candidate host paths, in their declared order.\n * @param name - The target workspace's own bare package name.\n * @returns Every candidate except the workspace's own guide, in input order.\n *\n * @remarks\n * `HOST_PATHS` is a candidate set rather than a plan, because a workspace never\n * mirrors its own guide: that file is the workspace's own product, and vendoring\n * it would have the target overwrite its guide with the copy it published.\n *\n * @example\n * ```ts\n * import { HOST_PATHS, selectHostPaths } from '@orkestrel/scaffold'\n *\n * selectHostPaths(HOST_PATHS, 'scaffold').includes('guides/scaffold.md') // false\n * ```\n */\nexport function selectHostPaths(paths: readonly string[], name: string): readonly string[] {\n\tconst guide = nameToGuide(name)\n\treturn paths.filter((path) => path !== guide)\n}\n\n/**\n * Select the groups a compile covers, in plan order.\n *\n * @param groups - The requested selection; every group when absent.\n * @returns The requested groups in `GROUPS` order, without repeats.\n *\n * @remarks\n * A caller's selection is data, so it arrives in whatever order and with\n * whatever repeats the caller wrote. Plan order is this package's, so the\n * selection is read as membership and the order comes from `GROUPS`. An empty\n * selection covers nothing, which is a caller asking for an empty plan rather\n * than a caller asking for everything.\n *\n * @example\n * ```ts\n * import { selectGroups } from '@orkestrel/scaffold'\n *\n * selectGroups(['tests', 'manifest', 'tests']) // ['manifest', 'tests']\n * selectGroups() // every group, in plan order\n * ```\n */\nexport function selectGroups(groups?: readonly Group[]): readonly Group[] {\n\tconst selection = groups ?? GROUPS\n\treturn GROUPS.filter((group) => selection.includes(group))\n}\n\n/**\n * Project an artifact to the exact bytes it claims, as hexadecimal.\n *\n * @param artifact - The planned artifact to read.\n * @returns The claimed bytes, or `undefined` when the artifact claims none.\n *\n * @remarks\n * A hydrated artifact carries its vendored source's bytes directly; a template\n * or computed artifact carries text, which is encoded here. An unhydrated host\n * artifact claims no bytes at all, and answers `undefined` rather than an empty\n * string, because no bytes and no content are different facts.\n *\n * @example\n * ```ts\n * import { artifactToHex } from '@orkestrel/scaffold'\n *\n * artifactToHex({\n * \tpath: 'README.md',\n * \tgroup: 'docs',\n * \townership: 'birth',\n * \torigin: 'template',\n * \tcontent: 'hi\\n',\n * }) // '68690a'\n * ```\n */\nexport function artifactToHex(artifact: Artifact): string | undefined {\n\tif (artifact.origin !== 'host') return contentToHex(artifact.content)\n\treturn artifact.hex\n}\n\n/**\n * Infer how one target path compares to the artifact planned for it.\n *\n * @param artifact - The planned artifact.\n * @param observed - The destination's exact bytes as hexadecimal; absent when\n * the destination holds no file.\n * @returns `aligned`, `stale`, or `missing`.\n *\n * @remarks\n * Ownership decides the comparison and nothing else does. A `birth`-owned\n * artifact is never compared and is always aligned, so a file the workspace has\n * outgrown is never reported as drift. A `presence`-owned artifact compares\n * existence only. A `content`-owned artifact compares bytes, and it always\n * carries the bytes to compare, so the comparison can always be made.\n *\n * `foreign` is not answerable here: it describes a path the plan does not own,\n * so no artifact exists to pass in.\n *\n * @example\n * ```ts\n * import type { Artifact } from '@orkestrel/scaffold'\n * import { inferDrift } from '@orkestrel/scaffold'\n *\n * const artifact: Artifact = {\n * \tpath: 'README.md',\n * \tgroup: 'docs',\n * \townership: 'content',\n * \torigin: 'computed',\n * \tcontent: 'hi\\n',\n * }\n *\n * inferDrift(artifact, '68690a') // 'aligned'\n * inferDrift(artifact, '6279650a') // 'stale'\n * inferDrift(artifact) // 'missing'\n * ```\n */\nexport function inferDrift(artifact: Artifact, observed?: string): Exclude<Drift, 'foreign'> {\n\tif (artifact.ownership === 'birth') return 'aligned'\n\tif (observed === undefined) return 'missing'\n\tif (artifact.ownership === 'presence') return 'aligned'\n\treturn observed === artifactToHex(artifact) ? 'aligned' : 'stale'\n}\n\n/**\n * Test whether {@link inferDrift} could have produced a finding for an ownership.\n *\n * @param ownership - What scaffold claims at the planned path.\n * @param finding - The audit verdict to test.\n * @returns Whether the ownership and verdict are reachable through {@link inferDrift}.\n *\n * @remarks\n * This predicate keeps the comparison law beside the reachability law it\n * restates. A mutation uses it so a refusal can distinguish an impossible\n * verdict from a target that genuinely moved after its audit.\n */\nexport function matchesDriftReachability(ownership: Ownership, finding: Finding): boolean {\n\tif (finding.drift === 'aligned') return ownership === 'birth' || finding.observed !== undefined\n\tif (finding.drift === 'missing') return ownership !== 'birth'\n\treturn finding.drift === 'stale' && ownership === 'content'\n}\n\n/**\n * Project a catalog into the layers it publishes in.\n *\n * @param entries - The catalog rows to order.\n * @returns One layer per round, each holding the names publishable together,\n * sorted within the layer; a name whose edges never resolve is omitted.\n *\n * @remarks\n * A layer is a deterministic function of the catalog's own edges, so it is\n * computed here rather than stored on a row that could disagree with them.\n * Only RUNTIME edges between catalogued packages count: a development\n * dependency reaches no consumer, so it constrains nothing about publish order,\n * and an edge leaving the fleet is a package this catalog does not publish.\n *\n * The order matters because these packages are `0.0.x`, where a caret pins one\n * exact release. Publishing a dependent before its dependency leaves the\n * dependent pinned to the older release, and two ranges that disagree install\n * two copies of one package that the compiler reads as two distinct types.\n *\n * A cycle cannot be published in rounds, so its members are omitted rather than\n * placed in an order that would be wrong. An absent name is the report: compare\n * the returned names against the catalog to find one.\n *\n * @example\n * ```ts\n * import { catalogToLayers } from '@orkestrel/scaffold'\n *\n * catalogToLayers(entries)[0] // the names that depend on nothing in the fleet\n * ```\n */\nexport function catalogToLayers(\n\tentries: readonly CatalogEntry[],\n): ReadonlyArray<readonly string[]> {\n\tconst published = new Set(\n\t\tentries.filter((entry) => entry.lookup === 'found').map((entry) => entry.name),\n\t)\n\tconst pending = new Map<string, Set<string>>()\n\tfor (const entry of entries) {\n\t\tif (entry.lookup !== 'found') continue\n\t\tconst edges = entry.dependencies.map((dependency) => dependency.name)\n\t\tpending.set(entry.name, new Set(edges.filter((name) => published.has(name))))\n\t}\n\tconst layers: string[][] = []\n\twhile (pending.size > 0) {\n\t\tconst ready = [...pending].filter(([, edges]) => edges.size === 0).map(([name]) => name)\n\t\tif (ready.length === 0) break\n\t\tfor (const name of ready) pending.delete(name)\n\t\tfor (const edges of pending.values()) for (const name of ready) edges.delete(name)\n\t\tlayers.push(ready.sort())\n\t}\n\treturn layers\n}\n\n/**\n * Project a plan into its tally by artifact origin.\n *\n * @param plan - The plan to summarize.\n * @returns The workspace's name, both environment axes, the covered groups, and\n * one count per origin.\n *\n * @remarks\n * Lossy on purpose: the summary is what a report prints, and it holds nothing a\n * caller could mistake for the plan itself. The counts are derived on each call\n * rather than stored on the plan, so they cannot disagree with the artifacts\n * beside them.\n *\n * @example\n * ```ts\n * import { planToSummary } from '@orkestrel/scaffold'\n *\n * planToSummary(plan).computed // the number of computed artifacts\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\tsrc: plan.blueprint.src,\n\t\tapp: plan.blueprint.app,\n\t\tgroups: plan.groups,\n\t\thost,\n\t\ttemplate,\n\t\tcomputed,\n\t}\n}\n\n/**\n * Extract the three numeric components of an exact version.\n *\n * @param version - The candidate version text.\n * @returns The major, minor, and patch numbers, or `undefined` when the text is\n * not the exact three-component syntax.\n *\n * @remarks\n * Deliberately narrow: a prerelease or build suffix is not extracted, because\n * this package compares released versions and refusing to read one is honest\n * where guessing its precedence would not be.\n *\n * @example\n * ```ts\n * import { extractVersion } from '@orkestrel/scaffold'\n *\n * extractVersion('0.0.23') // [0, 0, 23]\n * extractVersion('1.2.3-beta.1') // undefined\n * ```\n */\nexport function extractVersion(\n\tversion: string,\n): readonly [major: number, minor: number, patch: number] | undefined {\n\tif (!VERSION_PATTERN.test(version)) return undefined\n\tconst [major, minor, patch] = version.split('.').map((component) => Number(component))\n\tif (major === undefined || minor === undefined || patch === undefined) return undefined\n\treturn [major, minor, patch]\n}\n\n/**\n * Compare two versions by their numeric components.\n *\n * @param left - The version ordered first when it compares lower.\n * @param right - The version compared against.\n * @returns `-1`, `1`, or `0` as `left` sorts before, after, or with `right`.\n *\n * @remarks\n * Major, then minor, then patch, each compared as a number so `0.0.10` sorts\n * above `0.0.9`. The function is total: a version this package cannot read\n * sorts below one it can, and two unreadable versions fall back to a code-unit\n * comparison, so an ordering is never decided by which side failed to parse.\n *\n * @example\n * ```ts\n * import { compareVersions } from '@orkestrel/scaffold'\n *\n * compareVersions('0.0.9', '0.0.10') // -1\n * compareVersions('1.2.3', '1.2.3') // 0\n * ```\n */\nexport function compareVersions(left: string, right: string): number {\n\tconst first = extractVersion(left)\n\tconst second = extractVersion(right)\n\tif (first === undefined || second === undefined) {\n\t\tif (first !== undefined) return 1\n\t\tif (second !== undefined) return -1\n\t\treturn compareValues(left, right)\n\t}\n\tfor (let index = 0; index < first.length; index += 1) {\n\t\tconst order = compareValues(first[index] ?? 0, second[index] ?? 0)\n\t\tif (order !== 0) return order\n\t}\n\treturn 0\n}\n\n/**\n * Test whether a declared range already admits a published version.\n *\n * @param range - The declared dependency range.\n * @param latest - The version the registry reported as latest.\n * @returns `true` when the range admits that version.\n *\n * @remarks\n * The one place this comparison is made. A `Release` records the declared range\n * and the reported version and stores no verdict beside them, because a stored\n * verdict could only disagree with the two fields it sits next to.\n *\n * Readability is decided first, and it is `EXTRA_RANGE_PATTERN`: an optional\n * caret or tilde over three numeric components and an optional prerelease\n * suffix. That pattern already covers every `ORKESTREL_RANGE_PATTERN` range and\n * every `VERSION_PATTERN` version, so the subset is stated once rather than\n * assembled here. Text outside it is never admitted, including text handed in on\n * both sides, so an unreadable declaration surfaces as work instead of matching\n * itself.\n *\n * The accepted subset is the one that pattern admits: an exact pin, a tilde\n * range, and a caret range. An exact pin is satisfied by that version alone. A\n * tilde range holds the minor and admits a later patch. A caret range holds the\n * leading nonzero component, which is why `^0.0.5` is an exact pin and `^0.5.3`\n * admits `0.5.4` but not `0.6.0`.\n *\n * Identity is the door a prerelease passes through, and the only one: this\n * package does not order prerelease precedence, so `1.2.3-beta.1` is satisfied\n * by that exact string and by nothing else. The version side needs no separate\n * readability test, because identity already proves it equals a readable\n * declaration and every other branch reads it through {@link extractVersion}.\n *\n * @example\n * ```ts\n * import { matchesRange } from '@orkestrel/scaffold'\n *\n * matchesRange('^0.0.5', '0.0.5') // true\n * matchesRange('^0.0.5', '0.0.7') // false\n * matchesRange('~8.2.0', '8.2.4') // true\n * matchesRange('^7.58.12', '7.60.0') // true\n * matchesRange('not-a-range', 'not-a-range') // false\n * ```\n */\nexport function matchesRange(range: string, latest: string): boolean {\n\tif (!EXTRA_RANGE_PATTERN.test(range)) return false\n\tconst operator = range.startsWith('^') || range.startsWith('~') ? range.slice(0, 1) : ''\n\tconst declared = range.slice(operator.length)\n\tif (declared === latest) return true\n\tif (operator === '') return false\n\tconst left = extractVersion(declared)\n\tconst right = extractVersion(latest)\n\tif (left === undefined || right === undefined) return false\n\tif (left[0] !== right[0]) return false\n\tif (operator === '^' && left[0] === 0 && left[1] === 0) return false\n\tif ((operator === '~' || left[0] === 0) && left[1] !== right[1]) return false\n\treturn compareVersions(latest, declared) >= 0\n}\n\n/**\n * Test whether a declared engines floor is at or above the supported minimum.\n *\n * @param engines - The declared `engines.node` range.\n * @returns `true` when the range is the accepted syntax and its floor is at or\n * above `MINIMUM_NODE_VERSION`.\n *\n * @remarks\n * The declaration states a floor, so the comparison is against the oldest Node\n * the generated toolchain supports rather than against a published version. The\n * `>=` prefix is read here, so no caller repeats the offset.\n *\n * @example\n * ```ts\n * import { matchesEngines } from '@orkestrel/scaffold'\n *\n * matchesEngines('>=22.12.0') // true\n * matchesEngines('>=20.0.0') // false\n * matchesEngines('22.12.0') // false\n * ```\n */\nexport function matchesEngines(engines: string): boolean {\n\tif (!ENGINES_PATTERN.test(engines)) return false\n\treturn compareVersions(engines.slice(2), MINIMUM_NODE_VERSION) >= 0\n}\n\n/**\n * Project a package manifest's text to its own name.\n *\n * @param manifest - The `package.json` text.\n * @returns The declared name, or `undefined` when the text is oversized,\n * malformed, not an object, or carries no bounded string name.\n *\n * @remarks\n * Never throws: a manifest is a file a target owns, so unreadable is an answer\n * rather than a fault. The name is bounded by the registry's own package-name\n * ceiling, because it reaches a path through {@link nameToGuide}.\n *\n * @example\n * ```ts\n * import { manifestToName } from '@orkestrel/scaffold'\n *\n * manifestToName('{\"name\":\"@orkestrel/router\"}') // '@orkestrel/router'\n * manifestToName('{') // undefined\n * ```\n */\nexport function manifestToName(manifest: string): string | undefined {\n\tif (computeBytes(manifest) > MAX_MANIFEST_BYTES) return undefined\n\tconst parsed = parseJSON(manifest)\n\tif (!isRecord(parsed)) return undefined\n\tconst name = parsed.name\n\tif (!isString(name) || name.length === 0 || name.length > MAX_DEPENDENCY_NAME_LENGTH) {\n\t\treturn undefined\n\t}\n\treturn name\n}\n\n/**\n * Project a package manifest's text to the `@orkestrel/*` packages it declares.\n *\n * @param manifest - The `package.json` text.\n * @returns One dependency per declared `@orkestrel` package, in section order,\n * with the first declaration of a repeated name winning.\n *\n * @remarks\n * Runtime, development, and peer sections are read in that order, because a\n * package the fleet publishes is upstream of this workspace wherever it is\n * declared. Every other name is skipped rather than refused: a workspace's\n * unrelated dependencies are not this package's to report on.\n *\n * Never throws, and every row it returns satisfies `isDependency` while the\n * list satisfies `isCollection`, so the result crosses the compiler's own\n * boundary without a second cleaning.\n *\n * @example\n * ```ts\n * import { manifestToDependencies } from '@orkestrel/scaffold'\n *\n * manifestToDependencies('{\"dependencies\":{\"@orkestrel/emitter\":\"^0.0.5\",\"vite\":\"~8.2.0\"}}')\n * // [{ name: '@orkestrel/emitter', range: '^0.0.5' }]\n * ```\n */\nexport function manifestToDependencies(manifest: string): readonly Dependency[] {\n\tif (computeBytes(manifest) > MAX_MANIFEST_BYTES) return []\n\tconst parsed = parseJSON(manifest)\n\tif (!isRecord(parsed)) return []\n\tconst dependencies: Dependency[] = []\n\tconst seen = new Set<string>()\n\tfor (const section of ['dependencies', 'devDependencies', 'peerDependencies']) {\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 (seen.has(name)) continue\n\t\t\tif (!DEPENDENCY_NAME_PATTERN.test(name) || name.length > MAX_DEPENDENCY_NAME_LENGTH) continue\n\t\t\tif (!isString(range) || range.length === 0 || range.length > MAX_RANGE_LENGTH) continue\n\t\t\tseen.add(name)\n\t\t\tdependencies.push({ name, range })\n\t\t}\n\t}\n\treturn limitEntries(dependencies, MAX_COLLECTION_ITEMS)\n}\n","import type {\n\tArtifact,\n\tBuildFormat,\n\tBlueprint,\n\tContentArtifact,\n\tDependency,\n\tEnvironment,\n\tFinding,\n\tOverride,\n\tPlan,\n\tQuestion,\n\tSnapshot,\n\tViteMachinery,\n} from './types.js'\nimport { attempt, canonicalStringify, compareValues, sortValues } from '@orkestrel/contract'\nimport { fillTemplate } from '@orkestrel/template'\nimport {\n\tAPP_BROWSER_DEV_DEPENDENCIES,\n\tAPP_DEV_DEPENDENCIES,\n\tAPP_MATRIX,\n\tAPP_SERVER_DEV_DEPENDENCIES,\n\tBASE_DEV_DEPENDENCIES,\n\tBIN_CONFIGS,\n\tBIN_ENTRY_PATH,\n\tDECLARATION_DEV_DEPENDENCIES,\n\tDEPENDENCY_NAME_PATTERN,\n\tENVIRONMENTS,\n\tEXTRA_NAME_PATTERN,\n\tEXTRA_RANGE_PATTERN,\n\tGLOBAL_SETUP_PATH,\n\tHOST_PATHS,\n\tINTEGRATION_TEST_PATH,\n\tMAX_ARTIFACT_BYTES,\n\tMAX_COLLECTION_ITEMS,\n\tMAX_TOTAL_ARTIFACT_BYTES,\n\tNAME_PATTERN,\n\tORKESTREL_RANGE_PATTERN,\n\tSERVICE_SCRIPT_PATH,\n\tSERVICE_SETUP_PATH,\n\tSHOWCASE_CONFIG_PATH,\n\tSHOWCASE_DEV_DEPENDENCIES,\n\tSOURCE_BROWSER_DEV_DEPENDENCIES,\n\tSRC_MATRIX,\n\tVERSION_PATTERN,\n} from './constants.js'\nimport {\n\tcomputeBytes,\n\tcomputeHash,\n\tinferDrift,\n\tinferGroup,\n\tmatchesEngines,\n\tmatchesPrintWidth,\n\tnameToRewrite,\n\tserializeTypeScriptString,\n\tselectHostPaths,\n} from './helpers.js'\nimport { ARTIFACT_TEMPLATES, CONFIG_TEMPLATES } from './templates.js'\n\n/**\n * Select the single published environment a package root points at.\n *\n * @param src - The declared published environments.\n * @returns That environment, or `undefined` when the selection declares none or\n * several.\n *\n * @remarks\n * A workspace publishing exactly one environment puts it at the package root,\n * so its entry fields and its `'.'` export condition both name that\n * environment's build. A workspace publishing several puts core at the root and\n * gives every other environment a subpath, so there is no single root to name.\n * Both callers read the same answer, which is why the branch is decided once\n * here rather than twice.\n *\n * @example\n * ```ts\n * import { srcToRoot } from '@orkestrel/scaffold'\n *\n * srcToRoot(['browser']) // 'browser'\n * srcToRoot(['core', 'server']) // undefined\n * ```\n */\nexport function srcToRoot(src: readonly Environment[]): Environment | undefined {\n\tif (src.length !== 1) return undefined\n\treturn src[0]\n}\n\n/**\n * Build one `exports` condition block for a built environment.\n *\n * @param path - The extensionless `dist` path both conditions point at.\n * @param formats - The module formats that environment builds.\n * @returns The condition block: an `import` condition always, and a `require`\n * condition only where a CommonJS build exists.\n *\n * @remarks\n * The formats decide the shape, so no caller repeats the rule. An environment\n * that builds ES only publishes an `import` condition alone rather than a\n * `default` one, because a `default` condition answers `require` too and would\n * hand a CommonJS consumer a module its loader cannot read.\n *\n * @example\n * ```ts\n * import { pathToCondition } from '@orkestrel/scaffold'\n *\n * pathToCondition('./dist/src/browser/index', ['es'])\n * // { import: { types: './dist/src/browser/index.d.ts', default: './dist/src/browser/index.js' } }\n * ```\n */\nexport function pathToCondition(\n\tpath: string,\n\tformats: readonly BuildFormat[],\n): Readonly<Record<string, unknown>> {\n\tconst module = { types: `${path}.d.ts`, default: `${path}.js` }\n\tif (!formats.includes('cjs')) return { import: module }\n\treturn { import: module, require: { types: `${path}.d.cts`, default: `${path}.cjs` } }\n}\n\n/**\n * Project a published selection into the manifest's entry fields.\n *\n * @param src - The declared published environments.\n * @returns The `main` and `module` fields, plus `types` when one environment\n * owns the package root.\n *\n * @remarks\n * `main` follows the root environment's own formats, so an environment that\n * builds ES only points both fields at the same file rather than promising a\n * CommonJS build that never runs. A selection with several environments carries\n * no top-level `types`, because each environment declares its own under its\n * subpath and a single top-level field could only name one of them.\n *\n * @example\n * ```ts\n * import { srcToEntry } from '@orkestrel/scaffold'\n *\n * srcToEntry(['core']).main // './dist/src/core/index.cjs'\n * srcToEntry(['browser']).main // './dist/src/browser/index.js'\n * ```\n */\nexport function srcToEntry(src: readonly Environment[]): {\n\treadonly main: string\n\treadonly module: string\n\treadonly types?: string\n} {\n\tconst root = srcToRoot(src)\n\tconst environment = root ?? 'core'\n\tconst base = `./dist/src/${environment}/index`\n\tconst main = SRC_MATRIX[environment].formats.includes('cjs') ? `${base}.cjs` : `${base}.js`\n\tif (root === undefined) return { main, module: `${base}.js` }\n\treturn { main, module: `${base}.js`, types: `${base}.d.ts` }\n}\n\n/**\n * Project a published selection into the manifest's `exports` map.\n *\n * @param src - The declared published environments.\n * @returns The map, keyed by subpath in `ENVIRONMENTS` order.\n *\n * @remarks\n * One environment owns the package root and every other declared environment\n * takes the subpath its `SRC_MATRIX` row names, so the map never invents a\n * subpath. `./package.json` is published alongside, which is what lets a\n * consumer's tooling read the manifest of a package whose exports are otherwise\n * closed. A selection publishing nothing answers an empty map rather than a\n * core-rooted one, because a workspace with no published environment declares\n * no exports at all.\n *\n * @example\n * ```ts\n * import { srcToExports } from '@orkestrel/scaffold'\n *\n * Object.keys(srcToExports(['core', 'server'])) // ['.', './server', './package.json']\n * srcToExports([]) // {}\n * ```\n */\nexport function srcToExports(src: readonly Environment[]): Readonly<Record<string, unknown>> {\n\tif (src.length === 0) return {}\n\tconst map: Record<string, unknown> = {}\n\tconst root = srcToRoot(src)\n\tconst environment = root ?? 'core'\n\tmap['.'] = pathToCondition(`./dist/src/${environment}/index`, SRC_MATRIX[environment].formats)\n\tif (root === undefined) {\n\t\tfor (const declared of ENVIRONMENTS) {\n\t\t\tif (declared === 'core' || !src.includes(declared)) continue\n\t\t\tconst row = SRC_MATRIX[declared]\n\t\t\tmap[row.path] = pathToCondition(`./dist/src/${declared}/index`, row.formats)\n\t\t}\n\t}\n\tmap['./package.json'] = './package.json'\n\treturn map\n}\n\n/**\n * Project a blueprint into the development dependencies its manifest declares.\n *\n * @param blueprint - The workspace specification.\n * @returns The merged set, sorted by package name.\n *\n * @remarks\n * The shared toolchain is the baseline every generated workspace carries, and\n * each declared axis adds the set its host needs. A declared extra or peer is\n * applied after those, so a workspace that pins a range for a package the\n * conditional sets also name gets the range it declared. An extra that restates\n * a shared toolchain pin never reaches here, because the gate refuses it.\n *\n * A peer is declared here as well as under `peerDependencies`, because a peer is\n * not installed by the workspace that declares it and developing against one\n * requires it present. A runtime dependency is the opposite case and is removed:\n * it is already installed, so a second declaration would state one fact twice\n * and the two ranges would be free to disagree.\n *\n * A workspace never declares itself, so its own package name is removed. That\n * matters for a workspace named after a package the baseline already carries:\n * the baseline is a list of what a workspace consumes, and a workspace does not\n * consume itself.\n *\n * @example\n * ```ts\n * import { blueprintToDevDependencies, createBlueprint } from '@orkestrel/scaffold'\n *\n * const blueprint = createBlueprint('router', { src: ['core'] })\n *\n * blueprintToDevDependencies(blueprint).typescript // the shared TypeScript pin\n * ```\n */\nexport function blueprintToDevDependencies(blueprint: Blueprint): Readonly<Record<string, string>> {\n\tconst merged: Record<string, string> = {\n\t\t...BASE_DEV_DEPENDENCIES,\n\t\t...(blueprint.src.length > 0 || blueprint.bin ? DECLARATION_DEV_DEPENDENCIES : {}),\n\t\t...(blueprint.src.includes('browser') ? SOURCE_BROWSER_DEV_DEPENDENCIES : {}),\n\t\t...(blueprint.app.length > 0 ? APP_DEV_DEPENDENCIES : {}),\n\t\t...(blueprint.app.includes('browser') ? APP_BROWSER_DEV_DEPENDENCIES : {}),\n\t\t...(blueprint.showcase && blueprint.app.includes('browser') ? SHOWCASE_DEV_DEPENDENCIES : {}),\n\t\t...(blueprint.app.includes('server') ? APP_SERVER_DEV_DEPENDENCIES : {}),\n\t}\n\tfor (const extra of blueprint.extras) merged[extra.name] = extra.range\n\tfor (const peer of blueprint.peers) merged[peer.name] = peer.range\n\tconst own = blueprint.src.length > 0 ? `@orkestrel/${blueprint.name}` : blueprint.name\n\tconst runtime = new Set(blueprint.dependencies.map((dependency) => dependency.name))\n\treturn Object.fromEntries(\n\t\tObject.entries(merged)\n\t\t\t.filter(([name]) => name !== own && !runtime.has(name))\n\t\t\t.sort(([left], [right]) => compareValues(left, right)),\n\t)\n}\n\n/**\n * Project a blueprint into the scripts its manifest declares.\n *\n * @param blueprint - The workspace specification.\n * @returns The scripts, in the order the manifest lists them.\n *\n * @remarks\n * Each script is the workspace-level contract the repository rules fix, narrowed\n * to the axes the blueprint declares: a check and a test script per declared\n * environment, an aggregate over each axis, the policy and configuration\n * proofs every workspace can pass before it has a public API, and one build per\n * target that actually builds.\n *\n * A publishing workspace isolates distribution and live-service proofs from\n * `test` and runs them from `prepublishOnly` instead. A private workspace has\n * no publish lifecycle, so it omits distribution and runs a live-service proof\n * from `test`. Integration and conformance stay in `test` because they neither\n * pack nor install the workspace and drive no external service. A conformance\n * run may start a server, but it starts its own and reaches it over loopback,\n * so the run stays hermetic.\n *\n * The configuration paths interpolated here are the same ones `SRC_MATRIX` and\n * `APP_MATRIX` list as each environment's configuration files, so a rename in\n * either matrix is a rename in both places.\n *\n * @example\n * ```ts\n * import { blueprintToScripts, createBlueprint } from '@orkestrel/scaffold'\n *\n * const blueprint = createBlueprint('router', { src: ['core'] })\n *\n * blueprintToScripts(blueprint)['format:check'] // 'oxfmt --config .oxfmtrc.json --check .'\n * ```\n */\nexport function blueprintToScripts(blueprint: Blueprint): Readonly<Record<string, string>> {\n\tconst publishes = blueprint.src.length > 0\n\t// Distribution requires the published source it packs, so the declared flag\n\t// alone never selects it.\n\tconst distributes = blueprint.distribution && publishes\n\tconst integrates = blueprint.integration\n\tconst compiles = publishes || blueprint.bin\n\tconst runtime = blueprint.app.filter((environment) => environment !== 'core')\n\tconst vitest = 'vitest run --config vite.config.ts --no-cache --reporter=dot'\n\tconst scripts: Record<string, string> = {\n\t\tclean: \"node -e \\\"require('node:fs').rmSync('dist',{recursive:true,force:true})\\\"\",\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\tformat: 'oxfmt --config .oxfmtrc.json --write .',\n\t\t'format:check': 'oxfmt --config .oxfmtrc.json --check .',\n\t\tlint: 'oxlint --config .oxlintrc.json --fix .',\n\t\t'lint:check': 'oxlint --config .oxlintrc.json --deny-warnings .',\n\t\tcheck: [\n\t\t\t'tsc --noEmit --project tsconfig.json',\n\t\t\t...(compiles ? ['npm run check:src'] : []),\n\t\t\t...(blueprint.app.length > 0 ? ['npm run check:app'] : []),\n\t\t].join(' && '),\n\t}\n\tif (compiles) {\n\t\tscripts['check:src'] = [\n\t\t\t...blueprint.src.map((environment) => `npm run check:src:${environment}`),\n\t\t\t...(blueprint.bin ? ['npm run check:src:bin'] : []),\n\t\t].join(' && ')\n\t\tfor (const environment of blueprint.src) {\n\t\t\tscripts[`check:src:${environment}`] =\n\t\t\t\t`tsc --noEmit -p configs/src/tsconfig.${environment}.json`\n\t\t}\n\t\tif (blueprint.bin) scripts['check:src:bin'] = 'tsc --noEmit -p configs/src/tsconfig.bin.json'\n\t}\n\tif (blueprint.app.length > 0) {\n\t\tscripts['check:app'] = blueprint.app\n\t\t\t.map((environment) => `npm run check:app:${environment}`)\n\t\t\t.join(' && ')\n\t\tfor (const environment of blueprint.app) {\n\t\t\tscripts[`check:app:${environment}`] =\n\t\t\t\tenvironment === 'browser'\n\t\t\t\t\t? 'vue-tsc --noEmit -p configs/app/tsconfig.browser.json'\n\t\t\t\t\t: `tsc --noEmit -p configs/app/tsconfig.${environment}.json`\n\t\t}\n\t}\n\tscripts.test = [\n\t\t...(compiles ? ['npm run test:src'] : []),\n\t\t...(blueprint.app.length > 0 ? ['npm run test:app'] : []),\n\t\t'npm run test:policy',\n\t\t'npm run test:config',\n\t\t...(blueprint.guides ? ['npm run test:guides'] : []),\n\t\t...(blueprint.conformance ? ['npm run test:conformance'] : []),\n\t\t...(integrates ? ['npm run test:integration'] : []),\n\t\t...(!publishes && blueprint.service ? ['npm run test:service'] : []),\n\t].join(' && ')\n\tif (compiles) {\n\t\tscripts['test:src'] = [\n\t\t\tvitest,\n\t\t\t...blueprint.src.map((environment) => `--project ${SRC_MATRIX[environment].project}`),\n\t\t\t...(blueprint.bin ? ['--project src:bin'] : []),\n\t\t].join(' ')\n\t\tfor (const environment of blueprint.src) {\n\t\t\tscripts[`test:src:${environment}`] = `${vitest} --project ${SRC_MATRIX[environment].project}`\n\t\t}\n\t\tif (blueprint.bin) scripts['test:src:bin'] = `${vitest} --project src:bin`\n\t}\n\tif (blueprint.app.length > 0) {\n\t\tscripts['test:app'] = [\n\t\t\tvitest,\n\t\t\t...blueprint.app.map((environment) => `--project ${APP_MATRIX[environment].project}`),\n\t\t].join(' ')\n\t\tfor (const environment of blueprint.app) {\n\t\t\tscripts[`test:app:${environment}`] = `${vitest} --project ${APP_MATRIX[environment].project}`\n\t\t}\n\t}\n\tscripts['test:policy'] = `${vitest} --project policy`\n\tscripts['test:config'] = `${vitest} --project config`\n\tif (blueprint.guides) scripts['test:guides'] = `${vitest} --project guides`\n\tif (blueprint.conformance) scripts['test:conformance'] = `${vitest} --project conformance`\n\tscripts['test:probe'] =\n\t\t'vitest run --config vite.config.ts --no-cache --reporter=verbose --project probe'\n\tif (distributes) scripts['test:distribution'] = `${vitest} --project distribution`\n\tif (integrates) scripts['test:integration'] = `${vitest} --project integration`\n\tif (blueprint.service) scripts['test:service'] = `${vitest} --project service`\n\tscripts.build = [\n\t\t'npm run clean',\n\t\t...(compiles ? ['npm run build:src'] : []),\n\t\t...(blueprint.app.length > 0 ? ['npm run build:app'] : []),\n\t].join(' && ')\n\tif (compiles) {\n\t\tscripts['build:src'] = [\n\t\t\t...blueprint.src.map((environment) => `npm run build:src:${environment}`),\n\t\t\t...(blueprint.bin ? ['npm run build:src:bin'] : []),\n\t\t].join(' && ')\n\t\tfor (const environment of blueprint.src) {\n\t\t\tconst build = `vite build --config configs/src/vite.${environment}.config.ts`\n\t\t\tscripts[`build:src:${environment}`] = SRC_MATRIX[environment].formats.includes('cjs')\n\t\t\t\t? `${build} && npm run copy dist/src/${environment}/index.d.ts dist/src/${environment}/index.d.cts`\n\t\t\t\t: build\n\t\t}\n\t\tif (blueprint.bin) {\n\t\t\tscripts['build:src:bin'] = 'vite build --config configs/src/vite.bin.config.ts'\n\t\t}\n\t}\n\tif (blueprint.app.length > 0) {\n\t\tscripts['build:app'] =\n\t\t\truntime.length > 0\n\t\t\t\t? runtime.map((environment) => `npm run build:app:${environment}`).join(' && ')\n\t\t\t\t: 'npm run check:app:core'\n\t\tfor (const environment of runtime) {\n\t\t\tscripts[`build:app:${environment}`] =\n\t\t\t\t`vite build --config configs/app/vite.${environment}.config.ts`\n\t\t}\n\t}\n\tif (blueprint.app.includes('browser')) {\n\t\tscripts.dev = 'vite --config configs/app/vite.browser.config.ts'\n\t\tif (blueprint.showcase) {\n\t\t\tscripts.showcase = `vite --config ${SHOWCASE_CONFIG_PATH}`\n\t\t\tscripts['build:showcase'] = `vite build --config ${SHOWCASE_CONFIG_PATH}`\n\t\t\tscripts.show =\n\t\t\t\t'npm run format && npm run build:showcase && npm run copy dist/showcase/index.html demo/showcase.html'\n\t\t}\n\t}\n\tif (blueprint.app.includes('server')) {\n\t\tscripts.serve = 'node dist/app/server/main.cjs'\n\t\tscripts['serve:build'] = 'npm run build:app:server && npm run serve'\n\t}\n\tif (publishes) {\n\t\tscripts.prepublishOnly = [\n\t\t\t'npm run format:check && npm run lint:check && npm run check && npm run build && npm test',\n\t\t\t...(distributes ? ['npm run test:distribution -- --mode release'] : []),\n\t\t\t...(blueprint.service ? ['npm run test:service'] : []),\n\t\t].join(' && ')\n\t}\n\treturn scripts\n}\n\n/**\n * Compile a blueprint into its `package.json` content.\n *\n * @param blueprint - The workspace specification.\n * @returns The manifest text, newline-terminated.\n *\n * @remarks\n * A workspace declaring a published environment is scoped and public; one\n * declaring none is a private application and carries neither a scope, a\n * publication block, nor a repository. Declared dependencies and peers are\n * emitted in name order so the same blueprint answers the same bytes, and\n * `peerDependenciesMeta` carries only the peers marked optional.\n *\n * The text is `JSON.stringify` at tab indentation with a trailing newline,\n * which is the formatter's own fixed point for a manifest: `oxfmt` keeps every\n * `package.json` array expanded, so no width-aware collapse applies here. That\n * is not true of the workspace's other JSON, which is why this is the one JSON\n * artifact serialized directly.\n *\n * The artifact carrying this text is claimed by birth. A workspace owns its own\n * manifest once it exists: its description, its keywords, and any script it\n * added are the consumer's, so a repair that replaced the file would take them.\n * The one part scaffold keeps current afterwards is the declared `@orkestrel/*`\n * range set, and that is a region with its own writer rather than a claim over\n * the file's bytes.\n *\n * @example\n * ```ts\n * import { blueprintToManifest, createBlueprint } from '@orkestrel/scaffold'\n *\n * const blueprint = createBlueprint('router', { src: ['core'] })\n *\n * blueprintToManifest(blueprint).endsWith('}\\n') // true\n * ```\n */\nexport function blueprintToManifest(blueprint: Blueprint): string {\n\tconst publishes = blueprint.src.length > 0\n\tconst name = publishes ? `@orkestrel/${blueprint.name}` : blueprint.name\n\tconst dependencies: Record<string, string> = {}\n\tfor (const dependency of [...blueprint.dependencies].sort((left, right) =>\n\t\tcompareValues(left.name, right.name),\n\t)) {\n\t\tdependencies[dependency.name] = dependency.range\n\t}\n\tconst peerDependencies: Record<string, string> = {}\n\tconst peerDependenciesMeta: Record<string, { readonly optional: true }> = {}\n\tfor (const peer of [...blueprint.peers].sort((left, right) =>\n\t\tcompareValues(left.name, right.name),\n\t)) {\n\t\tpeerDependencies[peer.name] = peer.range\n\t\tif (peer.optional === true) peerDependenciesMeta[peer.name] = { optional: true }\n\t}\n\tconst entry = srcToEntry(blueprint.src)\n\tconst manifest: Record<string, unknown> = {\n\t\tname,\n\t\tversion: blueprint.version,\n\t\t...(publishes ? {} : { private: true }),\n\t\tdescription:\n\t\t\tblueprint.description ??\n\t\t\t(publishes ? `The ${name} package.` : `The ${blueprint.name} application.`),\n\t\tkeywords: sortValues(blueprint.keywords),\n\t\t...(publishes\n\t\t\t? {\n\t\t\t\t\thomepage: `https://github.com/orkestrel/${blueprint.name}#readme`,\n\t\t\t\t\tbugs: `https://github.com/orkestrel/${blueprint.name}/issues`,\n\t\t\t\t}\n\t\t\t: {}),\n\t\tlicense: 'MIT',\n\t\t...(publishes\n\t\t\t? {\n\t\t\t\t\trepository: {\n\t\t\t\t\t\ttype: 'git',\n\t\t\t\t\t\turl: `git+https://github.com/orkestrel/${blueprint.name}.git`,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t: {}),\n\t\t...(blueprint.bin ? { bin: { [blueprint.name]: './dist/bin/main.js' } } : {}),\n\t\tfiles: blueprint.bin\n\t\t\t? ['dist/src', 'dist/bin', 'README.md']\n\t\t\t: publishes\n\t\t\t\t? ['dist/src', 'README.md']\n\t\t\t\t: ['dist/app', 'README.md'],\n\t\ttype: 'module',\n\t\t...(publishes\n\t\t\t? {\n\t\t\t\t\tsideEffects: blueprint.bin ? [`./${BIN_ENTRY_PATH}`, './dist/bin/main.js'] : false,\n\t\t\t\t\tmain: entry.main,\n\t\t\t\t\tmodule: entry.module,\n\t\t\t\t\t...(entry.types === undefined ? {} : { types: entry.types }),\n\t\t\t\t\texports: srcToExports(blueprint.src),\n\t\t\t\t\tpublishConfig: { access: 'public' },\n\t\t\t\t}\n\t\t\t: {}),\n\t\tscripts: blueprintToScripts(blueprint),\n\t\tdependencies,\n\t\tdevDependencies: blueprintToDevDependencies(blueprint),\n\t\t...(Object.keys(peerDependencies).length > 0 ? { peerDependencies } : {}),\n\t\t...(Object.keys(peerDependenciesMeta).length > 0 ? { peerDependenciesMeta } : {}),\n\t\tengines: { node: blueprint.engines },\n\t}\n\treturn `${JSON.stringify(manifest, undefined, '\\t')}\\n`\n}\n\n/**\n * Derive the host-specific machinery a generated root Vite configuration carries.\n *\n * @param blueprint - The workspace specification.\n * @returns The four pipelines the generated configuration selects.\n *\n * @remarks\n * The sole derivation of that set: every renderer reads it rather than\n * recomputing an axis of its own. Nothing here selects a boundary guarantee,\n * because the environment-boundary plugin, its module-graph audit, and\n * stylesheet rejection ship in every shape.\n *\n * `output` is the one derived fact rather than a declared one. A workspace\n * builds when it publishes a library, ships an executable, or runs an\n * application host, and only a workspace that builds has an output directory to\n * contain. `showcase` requires the browser application it projects, so the\n * declared flag alone never selects it.\n *\n * @example\n * ```ts\n * import { blueprintToMachinery, createBlueprint } from '@orkestrel/scaffold'\n *\n * const blueprint = createBlueprint('router', { app: ['browser'] })\n *\n * blueprintToMachinery(blueprint).vue // true\n * ```\n */\nexport function blueprintToMachinery(blueprint: Blueprint): ViteMachinery {\n\tconst hosted = blueprint.app.some((environment) => environment !== 'core')\n\treturn {\n\t\tbrowser: blueprint.src.includes('browser') || blueprint.app.includes('browser'),\n\t\tvue: blueprint.app.includes('browser'),\n\t\toutput: blueprint.src.length > 0 || blueprint.bin || hosted,\n\t\tshowcase: blueprint.showcase && blueprint.app.includes('browser'),\n\t}\n}\n\n/**\n * Compile the root TypeScript configuration for a blueprint.\n *\n * @param blueprint - The workspace specification.\n * @returns Formatter-stable `tsconfig.json` text.\n *\n * @example\n * ```ts\n * import { blueprintToRootTsconfig, createBlueprint } from '@orkestrel/scaffold'\n *\n * const blueprint = createBlueprint('router', { src: ['core'] })\n *\n * blueprintToRootTsconfig(blueprint).startsWith('{') // true\n * ```\n */\nexport function blueprintToRootTsconfig(blueprint: Blueprint): string {\n\tconst aliases: string[] = []\n\tfor (const environment of ENVIRONMENTS) {\n\t\tif (blueprint.src.includes(environment)) {\n\t\t\taliases.push(`\"@src/${environment}\": [\"./src/${environment}/index.ts\"]`)\n\t\t}\n\t}\n\tfor (const environment of ENVIRONMENTS) {\n\t\tif (blueprint.app.includes(environment)) {\n\t\t\taliases.push(`\"@app/${environment}\": [\"./app/${environment}/index.ts\"]`)\n\t\t}\n\t}\n\tconst paths = aliases\n\t\t.map((alias, index) => `\\t\\t\\t${alias}${index === aliases.length - 1 ? '' : ','}`)\n\t\t.join('\\n')\n\treturn fillTemplate(CONFIG_TEMPLATES.root.tsconfig, { paths })\n}\n\n/**\n * Compile the root Vite and Vitest configuration for a blueprint.\n *\n * @param blueprint - The workspace specification.\n * @returns Formatter-stable `vite.config.ts` text.\n *\n * @remarks\n * The static root skeleton and each project factory are template data. This\n * function computes only selection, fixed conditional blocks, escaped\n * blueprint strings, and the formatter-measured project-array layout.\n *\n * @example\n * ```ts\n * import { blueprintToRootVite, createBlueprint } from '@orkestrel/scaffold'\n *\n * const blueprint = createBlueprint('router', { src: ['core'] })\n *\n * blueprintToRootVite(blueprint).includes('defineConfig') // true\n * ```\n */\nexport function blueprintToRootVite(blueprint: Blueprint): string {\n\tconst machinery = blueprintToMachinery(blueprint)\n\tconst publishes = blueprint.src.length > 0\n\t// Distribution requires the published source it packs, so the declared flag\n\t// alone never selects it.\n\tconst distributes = blueprint.distribution && publishes\n\tconst imports: string[] = []\n\tif (machinery.browser) imports.push(\"import { playwright } from '@vitest/browser-playwright'\")\n\tif (machinery.vue) imports.push(\"import vue from '@vitejs/plugin-vue'\")\n\tif (machinery.showcase) imports.push(\"import { viteSingleFile } from 'vite-plugin-singlefile'\")\n\n\tconst factories: string[] = []\n\tconst projects: string[] = []\n\tif (blueprint.src.includes('core')) {\n\t\tfactories.push(CONFIG_TEMPLATES.factories.src.core)\n\t\tprojects.push('srcCore')\n\t}\n\tif (blueprint.src.includes('browser')) {\n\t\tconst core = blueprint.src.includes('core')\n\t\tfactories.push(\n\t\t\tfillTemplate(CONFIG_TEMPLATES.factories.src.browser, {\n\t\t\t\texternal: core\n\t\t\t\t\t? \"external: (id: string) => id === '@src/core' || id.startsWith('@orkestrel/'),\"\n\t\t\t\t\t: \"external: (id: string) => id.startsWith('@orkestrel/'),\",\n\t\t\t\toutput: core\n\t\t\t\t\t? \"\\t\\t\\t\\t\\toutput: { paths: { '@src/core': '../core/index.js' } },\"\n\t\t\t\t\t: '\\t\\t\\t\\t\\toutput: {},',\n\t\t\t\texclude: core ? \"\\t\\t\\t\\texclude: ['tests/src/core/**/*.test.ts'],\\n\" : '',\n\t\t\t\t// A browser test runs in the browser, so it cannot start a Node fixture\n\t\t\t\t// for itself. That is the case a global setup exists for, and it is why\n\t\t\t\t// this project takes the same span the integration project does.\n\t\t\t\tglobal: blueprint.global ? \"\\t\\t\\t\\tglobalSetup: ['./tests/setupGlobal.ts'],\\n\" : '',\n\t\t\t}),\n\t\t)\n\t\tprojects.push('srcBrowser')\n\t}\n\tif (blueprint.src.includes('server')) {\n\t\tconst core = blueprint.src.includes('core')\n\t\tfactories.push(\n\t\t\tfillTemplate(CONFIG_TEMPLATES.factories.src.server, {\n\t\t\t\t// The formatter reprints this arrow from its syntax tree, so each\n\t\t\t\t// selection is written the way it measures at the emitted indentation:\n\t\t\t\t// the core predicate carries a third test and passes the vendored\n\t\t\t\t// width, and the one without core fits on the line it starts on.\n\t\t\t\texternal: core\n\t\t\t\t\t? `external: (id: string) =>\n\t\t\t\t\t\tid === '@src/core' || id.startsWith('node:') || id.startsWith('@orkestrel/'),`\n\t\t\t\t\t: \"external: (id: string) => id.startsWith('node:') || id.startsWith('@orkestrel/'),\",\n\t\t\t\toutput: core\n\t\t\t\t\t? `\\t\\t\\t\\t\\toutput: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tformat: 'es',\n\t\t\t\t\t\t\tentryFileNames: 'index.js',\n\t\t\t\t\t\t\tpaths: { '@src/core': '../core/index.js' },\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tformat: 'cjs',\n\t\t\t\t\t\t\tentryFileNames: 'index.cjs',\n\t\t\t\t\t\t\tpaths: { '@src/core': '../core/index.cjs' },\n\t\t\t\t\t\t},\n\t\t\t\t\t],`\n\t\t\t\t\t: '\\t\\t\\t\\t\\toutput: {},',\n\t\t\t\texclude: core ? \"\\t\\t\\t\\texclude: ['tests/src/core/**/*.test.ts'],\\n\" : '',\n\t\t\t}),\n\t\t)\n\t\tprojects.push('srcServer')\n\t}\n\tif (blueprint.bin) {\n\t\tfactories.push(CONFIG_TEMPLATES.factories.src.bin)\n\t\tprojects.push('srcBin')\n\t}\n\tif (blueprint.app.includes('core')) {\n\t\tfactories.push(CONFIG_TEMPLATES.factories.app.core)\n\t\tprojects.push('appCore')\n\t}\n\tif (blueprint.app.includes('browser')) {\n\t\t// The formatter reprints an array from its syntax tree and joins one that\n\t\t// fits the vendored width, so the base plugin array is emitted joined when\n\t\t// the showcase plugins are absent.\n\t\tconst showcasePlugins = machinery.showcase\n\t\t\t? `\tconst showcasePlugins: PluginOption[] = showcase\n\t\t? [\n\t\t\t\tviteSingleFile({\n\t\t\t\t\tremoveViteModuleLoader: true,\n\t\t\t\t\tuseRecommendedBuildConfig: true,\n\t\t\t\t}),\n\t\t\t\t{\n\t\t\t\t\tname: 'orkestrel-showcase-html',\n\t\t\t\t\ttransformIndexHtml: {\n\t\t\t\t\t\torder: 'post',\n\t\t\t\t\t\thandler(html) {\n\t\t\t\t\t\t\tconst stamp = new Date().toISOString()\n\t\t\t\t\t\t\treturn html.replace(\n\t\t\t\t\t\t\t\t'</head>',\n\t\t\t\t\t\t\t\t'\\t\\t<meta name=\"build-id\" content=\"' + stamp + '\" />\\\\n\\t</head>',\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]\n\t\t: []\n`\n\t\t\t: ''\n\t\tconst plugins = machinery.showcase\n\t\t\t? `\\t\\tplugins: [\n\t\t\toutputBoundary(output),\n\t\t\tenvironmentBoundary('app/browser'),\n\t\t\tvue(),\n\t\t\t...showcasePlugins,\n\t\t],\n`\n\t\t\t: \"\\t\\tplugins: [outputBoundary(output), environmentBoundary('app/browser'), vue()],\\n\"\n\t\tconst showcaseBuild = machinery.showcase\n\t\t\t? `\\t\\t\\t...(showcase\n\t\t\t\t? {\n\t\t\t\t\t\tcssMinify: 'lightningcss',\n\t\t\t\t\t\tminify: 'oxc',\n\t\t\t\t\t\tmodulePreload: false,\n\t\t\t\t\t\treportCompressedSize: false,\n\t\t\t\t\t\tsourcemap: false,\n\t\t\t\t\t\ttarget: 'esnext',\n\t\t\t\t\t}\n\t\t\t\t: { assetsInlineLimit: 0 }),\n`\n\t\t\t: '\\t\\t\\tassetsInlineLimit: 0,\\n'\n\t\tconst showcaseFactory = machinery.showcase\n\t\t\t? `\nexport function appShowcase(): UserConfig {\n\treturn applicationBrowser(true)\n}\n`\n\t\t\t: ''\n\t\tfactories.push(\n\t\t\tfillTemplate(CONFIG_TEMPLATES.factories.app.browser, {\n\t\t\t\tplugins,\n\t\t\t\tshowcasePlugins,\n\t\t\t\tshowcaseBuild,\n\t\t\t\tshowcaseFactory,\n\t\t\t}),\n\t\t)\n\t\t// Every other factory takes an optional override, which is the shape Vitest's\n\t\t// own project type reads as a configuration function and calls with a\n\t\t// `ConfigEnv`. This one takes no argument, so it is neither: the row carries\n\t\t// the configuration it returns rather than the factory itself.\n\t\tprojects.push('appBrowser()')\n\t}\n\tif (blueprint.app.includes('server')) {\n\t\tfactories.push(CONFIG_TEMPLATES.factories.app.server)\n\t\tprojects.push('appServer')\n\t}\n\tfactories.push(CONFIG_TEMPLATES.factories.policy)\n\tprojects.push('policy')\n\tfactories.push(CONFIG_TEMPLATES.factories.config)\n\tprojects.push('config')\n\tif (blueprint.guides) {\n\t\tfactories.push(CONFIG_TEMPLATES.factories.guides)\n\t\tprojects.push('guides')\n\t}\n\tif (blueprint.conformance) {\n\t\tfactories.push(CONFIG_TEMPLATES.factories.conformance)\n\t\tprojects.push('conformance')\n\t}\n\tif (blueprint.service) {\n\t\tfactories.push(CONFIG_TEMPLATES.factories.service)\n\t\tprojects.push('service')\n\t}\n\tif (distributes) {\n\t\tfactories.push(CONFIG_TEMPLATES.factories.distribution)\n\t\tprojects.push('distribution')\n\t}\n\tif (blueprint.integration) {\n\t\tfactories.push(\n\t\t\tfillTemplate(CONFIG_TEMPLATES.factories.integration, {\n\t\t\t\tglobal: blueprint.global ? \"\\t\\t\\t\\tglobalSetup: ['./tests/setupGlobal.ts'],\\n\" : '',\n\t\t\t}),\n\t\t)\n\t\tprojects.push('integration')\n\t}\n\tfactories.push(CONFIG_TEMPLATES.factories.probe)\n\tprojects.push('probe')\n\n\tconst joinedProjects = `\\t\\tprojects: [${projects.join(', ')}],`\n\tconst projectRows = matchesPrintWidth(joinedProjects)\n\t\t? joinedProjects\n\t\t: `\\t\\tprojects: [\n${projects.map((project) => `\\t\\t\\t${project},`).join('\\n')}\n\t\\t],`\n\t// The boundary plugins a selection reaches are read off the factories it\n\t// emitted rather than restated as a second selection rule, so the generated\n\t// config imports what it uses and passes its own lint gate. A core-only\n\t// workspace builds nothing and bounds no environment, so it imports neither.\n\tconst body = `${factories.join('\\n')}\\n`\n\tconst boundaries = ['environmentBoundary', 'outputBoundary'].filter((boundary) =>\n\t\tbody.includes(boundary),\n\t)\n\treturn fillTemplate(CONFIG_TEMPLATES.root.vite, {\n\t\tviteTypes: machinery.showcase ? 'PluginOption, UserConfig' : 'UserConfig',\n\t\timports: imports.length === 0 ? '' : `${imports.join('\\n')}\\n`,\n\t\thelpers:\n\t\t\tboundaries.length === 0\n\t\t\t\t? ''\n\t\t\t\t: `import { ${boundaries.join(', ')} } from './configs/helpers.js'\\n`,\n\t\t// The provider options are resolved once for the whole configuration, and\n\t\t// only a selection that emits `configs/browsers.ts` can name them.\n\t\tbrowsers: machinery.browser\n\t\t\t? \"import { resolveBrowser, resolvePinnedBrowser } from './configs/browsers.js'\\n\"\n\t\t\t: '',\n\t\toptions: machinery.browser\n\t\t\t? 'const browserOptions = resolveBrowser(resolvePinnedBrowser(), process.platform, process.env)\\n\\n'\n\t\t\t: '',\n\t\tfactories: body,\n\t\tprojects: projectRows,\n\t})\n}\n\n/**\n * Compile every artifact in the `configs` group.\n *\n * @param blueprint - The workspace specification.\n * @returns Root and selected wrapper artifacts in matrix order.\n *\n * @example\n * ```ts\n * import { blueprintToConfigArtifacts, createBlueprint } from '@orkestrel/scaffold'\n *\n * const blueprint = createBlueprint('router', { src: ['core'] })\n *\n * blueprintToConfigArtifacts(blueprint)[0]?.path // 'tsconfig.json'\n * ```\n */\nexport function blueprintToConfigArtifacts(blueprint: Blueprint): readonly Artifact[] {\n\tconst artifacts: Artifact[] = [\n\t\t{\n\t\t\tpath: 'tsconfig.json',\n\t\t\tgroup: 'configs',\n\t\t\townership: 'content',\n\t\t\torigin: 'template',\n\t\t\tcontent: blueprintToRootTsconfig(blueprint),\n\t\t},\n\t\t{\n\t\t\tpath: 'vite.config.ts',\n\t\t\tgroup: 'configs',\n\t\t\townership: 'content',\n\t\t\torigin: 'template',\n\t\t\tcontent: blueprintToRootVite(blueprint),\n\t\t},\n\t]\n\t// The browser resolver is its own leaf rather than a block inside the vendored\n\t// `configs/helpers.ts`, because that file is byte-identical in every workspace\n\t// and only a browser selection declares the `playwright` it imports.\n\tif (blueprintToMachinery(blueprint).browser) {\n\t\tartifacts.push({\n\t\t\tpath: 'configs/browsers.ts',\n\t\t\tgroup: 'configs',\n\t\t\townership: 'content',\n\t\t\torigin: 'template',\n\t\t\tcontent: CONFIG_TEMPLATES.browsers,\n\t\t})\n\t}\n\tfor (const environment of blueprint.src) {\n\t\tfor (const path of SRC_MATRIX[environment].configs) {\n\t\t\tlet content: string = CONFIG_TEMPLATES.vites.src.core\n\t\t\tif (path === 'configs/src/tsconfig.core.json') content = CONFIG_TEMPLATES.tsconfigs.src.core\n\t\t\telse if (path === 'configs/src/vite.browser.config.ts') {\n\t\t\t\tcontent = fillTemplate(CONFIG_TEMPLATES.vites.src.browser, {\n\t\t\t\t\treplacement: nameToRewrite(blueprint.name),\n\t\t\t\t})\n\t\t\t} else if (path === 'configs/src/tsconfig.browser.json') {\n\t\t\t\tcontent = CONFIG_TEMPLATES.tsconfigs.src.browser\n\t\t\t} else if (path === 'configs/src/vite.server.config.ts') {\n\t\t\t\tcontent = fillTemplate(CONFIG_TEMPLATES.vites.src.server, {\n\t\t\t\t\treplacement: nameToRewrite(blueprint.name),\n\t\t\t\t})\n\t\t\t} else if (path === 'configs/src/tsconfig.server.json') {\n\t\t\t\tcontent = CONFIG_TEMPLATES.tsconfigs.src.server\n\t\t\t}\n\t\t\tartifacts.push({\n\t\t\t\tpath,\n\t\t\t\tgroup: 'configs',\n\t\t\t\townership: 'content',\n\t\t\t\torigin: 'template',\n\t\t\t\tenvironment,\n\t\t\t\tcontent,\n\t\t\t})\n\t\t}\n\t}\n\tif (blueprint.bin) {\n\t\tconst paths = blueprint.src.map(\n\t\t\t(environment) => `\\t\\t\\t\\t\\t\\t'@src/${environment}': '../src/${environment}/index.js',`,\n\t\t)\n\t\tconst renderedPaths =\n\t\t\tpaths.length === 0\n\t\t\t\t? '\\t\\t\\t\\t\\tpaths: {},'\n\t\t\t\t: `\\t\\t\\t\\t\\tpaths: {\n${paths.join('\\n')}\n\t\t\t\t\t},`\n\t\tfor (const path of BIN_CONFIGS) {\n\t\t\tartifacts.push({\n\t\t\t\tpath,\n\t\t\t\tgroup: 'configs',\n\t\t\t\townership: 'content',\n\t\t\t\torigin: 'template',\n\t\t\t\tcontent:\n\t\t\t\t\tpath === 'configs/src/tsconfig.bin.json'\n\t\t\t\t\t\t? CONFIG_TEMPLATES.tsconfigs.bin\n\t\t\t\t\t\t: fillTemplate(CONFIG_TEMPLATES.vites.bin, { paths: renderedPaths }),\n\t\t\t})\n\t\t}\n\t}\n\tfor (const environment of blueprint.app) {\n\t\tfor (const path of APP_MATRIX[environment].configs) {\n\t\t\tlet content: string = CONFIG_TEMPLATES.tsconfigs.app.core\n\t\t\tif (path === 'configs/app/vite.browser.config.ts') {\n\t\t\t\tcontent = CONFIG_TEMPLATES.vites.app.browser\n\t\t\t} else if (path === 'configs/app/tsconfig.browser.json') {\n\t\t\t\tconst include = [\n\t\t\t\t\t'../../app/browser/**/*.cts',\n\t\t\t\t\t'../../app/browser/**/*.mts',\n\t\t\t\t\t'../../app/browser/**/*.ts',\n\t\t\t\t\t'../../app/browser/**/*.tsx',\n\t\t\t\t\t'../../app/browser/**/*.vue',\n\t\t\t\t]\n\t\t\t\tif (blueprint.app.includes('core')) {\n\t\t\t\t\tinclude.push(\n\t\t\t\t\t\t'../../app/core/**/*.cts',\n\t\t\t\t\t\t'../../app/core/**/*.mts',\n\t\t\t\t\t\t'../../app/core/**/*.ts',\n\t\t\t\t\t\t'../../app/core/**/*.tsx',\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tinclude.push(\n\t\t\t\t\t'../../tests/app/browser/**/*.cts',\n\t\t\t\t\t'../../tests/app/browser/**/*.mts',\n\t\t\t\t\t'../../tests/app/browser/**/*.ts',\n\t\t\t\t\t'../../tests/app/browser/**/*.tsx',\n\t\t\t\t\t'../../tests/app/browser/**/*.vue',\n\t\t\t\t\t'../../tests/setup.ts',\n\t\t\t\t\t'../../tests/setupBrowser.ts',\n\t\t\t\t)\n\t\t\t\tcontent = fillTemplate(CONFIG_TEMPLATES.tsconfigs.app.browser, {\n\t\t\t\t\tinclude: include\n\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t(entry, index) =>\n\t\t\t\t\t\t\t\t`\\t\\t${JSON.stringify(entry)}${index === include.length - 1 ? '' : ','}`,\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.join('\\n'),\n\t\t\t\t})\n\t\t\t} else if (path === 'configs/app/vite.server.config.ts') {\n\t\t\t\tcontent = CONFIG_TEMPLATES.vites.app.server\n\t\t\t} else if (path === 'configs/app/tsconfig.server.json') {\n\t\t\t\tconst include = [\n\t\t\t\t\t'../../app/server/**/*.cts',\n\t\t\t\t\t'../../app/server/**/*.mts',\n\t\t\t\t\t'../../app/server/**/*.ts',\n\t\t\t\t\t'../../app/server/**/*.tsx',\n\t\t\t\t]\n\t\t\t\tif (blueprint.app.includes('core')) {\n\t\t\t\t\tinclude.push(\n\t\t\t\t\t\t'../../app/core/**/*.cts',\n\t\t\t\t\t\t'../../app/core/**/*.mts',\n\t\t\t\t\t\t'../../app/core/**/*.ts',\n\t\t\t\t\t\t'../../app/core/**/*.tsx',\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tinclude.push(\n\t\t\t\t\t'../../tests/app/server/**/*.cts',\n\t\t\t\t\t'../../tests/app/server/**/*.mts',\n\t\t\t\t\t'../../tests/app/server/**/*.ts',\n\t\t\t\t\t'../../tests/app/server/**/*.tsx',\n\t\t\t\t\t'../../tests/setup.ts',\n\t\t\t\t\t'../../tests/setupServer.ts',\n\t\t\t\t)\n\t\t\t\tcontent = fillTemplate(CONFIG_TEMPLATES.tsconfigs.app.server, {\n\t\t\t\t\tinclude: include\n\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t(entry, index) =>\n\t\t\t\t\t\t\t\t`\\t\\t${JSON.stringify(entry)}${index === include.length - 1 ? '' : ','}`,\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.join('\\n'),\n\t\t\t\t})\n\t\t\t}\n\t\t\tartifacts.push({\n\t\t\t\tpath,\n\t\t\t\tgroup: 'configs',\n\t\t\t\townership: 'content',\n\t\t\t\torigin: 'template',\n\t\t\t\tenvironment,\n\t\t\t\tcontent,\n\t\t\t})\n\t\t}\n\t}\n\tif (blueprint.showcase && blueprint.app.includes('browser')) {\n\t\tartifacts.push({\n\t\t\tpath: SHOWCASE_CONFIG_PATH,\n\t\t\tgroup: 'configs',\n\t\t\townership: 'content',\n\t\t\torigin: 'template',\n\t\t\tenvironment: 'browser',\n\t\t\tcontent: CONFIG_TEMPLATES.vites.app.showcase,\n\t\t})\n\t}\n\treturn artifacts\n}\n\n/**\n * Compile every artifact in the `source` group.\n *\n * @param blueprint - The workspace specification.\n * @returns Empty published barrels, selected application entries, and the optional bin entry.\n *\n * @remarks\n * The barrels and every runtime entry intentionally hold nothing. A generated\n * sample entity is too easy to mistake for package implementation, so the\n * scaffold establishes only the selected environment boundaries. An application\n * entry is empty for the same reason the bin entry is, and because the vendored\n * lint config refuses an unassigned import outside a stylesheet, so the entry\n * cannot start by importing its barrel for effect either.\n *\n * @example\n * ```ts\n * import { blueprintToSourceArtifacts, createBlueprint } from '@orkestrel/scaffold'\n *\n * const blueprint = createBlueprint('router', { src: ['core'] })\n *\n * blueprintToSourceArtifacts(blueprint).every(({ group }) => group === 'source') // true\n * ```\n */\nexport function blueprintToSourceArtifacts(blueprint: Blueprint): readonly ContentArtifact[] {\n\tconst artifacts: ContentArtifact[] = []\n\tfor (const environment of blueprint.src) {\n\t\tartifacts.push({\n\t\t\tpath: `src/${environment}/index.ts`,\n\t\t\tgroup: 'source',\n\t\t\townership: 'birth',\n\t\t\torigin: 'template',\n\t\t\tenvironment,\n\t\t\tcontent: ARTIFACT_TEMPLATES.source.empty,\n\t\t})\n\t}\n\tfor (const environment of blueprint.app) {\n\t\tartifacts.push({\n\t\t\tpath: `app/${environment}/index.ts`,\n\t\t\tgroup: 'source',\n\t\t\townership: 'birth',\n\t\t\torigin: 'template',\n\t\t\tenvironment,\n\t\t\tcontent: ARTIFACT_TEMPLATES.source.empty,\n\t\t})\n\t\tif (environment === 'browser') {\n\t\t\tartifacts.push(\n\t\t\t\t{\n\t\t\t\t\tpath: 'app/browser/main.ts',\n\t\t\t\t\tgroup: 'source',\n\t\t\t\t\townership: 'birth',\n\t\t\t\t\torigin: 'template',\n\t\t\t\t\tenvironment,\n\t\t\t\t\tcontent: ARTIFACT_TEMPLATES.source.empty,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tpath: 'app/browser/index.html',\n\t\t\t\t\tgroup: 'source',\n\t\t\t\t\townership: 'birth',\n\t\t\t\t\torigin: 'template',\n\t\t\t\t\tenvironment,\n\t\t\t\t\tcontent: ARTIFACT_TEMPLATES.source.browser,\n\t\t\t\t},\n\t\t\t)\n\t\t} else if (environment === 'server') {\n\t\t\tartifacts.push({\n\t\t\t\tpath: 'app/server/main.ts',\n\t\t\t\tgroup: 'source',\n\t\t\t\townership: 'birth',\n\t\t\t\torigin: 'template',\n\t\t\t\tenvironment,\n\t\t\t\tcontent: ARTIFACT_TEMPLATES.source.empty,\n\t\t\t})\n\t\t}\n\t}\n\tif (blueprint.bin) {\n\t\tartifacts.push({\n\t\t\tpath: BIN_ENTRY_PATH,\n\t\t\tgroup: 'source',\n\t\t\townership: 'birth',\n\t\t\torigin: 'template',\n\t\t\tcontent: ARTIFACT_TEMPLATES.source.empty,\n\t\t})\n\t}\n\treturn artifacts\n}\n\n/**\n * Compile every artifact in the `tests` group that is not vendored from the host.\n *\n * @param blueprint - The workspace specification.\n * @returns Shared setup modules, axis tests, and the optional integration seed.\n *\n * @remarks\n * `tests/setupPolicy.ts`, `tests/policy.test.ts`, and `tests/config.test.ts` are\n * fleet-invariant host artifacts and therefore do not appear here. A guide\n * proof is not emitted while the workspace intentionally has empty barrels and\n * no package guide. The integration seed follows its structural flag and loads\n * every selected environment through its public barrel.\n *\n * The conformance proof is not emitted either, for the reason the guide proof\n * is not: it names an official artifact only the package knows, so a generated\n * placeholder would read as a proof while measuring nothing. `service` emits its\n * readiness setup alone, because the root configuration names that module by\n * path.\n *\n * @example\n * ```ts\n * import { blueprintToTestArtifacts, createBlueprint } from '@orkestrel/scaffold'\n *\n * const blueprint = createBlueprint('router', { src: ['core'] })\n *\n * blueprintToTestArtifacts(blueprint)[0]?.path // 'tests/setup.ts'\n * ```\n */\nexport function blueprintToTestArtifacts(blueprint: Blueprint): readonly ContentArtifact[] {\n\tconst artifacts: ContentArtifact[] = [\n\t\t{\n\t\t\tpath: 'tests/setup.ts',\n\t\t\tgroup: 'tests',\n\t\t\townership: 'birth',\n\t\t\torigin: 'template',\n\t\t\tcontent: ARTIFACT_TEMPLATES.tests.setup,\n\t\t},\n\t]\n\tif (blueprint.src.includes('browser') || blueprint.app.includes('browser')) {\n\t\tartifacts.push({\n\t\t\tpath: 'tests/setupBrowser.ts',\n\t\t\tgroup: 'tests',\n\t\t\townership: 'birth',\n\t\t\torigin: 'template',\n\t\t\tenvironment: 'browser',\n\t\t\tcontent: ARTIFACT_TEMPLATES.tests.setup,\n\t\t})\n\t}\n\tif (blueprint.src.includes('server') || blueprint.app.includes('server') || blueprint.bin) {\n\t\tartifacts.push({\n\t\t\tpath: 'tests/setupServer.ts',\n\t\t\tgroup: 'tests',\n\t\t\townership: 'birth',\n\t\t\torigin: 'template',\n\t\t\tenvironment: 'server',\n\t\t\tcontent: ARTIFACT_TEMPLATES.tests.setup,\n\t\t})\n\t}\n\t// The live-service project names this module in `setupFiles`, so a registered\n\t// project whose setup module is absent fails to load at all. The suite beneath\n\t// `tests/service` is not emitted beside it: what a live proof drives is the\n\t// package's own service, which this package cannot write for it.\n\tif (blueprint.service) {\n\t\tartifacts.push({\n\t\t\tpath: SERVICE_SETUP_PATH,\n\t\t\tgroup: 'tests',\n\t\t\townership: 'birth',\n\t\t\torigin: 'template',\n\t\t\tcontent: ARTIFACT_TEMPLATES.tests.setup,\n\t\t})\n\t}\n\tif (blueprint.global) {\n\t\tartifacts.push({\n\t\t\tpath: GLOBAL_SETUP_PATH,\n\t\t\tgroup: 'tests',\n\t\t\townership: 'birth',\n\t\t\torigin: 'template',\n\t\t\tcontent: ARTIFACT_TEMPLATES.tests.global,\n\t\t})\n\t}\n\tfor (const environment of blueprint.src) {\n\t\tartifacts.push({\n\t\t\tpath: `tests/src/${environment}/index.test.ts`,\n\t\t\tgroup: 'tests',\n\t\t\townership: 'birth',\n\t\t\torigin: 'template',\n\t\t\tenvironment,\n\t\t\tcontent: fillTemplate(ARTIFACT_TEMPLATES.tests.entry, {\n\t\t\t\tspecifier: serializeTypeScriptString(`@src/${environment}`),\n\t\t\t\tlabel: serializeTypeScriptString(`src ${environment} entry`),\n\t\t\t}),\n\t\t})\n\t}\n\tif (blueprint.bin) {\n\t\tconst specifier = serializeTypeScriptString('../../../src/bin/main.js')\n\t\tconst joined = `\\t\\tconst entry = await import(${specifier})`\n\t\tconst statement = matchesPrintWidth(joined)\n\t\t\t? joined\n\t\t\t: `\\t\\tconst entry =\\n\\t\\t\\tawait import(${specifier})`\n\t\tartifacts.push({\n\t\t\tpath: 'tests/src/bin/main.test.ts',\n\t\t\tgroup: 'tests',\n\t\t\townership: 'birth',\n\t\t\torigin: 'template',\n\t\t\tcontent: fillTemplate(ARTIFACT_TEMPLATES.tests.bin, { import: statement }),\n\t\t})\n\t}\n\tfor (const environment of blueprint.app) {\n\t\tartifacts.push({\n\t\t\tpath: `tests/app/${environment}/index.test.ts`,\n\t\t\tgroup: 'tests',\n\t\t\townership: 'birth',\n\t\t\torigin: 'template',\n\t\t\tenvironment,\n\t\t\tcontent: fillTemplate(ARTIFACT_TEMPLATES.tests.entry, {\n\t\t\t\tspecifier: serializeTypeScriptString(`@app/${environment}`),\n\t\t\t\tlabel: serializeTypeScriptString(`app ${environment} entry`),\n\t\t\t}),\n\t\t})\n\t}\n\tif (blueprint.integration) {\n\t\tconst imports: string[] = []\n\t\tconst entries: string[] = []\n\t\tfor (const environment of blueprint.src) {\n\t\t\tconst entry =\n\t\t\t\tenvironment === 'core' ? 'srcCore' : environment === 'browser' ? 'srcBrowser' : 'srcServer'\n\t\t\timports.push(`import * as ${entry} from '@src/${environment}'`)\n\t\t\tentries.push(entry)\n\t\t}\n\t\tfor (const environment of blueprint.app) {\n\t\t\tconst entry =\n\t\t\t\tenvironment === 'core' ? 'appCore' : environment === 'browser' ? 'appBrowser' : 'appServer'\n\t\t\timports.push(`import * as ${entry} from '@app/${environment}'`)\n\t\t\tentries.push(entry)\n\t\t}\n\t\tconst joined = `expect([${entries.map((entry) => `Object.keys(${entry})`).join(', ')}]).toStrictEqual(`\n\t\tconst actual = matchesPrintWidth(`\\t\\t${joined}[`)\n\t\t\t? joined\n\t\t\t: `expect([\\n${entries.map((entry) => `\\t\\t\\tObject.keys(${entry}),`).join('\\n')}\\n\\t\\t]).toStrictEqual(`\n\t\tconst expectedInline = `[${entries.map(() => '[]').join(', ')}]`\n\t\tconst expected =\n\t\t\tactual !== joined || matchesPrintWidth(`\\t\\t${joined}${expectedInline})`)\n\t\t\t\t? expectedInline\n\t\t\t\t: `[\\n${entries.map(() => '\\t\\t\\t[],').join('\\n')}\\n\\t\\t]`\n\t\tartifacts.push({\n\t\t\tpath: INTEGRATION_TEST_PATH,\n\t\t\tgroup: 'tests',\n\t\t\townership: 'birth',\n\t\t\torigin: 'template',\n\t\t\tcontent: fillTemplate(ARTIFACT_TEMPLATES.tests.integration, {\n\t\t\t\timports: `${imports.join('\\n')}\\n`,\n\t\t\t\tactual,\n\t\t\t\texpected,\n\t\t\t}),\n\t\t})\n\t}\n\treturn artifacts\n}\n\n/**\n * Compile the generated workspace's guide index.\n *\n * @param blueprint - The workspace specification.\n * @returns One birth-owned guide index carrying the concept and directory views.\n */\nexport function blueprintToGuideArtifacts(blueprint: Blueprint): readonly ContentArtifact[] {\n\tconst source: string[] = []\n\tconst tests: string[] = []\n\tconst directories: string[] = []\n\tconst guide = `guides/${blueprint.name}.md`\n\tfor (const environment of blueprint.src) {\n\t\tsource.push(` - [\\`src/${environment}\\`](../src/${environment})`)\n\t\ttests.push(` - [\\`tests/src/${environment}\\`](../tests/src/${environment})`)\n\t\tdirectories.push(\n\t\t\t`- [\\`src/${environment}\\`](../src/${environment})\\n - Guide: Not created. Create this file when the workspace has a public surface:\\n \\`${guide}\\`\\n - Tests: [\\`tests/src/${environment}\\`](../tests/src/${environment})`,\n\t\t)\n\t}\n\tif (blueprint.bin) {\n\t\tsource.push(' - [`src/bin`](../src/bin)')\n\t\ttests.push(' - [`tests/src/bin`](../tests/src/bin)')\n\t\tdirectories.push(\n\t\t\t`- [\\`src/bin\\`](../src/bin)\\n - Guide: Not created. Create this file when the workspace has a public surface:\\n \\`${guide}\\`\\n - Tests: [\\`tests/src/bin\\`](../tests/src/bin)`,\n\t\t)\n\t}\n\tfor (const environment of blueprint.app) {\n\t\tsource.push(` - [\\`app/${environment}\\`](../app/${environment})`)\n\t\ttests.push(` - [\\`tests/app/${environment}\\`](../tests/app/${environment})`)\n\t\tdirectories.push(\n\t\t\t`- [\\`app/${environment}\\`](../app/${environment})\\n - Guide: Not created. Create this file when the workspace has a public surface:\\n \\`${guide}\\`\\n - Tests: [\\`tests/app/${environment}\\`](../tests/app/${environment})`,\n\t\t)\n\t}\n\treturn [\n\t\t{\n\t\t\tpath: 'guides/README.md',\n\t\t\tgroup: 'guides',\n\t\t\townership: 'birth',\n\t\t\torigin: 'template',\n\t\t\tcontent: fillTemplate(ARTIFACT_TEMPLATES.guides.readme, {\n\t\t\t\tsource: source.join('\\n'),\n\t\t\t\ttests: tests.join('\\n'),\n\t\t\t\tdirectories: directories.join('\\n'),\n\t\t\t\tguide: blueprint.name,\n\t\t\t}),\n\t\t},\n\t]\n}\n\n/**\n * Compile the generated workspace's root documentation.\n *\n * @param blueprint - The workspace specification.\n * @returns One birth-owned package front page.\n */\nexport function blueprintToDocumentArtifacts(blueprint: Blueprint): readonly ContentArtifact[] {\n\tconst publishes = blueprint.src.length > 0\n\tconst name = publishes ? `@orkestrel/${blueprint.name}` : blueprint.name\n\tconst description =\n\t\tblueprint.description ?? (publishes ? `The ${name} package.` : `The ${name} application.`)\n\treturn [\n\t\t{\n\t\t\tpath: 'README.md',\n\t\t\tgroup: 'docs',\n\t\t\townership: 'birth',\n\t\t\torigin: 'template',\n\t\t\tcontent: fillTemplate(ARTIFACT_TEMPLATES.docs.readme, {\n\t\t\t\tpackage: name,\n\t\t\t\tdescription,\n\t\t\t}),\n\t\t},\n\t]\n}\n\n/**\n * Compile the blueprint-dependent orchestration artifacts.\n *\n * @param blueprint - The workspace specification.\n * @returns A vendor inventory script when vendors are declared, otherwise none.\n *\n * @remarks\n * A vendor name does not describe startup, readiness, or cleanup. The script\n * therefore records only the declared inventory and does not invent a service\n * runner or test project.\n */\nexport function blueprintToOrchestrationArtifacts(\n\tblueprint: Blueprint,\n): readonly ContentArtifact[] {\n\tif (blueprint.vendors.length === 0) return []\n\tconst vendors = blueprint.vendors\n\t\t.map((vendor, index) => `\\t'${vendor}'${index === blueprint.vendors.length - 1 ? '' : ' \\\\'}`)\n\t\t.join('\\n')\n\treturn [\n\t\t{\n\t\t\tpath: SERVICE_SCRIPT_PATH,\n\t\t\tgroup: 'orchestration',\n\t\t\townership: 'birth',\n\t\t\torigin: 'template',\n\t\t\tcontent: fillTemplate(ARTIFACT_TEMPLATES.orchestration.service, { vendors }),\n\t\t},\n\t]\n}\n\n/**\n * Compile the vendored host artifacts a named workspace plans.\n *\n * @param name - The target workspace's own bare package name.\n * @returns One artifact per vendored path, in `HOST_PATHS` order.\n *\n * @remarks\n * Every artifact is claimed by presence, which is the strongest claim a pure\n * compile can make: core cannot read the vendored data root, so it cannot carry\n * the bytes a content claim would have to be checked against. Reading that root\n * is what promotes the ones scaffold owns the bytes of.\n *\n * `source` is left absent because it falls back to `path`, and every vendored\n * path is stored under the name it is written to. The group comes from\n * {@link inferGroup}, so a vendored path and a foreign path found in a target\n * are classified by one rule and a plan never disagrees with the audit beside\n * it.\n *\n * @example\n * ```ts\n * import { nameToHostArtifacts } from '@orkestrel/scaffold'\n *\n * nameToHostArtifacts('router').some((artifact) => artifact.path === 'AGENTS.md') // true\n * nameToHostArtifacts('router').some((artifact) => artifact.path === 'guides/router.md') // false\n * ```\n */\nexport function nameToHostArtifacts(name: string): readonly Artifact[] {\n\treturn selectHostPaths(HOST_PATHS, name).map((path): Artifact => ({\n\t\tpath,\n\t\tgroup: inferGroup(path),\n\t\townership: 'presence',\n\t\torigin: 'host',\n\t}))\n}\n\n/**\n * Replace the content of every drafted artifact an override names.\n *\n * @param artifacts - The drafted artifacts.\n * @param overrides - The blueprint's overrides.\n * @returns The artifacts with each matching override applied, in input order.\n *\n * @remarks\n * An override replaces an artifact's whole content and never merges into it.\n * A host-origin artifact carries no content to replace, so it passes through\n * untouched; which overrides are legal at all is\n * {@link overridesToQuestions}'s answer, so an illegal one is reported rather\n * than silently dropped here.\n *\n * @example\n * ```ts\n * import { applyOverrides, blueprintToConfigArtifacts, createBlueprint } from '@orkestrel/scaffold'\n *\n * const artifacts = blueprintToConfigArtifacts(createBlueprint('router', { src: ['core'] }))\n *\n * applyOverrides(artifacts, [{ path: 'README.md', content: '# Title\\n' }])\n * ```\n */\nexport function applyOverrides(\n\tartifacts: readonly Artifact[],\n\toverrides: readonly Override[],\n): readonly Artifact[] {\n\tif (overrides.length === 0) return artifacts\n\tconst replacements = 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 = replacements.get(artifact.path)\n\t\treturn content === undefined ? artifact : { ...artifact, content }\n\t})\n}\n\n/**\n * Compute a plan's content identity.\n *\n * @param plan - The plan to identify.\n * @returns Sixteen lowercase hexadecimal digits, or `undefined` when the plan\n * carries a value JSON cannot encode.\n *\n * @remarks\n * The identity covers the blueprint the plan was compiled from, the groups it\n * covers, and its ordered artifacts. It deliberately excludes `hash` itself,\n * which is what lets a pinned plan be re-identified and compared without\n * stripping a field first.\n *\n * The projection is canonical, so two plans that differ only in key order\n * answer the same digits. Nothing here reads a clock or randomness, and the\n * refusal is total: a value that cannot be read answers `undefined` rather than\n * escaping as a thrown error, and a caller decides what an unidentifiable plan\n * means.\n *\n * @example\n * ```ts\n * import { createBlueprint, createCompiler, planToHash } from '@orkestrel/scaffold'\n *\n * const { plan } = createCompiler().compile(createBlueprint('router', { src: ['core'] }))\n *\n * plan === undefined ? undefined : planToHash(plan)?.length // 16\n * ```\n */\nexport function planToHash(plan: Plan): string | undefined {\n\tconst outcome = attempt(() =>\n\t\tcanonicalStringify({\n\t\t\tblueprint: plan.blueprint,\n\t\t\tgroups: plan.groups,\n\t\t\tartifacts: plan.artifacts,\n\t\t}),\n\t)\n\tif (!outcome.success || outcome.value === undefined) return undefined\n\treturn computeHash(outcome.value)\n}\n\n/**\n * Project one planned artifact and the bytes found at its path into a verdict.\n *\n * @param artifact - The planned artifact.\n * @param observed - The destination's exact bytes as hexadecimal; absent when\n * the destination holds no file.\n * @returns The finding, carrying the artifact's ownership and `observed`\n * exactly where bytes were read.\n *\n * @remarks\n * The comparison itself is {@link inferDrift}'s, so ownership decides it here\n * exactly as it does everywhere else. This adds only the shape: a missing\n * destination has no bytes to record, and every other verdict records the bytes\n * it was given, which is the precondition the mutation that follows is held to.\n * Ownership is copied rather than inferred from drift because aligned findings\n * span all three ownership tiers.\n *\n * `foreign` is not answerable here, because it describes a path no artifact was\n * planned for.\n *\n * @example\n * ```ts\n * import { artifactToFinding } from '@orkestrel/scaffold'\n *\n * artifactToFinding(\n * \t{ path: 'README.md', group: 'docs', ownership: 'content', origin: 'computed', content: 'hi\\n' },\n * \t'6279650a',\n * ) // { path: 'README.md', group: 'docs', ownership: 'content', drift: 'stale', observed: '6279650a' }\n * ```\n */\nexport function artifactToFinding(artifact: Artifact, observed?: string): Finding {\n\tconst path = artifact.path\n\tconst group = artifact.group\n\tconst ownership = artifact.ownership\n\tif (observed === undefined) {\n\t\treturn inferDrift(artifact) === 'aligned'\n\t\t\t? { path, group, ownership, drift: 'aligned' }\n\t\t\t: { path, group, ownership, drift: 'missing' }\n\t}\n\treturn inferDrift(artifact, observed) === 'stale'\n\t\t? { path, group, ownership, drift: 'stale', observed }\n\t\t: { path, group, ownership, drift: 'aligned', observed }\n}\n\n/**\n * Compare a plan against a target's current content.\n *\n * @param plan - The compiled plan.\n * @param current - The target's exact bytes, keyed by artifact-relative path.\n * @returns One finding per planned artifact in plan order, then one `foreign`\n * finding per unplanned path in snapshot order.\n *\n * @remarks\n * The sweep is bounded by the plan's own selection: a path the plan does not own\n * is reported as foreign only when its group is one the plan covers, so a\n * compile narrowed to a few groups never reports the rest of the workspace as\n * unowned. Within a covered group the report is deliberately wide, because\n * `foreign` is the set the destructive verb draws from and the narrowing that\n * set needs — the paths no verb may remove, and what git tracks — belongs to\n * that verb rather than to the comparison.\n *\n * @example\n * ```ts\n * import { createBlueprint, createCompiler, planToFindings } from '@orkestrel/scaffold'\n *\n * const { plan } = createCompiler().compile(createBlueprint('router', { src: ['core'] }))\n *\n * plan === undefined ? [] : planToFindings(plan, { 'AGENTS.md': '68690a' })\n * ```\n */\nexport function planToFindings(plan: Plan, current: Snapshot): readonly Finding[] {\n\tconst findings: Finding[] = []\n\tconst planned = new Set<string>()\n\tfor (const artifact of plan.artifacts) {\n\t\tplanned.add(artifact.path)\n\t\tfindings.push(artifactToFinding(artifact, current[artifact.path]))\n\t}\n\tfor (const [path, observed] of Object.entries(current)) {\n\t\tif (planned.has(path)) continue\n\t\tconst group = inferGroup(path)\n\t\tif (!plan.groups.includes(group)) continue\n\t\tfindings.push({ path, group, drift: 'foreign', observed })\n\t}\n\treturn findings\n}\n\n/**\n * Measure one declared package list against the name and range syntax it accepts.\n *\n * @param dependencies - The declared list.\n * @param field - The blueprint field the list came from, reported on each question.\n * @param name - The package-name syntax the field accepts.\n * @param range - The range syntax the field accepts.\n * @returns One blocking question per rejected name, repeated name, and rejected\n * range, in list order.\n *\n * @remarks\n * The three declared lists differ only in the two syntaxes they accept, so the\n * rules live here once and each caller supplies its own patterns. A runtime\n * dependency name reaches a path through its guide mirror and is fixed to the\n * `@orkestrel` scope; a development extra never reaches a path and admits any\n * valid npm name.\n *\n * Both patterns must be stateless. A global or sticky pattern carries a\n * `lastIndex` between calls, so it would answer differently for the same input\n * depending on what was tested before it.\n *\n * @example\n * ```ts\n * import { DEPENDENCY_NAME_PATTERN, ORKESTREL_RANGE_PATTERN } from '@orkestrel/scaffold'\n * import { dependenciesToQuestions } from '@orkestrel/scaffold'\n *\n * dependenciesToQuestions(\n * \t[{ name: '@orkestrel/router', range: '0.0.8' }],\n * \t'dependencies',\n * \tDEPENDENCY_NAME_PATTERN,\n * \tORKESTREL_RANGE_PATTERN,\n * ).length // 1 — the range is not caret-pinned\n * ```\n */\nexport function dependenciesToQuestions(\n\tdependencies: readonly Dependency[],\n\tfield: string,\n\tname: RegExp,\n\trange: RegExp,\n): readonly Question[] {\n\tconst questions: Question[] = []\n\tconst seen = new Set<string>()\n\tfor (const dependency of dependencies) {\n\t\tif (!name.test(dependency.name)) {\n\t\t\tquestions.push({\n\t\t\t\tfield,\n\t\t\t\tmessage: `${dependency.name} is not a package name ${field} accepts.`,\n\t\t\t\tblocking: true,\n\t\t\t})\n\t\t} else if (seen.has(dependency.name)) {\n\t\t\tquestions.push({\n\t\t\t\tfield,\n\t\t\t\tmessage: `${dependency.name} is declared more than once on ${field}.`,\n\t\t\t\tblocking: true,\n\t\t\t})\n\t\t}\n\t\tseen.add(dependency.name)\n\t\tif (!range.test(dependency.range)) {\n\t\t\tquestions.push({\n\t\t\t\tfield,\n\t\t\t\tmessage: `${dependency.name} declares the range ${dependency.range}, which ${field} does not accept.`,\n\t\t\t\tblocking: true,\n\t\t\t})\n\t\t}\n\t}\n\treturn questions\n}\n\n/**\n * Measure a blueprint against every law its own fields decide.\n *\n * @param blueprint - The workspace specification.\n * @returns One question per rejected field, in blueprint field order, with the\n * rules that span several fields last.\n *\n * @remarks\n * Only the laws a blueprint answers alone are here. The structural record and\n * its bounds are already settled by `isBlueprint`, which refuses a value that is\n * not a blueprint at all; what remains is the syntax of a name, a version, a\n * range, and an engines floor, the combinations the two environment axes admit,\n * and the overlaps between the three declared package lists. The laws that need\n * a drafted plan belong to {@link artifactsToQuestions} and\n * {@link overridesToQuestions}.\n *\n * A question blocks when it describes a workspace this package cannot generate.\n * Three do not, because each describes a workspace it can describe honestly and\n * should not create: a published axis of several environments without core,\n * whose manifest names a core build the workspace never runs; a showcase flag\n * whose required browser axis is absent, which emits nothing; and an\n * integration flag over fewer than two environments, whose seed does emit and\n * has nothing to compose across. Blocking any of them closed the gate for every\n * verb. The verbs that read an existing workspace need the plan the gate\n * refused. The caller that chooses the shape refuses the advisory; the callers\n * that read one report it.\n *\n * The integration advisory counts both axes together, because the proof it\n * seeds spans environments rather than published ones: an application of two\n * environments composes, and a package publishing one does not. Reading either\n * axis alone withdrew the proof from a workspace that does compose.\n *\n * An environment question carries `ENVIRONMENTS` as its candidates, so a caller\n * reads the accepted values from the question instead of from the documentation.\n *\n * @example\n * ```ts\n * import { blueprintToQuestions, createBlueprint } from '@orkestrel/scaffold'\n *\n * const blueprint = createBlueprint('router', { src: ['core'] })\n *\n * blueprintToQuestions(blueprint).length === 0 // true\n * ```\n */\nexport function blueprintToQuestions(blueprint: Blueprint): readonly Question[] {\n\tconst questions: Question[] = []\n\tif (!NAME_PATTERN.test(blueprint.name)) {\n\t\tquestions.push({\n\t\t\tfield: 'name',\n\t\t\tmessage: `${blueprint.name} is not a lowercase alphanumeric name starting with a letter.`,\n\t\t\tblocking: true,\n\t\t})\n\t}\n\tif (!VERSION_PATTERN.test(blueprint.version)) {\n\t\tquestions.push({\n\t\t\tfield: 'version',\n\t\t\tmessage: `${blueprint.version} is not an exact three-component version.`,\n\t\t\tblocking: true,\n\t\t})\n\t}\n\tif (!matchesEngines(blueprint.engines)) {\n\t\tquestions.push({\n\t\t\tfield: 'engines',\n\t\t\tmessage: `${blueprint.engines} is not a supported minimum-Node floor.`,\n\t\t\tblocking: true,\n\t\t})\n\t}\n\tif (blueprint.src.length === 0 && blueprint.app.length === 0) {\n\t\tquestions.push({\n\t\t\tfield: 'src',\n\t\t\tmessage: 'A workspace declares at least one environment on src or app.',\n\t\t\tblocking: true,\n\t\t\tcandidates: ENVIRONMENTS,\n\t\t})\n\t}\n\tif (blueprint.src.length > 1 && !blueprint.src.includes('core')) {\n\t\tquestions.push({\n\t\t\tfield: 'src',\n\t\t\tmessage:\n\t\t\t\t'Several published environments put core at the package root, so this manifest names a core build the workspace never runs. Declare core on src, or publish one environment.',\n\t\t\tblocking: false,\n\t\t\tcandidates: ENVIRONMENTS,\n\t\t})\n\t}\n\tfor (const environment of ENVIRONMENTS) {\n\t\tif (blueprint.src.filter((declared) => declared === environment).length > 1) {\n\t\t\tquestions.push({\n\t\t\t\tfield: 'src',\n\t\t\t\tmessage: `src declares ${environment} more than once.`,\n\t\t\t\tblocking: true,\n\t\t\t\tcandidates: ENVIRONMENTS,\n\t\t\t})\n\t\t}\n\t\tif (blueprint.app.filter((declared) => declared === environment).length > 1) {\n\t\t\tquestions.push({\n\t\t\t\tfield: 'app',\n\t\t\t\tmessage: `app declares ${environment} more than once.`,\n\t\t\t\tblocking: true,\n\t\t\t\tcandidates: ENVIRONMENTS,\n\t\t\t})\n\t\t}\n\t}\n\tif (blueprint.integration && blueprint.src.length + blueprint.app.length < 2) {\n\t\tquestions.push({\n\t\t\tfield: 'integration',\n\t\t\tmessage:\n\t\t\t\t'integration drives features across environments, and this workspace declares fewer than two, so its seed composes nothing.',\n\t\t\tblocking: false,\n\t\t})\n\t}\n\tconst vendors = new Set<string>()\n\tfor (const vendor of blueprint.vendors) {\n\t\tif (!NAME_PATTERN.test(vendor)) {\n\t\t\tquestions.push({\n\t\t\t\tfield: 'vendors',\n\t\t\t\tmessage: `${vendor} is not a lowercase alphanumeric vendor name starting with a letter.`,\n\t\t\t\tblocking: true,\n\t\t\t})\n\t\t} else if (vendors.has(vendor)) {\n\t\t\tquestions.push({\n\t\t\t\tfield: 'vendors',\n\t\t\t\tmessage: `${vendor} is declared more than once on vendors.`,\n\t\t\t\tblocking: true,\n\t\t\t})\n\t\t}\n\t\tvendors.add(vendor)\n\t}\n\tif (blueprint.distribution && blueprint.src.length === 0) {\n\t\tquestions.push({\n\t\t\tfield: 'distribution',\n\t\t\tmessage:\n\t\t\t\t'distribution packs the published source, and this workspace declares none, so it emits nothing.',\n\t\t\tblocking: false,\n\t\t})\n\t}\n\tif (blueprint.showcase && !blueprint.app.includes('browser')) {\n\t\tquestions.push({\n\t\t\tfield: 'showcase',\n\t\t\tmessage:\n\t\t\t\t'showcase projects a browser app, and this workspace declares none, so it emits nothing.',\n\t\t\tblocking: false,\n\t\t})\n\t}\n\tquestions.push(\n\t\t...dependenciesToQuestions(\n\t\t\tblueprint.dependencies,\n\t\t\t'dependencies',\n\t\t\tDEPENDENCY_NAME_PATTERN,\n\t\t\tORKESTREL_RANGE_PATTERN,\n\t\t),\n\t\t...dependenciesToQuestions(\n\t\t\tblueprint.peers,\n\t\t\t'peers',\n\t\t\tDEPENDENCY_NAME_PATTERN,\n\t\t\tORKESTREL_RANGE_PATTERN,\n\t\t),\n\t\t...dependenciesToQuestions(blueprint.extras, 'extras', EXTRA_NAME_PATTERN, EXTRA_RANGE_PATTERN),\n\t)\n\tconst lists: ReadonlyArray<readonly [field: string, list: readonly Dependency[]]> = [\n\t\t['dependencies', blueprint.dependencies],\n\t\t['peers', blueprint.peers],\n\t\t['extras', blueprint.extras],\n\t]\n\tconst declared = new Map<string, string>()\n\tconst own = `@orkestrel/${blueprint.name}`\n\tfor (const [field, list] of lists) {\n\t\tfor (const dependency of list) {\n\t\t\tif (dependency.name === own || dependency.name === blueprint.name) {\n\t\t\t\tquestions.push({\n\t\t\t\t\tfield,\n\t\t\t\t\tmessage: `${dependency.name} is the workspace itself.`,\n\t\t\t\t\tblocking: true,\n\t\t\t\t})\n\t\t\t}\n\t\t\tconst first = declared.get(dependency.name)\n\t\t\tif (first === undefined) declared.set(dependency.name, field)\n\t\t\telse if (first !== field) {\n\t\t\t\tquestions.push({\n\t\t\t\t\tfield,\n\t\t\t\t\tmessage: `${dependency.name} is declared on both ${first} and ${field}.`,\n\t\t\t\t\tblocking: true,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\tfor (const extra of blueprint.extras) {\n\t\tif (Object.hasOwn(BASE_DEV_DEPENDENCIES, extra.name)) {\n\t\t\tquestions.push({\n\t\t\t\tfield: 'extras',\n\t\t\t\tmessage: `${extra.name} is pinned by the shared toolchain, which every workspace carries at one version.`,\n\t\t\t\tblocking: true,\n\t\t\t})\n\t\t}\n\t}\n\treturn questions\n}\n\n/**\n * Measure a drafted artifact list against the laws a whole plan decides.\n *\n * @param artifacts - The drafted artifacts.\n * @returns One blocking question per colliding path and per exceeded ceiling.\n *\n * @remarks\n * Two artifacts claiming one path is a compilation defect rather than a caller's\n * mistake: whichever is written last silently wins, so the plan is refused\n * instead. The ceilings are the ones the plan has to survive being read back\n * through — one artifact's bytes, the count of artifacts one collection admits,\n * and the bytes retained across a whole plan — so a plan that would fail its own\n * guard is refused while the failure can still name the artifact that caused it.\n *\n * A host artifact planned before its bytes are read contributes nothing to the\n * budget, because it claims no bytes to retain.\n *\n * @example\n * ```ts\n * import { artifactsToQuestions, blueprintToConfigArtifacts, createBlueprint } from '@orkestrel/scaffold'\n *\n * const artifacts = blueprintToConfigArtifacts(createBlueprint('router', { src: ['core'] }))\n *\n * artifactsToQuestions(artifacts).length === 0 // true\n * ```\n */\nexport function artifactsToQuestions(artifacts: readonly Artifact[]): readonly Question[] {\n\tconst questions: Question[] = []\n\tconst claimed = new Set<string>()\n\tlet total = 0\n\tfor (const artifact of artifacts) {\n\t\tif (claimed.has(artifact.path)) {\n\t\t\tquestions.push({\n\t\t\t\tfield: 'artifacts',\n\t\t\t\tmessage: `Two artifacts claim ${artifact.path}.`,\n\t\t\t\tblocking: true,\n\t\t\t})\n\t\t}\n\t\tclaimed.add(artifact.path)\n\t\tconst bytes =\n\t\t\tartifact.origin === 'host'\n\t\t\t\t? artifact.hex === undefined\n\t\t\t\t\t? 0\n\t\t\t\t\t: artifact.hex.length / 2\n\t\t\t\t: computeBytes(artifact.content)\n\t\tif (bytes > MAX_ARTIFACT_BYTES) {\n\t\t\tquestions.push({\n\t\t\t\tfield: 'artifacts',\n\t\t\t\tmessage: `${artifact.path} carries ${bytes} bytes, above the ${MAX_ARTIFACT_BYTES} one artifact admits.`,\n\t\t\t\tblocking: true,\n\t\t\t})\n\t\t}\n\t\ttotal += bytes\n\t}\n\tif (artifacts.length > MAX_COLLECTION_ITEMS) {\n\t\tquestions.push({\n\t\t\tfield: 'artifacts',\n\t\t\tmessage: `A plan of ${artifacts.length} artifacts is above the ${MAX_COLLECTION_ITEMS} one collection admits.`,\n\t\t\tblocking: true,\n\t\t})\n\t}\n\tif (total > MAX_TOTAL_ARTIFACT_BYTES) {\n\t\tquestions.push({\n\t\t\tfield: 'artifacts',\n\t\t\tmessage: `A plan of ${total} bytes is above the ${MAX_TOTAL_ARTIFACT_BYTES} one plan retains.`,\n\t\t\tblocking: true,\n\t\t})\n\t}\n\treturn questions\n}\n\n/**\n * Measure a blueprint's overrides against the artifacts drafted for it.\n *\n * @param overrides - The blueprint's overrides.\n * @param artifacts - The drafted artifacts, before overrides are applied.\n * @returns One blocking question per override the draft cannot accept.\n *\n * @remarks\n * An override that matches no planned artifact is a caller expecting a file that\n * does not exist, and applying nothing would leave that expectation\n * unanswered. An override on a host-origin artifact asks this package to\n * rewrite a file it byte-copies from the vendored data root, which it never\n * does. An override on the manifest asks it to rewrite the one artifact the\n * blueprint's own fields decide, so the fields would no longer describe the\n * workspace they generated. Each is refused rather than dropped.\n *\n * @example\n * ```ts\n * import { blueprintToConfigArtifacts, createBlueprint, overridesToQuestions } from '@orkestrel/scaffold'\n *\n * const artifacts = blueprintToConfigArtifacts(createBlueprint('router', { src: ['core'] }))\n *\n * overridesToQuestions([{ path: 'package.json', content: '{}\\n' }], artifacts).length // 1\n * ```\n */\nexport function overridesToQuestions(\n\toverrides: readonly Override[],\n\tartifacts: readonly Artifact[],\n): readonly Question[] {\n\tconst questions: Question[] = []\n\tconst planned = new Map<string, Artifact>()\n\tfor (const artifact of artifacts) {\n\t\tif (!planned.has(artifact.path)) planned.set(artifact.path, artifact)\n\t}\n\tconst seen = new Set<string>()\n\tfor (const override of overrides) {\n\t\tif (seen.has(override.path)) {\n\t\t\tquestions.push({\n\t\t\t\tfield: 'overrides',\n\t\t\t\tmessage: `${override.path} is overridden more than once.`,\n\t\t\t\tblocking: true,\n\t\t\t})\n\t\t}\n\t\tseen.add(override.path)\n\t\tconst artifact = planned.get(override.path)\n\t\tif (artifact === undefined) {\n\t\t\tquestions.push({\n\t\t\t\tfield: 'overrides',\n\t\t\t\tmessage: `${override.path} is not a path this plan carries.`,\n\t\t\t\tblocking: true,\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\t\tif (artifact.origin === 'host') {\n\t\t\tquestions.push({\n\t\t\t\tfield: 'overrides',\n\t\t\t\tmessage: `${override.path} is byte-copied from the vendored data root.`,\n\t\t\t\tblocking: true,\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\t\tif (artifact.group === 'manifest') {\n\t\t\tquestions.push({\n\t\t\t\tfield: 'overrides',\n\t\t\t\tmessage: `${override.path} is the manifest, which the blueprint's own fields decide.`,\n\t\t\t\tblocking: true,\n\t\t\t})\n\t\t}\n\t}\n\treturn questions\n}\n","import type { Parser } from '@orkestrel/contract'\nimport type { EmitterInterface } from '@orkestrel/emitter'\nimport type {\n\tArtifact,\n\tAudit,\n\tBlueprint,\n\tCompileRecord,\n\tCompilerEventMap,\n\tCompilerInterface,\n\tCompilerOptions,\n\tGroup,\n\tPlan,\n\tQuestion,\n\tScaffoldErrorCode,\n\tScaffolding,\n\tSnapshot,\n} from './types.js'\nimport { Emitter } from '@orkestrel/emitter'\nimport { cloneValue } from './cloners.js'\nimport {\n\tapplyOverrides,\n\tartifactsToQuestions,\n\tblueprintToConfigArtifacts,\n\tblueprintToDocumentArtifacts,\n\tblueprintToGuideArtifacts,\n\tblueprintToManifest,\n\tblueprintToOrchestrationArtifacts,\n\tblueprintToQuestions,\n\tblueprintToSourceArtifacts,\n\tblueprintToTestArtifacts,\n\tnameToHostArtifacts,\n\toverridesToQuestions,\n\tplanToFindings,\n\tplanToHash,\n} from './compilers.js'\nimport { GROUPS } from './constants.js'\nimport { ScaffoldError } from './errors.js'\nimport { selectGroups } from './helpers.js'\nimport { parseBlueprint, parseCompilerOptions, parseGroups, parseSnapshot } from './parsers.js'\n\n/**\n * The compile spine: draft, gate, pin, run in that order over a blueprint.\n *\n * @remarks\n * The draft stage assembles the artifacts the selected groups cover. The gate\n * stage measures the blueprint, its overrides, and the drafted artifacts, and\n * refuses on a blocking question. The pin stage gives the plan its content\n * identity. Every stage records its input and its output, and a failed stage\n * records the coded reason beside them; the stages after a failed one never run,\n * so the records stop where the compile stopped.\n *\n * The compile fails closed on one rule: a scaffolding carries a plan exactly\n * when no question blocks. A refused blueprint is answered rather than raised,\n * so a caller reads the refusal from the value it asked for.\n *\n * Both entry points snapshot each caller-supplied value and then guard the\n * snapshot, which is the order `cloneValue` fixes. A value that is not the exact\n * shape is off-contract input rather than an answerable question, so it raises\n * `INVALID`. Structure raises; the laws a well-formed blueprint can still break\n * are the gate's, and they answer with questions.\n *\n * Two consequences of that order are worth stating, because they are the ones a\n * JavaScript caller meets first. A property backed by an accessor is refused\n * rather than read, which is what closes the race a guard cannot close from\n * inside; the accessor never runs. And an optional field present with the value\n * `undefined` is not the exact shape either, which is the same law\n * `exactOptionalPropertyTypes` already states at compile time.\n *\n * Every error this compiler raises is emitted on `error` immediately before it\n * is thrown, so an observer sees a refusal even where the caller catches it.\n *\n * @example\n * ```ts\n * import { createBlueprint, Compiler } from '@orkestrel/scaffold'\n *\n * const compiler = new Compiler()\n * const scaffolding = compiler.compile(createBlueprint('router', { src: ['core'] }))\n * scaffolding.plan?.hash?.length // 16\n * compiler.destroy()\n * ```\n */\nexport class Compiler implements CompilerInterface {\n\treadonly #emitter: Emitter<CompilerEventMap>\n\t#destroyed = false\n\n\t/**\n\t * Construct a compiler.\n\t *\n\t * @param options - The initial listeners and the listener-error handler.\n\t * @throws {@link ScaffoldError} coded `INVALID` when `options` is present but\n\t * is not an option bag this compiler accepts.\n\t *\n\t * @remarks\n\t * The options are guarded and never snapshotted: they carry listeners, and a\n\t * function is not data a snapshot can take ownership of. A key outside the\n\t * event map is refused here, so a listener wired to a misspelled event fails\n\t * at construction instead of never firing.\n\t */\n\tconstructor(options?: CompilerOptions) {\n\t\tconst accepted = parseCompilerOptions(options)\n\t\tif (options !== undefined && accepted === undefined) {\n\t\t\tthrow new ScaffoldError(\n\t\t\t\t'INVALID',\n\t\t\t\t'The options argument is not the exact shape this compiler accepts.',\n\t\t\t\t{ field: 'options' },\n\t\t\t)\n\t\t}\n\t\tthis.#emitter = new Emitter<CompilerEventMap>({\n\t\t\t...(accepted?.on === undefined ? {} : { on: accepted.on }),\n\t\t\t...(accepted?.error === undefined ? {} : { error: accepted.error }),\n\t\t})\n\t}\n\n\t/** The compiler's observation channel. */\n\tget emitter(): EmitterInterface<CompilerEventMap> {\n\t\treturn this.#emitter\n\t}\n\n\t/**\n\t * Compile a blueprint into a plan through the draft, gate, and pin stages.\n\t *\n\t * @param blueprint - The workspace specification to compile.\n\t * @param groups - The artifact groups to cover; every group when absent.\n\t * @returns The scaffolding, carrying a plan only when the gate passed.\n\t * @throws {@link ScaffoldError} coded `INVALID` when an argument is not the\n\t * exact shape, and `DESTROYED` when the compiler has been torn down.\n\t *\n\t * @remarks\n\t * Emits `block` with the questions that closed the gate when the compile\n\t * carries no plan, then `compile` with the whole outcome either way, so an\n\t * observer reads every compile from one event and the refusals from the other.\n\t *\n\t * A plan says the blueprint can be built. It does not say the blueprint should\n\t * be created, and the questions beside it are what this compiler could not\n\t * settle. A caller creating a fresh workspace answers them first and writes\n\t * nothing while any remains, which is the rule the `new` verb applies; a caller\n\t * describing or repairing an existing target carries them through instead.\n\t * Nothing downstream repeats that check, because only the caller knows which of\n\t * the two it is.\n\t *\n\t * @example\n\t * ```ts\n\t * import { createBlueprint, createCompiler } from '@orkestrel/scaffold'\n\t *\n\t * const blueprint = createBlueprint('router', { src: ['core'] })\n\t *\n\t * createCompiler().compile(blueprint, ['manifest']).plan?.artifacts.length // 1\n\t * ```\n\t */\n\tcompile(blueprint: Blueprint, groups?: readonly Group[]): Scaffolding {\n\t\tthis.#assertAlive()\n\t\tconst accepted = this.#accept(blueprint, parseBlueprint, 'blueprint')\n\t\tconst scaffolding = this.#scaffold(accepted, this.#select(groups))\n\t\tif (scaffolding.plan === undefined) this.#emitter.emit('block', scaffolding.questions)\n\t\tthis.#emitter.emit('compile', scaffolding)\n\t\treturn scaffolding\n\t}\n\n\t/**\n\t * Compile a blueprint and compare its plan to a target's current content.\n\t *\n\t * @param blueprint - The workspace specification to compile.\n\t * @param current - The target's exact bytes, keyed by artifact-relative path.\n\t * @param groups - The artifact groups to cover; every group when absent.\n\t * @returns The audit; empty findings and blocking questions when the gate refused.\n\t * @throws {@link ScaffoldError} coded `INVALID` when an argument is not the\n\t * exact shape, and `DESTROYED` when the compiler has been torn down.\n\t *\n\t * @remarks\n\t * A compile that carries no plan says nothing about the target, so the audit\n\t * reports no findings and carries the questions instead. Emits `block` in that\n\t * case, then `audit` with the verdict either way.\n\t *\n\t * Ownership decides each verdict, not absence. A birth-owned path is never\n\t * compared and reads `aligned` against a target holding nothing, while a\n\t * content-owned path with no bytes to read is `missing`. An empty snapshot\n\t * therefore produces both verdicts rather than one.\n\t *\n\t * @example\n\t * ```ts\n\t * import { createBlueprint, createCompiler } from '@orkestrel/scaffold'\n\t *\n\t * const blueprint = createBlueprint('router', { src: ['core'] })\n\t *\n\t * createCompiler().audit(blueprint, {}, ['manifest']).findings[0]?.drift // 'aligned'\n\t * createCompiler().audit(blueprint, {}, ['configs']).findings[0]?.drift // 'missing'\n\t * ```\n\t */\n\taudit(blueprint: Blueprint, current: Snapshot, groups?: readonly Group[]): Audit {\n\t\tthis.#assertAlive()\n\t\tconst accepted = this.#accept(blueprint, parseBlueprint, 'blueprint')\n\t\tconst observed = this.#accept(current, parseSnapshot, 'current')\n\t\tconst scaffolding = this.#scaffold(accepted, this.#select(groups))\n\t\tif (scaffolding.plan === undefined) this.#emitter.emit('block', scaffolding.questions)\n\t\tconst result: Audit = {\n\t\t\tfindings: scaffolding.plan === undefined ? [] : planToFindings(scaffolding.plan, observed),\n\t\t\tquestions: scaffolding.questions,\n\t\t}\n\t\tthis.#emitter.emit('audit', result)\n\t\treturn result\n\t}\n\n\t/**\n\t * Tear the compiler down. Every later call throws, and teardown is idempotent.\n\t *\n\t * @returns Nothing.\n\t *\n\t * @example\n\t * ```ts\n\t * import { createCompiler } from '@orkestrel/scaffold'\n\t *\n\t * const compiler = createCompiler()\n\t * compiler.destroy()\n\t * compiler.emitter.destroyed // true\n\t * ```\n\t */\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 three stages in order, recording each one and stopping at the first\n\t// failure. Both public methods run this and choreograph their own events, so\n\t// an audit never emits a compile's completion.\n\t#scaffold(blueprint: Blueprint, groups: readonly Group[]): Scaffolding {\n\t\tconst stages: CompileRecord[] = []\n\t\tconst draft = this.#draft(blueprint)\n\t\tconst selected: Artifact[] = []\n\t\tfor (const group of groups) {\n\t\t\tfor (const artifact of draft) {\n\t\t\t\tif (artifact.group === group) selected.push(artifact)\n\t\t\t}\n\t\t}\n\t\tconst artifacts = applyOverrides(selected, blueprint.overrides)\n\t\tstages.push({ stage: 'draft', input: { blueprint, groups }, output: artifacts })\n\t\tconst questions = this.#gate(blueprint, draft, artifacts)\n\t\tconst blocking = questions.filter((question) => question.blocking)\n\t\tif (blocking.length > 0) {\n\t\t\tstages.push({\n\t\t\t\tstage: 'gate',\n\t\t\t\tinput: { blueprint, artifacts },\n\t\t\t\toutput: questions,\n\t\t\t\tfailure: {\n\t\t\t\t\tcode: 'BLOCKED',\n\t\t\t\t\tmessage: `The gate refused this blueprint on ${blocking.length} blocking question${blocking.length === 1 ? '' : 's'}.`,\n\t\t\t\t},\n\t\t\t})\n\t\t\treturn { questions, stages }\n\t\t}\n\t\tstages.push({ stage: 'gate', input: { blueprint, artifacts }, output: questions })\n\t\tconst drafted: Plan = { blueprint, groups, artifacts }\n\t\tconst hash = planToHash(drafted)\n\t\tif (hash === undefined) {\n\t\t\t// An unidentifiable plan is a question raised against the plan, so the\n\t\t\t// one fail-closed rule still decides it: no plan travels with a blocking\n\t\t\t// question beside it.\n\t\t\tconst refusal: Question = {\n\t\t\t\tfield: 'plan',\n\t\t\t\tmessage: 'The plan carries a value that cannot be encoded, so it has no identity.',\n\t\t\t\tblocking: true,\n\t\t\t}\n\t\t\tstages.push({\n\t\t\t\tstage: 'pin',\n\t\t\t\tinput: drafted,\n\t\t\t\toutput: undefined,\n\t\t\t\tfailure: { code: 'INVALID', message: refusal.message },\n\t\t\t})\n\t\t\treturn { questions: [...questions, refusal], stages }\n\t\t}\n\t\tconst plan: Plan = { ...drafted, hash }\n\t\tstages.push({ stage: 'pin', input: drafted, output: plan })\n\t\treturn { plan, questions, stages }\n\t}\n\n\t// Every artifact the blueprint drafts, in plan order. The manifest is the one artifact this\n\t// package's own fields decide, and it is claimed by birth because a workspace\n\t// owns its manifest once it exists. Every other drafted path is vendored. The\n\t// compile spine selects groups and applies overrides after this full set exists,\n\t// so override legality never depends on the caller's group selection.\n\t#draft(blueprint: Blueprint): readonly Artifact[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tpath: 'package.json',\n\t\t\t\tgroup: 'manifest',\n\t\t\t\townership: 'birth',\n\t\t\t\torigin: 'computed',\n\t\t\t\tcontent: blueprintToManifest(blueprint),\n\t\t\t},\n\t\t\t...blueprintToConfigArtifacts(blueprint),\n\t\t\t...blueprintToSourceArtifacts(blueprint),\n\t\t\t...blueprintToTestArtifacts(blueprint),\n\t\t\t...blueprintToGuideArtifacts(blueprint),\n\t\t\t...blueprintToDocumentArtifacts(blueprint),\n\t\t\t...blueprintToOrchestrationArtifacts(blueprint),\n\t\t\t...nameToHostArtifacts(blueprint.name),\n\t\t]\n\t}\n\n\t// Blueprint and override laws span the full draft. Artifact bounds measure the\n\t// selected, overridden list the plan will carry.\n\t#gate(\n\t\tblueprint: Blueprint,\n\t\tdraft: readonly Artifact[],\n\t\tartifacts: readonly Artifact[],\n\t): readonly Question[] {\n\t\treturn [\n\t\t\t...blueprintToQuestions(blueprint),\n\t\t\t...overridesToQuestions(blueprint.overrides, draft),\n\t\t\t...artifactsToQuestions(artifacts),\n\t\t]\n\t}\n\n\t// The groups boundary: absence covers every group, a selection is refused\n\t// unless it is one, and what survives is read as membership against `GROUPS`.\n\t#select(groups: readonly Group[] | undefined): readonly Group[] {\n\t\tconst selection =\n\t\t\tgroups === undefined ? undefined : this.#accept(groups, parseGroups, 'groups', GROUPS)\n\t\treturn selectGroups(selection)\n\t}\n\n\t// Snapshot the caller's value, then guard the snapshot. The snapshot is what\n\t// closes the guard/use race: a property backed by an accessor never reaches\n\t// the guard, so what the guard measured is what every later read returns.\n\t#accept<T>(value: unknown, parse: Parser<T>, field: string, candidates?: readonly string[]): T {\n\t\tconst accepted = parse(cloneValue(value))\n\t\tif (accepted !== undefined) return accepted\n\t\tthrow this.#error(\n\t\t\t'INVALID',\n\t\t\t`The ${field} argument is not the exact shape this compiler accepts.`,\n\t\t\tcandidates === undefined ? { field } : { field, candidates },\n\t\t)\n\t}\n\n\t#assertAlive(): void {\n\t\tif (this.#destroyed) throw this.#error('DESTROYED', 'This compiler has been destroyed.')\n\t}\n\n\t// Publish the failure on the observation channel, then hand it back to be\n\t// thrown at the site that decided it.\n\t#error(code: ScaffoldErrorCode, message: string, context?: unknown): ScaffoldError {\n\t\tconst error = new ScaffoldError(code, message, context)\n\t\tthis.#emitter.emit('error', error)\n\t\treturn error\n\t}\n}\n","import type { Blueprint, CompilerInterface, CompilerOptions } from './types.js'\nimport { Compiler } from './Compiler.js'\nimport { cloneValue } from './cloners.js'\nimport { DEFAULT_ENGINES, DEFAULT_VERSION } from './constants.js'\nimport { ScaffoldError } from './errors.js'\nimport { parseBlueprint } from './parsers.js'\n\n/**\n * Construct a {@link Blueprint} from a name and the fields that differ from the defaults.\n *\n * @param name - The bare workspace name.\n * @param input - The fields to set; every omitted field takes its default.\n * @returns The filled blueprint, owned by the caller and sharing nothing with `input`.\n * @throws {@link ScaffoldError} coded `INVALID` when the filled record is not a\n * blueprint.\n *\n * @remarks\n * A blueprint is a closed record, and most of its fields have one sensible\n * starting value: an empty list, a cleared flag, `DEFAULT_VERSION`, and\n * `DEFAULT_ENGINES`. Filling them here is what lets a caller state only what its\n * workspace actually declares.\n *\n * This is the construction door, and {@link parseBlueprint} is the coercing one.\n * They differ in all three of their parts: this fills the defaults and takes a\n * partial specification, where the parser fills nothing and takes an untrusted\n * value; and this refuses by throwing, where the parser refuses by answering\n * `undefined`. What they share is the law — both accept exactly what\n * `isBlueprint` accepts.\n *\n * That law is structural only. Whether the name is a name, the version a\n * version, and the two environment axes a combination this package can generate\n * are the gate's laws, and the gate answers them with {@link Question}s carrying\n * their accepted candidates. Deciding them here as well would state one law in\n * two places and let the two answers disagree, so a blueprint the gate will\n * refuse is still constructible.\n *\n * @example\n * ```ts\n * import { createBlueprint } from '@orkestrel/scaffold'\n *\n * createBlueprint('router', { src: ['core'] }).version // '0.0.1'\n * createBlueprint('Router').name // 'Router' — the gate refuses it, this does not\n * ```\n */\nexport function createBlueprint(name: string, input?: Partial<Omit<Blueprint, 'name'>>): Blueprint {\n\tconst candidate = {\n\t\tname,\n\t\t...(input?.description === undefined ? {} : { description: input.description }),\n\t\tkeywords: input?.keywords ?? [],\n\t\tsrc: input?.src ?? [],\n\t\tapp: input?.app ?? [],\n\t\tdependencies: input?.dependencies ?? [],\n\t\tpeers: input?.peers ?? [],\n\t\textras: input?.extras ?? [],\n\t\tversion: input?.version ?? DEFAULT_VERSION,\n\t\tengines: input?.engines ?? DEFAULT_ENGINES,\n\t\toverrides: input?.overrides ?? [],\n\t\tbin: input?.bin ?? false,\n\t\tguides: input?.guides ?? false,\n\t\tdistribution: input?.distribution ?? false,\n\t\tintegration: input?.integration ?? false,\n\t\tconformance: input?.conformance ?? false,\n\t\tservice: input?.service ?? false,\n\t\tvendors: input?.vendors ?? [],\n\t\tglobal: input?.global ?? false,\n\t\tshowcase: input?.showcase ?? false,\n\t}\n\tconst blueprint = parseBlueprint(cloneValue(candidate))\n\tif (blueprint === undefined) {\n\t\tthrow new ScaffoldError('INVALID', 'The filled record is not a blueprint.', { name })\n\t}\n\treturn blueprint\n}\n\n/**\n * Construct a {@link Compiler}.\n *\n * @param options - The initial listeners and the listener-error handler.\n * @returns The compiler, typed as the contract consumers program against.\n * @throws {@link ScaffoldError} coded `INVALID` when `options` is present but is\n * not an option bag the compiler accepts.\n *\n * @example\n * ```ts\n * import { createCompiler } from '@orkestrel/scaffold'\n *\n * const compiler = createCompiler({ on: { block: (questions) => report(questions) } })\n * compiler.destroy()\n * ```\n */\nexport function createCompiler(options?: CompilerOptions): CompilerInterface {\n\treturn new Compiler(options)\n}\n"],"mappings":";;;;;;;;;;;;;;AAWA,IAAa,eAAuC,OAAO,OAAO;CAAC;CAAQ;CAAW;AAAQ,CAAC;;;;;;;;;AAU/F,IAAa,SAA2B,OAAO,OAAO;CACrD;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;;;;;;;;;;;AAYD,IAAa,aAA2D,OAAO,OAAO;CACrF,MAAM,OAAO,OAAO;EACnB,SAAS,OAAO,OAAO,CAAC,mCAAmC,gCAAgC,CAAC;EAC5F,SAAS;EACT,MAAM;EACN,SAAS,OAAO,OAAsB,CAAC,MAAM,KAAK,CAAC;CACpD,CAAC;CACD,SAAS,OAAO,OAAO;EACtB,SAAS,OAAO,OAAO,CACtB,sCACA,mCACD,CAAC;EACD,SAAS;EACT,MAAM;EACN,SAAS,OAAO,OAAsB,CAAC,IAAI,CAAC;CAC7C,CAAC;CACD,QAAQ,OAAO,OAAO;EACrB,S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