@orkestrel/scaffold 0.0.107 → 0.0.109

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.
Files changed (164) hide show
  1. package/dist/agents/skills/orkestrel-dispatch/scripts/bench.js +326 -91
  2. package/dist/agents/skills/orkestrel-dispatch/scripts/brief.js +110 -14
  3. package/dist/agents/skills/orkestrel-dispatch/scripts/chain.js +280 -0
  4. package/dist/agents/skills/orkestrel-dispatch/scripts/cite.js +188 -26
  5. package/dist/agents/skills/orkestrel-dispatch/scripts/launch.js +142 -43
  6. package/dist/agents/skills/orkestrel-dispatch/scripts/login.js +240 -62
  7. package/dist/agents/skills/orkestrel-dispatch/scripts/patch.js +323 -0
  8. package/dist/agents/skills/orkestrel-dispatch/scripts/result.js +169 -32
  9. package/dist/agents/skills/orkestrel-dispatch/scripts/sweep.js +368 -27
  10. package/dist/agents/skills/orkestrel-falsify/scripts/mutate.js +560 -0
  11. package/dist/agents/skills/orkestrel-harden/scripts/discovery.js +1052 -205
  12. package/dist/agents/skills/orkestrel-harden/scripts/measure.js +361 -0
  13. package/dist/agents/skills/orkestrel-harden/scripts/titles.js +455 -80
  14. package/dist/agents/skills/orkestrel-parallel/scripts/cases.js +327 -0
  15. package/dist/agents/skills/orkestrel-publish/scripts/compare.js +298 -51
  16. package/dist/agents/skills/orkestrel-publish/scripts/pins.js +170 -13
  17. package/dist/agents/skills/orkestrel-publish/scripts/swap.js +956 -191
  18. package/dist/agents/skills/orkestrel-publish/scripts/wave.js +707 -112
  19. package/dist/agents/skills/orkestrel-publish/scripts/window.js +235 -41
  20. package/dist/agents/skills/orkestrel-scout/scripts/map.js +341 -54
  21. package/dist/agents/templates/brief.md +1 -1
  22. package/dist/bin/main.js +51 -46
  23. package/dist/bin/main.js.map +1 -1
  24. package/dist/host/AGENTS.md +26 -20
  25. package/dist/host/agents/orchestration.md +98 -58
  26. package/dist/host/agents/platforms/posix.md +15 -0
  27. package/dist/host/agents/platforms/windows.md +37 -0
  28. package/dist/host/agents/skills/orkestrel-align/SKILL.md +10 -13
  29. package/dist/host/agents/skills/orkestrel-align/references/fleet.md +4 -10
  30. package/dist/host/agents/skills/orkestrel-align/references/integration.md +1 -1
  31. package/dist/host/agents/skills/orkestrel-build/SKILL.md +16 -48
  32. package/dist/host/agents/skills/orkestrel-build/agents/openai.yaml +1 -1
  33. package/dist/host/agents/skills/orkestrel-debrief/SKILL.md +19 -16
  34. package/dist/host/agents/skills/orkestrel-debrief/agents/openai.yaml +1 -1
  35. package/dist/host/agents/skills/orkestrel-debrief/references/field-testing.md +15 -28
  36. package/dist/host/agents/skills/orkestrel-debrief/references/instruction-audit.md +5 -6
  37. package/dist/host/agents/skills/orkestrel-debrief/references/retention.md +12 -14
  38. package/dist/host/agents/skills/orkestrel-dispatch/SKILL.md +36 -24
  39. package/dist/host/agents/skills/orkestrel-dispatch/references/launch.md +14 -11
  40. package/dist/host/agents/skills/orkestrel-dispatch/scripts/bench.ts +366 -75
  41. package/dist/host/agents/skills/orkestrel-dispatch/scripts/brief.ts +126 -16
  42. package/dist/host/agents/skills/orkestrel-dispatch/scripts/chain.ts +323 -0
  43. package/dist/host/agents/skills/orkestrel-dispatch/scripts/cite.ts +220 -31
  44. package/dist/host/agents/skills/orkestrel-dispatch/scripts/launch.ts +176 -33
  45. package/dist/host/agents/skills/orkestrel-dispatch/scripts/login.ts +294 -59
  46. package/dist/host/agents/skills/orkestrel-dispatch/scripts/patch.ts +401 -0
  47. package/dist/host/agents/skills/orkestrel-dispatch/scripts/result.ts +199 -34
  48. package/dist/host/agents/skills/orkestrel-dispatch/scripts/sweep.ts +428 -27
  49. package/dist/host/agents/skills/orkestrel-falsify/SKILL.md +10 -8
  50. package/dist/host/agents/skills/orkestrel-falsify/references/brief.md +1 -5
  51. package/dist/host/agents/skills/orkestrel-falsify/references/reconcile.md +1 -1
  52. package/dist/host/agents/skills/orkestrel-falsify/scripts/mutate.ts +701 -0
  53. package/dist/host/agents/skills/orkestrel-harden/SKILL.md +16 -12
  54. package/dist/host/agents/skills/orkestrel-harden/references/bindings.md +23 -81
  55. package/dist/host/agents/skills/orkestrel-harden/references/centralization.md +4 -5
  56. package/dist/host/agents/skills/orkestrel-harden/references/contract.md +2 -0
  57. package/dist/host/agents/skills/orkestrel-harden/references/document.md +33 -0
  58. package/dist/host/agents/skills/orkestrel-harden/references/equivalence.md +6 -3
  59. package/dist/host/agents/skills/orkestrel-harden/references/hardening.md +8 -4
  60. package/dist/host/agents/skills/orkestrel-harden/references/research.md +2 -0
  61. package/dist/host/agents/skills/orkestrel-harden/scripts/discovery.ts +1272 -279
  62. package/dist/host/agents/skills/orkestrel-harden/scripts/measure.ts +425 -0
  63. package/dist/host/agents/skills/orkestrel-harden/scripts/titles.ts +603 -98
  64. package/dist/host/agents/skills/orkestrel-journey/SKILL.md +75 -98
  65. package/dist/host/agents/skills/orkestrel-journey/references/captures.md +54 -17
  66. package/dist/host/agents/skills/orkestrel-journey/references/decide.md +1 -20
  67. package/dist/host/agents/skills/orkestrel-journey/references/layer.md +21 -31
  68. package/dist/host/agents/skills/orkestrel-journey/references/styles.md +1 -1
  69. package/dist/host/agents/skills/orkestrel-parallel/SKILL.md +91 -30
  70. package/dist/host/agents/skills/orkestrel-parallel/agents/openai.yaml +2 -2
  71. package/dist/host/agents/skills/orkestrel-parallel/references/claude.md +34 -0
  72. package/dist/host/agents/skills/orkestrel-parallel/references/codex.md +29 -0
  73. package/dist/host/agents/skills/orkestrel-parallel/references/cursor.md +29 -0
  74. package/dist/host/agents/skills/orkestrel-parallel/references/t3.md +31 -0
  75. package/dist/host/agents/skills/orkestrel-parallel/scripts/cases.ts +389 -0
  76. package/dist/host/agents/skills/orkestrel-polish/SKILL.md +16 -20
  77. package/dist/host/agents/skills/orkestrel-polish/references/capture-harness.md +16 -26
  78. package/dist/host/agents/skills/orkestrel-publish/SKILL.md +12 -26
  79. package/dist/host/agents/skills/orkestrel-publish/agents/openai.yaml +2 -2
  80. package/dist/host/agents/skills/orkestrel-publish/references/adopt.md +23 -0
  81. package/dist/host/agents/skills/orkestrel-publish/references/release.md +4 -4
  82. package/dist/host/agents/skills/orkestrel-publish/references/wave.md +12 -10
  83. package/dist/host/agents/skills/orkestrel-publish/references/window.md +20 -25
  84. package/dist/host/agents/skills/orkestrel-publish/scripts/compare.ts +348 -59
  85. package/dist/host/agents/skills/orkestrel-publish/scripts/pins.ts +202 -22
  86. package/dist/host/agents/skills/orkestrel-publish/scripts/swap.ts +1061 -191
  87. package/dist/host/agents/skills/orkestrel-publish/scripts/wave.ts +812 -140
  88. package/dist/host/agents/skills/orkestrel-publish/scripts/window.ts +280 -38
  89. package/dist/host/agents/skills/orkestrel-scout/SKILL.md +3 -3
  90. package/dist/host/agents/skills/orkestrel-scout/scripts/map.ts +428 -70
  91. package/dist/host/agents/templates/brief.md +1 -1
  92. package/dist/host/agents/transports/claude-cli.md +3 -3
  93. package/dist/host/agents/transports/codex.md +3 -8
  94. package/dist/host/agents/transports/cursor.md +2 -3
  95. package/dist/host/claude/AGENTS.md +7 -10
  96. package/dist/host/claude/agents/analyst.md +3 -3
  97. package/dist/host/claude/agents/astra.md +3 -3
  98. package/dist/host/claude/agents/builder.md +1 -1
  99. package/dist/host/claude/agents/checker.md +1 -1
  100. package/dist/host/claude/agents/distiller.md +1 -1
  101. package/dist/host/claude/agents/grok.md +1 -1
  102. package/dist/host/claude/agents/opus.md +2 -2
  103. package/dist/host/claude/agents/orkestrel.md +57 -90
  104. package/dist/host/claude/agents/researcher.md +1 -1
  105. package/dist/host/claude/agents/reviewer.md +4 -0
  106. package/dist/host/claude/agents/scout.md +1 -1
  107. package/dist/host/claude/agents/verifier.md +1 -1
  108. package/dist/host/claude/rules/application.md +14 -21
  109. package/dist/host/claude/rules/architecture.md +34 -44
  110. package/dist/host/claude/rules/browser.md +3 -4
  111. package/dist/host/claude/rules/campaign.md +55 -0
  112. package/dist/host/claude/rules/documentation.md +26 -11
  113. package/dist/host/claude/rules/names.md +9 -4
  114. package/dist/host/claude/rules/patterns.md +6 -7
  115. package/dist/host/claude/rules/portability.md +2 -3
  116. package/dist/host/claude/rules/quality.md +4 -5
  117. package/dist/host/claude/rules/styles.md +2 -2
  118. package/dist/host/claude/rules/tests.md +57 -114
  119. package/dist/host/claude/rules/typescript.md +8 -10
  120. package/dist/host/claude/rules/workspace.md +21 -19
  121. package/dist/host/claude/rules/writing.md +3 -3
  122. package/dist/host/claude/skills/orkestrel-dispatch/SKILL.md +1 -1
  123. package/dist/host/claude/skills/orkestrel-harden/SKILL.md +1 -1
  124. package/dist/host/claude/skills/orkestrel-parallel/SKILL.md +1 -1
  125. package/dist/host/claude/skills/orkestrel-publish/SKILL.md +1 -1
  126. package/dist/host/claude/skills/orkestrel-scout/SKILL.md +1 -1
  127. package/dist/host/codex/agents/analyst.toml +9 -3
  128. package/dist/host/codex/agents/astra.toml +3 -4
  129. package/dist/host/codex/agents/builder.toml +1 -1
  130. package/dist/host/codex/agents/opus.toml +3 -4
  131. package/dist/host/codex/agents/orkestrel.toml +1 -1
  132. package/dist/host/codex/agents/researcher.toml +2 -2
  133. package/dist/host/codex/agents/verifier.toml +1 -1
  134. package/dist/host/codex/config.toml +3 -3
  135. package/dist/host/configs/helpers.ts +21 -1
  136. package/dist/host/configs/policy.ts +405 -16
  137. package/dist/host/cursor/rules/orchestration.mdc +1 -0
  138. package/dist/host/dotfiles/oxlintrc.json +141 -5
  139. package/dist/host/guides/agent.md +111 -134
  140. package/dist/host/guides/capture.md +801 -0
  141. package/dist/host/guides/probe.md +27 -8
  142. package/dist/host/guides/scaffold.md +152 -19
  143. package/dist/host/guides/study.md +534 -440
  144. package/dist/host/guides/test.md +111 -44
  145. package/dist/host/manifest.json +199 -242
  146. package/dist/host/tests/config.test.ts +1558 -219
  147. package/dist/host/tests/policy.test.ts +127 -1
  148. package/dist/host/tests/setupPolicy.ts +1389 -39
  149. package/dist/src/core/index.cjs +239 -87
  150. package/dist/src/core/index.cjs.map +1 -1
  151. package/dist/src/core/index.d.cts +123 -39
  152. package/dist/src/core/index.d.ts +123 -39
  153. package/dist/src/core/index.js +234 -86
  154. package/dist/src/core/index.js.map +1 -1
  155. package/dist/src/server/index.cjs +20 -27
  156. package/dist/src/server/index.cjs.map +1 -1
  157. package/dist/src/server/index.js +21 -28
  158. package/dist/src/server/index.js.map +1 -1
  159. package/package.json +11 -11
  160. package/dist/agents/skills/orkestrel-dispatch/scripts/helpers.js +0 -283
  161. package/dist/host/agents/skills/orkestrel-dispatch/references/bench.md +0 -25
  162. package/dist/host/agents/skills/orkestrel-dispatch/scripts/helpers.ts +0 -333
  163. package/dist/host/agents/skills/orkestrel-parallel/references/harnesses.md +0 -19
  164. package/dist/host/guides/supervisor.md +0 -4890
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["manifest"],"sources":["../../../package.json","../../../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/factories.ts","../../../src/core/Compiler.ts"],"sourcesContent":["{\n\t\"name\": \"@orkestrel/scaffold\",\n\t\"version\": \"0.0.107\",\n\t\"description\": \"Scaffold workspaces with commands: new, audit, repair, catalog, and overwrite.\",\n\t\"keywords\": [\n\t\t\"audit\",\n\t\t\"catalog\",\n\t\t\"new\",\n\t\t\"overwrite\",\n\t\t\"repair\"\n\t],\n\t\"homepage\": \"https://github.com/orkestrel/scaffold#readme\",\n\t\"bugs\": \"https://github.com/orkestrel/scaffold/issues\",\n\t\"license\": \"MIT\",\n\t\"repository\": {\n\t\t\"type\": \"git\",\n\t\t\"url\": \"git+https://github.com/orkestrel/scaffold.git\"\n\t},\n\t\"bin\": {\n\t\t\"scaffold\": \"dist/bin/main.js\"\n\t},\n\t\"files\": [\n\t\t\"dist/src\",\n\t\t\"dist/bin\",\n\t\t\"dist/host\",\n\t\t\"dist/agents\",\n\t\t\"README.md\"\n\t],\n\t\"type\": \"module\",\n\t\"sideEffects\": [\n\t\t\"./src/bin/main.ts\",\n\t\t\"./dist/bin/main.js\"\n\t],\n\t\"main\": \"./dist/src/core/index.cjs\",\n\t\"module\": \"./dist/src/core/index.js\",\n\t\"exports\": {\n\t\t\".\": {\n\t\t\t\"import\": {\n\t\t\t\t\"types\": \"./dist/src/core/index.d.ts\",\n\t\t\t\t\"default\": \"./dist/src/core/index.js\"\n\t\t\t},\n\t\t\t\"require\": {\n\t\t\t\t\"types\": \"./dist/src/core/index.d.cts\",\n\t\t\t\t\"default\": \"./dist/src/core/index.cjs\"\n\t\t\t}\n\t\t},\n\t\t\"./server\": {\n\t\t\t\"import\": {\n\t\t\t\t\"types\": \"./dist/src/server/index.d.ts\",\n\t\t\t\t\"default\": \"./dist/src/server/index.js\"\n\t\t\t},\n\t\t\t\"require\": {\n\t\t\t\t\"types\": \"./dist/src/server/index.d.cts\",\n\t\t\t\t\"default\": \"./dist/src/server/index.cjs\"\n\t\t\t}\n\t\t},\n\t\t\"./package.json\": \"./package.json\"\n\t},\n\t\"publishConfig\": {\n\t\t\"access\": \"public\"\n\t},\n\t\"scripts\": {\n\t\t\"clean\": \"node -e \\\"require('node:fs').rmSync('dist',{recursive:true,force:true})\\\"\",\n\t\t\"copy\": \"node -e \\\"const fs=require('node:fs'),p=require('node:path'),a=process.argv[1],b=process.argv[2];fs.mkdirSync(p.dirname(b),{recursive:true});fs.cpSync(a,b,{force:true});console.log('Copied: '+a+' to '+b)\\\"\",\n\t\t\"scaffold\": \"node ./dist/bin/main.js\",\n\t\t\"lint\": \"oxlint --config .oxlintrc.json --fix .\",\n\t\t\"check\": \"tsc --noEmit --project tsconfig.json && npm run check:src && npm run check:skills\",\n\t\t\"check:src\": \"npm run check:src:core && npm run check:src:server && npm run check:src:bin\",\n\t\t\"check:src:core\": \"tsc --noEmit -p configs/src/tsconfig.core.json\",\n\t\t\"check:src:server\": \"tsc --noEmit -p configs/src/tsconfig.server.json\",\n\t\t\"check:src:bin\": \"tsc --noEmit -p configs/src/tsconfig.bin.json\",\n\t\t\"check:skills\": \"tsc --noEmit -p configs/agents/tsconfig.skills.json\",\n\t\t\"format\": \"oxfmt --config .oxfmtrc.json --write .\",\n\t\t\"format:check\": \"oxfmt --config .oxfmtrc.json --check .\",\n\t\t\"lint:check\": \"oxlint --config .oxlintrc.json --deny-warnings .\",\n\t\t\"test\": \"npm run test:src:core && npm run test:src:server && npm run test:src:bin && npm run test:policy && npm run test:config && npm run test:setup && npm run test:skills && npm run test:guides\",\n\t\t\"test:src:core\": \"vitest run --config vite.config.ts --no-cache --reporter=dot --project src:core\",\n\t\t\"test:src:server\": \"vitest run --config vite.config.ts --no-cache --reporter=dot --project src:server\",\n\t\t\"test:src:bin\": \"vitest run --config vite.config.ts --no-cache --reporter=dot --project src:bin\",\n\t\t\"test:policy\": \"vitest run --config vite.config.ts --no-cache --reporter=dot --project policy\",\n\t\t\"test:config\": \"vitest run --config vite.config.ts --no-cache --reporter=dot --project config\",\n\t\t\"test:guides\": \"node --experimental-strip-types tests/guides.test.ts\",\n\t\t\"test:skills\": \"vitest run --config vite.config.ts --no-cache --reporter=dot --project skills\",\n\t\t\"test:templates\": \"vitest run --config vite.config.ts --no-cache --reporter=dot --project templates\",\n\t\t\"test:distribution\": \"vitest run --config vite.config.ts --no-cache --reporter=dot --project distribution\",\n\t\t\"test:probe\": \"vitest run --config vite.config.ts --no-cache --reporter=verbose --project probe\",\n\t\t\"test:bench\": \"vitest bench --config vite.config.ts --no-cache --project probe\",\n\t\t\"test:setup\": \"vitest run --config vite.config.ts --no-cache --reporter=dot --project setup\",\n\t\t\"build\": \"npm run clean && npm run build:src && npm run build:host && npm run build:skills && npm run build:inventory\",\n\t\t\"build:src\": \"npm run build:src:core && npm run build:src:server && npm run build:src:bin\",\n\t\t\"build:src:core\": \"vite build --config configs/src/vite.core.config.ts && npm run copy dist/src/core/index.d.ts dist/src/core/index.d.cts\",\n\t\t\"build:src:server\": \"vite build --config configs/src/vite.server.config.ts && npm run copy dist/src/server/index.d.ts dist/src/server/index.d.cts\",\n\t\t\"build:src:bin\": \"vite build --config configs/src/vite.bin.config.ts\",\n\t\t\"build:host\": \"node -e \\\"import('./dist/src/server/index.js').then((m)=>{const n=m.stageHost(process.cwd(),'dist/host',{report: (message) => console.error(message)}).length;console.log('build-host: staged '+n+' file(s) into dist/host')})\\\"\",\n\t\t\"build:inventory\": \"node -e \\\"import('./dist/src/server/index.js').then((m)=>{const p=process.argv[1]??'host.json',n=m.stageInventory(process.cwd(),p).entries.length;console.log('build-inventory: staged '+n+' file(s) into '+p)})\\\"\",\n\t\t\"build:skills\": \"tsc -p configs/agents/tsconfig.skills.json --noEmit false --allowImportingTsExtensions false --rewriteRelativeImportExtensions --declaration false --sourceMap false --rootDir .agents/skills --outDir dist/agents/skills && npm run copy .agents/templates/brief.md dist/agents/templates/brief.md\",\n\t\t\"prepack\": \"npm run build\",\n\t\t\"prepublishOnly\": \"npm run format:check && npm run lint:check && npm run check && npm run build && npm test && npm run test:templates && npm run test:distribution -- --mode release\"\n\t},\n\t\"dependencies\": {\n\t\t\"@orkestrel/console\": \"^0.0.16\",\n\t\t\"@orkestrel/contract\": \"^0.0.19\",\n\t\t\"@orkestrel/emitter\": \"^0.0.12\",\n\t\t\"@orkestrel/markdown\": \"^0.0.17\",\n\t\t\"@orkestrel/process\": \"^0.0.15\",\n\t\t\"@orkestrel/template\": \"^0.0.10\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@microsoft/api-extractor\": \"^7.59.4\",\n\t\t\"@orkestrel/browser\": \"^0.0.29\",\n\t\t\"@orkestrel/guide\": \"^0.0.25\",\n\t\t\"@orkestrel/html\": \"^0.0.12\",\n\t\t\"@orkestrel/probe\": \"^0.0.24\",\n\t\t\"@orkestrel/test\": \"^0.0.29\",\n\t\t\"@types/node\": \"^24.19.2\",\n\t\t\"@vitest/browser-playwright\": \"^4.1.11\",\n\t\t\"oxfmt\": \"^0.74.0\",\n\t\t\"oxlint\": \"^1.89.0\",\n\t\t\"playwright\": \"^1.63.0\",\n\t\t\"typescript\": \"^6.0.3\",\n\t\t\"vite\": \"^8.3.5\",\n\t\t\"vitest\": \"^4.1.12\"\n\t},\n\t\"engines\": {\n\t\t\"node\": \">=22.18.0\"\n\t}\n}\n","import type {\n\tAppDefinition,\n\tAxis,\n\tBuildFormat,\n\tEnvironment,\n\tFramework,\n\tFrameworkDefinition,\n\tGroup,\n\tSrcDefinition,\n\tSurface,\n} from './types.js'\nimport manifest from '../../package.json' with { type: 'json' }\n\n/**\n * Lists the `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/** Lists the surfaces an extension may extend, frozen. */\nexport const SURFACES: readonly Surface[] = Object.freeze(['browser', 'styles'])\n\n/** Lists the axes a browser extension may occupy, frozen. */\nexport const AXES: readonly Axis[] = Object.freeze(['src', 'app'])\n\n/** Lists the supported browser frameworks, frozen. */\nexport const FRAMEWORKS: readonly Framework[] = Object.freeze(['vue'])\n\n/** Describes the tooling and package boundaries of each browser framework, frozen. */\nexport const FRAMEWORK_MATRIX: Readonly<Record<Framework, FrameworkDefinition>> = Object.freeze({\n\tvue: Object.freeze({\n\t\tplugin: '@vitejs/plugin-vue',\n\t\tchecker: 'vue-tsc',\n\t\tsuffixes: Object.freeze(['vue']),\n\t\trefused: Object.freeze(['vue', '@vue/']),\n\t\tdependencies: Object.freeze({\n\t\t\t'@vitejs/plugin-vue': '^6.0.8',\n\t\t\tvue: '^3.5.40',\n\t\t\t'vue-tsc': '^3.3.7',\n\t\t}),\n\t}),\n})\n\n/** Names the base stylesheet marker. */\nexport const STYLES_ENTRY_PATH = 'src/styles/index.scss'\n\n/** Names the themes build entry marker. */\nexport const THEMES_ENTRY_PATH = 'src/styles/themes/sheet.ts'\n\n/** Names the themes stylesheet marker. */\nexport const THEMES_BARREL_PATH = 'src/styles/themes/index.scss'\n\n/** Names the build entry beside each stylesheet marker. */\nexport const SHEET_ENTRY_NAME = 'sheet.ts'\n\n/** Names the physical showcase output directory. */\nexport const SHOWCASE_PAGES_PATH = 'showcase'\n\n/** Lists the development dependencies the styles surface adds, frozen. */\nexport const STYLES_DEV_DEPENDENCIES: Readonly<Record<string, string>> = Object.freeze({\n\tsass: '^1.105.1',\n})\n\n/** Lists the names a styles extension cannot occupy, frozen. */\nexport const RESERVED_SHEET_NAMES: readonly string[] = Object.freeze([\n\t...ENVIRONMENTS,\n\t'bin',\n\t'styles',\n\t'themes',\n\t...FRAMEWORKS,\n])\n\n/**\n * Lists the `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 * Holds 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 * Holds the configuration and runtime-entry settings each private `app` environment\n * 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 environments 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/** Lists 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/** Names the executable entry whose presence makes a workspace `bin`. */\nexport const BIN_ENTRY_PATH = 'src/bin/main.ts'\n\n/** Names the built executable a bin workspace's manifest command runs. */\nexport const BIN_OUTPUT_PATH = 'dist/bin/main.js'\n\n/**\n * Lists the paths a target receives from the vendored data root, frozen.\n *\n * @remarks\n * These are the files the fleet shares verbatim, and each target holds a copy\n * of the paths it selects: the licence, the harness permission file, the\n * session-start hooks, the shared policy\n * register, the shared policy proof, the shared policy plugin, the shared\n * configuration leaf and its proof, and the byte-identical root dotfiles.\n * A directory entry vendors everything beneath it.\n *\n * A plan carries the subset its target selects. The seed guide mirrors are\n * claimed separately by `blueprintToHostArtifacts` through {@link SEED_GUIDE_PATHS}.\n *\n * Neither the instruction canon nor the bench and MCP wiring is here. A target reads\n * its rules, its skills, its agent roles, its bench configuration, and its MCP\n * registrations from {@link CANON_PATHS} inside the installed package, so no\n * file scaffold leaves in a target names a path the target does not hold.\n * `blueprintToHostArtifacts` appends {@link CATALOG_AGENT_PATH} to what this list\n * selects, which is what keeps the list itself disjoint from the canon.\n */\nexport const HOST_PATHS: readonly string[] = Object.freeze([\n\t'LICENSE',\n\t'.claude/settings.json',\n\t'scripts',\n\t'tests/setupPolicy.ts',\n\t'tests/policy.test.ts',\n\t'tests/config.test.ts',\n\t'configs/helpers.ts',\n\t'configs/policy.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])\n\n/**\n * Lists the instruction-canon paths staged for reading rather than for a target, frozen.\n *\n * @remarks\n * The root instruction documents, the orchestration contract every harness\n * bridge points at, the rule map's rules, the skills, the templates, the\n * transport contracts, the agent roles each harness dispatches, the bench\n * configuration, and the MCP registrations. A directory entry covers everything\n * beneath it.\n *\n * Staging walks these beside {@link HOST_PATHS}, so a release ships them and a\n * reader reaches them two ways: a scaffold checkout sitting beside the\n * repository, or the `node_modules/@orkestrel/scaffold/dist/host/` root inside\n * the installed package. The `AGENTS.md` pointer scaffold plans is what names\n * each location.\n *\n * This list, {@link HOST_PATHS}, and {@link REFERENCE_PATHS} are disjoint by\n * prefix in every direction: no member equals or sits beneath another list's\n * member. Staging depends on that, because\n * the walk covers the union and a path it discovers twice claims one storage\n * name twice, which refuses the stage.\n *\n * The plan claims paths inside the canon deliberately, and each has a reason.\n * `blueprintToDocumentArtifacts` claims `AGENTS.md` as this package's own\n * template pointer. `blueprintToHostArtifacts` claims\n * {@link CATALOG_AGENT_PATH}, because the catalog verb refuses a target that\n * lacks the file and repair restores its absence.\n *\n * A target therefore holds a file at a canon path only where the plan claims it.\n * That is the rule every verb obeys, and it is what makes a copy found anywhere\n * else superseded. A member this checkout no longer holds, `CLAUDE.md` since\n * Claude Code began reading `AGENTS.md` directly, stays listed for exactly that\n * reason: the stager ships nothing for it, `audit` reports a target's copy\n * `foreign`, and `overwrite` deletes it.\n */\nexport const CANON_PATHS: readonly string[] = Object.freeze([\n\t'AGENTS.md',\n\t'CLAUDE.md',\n\t'.claude/AGENTS.md',\n\t'.mcp.json',\n\t'.agents/orchestration.md',\n\t'.agents/skills',\n\t'.agents/templates',\n\t'.agents/transports',\n\t'.claude/agents',\n\t'.claude/rules',\n\t'.claude/skills',\n\t'.codex/agents',\n\t'.codex/config.toml',\n\t'.cursor/mcp.json',\n\t'.cursor/rules',\n])\n\n/**\n * Lists the reference paths staged for offline reading, frozen.\n *\n * @remarks\n * A directory entry covers everything beneath it. Reference membership grants\n * no target ownership and no instruction-canon membership. Keep this list,\n * {@link HOST_PATHS}, and {@link CANON_PATHS} disjoint by prefix in every\n * direction; duplicate discovery refuses the stage.\n */\nexport const REFERENCE_PATHS: readonly string[] = Object.freeze(['guides'])\n\n/**\n * Lists the guide paths a generated workspace starts with, frozen.\n *\n * @remarks\n * `blueprintToHostArtifacts` claims these mirrors from {@link REFERENCE_PATHS}.\n * `selectHostPaths` excludes the workspace's own guide from that claim.\n */\nexport const SEED_GUIDE_PATHS: readonly string[] = Object.freeze([\n\t'guides/guide.md',\n\t'guides/scaffold.md',\n])\n\n/** Names the repository-relative path where the committed vendored-file inventory is served. */\nexport const HOST_INVENTORY_PATH = 'host.json'\n\n/**\n * Lists 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 * Lists 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/browsers.sh',\n\t'scripts/codex.sh',\n\t'scripts/cursor.sh',\n\t'scripts/deps.sh',\n\t'scripts/npm.sh',\n\t'scripts/ollama.sh',\n])\n\n/**\n * Lists 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 * an added 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 * Lists the exact root paths that wire an agent bench or own an orchestration directory, frozen.\n *\n * @remarks\n * `.mcp.json` registers MCP servers for the harness. `scripts` is the owned\n * directory whose members wire the development environment.\n */\nexport const ORCHESTRATION_PATH_NAMES: readonly string[] = Object.freeze(['.mcp.json', 'scripts'])\n\n/**\n * Names the agent file whose marker-bounded package table the catalog verb alone owns.\n *\n * @remarks\n * A plan claims it at a canon path, because the catalog verb refuses a target\n * that lacks the file. `blueprintToHostArtifacts` appends it to the vendored\n * selection, and it reaches a release through the `.claude/agents` directory in\n * {@link CANON_PATHS} rather than through {@link HOST_PATHS}, which is what\n * keeps the two lists disjoint.\n *\n * It is claimed by presence rather than content, so a consumer's own edits to\n * the file survive every verb and only the catalog verb rewrites the region\n * inside the markers.\n */\nexport const CATALOG_AGENT_PATH = '.claude/agents/orkestrel.md'\n\n/**\n * Names the marker opening the package table inside {@link CATALOG_AGENT_PATH}.\n *\n * @remarks\n * The catalog verb rewrites the region between this marker and\n * {@link CATALOG_CLOSING_MARKER} and leaves every other byte of the file alone,\n * so the writer and every proof that reads the rendered file read the pair from\n * here rather than repeating a literal that only agrees by inspection.\n */\nexport const CATALOG_OPENING_MARKER = '<!-- orkestrel:catalog -->'\n\n/**\n * Names the marker closing the package table inside {@link CATALOG_AGENT_PATH}.\n *\n * @remarks\n * It pairs with {@link CATALOG_OPENING_MARKER}; a file missing either marker is\n * refused rather than rewritten.\n */\nexport const CATALOG_CLOSING_MARKER = '<!-- /orkestrel:catalog -->'\n\n/**\n * Lists the package-facing skills a target receives pointers for, frozen and alphabetical.\n *\n * @remarks\n * `blueprintToHostArtifacts` plans, for each name, the Claude bridge, the Codex\n * sidecar, and the derived `SKILL.md` pointer, so every harness discovers the\n * skill while its body, references, and scripts stay in the installed package.\n * `orkestrel-align`, `orkestrel-dispatch`, `orkestrel-publish`, and\n * `orkestrel-scout` are excluded because they run from the scaffold checkout\n * and a target is not an orchestration host.\n */\nexport const TARGET_SKILL_NAMES: readonly string[] = Object.freeze([\n\t'enterprise-bootstrap',\n\t'orkestrel-build',\n\t'orkestrel-debrief',\n\t'orkestrel-falsify',\n\t'orkestrel-harden',\n\t'orkestrel-journey',\n\t'orkestrel-parallel',\n\t'orkestrel-polish',\n])\n\n/** Names the inventory skeleton a workspace with declared service vendors is given once. */\nexport const SERVICE_SCRIPT_PATH = 'scripts/service.sh'\n\n/** Names the shared Vitest global-setup module whose presence makes a workspace `global`. */\nexport const GLOBAL_SETUP_PATH = 'tests/setupGlobal.ts'\n\n/** Names the package-owned guide-parity entry used by `test:guides` and to select the `guides` project. */\nexport const GUIDES_TEST_PATH = 'tests/guides.test.ts'\n\n/** Names the generated packed-package proof every publishing workspace is planned at. */\nexport const DISTRIBUTION_TEST_PATH = 'tests/distribution.test.ts'\n\n/** Names the content-owned harness imported by the generated distribution proof. */\nexport const DISTRIBUTION_SETUP_PATH = 'tests/setupDistribution.ts'\n\n/**\n * Names the `prepublishOnly` row that runs the packed-package proof against a real registry.\n *\n * @remarks\n * The proof reads `import.meta.env.MODE`, so without `--mode release` it passes\n * on an unreachable registry instead of failing. The row therefore has one home\n * and both the script compiler and the manifest region writer read it from here.\n */\nexport const RELEASE_PROOF_COMMAND = 'npm run test:distribution -- --mode release'\n\n/**\n * Names the cross-environment composition proof whose presence makes a workspace\n * `integration`.\n */\nexport const INTEGRATION_TEST_PATH = 'tests/integration.test.ts'\n\n/** Names the manifest path every compiler plan emits with birth ownership. */\nexport const MANIFEST_PATH = 'package.json'\n\n/** Names the official-tooling drift proof whose presence makes a workspace `conformance`. */\nexport const CONFORMANCE_TEST_PATH = 'tests/conformance.test.ts'\n\n/** Names the real-tree proof whose presence makes a workspace `tree`. */\nexport const TREE_TEST_PATH = 'tests/tree.test.ts'\n\n/** Names the live-service readiness module whose presence makes a workspace `service`. */\nexport const SERVICE_SETUP_PATH = 'tests/setupService.ts'\n\n/**\n * Names the include the live-service project covers, which is a directory rather than\n * one proof.\n */\nexport const SERVICE_TEST_INCLUDE = 'tests/service/**/*.test.ts'\n\n/**\n * Names the include the study project covers, where an exact-case `*.test.ts` file beneath\n * `tests/studies`, outside any `node_modules` or `.git` directory, makes a workspace `studies`.\n *\n * @remarks\n * The selector reads the include's population less Vitest's default exclude: an exact-case file\n * beneath `tests/studies`, nested or direct, whose name ends in `.test.ts`, outside any\n * `node_modules` or `.git` directory, which Vitest's default exclude never collects.\n */\nexport const STUDIES_TEST_INCLUDE = 'tests/studies/**/*.test.ts'\n\n/** Names the Vite wrapper whose presence makes a workspace `showcase`. */\nexport const SHOWCASE_CONFIG_PATH = 'configs/app/vite.showcase.config.ts'\n\n/** Names the Vite wrapper whose presence makes a workspace `journey`. */\nexport const JOURNEY_CONFIG_PATH = 'configs/app/vite.journey.config.ts'\n\n/** Names the TypeScript wrapper whose presence makes a workspace `skills`. */\nexport const SKILLS_CONFIG_PATH = 'configs/agents/tsconfig.skills.json'\n\n/** Matches the bare workspace name syntax: lowercase alphanumeric with hyphens, letter first. */\nexport const NAME_PATTERN = /^[a-z][a-z0-9-]*$/\n\n/**\n * Matches 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 resolving outside the directory\n * the mirror belongs in.\n */\nexport const DEPENDENCY_NAME_PATTERN = /^@orkestrel\\/[a-z][a-z0-9-]*$/\n\n/**\n * Matches the package name syntax for a dependency this package does not publish.\n *\n * @remarks\n * A foreign package is one this package does not publish, so its name reaches\n * no path. It may carry any scope or no scope at all. Each name segment begins\n * with an alphanumeric character after an optional leading `@`, and the name\n * carries at most one `/`. No segment can therefore be `..`, and no backslash\n * is admitted, so the shape cannot express a traversal.\n */\nexport const FOREIGN_NAME_PATTERN = /^(?:@[a-z0-9][a-z0-9._-]*\\/)?[a-z0-9][a-z0-9._-]*$/\n\n/** Matches the exact `major.minor.patch` version syntax a blueprint declares. */\nexport const VERSION_PATTERN = /^(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)$/\n\n/**\n * Matches 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/** Matches 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/**\n * Matches the exact `major.minor.patch` floor accepted for a foreign peer's range.\n *\n * @remarks\n * This is independent from {@link ENGINES_PATTERN}. An engine floors the Node\n * runtime a workspace supports, while a peer floors a tool the consumer\n * supplies. Either obligation may change without changing the other.\n */\nexport const FLOOR_RANGE_PATTERN = /^>=(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)$/\n\n/** Matches 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/** Matches exact lowercase hexadecimal bytes: two digits per byte, and empty content is valid. */\nexport const HEX_PATTERN = /^(?:[0-9a-f]{2})*$/\n\n/**\n * Matches the Unicode controls, formatting controls, and line and paragraph separators\n * rejected in text.\n */\nexport const CONTROL_CHARACTER_PATTERN = /[\\p{Cc}\\p{Cf}\\p{Zl}\\p{Zp}]/u\n\n/** Matches the visible characters a target-relative path and a Markdown path cell both forbid. */\nexport const INVALID_PATH_CHARACTER_PATTERN = /[<>:\"|?*\\\\]/\n\n/**\n * Caps the 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/** Sets the maximum dependency package name length, scope included, as the registry caps it. */\nexport const MAX_DEPENDENCY_NAME_LENGTH = 214\n\n/** Caps the length of one declared package range. */\nexport const MAX_RANGE_LENGTH = 2_048\n\n/** Caps the length of one manifest script name or command. */\nexport const MAX_SCRIPT_LENGTH = 4_096\n\n/** Caps the length of one path, matching the longest a supported filesystem accepts. */\nexport const MAX_PATH_LENGTH = 32_767\n\n/** Caps the items accepted in one public collection. */\nexport const MAX_COLLECTION_ITEMS = 1_000\n\n/** Caps the columns one emitted line may occupy, matching `printWidth` in `.oxfmtrc.json`. */\nexport const PRINT_WIDTH = 100\n\n/** Sets the columns one tab occupies when the formatter measures a line, matching `tabWidth`. */\nexport const TAB_WIDTH = 2\n\n/** Caps the findings one audit can produce from a bounded plan and snapshot. */\nexport const MAX_AUDIT_FINDINGS = MAX_COLLECTION_ITEMS * 2\n\n/** Caps the bytes accepted for one artifact. */\nexport const MAX_ARTIFACT_BYTES = 5_242_880\n\n/** Caps the length of the hexadecimal string carrying one artifact's bytes. */\nexport const MAX_ARTIFACT_HEX_LENGTH = MAX_ARTIFACT_BYTES * 2\n\n/**\n * Caps the decoded bytes accepted from one registry response.\n *\n * @remarks\n * The 2026-08-21 abbreviated-packument measurements were 8,647,138 bytes for\n * TypeScript, 8,077,438 for Playwright, 2,315,360 for `@types/node`, 2,298,256\n * for Vite, and 1,272,652 for Vitest. The bound leaves headroom above those\n * registry answers.\n */\nexport const MAX_REGISTRY_BYTES = 33_554_432\n\n/**\n * Caps the decoded bytes accepted across one registry-reading call.\n *\n * @remarks\n * The 2026-08-21 browser-workspace registry set measured about 24 MiB. The\n * bound leaves headroom for that set to grow without making a call unbounded.\n */\nexport const MAX_TOTAL_REGISTRY_BYTES = 100_663_296\n\n/** Caps the bytes accepted for one package or vendored-host manifest. */\nexport const MAX_MANIFEST_BYTES = 1_048_576\n\n/** Caps the bytes retained across one whole plan or audit. */\nexport const MAX_TOTAL_ARTIFACT_BYTES = 104_857_600\n\n/** Names the oldest Node version the generated toolchain supports. */\nexport const MINIMUM_NODE_VERSION = '22.18.0'\n\n/** Names the oldest npm version the generated toolchain supports. */\nexport const MINIMUM_NPM_VERSION = '11.6.0'\n\n/** Names the version a workspace starts at. */\nexport const DEFAULT_VERSION = '0.0.1'\n\n/** Names the `engines.node` range a workspace starts with. */\nexport const DEFAULT_ENGINES = `>=${MINIMUM_NODE_VERSION}`\n\n/**\n * Holds the `devEngines` record every generated manifest carries.\n *\n * @remarks\n * Every generated manifest names npm at the {@link MINIMUM_NPM_VERSION} floor with the `onFail`\n * key set to the `error` value, and no blueprint field varies that record. An npm at 10.9.0 or\n * later reads the `devEngines` record. Such an npm earlier than the floor refuses an install in a\n * generated workspace rather than resolving its dependency graph.\n * The neighbouring `DEFAULT_ENGINES` constant is the Node range, and a blueprint's `engines`\n * field does replace that one.\n */\nexport const WORKSPACE_DEV_ENGINES = Object.freeze({\n\tpackageManager: Object.freeze({\n\t\tname: 'npm',\n\t\tversion: `>=${MINIMUM_NPM_VERSION}`,\n\t\tonFail: 'error',\n\t}),\n})\n\n/** Holds the tooling versions scaffold and every generated workspace share. */\nexport const BASE_DEV_DEPENDENCIES: Readonly<Record<string, string>> = Object.freeze({\n\t'@orkestrel/guide': manifest.devDependencies['@orkestrel/guide'],\n\t'@orkestrel/probe': manifest.devDependencies['@orkestrel/probe'],\n\t'@orkestrel/scaffold': `^${manifest.version}`,\n\t'@orkestrel/test': manifest.devDependencies['@orkestrel/test'],\n\t'@types/node': manifest.devDependencies['@types/node'],\n\toxfmt: manifest.devDependencies.oxfmt,\n\toxlint: manifest.devDependencies.oxlint,\n\ttypescript: manifest.devDependencies.typescript,\n\tvite: manifest.devDependencies.vite,\n\tvitest: manifest.devDependencies.vitest,\n})\n\n/**\n * Lists the development dependencies that roll declarations up for published source.\n *\n * @remarks\n * The toolchain runs the compiler it already installs as a command, emitting one declaration per\n * module, and the extractor rolls that emit into the single file each published face ships.\n */\nexport const DECLARATION_DEV_DEPENDENCIES: Readonly<Record<string, string>> = Object.freeze({\n\t'@microsoft/api-extractor': manifest.devDependencies['@microsoft/api-extractor'],\n})\n\n/** Lists 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': manifest.devDependencies['@vitest/browser-playwright'],\n\tplaywright: manifest.devDependencies.playwright,\n})\n\n/**\n * Names the development dependency a browser or styles surface adds.\n *\n * @remarks\n * The package ships the `browse` binary, an MCP server that drives a rendered page and records\n * journeys, and `.claude/rules/quality.md` § Instruments names its registration.\n * `blueprintToDevDependencies` names the blueprints that receive it, and it withholds the\n * dependency from the workspaces {@link BROWSE_UPSTREAM} lists.\n */\nexport const BROWSE_DEV_DEPENDENCIES: Readonly<Record<string, string>> = Object.freeze({\n\t'@orkestrel/browser': manifest.devDependencies['@orkestrel/browser'],\n})\n\n/**\n * Lists the packages `@orkestrel/browser` depends on at runtime, directly or transitively, frozen.\n *\n * @remarks\n * A workspace this list names cannot declare `@orkestrel/browser`, because the declaration closes\n * a dependency cycle through the browser package's runtime dependencies. The list is the closure\n * of `dependencies` and `peerDependencies` over the installed manifests, sorted by name, and moves\n * with the `@orkestrel/browser` pin.\n */\nexport const BROWSE_UPSTREAM: readonly string[] = Object.freeze([\n\t'@orkestrel/abort',\n\t'@orkestrel/codec',\n\t'@orkestrel/contract',\n\t'@orkestrel/emitter',\n\t'@orkestrel/html',\n\t'@orkestrel/markdown',\n\t'@orkestrel/mcp',\n\t'@orkestrel/pool',\n\t'@orkestrel/process',\n\t'@orkestrel/router',\n\t'@orkestrel/server',\n\t'@orkestrel/sse',\n\t'@orkestrel/timeout',\n\t'@orkestrel/tool',\n\t'@orkestrel/websocket',\n])\n\n/** Names the development dependency every private `app` environment adds. */\nexport const APP_DEV_DEPENDENCIES: Readonly<Record<string, string>> = Object.freeze({\n\t'@orkestrel/contract': manifest.dependencies['@orkestrel/contract'],\n})\n\n/** Lists the development dependencies a private 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': manifest.devDependencies['@orkestrel/html'],\n})\n\n/**\n * Names the tested dependency pair selected 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'] // the showcase plugin range\n * ```\n */\nexport const SHOWCASE_DEV_DEPENDENCIES: Readonly<Record<string, string>> = Object.freeze({\n\t'vite-plugin-singlefile': '2.3.3',\n\tvite: manifest.devDependencies.vite,\n})\n\n/** Names the scoped npm override required by the tested showcase plugin. */\nexport const SHOWCASE_OVERRIDES: Readonly<Record<string, Readonly<Record<string, string>>>> =\n\tObject.freeze({\n\t\t[`vite-plugin-singlefile@${SHOWCASE_DEV_DEPENDENCIES['vite-plugin-singlefile']}`]:\n\t\t\tObject.freeze({\n\t\t\t\tmicromatch: 'npm:picomatch@2.3.2',\n\t\t\t}),\n\t})\n\n/** Lists the development dependencies a private server application adds. */\nexport const APP_SERVER_DEV_DEPENDENCIES: Readonly<Record<string, string>> = Object.freeze({\n\t'@orkestrel/emitter': manifest.dependencies['@orkestrel/emitter'],\n\t'@orkestrel/middleware': '^0.0.16',\n\t'@orkestrel/router': '^0.0.10',\n\t'@orkestrel/server': '^0.0.14',\n})\n","import {\n\tBIN_ENTRY_PATH,\n\tCONFORMANCE_TEST_PATH,\n\tTREE_TEST_PATH,\n\tDISTRIBUTION_TEST_PATH,\n\tGUIDES_TEST_PATH,\n\tINTEGRATION_TEST_PATH,\n\tSERVICE_TEST_INCLUDE,\n\tSTUDIES_TEST_INCLUDE,\n} from './constants.js'\n\n/**\n * Holds 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{{paths}}\n\t},\n\t\"exclude\": [\"node_modules\", \"dist\", \"tmp\"]\n}\n`,\n\t\t// The manifest import and the `peers` derivation this template emits are\n\t\t// fixed, where `{{imports}}`, `{{helpers}}`, and `{{browsers}}` are selected.\n\t\t// One fixed block costs less than a fifth conditional span, and a workspace\n\t\t// that builds nothing carries one export nothing reads.\n\t\tvite: `{{journey}}import type { PluginOption, UserConfig } from 'vite'\nimport { mergeConfig } from 'vite'\n{{imports}}import { defineConfig } from 'vitest/config'\nimport manifest from './package.json' with { type: 'json' }\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 peerDependencies = 'peerDependencies' in manifest ? manifest.peerDependencies : undefined\nif (\n\tpeerDependencies !== undefined &&\n\t(typeof peerDependencies !== 'object' ||\n\t\tpeerDependencies === null ||\n\t\tArray.isArray(peerDependencies))\n) {\n\tthrow new Error('package peerDependencies must be an object')\n}\nexport const peers: readonly string[] =\n\tpeerDependencies === undefined ? [] : Object.keys(peerDependencies)\n\nconst resolve = {\n\talias: Object.fromEntries(\n\t\tObject.entries(tsconfig.compilerOptions.paths).map(([key, values]) => {\n\t\t\tconst [path] = values\n\t\t\tif (path === undefined) throw new Error('tsconfig path alias ' + key + ' has no target')\n\t\t\treturn [key, resolveWorkspacePath(path)]\n\t\t}),\n\t),\n}\n\n// Merges a caller's override onto the configuration a factory declares, so a\n// package's own configuration reaches the factory through its parameter instead of\n// wrapping the call from outside.\n//\n// Vitest calls every registered project factory with its own invocation record —\n// \\`command\\`, \\`mode\\`, \\`isSsrBuild\\`, \\`isPreview\\` — so a factory that also takes an\n// override receives that record in the same position. A \\`UserConfig\\` declares \\`mode\\`\n// but not \\`command\\`, and the invocation record always carries both, so a value\n// carrying the pair is that record rather than an override. The merge returns the\n// base in the record's \\`mode\\` and carries none of the record's other fields. Vitest\n// runs a project that declares no \\`mode\\` in its own run mode, \\`test\\`, rather than in\n// the \\`--mode\\` value it was invoked with, so a distribution proof run with\n// \\`--mode release\\` would read \\`test\\` and skip where it must fail. A record whose\n// \\`mode\\` is not a string throws. The \\`tests/config.test.ts\\` file drives every\n// registered factory through it.\n//\n// \\`mergeConfig\\` concatenates arrays, so an override carrying \\`plugins\\` would otherwise\n// add a second copy of a plugin the base already declares. Only named top-level\n// objects replace a base plugin of the same name, in the base's position, and one\n// override entry is taken at most once. An entry no base position took appends in its\n// written order; the caller's own entries never merge with each other. Nested arrays,\n// promises, falsy entries, and anonymous objects pass through unchanged. An override\n// cannot remove a base plugin. Every key other than \\`plugins\\` merges as \\`mergeConfig\\`\n// merges it, so an override's arrays elsewhere concatenate with the base's rather than\n// replacing them.\nexport function mergeOverride(base: UserConfig, override?: UserConfig): UserConfig {\n\tif (\n\t\toverride !== undefined &&\n\t\t'command' in override &&\n\t\t'mode' in override &&\n\t\ttypeof override.mode !== 'string'\n\t) {\n\t\tthrow new Error('The project invocation carries no string mode')\n\t}\n\tconst effective: UserConfig | undefined =\n\t\toverride !== undefined && 'command' in override && typeof override.mode === 'string'\n\t\t\t? { mode: override.mode }\n\t\t\t: override\n\tconst merged: UserConfig = effective === undefined ? { ...base } : mergeConfig(base, effective)\n\tconst name = merged.test?.name\n\tconst label = typeof name === 'string' ? name : name?.label\n\tconst browser = merged.test?.browser\n\tconst named: UserConfig =\n\t\tlabel !== undefined && browser?.instances !== undefined\n\t\t\t? {\n\t\t\t\t\t...merged,\n\t\t\t\t\ttest: {\n\t\t\t\t\t\t...merged.test,\n\t\t\t\t\t\tbrowser: {\n\t\t\t\t\t\t\t...browser,\n\t\t\t\t\t\t\tinstances: browser.instances.map((instance) => ({\n\t\t\t\t\t\t\t\t...instance,\n\t\t\t\t\t\t\t\tname: instance.name ?? \\`\\${label} (\\${instance.browser})\\`,\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: merged\n\tif (named.plugins === undefined || effective === undefined) return named\n\tconst candidates = [...(effective.plugins ?? [])]\n\tconst bases = [...(base.plugins ?? [])]\n\t// A base plugin takes the first candidate of its own name that no earlier base plugin took, and\n\t// candidates of other names never compete for it, so its pick is the candidate whose rank among\n\t// its name equals the number of earlier base plugins sharing that name.\n\tconst chosen = bases.map((plugin, position) =>\n\t\tisNamedPlugin(plugin)\n\t\t\t? candidates\n\t\t\t\t\t.flatMap((candidate, index) =>\n\t\t\t\t\t\tisNamedPlugin(candidate) && candidate.name === plugin.name ? [index] : [],\n\t\t\t\t\t)\n\t\t\t\t\t.at(\n\t\t\t\t\t\tbases\n\t\t\t\t\t\t\t.slice(0, position)\n\t\t\t\t\t\t\t.filter((earlier) => isNamedPlugin(earlier) && earlier.name === plugin.name).length,\n\t\t\t\t\t)\n\t\t\t: undefined,\n\t)\n\treturn {\n\t\t...named,\n\t\tplugins: [\n\t\t\t...bases.map((plugin, position) => {\n\t\t\t\tconst index = chosen[position]\n\t\t\t\treturn index === undefined ? plugin : (candidates[index] ?? plugin)\n\t\t\t}),\n\t\t\t...candidates.filter((_, index) => !chosen.includes(index)),\n\t\t],\n\t}\n}\n\nfunction isNamedPlugin(plugin: PluginOption): plugin is { name: string } {\n\treturn (\n\t\ttypeof plugin === 'object' &&\n\t\tplugin !== null &&\n\t\t!Array.isArray(plugin) &&\n\t\t!('then' in plugin && typeof plugin.then === 'function') &&\n\t\t'name' in plugin &&\n\t\ttypeof plugin.name === 'string'\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\tsheet: `export function sheetProject(name: string, override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\toptimizeDeps,\n\t\tpublicDir: false,\n\t\ttest: {\n\t\t\tname: { label: name, color: 'magenta' },\n\t\t\troot: resolveWorkspacePath('.'),\n\t\t\tisolate: false,\n\t\t\tsetupFiles: [\n\t\t\t\t'./tests/setup.ts',\n\t\t\t\t'./tests/setupBrowser.ts',\n\t\t\t\t...(existsSync(resolveWorkspacePath('tests/setupStyles.ts'))\n\t\t\t\t\t? ['./tests/setupStyles.ts']\n\t\t\t\t\t: []),\n\t\t\t],\n\t\t\tbrowser: {\n\t\t\t\tenabled: true,\n\t\t\t\tprovider: playwright(browserOptions),\n\t\t\t\tcommands,\n\t\t\t\tinstances: [{ browser: 'chromium', headless: true }],\n\t\t\t},\n\t\t\tfileParallelism: false,\n\t\t\tsequence: { groupOrder: 1 },\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\tsrc: Object.freeze({\n\t\t\tcore: `export function srcCore(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\tpublicDir: false,\n\t\tbuild: {\n\t\t\temptyOutDir: true,\n\t\t\tsourcemap: true,\n\t\t\tminify: false,\n\t\t\trolldownOptions: { onLog: enforceBuildLog },\n\t\t},\n\t\ttest: {\n\t\t\tname: { label: 'src:core', color: 'magenta' },\n\t\t\tinclude: ['tests/src/core/**/*.test.ts'],\n\t\t\tsetupFiles: ['./tests/setup.ts'],\n\t\t\tenvironment: 'node',\n\t\t\tbrowser: { enabled: false },\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\t\tvue: `function resolveVueFilename(): string {\n\treturn 'index.js'\n}\n\nexport function srcVue(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\toptimizeDeps: { include: [...optimizeDeps.include, 'vue'] },\n\t\tpublicDir: false,\n\t\tplugins: [outputBoundary('dist/src/vue'), environmentBoundary('src/vue'), vue()],\n\t\tbuild: {\n\t\t\temptyOutDir: true,\n\t\t\tsourcemap: true,\n\t\t\tminify: false,\n\t\t\tlib: {\n\t\t\t\tentry: resolveWorkspacePath('src/vue/index.ts'),\n\t\t\t\tformats: ['es'],\n\t\t\t\tfileName: resolveVueFilename,\n\t\t\t},\n\t\t\toutDir: 'dist/src/vue',\n\t\t\trolldownOptions: { onLog: enforceBuildLog },\n\t\t},\n\t\ttest: {\n\t\t\tname: { label: 'src:vue', color: 'green' },\n\t\t\tinclude: ['tests/src/vue/**/*.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\tcommands,\n\t\t\t\tinstances: [{ browser: 'chromium', headless: true }],\n\t\t\t},\n\t\t\tfileParallelism: false,\n\t\t\tsequence: { groupOrder: 1 },\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\t\tbrowser: `function resolveBrowserFilename(): string {\n\treturn 'index.js'\n}\n\nexport function srcBrowser(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\toptimizeDeps,\n\t\tpublicDir: false,\n\t\tplugins: [outputBoundary('dist/src/browser'), environmentBoundary('src/browser')],\n\t\tbuild: {\n\t\t\temptyOutDir: true,\n\t\t\tsourcemap: true,\n\t\t\tminify: false,\n\t\t\tlib: {\n\t\t\t\tentry: resolveWorkspacePath('src/browser/index.ts'),\n\t\t\t\tformats: ['es'],\n\t\t\t\tfileName: resolveBrowserFilename,\n\t\t\t},\n\t\t\toutDir: 'dist/src/browser',\n\t\t\trolldownOptions: {\n\t\t\t\tonLog: enforceBuildLog,\n\t\t\t\t{{external}}\n{{output}}\n\t\t\t},\n\t\t},\n\t\ttest: {\n\t\t\tname: { label: 'src:browser', color: 'yellow' },\n\t\t\tinclude: ['tests/src/browser/**/*.test.ts'],\n{{exclude}}\t\t\tsetupFiles: ['./tests/setup.ts', './tests/setupBrowser.ts'],\n{{global}}\n\t\t\tbrowser: {\n\t\t\t\tenabled: true,\n\t\t\t\tprovider: playwright(browserOptions),\n\t\t\t\tcommands,\n\t\t\t\tinstances: [{ browser: 'chromium', headless: true }],\n\t\t\t},\n\t\t\tfileParallelism: false,\n\t\t\tsequence: { groupOrder: 1 },\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\t\tserver: `function resolveServerFilename(format: string): string {\n\treturn format === 'es' ? 'index.js' : 'index.cjs'\n}\n\nexport function srcServer(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\tpublicDir: false,\n\t\tplugins: [outputBoundary('dist/src/server'), environmentBoundary('src/server')],\n\t\tbuild: {\n\t\t\temptyOutDir: true,\n\t\t\tsourcemap: true,\n\t\t\tminify: false,\n\t\t\tlib: {\n\t\t\t\tentry: resolveWorkspacePath('src/server/index.ts'),\n\t\t\t\tformats: ['es', 'cjs'],\n\t\t\t\tfileName: resolveServerFilename,\n\t\t\t},\n\t\t\toutDir: 'dist/src/server',\n\t\t\ttarget: 'node22',\n\t\t\trolldownOptions: {\n\t\t\t\tonLog: enforceBuildLog,\n\t\t\t\tplatform: 'node',\n\t\t\t\t{{external}}\n{{output}}\n\t\t\t},\n\t\t},\n\t\ttest: {\n\t\t\tname: { label: 'src:server', color: 'red' },\n\t\t\tinclude: ['tests/src/server/**/*.test.ts'],\n{{exclude}}\t\t\tsetupFiles: ['./tests/setup.ts', './tests/setupServer.ts'],\n\t\t\tenvironment: 'node',\n\t\t\tbrowser: { enabled: false },\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\t\tbin: `function resolveBinFilename(): string {\n\treturn 'main.js'\n}\n\nfunction resolveBinExternal(id: string): boolean {\n\treturn id.startsWith('@src/') || resolveExternal(id, { peers, refused: [], siblings: [] })\n}\n\nexport function srcBin(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\tpublicDir: false,\n\t\tplugins: [outputBoundary('dist/bin')],\n\t\tbuild: {\n\t\t\temptyOutDir: true,\n\t\t\tsourcemap: true,\n\t\t\tminify: false,\n\t\t\tlib: {\n\t\t\t\tentry: resolveWorkspacePath('${BIN_ENTRY_PATH}'),\n\t\t\t\tformats: ['es'],\n\t\t\t\tfileName: resolveBinFilename,\n\t\t\t},\n\t\t\toutDir: 'dist/bin',\n\t\t\ttarget: 'node22',\n\t\t\trolldownOptions: {\n\t\t\t\tonLog: enforceBuildLog,\n\t\t\t\texternal: resolveBinExternal,\n\t\t\t},\n\t\t},\n\t\ttest: {\n\t\t\tname: { label: 'src:bin', color: 'yellow' },\n\t\t\tinclude: ['tests/src/bin/**/*.test.ts'],\n\t\t\tsetupFiles: ['./tests/setup.ts', './tests/setupServer.ts'],\n\t\t\tenvironment: 'node',\n\t\t\tbrowser: { enabled: false },\n\t\t\t// A bin test drives the real executable over a real temporary repository, so it\n\t\t\t// spends seconds in process startup and filesystem work rather than milliseconds.\n\t\t\t// Vitest's five-second default clears one alone and times out under a full suite.\n\t\t\ttestTimeout: 15_000,\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\t}),\n\t\tapp: Object.freeze({\n\t\t\tcore: `export function appCore(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\tpublicDir: false,\n\t\tplugins: [environmentBoundary('app/core')],\n\t\ttest: {\n\t\t\tname: { label: 'app:core', color: 'cyan' },\n\t\t\tinclude: ['tests/app/core/**/*.test.ts'],\n\t\t\tsetupFiles: ['./tests/setup.ts'],\n\t\t\tenvironment: 'node',\n\t\t\tbrowser: { enabled: false },\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\t\tbrowser: `export function appBrowser(override?: UserConfig): UserConfig {\n\tconst output = 'dist/app/browser'\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\toptimizeDeps,\n\t\tplugins: [outputBoundary(output), environmentBoundary('app/browser')],\n\t\troot: resolveWorkspacePath('app/browser'),\n\t\tpublicDir: false,\n\t\tbuild: {\n\t\t\tassetsInlineLimit: 0,\n\t\t\temptyOutDir: true,\n\t\t\toutDir: resolveWorkspacePath(output),\n\t\t\trolldownOptions: {\n\t\t\t\tonLog: enforceBuildLog,\n\t\t\t\tinput: resolveWorkspacePath('app/browser/index.html'),\n\t\t\t},\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{{journeyExclude}}\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\tcommands,\n\t\t\t\tinstances: [{ browser: 'chromium', headless: true }],\n\t\t\t},\n\t\t\tfileParallelism: false,\n\t\t\tsequence: { groupOrder: 1 },\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n{{showcaseFactory}}{{journeyFactory}}`,\n\t\t\tvue: `export function appVue(override?: UserConfig): UserConfig {\n\tconst output = 'dist/app/vue'\n\tconst browser = appBrowser()\n\tconst project: UserConfig = {\n\t\t...browser,\n\t\toptimizeDeps: { include: [...optimizeDeps.include, 'vue'] },\n\t\tplugins: [outputBoundary(output), environmentBoundary('app/vue'), vue()],\n\t\troot: resolveWorkspacePath('app/vue'),\n\t\tbuild: {\n\t\t\t...browser.build,\n\t\t\toutDir: resolveWorkspacePath(output),\n\t\t\trolldownOptions: {\n\t\t\t\t...browser.build?.rolldownOptions,\n\t\t\t\tinput: resolveWorkspacePath('app/vue/index.html'),\n\t\t\t},\n\t\t},\n\t\ttest: {\n\t\t\t...browser.test,\n\t\t\tname: { label: 'app:vue', color: 'magenta' },\n\t\t\tbrowser: {\n\t\t\t\t...browser.test?.browser,\n\t\t\t\tinstances: (browser.test?.browser?.instances ?? []).map(\n\t\t\t\t\t({ name: _name, ...instance }) => instance,\n\t\t\t\t),\n\t\t\t},\n\t\t\tinclude: ['tests/app/vue/**/*.test.ts'],\n{{journeyExclude}}\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\t\tjourney: `\n// Replace the journey fields directly: merging would concatenate the ordinary include\n// and retain the exclusion of the journey suite.\nexport function appJourney(\n\tvariant: JourneyVariant,\n\tvariants: readonly JourneyVariant[],\n\tmode?: string,\n): UserConfig {\n\tconst application = resolveApplication(mode, applications)\n\tconst browser = applications[application]()\n\tconst project: UserConfig = {\n\t\t...browser,\n\t\ttest: {\n\t\t\t...browser.test,\n\t\t\tname: { label: \\`journey:\\${variant.name}\\`, color: 'green' },\n\t\t\tinclude: [\\`tests/app/\\${application}/integration.test.ts\\`],\n\t\t\texclude: [],\n\t\t\tprovide: { variant: variant.name, variants, capture },\n\t\t\tbrowser: {\n\t\t\t\t...browser.test?.browser,\n\t\t\t\tenabled: true,\n\t\t\t\tviewport: { width: variant.width, height: variant.height },\n\t\t\t\tinstances: (browser.test?.browser?.instances ?? []).map(\n\t\t\t\t\t({ name: _name, ...instance }) => instance,\n\t\t\t\t),\n\t\t\t},\n\t\t},\n\t}\n\treturn mergeOverride(project)\n}\n`,\n\t\t\t// A showcase is the browser application written to its own output, so it composes\n\t\t\t// on `appBrowser` and declares only what it changes. Its output boundary carries\n\t\t\t// the plugin name the browser boundary carries, so the merge replaces that\n\t\t\t// boundary rather than adding a second one.\n\t\t\tshowcase: `\nconst showcaseStamp: PluginOption = {\n\tname: 'orkestrel-showcase-html',\n\tenforce: 'post',\n\tgenerateBundle(_, bundle) {\n\t\tfor (const file of Object.values(bundle)) {\n\t\t\tif (\n\t\t\t\tfile.type === 'asset' &&\n\t\t\t\ttypeof file.source === 'string' &&\n\t\t\t\tfile.fileName.endsWith('.html')\n\t\t\t) {\n\t\t\t\tfile.source = stampPage(file.source)\n\t\t\t}\n\t\t}\n\t},\n}\n\nfunction createShowcaseNaming(application: string): PluginOption {\n\treturn {\n\t\tname: 'orkestrel-showcase-name',\n\t\tenforce: 'post',\n\t\twriteBundle(options) {\n\t\t\tif (options.dir === undefined) throw new Error('The showcase output is absent.')\n\t\t\trenameSync(\n\t\t\t\tresolvePath(options.dir, 'index.html'),\n\t\t\t\tresolvePath(options.dir, application + '.html'),\n\t\t\t)\n\t\t},\n\t}\n}\n\nexport function appShowcase(mode: string, override?: UserConfig): UserConfig {\n\tconst application = resolveApplication(mode, applications)\n\tconst output = 'showcase'\n\tconst showcase: UserConfig = {\n\t\tplugins: [\n\t\t\toutputBoundary(output),\n\t\t\tviteSingleFile({\n\t\t\t\tremoveViteModuleLoader: true,\n\t\t\t\tuseRecommendedBuildConfig: true,\n\t\t\t}),\n\t\t\tshowcaseStamp,\n\t\t\tcreateShowcaseNaming(application),\n\t\t],\n\t\tbuild: {\n\t\t\t// The \\`appBrowser\\` factory sets \\`assetsInlineLimit\\` to 0, so every asset becomes\n\t\t\t// its own file, and 4096 is Vite's own default put back. The \\`viteSingleFile\\`\n\t\t\t// plugin overwrites the value while the \\`useRecommendedBuildConfig\\` option stays\n\t\t\t// true, so this line takes effect only in a workspace that turns that option off.\n\t\t\tassetsInlineLimit: 4096,\n\t\t\tcssMinify: 'lightningcss',\n\t\t\temptyOutDir: false,\n\t\t\tminify: 'oxc',\n\t\t\tmodulePreload: false,\n\t\t\toutDir: resolveWorkspacePath(output),\n\t\t\treportCompressedSize: false,\n\t\t\tsourcemap: false,\n\t\t\ttarget: 'esnext',\n\t\t},\n\t}\n\treturn applications[application](mergeOverride(showcase, override))\n}\n`,\n\t\t\tserver: `function resolveAppFilename(): string {\n\treturn 'main.cjs'\n}\n\nfunction resolveAppExternal(id: string): boolean {\n\treturn id.startsWith('node:')\n}\n\nexport function appServer(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\tpublicDir: false,\n\t\tplugins: [outputBoundary('dist/app/server'), environmentBoundary('app/server')],\n\t\tbuild: {\n\t\t\temptyOutDir: true,\n\t\t\tlib: {\n\t\t\t\tentry: resolveWorkspacePath('app/server/main.ts'),\n\t\t\t\tformats: ['cjs'],\n\t\t\t\tfileName: resolveAppFilename,\n\t\t\t},\n\t\t\toutDir: resolveWorkspacePath('dist/app/server'),\n\t\t\ttarget: 'node22',\n\t\t\trolldownOptions: {\n\t\t\t\tonLog: enforceBuildLog,\n\t\t\t\texternal: resolveAppExternal,\n\t\t\t},\n\t\t},\n\t\ttest: {\n\t\t\tname: { label: 'app:server', color: 'green' },\n\t\t\tinclude: ['tests/app/server/**/*.test.ts'],\n\t\t\tsetupFiles: ['./tests/setup.ts', './tests/setupServer.ts'],\n\t\t\tenvironment: 'node',\n\t\t\tbrowser: { enabled: false },\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\t}),\n\t\tpolicy: `export function policy(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\ttest: {\n\t\t\tname: { label: 'policy', color: 'white' },\n\t\t\tinclude: ['tests/policy.test.ts'],\n\t\t\tsetupFiles: ['./tests/setup.ts'],\n\t\t\tenvironment: 'node',\n\t\t\tbrowser: { enabled: false },\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\tconfig: `export function config(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\ttest: {\n\t\t\tname: { label: 'config', color: 'yellow' },\n\t\t\tinclude: ['tests/config.test.ts'],\n\t\t\tsetupFiles: ['./tests/setup.ts'],\n\t\t\tenvironment: 'node',\n\t\t\tbrowser: { enabled: false },\n\t\t\t// A config test validates every target wrapper, spawns the real linter twice under\n\t\t\t// 15-second child caps, and rolls one face up through the compiler and the extractor it\n\t\t\t// spawns, so this budget clears the capped pair with room for a contended host.\n\t\t\ttestTimeout: 60_000,\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\tsetup: `export function setup(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\ttest: {\n\t\t\tname: { label: 'setup', color: 'white' },\n\t\t\tinclude: ['tests/setup*.test.ts'],\n\t\t\texclude: ['tests/setupBrowser.test.ts', 'tests/setupStyles.test.ts'],\n\t\t\tsetupFiles: ['./tests/setup.ts'],\n\t\t\tpool: 'threads',\n\t\t\tisolate: false,\n\t\t\tenvironment: 'node',\n\t\t\tbrowser: { enabled: false },\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\tbrowser: `export function setupBrowser(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\t{{optimization}},\n{{plugins}}\t\ttest: {\n\t\t\tname: { label: 'setup:browser', color: 'blue' },\n\t\t\tinclude: ['tests/setupBrowser.test.ts', 'tests/setupStyles.test.ts'],\n\t\t\tsetupFiles: ['./tests/setup.ts', './tests/setupBrowser.ts'],\n{{global}}\t\t\tbrowser: {\n\t\t\t\tenabled: true,\n\t\t\t\tprovider: playwright(browserOptions),\n\t\t\t\tcommands,\n\t\t\t\tinstances: [{ browser: 'chromium', headless: true }],\n\t\t\t},\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\tguides: `export function guides(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\ttest: {\n\t\t\tname: { label: 'guides', color: 'green' },\n\t\t\tinclude: ['${GUIDES_TEST_PATH}'],\n\t\t\texclude: ['tests/src/**/*.test.ts', 'tests/app/**/*.test.ts', 'tests/setup.test.ts'],\n\t\t\tsetupFiles: ['./tests/setup.ts'],\n\t\t\tenvironment: 'node',\n\t\t\tbrowser: { enabled: false },\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\tskills: `// The skill scripts this package ships as canon, each driven as a child process against a\n// scratch fixture from its mirrored proof under \\`tests/agents/skills/<skill>/scripts/\\`. The\n// \\`configs/agents/tsconfig.skills.json\\` wrapper selects the project.\nexport function skills(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\ttest: {\n\t\t\tname: { label: 'skills', color: 'blue' },\n\t\t\tinclude: ['tests/agents/**/*.test.ts'],\n\t\t\tsetupFiles: ['./tests/setup.ts'],\n\t\t\tenvironment: 'node',\n\t\t\tbrowser: { enabled: false },\n\t\t\t// Each case spawns node on a script; a census case runs \\`vitest list\\` over this checkout.\n\t\t\ttestTimeout: 60_000,\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\ttree: `// The laws this package states about its own real tree.\n// Standalone Node proof; reads the tree without a build, install, or service.\nexport function tree(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\ttest: {\n\t\t\tname: { label: 'tree', color: 'magenta' },\n\t\t\tinclude: ['${TREE_TEST_PATH}'],\n\t\t\tsetupFiles: ['./tests/setup.ts', './tests/setupServer.ts'],\n\t\t\tpool: 'threads',\n\t\t\tisolate: false,\n\t\t\tenvironment: 'node',\n\t\t\tbrowser: { enabled: false },\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\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 function conformance(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\ttest: {\n\t\t\tname: { label: 'conformance', color: 'magenta' },\n\t\t\tinclude: ['${CONFORMANCE_TEST_PATH}'],\n\t\t\tsetupFiles: ['./tests/setup.ts', './tests/setupServer.ts'],\n\t\t\tpool: 'threads',\n\t\t\tisolate: false,\n\t\t\tenvironment: 'node',\n\t\t\tbrowser: { enabled: false },\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\tservice: `// The caller prepares the live external services before this project.\n// \\`tests/setupService.ts\\` verifies readiness, and the project stays out of \\`npm test\\`\n// because a real service answers it.\nexport function service(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\ttest: {\n\t\t\tname: { label: 'service', color: 'red' },\n\t\t\tinclude: ['${SERVICE_TEST_INCLUDE}'],\n\t\t\tsetupFiles: ['./tests/setup.ts', './tests/setupService.ts'],\n\t\t\tenvironment: 'node',\n\t\t\tbrowser: { enabled: false },\n\t\t\ttestTimeout: 120_000,\n\t\t\thookTimeout: 120_000,\n\t\t\tfileParallelism: false,\n\t\t\tsequence: { groupOrder: 1 },\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\tstudies: `// Authored study proofs run installed packages through bounded subprocesses and protocol fixtures,\n// so this project is isolated in its own gate script, test:studies.\nexport function studies(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\ttest: {\n\t\t\tname: { label: 'studies', color: 'red' },\n\t\t\tinclude: ['${STUDIES_TEST_INCLUDE}'],\n\t\t\tsetupFiles: ['./tests/setup.ts'],\n\t\t\tenvironment: 'node',\n\t\t\tbrowser: { enabled: false },\n\t\t\ttestTimeout: 120_000,\n\t\t\thookTimeout: 120_000,\n\t\t\tfileParallelism: false,\n\t\t\tsequence: { groupOrder: 1 },\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\tdistribution: `export function distribution(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\ttest: {\n\t\t\tname: { label: 'distribution', color: 'cyan' },\n\t\t\tinclude: ['${DISTRIBUTION_TEST_PATH}'],\n\t\t\tsetupFiles: ['./tests/setup.ts'],\n\t\t\tenvironment: 'node',\n\t\t\ttestTimeout: 120_000,\n\t\t\thookTimeout: 120_000,\n\t\t\tfileParallelism: false,\n\t\t\tsequence: { groupOrder: 1 },\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\tprobe: `// A workbench, not a proof. No gate selects this project. Run in test mode by the\n// \\`test:probe\\` script, it collects \\`tmp/probes/**/*.test.ts\\`. Run in benchmark mode by the\n// \\`test:bench\\` script, the same workbench also collects \\`tests/**/*.test.ts\\` for a \\`bench\\` block,\n// so a suite may carry a bench beside its ordinary tests without a second project. The mode\n// guard around each \\`bench\\` call keeps it out of test mode, so it never executes there.\nexport function probe(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\ttest: {\n\t\t\tname: { label: 'probe', color: 'black' },\n\t\t\tinclude: ['tmp/probes/**/*.test.ts'],\n\t\t\tsetupFiles: ['./tests/setup.ts'],\n\t\t\tenvironment: 'node',\n\t\t\tbrowser: { enabled: false },\n\t\t\tfileParallelism: false,\n\t\t\tsequence: { groupOrder: 1 },\n\t\t\tpool: 'threads',\n\t\t\tbenchmark: { include: ['tmp/probes/**/*.test.ts', 'tests/**/*.test.ts'] },\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\tintegration: Object.freeze({\n\t\t\tsheet: `export function integration(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\ttest: {\n\t\t\tinclude: ['tests/integration.test.ts'],\n{{global}}\t\t},\n\t}\n\treturn sheetProject('integration', mergeOverride(project, override))\n}\n`,\n\t\t\tmodule: `export function integration(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\ttest: {\n\t\t\tname: { label: 'integration', color: 'blue' },\n\t\t\tinclude: ['${INTEGRATION_TEST_PATH}'],\n\t\t\tsetupFiles: ['./tests/setup.ts'],\n{{global}}\t\t\tenvironment: 'node',\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\t}),\n\t}),\n\ttsconfigs: Object.freeze({\n\t\tvue: Object.freeze({\n\t\t\tsrc: `{\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/vue/**/*.cts\",\n\t\t\"../../src/vue/**/*.mts\",\n\t\t\"../../src/vue/**/*.ts\",\n\t\t\"../../src/vue/**/*.tsx\"\n\t]\n}\n`,\n\t\t\tapp: `{\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}),\n\t\tsheet: `{\n\t\"extends\": \"../../tsconfig.json\",\n\t\"compilerOptions\": {\n\t\t\"lib\": [\"ESNext\"],\n\t\t\"types\": [\"vite/client\"],\n\t\t\"noEmit\": true\n\t},\n\t\"include\": [\"../../src/{{name}}/**/*.ts\"]\n}\n`,\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\"]\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\tskills: `{\n\t\"extends\": \"../../tsconfig.json\",\n\t\"compilerOptions\": {\n\t\t\"lib\": [\"ESNext\"],\n\t\t\"types\": [\"node\"]\n\t},\n\t\"include\": [\"../../.agents/skills/*/scripts/*.ts\"],\n\t\"exclude\": [\"../../node_modules\"]\n}\n`,\n\t}),\n\tvites: Object.freeze({\n\t\tsheet: `import { defineConfig } from 'vitest/config'\nimport { outputBoundary } from '../helpers.js'\nimport { resolveWorkspacePath, sheetProject } from '../../vite.config.ts'\n\nexport default defineConfig((invocation) => {\n\tconst project = sheetProject('src:{{label}}', {\n\t\tplugins: [outputBoundary('dist/src/{{name}}')],\n\t\tbuild: {\n\t\t\toutDir: 'dist/src/{{name}}',\n\t\t\temptyOutDir: true,\n\t\t\t// Preserve the authored layer-order statement in the published sheet.\n\t\t\tcssMinify: false,\n\t\t\tlib: {\n\t\t\t\tentry: resolveWorkspacePath('src/{{name}}/sheet.ts'),\n\t\t\t\tformats: ['es'],\n\t\t\t\tfileName: 'index',\n\t\t\t\tcssFileName: 'index',\n\t\t\t},\n\t\t},\n\t\ttest: { include: ['tests/src/{{name}}/**/*.test.ts'] },\n\t})\n\treturn { ...project, mode: invocation.mode }\n})\n`,\n\t\tsrc: Object.freeze({\n\t\t\tcore: `import { defineConfig } from 'vite'\nimport {\n\tdeclarationRollup,\n\tenvironmentBoundary,\n\toutputBoundary,\n\tresolveExternal,\n} from '../helpers.js'\nimport { peers, 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\tdeclarationRollup({\n\t\t\t\tproject: resolveWorkspacePath('configs/src/tsconfig.core.json'),\n\t\t\t\ttypes: ['node'],\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: string) => (format === 'es' ? 'index.js' : 'index.cjs'),\n\t\t\t},\n\t\t\toutDir: 'dist/src/core',\n\t\t\trolldownOptions: {\n\t\t\t\texternal: (id: string) => resolveExternal(id, { peers, refused: [], siblings: [] }),\n\t\t\t},\n\t\t},\n\t}),\n)\n`,\n\t\t\tvue: `import { defineConfig } from 'vite'\nimport {\n\tdeclarationRollup,\n\tresolveExternal,\n\trewriteBrowserSpecifier,\n\trewriteCoreSpecifier,\n} from '../helpers.js'\nimport { peers, srcVue, resolveWorkspacePath } from '../../vite.config.ts'\n\nconst siblings = {\n{{siblings}}\n}\n\nexport default defineConfig(\n\tsrcVue({\n\t\tplugins: [\n\t\t\tdeclarationRollup({\n\t\t\t\tproject: resolveWorkspacePath('configs/src/tsconfig.vue.json'),\n\t\t\t\trewrite: (content) => rewriteBrowserSpecifier(rewriteCoreSpecifier(content)),\n\t\t\t}),\n\t\t],\n\t\tbuild: {\n\t\t\trolldownOptions: {\n\t\t\t\texternal: (id: string) =>\n\t\t\t\t\tresolveExternal(id, {\n\t\t\t\t\t\tpeers,\n\t\t\t\t\t\trefused: {{refused}},\n\t\t\t\t\t\tsiblings: Object.keys(siblings),\n\t\t\t\t\t}),\n\t\t\t\toutput: { paths: siblings },\n\t\t\t},\n\t\t},\n\t}),\n)\n`,\n\t\t\tbrowser: `import { defineConfig } from 'vite'\nimport { declarationRollup, rewriteCoreSpecifier } from '../helpers.js'\nimport { srcBrowser, resolveWorkspacePath } from '../../vite.config.ts'\n\n// The roll-up reaches src/core through a specifier the tarball does not carry, so the rewrite\n// externalizes core through the package's own published root export, on the final roll-up alone.\nexport default defineConfig(\n\tsrcBrowser({\n\t\tplugins: [\n\t\t\tdeclarationRollup({\n\t\t\t\tproject: resolveWorkspacePath('configs/src/tsconfig.browser.json'),\n\t\t\t\trewrite: rewriteCoreSpecifier,\n\t\t\t}),\n\t\t],\n\t}),\n)\n`,\n\t\t\tserver: `import { defineConfig } from 'vite'\nimport { declarationRollup, rewriteCoreSpecifier } from '../helpers.js'\nimport { srcServer, resolveWorkspacePath } from '../../vite.config.ts'\n\n// The roll-up reaches src/core through a specifier the tarball does not carry, so the rewrite\n// externalizes core through the package's own published root export, on the final roll-up alone.\nexport default defineConfig(\n\tsrcServer({\n\t\tplugins: [\n\t\t\tdeclarationRollup({\n\t\t\t\tproject: resolveWorkspacePath('configs/src/tsconfig.server.json'),\n\t\t\t\trewrite: rewriteCoreSpecifier,\n\t\t\t}),\n\t\t],\n\t}),\n)\n`,\n\t\t}),\n\t\tbin: `import { defineConfig } from 'vite'\nimport { resolveExternal } from '../helpers.js'\nimport { peers, 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 through\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\texternal: (id: string) =>\n\t\t\t\t\tid.startsWith('@src/') || resolveExternal(id, { peers, refused: [], siblings: [] }),\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\tvue: `import { defineConfig } from 'vite'\nimport { appVue } from '../../vite.config.ts'\n\nexport default defineConfig(appVue())\n`,\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(({ mode }) => appShowcase(mode))\n`,\n\t\t\tjourney: `import type { JourneyVariant } from '@orkestrel/test'\nimport { defineConfig } from 'vitest/config'\nimport { appJourney } from '../../vite.config.ts'\n\n// Rename and extend these viewports for the application. Apply themes through its interface.\nconst VARIANTS: readonly JourneyVariant[] = Object.freeze([\n\t{ name: 'desktop', width: 1280, height: 800 },\n\t{ name: 'compact', width: 390, height: 844 },\n])\n\nexport default defineConfig(({ mode }) => ({\n\ttest: {\n\t\tprojects: VARIANTS.map((variant) => () => appJourney(variant, VARIANTS, mode)),\n\t},\n}))\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 * Lists the Chromium executable layouts inside a \\`chromium-<revision>\\` browsers-directory\n * entry, per 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/** Matches the \\`chromium-<revision>\\` entry name Playwright installs one managed build into. */\nexport const CHROMIUM_ENTRY_PATTERN = /^chromium-\\\\d+$/\n\n/** Matches the revision number carried by any path containing a \\`chromium-<revision>\\` segment. */\nexport const CHROMIUM_REVISION_PATTERN = /chromium-(\\\\d+)/\n\n/** Names the directory a managed Linux container installs its bundled Playwright browsers into. */\nexport const BUNDLED_BROWSERS_ROOT = '/opt/pw-browsers'\n\n/**\n * Lists the 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/** Lists the 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 * Determines whether a path identifies an executable regular file.\n *\n * @param path - The filesystem path to inspect.\n * @returns True if the path is a regular file with execute access; false otherwise.\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 * Orders 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 * Reads 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 * Resolves 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\t// One \\`dirname\\` per path segment reaches the root from any path, and the nearest\n\t// ancestor named \\`chromium-<revision>\\` is the revision directory this build sits in.\n\tconst directory = dirname(pinned)\n\tconst ancestors = directory\n\t\t.split(/[\\\\\\\\/]/u)\n\t\t.reduce<string[]>((chain) => [...chain, dirname(chain.at(-1) ?? directory)], [directory])\n\tconst revisionRoot = ancestors.find((ancestor) => CHROMIUM_ENTRY_PATTERN.test(basename(ancestor)))\n\tif (revisionRoot === undefined) return undefined\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\ttry {\n\t\tconst revisions = readdirSync(browsersRoot)\n\t\t\t.filter((entry) => CHROMIUM_ENTRY_PATTERN.test(entry))\n\t\t\t.sort(compareRevisions)\n\t\tfor (const revision of revisions) {\n\t\t\tfor (const layout of CHROMIUM_LAYOUTS) {\n\t\t\t\tconst candidate = resolvePath(browsersRoot, revision, layout)\n\t\t\t\tif (isBrowserExecutable(candidate)) return candidate\n\t\t\t}\n\t\t}\n\t\treturn undefined\n\t} catch {\n\t\treturn undefined\n\t}\n}\n\n/**\n * Resolves 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\ttry {\n\t\t\tfor (const match of globSync(layout, { cwd: root }).sort(compareRevisions)) {\n\t\t\t\tconst candidate = resolvePath(root, match)\n\t\t\t\tif (isBrowserExecutable(candidate)) return candidate\n\t\t\t}\n\t\t} catch {\n\t\t\treturn undefined\n\t\t}\n\t}\n\treturn undefined\n}\n\n/**\n * Resolves the first installed stable system Chromium channel.\n *\n * @param platform - The Node platform whose standard layouts this call probes.\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(\n\t\tplatform === 'win32'\n\t\t\t? [\n\t\t\t\t\t...[\n\t\t\t\t\t\tenvironment.LOCALAPPDATA,\n\t\t\t\t\t\tenvironment.PROGRAMFILES,\n\t\t\t\t\t\tenvironment['PROGRAMFILES(X86)'],\n\t\t\t\t\t].flatMap((root) => (root !== undefined && root.length > 0 ? [root] : [])),\n\t\t\t\t\t...[environment.HOMEDRIVE].flatMap((homeDrive) =>\n\t\t\t\t\t\thomeDrive !== undefined && homeDrive.length > 0\n\t\t\t\t\t\t\t? [join(homeDrive, 'Program Files'), join(homeDrive, 'Program Files (x86)')]\n\t\t\t\t\t\t\t: [],\n\t\t\t\t\t),\n\t\t\t\t]\n\t\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 * Resolves Playwright provider options for Chromium on this host.\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 this call probes.\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 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. Every resolved\n * managed path names the full Chromium executable so headless launches retain browser permissions.\n * Only a discovered system channel is verified before it is named. The platform default is\n * unverified as well and exists only as a last resort: Windows takes \\`msedge\\`, which ships with the\n * OS and never collides with a foreground Chrome.\n *\n * Set \\`PLAYWRIGHT_SCROLLBARS=classic\\` only for runs that measure scrollbar compensation, never\n * for a standing gate. Every Chromium launch in that run omits Playwright's \\`--hide-scrollbars\\`\n * default argument so classic scrollbars can take layout space in every case. An empty or unset\n * value preserves the launch defaults; any other value throws an \\`Error\\`. Pairing \\`classic\\`\n * with \\`PLAYWRIGHT_WS_ENDPOINT\\` throws an \\`Error\\`, even with an executable override, because the\n * server owns the launch.\n *\n * The resolver and the gate cover Chromium alone. Reopen engine selection when another\n * Playwright engine is installed and launches on the host with a \\`captureFrame\\` reading\n * back at its declared size, or when a journey or style divergence is recorded.\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 scrollbars = environment.PLAYWRIGHT_SCROLLBARS\n\tif (scrollbars !== undefined && scrollbars.length > 0 && scrollbars !== 'classic') {\n\t\tthrow new Error('PLAYWRIGHT_SCROLLBARS must be classic or empty')\n\t}\n\tconst endpoint = environment.PLAYWRIGHT_WS_ENDPOINT\n\tif (scrollbars === 'classic' && endpoint !== undefined && endpoint.length > 0) {\n\t\tthrow new Error('PLAYWRIGHT_SCROLLBARS=classic cannot be used with PLAYWRIGHT_WS_ENDPOINT')\n\t}\n\tconst launch: PlaywrightProviderOptions['launchOptions'] =\n\t\tscrollbars === 'classic' ? { ignoreDefaultArgs: ['--hide-scrollbars'] } : {}\n\tconst executable = environment.PLAYWRIGHT_EXECUTABLE_PATH\n\tif (executable !== undefined && executable.length > 0) {\n\t\treturn { launchOptions: { executablePath: executable, ...launch } }\n\t}\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, ...launch } }\n\t}\n\tconst managed = pinned === undefined ? undefined : resolveManagedBrowser(pinned)\n\tif (managed !== undefined) {\n\t\treturn { launchOptions: { executablePath: managed, ...launch } }\n\t}\n\tconst bundled = resolveBundledBrowser(platform, root)\n\tif (bundled !== undefined) return { launchOptions: { executablePath: bundled, ...launch } }\n\tconst fallback = platform === 'win32' ? 'msedge' : 'chrome'\n\treturn {\n\t\tlaunchOptions: { channel: resolveSystemBrowser(platform, environment) ?? fallback, ...launch },\n\t}\n}\n`,\n\tcommands: `import type { BrowserConfigOptions } from 'vitest/node'\n\nexport const commands: Readonly<NonNullable<BrowserConfigOptions['commands']>> = Object.freeze({})\n`,\n})\n\n/**\n * Holds 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\tsheet: Object.freeze({\n\t\t\t'index.scss': \"@use 'tokens';\\n@use 'elements';\\n@use 'components';\\n@use 'utilities';\\n\",\n\t\t\t'_tokens.scss': '@layer theme, reset, base, elements, components, utilities;\\n',\n\t\t\t'_mixins.scss': '',\n\t\t\t'elements/_index.scss': '',\n\t\t\t'components/_index.scss': '',\n\t\t\t'utilities/_index.scss': '',\n\t\t\t'sheet.ts': \"import './index.scss'\\n\",\n\t\t\t'index.ts': \"export * from './sheet.js'\\n\",\n\t\t}),\n\t\tthemes: Object.freeze({\n\t\t\t'index.scss': \"@use '../tokens';\\n@use 'default';\\n\",\n\t\t\t'_default.scss': '',\n\t\t\t'sheet.ts': \"import './index.scss'\\n\",\n\t\t}),\n\t\tempty: '',\n\t\tbarrel: '// TODO: [Feature] Export the browser extension API.\\n',\n\t\tmain: `document.body\n\t.appendChild(document.createElement('main'))\n\t.appendChild(document.createElement('h1')).textContent ={{heading}}\n`,\n\t\tvue: Object.freeze({\n\t\t\t'main.ts': `import { createApp } from 'vue'\nimport App from './App.vue'\n\ncreateApp(App).mount(document.body.appendChild(document.createElement('main')))\n`,\n\t\t\t'App.vue': `<template>\n\t<h1>{{heading}}</h1>\n</template>\n`,\n\t\t}),\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\tjourney: `import {\n\tACCESSIBLE_ROLES,\n\tcreatePortfolio,\n\texpandCaptures,\n\tisRendered,\n\treadRefusal,\n\treadStyle,\n} from '@orkestrel/test/browser'\n{{imports}}import { page } from 'vitest/browser'\nimport { describe, expect, inject, it } from 'vitest'\n\nconst VARIANT = inject('variant')\nconst VARIANTS = inject('variants')\nconst CAPTURE = inject('capture')\n\ndescribe('{{application}} arrival journey', () => {\n\tit('proves the declared arrival families', async () => {\n\t\tconst families = ['Journey', 'Refusal', 'Matrix', ...(CAPTURE ? ['Capture'] : [])]\n\t\tconst proven: string[] = []\n\t\tconst states = ['{{application}}-arrival']\n\t\tconst placed: string[] = []\n\t\tconst portfolio = createPortfolio({\n\t\t\tstates,\n\t\t\tvariants: VARIANTS,\n\t\t\tvariant: VARIANT,\n\t\t\tdirectory: '../../../tmp/captures/states',\n\t\t\tenabled: CAPTURE,\n\t\t})\n{{mount}}\t\ttry {\n{{arrival}}\t\t\tconst heading = page\n\t\t\t\t.getByRole('heading', {\n\t\t\t\t\tname: {{heading}},\n\t\t\t\t\texact: true,\n\t\t\t\t\tlevel: 1,\n\t\t\t\t})\n\t\t\t\t.element()\n\t\t\texpect(isRendered(heading)).toBe(true)\n\t\t\tproven.push('Journey')\n\t\t\tawait portfolio.place('{{application}}-arrival')\n\t\t\tplaced.push('{{application}}-arrival')\n\n\t\t\tfor (const role of ACCESSIBLE_ROLES) expect(page.getByRole(role).elements()).toEqual([])\n\t\t\texpect(readRefusal('Continue')).toBe(\n\t\t\t\t'No interactive element has the accessible name \"Continue\"',\n\t\t\t)\n\t\t\tproven.push('Refusal')\n\n\t\t\tconst measured: string[] = []\n\t\t\tfor (const variant of VARIANTS) {\n\t\t\t\tawait page.viewport(variant.width, variant.height)\n\t\t\t\texpect(readStyle(heading, 'display')).toBe('block')\n\t\t\t\texpect(window.innerWidth).toBe(variant.width)\n\t\t\t\tmeasured.push(variant.name)\n\t\t\t}\n\t\t\texpect(measured).toEqual(VARIANTS.map(({ name }) => name))\n\t\t\tproven.push('Matrix')\n\n\t\t\tconst files = expandCaptures(states, VARIANTS)\n\t\t\texpect(portfolio.files).toEqual(files)\n\t\t\texpect(new Set(files).size).toBe(states.length * VARIANTS.length)\n\t\t\texpect(placed).toEqual(states)\n\t\t\tconst expected = CAPTURE\n\t\t\t\t? expandCaptures(\n\t\t\t\t\t\tstates,\n\t\t\t\t\t\tVARIANTS.filter(({ name }) => name === VARIANT),\n\t\t\t\t\t)\n\t\t\t\t: []\n\t\t\texpect(portfolio.paths.map((path) => path.replaceAll('\\\\\\\\', '/').split('/').at(-1))).toEqual(\n\t\t\t\texpected,\n\t\t\t)\n\t\t\tif (CAPTURE) proven.push('Capture')\n\t\t\texpect(proven).toEqual(families)\n\t\t} finally {\n{{cleanup}}\t\t\tconst variant = VARIANTS.find(({ name }) => name === VARIANT)\n\t\t\tif (variant !== undefined) await page.viewport(variant.width, variant.height)\n\t\t}\n\t})\n})\n`,\n\t\tbrowser: `import type { JourneyVariant } from '@orkestrel/test'\n\ndeclare module 'vitest' {\n\texport interface ProvidedContext {\n\t\treadonly variant: string\n\t\treadonly variants: readonly JourneyVariant[]\n\t\treadonly capture: boolean\n\t}\n}\n`,\n\t\tsheet: `import sheet from '{{root}}dist/src/{{name}}/index.css?raw'\nimport { adoptSheet, readLayerNames } from '@orkestrel/test/browser'\nimport { describe, expect, it } from 'vitest'\n\ndescribe('{{name}} entry', () => {\n\tit('opens with the declared cascade order', () => {\n\t\tconst adopted = adoptSheet(sheet)\n\t\ttry {\n\t\t\texpect(adopted.sheet.cssRules[0]?.cssText).toBe(\n\t\t\t\t'@layer theme, reset, base, elements, components, utilities;',\n\t\t\t)\n\t\t\texpect(readLayerNames(adopted.sheet).slice(0, 6)).toEqual([\n\t\t\t\t'theme',\n\t\t\t\t'reset',\n\t\t\t\t'base',\n\t\t\t\t'elements',\n\t\t\t\t'components',\n\t\t\t\t'utilities',\n\t\t\t])\n\t\t} finally {\n\t\t\tadopted.release()\n\t\t}\n\t})\n})\n`,\n\t\tstyles: Object.freeze({\n\t\t\tmodule: '',\n\t\t\tproof: '',\n\t\t}),\n\t\tsetup: '',\n\t\tglobal: Object.freeze({\n\t\t\tmodule: `export function setup(): void {}\n`,\n\t\t\tproof: `import { describe, expect, it } from 'vitest'\nimport { setup } from './setupGlobal.js'\n\ndescribe('global setup', () => {\n\tit('runs without producing a teardown', () => {\n\t\texpect(setup()).toBeUndefined()\n\t\texpect(setup()).toBeUndefined()\n\t})\n})\n`,\n\t\t}),\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\tdistribution: Object.freeze({\n\t\t\tmodule: `{{types}}import type { SpawnSyncReturns } from 'node:child_process'\nimport type { TestContext } from 'vitest'\nimport { spawnSync } from 'node:child_process'\nimport {\n\texistsSync,\n\tmkdirSync,\n\tmkdtempSync,\n\treaddirSync,\n\treadFileSync,\n\trmSync,\n\tstatSync,\n\twriteFileSync,\n} from 'node:fs'\n{{transport}}import { createRequire } from 'node:module'\nimport { tmpdir } from 'node:os'\nimport { dirname, join, relative as relativePath, resolve, sep } from 'node:path'\nimport { fileURLToPath, pathToFileURL } from 'node:url'\nimport { isDeepStrictEqual } from 'node:util'\nimport { parseSync } from 'vite'\n{{launcher}}\n/** Defines the lifecycle and installed consumer read by a distribution proof. */\nexport interface DistributionSuiteInterface {\n\treadonly scratch: string\n\tstart(): void\n\tread(context: TestContext): DistributionStage\n\tdestroy(): void\n}\n\n/** Holds the observed and required values for one distribution assertion. */\nexport interface DistributionObservation {\n\treadonly actual: unknown\n\treadonly expected: unknown\n}\n\n/** Defines one independently registered distribution observation. */\nexport interface DistributionCase {\n\treadonly label: string\n\treadonly observe: (\n\t\tcontext: TestContext,\n\t) => DistributionObservation | Promise<DistributionObservation>\n}\n\n/** Holds the installed export map's classified publications. */\nexport interface DistributionClassification {\n\treadonly entries: readonly DistributionEntry[]\n\treadonly subpaths: readonly string[]\n\treadonly undeclared: readonly string[]\n\treadonly excluded: readonly string[]\n\treadonly targets: readonly string[]\n}\n\n/** Names the workspace whose packed artifact the proof consumes. */\nexport const DISTRIBUTION_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..')\n/** Names the npm executable on the running host. */\nexport const DISTRIBUTION_NPM = process.platform === 'win32' ? 'npm.cmd' : 'npm'\n// The compiler this workspace installs, run as a command rather than called in\n// process: the command and its plain-text diagnostics are the same across the\n// compiler majors this toolchain supports, and its in-process API is not. It is\n// resolved from the workspace under proof, so a consumer of the packed artifact is\n// checked by the same compiler that workspace's own \\`check\\` script runs.\n/** Names the compiler installed by the workspace under proof. */\nexport const DISTRIBUTION_COMPILER = createRequire(join(DISTRIBUTION_ROOT, 'package.json')).resolve(\n\t'typescript/bin/tsc',\n)\n// Windows needs a shell to launch a \\`.cmd\\`: Node refuses one directly since the\n// batch-argument hardening, and \\`spawnSync\\` returns \\`EINVAL\\` with a null status\n// rather than an exit code a caller can read. Every following argument is a literal or\n// a path this file built, so the shell has nothing to escape.\n/** Selects the Windows command-shell route required by the npm shim. */\nexport const DISTRIBUTION_SHELL = process.platform === 'win32'\n// \\`prepublishOnly\\` runs this proof as \\`npm run test:distribution -- --mode release\\`,\n// and the root configuration's project factories carry that mode into this project.\n// Release is the publish gate, so evidence it cannot obtain fails there and skips\n// everywhere else: a gate that passes on missing evidence proves nothing.\n/** Indicates whether missing prerequisites must fail the publish gate. */\nexport const DISTRIBUTION_RELEASE = import.meta.env?.MODE === 'release'\n// The built output directory convention a browser face may publish from. Every\n// selection reads this prefix off the export target and never off the subpath name. A\n// workspace whose only published face is the browser one publishes that face at the\n// root subpath, so a rule keyed on the subpath name drives a browser bundle through\n// Node and the miss is silent.\n/** Names the conventional output prefix for a browser publication. */\nexport const DISTRIBUTION_BROWSER_OUTPUT = './dist/src/browser/'\n/** Names the unpublished subpath used as a resolution control. */\nexport const DISTRIBUTION_ABSENT_SUBPATH = '/no-subpath-is-published-under-this-name'\n// A compiler diagnostic that says where it is: the path relative to the directory\n// the compiler ran in, the 1-based line and column, the code, and the message. The\n// diagnostics are the verdict rather than the exit code, which differs between the\n// compiler majors this toolchain supports, so a reported line matching nothing here\n// came from something other than a check of a consumer module.\n/** Matches the location prefix of a consumer compiler diagnostic. */\nexport const DISTRIBUTION_DIAGNOSTIC_PATTERN = /^(.+?)\\\\(\\\\d+,\\\\d+\\\\): error TS\\\\d+: /u\n/** Lists the bounded registry-readiness command arguments. */\nexport const DISTRIBUTION_PING = Object.freeze([\n\t'ping',\n\t'--fetch-retries=0',\n\t'--fetch-timeout=5000',\n\t'--loglevel=silent',\n])\n/** Names the consumer entry that imports an installed module. */\nexport const DISTRIBUTION_ESM_DRIVER = 'drive.mjs'\n/** Names the consumer entry that requires an installed module. */\nexport const DISTRIBUTION_CJS_DRIVER = 'drive.cjs'\n/** Defines the isolated consumer package manifest. */\nexport const DISTRIBUTION_CONSUMER_MANIFEST =\n\t'{ \"name\": \"distribution-consumer\", \"private\": true, \"type\": \"module\" }\\\\n'\n/** Reads the names exported by an installed ESM entry. */\nexport const DISTRIBUTION_ESM_DRIVER_SOURCE = \\`const entry = await import(process.argv[2])\nprocess.stdout.write(JSON.stringify(Object.keys(entry).sort()))\n\\`\n/** Reads the names exported by an installed CommonJS entry. */\nexport const DISTRIBUTION_CJS_DRIVER_SOURCE = \\`const entry = require(process.argv[2])\nprocess.stdout.write(JSON.stringify(Object.keys(entry).sort()))\n\\`\n\n// The extensions a JavaScript handler loads as modules. Node loads a native addon\n// through its addon handler instead, so that extension is named separately.\n/** Lists extensions loaded as JavaScript modules. */\nexport const DISTRIBUTION_MODULE_EXTENSIONS = Object.freeze(['.js', '.mjs', '.cjs'])\n/** Names the extension loaded by the native-addon handler. */\nexport const DISTRIBUTION_ADDON_EXTENSION = '.node'\n// The extensions a declaration file carries. A \\`require\\` condition declares\n// \\`.d.cts\\` and an ESM-only one \\`.d.mts\\`, so the \\`.d.ts\\` spelling alone does not\n// name them.\n/** Lists the supported TypeScript declaration extensions. */\nexport const DISTRIBUTION_DECLARATION_EXTENSIONS = Object.freeze(['.d.ts', '.d.cts', '.d.mts'])\n/** Names the module format of a typed consumer. */\nexport type DistributionFormat = 'module' | 'commonjs'\n\n// The Node import target is resolved with the conditions that driver supplies. The\n// CommonJS compile probe is selected from its declaration's format, and its runtime\n// drive loads the same subpath through Node's require resolver. Vite's production\n// client build enables its module and browser conditions.\n/** Defines the conditions each runtime uses to resolve an entry. */\nexport const DISTRIBUTION_RUNTIME_CONDITIONS = Object.freeze({\n\tmodule: Object.freeze(['node-addons', 'node', 'import', 'module-sync']),\n\tcommonjs: Object.freeze(['node-addons', 'node', 'require', 'module-sync']),\n\tbrowser: Object.freeze(['module', 'browser', 'production', 'import']),\n})\n// TypeScript's Node resolutions add \\`node\\` to the format condition. Its bundler\n// resolution does not, so a browser drive compares against the declaration a bundler\n// consumer reads rather than borrowing the Node declaration.\n/** Defines the declaration conditions used by bundler consumers. */\nexport const DISTRIBUTION_BUNDLER_CONDITIONS = Object.freeze({\n\tmodule: Object.freeze(['types', 'import']),\n\tcommonjs: Object.freeze(['types', 'require']),\n})\n/** Defines the declaration conditions paired with each runtime. */\nexport const DISTRIBUTION_DECLARATION_CONDITIONS = Object.freeze({\n\tmodule: Object.freeze(['types', 'node', 'import']),\n\tcommonjs: Object.freeze(['types', 'node', 'require']),\n\tbrowser: DISTRIBUTION_BUNDLER_CONDITIONS.module,\n})\n\n/** Describes the compiler options and conditions for one consumer resolution. */\nexport interface DistributionResolution {\n\treadonly label: string\n\treadonly resolution: string\n\treadonly module: string\n\treadonly conditions: Readonly<Record<DistributionFormat, readonly string[]>>\n}\n\n/** Holds the target selected by package condition resolution. */\nexport interface DistributionTargetResult {\n\treadonly target: string\n}\n\n// Each compile driver carries the compiler options its scratch project sets and\n// the conditions TypeScript applies for that resolution and importing format. A\n// \\`require\\`-only subpath therefore stays in each CommonJS probe that can resolve it.\n// The option values are the spellings the project file takes, so nothing here needs\n// the compiler's own API to name them.\n/** Lists the compiler resolutions driven against installed declarations. */\nexport const DISTRIBUTION_RESOLUTIONS: readonly DistributionResolution[] = Object.freeze([\n\t{\n\t\tlabel: 'node16',\n\t\tresolution: 'node16',\n\t\tmodule: 'node16',\n\t\tconditions: DISTRIBUTION_DECLARATION_CONDITIONS,\n\t},\n\t{\n\t\tlabel: 'nodenext',\n\t\tresolution: 'nodenext',\n\t\tmodule: 'nodenext',\n\t\tconditions: DISTRIBUTION_DECLARATION_CONDITIONS,\n\t},\n\t{\n\t\tlabel: 'bundler',\n\t\tresolution: 'bundler',\n\t\tmodule: 'esnext',\n\t\tconditions: DISTRIBUTION_BUNDLER_CONDITIONS,\n\t},\n])\n\n// The driver a bundled consumer reads declarations under. A browser application\n// compiles through a bundler, so the browser drive answers under this one alone,\n// and naming it here is what keeps that selection tied to the driver it selects.\n/** Selects the compiler resolution used by a browser consumer. */\nexport const DISTRIBUTION_BROWSER_RESOLUTION = DISTRIBUTION_RESOLUTIONS.find(\n\t(candidate) => candidate.label === 'bundler',\n)\nif (DISTRIBUTION_BROWSER_RESOLUTION === undefined)\n\tthrow new Error(\"DISTRIBUTION_RESOLUTIONS carries no 'bundler' row\")\n\n/** Pairs consumer source extensions with their module formats. */\nexport const DISTRIBUTION_FORMATS: ReadonlyArray<\n\treadonly [extension: string, format: DistributionFormat]\n> = Object.freeze([\n\t['ts', 'module'],\n\t['cts', 'commonjs'],\n])\n\n// One published subpath, resolved to what this proof can drive: the specifier a\n// consumer writes, whether the declarations its consumer formats resolve at all,\n// whether the exports map answers the browser condition with a target of its own,\n// whether it answers \\`import\\` and \\`require\\` at all, and whether the target that\n// \\`require\\` answers with is one that a CommonJS consumer loads.\n/** Describes one published subpath and its runtime and declaration capabilities. */\nexport interface DistributionEntry {\n\treadonly subpath: string\n\treadonly specifier: string\n\treadonly mapping: unknown\n\treadonly declaration: {\n\t\treadonly importable: boolean\n\t\treadonly requirable: boolean\n\t\treadonly browsable: boolean\n\t}\n\treadonly browsable: boolean\n\treadonly importable: boolean\n\treadonly requirable: boolean\n\treadonly loadable: boolean\n}\n\n// The installed tree every claim is read from. Every subpath the exports map names\n// lands in exactly one of \\`entries\\`, \\`undeclared\\`, and \\`excluded\\`, so a subpath this\n// proof cannot drive is reported rather than dropped.\n/** Holds the installed consumer and the partition of its published subpaths. */\nexport interface DistributionStage {\n\treadonly consumer: string\n\treadonly installed: string\n\treadonly archives: readonly string[]\n\treadonly entries: readonly DistributionEntry[]\n\treadonly subpaths: readonly string[]\n\treadonly undeclared: readonly string[]\n\treadonly excluded: readonly string[]\n\treadonly targets: readonly string[]\n}\n\n/**\n * Checks whether a value is a non-null object other than an array.\n *\n * @param value - The value to inspect.\n * @returns True if the value is a record; false otherwise.\n */\nexport function isDistributionRecord(value: unknown): value is Readonly<Record<string, unknown>> {\n\treturn typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\n/**\n * Checks whether a value is an array of strings.\n *\n * @param value - The value to inspect.\n * @returns True if every array member is a string; false otherwise.\n */\nexport function isDistributionNames(value: unknown): value is readonly string[] {\n\treturn Array.isArray(value) && value.every((name) => typeof name === 'string')\n}\n\n// A fallback list, which is what Node reads an array in an exports entry as. The\n// narrowing is what the following walkers need: \\`Array.isArray\\` widens an \\`unknown\\`\n// member to \\`any\\`, and an entry read that way is not read at all.\n/**\n * Checks whether a value is a fallback array.\n *\n * @param value - The value to inspect.\n * @returns True if the value is an array; false otherwise.\n */\nexport function isDistributionList(value: unknown): value is readonly unknown[] {\n\treturn Array.isArray(value)\n}\n\n// Whether a string is a valid package target. Node rejects a target outside the\n// package and a target containing a dot, parent, or node_modules segment during\n// package-target resolution. A later module-resolution failure is not the same\n// thing: an array falls through the former and keeps the latter.\n/**\n * Checks whether a relative package target contains only admitted segments.\n *\n * @param target - The package-relative target.\n * @returns True if the target passes package-target validation; false otherwise.\n */\nexport function matchesDistributionPackageTarget(target: string): boolean {\n\tif (!target.startsWith('./')) return false\n\tconst refused = ['.', '..', 'node_modules']\n\treturn target\n\t\t.slice(2)\n\t\t.split(/[\\\\\\\\/]/u)\n\t\t.every((segment) => {\n\t\t\ttry {\n\t\t\t\treturn !refused.includes(decodeURIComponent(segment).toLowerCase())\n\t\t\t} catch {\n\t\t\t\treturn !refused.includes(segment.toLowerCase())\n\t\t\t}\n\t\t})\n}\n\n/**\n * Reads and parses a JSON file.\n *\n * @param path - The file to read.\n * @returns The parsed value. Throws when reading or parsing fails.\n */\nexport function readDistributionJSON(path: string): unknown {\n\tconst parsed: unknown = JSON.parse(readFileSync(path, 'utf8'))\n\treturn parsed\n}\n\n/**\n * Reads the package name from a manifest.\n *\n * @param path - The manifest to read.\n * @returns The package name. Throws when the manifest has no string name.\n */\nexport function readDistributionManifestName(path: string): string {\n\tconst manifest = readDistributionJSON(path)\n\tif (!isDistributionRecord(manifest) || typeof manifest.name !== 'string') {\n\t\tthrow new Error(\\`The manifest at \\${path} declares no package name\\`)\n\t}\n\treturn manifest.name\n}\n\n/**\n * Writes a consumer file after creating its parent directory.\n *\n * @param path - The file to write.\n * @param content - The text to write.\n */\nexport function writeDistributionFile(path: string, content: string): void {\n\tmkdirSync(dirname(path), { recursive: true })\n\twriteFileSync(path, content)\n}\n\n/**\n * Combines the output streams of a completed command.\n *\n * @param result - The completed command.\n * @returns The trimmed diagnostic text.\n */\nexport function readDistributionOutput(result: SpawnSyncReturns<string>): string {\n\treturn \\`\\${result.stdout ?? ''}\\${result.stderr ?? ''}\\`.trim()\n}\n\n/**\n * Runs npm with a cache inside the owned scratch directory.\n *\n * @param args - The npm arguments.\n * @param cwd - The working directory.\n * @param scratch - The owned scratch root.\n * @returns The command status and captured streams.\n */\nexport function runDistributionNpm(\n\targs: readonly string[],\n\tcwd: string,\n\tscratch: string,\n): SpawnSyncReturns<string> {\n\treturn spawnSync(DISTRIBUTION_NPM, [...args], {\n\t\tcwd,\n\t\tencoding: 'utf8',\n\t\tenv: { ...process.env, npm_config_cache: join(scratch, 'cache') },\n\t\tshell: DISTRIBUTION_SHELL,\n\t\twindowsHide: true,\n\t})\n}\n\n/**\n * Runs a JavaScript entry with the running Node executable.\n *\n * @param args - The Node arguments.\n * @param cwd - The working directory.\n * @returns The command status and captured streams.\n */\nexport function runDistributionNode(\n\targs: readonly string[],\n\tcwd: string,\n): SpawnSyncReturns<string> {\n\treturn spawnSync(process.execPath, [...args], { cwd, encoding: 'utf8', windowsHide: true })\n}\n\n// Node's own condition matching, read in declaration order.\n/**\n * Resolves a package target through conditions and fallback arrays.\n *\n * @param entry - The exports-map entry.\n * @param conditions - The active resolution conditions.\n * @returns The selected target, or undefined when no branch resolves.\n */\nexport function resolveDistributionPackageTarget(\n\tentry: unknown,\n\tconditions: readonly string[],\n): DistributionTargetResult | undefined {\n\tif (typeof entry === 'string') return { target: entry }\n\tif (isDistributionList(entry)) {\n\t\tfor (const member of entry) {\n\t\t\tconst resolved = resolveDistributionPackageTarget(member, conditions)\n\t\t\tif (resolved !== undefined && matchesDistributionPackageTarget(resolved.target))\n\t\t\t\treturn resolved\n\t\t}\n\t\treturn undefined\n\t}\n\tif (!isDistributionRecord(entry)) return undefined\n\tfor (const [condition, nested] of Object.entries(entry)) {\n\t\tif (condition !== 'default' && !conditions.includes(condition)) continue\n\t\tconst resolved = resolveDistributionPackageTarget(nested, conditions)\n\t\tif (resolved !== undefined) return resolved\n\t}\n\treturn undefined\n}\n\n// A flat entry, a condition-nested entry, and a fallback list all resolve through\n// one walker. An entry may declare \\`types\\` beside \\`default\\` at its top level\n// rather than inside \\`import\\`, so a fixed \\`entry.import.types\\` lookup is not\n// equivalent to condition resolution.\n/**\n * Resolves the path selected by an exports-map entry.\n *\n * @param entry - The exports-map entry.\n * @param conditions - The active resolution conditions.\n * @returns The selected path, or undefined when no branch resolves.\n */\nexport function resolveDistributionTarget(\n\tentry: unknown,\n\tconditions: readonly string[],\n): string | undefined {\n\treturn resolveDistributionPackageTarget(entry, conditions)?.target\n}\n\n// Whether a path is a physical file. TypeScript's file-existence check refuses a\n// directory at the same spelling and continues to the outer package scope.\n/**\n * Checks whether a path names a physical file.\n *\n * @param path - The filesystem path.\n * @returns True if the path names a file; false otherwise.\n */\nexport function matchesDistributionFile(path: string): boolean {\n\ttry {\n\t\treturn statSync(path).isFile()\n\t} catch {\n\t\treturn false\n\t}\n}\n\n// TypeScript resolves a declaration target by accepting an existing declaration\n// directly or by substituting beside a JavaScript target. A missing target leaves\n// the containing condition or fallback list unresolved, so the walk continues.\n/**\n * Resolves an existing declaration beside a package target.\n *\n * @param target - The package-relative target.\n * @param installed - The installed package root.\n * @returns The declaration target, or undefined when no declaration exists.\n */\nexport function targetToDistributionDeclaration(\n\ttarget: string,\n\tinstalled: string,\n): string | undefined {\n\tif (!matchesDistributionPackageTarget(target)) return undefined\n\tconst declaration = target.endsWith('.cjs')\n\t\t? \\`\\${target.slice(0, -4)}.d.cts\\`\n\t\t: target.endsWith('.mjs')\n\t\t\t? \\`\\${target.slice(0, -4)}.d.mts\\`\n\t\t\t: target.endsWith('.js')\n\t\t\t\t? \\`\\${target.slice(0, -3)}.d.ts\\`\n\t\t\t\t: target\n\tif (declaration === target && !matchesDistributionDeclaration(target)) return undefined\n\treturn matchesDistributionFile(join(installed, declaration)) ? declaration : undefined\n}\n\n// The declaration TypeScript resolves through one importing format's conditions.\n// Condition objects keep manifest order, and arrays keep fallback order.\n/**\n * Resolves an existing declaration through consumer conditions.\n *\n * @param entry - The exports-map entry.\n * @param conditions - The active declaration conditions.\n * @param installed - The installed package root.\n * @returns The declaration target, or undefined when no branch resolves.\n */\nexport function resolveDistributionDeclaration(\n\tentry: unknown,\n\tconditions: readonly string[],\n\tinstalled: string,\n): string | undefined {\n\tif (typeof entry === 'string') return targetToDistributionDeclaration(entry, installed)\n\tif (isDistributionList(entry)) {\n\t\tfor (const member of entry) {\n\t\t\tconst resolved = resolveDistributionDeclaration(member, conditions, installed)\n\t\t\tif (resolved !== undefined) return resolved\n\t\t}\n\t\treturn undefined\n\t}\n\tif (!isDistributionRecord(entry)) return undefined\n\tfor (const [condition, nested] of Object.entries(entry)) {\n\t\tif (condition !== 'default' && !conditions.includes(condition)) continue\n\t\tconst resolved = resolveDistributionDeclaration(nested, conditions, installed)\n\t\tif (resolved !== undefined) return resolved\n\t}\n\treturn undefined\n}\n\n// The nearest package scope that decides a \\`.d.ts\\` declaration's module format. A\n// physical nested manifest starts a scope even when it omits \\`type\\` or cannot be\n// parsed. A directory at that spelling is not a manifest, so the walk continues.\n/**\n * Reads the nearest package scope for a target inside an installed package.\n *\n * @param installed - The installed package root.\n * @param target - The package-relative target.\n * @returns The manifest type, or undefined when the nearest scope omits it or cannot be read.\n */\nexport function readDistributionPackageType(installed: string, target: string): unknown {\n\t// One \\`dirname\\` per path segment reaches the root from any path. The walk ends at the\n\t// installed package, so no scope above it is consulted.\n\tconst start = dirname(join(installed, target))\n\tconst chain = start\n\t\t.split(/[\\\\\\\\/]/u)\n\t\t.reduce<string[]>((climbed) => [...climbed, dirname(climbed.at(-1) ?? start)], [start])\n\tconst end = chain.indexOf(installed)\n\tconst scope = chain\n\t\t.slice(0, end === -1 ? chain.length : end + 1)\n\t\t.find((directory) => matchesDistributionFile(join(directory, 'package.json')))\n\tif (scope === undefined) return undefined\n\ttry {\n\t\tconst manifest = readDistributionJSON(join(scope, 'package.json'))\n\t\treturn isDistributionRecord(manifest) ? manifest.type : undefined\n\t} catch {\n\t\treturn undefined\n\t}\n}\n\n/**\n * Checks whether an entry publishes a distinct or conventional browser target.\n *\n * @param entry - The exports-map entry.\n * @returns True if the entry requires a browser drive; false otherwise.\n */\nexport function resolvesDistributionBrowser(entry: unknown): boolean {\n\tconst module = resolveDistributionTarget(entry, DISTRIBUTION_RUNTIME_CONDITIONS.browser)\n\tif (module !== undefined && module.startsWith(DISTRIBUTION_BROWSER_OUTPUT)) return true\n\tif (module === undefined) return false\n\tconst imported = resolveDistributionTarget(entry, DISTRIBUTION_RUNTIME_CONDITIONS.module)\n\tconst required = resolveDistributionTarget(entry, DISTRIBUTION_RUNTIME_CONDITIONS.commonjs)\n\treturn module !== imported && module !== required\n}\n\n// Whether the target selected by Node's CommonJS conditions is a module require can\n// load. A JavaScript target takes its own nearest package scope. Native addons and\n// extensionless targets have their own CommonJS handlers.\n/**\n * Checks whether Node require can load an entry selected by its conditions.\n *\n * @param entry - The exports-map entry.\n * @param installed - The installed package root.\n * @returns True if the target has a CommonJS-compatible format; false otherwise.\n */\nexport function resolvesDistributionCommonJS(entry: unknown, installed: string): boolean {\n\tconst target = resolveDistributionTarget(entry, DISTRIBUTION_RUNTIME_CONDITIONS.commonjs)\n\tif (target === undefined) return false\n\tconst name = target.slice(target.lastIndexOf('/') + 1)\n\tif (name.endsWith('.cjs')) return true\n\tif (name.endsWith('.mjs')) return false\n\tif (name.endsWith('.node')) return true\n\tif (!name.includes('.')) return true\n\treturn name.endsWith('.js') && readDistributionPackageType(installed, target) !== 'module'\n}\n\n// Whether the declaration selected by a typed CommonJS consumer admits that entry.\n// A \\`.d.cts\\` declaration admits and a \\`.d.mts\\` declaration refuses. A \\`.d.ts\\`\n// declaration takes its own nearest package scope.\n/**\n * Checks whether an entry resolves a CommonJS-compatible declaration.\n *\n * @param entry - The exports-map entry.\n * @param installed - The installed package root.\n * @returns True if the selected declaration admits CommonJS consumption; false otherwise.\n */\nexport function declaresDistributionCommonJS(entry: unknown, installed: string): boolean {\n\tconst declaration = resolveDistributionDeclaration(\n\t\tentry,\n\t\tDISTRIBUTION_DECLARATION_CONDITIONS.commonjs,\n\t\tinstalled,\n\t)\n\tif (declaration === undefined) return false\n\tif (declaration.endsWith('.d.cts')) return true\n\tif (declaration.endsWith('.d.mts')) return false\n\treturn (\n\t\tdeclaration.endsWith('.d.ts') &&\n\t\treadDistributionPackageType(installed, declaration) !== 'module'\n\t)\n}\n\n// Every target an entry names under any condition. A fallback list omits members\n// Node rejects during package-target validation, because no reader can take them.\n/**\n * Collects the targets an entry publishes under every condition.\n *\n * @param entry - The exports-map entry.\n * @returns The targets, excluding invalid members of fallback arrays.\n */\nexport function collectDistributionTargets(entry: unknown): readonly string[] {\n\tif (typeof entry === 'string') return [entry]\n\tif (isDistributionList(entry))\n\t\treturn entry.flatMap(collectDistributionTargets).filter(matchesDistributionPackageTarget)\n\tif (!isDistributionRecord(entry)) return []\n\treturn Object.values(entry).flatMap((nested) => collectDistributionTargets(nested))\n}\n\n// Whether a target is a file a runtime loads for its names, which is what a\n// declaration is owed for. The extension on the target's own file name decides it,\n// and a name carrying no extension is code: \\`require\\` reads such a file through its\n// JavaScript handler, so an extensionless target loads and publishes names. Node\n// loads \\`.node\\` through its native-addon handler. Every other extension is an asset\n// a consumer reads rather than imports — a stylesheet, a WebAssembly binary, the\n// \\`\"./package.json\"\\` manifest pointer, and a declaration alike.\n// The cost is an extensionless file published for a reader, such as a \\`LICENSE\\`:\n// that target reports undeclared until it is given an extension or a declaration.\n/**\n * Checks whether a target names a runtime module rather than an asset.\n *\n * @param target - The package-relative target.\n * @returns True if the target has a module extension or no extension; false otherwise.\n */\nexport function matchesDistributionModule(target: string): boolean {\n\tconst name = target.slice(target.lastIndexOf('/') + 1)\n\tconst dot = name.lastIndexOf('.')\n\tif (name.endsWith(DISTRIBUTION_ADDON_EXTENSION)) return true\n\treturn dot === -1 || DISTRIBUTION_MODULE_EXTENSIONS.includes(name.slice(dot))\n}\n\n// Whether a resolved target is a declaration rather than the JavaScript a\n// \\`default\\` branch answers with when the entry declares no \\`types\\` condition.\n/**\n * Checks whether a target names a TypeScript declaration.\n *\n * @param target - The package-relative target.\n * @returns True if the target has a declaration extension; false otherwise.\n */\nexport function matchesDistributionDeclaration(target: string): boolean {\n\treturn DISTRIBUTION_DECLARATION_EXTENSIONS.some((extension) => target.endsWith(extension))\n}\n\n// The declarations the Node module, Node CommonJS, and browser drives compare\n// against. Each field uses the conditions of the TypeScript consumer paired with\n// that runtime. A JavaScript target resolves through TypeScript's adjacent\n// declaration substitution rather than standing in for the declaration itself.\n/**\n * Reads the declarations paired with Node and browser consumers.\n *\n * @param entry - The exports-map entry.\n * @param installed - The installed package root.\n * @returns The declaration selected by each consumer format.\n */\nexport function readDistributionDeclaration(\n\tentry: unknown,\n\tinstalled: string,\n): {\n\treadonly module: string | undefined\n\treadonly commonjs: string | undefined\n\treadonly browser: string | undefined\n} {\n\treturn {\n\t\tmodule: resolveDistributionDeclaration(\n\t\t\tentry,\n\t\t\tDISTRIBUTION_DECLARATION_CONDITIONS.module,\n\t\t\tinstalled,\n\t\t),\n\t\tcommonjs: resolveDistributionDeclaration(\n\t\t\tentry,\n\t\t\tDISTRIBUTION_DECLARATION_CONDITIONS.commonjs,\n\t\t\tinstalled,\n\t\t),\n\t\tbrowser: resolveDistributionDeclaration(\n\t\t\tentry,\n\t\t\tDISTRIBUTION_DECLARATION_CONDITIONS.browser,\n\t\t\tinstalled,\n\t\t),\n\t}\n}\n\n// The entries one compile driver can resolve under its own conditions.\n/**\n * Filters entries to those a consumer can resolve.\n *\n * @param entries - The installed entries.\n * @param conditions - The active consumer conditions.\n * @returns The matching entries in their original order.\n */\nexport function filterDistributionEntries(\n\tentries: readonly DistributionEntry[],\n\tconditions: readonly string[],\n): readonly DistributionEntry[] {\n\treturn entries.filter(\n\t\t(entry) =>\n\t\t\tresolveDistributionTarget(entry.mapping, conditions) !== undefined &&\n\t\t\t(!conditions.includes('require') || entry.loadable),\n\t)\n}\n\n// The compile drivers whose conditions reach one entry under one importing format.\n// A driver that resolves no target for that entry compiles nothing, so a consumer\n// written under it would report a resolution failure this package never made.\n/**\n * Filters compiler resolutions to those that can read an entry.\n *\n * @param entry - The installed entry.\n * @param format - The consumer module format.\n * @returns The matching compiler resolutions.\n */\nexport function filterDistributionResolutions(\n\tentry: DistributionEntry,\n\tformat: DistributionFormat,\n): readonly DistributionResolution[] {\n\treturn DISTRIBUTION_RESOLUTIONS.filter(\n\t\t(driver) => filterDistributionEntries([entry], driver.conditions[format]).length > 0,\n\t)\n}\n\n// Requirable entries that declare CommonJS support but a typed CommonJS consumer\n// cannot compile against. A default branch resolving under the require condition\n// set makes no CommonJS claim.\n/**\n * Filters entries whose require target lacks a compatible declaration.\n *\n * @param entries - The installed entries.\n * @param installed - The installed package root.\n * @returns The entries a CommonJS consumer cannot typecheck.\n */\nexport function filterDistributionUntypable(\n\tentries: readonly DistributionEntry[],\n\tinstalled: string,\n): readonly DistributionEntry[] {\n\treturn entries.filter(\n\t\t(entry) =>\n\t\t\tentry.requirable &&\n\t\t\tisDistributionRecord(entry.mapping) &&\n\t\t\tObject.hasOwn(entry.mapping, 'require') &&\n\t\t\t!declaresDistributionCommonJS(entry.mapping, installed),\n\t)\n}\n\n// One surface comparison, written as the consumer module that proves it: the\n// installed entry that consumer imports, the file extension fixing its importing\n// format, the names a real runtime published off it, and the driver whose scratch\n// project compiles it.\n/** Describes the runtime names and declaration resolution compared for one entry. */\nexport interface DistributionSurface {\n\treadonly entry: DistributionEntry\n\treadonly extension: string\n\treadonly published: readonly string[]\n\treadonly driver: DistributionResolution\n}\n\n// A scratch project over named consumer modules, written beside them so their own\n// resolution reaches the installed package. Nothing is emitted and no ambient types\n// are pulled in, so what the check reads is the installed declarations alone.\n/**\n * Writes a compiler project for a consumer probe.\n *\n * @param stage - The installed consumer.\n * @param name - The project filename suffix.\n * @param driver - The compiler resolution.\n * @param files - The consumer source files.\n * @returns The absolute project path.\n */\nexport function writeDistributionProject(\n\tstage: DistributionStage,\n\tname: string,\n\tdriver: DistributionResolution,\n\tfiles: readonly string[],\n): string {\n\tconst path = join(stage.consumer, \\`tsconfig.\\${name}.json\\`)\n\tconst project = {\n\t\tcompilerOptions: {\n\t\t\tmodule: driver.module,\n\t\t\tmoduleResolution: driver.resolution,\n\t\t\tnoEmit: true,\n\t\t\tskipLibCheck: true,\n\t\t\tstrict: true,\n\t\t\ttarget: 'esnext',\n\t\t\ttypes: [],\n\t\t},\n\t\tfiles: [...files],\n\t}\n\twriteDistributionFile(path, \\`\\${JSON.stringify(project, undefined, '\\\\t')}\\\\n\\`)\n\treturn path\n}\n\n// The diagnostics the compiler this workspace installs reports for one scratch\n// project. The compiler runs as a command, so nothing here reaches an API that\n// moves between its majors, and the located lines it prints are the verdict rather\n// than the exit code, which moves between them. A line carrying no location, a line\n// naming the scratch project rather than a consumer module, and anything at all on\n// the error stream are faults of this proof rather than of the package under proof,\n// so each is raised where it happens instead of counted against the package.\n/**\n * Checks a consumer project with the installed TypeScript compiler.\n *\n * @param stage - The installed consumer.\n * @param project - The compiler project path.\n * @returns The located compiler diagnostics. Throws on a tool or project failure.\n */\nexport function checkDistributionProject(\n\tstage: DistributionStage,\n\tproject: string,\n): readonly string[] {\n\tconst result = runDistributionNode(\n\t\t[DISTRIBUTION_COMPILER, '--noEmit', '--pretty', 'false', '-p', project],\n\t\tstage.consumer,\n\t)\n\tconst refused = \\`\\${result.stderr ?? ''}\\`.trim()\n\tif (refused.length > 0) {\n\t\tthrow new Error(\\`The consumer compiler wrote \\${refused} to its error stream\\`)\n\t}\n\tconst lines = \\`\\${result.stdout ?? ''}\\`.split(/\\\\r\\\\n|\\\\n/u).filter((line) => line.trim().length > 0)\n\t// An elaborated diagnostic prints its detail on indented lines under its own\n\t// first line, so each of those joins the diagnostic it elaborates. The first line\n\t// has no diagnostic above it to join, so it opens one whatever its indentation.\n\tconst heads = lines.flatMap((line, index) => (index === 0 || !/^\\\\s/u.test(line) ? [index] : []))\n\tconst reported = heads.map((head, position) => {\n\t\tconst line = lines[head] ?? ''\n\t\tconst located = DISTRIBUTION_DIAGNOSTIC_PATTERN.exec(line)?.[1]\n\t\tif (located === undefined) {\n\t\t\tthrow new Error(\\`The consumer compiler reported \\${line}, which names no location\\`)\n\t\t}\n\t\tif (resolve(stage.consumer, located) === project) {\n\t\t\tthrow new Error(\\`The scratch project is itself at fault: \\${line}\\`)\n\t\t}\n\t\treturn [\n\t\t\tline,\n\t\t\t...lines.slice(head + 1, heads[position + 1] ?? lines.length).map((detail) => detail.trim()),\n\t\t].join(' ')\n\t})\n\tif (reported.length === 0 && result.status !== 0) {\n\t\tthrow new Error(\\`The consumer compiler refused the project: \\${readDistributionOutput(result)}\\`)\n\t}\n\treturn reported\n}\n\n// One installed entry's published names checked against its own declarations by\n// the compiler this workspace installs, in the direction each divergence surfaces\n// under. The runtime's key list is written into the consumer as a literal, so the\n// published side comes from a real process and the declared side from the\n// declarations that process's package ships, and the two can disagree. A name the\n// declarations carry and the runtime does not lands on \\`declared\\`. A name the\n// runtime carries and the declarations do not, and a name the declarations publish\n// as a type alone, land on \\`surfaced\\`: a variable widens into the type\n// \\`declared\\` annotates, and only \\`surfaced\\` reads the literal's own keys back.\n// Each names the member it is about, so the failure says which export moved.\n/**\n * Checks runtime export names against their installed declarations.\n *\n * @param stage - The installed consumer.\n * @param surface - The publication and declaration pair.\n * @returns The diagnostics labelled by compiler resolution.\n */\nexport function checkDistributionSurface(\n\tstage: DistributionStage,\n\tsurface: DistributionSurface,\n): readonly string[] {\n\tconst slug = surface.entry.subpath.replaceAll(/[^\\\\w]+/gu, '-')\n\tconst name = \\`surface.\\${surface.driver.label}\\${slug}.\\${surface.extension}\\`\n\tconst module = \\`\\${name}\\`\n\tconst keys = surface.published.map((key) => \\`\\${JSON.stringify(key)}: true\\`).join(', ')\n\twriteDistributionFile(\n\t\tjoin(stage.consumer, module),\n\t\t\\`import * as entry from \\${JSON.stringify(surface.entry.specifier)}\nexport const published = {\\${keys.length === 0 ? '' : \\` \\${keys} \\`}} as const\nexport const declared: Record<keyof typeof entry, true> = published\nexport const surfaced: Record<keyof typeof published, true> = declared\n\\`,\n\t)\n\tconst project = writeDistributionProject(stage, name, surface.driver, [\\`./\\${module}\\`])\n\treturn checkDistributionProject(stage, project).map((line) => \\`\\${surface.driver.label}: \\${line}\\`)\n}\n\n// One consumer module importing every installed entry, written where its own\n// resolution finds the installed package.\n/**\n * Writes a consumer importing the requested public specifiers.\n *\n * @param stage - The installed consumer.\n * @param path - The consumer-relative source path.\n * @param specifiers - The public imports to resolve.\n */\nexport function writeDistributionConsumerProbe(\n\tstage: DistributionStage,\n\tpath: string,\n\tspecifiers: readonly string[],\n): void {\n\tconst modules = specifiers.map((specifier, index) => ({\n\t\tbinding: \\`entry\\${String(index)}\\`,\n\t\tspecifier,\n\t}))\n\tconst bindings = modules.map(\n\t\t({ binding, specifier }) => \\`import * as \\${binding} from \\${JSON.stringify(specifier)}\\`,\n\t)\n\tconst names = modules.map(({ binding }) => binding)\n\tconst source = \\`\\${bindings.join('\\\\n')}\\\\nexport const surface = [\\${names.join(', ')}]\\\\n\\`\n\twriteDistributionFile(join(stage.consumer, path), source)\n}\n\n// The runtime key set a real process reads off one installed entry under one\n// condition. The driver is a file rather than an \\`--eval\\` string, so the specifier\n// travels as an argument and nothing needs escaping.\n/**\n * Reads the names a real Node process loads from an installed entry.\n *\n * @param stage - The installed consumer.\n * @param specifier - The public package specifier.\n * @param driver - The consumer driver filename.\n * @returns The exported names. Throws when loading or decoding fails.\n */\nexport function driveDistributionRuntime(\n\tstage: DistributionStage,\n\tspecifier: string,\n\tdriver: string,\n): readonly string[] {\n\tconst result = runDistributionNode([join(stage.consumer, driver), specifier], stage.consumer)\n\tif (result.status !== 0) {\n\t\tthrow new Error(\n\t\t\t\\`Loading \\${specifier} from the consumer failed: \\${readDistributionOutput(result)}\\`,\n\t\t)\n\t}\n\tconst published: unknown = JSON.parse(result.stdout)\n\tif (!isDistributionNames(published))\n\t\tthrow new Error(\\`The driver printed no name list for \\${specifier}\\`)\n\treturn published\n}\n{{helpers}}\n// Pack this workspace, install the archive into an isolated consumer, and read the\n// published surface back off the installed tree. Every later claim reads this\n// result, so a failure here is raised where it happens rather than once per entry.\n/**\n * Packs the workspace and installs its archive into an isolated consumer.\n *\n * @param scratch - The owned scratch root.\n * @returns The installed consumer and classified exports.\n * @throws Thrown when packing or installation fails.\n */\nexport function buildDistributionStage(scratch: string): DistributionStage {\n\tconst packed = join(scratch, 'packed')\n\tconst consumer = join(scratch, 'consumer')\n\tmkdirSync(packed, { recursive: true })\n\tconst pack = runDistributionNpm(\n\t\t['pack', '--ignore-scripts', '--pack-destination', packed],\n\t\tDISTRIBUTION_ROOT,\n\t\tscratch,\n\t)\n\tif (pack.status !== 0)\n\t\tthrow new Error(\\`npm pack refused this workspace: \\${readDistributionOutput(pack)}\\`)\n\tconst archives = readdirSync(packed).filter((name) => name.endsWith('.tgz'))\n\tconst archive = archives[0]\n\tif (archives.length !== 1 || archive === undefined) {\n\t\tthrow new Error(\\`npm pack wrote no single archive: \\${archives.join(', ')}\\`)\n\t}\n\twriteDistributionFile(join(consumer, 'package.json'), DISTRIBUTION_CONSUMER_MANIFEST)\n\twriteDistributionFile(join(consumer, DISTRIBUTION_ESM_DRIVER), DISTRIBUTION_ESM_DRIVER_SOURCE)\n\twriteDistributionFile(join(consumer, DISTRIBUTION_CJS_DRIVER), DISTRIBUTION_CJS_DRIVER_SOURCE)\n\tconst install = runDistributionNpm(\n\t\t['install', '--ignore-scripts', '--no-audit', '--no-fund', join(packed, archive)],\n\t\tconsumer,\n\t\tscratch,\n\t)\n\tif (install.status !== 0) {\n\t\tthrow new Error(\\`Installing the packed archive failed: \\${readDistributionOutput(install)}\\`)\n\t}\n\tconst name = readDistributionManifestName(join(DISTRIBUTION_ROOT, 'package.json'))\n\tconst installed = join(consumer, 'node_modules', ...name.split('/'))\n\tconst manifest = readDistributionJSON(join(installed, 'package.json'))\n\tif (!isDistributionRecord(manifest) || !isDistributionRecord(manifest.exports)) {\n\t\tthrow new Error('The installed manifest publishes no exports map')\n\t}\n\treturn { consumer, installed, archives, ...classifyDistributionStage(manifest, installed, name) }\n}\n\n// One file's run: the scratch directory and the staged consumer, which is absent when the\n// registry could not be reached.\n/** Binds an owned scratch directory to its optional installed consumer. */\nexport interface DistributionRun {\n\treadonly scratch: string\n\treadonly stage: DistributionStage | undefined\n}\n\n// The run the start hook binds once for this file and the stop hook releases.\n/** Owns the staged consumer shared by one distribution proof. */\nexport class DistributionSuite implements DistributionSuiteInterface {\n\t#run: DistributionRun | undefined\n\n\tget scratch(): string {\n\t\tif (this.#run === undefined) {\n\t\t\tthrow new Error('The distribution setup has not allocated its scratch directory')\n\t\t}\n\t\treturn this.#run.scratch\n\t}\n\n\tread(context: TestContext): DistributionStage {\n\t\tconst stage = this.#run?.stage\n\t\tif (stage === undefined) {\n\t\t\treturn context.skip('\\`npm ping\\` did not answer, so nothing was packed or installed')\n\t\t}\n\t\treturn stage\n\t}\n\n\tstart(): void {\n\t\tif (this.#run !== undefined) {\n\t\t\tthrow new Error('The distribution setup has already allocated its scratch directory')\n\t\t}\n\t\tconst scratch = mkdtempSync(join(tmpdir(), 'distribution-'))\n\t\tthis.#run = { scratch, stage: openDistributionStage(scratch) }\n\t}\n\n\tdestroy(): void {\n\t\tif (this.#run !== undefined) {\n\t\t\trmSync(this.#run.scratch, { force: true, recursive: true, maxRetries: 3, retryDelay: 100 })\n\t\t}\n\t\tthis.#run = undefined\n\t}\n}\n\n// Installing the packed archive resolves its own runtime dependencies, so an\n// unreachable registry leaves nothing to measure. Under release that is the gate\n// failing; anywhere else the suite skips and names the mechanism it wanted.\n/**\n * Opens an installed consumer after checking registry readiness.\n *\n * @param scratch - The owned scratch root.\n * @returns The installed consumer, or undefined when an ordinary run cannot reach the registry.\n * @throws Thrown in release mode or when staging fails, after removing scratch.\n */\nexport function openDistributionStage(scratch: string): DistributionStage | undefined {\n\ttry {\n\t\tmkdirSync(join(scratch, 'cache'), { recursive: true })\n\t\tif (runDistributionNpm(DISTRIBUTION_PING, DISTRIBUTION_ROOT, scratch).status !== 0) {\n\t\t\tif (!DISTRIBUTION_RELEASE) return undefined\n\t\t\tthrow new Error(\n\t\t\t\t'The release gate requires a reachable npm registry, and npm ping did not answer',\n\t\t\t)\n\t\t}\n\t\treturn buildDistributionStage(scratch)\n\t} catch (error) {\n\t\trmSync(scratch, {\n\t\t\tforce: true,\n\t\t\trecursive: true,\n\t\t\tmaxRetries: 3,\n\t\t\tretryDelay: 100,\n\t\t})\n\t\tthrow error\n\t}\n}\n\n/**\n * Partitions an installed exports map into driven, undeclared, and excluded subpaths.\n *\n * @param manifest - The installed package manifest.\n * @param installed - The installed package root.\n * @param name - The published package name.\n * @returns The classified entries and complete target population.\n * @throws Thrown when the exports map is absent.\n */\nexport function classifyDistributionStage(\n\tmanifest: Readonly<Record<string, unknown>>,\n\tinstalled: string,\n\tname: string,\n): DistributionClassification {\n\tif (!isDistributionRecord(manifest.exports))\n\t\tthrow new Error('The installed manifest publishes no exports map')\n\tconst readings = Object.entries(manifest.exports).map(([subpath, mapping]) => {\n\t\tconst files = collectDistributionTargets(mapping)\n\t\tconst declaration = readDistributionDeclaration(mapping, installed)\n\t\t// A subpath resolving no declaration is partitioned rather than dropped. It is a\n\t\t// defect when a runtime loads one of its targets for names, because a consumer\n\t\t// importing it compiles against nothing under \\`node16\\`. It is an excluded\n\t\t// publication otherwise: the \\`\"./package.json\"\\` manifest pointer and a stylesheet\n\t\t// are published for a reader rather than an importer.\n\t\tif (\n\t\t\tdeclaration.module === undefined &&\n\t\t\tdeclaration.commonjs === undefined &&\n\t\t\tdeclaration.browser === undefined\n\t\t) {\n\t\t\treturn { subpath, files, entry: undefined }\n\t\t}\n\t\tconst importTarget = resolveDistributionTarget(mapping, DISTRIBUTION_RUNTIME_CONDITIONS.module)\n\t\tconst requireTarget = resolveDistributionTarget(\n\t\t\tmapping,\n\t\t\tDISTRIBUTION_RUNTIME_CONDITIONS.commonjs,\n\t\t)\n\t\tconst browserTarget = resolveDistributionTarget(\n\t\t\tmapping,\n\t\t\tDISTRIBUTION_RUNTIME_CONDITIONS.browser,\n\t\t)\n\t\tconst browsable = resolvesDistributionBrowser(mapping)\n\t\tconst shadowed = browsable && requireTarget === browserTarget\n\t\tconst requirable = requireTarget !== undefined && !shadowed\n\t\tconst loadable = requirable && resolvesDistributionCommonJS(mapping, installed)\n\t\tconst entry: DistributionEntry = {\n\t\t\tsubpath,\n\t\t\tspecifier: subpath === '.' ? name : \\`\\${name}\\${subpath.slice(1)}\\`,\n\t\t\tmapping,\n\t\t\tdeclaration: {\n\t\t\t\timportable: declaration.module !== undefined,\n\t\t\t\trequirable: declaration.commonjs !== undefined,\n\t\t\t\tbrowsable: declaration.browser !== undefined,\n\t\t\t},\n\t\t\tbrowsable,\n\t\t\timportable: importTarget !== undefined && !(browsable && importTarget === browserTarget),\n\t\t\trequirable,\n\t\t\tloadable,\n\t\t}\n\t\treturn { subpath, files, entry }\n\t})\n\tconst entries = readings.flatMap(({ entry }) => (entry === undefined ? [] : [entry]))\n\tconst targets = readings.flatMap(({ files }) => files)\n\tconst subpaths = readings.map(({ subpath }) => subpath)\n\tconst undeclared = readings\n\t\t.filter(({ entry, files }) => entry === undefined && files.some(matchesDistributionModule))\n\t\t.map(({ subpath }) => subpath)\n\tconst excluded = readings\n\t\t.filter(({ entry, files }) => entry === undefined && !files.some(matchesDistributionModule))\n\t\t.map(({ subpath }) => subpath)\n\treturn { entries, subpaths, undeclared, excluded, targets }\n}\n\n/**\n * Creates the lifecycle boundary used by generated distribution proofs.\n * @returns The suite interface backed by an owned run.\n */\nexport function createDistributionSuite(): DistributionSuiteInterface {\n\treturn new DistributionSuite()\n}\n\n/**\n * Collects physical files beneath an installed output directory.\n * @param directory - The output directory to walk.\n * @returns The installed files, or an empty list when the directory is absent.\n */\nexport function collectDistributionFiles(directory: string): readonly string[] {\n\tif (!existsSync(directory)) return []\n\treturn readdirSync(directory, { withFileTypes: true }).flatMap((entry) => {\n\t\tconst path = join(directory, entry.name)\n\t\treturn entry.isDirectory() ? collectDistributionFiles(path) : entry.isFile() ? [path] : []\n\t})\n}\n\n/**\n * Reads the source environment owning an installed output path.\n * @param installed - The installed package root.\n * @param path - The output file.\n * @returns The source environment, or undefined outside a JavaScript face.\n */\nexport function readDistributionFace(installed: string, path: string): string | undefined {\n\tconst [output, axis, face] = relativePath(installed, path).split(sep)\n\treturn output === 'dist'\n\t\t? axis === 'src'\n\t\t\t? face\n\t\t\t: axis === 'bin'\n\t\t\t\t? 'bin'\n\t\t\t\t: undefined\n\t\t: undefined\n}\n\n/**\n * Scans installed JavaScript maps for sources copied from another environment.\n * @param installed - The installed package root.\n * @returns The copied sources and unreadable maps.\n * @throws Thrown when a code-bearing output has no readable map of its own.\n */\nexport function scanDistributionSourceMaps(installed: string): readonly string[] {\n\tconst files = collectDistributionFiles(join(installed, 'dist')).filter(\n\t\t(path) => readDistributionFace(installed, path) !== undefined,\n\t)\n\tconst outputs = files\n\t\t.filter((path) => /\\\\.(?:js|cjs|mjs)$/u.test(path))\n\t\t.map((path) => {\n\t\t\tconst parsed = parseSync(path, readFileSync(path, 'utf8'))\n\t\t\tconst code = parsed.program.body.some(\n\t\t\t\t(statement) =>\n\t\t\t\t\tstatement.type !== 'EmptyStatement' &&\n\t\t\t\t\t!(\n\t\t\t\t\t\tstatement.type === 'ExportNamedDeclaration' &&\n\t\t\t\t\t\tstatement.declaration === null &&\n\t\t\t\t\t\tstatement.specifiers.length === 0 &&\n\t\t\t\t\t\tstatement.source === null\n\t\t\t\t\t),\n\t\t\t)\n\t\t\tconst reference = parsed.comments\n\t\t\t\t.flatMap((comment) => {\n\t\t\t\t\tconst match = /^[@#]\\\\s*sourceMappingURL=(\\\\S+)\\\\s*$/u.exec(comment.value)\n\t\t\t\t\treturn match?.[1] === undefined ? [] : [match[1]]\n\t\t\t\t})\n\t\t\t\t.at(-1)\n\t\t\ttry {\n\t\t\t\tconst inline = reference?.startsWith('data:') === true\n\t\t\t\tconst target = inline\n\t\t\t\t\t? path\n\t\t\t\t\t: reference === undefined\n\t\t\t\t\t\t? \\`\\${path}.map\\`\n\t\t\t\t\t\t: fileURLToPath(new URL(reference.replaceAll('\\\\\\\\', '/'), pathToFileURL(path)))\n\t\t\t\treturn {\n\t\t\t\t\tpath: target,\n\t\t\t\t\tface: readDistributionFace(installed, path),\n\t\t\t\t\tcode,\n\t\t\t\t\treference: inline ? reference : undefined,\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\tthrow new Error(\\`Unreadable source maps for \\${path}\\`)\n\t\t\t}\n\t\t})\n\tconst maps = [\n\t\t...outputs.filter(\n\t\t\t({ path, code, reference }) => code || reference !== undefined || existsSync(path),\n\t\t),\n\t\t...files\n\t\t\t.filter(\n\t\t\t\t(path) =>\n\t\t\t\t\t/\\\\.(?:js|cjs|mjs)\\\\.map$/u.test(path) && !outputs.some((output) => output.path === path),\n\t\t\t)\n\t\t\t.map((path) => ({\n\t\t\t\tpath,\n\t\t\t\tface: readDistributionFace(installed, path),\n\t\t\t\tcode: false,\n\t\t\t\treference: undefined,\n\t\t\t})),\n\t]\n\tif (maps.length === 0)\n\t\tconsole.info('No built JavaScript face holds code, so no source map is required')\n\treturn maps.flatMap(({ path, face, code, reference }) => {\n\t\tconst label = relativePath(installed, path).split(sep).join('/')\n\t\ttry {\n\t\t\tconst payload =\n\t\t\t\treference === undefined\n\t\t\t\t\t? undefined\n\t\t\t\t\t: /^data:application\\\\/json(?:;charset=[^;,]+)?(;base64)?,(.*)$/iu.exec(reference)\n\t\t\tconst map: unknown =\n\t\t\t\treference === undefined\n\t\t\t\t\t? readDistributionJSON(path)\n\t\t\t\t\t: payload?.[2] === undefined\n\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t: JSON.parse(\n\t\t\t\t\t\t\t\tpayload[1] === undefined\n\t\t\t\t\t\t\t\t\t? decodeURIComponent(payload[2])\n\t\t\t\t\t\t\t\t\t: Buffer.from(payload[2], 'base64').toString('utf8'),\n\t\t\t\t\t\t\t)\n\t\t\tif (\n\t\t\t\t!isDistributionRecord(map) ||\n\t\t\t\t!isDistributionNames(map.sources) ||\n\t\t\t\t(map.sourceRoot !== undefined && typeof map.sourceRoot !== 'string')\n\t\t\t) {\n\t\t\t\tthrow new Error('Unreadable source map')\n\t\t\t}\n\t\t\tconst root = typeof map.sourceRoot === 'string' ? map.sourceRoot : ''\n\t\t\tconst directory = root.startsWith('file:')\n\t\t\t\t? fileURLToPath(new URL(root))\n\t\t\t\t: resolve(dirname(path), root.replaceAll('\\\\\\\\', '/'))\n\t\t\tconst sources = map.sources.map((source) =>\n\t\t\t\trelativePath(\n\t\t\t\t\tresolve(installed),\n\t\t\t\t\tsource.startsWith('file:')\n\t\t\t\t\t\t? fileURLToPath(new URL(source))\n\t\t\t\t\t\t: resolve(directory, source.replaceAll('\\\\\\\\', '/')),\n\t\t\t\t)\n\t\t\t\t\t.split(sep)\n\t\t\t\t\t.join('/'),\n\t\t\t)\n\t\t\tconst copied = sources.filter(\n\t\t\t\t(source) => source.startsWith('src/') && !source.startsWith(\\`src/\\${face}/\\`),\n\t\t\t)\n\t\t\treturn [\n\t\t\t\t...copied.map((source) => \\`\\${label}: \\${source}\\`),\n\t\t\t\t...(sources.some((source) => source.startsWith(\\`src/\\${face}/\\`))\n\t\t\t\t\t? []\n\t\t\t\t\t: [\\`\\${label}: unreadable source map (no src/\\${face}/ source)\\`]),\n\t\t\t]\n\t\t} catch {\n\t\t\tif (code) throw new Error(\\`Unreadable source maps for \\${path}\\`)\n\t\t\treturn [\\`\\${label}: unreadable source map\\`]\n\t\t}\n\t})\n}\n\n/**\n * Reads top-level names declared by a roll-up, including unexported declarations.\n * @param path - The installed declaration file.\n * @returns The declared names. Refuses syntax errors and unreadable binding patterns.\n */\nexport function readDistributionNames(path: string): readonly string[] {\n\tconst source = parseSync(path, readFileSync(path, 'utf8'))\n\tif (source.errors.length > 0) throw new Error(\\`Unreadable declarations at \\${path}\\`)\n\treturn source.program.body.flatMap((statement) => {\n\t\tconst declaration =\n\t\t\tstatement.type === 'ExportNamedDeclaration' || statement.type === 'ExportDefaultDeclaration'\n\t\t\t\t? statement.declaration\n\t\t\t\t: statement\n\t\tif (declaration === null) return []\n\t\tif (declaration.type === 'VariableDeclaration') {\n\t\t\treturn declaration.declarations.map((binding) => {\n\t\t\t\tif (binding.id.type !== 'Identifier')\n\t\t\t\t\tthrow new Error(\\`Unreadable declaration binding at \\${path}\\`)\n\t\t\t\treturn binding.id.name\n\t\t\t})\n\t\t}\n\t\tif (\n\t\t\tdeclaration.type === 'ClassDeclaration' ||\n\t\t\tdeclaration.type === 'FunctionDeclaration' ||\n\t\t\tdeclaration.type === 'TSDeclareFunction' ||\n\t\t\tdeclaration.type === 'TSInterfaceDeclaration' ||\n\t\t\tdeclaration.type === 'TSTypeAliasDeclaration' ||\n\t\t\tdeclaration.type === 'TSEnumDeclaration' ||\n\t\t\tdeclaration.type === 'TSModuleDeclaration'\n\t\t) {\n\t\t\treturn declaration.id?.type === 'Identifier' ? [declaration.id.name] : []\n\t\t}\n\t\treturn []\n\t})\n}\n\n/**\n * Checks whether a source entry exports names, following local star exports.\n * @param path - The source entry to inspect.\n * @param ancestors - The entries already visited on this export path.\n * @returns True if the entry exports a name; false otherwise.\n */\nexport function matchesDistributionSourceExports(\n\tpath: string,\n\tancestors: readonly string[] = [],\n): boolean {\n\tif (ancestors.includes(path)) return false\n\tconst source = parseSync(path, readFileSync(path, 'utf8'))\n\tif (source.errors.length > 0) throw new Error(\\`Unreadable source exports at \\${path}\\`)\n\treturn source.program.body.some((statement) => {\n\t\tif (statement.type === 'ExportDefaultDeclaration') return ancestors.length === 0\n\t\tif (statement.type === 'ExportNamedDeclaration')\n\t\t\treturn (\n\t\t\t\tstatement.declaration !== null ||\n\t\t\t\tstatement.specifiers.some((specifier) => {\n\t\t\t\t\tconst name =\n\t\t\t\t\t\tspecifier.exported.type === 'Identifier'\n\t\t\t\t\t\t\t? specifier.exported.name\n\t\t\t\t\t\t\t: specifier.exported.value\n\t\t\t\t\treturn ancestors.length === 0 || name !== 'default'\n\t\t\t\t})\n\t\t\t)\n\t\tif (statement.type !== 'ExportAllDeclaration') return false\n\t\tif (statement.exported !== null || !statement.source.value.startsWith('.')) return true\n\t\tconst target = resolve(dirname(path), statement.source.value.replace(/\\\\.js$/u, '.ts'))\n\t\treturn matchesDistributionSourceExports(target, [...ancestors, path])\n\t})\n}\n\n/**\n * Scans installed declaration faces for names declared by multiple environments.\n * @param installed - The installed package root.\n * @param source - The workspace holding the source entries being published.\n * @returns The repeated names with their declaring faces.\n * @throws Thrown when a source entry exports names but its roll-up declares none.\n */\nexport function scanDistributionDeclarations(\n\tinstalled: string,\n\tsource: string = DISTRIBUTION_ROOT,\n): readonly string[] {\n\tconst declarations = collectDistributionFiles(join(installed, 'dist'))\n\t\t.filter(matchesDistributionDeclaration)\n\t\t.map((path) => ({\n\t\t\tpath,\n\t\t\tface: readDistributionFace(installed, path),\n\t\t\tnames: readDistributionNames(path),\n\t\t}))\n\tconst entries = collectDistributionFiles(join(source, 'src')).filter((path) => {\n\t\tconst parts = relativePath(source, path).split(sep)\n\t\treturn parts.length === 3 && parts[2] === 'index.ts'\n\t})\n\tconst published = entries.filter((path) => matchesDistributionSourceExports(path))\n\tfor (const path of published) {\n\t\tconst face = relativePath(source, path).split(sep)[1]\n\t\tif (!declarations.some((entry) => entry.face === face && entry.names.length > 0))\n\t\t\tthrow new Error(\n\t\t\t\t\\`The \\${face} source entry exports names but its declaration roll-up declares none\\`,\n\t\t\t)\n\t}\n\tif (published.length === 0)\n\t\tconsole.info('No source entry exports names, so no declaration names are required')\n\tconst names = [...new Set(declarations.flatMap((entry) => entry.names))].sort()\n\treturn names.flatMap((name) => {\n\t\tconst faces = [\n\t\t\t...new Set(\n\t\t\t\tdeclarations\n\t\t\t\t\t.filter((entry) => entry.names.includes(name))\n\t\t\t\t\t.map((entry) => entry.face)\n\t\t\t\t\t.filter((face) => face !== undefined),\n\t\t\t),\n\t\t].sort()\n\t\treturn faces.length > 1 ? [\\`\\${name}: \\${faces.join(', ')}\\`] : []\n\t})\n}\n\n/**\n * Checks the installed manifest against npm's normalization in an owned scratch copy.\n * @param installed - The installed package root, read only.\n * @param scratch - The suite's owned scratch root and npm cache parent.\n * @returns The top-level keys changed by npm. Refuses an unsuccessful npm command.\n */\nexport function checkDistributionManifest(installed: string, scratch: string): readonly string[] {\n\tconst directory = mkdtempSync(join(scratch, 'manifest-'))\n\ttry {\n\t\tconst path = join(directory, 'package.json')\n\t\twriteFileSync(path, readFileSync(join(installed, 'package.json')))\n\t\tconst before = readDistributionJSON(path)\n\t\tconst result = runDistributionNpm(['pkg', 'fix'], directory, scratch)\n\t\tif (result.status !== 0)\n\t\t\tthrow new Error(\\`npm pkg fix failed: \\${readDistributionOutput(result)}\\`)\n\t\tconst after = readDistributionJSON(path)\n\t\tif (!isDistributionRecord(before) || !isDistributionRecord(after))\n\t\t\tthrow new Error('Unreadable manifest')\n\t\treturn [...new Set([...Object.keys(before), ...Object.keys(after)])]\n\t\t\t.filter((key) => !isDeepStrictEqual(before[key], after[key]))\n\t\t\t.sort()\n\t} finally {\n\t\trmSync(directory, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 })\n\t}\n}\n\n/**\n * Builds independently registered observations over the suite's installed consumer.\n * @param suite - The lifecycle shared by the proof's hooks and observations.\n * @returns The case rows whose observations each require one assertion.\n */\nexport function buildDistributionCases(\n\tsuite: DistributionSuiteInterface,\n): readonly DistributionCase[] {\n\treturn [\n\t\t{\n\t\t\tlabel: 'classifies synthetic export mappings without a registry stage',\n\t\t\tobserve: () => {\n\t\t\t\tconst root = join(suite.scratch, 'classifiers')\n\t\t\t\twriteDistributionFile(\n\t\t\t\t\tjoin(root, 'package.json'),\n\t\t\t\t\tJSON.stringify({\n\t\t\t\t\t\ttype: 'commonjs',\n\t\t\t\t\t\texports: {\n\t\t\t\t\t\t\tcondition: { browser: './b.js', default: './n.js' },\n\t\t\t\t\t\t\tconvention: { default: './dist/src/browser/index.js' },\n\t\t\t\t\t\t\tuniversal: { default: './shared.js' },\n\t\t\t\t\t\t\t'import-shared': {\n\t\t\t\t\t\t\t\tbrowser: './shared.mjs',\n\t\t\t\t\t\t\t\timport: './shared.mjs',\n\t\t\t\t\t\t\t\tdefault: './node.js',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t'require-shared': {\n\t\t\t\t\t\t\t\tbrowser: './shared.cjs',\n\t\t\t\t\t\t\t\trequire: './shared.cjs',\n\t\t\t\t\t\t\t\tdefault: './node.js',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tnode: { node: './node.js', default: './node.js' },\n\t\t\t\t\t\t\tsilent: { 'module-sync': './x.cjs', import: './x.mjs' },\n\t\t\t\t\t\t\tmodule: { require: './x.mjs' },\n\t\t\t\t\t\t\t'nested-module': { require: './module/x.js' },\n\t\t\t\t\t\t\t'nested-commonjs': { require: './commonjs/x.js' },\n\t\t\t\t\t\t\tesm: { import: './x.mjs' },\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t\twriteDistributionFile(join(root, 'module/package.json'), '{ \"type\": \"module\" }\\\\n')\n\t\t\t\twriteDistributionFile(join(root, 'commonjs/package.json'), '{ \"type\": \"commonjs\" }\\\\n')\n\t\t\t\tconst manifest = readDistributionJSON(join(root, 'package.json'))\n\t\t\t\tif (!isDistributionRecord(manifest) || !isDistributionRecord(manifest.exports)) {\n\t\t\t\t\tthrow new Error('The classifier fixture declares no exports map')\n\t\t\t\t}\n\t\t\t\tconst mappings = manifest.exports\n\n\t\t\t\treturn {\n\t\t\t\t\tactual: {\n\t\t\t\t\t\tbrowser: {\n\t\t\t\t\t\t\tcondition: resolvesDistributionBrowser(mappings.condition),\n\t\t\t\t\t\t\tconvention: resolvesDistributionBrowser(mappings.convention),\n\t\t\t\t\t\t\tuniversal: resolvesDistributionBrowser(mappings.universal),\n\t\t\t\t\t\t\timport: resolvesDistributionBrowser(mappings['import-shared']),\n\t\t\t\t\t\t\trequire: resolvesDistributionBrowser(mappings['require-shared']),\n\t\t\t\t\t\t\tnode: resolvesDistributionBrowser(mappings.node),\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcommonjs: {\n\t\t\t\t\t\t\tsilent: resolvesDistributionCommonJS(mappings.silent, root),\n\t\t\t\t\t\t\tmodule: resolvesDistributionCommonJS(mappings.module, root),\n\t\t\t\t\t\t\tnestedModule: resolvesDistributionCommonJS(mappings['nested-module'], root),\n\t\t\t\t\t\t\tnestedCommonJS: resolvesDistributionCommonJS(mappings['nested-commonjs'], root),\n\t\t\t\t\t\t\tesm: resolvesDistributionCommonJS(mappings.esm, root),\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\texpected: {\n\t\t\t\t\t\tbrowser: {\n\t\t\t\t\t\t\tcondition: true,\n\t\t\t\t\t\t\tconvention: true,\n\t\t\t\t\t\t\tuniversal: false,\n\t\t\t\t\t\t\timport: false,\n\t\t\t\t\t\t\trequire: false,\n\t\t\t\t\t\t\tnode: false,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcommonjs: {\n\t\t\t\t\t\t\tsilent: true,\n\t\t\t\t\t\t\tmodule: false,\n\t\t\t\t\t\t\tnestedModule: false,\n\t\t\t\t\t\t\tnestedCommonJS: true,\n\t\t\t\t\t\t\tesm: false,\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\t{\n\t\t\tlabel: 'keeps installed JavaScript sources in their own environment [requires the registry]',\n\t\t\tobserve: (context) => {\n\t\t\t\tconst stage = suite.read(context)\n\t\t\t\treturn { actual: scanDistributionSourceMaps(stage.installed), expected: [] }\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: 'declares each installed name in one environment [requires the registry]',\n\t\t\tobserve: (context) => {\n\t\t\t\tconst stage = suite.read(context)\n\t\t\t\tconst faces = new Set(\n\t\t\t\t\tcollectDistributionFiles(join(stage.installed, 'dist'))\n\t\t\t\t\t\t.filter(matchesDistributionDeclaration)\n\t\t\t\t\t\t.map((path) => readDistributionFace(stage.installed, path))\n\t\t\t\t\t\t.filter((face) => face !== undefined),\n\t\t\t\t)\n\t\t\t\tconst findings = scanDistributionDeclarations(stage.installed)\n\t\t\t\tif (faces.size <= 1)\n\t\t\t\t\tconsole.info(\n\t\t\t\t\t\t'Fewer than two declaration faces are installed, so no cross-face copy exists',\n\t\t\t\t\t)\n\t\t\t\treturn { actual: findings, expected: [] }\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: 'keeps the installed manifest fixed under npm pkg fix [requires the registry]',\n\t\t\tobserve: (context) => ({\n\t\t\t\tactual: checkDistributionManifest(suite.read(context).installed, suite.scratch),\n\t\t\t\texpected: [],\n\t\t\t}),\n\t\t},\n\t\t{\n\t\t\tlabel: 'packs one archive and installs it in isolation [requires the registry]',\n\t\t\tobserve: (context) => {\n\t\t\t\tconst stage = suite.read(context)\n\t\t\t\treturn {\n\t\t\t\t\tactual: {\n\t\t\t\t\t\tarchives: stage.archives.length,\n\t\t\t\t\t\tinstalled: existsSync(join(stage.installed, 'package.json')),\n\t\t\t\t\t\tentries: stage.entries.length > 0,\n\t\t\t\t\t},\n\t\t\t\t\texpected: { archives: 1, installed: true, entries: true },\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: 'ships every relative target its exports map names [requires the registry]',\n\t\t\tobserve: (context) => {\n\t\t\t\tconst stage = suite.read(context)\n\t\t\t\tconst relative = stage.targets.filter((target) => target.startsWith('./'))\n\t\t\t\treturn {\n\t\t\t\t\tactual: {\n\t\t\t\t\t\tpopulated: relative.length > 0,\n\t\t\t\t\t\tmissing: relative.filter((target) => !existsSync(join(stage.installed, target))),\n\t\t\t\t\t},\n\t\t\t\t\texpected: { populated: true, missing: [] },\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: 'declares types for every module it publishes [requires the registry]',\n\t\t\tobserve: (context) => {\n\t\t\t\tconst stage = suite.read(context)\n\t\t\t\tconst partitioned = [\n\t\t\t\t\t...stage.entries.map((entry) => entry.subpath),\n\t\t\t\t\t...stage.undeclared,\n\t\t\t\t\t...stage.excluded,\n\t\t\t\t]\n\t\t\t\treturn {\n\t\t\t\t\tactual: {\n\t\t\t\t\t\tundeclared: stage.undeclared,\n\t\t\t\t\t\tpartitioned: partitioned.sort(),\n\t\t\t\t\t\tunreachable: stage.entries\n\t\t\t\t\t\t\t.filter((entry) => !entry.importable && !entry.requirable && !entry.browsable)\n\t\t\t\t\t\t\t.map((entry) => entry.subpath),\n\t\t\t\t\t\tuntypable: filterDistributionUntypable(stage.entries, stage.installed).map(\n\t\t\t\t\t\t\t(entry) => entry.subpath,\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t\texpected: {\n\t\t\t\t\t\tundeclared: [],\n\t\t\t\t\t\tpartitioned: [...stage.subpaths].sort(),\n\t\t\t\t\t\tunreachable: [],\n\t\t\t\t\t\tuntypable: [],\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: 'refuses a subpath its exports map does not name [requires the registry]',\n\t\t\tobserve: (context) => {\n\t\t\t\tconst stage = suite.read(context)\n\t\t\t\tconst name = readDistributionManifestName(join(stage.installed, 'package.json'))\n\t\t\t\tconst result = runDistributionNode(\n\t\t\t\t\t[join(stage.consumer, DISTRIBUTION_ESM_DRIVER), \\`\\${name}\\${DISTRIBUTION_ABSENT_SUBPATH}\\`],\n\t\t\t\t\tstage.consumer,\n\t\t\t\t)\n\t\t\t\treturn {\n\t\t\t\t\tactual: {\n\t\t\t\t\t\trefused: result.status !== 0,\n\t\t\t\t\t\tcoded: readDistributionOutput(result).includes('ERR_PACKAGE_PATH_NOT_EXPORTED'),\n\t\t\t\t\t},\n\t\t\t\t\texpected: { refused: true, coded: true },\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: 'compiles a consumer under every module resolution [requires the registry]',\n\t\t\tobserve: (context) => {\n\t\t\t\tconst stage = suite.read(context)\n\t\t\t\tconst name = readDistributionManifestName(join(stage.installed, 'package.json'))\n\t\t\t\tconst readings = DISTRIBUTION_RESOLUTIONS.flatMap((driver) =>\n\t\t\t\t\tDISTRIBUTION_FORMATS.flatMap(([extension, format]) => {\n\t\t\t\t\t\tconst written = filterDistributionEntries(stage.entries, driver.conditions[format])\n\t\t\t\t\t\tif (written.length === 0) return []\n\t\t\t\t\t\tconst label = \\`\\${driver.label}.\\${extension}\\`\n\t\t\t\t\t\tconst probe = \\`probe.\\${label}\\`\n\t\t\t\t\t\tconst specifiers = written.map((entry) => entry.specifier)\n\t\t\t\t\t\twriteDistributionConsumerProbe(stage, probe, specifiers)\n\t\t\t\t\t\tconst project = writeDistributionProject(stage, probe, driver, [\\`./\\${probe}\\`])\n\t\t\t\t\t\tconst messages = checkDistributionProject(stage, project).map(\n\t\t\t\t\t\t\t(message) => \\`\\${label}: \\${message}\\`,\n\t\t\t\t\t\t)\n\t\t\t\t\t\tconst control = \\`control.\\${label}\\`\n\t\t\t\t\t\twriteDistributionConsumerProbe(stage, control, [\n\t\t\t\t\t\t\t\\`\\${name}\\${DISTRIBUTION_ABSENT_SUBPATH}\\`,\n\t\t\t\t\t\t])\n\t\t\t\t\t\tconst refused = writeDistributionProject(stage, control, driver, [\\`./\\${control}\\`])\n\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tmessages,\n\t\t\t\t\t\t\t\tsilent: checkDistributionProject(stage, refused).length === 0 ? [label] : [],\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\treturn {\n\t\t\t\t\tactual: {\n\t\t\t\t\t\tmessages: readings.flatMap(({ messages }) => messages),\n\t\t\t\t\t\tsilent: readings.flatMap(({ silent }) => silent),\n\t\t\t\t\t},\n\t\t\t\t\texpected: { messages: [], silent: [] },\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: 'publishes what it declares to a Node import, and no more',\n\t\t\tobserve: (context) => {\n\t\t\t\tconst stage = suite.read(context)\n\t\t\t\tconst entries = stage.entries.filter((entry) => entry.importable)\n\t\t\t\tif (entries.length === 0) return context.skip('No installed entry supports Node import')\n\t\t\t\tconst readings = entries.map((entry) => {\n\t\t\t\t\tif (!entry.declaration.importable)\n\t\t\t\t\t\tthrow new Error(\\`\\${entry.subpath} publishes no import declaration\\`)\n\t\t\t\t\tconst published = driveDistributionRuntime(\n\t\t\t\t\t\tstage,\n\t\t\t\t\t\tentry.specifier,\n\t\t\t\t\t\tDISTRIBUTION_ESM_DRIVER,\n\t\t\t\t\t)\n\t\t\t\t\tconst drivers = filterDistributionResolutions(entry, 'module')\n\t\t\t\t\treturn {\n\t\t\t\t\t\tentry: entry.subpath,\n\t\t\t\t\t\tdriven: drivers.length > 0,\n\t\t\t\t\t\treported: drivers.flatMap((driver) =>\n\t\t\t\t\t\t\tcheckDistributionSurface(stage, { entry, extension: 'ts', published, driver }),\n\t\t\t\t\t\t),\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\treturn {\n\t\t\t\t\tactual: readings,\n\t\t\t\t\texpected: entries.map((entry) => ({ entry: entry.subpath, driven: true, reported: [] })),\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: 'publishes what it declares to a Node require, and no more',\n\t\t\tobserve: (context) => {\n\t\t\t\tconst stage = suite.read(context)\n\t\t\t\tconst entries = stage.entries.filter((entry) => entry.requirable)\n\t\t\t\tif (entries.length === 0) return context.skip('No installed entry supports Node require')\n\t\t\t\tconst readings = entries.map((entry) => {\n\t\t\t\t\tif (!entry.declaration.requirable)\n\t\t\t\t\t\tthrow new Error(\\`\\${entry.subpath} publishes no require declaration\\`)\n\t\t\t\t\tconst published = driveDistributionRuntime(\n\t\t\t\t\t\tstage,\n\t\t\t\t\t\tentry.specifier,\n\t\t\t\t\t\tDISTRIBUTION_CJS_DRIVER,\n\t\t\t\t\t)\n\t\t\t\t\tconst drivers = filterDistributionResolutions(entry, 'commonjs')\n\t\t\t\t\treturn {\n\t\t\t\t\t\tentry: entry.subpath,\n\t\t\t\t\t\tdriven: drivers.length > 0,\n\t\t\t\t\t\treported: drivers.flatMap((driver) =>\n\t\t\t\t\t\t\tcheckDistributionSurface(stage, { entry, extension: 'cts', published, driver }),\n\t\t\t\t\t\t),\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\treturn {\n\t\t\t\t\tactual: readings,\n\t\t\t\t\texpected: entries.map((entry) => ({ entry: entry.subpath, driven: true, reported: [] })),\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t]\n}\n`,\n\t\t\tproof: `import {\n\t// These exports remain available to proofs emitted by earlier scaffold releases.\n\tbuildDistributionCases,\n\t{{import}}createDistributionSuite,\n} from './setupDistribution.js'\nimport { afterAll, beforeAll, describe, expect, it } from 'vitest'\n\nconst DISTRIBUTION_SUITE = createDistributionSuite()\n\nbeforeAll(() => DISTRIBUTION_SUITE.start())\n\nafterAll(() => DISTRIBUTION_SUITE.destroy())\n\ndescribe('installed package consumer', () => {\n\tfor (const row of buildDistributionCases(DISTRIBUTION_SUITE)) {\n\t\tit(\\`\\${row.label}\\`, async (context) => {\n\t\t\tconst observation = await row.observe(context)\n\t\t\texpect(observation.actual).toStrictEqual(observation.expected)\n\t\t})\n\t}\n{{guard}}{{drive}}})\n`,\n\t\t\ttransport: `import { createServer } from 'node:http'\n`,\n\t\t\ttypes: `import type { PlaywrightProviderOptions } from '@vitest/browser-playwright'\nimport type { Browser } from 'playwright'\n`,\n\t\t\tlauncher: `import { chromium } from 'playwright'\nimport { build } from 'vite'\nimport { resolveBrowser, resolvePinnedBrowser } from '../configs/browsers.js'\n`,\n\t\t\timport: 'checkDistributionBrowser,\\n\\t',\n\t\t\thelpers: `/** Defines the page that loads a bundled browser consumer. */\nexport const DISTRIBUTION_BROWSER_PAGE = \\`<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<meta charset=\"UTF-8\" />\n\t\t<title>Distribution</title>\n\t</head>\n\t<body>\n\t\t<script type=\"module\" src=\"./main.js\"></script>\n\t</body>\n</html>\n\\`\n\n/**\n * Infers the response media type from a bundle filename.\n *\n * @param path - The requested bundle path.\n * @returns The media type, defaulting to application/octet-stream.\n */\nexport function inferDistributionContentType(path: string): string {\n\tif (path.endsWith('.html')) return 'text/html'\n\tif (path.endsWith('.js')) return 'text/javascript'\n\tif (path.endsWith('.css')) return 'text/css'\n\tif (path.endsWith('.json') || path.endsWith('.map')) return 'application/json'\n\treturn 'application/octet-stream'\n}\n\n// \\`resolveBrowser\\` answers with provider options and never reports absence: its\n// last resort is a channel nothing verified. So the launch is attempted and its\n// rejection classified, rather than probed for and ruled on.\n/**\n * Renders the browser endpoint selected by provider options.\n *\n * @param options - The browser provider options.\n * @returns The endpoint, executable, channel, or bundled-browser description.\n */\nexport function renderDistributionBrowser(options: PlaywrightProviderOptions): string {\n\tconst endpoint = options.connectOptions?.wsEndpoint\n\tif (endpoint !== undefined) return \\`the browser server at \\${endpoint}\\`\n\tconst executable = options.launchOptions?.executablePath\n\tif (executable !== undefined) return \\`the executable at \\${executable}\\`\n\tconst channel = options.launchOptions?.channel\n\tif (channel !== undefined) return \\`the \\${channel} channel\\`\n\treturn 'the Chromium Playwright installed for itself'\n}\n\n/**\n * Launches or connects to the selected Chromium browser.\n *\n * @param options - The browser provider options.\n * @returns The real browser. Rejects when the selected browser is unavailable.\n */\nexport async function launchDistributionBrowser(\n\toptions: PlaywrightProviderOptions,\n): Promise<Browser> {\n\tconst endpoint = options.connectOptions?.wsEndpoint\n\tif (endpoint !== undefined) return chromium.connect(endpoint)\n\treturn chromium.launch({ ...options.launchOptions, headless: true })\n}\n\n// A consumer of one installed browser entry, bundled by the Vite toolchain this\n// workspace already declares. Nothing is stubbed: the bundle resolves the installed\n// package and its whole transitive graph as an application consuming it would.\n/**\n * Bundles a browser consumer against an installed public entry.\n *\n * @param stage - The installed consumer.\n * @param entry - The browser publication.\n * @returns The bundle directory. Rejects when Vite cannot build the consumer.\n */\nexport async function bundleDistributionEntry(\n\tstage: DistributionStage,\n\tentry: DistributionEntry,\n): Promise<string> {\n\tconst page = join(stage.consumer, 'pages', entry.subpath.replaceAll(/[^\\\\w]+/gu, '-'))\n\tconst specifier = JSON.stringify(entry.specifier)\n\twriteDistributionFile(join(page, 'index.html'), DISTRIBUTION_BROWSER_PAGE)\n\twriteDistributionFile(\n\t\tjoin(page, 'main.js'),\n\t\t\\`import * as entry from \\${specifier}\\\\nglobalThis.subject = Object.keys(entry).sort()\\\\n\\`,\n\t)\n\tawait build({\n\t\tbase: './',\n\t\tbuild: { emptyOutDir: true, outDir: 'bundle' },\n\t\tconfigFile: false,\n\t\tlogLevel: 'error',\n\t\troot: page,\n\t})\n\treturn join(page, 'bundle')\n}\n\n// The key set the bundled module publishes in a real browser, read off the page\n// after it has loaded over a loopback server. A module that never evaluated\n// publishes nothing, and a page error is raised rather than compared away.\n/**\n * Reads the names a real browser publishes from a served bundle.\n *\n * @param browser - The browser to drive.\n * @param bundle - The built consumer directory.\n * @returns The exported names. Rejects on a page error or an invalid name list.\n */\nexport async function readDistributionBrowserExports(\n\tbrowser: Browser,\n\tbundle: string,\n): Promise<readonly string[]> {\n\tconst server = createServer((request, response) => {\n\t\tconst asked = request.url === undefined || request.url === '/' ? '/index.html' : request.url\n\t\tconst path = join(bundle, decodeURIComponent(asked))\n\t\tif (!path.startsWith(bundle) || !existsSync(path)) {\n\t\t\tresponse.writeHead(404)\n\t\t\tresponse.end()\n\t\t\treturn\n\t\t}\n\t\tresponse.writeHead(200, { 'content-type': inferDistributionContentType(path) })\n\t\tresponse.end(readFileSync(path))\n\t})\n\ttry {\n\t\tawait new Promise<void>((settle) => {\n\t\t\tserver.listen(0, '127.0.0.1', settle)\n\t\t})\n\t\tconst address = server.address()\n\t\tif (address === null || typeof address === 'string') {\n\t\t\tthrow new Error('The bundle server bound no port')\n\t\t}\n\t\tconst page = await browser.newPage()\n\t\tconst failures: string[] = []\n\t\tpage.on('pageerror', (error) => failures.push(String(error)))\n\t\tawait page.goto(\\`http://127.0.0.1:\\${String(address.port)}/\\`, { waitUntil: 'load' })\n\t\tconst published: unknown = await page.evaluate('globalThis.subject')\n\t\tif (failures.length > 0) throw new Error(\\`The bundle raised \\${failures.join(' | ')}\\`)\n\t\tif (!isDistributionNames(published))\n\t\t\tthrow new Error('The bundled module published no name list')\n\t\treturn published\n\t} finally {\n\t\tserver.close()\n\t}\n}\n/**\n * Checks each browser publication against its installed declarations in a real browser.\n * @param stage - The installed consumer to drive.\n * @param context - The proof context that reports unavailable browser prerequisites.\n * @returns The compiler diagnostics each browser publication reports.\n */\nexport async function checkDistributionBrowser(\n\tstage: DistributionStage,\n\tcontext: TestContext,\n): Promise<readonly string[]> {\n\tconst driver = DISTRIBUTION_BROWSER_RESOLUTION\n\tif (driver === undefined) throw new Error(\"DISTRIBUTION_RESOLUTIONS carries no 'bundler' row\")\n\tconst entries = stage.entries.filter((entry) => entry.browsable)\n\tif (entries.length === 0) return context.skip('No installed entry supports a browser')\n\tconst readings: Array<readonly string[]> = []\n\tfor (const entry of entries) {\n\t\tif (!entry.declaration.browsable) {\n\t\t\tthrow new Error(\\`\\${entry.subpath} publishes no browser declaration\\`)\n\t\t}\n\t\tconst options = resolveBrowser(resolvePinnedBrowser(), process.platform, process.env)\n\t\tconst browser = await launchDistributionBrowser(options).catch((error: unknown) => {\n\t\t\tconst cause = \\`\\${renderDistributionBrowser(options)} was rejected: \\${String(error)}\\`\n\t\t\tif (DISTRIBUTION_RELEASE) throw new Error(\\`The release gate requires a browser, and \\${cause}\\`)\n\t\t\treturn context.skip(\\`No browser launched. \\${cause}\\`)\n\t\t})\n\t\ttry {\n\t\t\tconst bundle = await bundleDistributionEntry(stage, entry)\n\t\t\tconst published = await readDistributionBrowserExports(browser, bundle)\n\t\t\t// A browser consumer reads the installed declarations through a bundler, so\n\t\t\t// that is the one driver this face answers under.\n\t\t\tconst reported = checkDistributionSurface(stage, {\n\t\t\t\tentry,\n\t\t\t\textension: 'ts',\n\t\t\t\tpublished,\n\t\t\t\tdriver,\n\t\t\t})\n\t\t\treadings.push(reported)\n\t\t} finally {\n\t\t\tawait browser.close()\n\t\t}\n\t}\n\treturn readings.flat()\n}\n`,\n\t\t\tdrive: `\tit('publishes what it declares to a real browser [requires a browser]', async (context) => {\n\t\texpect(await checkDistributionBrowser(DISTRIBUTION_SUITE.read(context), context)).toStrictEqual(\n\t\t\t[],\n\t\t)\n\t})\n`,\n\t\t\tguard: `\tit('publishes no browser face this proof cannot drive [requires the registry]', (context) => {\n\t\tconst faces = DISTRIBUTION_SUITE.read(context).entries.filter((entry) => entry.browsable)\n\t\texpect(faces.map((entry) => entry.subpath)).toStrictEqual([])\n\t})\n`,\n\t\t}),\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\tagents: `# AGENTS.md\n\nThe \\`@orkestrel/scaffold\\` package is this repository's coding and orchestration authority. This\nfile points at it and states no law of its own.\n\nRead these before working: the \\`AGENTS.md\\` coding contract, the \\`.agents/orchestration.md\\`\nagent-operation contract, every applicable rule the contract's rule map names under\n\\`.claude/rules/\\`, and the dispatch-named skill under \\`.agents/skills/\\` with the references it\nrequires.\n\nResolve every one of those paths against scaffold, never against this repository:\n\n- When a scaffold checkout sits beside this repository, read \\`../scaffold/AGENTS.md\\`, the\n \\`../scaffold/.agents/orchestration.md\\` file, the \\`../scaffold/.claude/rules/\\` directory, and\n the \\`../scaffold/.agents/skills/\\` directory.\n- Otherwise read the installed copy, whose paths drop the dot that opens each segment: the\n \\`node_modules/@orkestrel/scaffold/dist/host/AGENTS.md\\` file, the\n \\`node_modules/@orkestrel/scaffold/dist/host/agents/orchestration.md\\` file, the\n \\`node_modules/@orkestrel/scaffold/dist/host/claude/rules/\\` directory, and the\n \\`node_modules/@orkestrel/scaffold/dist/host/agents/skills/\\` directory.\n\nEvery path a scaffold-supplied file names resolves the same way. Run a script such a file names\nthrough its built twin: replace \\`node .agents/skills/\\` with\n\\`node node_modules/@orkestrel/scaffold/dist/agents/skills/\\` and the \\`.ts\\` extension with \\`.js\\`,\nbecause Node runs no \\`.ts\\` file under \\`node_modules\\`. The files this repository carries\n— the \\`.claude/agents/orkestrel.md\\` catalog file, the \\`.claude/settings.json\\` permission file,\nthe bench scripts under \\`scripts/\\`, and the skill pointers under \\`.agents/skills/\\` and\n\\`.claude/skills/\\`, which name the canonical skills and how to run their scripts — are this\nrepository's own copies and resolve here.\n\nIn Claude Code, also read the Claude bridge: \\`../scaffold/.claude/AGENTS.md\\` beside a checkout, or\n\\`node_modules/@orkestrel/scaffold/dist/host/claude/AGENTS.md\\` from the installed copy. Keep no\n\\`CLAUDE.md\\` in this repository; one stops Claude Code from reading this file.\n\nEdit none of the scaffold-owned files here. The \\`scaffold repair\\` command restores them, so a\nchange to one is a commit in the scaffold repository followed by a release.\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\tskill: `\n# Load the canonical skill\n\nThis file is a pointer the \\`@orkestrel/scaffold\\` package writes into every fleet workspace; the\nskill itself ships with that package. Read the canonical \\`SKILL.md\\` completely and follow it:\n\n- beside a scaffold checkout, \\`../scaffold/.agents/skills/{{name}}/SKILL.md\\`;\n- otherwise, \\`node_modules/@orkestrel/scaffold/dist/host/agents/skills/{{name}}/SKILL.md\\`.\n\nResolve every path the canonical skill names against the same root; under \\`node_modules\\` each\nsegment drops its opening dot. Run a script the skill names through its built twin, as this\nrepository's \\`AGENTS.md\\` states. This pointer carries no process of its own; \\`AGENTS.md\\`, the applicable\nrules, and the canonical skill remain authoritative in that order.\n`,\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'\nimport { isInstance } from '@orkestrel/contract'\n\n/**\n * Represents 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 { isScaffoldError, ScaffoldError } from '@orkestrel/scaffold'\n *\n * try {\n * \tthrow new ScaffoldError('TARGET', 'The target carries no readable manifest.')\n * } catch (error) {\n * \tif (isScaffoldError(error)) error.code // 'TARGET'\n * }\n * ```\n */\nexport class ScaffoldError extends Error {\n\treadonly code: ScaffoldErrorCode\n\treadonly context?: unknown\n\n\t/**\n\t * Constructs 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 * Narrows a caught value to a {@link ScaffoldError}.\n *\n * @param value - The caught value to narrow.\n * @returns True if `value` is a {@link ScaffoldError}; false otherwise.\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 isInstance(value, ScaffoldError)\n}\n","import type { Guard } from '@orkestrel/contract'\nimport type { EmitterHooks } from '@orkestrel/emitter'\nimport type {\n\tArtifact,\n\tAudit,\n\tBlueprint,\n\tBrowserExtension,\n\tCatalogEntry,\n\tCompilerEventMap,\n\tCompilerOptions,\n\tDependency,\n\tEnvironment,\n\tExtension,\n\tFinding,\n\tGroup,\n\tManifestScript,\n\tMirror,\n\tOverride,\n\tPlan,\n\tQuestion,\n\tSnapshot,\n\tStylesExtension,\n\tSurface,\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\tAXES,\n\tCONTROL_CHARACTER_PATTERN,\n\tDEPENDENCY_NAME_PATTERN,\n\tENVIRONMENTS,\n\tFRAMEWORKS,\n\tGROUPS,\n\tHEX_PATTERN,\n\tINVALID_PATH_CHARACTER_PATTERN,\n\tMANIFEST_PATH,\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\tMAX_SCRIPT_LENGTH,\n\tNAME_PATTERN,\n\tRESERVED_SHEET_NAMES,\n\tSURFACES,\n} from './constants.js'\n\n/**\n * Narrows a value to a logical target-relative path.\n *\n * @param value - The candidate path.\n * @returns True if the value is a bounded relative path with no traversal, empty\n * segment, control character, or reserved syntax character; false otherwise.\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 * Narrows 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 * Narrows 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 places the bytes\n * are actually produced.\n */\nexport const isContent: Guard<string> = stringOf({ max: MAX_ARTIFACT_BYTES })\n\n/**\n * Narrows a value to an array within the limit one public collection accepts.\n *\n * @param value - The candidate collection.\n * @returns True if the value is an array of no more than\n * `MAX_COLLECTION_ITEMS` items; false otherwise.\n *\n * @remarks\n * Compose this ahead of an element guard so the item count is settled before\n * anything walks the items. A throwing `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 * Narrows 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 * Narrows a value to a surface an extension can extend.\n * @param value - The candidate surface.\n * @returns True if the value is a supported surface; false otherwise.\n * @example\n * ```ts\n * import { isSurface } from '@orkestrel/scaffold'\n *\n * isSurface('styles') // true\n * isSurface('themes') // false\n * ```\n */\nexport const isSurface: Guard<Surface> = literalOf(SURFACES)\n\n/**\n * Narrows a value to a non-reserved sheet face name.\n * @param value - The candidate name.\n * @returns True if the name matches the workspace pattern and is not reserved; false otherwise.\n * @example\n * ```ts\n * import { isSheetName } from '@orkestrel/scaffold'\n *\n * isSheetName('print') // true\n * isSheetName('styles') // false\n * ```\n */\nexport function isSheetName(value: unknown): value is string {\n\treturn (\n\t\tisString(value) &&\n\t\tvalue.length <= MAX_NAME_LENGTH &&\n\t\tNAME_PATTERN.test(value) &&\n\t\t!RESERVED_SHEET_NAMES.includes(value)\n\t)\n}\n\n/**\n * Narrows a value to a supported browser framework with distinct occupied axes.\n * @param value - The candidate extension.\n * @returns True if the value is an admitted extension; false otherwise.\n * @example\n * ```ts\n * import { isBrowserExtension } from '@orkestrel/scaffold'\n *\n * isBrowserExtension({ surface: 'browser', name: 'vue', axes: ['app'] }) // true\n * isBrowserExtension(undefined) // false\n * ```\n */\nexport const isBrowserExtension: Guard<BrowserExtension> = andOf(\n\trecordOf({\n\t\tsurface: literalOf('browser'),\n\t\tname: literalOf(FRAMEWORKS),\n\t\taxes: andOf(isCollection, arrayOf(literalOf(AXES))),\n\t}),\n\t(extension: BrowserExtension) => new Set(extension.axes).size === extension.axes.length,\n)\n\n/**\n * Narrows a value to a named non-reserved stylesheet face.\n * @param value - The candidate extension.\n * @returns True if the value is an admitted extension; false otherwise.\n * @example\n * ```ts\n * import { isStylesExtension } from '@orkestrel/scaffold'\n *\n * isStylesExtension({ surface: 'styles', name: 'print' }) // true\n * isStylesExtension(undefined) // false\n * ```\n */\nexport const isStylesExtension: Guard<StylesExtension> = recordOf({\n\tsurface: literalOf('styles'),\n\tname: isSheetName,\n})\n\n/**\n * Narrows a value to an extension of a supported surface.\n * @param value - The candidate extension.\n * @returns True if the value is an admitted extension; false otherwise.\n * @example\n * ```ts\n * import { isExtension } from '@orkestrel/scaffold'\n *\n * isExtension({ surface: 'styles', name: 'print' }) // true\n * isExtension(undefined) // false\n * ```\n */\nexport const isExtension: Guard<Extension> = unionOf(isBrowserExtension, isStylesExtension)\n\n/**\n * Narrows 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/** Narrows a value to a bounded group selection. */\nexport const isGroups: Guard<readonly Group[]> = andOf(isCollection, arrayOf(isGroup))\n\n/**\n * Narrows 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 * Narrows 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 * Narrows a value to a {@link ManifestScript}.\n *\n * @remarks\n * Structural and bounded, exactly as {@link isDependency} is: a script name\n * and a script command are free text a manifest may carry, and which values a\n * region writer is willing to overwrite is the caller's decision rather than\n * this guard's.\n *\n * @example\n * ```ts\n * import { isManifestScript } from '@orkestrel/scaffold'\n *\n * isManifestScript({ name: 'test', command: 'vitest run', accepted: [] }) // true\n * isManifestScript({ name: 'test', command: 'vitest run' }) // false\n * ```\n */\nexport const isManifestScript: Guard<ManifestScript> = recordOf({\n\tname: stringOf({ min: 1, max: MAX_SCRIPT_LENGTH }),\n\tcommand: stringOf({ min: 1, max: MAX_SCRIPT_LENGTH }),\n\taccepted: andOf(isCollection, arrayOf(stringOf({ min: 1, max: MAX_SCRIPT_LENGTH }))),\n})\n\n/**\n * Narrows 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 * Narrows 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\textensions: andOf(isCollection, arrayOf(isExtension)),\n\t\tstyles: isBoolean,\n\t\tthemes: isBoolean,\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\tsetup: andOf(isCollection, arrayOf(literalOf('node', 'browser'))),\n\t\tguides: isBoolean,\n\t\tintegration: isBoolean,\n\t\tconformance: isBoolean,\n\t\ttree: isBoolean,\n\t\tservice: isBoolean,\n\t\tvendors: andOf(isCollection, arrayOf(isString)),\n\t\tstudies: isBoolean,\n\t\tglobal: isBoolean,\n\t\tshowcase: isBoolean,\n\t\tjourney: isBoolean,\n\t\tskills: isBoolean,\n\t},\n\t['description'],\n)\n\n/**\n * Narrows 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\tpointer: isBoolean,\n\t\t},\n\t\t['environment', 'source', 'pointer'],\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 * Narrows 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. An artifact at {@link MANIFEST_PATH}\n * must carry `birth` ownership. A plan claiming `content` or `presence` there\n * is refused because the compiler emits the manifest only as birth-owned.\n */\nexport const isPlan: Guard<Plan> = andOf(\n\trecordOf(\n\t\t{\n\t\t\tblueprint: isBlueprint,\n\t\t\tgroups: isGroups,\n\t\t\tartifacts: andOf(isCollection, arrayOf(isArtifact)),\n\t\t\thash: isHex,\n\t\t},\n\t\t['hash'],\n\t),\n\t(plan: Plan) =>\n\t\tplan.artifacts.every(\n\t\t\t(artifact) => artifact.path !== MANIFEST_PATH || artifact.ownership === 'birth',\n\t\t),\n)\n\n/**\n * Narrows 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 * Narrows 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 * Narrows 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 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 * Narrows 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 they 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', 'unmatched', 'failed'),\n\t\t\tnote: isString,\n\t\t\tobserved: isHex,\n\t\t},\n\t\t['observed'],\n\t),\n)\n\n/**\n * Narrows 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\tpeers: andOf(isCollection, arrayOf(isDependency)),\n\t}),\n\trecordOf({\n\t\tname: isDependencyName,\n\t\tlookup: literalOf('missing', 'unmatched', 'failed'),\n\t\tnote: isString,\n\t}),\n)\n\n/**\n * Narrows a value to a {@link Snapshot}.\n *\n * @param value - The candidate target snapshot.\n * @returns True if the value is a bounded plain record whose every key is a path and\n * whose every value is exact lowercase hexadecimal bytes; false otherwise.\n *\n * @remarks\n * Read through the shared total key lens, so an `ownKeys` trap that throws 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 * Narrows 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 * Narrows 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 * Snapshots 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, Extension, Group, Snapshot } from './types.js'\nimport { isString } from '@orkestrel/contract'\nimport {\n\tisBlueprint,\n\tisCompilerOptions,\n\tisExtension,\n\tisGroups,\n\tisSnapshot,\n\tisSurface,\n} from './validators.js'\n\n/**\n * Coerces an extension value or a `surface:name` selection into an extension.\n * @param value - An extension record or its selection text.\n * @returns The extension, or `undefined` for a malformed or unsupported selection.\n * @remarks Browser text has empty axes; the creating command supplies its selected browser axes.\n * @example\n * ```ts\n * import { parseExtension } from '@orkestrel/scaffold'\n *\n * parseExtension('browser:vue') // { surface: 'browser', name: 'vue', axes: [] }\n * parseExtension('styles:print') // { surface: 'styles', name: 'print' }\n * ```\n */\nexport function parseExtension(value: unknown): Extension | undefined {\n\tif (isExtension(value)) return value\n\tif (!isString(value)) return undefined\n\tconst [surface, name, excess] = value.split(':')\n\tif (excess !== undefined || !isSurface(surface)) return undefined\n\tconst candidate = surface === 'browser' ? { surface, name, axes: [] } : { surface, name }\n\treturn isExtension(candidate) ? candidate : undefined\n}\n\n/**\n * Coerces 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 * Coerces 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 * Coerces 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 * Coerces 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\tManifestDependencySet,\n\tManifestToken,\n\tDrift,\n\tEnvironment,\n\tFinding,\n\tGroup,\n\tOwnership,\n\tPlan,\n\tPlanSummary,\n} from './types.js'\nimport { compareValues, isRecord, isString, limitEntries, parseJSON } from '@orkestrel/contract'\nimport { fillTemplate } from '@orkestrel/template'\nimport {\n\tCANON_PATHS,\n\tCATALOG_AGENT_PATH,\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\tWORKSPACE_OWNED_PATHS,\n} from './constants.js'\nimport { ARTIFACT_TEMPLATES } from './templates.js'\n\n/**\n * Encodes 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\tconst digits = Array.from({ length: 256 }, (_, value) => value.toString(16).padStart(2, '0'))\n\treturn Iterator.from(bytes)\n\t\t.map((byte) => digits[byte] ?? '')\n\t\t.toArray()\n\t\t.join('')\n}\n\n/**\n * Encodes 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 * Counts 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\treturn content[Symbol.iterator]().reduce((bytes, character) => {\n\t\tconst code = character.codePointAt(0) ?? 0\n\t\treturn bytes + (code <= 0x7f ? 1 : code <= 0x7ff ? 2 : code <= 0xffff ? 3 : 4)\n\t}, 0)\n}\n\n/**\n * Computes the sum of a list of numbers.\n *\n * @param values - The numbers to add.\n * @returns The sum, and `0` for no numbers.\n *\n * @remarks\n * The one place a running tally is derived from the amounts that make it up, so a\n * byte budget is the allowance less what was spent rather than a counter that is\n * reassigned as reads land.\n *\n * @example\n * ```ts\n * import { computeTotal } from '@orkestrel/scaffold'\n *\n * computeTotal([65536, 65536, 12]) // 131084\n * computeTotal([]) // 0\n * ```\n */\nexport function computeTotal(values: readonly number[]): number {\n\treturn values.reduce((total, value) => total + value, 0)\n}\n\n/**\n * Yields the answer to each value of a source and ends after the first refused answer.\n *\n * @param source - The values to answer, requested one at a time as the answers are read.\n * @param answer - Answers one value, or returns `undefined` to refuse it.\n * @returns A generator of the answers in source order, whose last answer is the first refusal when\n * the source holds one.\n * @throws Thrown when `answer` throws for a value, with that error, or when closing `source` after\n * a refusal throws, with the close's error.\n *\n * @remarks\n * The body is a `for…of` loop, so the source's iterator is requested once, when the first answer\n * is read, and stepped only as the answers are read: a length the source reports never bounds the\n * read, a hole reads as an `undefined` value, and an infinite source is read as far as the first\n * refusal. The iterator is closed after a refusal with a normal completion, so a raising close\n * surfaces, and is closed when `answer` throws with a throw completion, so the error from `answer`\n * wins. An iterator that ends is left alone. A caller that stops at a refusal and keeps what came\n * before it reads the answers into a list and checks that none is `undefined`.\n *\n * @example\n * ```ts\n * import { iterateAnswers } from '@orkestrel/scaffold'\n *\n * const halve = (value: number): number | undefined => (value % 2 === 0 ? value / 2 : undefined)\n *\n * Array.from(iterateAnswers([2, 4, 5, 6], halve)).length // 3\n * Array.from(iterateAnswers([2, 4], halve)) // [1, 2]\n * ```\n */\nexport function* iterateAnswers<TValue, TAnswer>(\n\tsource: Iterable<TValue>,\n\tanswer: (value: TValue) => TAnswer | undefined,\n): Generator<TAnswer | undefined, void, undefined> {\n\tfor (const value of source) {\n\t\tconst answered = answer(value)\n\t\tyield answered\n\t\tif (answered === undefined) return\n\t}\n}\n\n/**\n * Computes 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\t// The iterator yields code points; a surrogate pair folds as its two code units.\n\tconst hash = text[Symbol.iterator]().reduce((digest, character) => {\n\t\tconst first = BigInt.asUintN(64, (digest ^ BigInt(character.charCodeAt(0))) * 0x100000001b3n)\n\t\treturn character.length === 1\n\t\t\t? first\n\t\t\t: BigInt.asUintN(64, (first ^ BigInt(character.charCodeAt(1))) * 0x100000001b3n)\n\t}, 0xcbf29ce484222325n)\n\treturn hash.toString(16).padStart(16, '0')\n}\n\n/**\n * Tests 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 if the path is beneath a harness directory or is one of the exact\n * root filenames that wires an agent bench; false otherwise.\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 an added\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 * Checks whether another surface owns the vendored bytes at a path.\n *\n * @param path - The target-relative vendored path to test.\n * @returns True if the path is the catalog agent file or a Markdown guide\n * mirror; false otherwise.\n *\n * @remarks\n * The materializer keeps these paths presence-owned because the catalog or\n * mirror surface writes their bytes. A live host fill therefore keeps the\n * installed floor's bytes for them and requests only the host-owned paths.\n *\n * @example\n * ```ts\n * import { isDeferredPath } from '@orkestrel/scaffold'\n *\n * isDeferredPath('guides/router.md') // true\n * isDeferredPath('AGENTS.md') // false\n * ```\n */\nexport function isDeferredPath(path: string): boolean {\n\treturn path === CATALOG_AGENT_PATH || (path.startsWith('guides/') && path.endsWith('.md'))\n}\n\n/**\n * Checks whether a path belongs to the instruction canon a target reads rather than holds.\n *\n * @param path - The target-relative path to test.\n * @returns True if the path is a {@link CANON_PATHS} member or sits beneath a\n * member that is a directory; false otherwise.\n *\n * @remarks\n * The one reading of canon membership, so the live overlay and the executable's\n * fetch list never disagree about what a path is. The match runs to a segment\n * boundary, so a sibling whose name opens with a member's name —\n * `.claude/rulesets` beside `.claude/rules` — stays outside.\n *\n * Membership answers whether scaffold owns the path, not whether a plan claims\n * it. A plan claims `AGENTS.md` and {@link CATALOG_AGENT_PATH} at canon paths\n * deliberately, so a consumer deciding whether to write, restore, or remove a\n * path reads the plan rather than this predicate. A member the checkout no\n * longer holds is still canon, so a copy a target keeps reports as foreign.\n *\n * @example\n * ```ts\n * import { isCanonPath } from '@orkestrel/scaffold'\n *\n * isCanonPath('.claude/rules/names.md') // true\n * isCanonPath('.claude/settings.json') // false\n * ```\n */\nexport function isCanonPath(path: string): boolean {\n\treturn CANON_PATHS.some((canon) => path === canon || path.startsWith(`${canon}/`))\n}\n\n/**\n * Checks whether another surface owns a target's present bytes at a path.\n *\n * @param path - The target-relative path to test.\n * @returns True if the path is a {@link WORKSPACE_OWNED_PATHS} member or a\n * deferred path; false otherwise.\n *\n * @remarks\n * The one reading of presence ownership. A workspace-owned path carries bytes\n * the consumer's own workspace writes, and a deferred path carries bytes the\n * catalog or mirror surface writes, so a vendored expansion plans either by\n * presence rather than reading and claiming its content.\n *\n * @example\n * ```ts\n * import { isRetainedPath } from '@orkestrel/scaffold'\n *\n * isRetainedPath('.gitignore') // true\n * isRetainedPath('LICENSE') // false\n * ```\n */\nexport function isRetainedPath(path: string): boolean {\n\treturn WORKSPACE_OWNED_PATHS.includes(path) || isDeferredPath(path)\n}\n\n/**\n * Checks whether a destination's floor bytes survive a live overlay.\n *\n * @param path - The target-relative destination to test.\n * @returns True if the path is deferred or belongs to the instruction\n * canon; false otherwise.\n *\n * @remarks\n * The one reading of what a live fill does not replace, so the overlay assembler\n * and the executable's fetch list never disagree about a destination. A deferred\n * path's bytes belong to the catalog or mirror verb, and a canon destination is\n * staged for reading rather than for a target, so the installed floor's bytes\n * stand for both. A reader that requested either would spend a round trip on\n * bytes the overlay would not take.\n *\n * @example\n * ```ts\n * import { isFloorPath } from '@orkestrel/scaffold'\n *\n * isFloorPath('AGENTS.md') // true\n * isFloorPath('scripts/codex.sh') // false\n * ```\n */\nexport function isFloorPath(path: string): boolean {\n\treturn isDeferredPath(path) || isCanonPath(path)\n}\n\n/**\n * Infers 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\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 row holds the licence, the workspace's own front page, and the\n\t// scaffold-owned root pointers. The group carries placement rather than\n\t// authorship, so `Ownership` is what separates them.\n\tif (path === 'LICENSE') return 'docs'\n\tif (!path.includes('/') && path.endsWith('.md')) return 'docs'\n\treturn 'configs'\n}\n\n/**\n * Serializes 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\tconst escapes: Readonly<Record<string, string>> = {\n\t\t\"'\": \"\\\\'\",\n\t\t'\\\\': '\\\\\\\\',\n\t\t'\\b': '\\\\b',\n\t\t'\\f': '\\\\f',\n\t\t'\\n': '\\\\n',\n\t\t'\\r': '\\\\r',\n\t\t'\\t': '\\\\t',\n\t\t'
': '\\\\u2028',\n\t\t'
': '\\\\u2029',\n\t}\n\t// The iterator yields code points, so a surrogate pair is one two-unit character\n\t// that passes through and a lone surrogate is a one-unit character that escapes.\n\tconst serialized = Array.from(value, (character) => {\n\t\tconst escape = escapes[character]\n\t\tif (escape !== undefined) return escape\n\t\tconst code = character.charCodeAt(0)\n\t\treturn character.length === 1 && (code < 0x20 || (code >= 0xd800 && code <= 0xdfff))\n\t\t\t? `\\\\u${code.toString(16).padStart(4, '0')}`\n\t\t\t: character\n\t}).join('')\n\treturn `'${serialized}'`\n}\n\n/**\n * Derives 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 * Tests whether one emitted line fits the vendored formatter width.\n *\n * @param line - One emitted line, leading tabs included.\n * @returns True if the expanded line fits; false otherwise.\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 * Selects 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 * Selects 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 * The candidates include the seed guide mirrors beside `HOST_PATHS`. 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 * Selects 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 * Projects 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 * Infers 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 * Projects 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 every ownership tier.\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 * Tests 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 True if the ownership and verdict are reachable through\n * {@link inferDrift}; false otherwise.\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 *\n * @example\n * ```ts\n * import type { Finding } from '@orkestrel/scaffold'\n * import { matchesDriftReachability } from '@orkestrel/scaffold'\n *\n * const aligned: Finding = {\n * \tpath: 'README.md',\n * \tgroup: 'docs',\n * \townership: 'birth',\n * \tdrift: 'aligned',\n * }\n * const stale: Finding = {\n * \tpath: 'README.md',\n * \tgroup: 'docs',\n * \townership: 'birth',\n * \tdrift: 'stale',\n * \tobserved: '6279650a',\n * }\n *\n * matchesDriftReachability('birth', aligned) // true\n * matchesDriftReachability('birth', stale) // false\n * ```\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 * Projects 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 and PEER 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. A\n * peer edge counts like a runtime edge, because a caret peer range at `0.0.x`\n * names one exact release the dependent cannot publish ahead of.\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 ranges that disagree install\n * duplicate copies of one package that the compiler reads as 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 Fleet catalog\n * ```ts\n * import { catalogToLayers } from '@orkestrel/scaffold'\n *\n * const layers = catalogToLayers(entries)\n * layers[0] // the names that depend on nothing else in the fleet\n * ```\n */\nexport function catalogToLayers(\n\tentries: readonly CatalogEntry[],\n): ReadonlyArray<readonly string[]> {\n\t// The names come from a first pass that skips a hole. The edges come from a second pass, whose\n\t// iterator consumes one entry at a time and which reads a hole as an `undefined` entry, as a\n\t// `for…of` over the list would.\n\tconst published = new Set(\n\t\tentries.filter((entry) => entry.lookup === 'found').map((entry) => entry.name),\n\t)\n\t// A later entry of one name replaces an earlier one at the earlier position, as a keyed\n\t// write does, and an edge to a name that is not published constrains nothing.\n\tconst found = Iterator.from(entries)\n\t\t.flatMap((entry): ReadonlyArray<readonly [string, readonly string[]]> =>\n\t\t\tentry.lookup === 'found'\n\t\t\t\t? [\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\tentry.name,\n\t\t\t\t\t\t\t[...entry.dependencies, ...entry.peers]\n\t\t\t\t\t\t\t\t.map((dependency) => dependency.name)\n\t\t\t\t\t\t\t\t.filter((name) => published.has(name)),\n\t\t\t\t\t\t],\n\t\t\t\t\t]\n\t\t\t\t: [],\n\t\t)\n\t\t.toArray()\n\tconst dependencies = new Map(found)\n\t// Each round places every name whose edges are all placed, in name order. A round that places\n\t// nothing leaves the state as it was, which ends the layers: a cycle never becomes ready.\n\t// One round per found entry is enough, because a round that places anything places one name.\n\treturn found.reduce<{\n\t\treadonly layers: ReadonlyArray<readonly string[]>\n\t\treadonly placed: ReadonlySet<string>\n\t}>(\n\t\t(state) => {\n\t\t\tconst ready = [...dependencies]\n\t\t\t\t.filter(\n\t\t\t\t\t([name, edges]) =>\n\t\t\t\t\t\t!state.placed.has(name) && edges.every((edge) => state.placed.has(edge)),\n\t\t\t\t)\n\t\t\t\t.map(([name]) => name)\n\t\t\t\t.sort()\n\t\t\treturn ready.length === 0\n\t\t\t\t? state\n\t\t\t\t: { layers: [...state.layers, ready], placed: new Set([...state.placed, ...ready]) }\n\t\t},\n\t\t{ layers: [], placed: new Set() },\n\t).layers\n}\n\n/**\n * Projects 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\t// The iterator reads a hole as an `undefined` artifact, as a `for…of` over the list would, and the\n\t// tally counts the artifacts it yields rather than the length the list reports.\n\tconst origins = Iterator.from(plan.artifacts)\n\t\t.map((artifact) => artifact.origin)\n\t\t.toArray()\n\tconst host = origins.filter((origin) => origin === 'host').length\n\tconst template = origins.filter((origin) => origin === 'template').length\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: origins.length - host - template,\n\t}\n}\n\n/**\n * Extracts the major, minor, and patch 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 `major.minor.patch` 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 * Extracts the major component of an admitted dependency range.\n *\n * @param range - The candidate range text.\n * @returns The major number, or `undefined` when the text is not a canonical\n * major caret or an admitted full-version form.\n *\n * @remarks\n * A canonical toolchain range is `^MAJOR`. Existing consumer declarations may\n * instead carry an exact `major.minor.patch` version or that version under a\n * caret or tilde. The projection reads those forms without deciding whether a\n * version satisfies them; {@link matchesRange} owns that separate question.\n *\n * @example\n * ```ts\n * import { extractRangeMajor } from '@orkestrel/scaffold'\n *\n * extractRangeMajor('^6') // the declared major\n * extractRangeMajor('>=6.0.0') // undefined\n * ```\n */\nexport function extractRangeMajor(range: string): number | undefined {\n\tconst match =\n\t\t/^(?:\\^(0|[1-9]\\d*)|(?:\\^|~)?(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-]*))*)?)$/.exec(\n\t\t\trange,\n\t\t)\n\tconst major = match?.[1] ?? match?.[2]\n\treturn major === undefined ? undefined : Number(major)\n}\n\n/**\n * Compares 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 (const [index, component] of first.entries()) {\n\t\tconst order = compareValues(component, second[index] ?? 0)\n\t\tif (order !== 0) return order\n\t}\n\treturn 0\n}\n\n/**\n * Tests whether a declared range already admits a published version.\n *\n * @param range - The declared dependency range.\n * @param latest - The version the registry's `latest` tag reports.\n * @returns True if the range admits that version; false otherwise.\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 fields it sits next to.\n *\n * Readability is decided first, and it is `EXTRA_RANGE_PATTERN`: an optional\n * caret or tilde over `major.minor.patch` 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 * Tests whether a declared engines floor is at or above the supported minimum.\n *\n * @param engines - The declared `engines.node` range.\n * @returns True if the range is the accepted syntax and its floor is at or above\n * `MINIMUM_NODE_VERSION`; false otherwise.\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.18.0') // true\n * matchesEngines('>=20.0.0') // false\n * matchesEngines('22.18.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 * Projects 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 * Projects a package manifest's text to the `@orkestrel/*` packages each dependency\n * section declares.\n *\n * @param manifest - The `package.json` text.\n * @returns The runtime, development, and peer declarations as separate lists.\n *\n * @remarks\n * Every other name is skipped rather than refused: a workspace's unrelated\n * dependencies are not this package's to report on. Keeping the sections\n * separate prevents a caller from treating a peer as a writable floor.\n *\n * Never throws, and every row it returns satisfies `isDependency` while each\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 * // { runtime: [{ name: '@orkestrel/emitter', range: '^0.0.5' }], development: [], peer: [] }\n * ```\n */\nexport function manifestToDependencies(manifest: string): ManifestDependencySet {\n\tif (computeBytes(manifest) > MAX_MANIFEST_BYTES) {\n\t\treturn { runtime: [], development: [], peer: [] }\n\t}\n\tconst parsed = parseJSON(manifest)\n\tif (!isRecord(parsed)) return { runtime: [], development: [], peer: [] }\n\tconst [runtime = [], development = [], peer = []] = [\n\t\t'dependencies',\n\t\t'devDependencies',\n\t\t'peerDependencies',\n\t].map((section): readonly Dependency[] => {\n\t\tconst entries = parsed[section]\n\t\treturn isRecord(entries)\n\t\t\t? Object.entries(entries).flatMap(([name, range]): readonly Dependency[] =>\n\t\t\t\t\t!DEPENDENCY_NAME_PATTERN.test(name) ||\n\t\t\t\t\tname.length > MAX_DEPENDENCY_NAME_LENGTH ||\n\t\t\t\t\t!isString(range) ||\n\t\t\t\t\trange.length === 0 ||\n\t\t\t\t\trange.length > MAX_RANGE_LENGTH\n\t\t\t\t\t\t? []\n\t\t\t\t\t\t: [{ name, range }],\n\t\t\t\t)\n\t\t\t: []\n\t})\n\treturn {\n\t\truntime: limitEntries(runtime, MAX_COLLECTION_ITEMS),\n\t\tdevelopment: limitEntries(development, MAX_COLLECTION_ITEMS),\n\t\tpeer: limitEntries(peer, MAX_COLLECTION_ITEMS),\n\t}\n}\n\n/**\n * Renders the `SKILL.md` pointer a target carries in place of a canonical skill.\n *\n * @param canonical - The canonical `SKILL.md` text, which opens with a frontmatter block.\n * @param name - The skill directory name the pointer body names.\n * @returns The canonical frontmatter block copied line for line, from its opening `---` line through\n * its closing `---` line, then the filled `ARTIFACT_TEMPLATES.orchestration.skill` body, with `\\n`\n * line endings; `undefined` when the canonical text does not open with a complete frontmatter block.\n *\n * @remarks\n * The frontmatter is copied rather than rewritten, so every harness that\n * discovers the pointer reads the canonical `name` and `description` and\n * triggers the skill exactly as the canonical file would. A CRLF canonical\n * text yields the same pointer as its LF form.\n *\n * @example\n * ```ts\n * import { renderSkillPointer } from '@orkestrel/scaffold'\n *\n * renderSkillPointer('---\\nname: orkestrel-harden\\ndescription: Hardens a package.\\n---\\n\\n# Harden\\n', 'orkestrel-harden')?.startsWith('---\\nname: orkestrel-harden\\ndescription: Hardens a package.\\n---\\n\\n# Load the canonical skill\\n') // true\n * renderSkillPointer('# Harden\\n', 'orkestrel-harden') // undefined\n * ```\n */\nexport function renderSkillPointer(canonical: string, name: string): string | undefined {\n\tconst lines = canonical.split(/\\r\\n|\\n/u)\n\tif (lines[0] !== '---') return undefined\n\tconst closing = lines.indexOf('---', 1)\n\tif (closing === -1) return undefined\n\tconst frontmatter = lines.slice(0, closing + 1).join('\\n')\n\treturn `${frontmatter}\\n${fillTemplate(ARTIFACT_TEMPLATES.orchestration.skill, { name })}`\n}\n\n/**\n * Scans manifest text for its strings and object braces, in order.\n *\n * @param text - The manifest text to scan.\n * @returns One token per quoted string and per `{` or `}` outside a string, or\n * `undefined` when a string is never closed.\n *\n * @remarks\n * Native JSON validation owns syntax; this scan only locates the byte ranges an\n * in-place writer edits. A string is opaque, so a brace inside one is never read,\n * and a backslash escapes the character after it. Depth counts objects alone and\n * ignores arrays, exactly as the range writers count them, so a key nested inside\n * another object never reads as a top-level one. A string that a colon follows\n * carries `value`, the offset of the character after that colon and the\n * whitespace beside it.\n *\n * @example\n * ```ts\n * import { scanManifestTokens } from '@orkestrel/scaffold'\n *\n * scanManifestTokens('{\"a\": \"b\"}')?.length // 4\n * scanManifestTokens('{\"a') // undefined\n * ```\n */\nexport function scanManifestTokens(text: string): readonly ManifestToken[] | undefined {\n\tconst tokens: ManifestToken[] = []\n\tfor (const match of text.matchAll(\n\t\t/(?<string>\"(?:\\\\[\\s\\S]|[^\"\\\\])*\")(?<colon>\\s*:\\s*)?|[{}]|\"/gu,\n\t)) {\n\t\tif (match[0] === '\"') return undefined\n\t\tconst literal = match.groups?.string\n\t\tconst depth = (tokens.at(-1)?.depth ?? 0) + (match[0] === '{' ? 1 : match[0] === '}' ? -1 : 0)\n\t\ttokens.push(\n\t\t\tliteral === undefined\n\t\t\t\t? { text: match[0], index: match.index, depth, value: undefined }\n\t\t\t\t: {\n\t\t\t\t\t\ttext: literal,\n\t\t\t\t\t\tindex: match.index,\n\t\t\t\t\t\tdepth,\n\t\t\t\t\t\tvalue: match.groups?.colon === undefined ? undefined : match.index + match[0].length,\n\t\t\t\t\t},\n\t\t)\n\t}\n\treturn tokens\n}\n","import type {\n\tArtifact,\n\tBuildFormat,\n\tBlueprint,\n\tBrowserExtension,\n\tContentArtifact,\n\tDependency,\n\tDependencyPinSet,\n\tEnvironment,\n\tFinding,\n\tManifestEdit,\n\tManifestScript,\n\tManifestToken,\n\tOverride,\n\tPlan,\n\tQuestion,\n\tSnapshot,\n\tViteMachinery,\n} from './types.js'\nimport {\n\tattempt,\n\tcanonicalStringify,\n\tcompareValues,\n\tisRecord,\n\tisString,\n\tparseJSON,\n\tsortValues,\n} 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\tAXES,\n\tBASE_DEV_DEPENDENCIES,\n\tBIN_CONFIGS,\n\tBIN_ENTRY_PATH,\n\tBIN_OUTPUT_PATH,\n\tBROWSE_DEV_DEPENDENCIES,\n\tBROWSE_UPSTREAM,\n\tCATALOG_AGENT_PATH,\n\tDECLARATION_DEV_DEPENDENCIES,\n\tDEPENDENCY_NAME_PATTERN,\n\tDISTRIBUTION_SETUP_PATH,\n\tDISTRIBUTION_TEST_PATH,\n\tENVIRONMENTS,\n\tEXTRA_RANGE_PATTERN,\n\tFLOOR_RANGE_PATTERN,\n\tFOREIGN_NAME_PATTERN,\n\tFRAMEWORK_MATRIX,\n\tFRAMEWORKS,\n\tGLOBAL_SETUP_PATH,\n\tGUIDES_TEST_PATH,\n\tHOST_PATHS,\n\tINTEGRATION_TEST_PATH,\n\tJOURNEY_CONFIG_PATH,\n\tMAX_ARTIFACT_BYTES,\n\tMAX_COLLECTION_ITEMS,\n\tMAX_TOTAL_ARTIFACT_BYTES,\n\tNAME_PATTERN,\n\tORKESTREL_RANGE_PATTERN,\n\tRELEASE_PROOF_COMMAND,\n\tSEED_GUIDE_PATHS,\n\tSERVICE_SCRIPT_PATH,\n\tSERVICE_SETUP_PATH,\n\tSHOWCASE_CONFIG_PATH,\n\tSHOWCASE_DEV_DEPENDENCIES,\n\tSHOWCASE_OVERRIDES,\n\tSKILLS_CONFIG_PATH,\n\tSOURCE_BROWSER_DEV_DEPENDENCIES,\n\tSRC_MATRIX,\n\tSTYLES_DEV_DEPENDENCIES,\n\tTARGET_SKILL_NAMES,\n\tVERSION_PATTERN,\n\tWORKSPACE_DEV_ENGINES,\n} from './constants.js'\nimport {\n\tartifactToFinding,\n\tcomputeBytes,\n\tcomputeHash,\n\tcomputeTotal,\n\tinferGroup,\n\tmatchesEngines,\n\tmatchesPrintWidth,\n\tscanManifestTokens,\n\tserializeTypeScriptString,\n\tselectHostPaths,\n\tsrcToRoot,\n} from './helpers.js'\nimport { ARTIFACT_TEMPLATES, CONFIG_TEMPLATES } from './templates.js'\nimport { isSheetName } from './validators.js'\n\n/**\n * Projects a blueprint into browser extensions restricted to occupied browser axes.\n * @param blueprint - The workspace specification.\n * @returns Browser extensions with their occupied axes, omitting unplaced extensions.\n * @example\n * ```ts\n * import { blueprintToFaces, createBlueprint } from '@orkestrel/scaffold'\n *\n * blueprintToFaces(createBlueprint('desk', { app: ['core'] })).length // 0\n * ```\n */\nexport function blueprintToFaces(blueprint: Blueprint): readonly BrowserExtension[] {\n\treturn blueprint.extensions.flatMap((extension) => {\n\t\tif (extension.surface !== 'browser') return []\n\t\tconst axes = extension.axes.filter((axis) => blueprint[axis].includes('browser'))\n\t\treturn axes.length === 0 ? [] : [{ ...extension, axes }]\n\t})\n}\n\n/**\n * Projects a blueprint into its validated sheet-face names in stable order.\n * @param blueprint - The workspace specification.\n * @returns The base face followed by named styles extensions; themes remain a separate target.\n * @example\n * ```ts\n * import { blueprintToSheets, createBlueprint } from '@orkestrel/scaffold'\n *\n * blueprintToSheets(createBlueprint('paper', { styles: true })) // ['styles']\n * ```\n */\nexport function blueprintToSheets(blueprint: Blueprint): readonly string[] {\n\treturn [\n\t\t...(blueprint.styles ? ['styles'] : []),\n\t\t...sortValues(\n\t\t\tblueprint.extensions.flatMap((extension) =>\n\t\t\t\textension.surface === 'styles' && isSheetName(extension.name) ? [extension.name] : [],\n\t\t\t),\n\t\t),\n\t]\n}\n\n/**\n * Projects published environments and sheets into the manifest export map.\n * @param blueprint - The workspace specification.\n * @returns JavaScript conditions and CSS and SCSS subpaths, without an invented JavaScript root.\n * @example\n * ```ts\n * import { blueprintToExports, createBlueprint } from '@orkestrel/scaffold'\n *\n * blueprintToExports(createBlueprint('paper', { styles: true }))['./styles']\n * // './dist/src/styles/index.css'\n * ```\n */\nexport function blueprintToExports(blueprint: Blueprint): Readonly<Record<string, unknown>> {\n\t// A repeated key keeps its first position and takes its last value, so the browser subpath\n\t// written once per face and the package manifest named twice land where assignment put them.\n\tconst exported: Readonly<Record<string, unknown>> = {\n\t\t...srcToExports(blueprint.src),\n\t\t...Object.fromEntries(\n\t\t\tblueprintToFaces(blueprint)\n\t\t\t\t.filter((extension) => extension.axes.includes('src'))\n\t\t\t\t.flatMap((extension): ReadonlyArray<readonly [string, unknown]> => {\n\t\t\t\t\tconst face: readonly [string, unknown] = [\n\t\t\t\t\t\t`./${extension.name}`,\n\t\t\t\t\t\tpathToCondition(`./dist/src/${extension.name}/index`, ['es']),\n\t\t\t\t\t]\n\t\t\t\t\t// Declaration rewrites name the browser subpath even when browser owns the root export.\n\t\t\t\t\treturn blueprint.src.includes('browser')\n\t\t\t\t\t\t? [face, ['./browser', pathToCondition('./dist/src/browser/index', ['es'])]]\n\t\t\t\t\t\t: [face]\n\t\t\t\t}),\n\t\t),\n\t\t...Object.fromEntries(\n\t\t\t[...blueprintToSheets(blueprint), ...(blueprint.themes ? ['styles/themes'] : [])].flatMap(\n\t\t\t\t(name) => [\n\t\t\t\t\t[`./${name}`, `./dist/src/${name}/index.css`],\n\t\t\t\t\t[`./${name}/scss`, `./src/${name}/index.scss`],\n\t\t\t\t],\n\t\t\t),\n\t\t),\n\t}\n\treturn Object.keys(exported).length > 0\n\t\t? { ...exported, './package.json': './package.json' }\n\t\t: exported\n}\n\n/**\n * Builds 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 * Projects 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 * Projects 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 root = srcToRoot(src)\n\tconst environment = root ?? 'core'\n\tconst entries: ReadonlyArray<readonly [string, unknown]> = [\n\t\t['.', pathToCondition(`./dist/src/${environment}/index`, SRC_MATRIX[environment].formats)],\n\t\t...(root === undefined\n\t\t\t? ENVIRONMENTS.filter((declared) => declared !== 'core' && src.includes(declared)).map(\n\t\t\t\t\t(declared): readonly [string, unknown] => [\n\t\t\t\t\t\tSRC_MATRIX[declared].path,\n\t\t\t\t\t\tpathToCondition(`./dist/src/${declared}/index`, SRC_MATRIX[declared].formats),\n\t\t\t\t\t],\n\t\t\t\t)\n\t\t\t: []),\n\t\t['./package.json', './package.json'],\n\t]\n\treturn Object.fromEntries(entries)\n}\n\n/**\n * Projects 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. A peer\n * that names a development tool already selected keeps that tool's pin, because\n * the peer's floor states what consumers may supply rather than what this workspace\n * develops against.\n *\n * A workspace that renders a surface receives {@link BROWSE_DEV_DEPENDENCIES}: a browser\n * environment on either axis, a sheet, or themes. A framework face counts without a clause of\n * its own, because a face is selected only on an axis that carries a browser environment.\n * A browser setup runtime alone receives nothing, because it renders no surface for `browse`\n * to drive. A workspace {@link BROWSE_UPSTREAM} names receives nothing either, because\n * `@orkestrel/browser` depends on it at runtime and the declaration would close a cycle.\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 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 sheets = blueprintToSheets(blueprint).length > 0 || blueprint.themes\n\tconst rendered = blueprint.src.includes('browser') || blueprint.app.includes('browser') || sheets\n\tconst own = blueprint.src.length > 0 || sheets ? `@orkestrel/${blueprint.name}` : blueprint.name\n\tconst prior: Readonly<Record<string, string>> = {\n\t\t...BASE_DEV_DEPENDENCIES,\n\t\t...(rendered && !BROWSE_UPSTREAM.includes(own) ? BROWSE_DEV_DEPENDENCIES : {}),\n\t\t...(sheets ? STYLES_DEV_DEPENDENCIES : {}),\n\t\t...(blueprint.src.length > 0 || blueprint.bin ? DECLARATION_DEV_DEPENDENCIES : {}),\n\t\t...(blueprint.src.includes('browser') || blueprint.setup.includes('browser') || sheets\n\t\t\t? SOURCE_BROWSER_DEV_DEPENDENCIES\n\t\t\t: {}),\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.app.includes('server') ? APP_SERVER_DEV_DEPENDENCIES : {}),\n\t\t...Object.fromEntries(\n\t\t\tblueprintToMachinery(blueprint).frameworks.flatMap((framework) =>\n\t\t\t\tObject.entries(FRAMEWORK_MATRIX[framework].dependencies),\n\t\t\t),\n\t\t),\n\t\t// The iterator consumes one extra at a time and reads a hole as an `undefined` extra, which the\n\t\t// name read refuses before a later extra is read. It takes the list through its iterator\n\t\t// protocol alone, so a list without one is refused as the loop refused it.\n\t\t...Object.fromEntries(\n\t\t\tIterator.from(blueprint.extras)\n\t\t\t\t.map((extra) => [extra.name, extra.range])\n\t\t\t\t.toArray(),\n\t\t),\n\t\t...(blueprint.showcase && blueprint.app.includes('browser') ? SHOWCASE_DEV_DEPENDENCIES : {}),\n\t}\n\t// A peer keeps the pin of a development tool already selected, and the first of two peers\n\t// naming one package wins, because its floor was the one the workspace declared first. Each peer is\n\t// read once, in order, and only a peer the selection lacks has its range read.\n\tconst peers = Iterator.from(blueprint.peers)\n\t\t.flatMap((peer): ReadonlyArray<readonly [string, string]> =>\n\t\t\tObject.hasOwn(prior, peer.name) ? [] : [[peer.name, peer.range]],\n\t\t)\n\t\t.toArray()\n\tconst merged: Readonly<Record<string, string>> = {\n\t\t...prior,\n\t\t...Object.fromEntries(\n\t\t\tpeers.filter(([name], index) => peers.findIndex(([other]) => other === name) === index),\n\t\t),\n\t}\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 * Projects the scoped npm overrides required by a selected browser showcase.\n *\n * @param blueprint - The workspace specification.\n * @returns The showcase override map, or an empty map for other workspaces.\n * @example\n * ```ts\n * import { blueprintToManifestOverrides, createBlueprint } from '@orkestrel/scaffold'\n * blueprintToManifestOverrides(createBlueprint('desk', { app: ['browser'], showcase: true }))\n * // { 'vite-plugin-singlefile@2.3.3': { micromatch: 'npm:picomatch@2.3.2' } }\n * ```\n */\nexport function blueprintToManifestOverrides(\n\tblueprint: Blueprint,\n): Readonly<Record<string, Readonly<Record<string, string>>>> {\n\treturn blueprint.showcase && blueprint.app.includes('browser') ? SHOWCASE_OVERRIDES : {}\n}\n\n/**\n * Replaces selected npm override leaves while preserving every byte outside the edited path.\n *\n * @param manifest - The JSON package manifest text.\n * @param overrides - The scoped selectors and string leaves to write.\n * @returns The aligned text, or `undefined` for invalid JSON, duplicate selected keys, malformed ancestors, or non-string owned leaves.\n * @remarks\n * Absent ancestors and leaves are inserted. Aligned strings retain their original spelling.\n * Unrelated overrides remain caller-owned. Artifact replacements in `Blueprint.overrides` are independent.\n * @example\n * ```ts\n * import { replaceManifestOverrides } from '@orkestrel/scaffold'\n * replaceManifestOverrides('{}', { 'plugin@1.0.0': { child: '2.0.0' } })\n * // '{\"overrides\":{\"plugin@1.0.0\":{\"child\":\"2.0.0\"}}}'\n * ```\n */\nexport function replaceManifestOverrides(\n\tmanifest: string,\n\toverrides: Readonly<Record<string, Readonly<Record<string, string>>>>,\n): string | undefined {\n\tif (!isRecord(parseJSON(manifest))) return undefined\n\treturn Object.entries(overrides)\n\t\t.flatMap(([selector, children]) =>\n\t\t\tObject.entries(children).map(([child, range]) => ({\n\t\t\t\tpath: ['overrides', selector, child],\n\t\t\t\trange,\n\t\t\t})),\n\t\t)\n\t\t.reduce<string | undefined>(\n\t\t\t(compiled, leaf) =>\n\t\t\t\tcompiled === undefined\n\t\t\t\t\t? undefined\n\t\t\t\t\t: replaceManifestOverride(compiled, leaf.path, leaf.range),\n\t\t\tmanifest,\n\t\t)\n}\n\n/**\n * Replaces one npm override leaf in manifest text, inserting its absent ancestors.\n *\n * @param manifest - The JSON package manifest text, already known to be an object.\n * @param path - The object keys from the manifest root to the leaf, ending at the leaf's key.\n * @param range - The string the leaf must hold.\n * @returns The text carrying the leaf, or `undefined` for a duplicate selected key, a malformed\n * ancestor, or a non-string leaf.\n *\n * @remarks\n * The one step {@link replaceManifestOverrides} repeats per leaf. Absent ancestors and the leaf are\n * inserted after the last member of the deepest ancestor the text declares, and a leaf already\n * holding `range` keeps its original spelling. Every byte outside the edited path survives.\n *\n * @example\n * ```ts\n * import { replaceManifestOverride } from '@orkestrel/scaffold'\n *\n * replaceManifestOverride('{}', ['overrides', 'plugin@1.0.0', 'child'], '2.0.0')\n * // '{\"overrides\":{\"plugin@1.0.0\":{\"child\":\"2.0.0\"}}}'\n * ```\n */\nexport function replaceManifestOverride(\n\tmanifest: string,\n\tpath: readonly string[],\n\trange: string,\n): string | undefined {\n\tconst tokens = scanManifestTokens(manifest)\n\tif (tokens === undefined) return undefined\n\t// Each level descends into the object the previous level's value opened, so the fold carries\n\t// that object's offset and stops after a level answers.\n\tconst outcome = path.reduce<{\n\t\treadonly done: boolean\n\t\treadonly open: number\n\t\treadonly text: string | undefined\n\t}>(\n\t\t(state, key, level) => {\n\t\t\tif (state.done) return state\n\t\t\tconst refused = { ...state, done: true, text: undefined }\n\t\t\tconst brace = tokens.find((token) => token.index === state.open && token.text === '{')\n\t\t\tif (brace === undefined) return refused\n\t\t\tconst close = tokens.find(\n\t\t\t\t(token) =>\n\t\t\t\t\ttoken.text === '}' && token.index > state.open && token.depth === brace.depth - 1,\n\t\t\t)\n\t\t\tif (close === undefined) return refused\n\t\t\t// Only the selected object's immediate keys count; strings and nested values are opaque.\n\t\t\tconst matches = tokens.flatMap((token, at) =>\n\t\t\t\ttoken.index > state.open &&\n\t\t\t\ttoken.index < close.index &&\n\t\t\t\ttoken.depth === brace.depth &&\n\t\t\t\ttoken.value !== undefined &&\n\t\t\t\tparseJSON(token.text) === key\n\t\t\t\t\t? [at]\n\t\t\t\t\t: [],\n\t\t\t)\n\t\t\tif (matches.length > 1) return refused\n\t\t\tconst at = matches[0]\n\t\t\tconst entry = at === undefined ? undefined : tokens[at]\n\t\t\tif (at === undefined || entry === undefined) {\n\t\t\t\tconst insertion = path\n\t\t\t\t\t.slice(level)\n\t\t\t\t\t.reduceRight((inner, name) => `{${JSON.stringify(name)}:${inner}}`, JSON.stringify(range))\n\t\t\t\tconst tail = state.open + manifest.slice(state.open + 1, close.index).trimEnd().length\n\t\t\t\treturn {\n\t\t\t\t\t...state,\n\t\t\t\t\tdone: true,\n\t\t\t\t\ttext:\n\t\t\t\t\t\tmanifest.slice(0, tail + 1) +\n\t\t\t\t\t\t(tail === state.open ? '' : ',') +\n\t\t\t\t\t\tinsertion.slice(1, -1) +\n\t\t\t\t\t\tmanifest.slice(tail + 1),\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst start = entry.value\n\t\t\tif (start === undefined) return refused\n\t\t\tif (level < path.length - 1) {\n\t\t\t\treturn manifest.charAt(start) === '{' ? { ...state, open: start } : refused\n\t\t\t}\n\t\t\tconst literal = tokens[at + 1]\n\t\t\tif (manifest.charAt(start) !== '\"' || literal === undefined) return refused\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tdone: true,\n\t\t\t\ttext:\n\t\t\t\t\tparseJSON(literal.text) === range\n\t\t\t\t\t\t? manifest\n\t\t\t\t\t\t: manifest.slice(0, start) +\n\t\t\t\t\t\t\tJSON.stringify(range) +\n\t\t\t\t\t\t\tmanifest.slice(literal.index + literal.text.length),\n\t\t\t}\n\t\t},\n\t\t{ done: false, open: manifest.indexOf('{'), text: manifest },\n\t)\n\treturn outcome.text\n}\n\n/**\n * Projects 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 its distribution, study, and live-service proofs\n * from `test` and runs them from `prepublishOnly` instead. Publishing is what\n * selects the distribution proof: what that proof measures is the packed tarball,\n * so a workspace that packs no published source has nothing for it to read. A\n * private workspace therefore omits it and runs a study proof and a live-service\n * proof from `test`, the study proof first.\n * Integration and conformance stay in `test` because they neither pack nor\n * install the workspace and drive no external service. A conformance run may\n * start a server, but it starts its own and reaches it over loopback, so the run\n * 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 source = blueprintToFaces(blueprint).flatMap((extension) =>\n\t\textension.surface === 'browser' && extension.axes.includes('src') ? [extension.name] : [],\n\t)\n\tconst application = blueprintToFaces(blueprint).flatMap((extension) =>\n\t\textension.surface === 'browser' && extension.axes.includes('app') ? [extension.name] : [],\n\t)\n\tconst sheets = blueprintToSheets(blueprint)\n\tconst targets = [...sheets, ...(blueprint.themes && !blueprint.styles ? ['themes'] : [])]\n\tconst checker = application.includes('vue') ? FRAMEWORK_MATRIX.vue.checker : 'tsc'\n\tconst publishes = blueprint.src.length > 0 || targets.length > 0\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 checks = [...blueprint.src, ...source, ...sheets, ...(blueprint.bin ? ['bin'] : [])].map(\n\t\t(name) => `npm run check:src:${name}`,\n\t)\n\tconst journey = `vitest run --config ${JOURNEY_CONFIG_PATH} --no-cache --reporter=dot`\n\tconst showcase = `vite --config ${SHOWCASE_CONFIG_PATH}`\n\tconst buildShowcase = `vite build --config ${SHOWCASE_CONFIG_PATH}`\n\treturn {\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`${checker} --noEmit --project tsconfig.json`,\n\t\t\t...(checks.length > 0 ? ['npm run check:src'] : []),\n\t\t\t...(blueprint.app.length > 0 ? ['npm run check:app'] : []),\n\t\t\t...(blueprint.skills ? ['npm run check:skills'] : []),\n\t\t].join(' && '),\n\t\t...(checks.length > 0\n\t\t\t? {\n\t\t\t\t\t'check:src': checks.join(' && '),\n\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\tIterator.from(blueprint.src)\n\t\t\t\t\t\t\t.map((environment) => [\n\t\t\t\t\t\t\t\t`check:src:${environment}`,\n\t\t\t\t\t\t\t\t`tsc --noEmit -p configs/src/tsconfig.${environment}.json`,\n\t\t\t\t\t\t\t])\n\t\t\t\t\t\t\t.toArray(),\n\t\t\t\t\t),\n\t\t\t\t\t...(blueprint.bin\n\t\t\t\t\t\t? { 'check:src:bin': 'tsc --noEmit -p configs/src/tsconfig.bin.json' }\n\t\t\t\t\t\t: {}),\n\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\t[...sheets, ...source].map((name) => [\n\t\t\t\t\t\t\t`check:src:${name}`,\n\t\t\t\t\t\t\t`tsc --noEmit -p configs/src/tsconfig.${name}.json`,\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...(blueprint.app.length > 0\n\t\t\t? {\n\t\t\t\t\t'check:app': [...blueprint.app, ...application]\n\t\t\t\t\t\t.map((environment) => `npm run check:app:${environment}`)\n\t\t\t\t\t\t.join(' && '),\n\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\tIterator.from(blueprint.app)\n\t\t\t\t\t\t\t.map((environment) => [\n\t\t\t\t\t\t\t\t`check:app:${environment}`,\n\t\t\t\t\t\t\t\t`tsc --noEmit -p configs/app/tsconfig.${environment}.json`,\n\t\t\t\t\t\t\t])\n\t\t\t\t\t\t\t.toArray(),\n\t\t\t\t\t),\n\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\tapplication.map((name) => [\n\t\t\t\t\t\t\t`check:app:${name}`,\n\t\t\t\t\t\t\t`${FRAMEWORK_MATRIX[name].checker} --noEmit -p configs/app/tsconfig.${name}.json`,\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...(blueprint.skills ? { 'check:skills': `tsc --noEmit -p ${SKILLS_CONFIG_PATH}` } : {}),\n\t\ttest: [\n\t\t\t...(compiles ? ['npm run test:src'] : []),\n\t\t\t...(blueprint.app.length > 0 ? ['npm run test:app'] : []),\n\t\t\t...(blueprint.journey && blueprint.app.includes('browser')\n\t\t\t\t? ['npm run test:journey', ...application.map((name) => `npm run test:journey:${name}`)]\n\t\t\t\t: []),\n\t\t\t'npm run test:policy',\n\t\t\t'npm run test:config',\n\t\t\t...(blueprint.setup.includes('node') || blueprint.global ? ['npm run test:setup'] : []),\n\t\t\t...(blueprint.setup.includes('browser') ? ['npm run test:setup:browser'] : []),\n\t\t\t...(blueprint.skills ? ['npm run test:skills'] : []),\n\t\t\t...(blueprint.guides ? ['npm run test:guides'] : []),\n\t\t\t...(blueprint.conformance ? ['npm run test:conformance'] : []),\n\t\t\t...(blueprint.tree ? ['npm run test:tree'] : []),\n\t\t\t...(integrates ? ['npm run test:integration'] : []),\n\t\t\t...(!publishes && blueprint.studies ? ['npm run test:studies'] : []),\n\t\t\t...(!publishes && blueprint.service ? ['npm run test:service'] : []),\n\t\t].join(' && '),\n\t\t...(compiles\n\t\t\t? {\n\t\t\t\t\t// The aggregate keeps the position its first appearance gave it, with the value the sheet\n\t\t\t\t\t// targets extend, so it is computed once rather than written and then rewritten. It is\n\t\t\t\t\t// computed here, after the checks, so the environments are read where the baseline read them.\n\t\t\t\t\t'test:src': [\n\t\t\t\t\t\t...(blueprint.src.length > 0 || blueprint.bin\n\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\tvitest,\n\t\t\t\t\t\t\t\t\t\t...blueprint.src.map(\n\t\t\t\t\t\t\t\t\t\t\t(environment) => `--project ${SRC_MATRIX[environment].project}`,\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t...source.map((name) => `--project src:${name}`),\n\t\t\t\t\t\t\t\t\t\t...(blueprint.bin ? ['--project src:bin'] : []),\n\t\t\t\t\t\t\t\t\t].join(' '),\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t: []),\n\t\t\t\t\t\t...targets.map((name) => `npm run test:src:${name}`),\n\t\t\t\t\t].join(' && '),\n\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\tIterator.from(blueprint.src)\n\t\t\t\t\t\t\t.map((environment) => [\n\t\t\t\t\t\t\t\t`test:src:${environment}`,\n\t\t\t\t\t\t\t\t`${vitest} --project ${SRC_MATRIX[environment].project}`,\n\t\t\t\t\t\t\t])\n\t\t\t\t\t\t\t.toArray(),\n\t\t\t\t\t),\n\t\t\t\t\t...(blueprint.bin ? { 'test:src:bin': `${vitest} --project src:bin` } : {}),\n\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\tsource.map((name) => [`test:src:${name}`, `${vitest} --project src:${name}`]),\n\t\t\t\t\t),\n\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\ttargets.map((name) => [\n\t\t\t\t\t\t\t`test:src:${name}`,\n\t\t\t\t\t\t\t`npm run build:src:${name} && ${vitest} --project src:${name}`,\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...(blueprint.app.length > 0\n\t\t\t? {\n\t\t\t\t\t'test:app': [\n\t\t\t\t\t\tvitest,\n\t\t\t\t\t\t...blueprint.app.map((environment) => `--project ${APP_MATRIX[environment].project}`),\n\t\t\t\t\t\t...application.map((name) => `--project app:${name}`),\n\t\t\t\t\t].join(' '),\n\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\tIterator.from(blueprint.app)\n\t\t\t\t\t\t\t.map((environment) => [\n\t\t\t\t\t\t\t\t`test:app:${environment}`,\n\t\t\t\t\t\t\t\t`${vitest} --project ${APP_MATRIX[environment].project}`,\n\t\t\t\t\t\t\t])\n\t\t\t\t\t\t\t.toArray(),\n\t\t\t\t\t),\n\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\tapplication.map((name) => [`test:app:${name}`, `${vitest} --project app:${name}`]),\n\t\t\t\t\t),\n\t\t\t\t}\n\t\t\t: {}),\n\t\t'test:policy': `${vitest} --project policy`,\n\t\t'test:config': `${vitest} --project config`,\n\t\t...(blueprint.setup.includes('node') || blueprint.global\n\t\t\t? { 'test:setup': `${vitest} --project setup` }\n\t\t\t: {}),\n\t\t...(blueprint.setup.includes('browser')\n\t\t\t? { 'test:setup:browser': `${vitest} --project setup:browser` }\n\t\t\t: {}),\n\t\t...(blueprint.journey && blueprint.app.includes('browser')\n\t\t\t? {\n\t\t\t\t\t'test:journey': journey,\n\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\tapplication.map((name) => [`test:journey:${name}`, `${journey} --mode ${name}`]),\n\t\t\t\t\t),\n\t\t\t\t}\n\t\t\t: {}),\n\t\t...(blueprint.skills ? { 'test:skills': `${vitest} --project skills` } : {}),\n\t\t...(blueprint.guides\n\t\t\t? { 'test:guides': `node --experimental-strip-types ${GUIDES_TEST_PATH}` }\n\t\t\t: {}),\n\t\t...(blueprint.conformance ? { 'test:conformance': `${vitest} --project conformance` } : {}),\n\t\t...(blueprint.tree ? { 'test:tree': `${vitest} --project tree` } : {}),\n\t\t'test:probe':\n\t\t\t'vitest run --config vite.config.ts --no-cache --reporter=verbose --project probe',\n\t\t'test:bench': 'vitest bench --config vite.config.ts --no-cache --project probe',\n\t\t...(publishes ? { 'test:distribution': `${vitest} --project distribution` } : {}),\n\t\t...(integrates ? { 'test:integration': `${vitest} --project integration` } : {}),\n\t\t...(blueprint.service ? { 'test:service': `${vitest} --project service` } : {}),\n\t\t...(blueprint.studies ? { 'test:studies': `${vitest} --project studies` } : {}),\n\t\tbuild: [\n\t\t\t'npm run clean',\n\t\t\t...(compiles ? ['npm run build:src'] : []),\n\t\t\t...(blueprint.app.length > 0 ? ['npm run build:app'] : []),\n\t\t].join(' && '),\n\t\t...(compiles\n\t\t\t? {\n\t\t\t\t\t'build:src': [\n\t\t\t\t\t\t...blueprint.src.map((environment) => `npm run build:src:${environment}`),\n\t\t\t\t\t\t...source.map((name) => `npm run build:src:${name}`),\n\t\t\t\t\t\t...targets.map((name) => `npm run build:src:${name}`),\n\t\t\t\t\t\t...(blueprint.bin ? ['npm run build:src:bin'] : []),\n\t\t\t\t\t].join(' && '),\n\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\tIterator.from(blueprint.src)\n\t\t\t\t\t\t\t.map((environment) => [\n\t\t\t\t\t\t\t\t`build:src:${environment}`,\n\t\t\t\t\t\t\t\tSRC_MATRIX[environment].formats.includes('cjs')\n\t\t\t\t\t\t\t\t\t? `vite build --config configs/src/vite.${environment}.config.ts && npm run copy dist/src/${environment}/index.d.ts dist/src/${environment}/index.d.cts`\n\t\t\t\t\t\t\t\t\t: `vite build --config configs/src/vite.${environment}.config.ts`,\n\t\t\t\t\t\t\t])\n\t\t\t\t\t\t\t.toArray(),\n\t\t\t\t\t),\n\t\t\t\t\t...(blueprint.bin\n\t\t\t\t\t\t? { 'build:src:bin': 'vite build --config configs/src/vite.bin.config.ts' }\n\t\t\t\t\t\t: {}),\n\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\tsource.map((name) => [\n\t\t\t\t\t\t\t`build:src:${name}`,\n\t\t\t\t\t\t\t`vite build --config configs/src/vite.${name}.config.ts`,\n\t\t\t\t\t\t]),\n\t\t\t\t\t),\n\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\ttargets.map((name) => [\n\t\t\t\t\t\t\t`build:src:${name}`,\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t`vite build --config configs/src/vite.${name}.config.ts`,\n\t\t\t\t\t\t\t\t...(name === 'styles' && blueprint.themes\n\t\t\t\t\t\t\t\t\t? ['vite build --config configs/src/vite.themes.config.ts']\n\t\t\t\t\t\t\t\t\t: []),\n\t\t\t\t\t\t\t].join(' && '),\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...(blueprint.app.length > 0\n\t\t\t? {\n\t\t\t\t\t'build:app':\n\t\t\t\t\t\truntime.length > 0\n\t\t\t\t\t\t\t? [...runtime, ...application]\n\t\t\t\t\t\t\t\t\t.map((environment) => `npm run build:app:${environment}`)\n\t\t\t\t\t\t\t\t\t.join(' && ')\n\t\t\t\t\t\t\t: 'npm run check:app:core',\n\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\t[...runtime, ...application].map((environment) => [\n\t\t\t\t\t\t\t`build:app:${environment}`,\n\t\t\t\t\t\t\t`vite build --config configs/app/vite.${environment}.config.ts`,\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...(blueprint.app.includes('browser')\n\t\t\t? {\n\t\t\t\t\tdev: 'vite --config configs/app/vite.browser.config.ts',\n\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\tapplication.map((name) => [\n\t\t\t\t\t\t\t`dev:${name}`,\n\t\t\t\t\t\t\t`vite --config configs/app/vite.${name}.config.ts`,\n\t\t\t\t\t\t]),\n\t\t\t\t\t),\n\t\t\t\t\t...(blueprint.showcase\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tshowcase,\n\t\t\t\t\t\t\t\t'build:showcase': buildShowcase,\n\t\t\t\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\t\t\t\tapplication.flatMap((name): ReadonlyArray<readonly [string, string]> => [\n\t\t\t\t\t\t\t\t\t\t[`showcase:${name}`, `${showcase} --mode ${name}`],\n\t\t\t\t\t\t\t\t\t\t[`build:showcase:${name}`, `${buildShowcase} --mode ${name}`],\n\t\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: {}),\n\t\t\t\t}\n\t\t\t: {}),\n\t\t...(blueprint.app.includes('server')\n\t\t\t? {\n\t\t\t\t\tserve: 'node dist/app/server/main.cjs',\n\t\t\t\t\t'serve:build': 'npm run build:app:server && npm run serve',\n\t\t\t\t}\n\t\t\t: {}),\n\t\t...(publishes\n\t\t\t? {\n\t\t\t\t\tprepack: 'npm run build',\n\t\t\t\t\tprepublishOnly: [\n\t\t\t\t\t\t'npm run format:check && npm run lint:check && npm run check && npm run build',\n\t\t\t\t\t\t...(blueprint.showcase && blueprint.app.includes('browser')\n\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\t'npm run build:showcase',\n\t\t\t\t\t\t\t\t\t...application.map((name) => `npm run build:showcase:${name}`),\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t: []),\n\t\t\t\t\t\t'npm test',\n\t\t\t\t\t\t...(blueprint.studies ? ['npm run test:studies'] : []),\n\t\t\t\t\t\tRELEASE_PROOF_COMMAND,\n\t\t\t\t\t\t...(blueprint.service ? ['npm run test:service'] : []),\n\t\t\t\t\t].join(' && '),\n\t\t\t\t}\n\t\t\t: {}),\n\t}\n}\n\n/**\n * Projects a blueprint into the manifest scripts a region write may replace.\n *\n * @param blueprint - The workspace specification.\n * @returns One entry per writable script.\n *\n * @remarks\n * Every direct `test:<project>` script is writable, together with the probe and\n * benchmark workbench scripts. A workspace carrying guides adds `test:guides`,\n * whose package-owned entry runs the guides project and handles explicit parity\n * rewrites, and one carrying skills adds `test:skills`. Publishing adds the pack and publication lifecycle scripts.\n * Sheet and framework faces add their check and build scripts, application frameworks add dev scripts,\n * and selected showcases and journeys add their mode scripts.\n * Aggregate test scripts and\n * maintainer-owned gate chains stay outside the region.\n *\n * `accepted` carries each generated predecessor the region can replace. The\n * guides entry accepts the generated command that invoked the guides project\n * through Vitest alone. The pack hook accepts the build chain emitted before it\n * delegated to `build`. The publication hook accepts the same gate chain without\n * {@link RELEASE_PROOF_COMMAND}. A workspace carrying studies also accepts the\n * chain without its study step and the chain without both its study step and\n * the release proof. The value being written is always writable, so\n * it is not repeated there. Any other value is a script the workspace author\n * customized, and {@link replaceManifestScripts} retains it while writing the\n * other named scripts independently.\n *\n * @example\n * ```ts\n * import { blueprintToWritableScripts, createBlueprint } from '@orkestrel/scaffold'\n *\n * const blueprint = createBlueprint('router', { src: ['core'] })\n *\n * blueprintToWritableScripts(blueprint)[0]?.name // 'test:src:core'\n * ```\n */\nexport function blueprintToWritableScripts(blueprint: Blueprint): readonly ManifestScript[] {\n\tconst scripts = blueprintToScripts(blueprint)\n\tconst sheets = [\n\t\t...blueprintToSheets(blueprint),\n\t\t...(blueprint.themes && !blueprint.styles ? ['themes'] : []),\n\t]\n\tconst body = Object.entries(scripts).flatMap(([name, command]): readonly ManifestScript[] => {\n\t\tconst direct = name.startsWith('test:') && name !== 'test:src' && name !== 'test:app'\n\t\tconst sheet = sheets.some(\n\t\t\t(face) => name === `build:src:${face}` || name === `check:src:${face}`,\n\t\t)\n\t\t// The faces are read for each script, so the extensions are read as many times as before.\n\t\tconst framework = blueprintToFaces(blueprint).some(\n\t\t\t(extension) =>\n\t\t\t\textension.surface === 'browser' &&\n\t\t\t\textension.axes.some(\n\t\t\t\t\t(axis) =>\n\t\t\t\t\t\tname === `check:${axis}:${extension.name}` ||\n\t\t\t\t\t\tname === `build:${axis}:${extension.name}` ||\n\t\t\t\t\t\t(axis === 'app' && name === `dev:${extension.name}`),\n\t\t\t\t),\n\t\t)\n\t\tconst showcase =\n\t\t\tname === 'showcase' ||\n\t\t\tname.startsWith('showcase:') ||\n\t\t\tname === 'build:showcase' ||\n\t\t\tname.startsWith('build:showcase:')\n\t\tif (!direct && !sheet && !framework && !showcase) return []\n\t\treturn [\n\t\t\t{\n\t\t\t\tname,\n\t\t\t\tcommand,\n\t\t\t\taccepted:\n\t\t\t\t\tname === 'test:guides'\n\t\t\t\t\t\t? ['vitest run --config vite.config.ts --no-cache --reporter=dot --project guides']\n\t\t\t\t\t\t: name === 'build:src:styles' && blueprint.themes\n\t\t\t\t\t\t\t? ['vite build --config configs/src/vite.styles.config.ts']\n\t\t\t\t\t\t\t: sheets.some((face) => name === `test:src:${face}`)\n\t\t\t\t\t\t\t\t? [command.slice(command.indexOf(' && ') + 4)]\n\t\t\t\t\t\t\t\t: [],\n\t\t\t},\n\t\t]\n\t})\n\tconst prepack = scripts.prepack\n\tconst prepublish = scripts.prepublishOnly\n\tconst unreleased = prepublish?.replace(` && ${RELEASE_PROOF_COMMAND}`, '')\n\treturn [\n\t\t...body,\n\t\t...(prepack === undefined\n\t\t\t? []\n\t\t\t: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'prepack',\n\t\t\t\t\t\tcommand: prepack,\n\t\t\t\t\t\taccepted: scripts.build === undefined ? [] : [scripts.build],\n\t\t\t\t\t},\n\t\t\t\t]),\n\t\t...(prepublish === undefined || unreleased === undefined\n\t\t\t? []\n\t\t\t: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'prepublishOnly',\n\t\t\t\t\t\tcommand: prepublish,\n\t\t\t\t\t\taccepted: blueprint.studies\n\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\tunreleased,\n\t\t\t\t\t\t\t\t\tprepublish.replace(' && npm run test:studies', ''),\n\t\t\t\t\t\t\t\t\tunreleased.replace(' && npm run test:studies', ''),\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t: [unreleased],\n\t\t\t\t\t},\n\t\t\t\t]),\n\t]\n}\n\n/**\n * Compiles 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 after 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 sheets = blueprintToSheets(blueprint)\n\tconst targets = [...sheets, ...(blueprint.themes ? ['styles/themes'] : [])]\n\tconst publishes = blueprint.src.length > 0 || targets.length > 0\n\tconst name = publishes ? `@orkestrel/${blueprint.name}` : blueprint.name\n\tconst dependencies = Object.fromEntries(\n\t\t[...blueprint.dependencies]\n\t\t\t.sort((left, right) => compareValues(left.name, right.name))\n\t\t\t.map((dependency) => [dependency.name, dependency.range]),\n\t)\n\tconst peers = [...blueprint.peers].sort((left, right) => compareValues(left.name, right.name))\n\tconst peerDependencies = Object.fromEntries(peers.map((peer) => [peer.name, peer.range]))\n\tconst peerDependenciesMeta = Object.fromEntries(\n\t\tpeers.filter((peer) => peer.optional === true).map((peer) => [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]: BIN_OUTPUT_PATH } } : {}),\n\t\tfiles: [\n\t\t\tblueprint.bin || publishes ? 'dist/src' : 'dist/app',\n\t\t\t...(blueprint.bin ? ['dist/bin'] : []),\n\t\t\t...targets.map((face) => `!dist/src/${face}/index.js`),\n\t\t\t...sheets.map((face) => `src/${face}/**/*.scss`),\n\t\t\t...(blueprint.themes && !blueprint.styles ? ['src/styles/themes/**/*.scss'] : []),\n\t\t\t'README.md',\n\t\t],\n\t\ttype: 'module',\n\t\t...(publishes\n\t\t\t? {\n\t\t\t\t\tsideEffects:\n\t\t\t\t\t\ttargets.length > 0 || blueprint.bin\n\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\t...(targets.length > 0 ? ['**/*.css', '**/*.scss'] : []),\n\t\t\t\t\t\t\t\t\t...(blueprint.bin ? [`./${BIN_ENTRY_PATH}`, `./${BIN_OUTPUT_PATH}`] : []),\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t: false,\n\t\t\t\t\t...(blueprint.src.length > 0 ? entry : {}),\n\t\t\t\t\texports: blueprintToExports(blueprint),\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(blueprintToManifestOverrides(blueprint)).length > 0\n\t\t\t? { overrides: blueprintToManifestOverrides(blueprint) }\n\t\t\t: {}),\n\t\t...(Object.keys(peerDependencies).length > 0 ? { peerDependencies } : {}),\n\t\t...(Object.keys(peerDependenciesMeta).length > 0 ? { peerDependenciesMeta } : {}),\n\t\tdevEngines: WORKSPACE_DEV_ENGINES,\n\t\tengines: { node: blueprint.engines },\n\t}\n\treturn `${JSON.stringify(manifest, undefined, '\\t')}\\n`\n}\n\n/**\n * Derives the host-specific machinery a generated root Vite configuration carries.\n *\n * @param blueprint - The workspace specification.\n * @returns The 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).frameworks // []\n * ```\n */\nexport function blueprintToMachinery(blueprint: Blueprint): ViteMachinery {\n\tconst hosted = blueprint.app.some((environment) => environment !== 'core')\n\tconst frameworks = FRAMEWORKS.filter((framework) =>\n\t\tblueprintToFaces(blueprint).some(\n\t\t\t(extension) =>\n\t\t\t\textension.surface === 'browser' &&\n\t\t\t\textension.name === framework &&\n\t\t\t\textension.axes.some((axis) => blueprint[axis].includes('browser')),\n\t\t),\n\t)\n\treturn {\n\t\tbrowser:\n\t\t\tblueprint.src.includes('browser') ||\n\t\t\tblueprint.app.includes('browser') ||\n\t\t\tblueprint.setup.includes('browser') ||\n\t\t\tblueprintToSheets(blueprint).length > 0 ||\n\t\t\tblueprint.themes ||\n\t\t\tframeworks.length > 0,\n\t\tframeworks,\n\t\toutput:\n\t\t\tblueprint.src.length > 0 ||\n\t\t\tblueprint.bin ||\n\t\t\thosted ||\n\t\t\tblueprintToSheets(blueprint).length > 0 ||\n\t\t\tblueprint.themes,\n\t\tshowcase: blueprint.showcase && blueprint.app.includes('browser'),\n\t}\n}\n\n/**\n * Compiles the root TypeScript configuration for a blueprint.\n *\n * @param blueprint - The workspace specification.\n * @returns Formatter-stable `tsconfig.json` text.\n *\n * @remarks\n * `paths` carries the workspace's own published specifiers beside the `@src` and\n * `@app` aliases, mapped to source. The published set is what\n * {@link srcToExports} publishes, read the same way here so the two never name\n * different subpaths, and the `app` axis publishes nothing so it maps nothing.\n * A package's own name resolves inside its own checkout through that `exports`\n * map, to the built `dist/` entry, so a module importing it would make the root\n * typecheck depend on a build; mapping the specifier to source is what keeps\n * `npm run check` independent of `npm run build`. The root Vite configuration\n * derives its `alias` record from every `paths` entry, so the same specifiers\n * resolve to source under Vitest, and every subpath is emitted before the bare\n * specifier: an alias record is matched in declaration order and a bare pattern\n * also matches its own subpaths, so the reverse order would resolve\n * `@orkestrel/<name>/server` through the core entry.\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 root = srcToRoot(blueprint.src)\n\tconst aliases = [\n\t\t...blueprintToFaces(blueprint).flatMap((extension) => [\n\t\t\t...extension.axes.map((axis) => ({\n\t\t\t\tspecifier: `@${axis}/${extension.name}`,\n\t\t\t\ttarget: `./${axis}/${extension.name}/index.ts`,\n\t\t\t})),\n\t\t\t...(extension.axes.includes('src')\n\t\t\t\t? [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tspecifier: `@orkestrel/${blueprint.name}/${extension.name}`,\n\t\t\t\t\t\t\ttarget: `./src/${extension.name}/index.ts`,\n\t\t\t\t\t\t},\n\t\t\t\t\t]\n\t\t\t\t: []),\n\t\t]),\n\t\t...blueprintToSheets(blueprint).map((name) => ({\n\t\t\tspecifier: `@src/${name}`,\n\t\t\ttarget: `./src/${name}/index.ts`,\n\t\t})),\n\t\t...ENVIRONMENTS.filter((environment) => blueprint.src.includes(environment)).map(\n\t\t\t(environment) => ({\n\t\t\t\tspecifier: `@src/${environment}`,\n\t\t\t\ttarget: `./src/${environment}/index.ts`,\n\t\t\t}),\n\t\t),\n\t\t...ENVIRONMENTS.filter((environment) => blueprint.app.includes(environment)).map(\n\t\t\t(environment) => ({\n\t\t\t\tspecifier: `@app/${environment}`,\n\t\t\t\ttarget: `./app/${environment}/index.ts`,\n\t\t\t}),\n\t\t),\n\t\t...(root === undefined\n\t\t\t? ENVIRONMENTS.filter(\n\t\t\t\t\t(environment) => environment !== 'core' && blueprint.src.includes(environment),\n\t\t\t\t).map((environment) => ({\n\t\t\t\t\tspecifier: `@orkestrel/${blueprint.name}${SRC_MATRIX[environment].path.slice(1)}`,\n\t\t\t\t\ttarget: `./src/${environment}/index.ts`,\n\t\t\t\t}))\n\t\t\t: []),\n\t\t...(blueprint.src.length > 0\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tspecifier: `@orkestrel/${blueprint.name}`,\n\t\t\t\t\t\ttarget: `./src/${root ?? 'core'}/index.ts`,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: []),\n\t]\n\tconst paths = aliases\n\t\t.map(({ specifier, target }, index) => {\n\t\t\tconst separator = index === aliases.length - 1 ? '' : ','\n\t\t\tconst line = `\\t\\t\\t\"${specifier}\": [\"${target}\"]${separator}`\n\t\t\t// A published specifier carries the package name, and npm accepts one long\n\t\t\t// enough to push the entry past the formatter's width. oxfmt breaks such an\n\t\t\t// entry over its own lines, so emitting the flat form would leave the generated\n\t\t\t// file outside the fixed point the emit corpus holds it to.\n\t\t\tif (matchesPrintWidth(line)) return line\n\t\t\treturn `\\t\\t\\t\"${specifier}\": [\\n\\t\\t\\t\\t\"${target}\"\\n\\t\\t\\t]${separator}`\n\t\t})\n\t\t.join('\\n')\n\treturn fillTemplate(CONFIG_TEMPLATES.root.tsconfig, {\n\t\tpaths: aliases.length === 0 ? '\\t\\t\"paths\": {}' : `\\t\\t\"paths\": {\\n${paths}\\n\\t\\t}`,\n\t})\n}\n\n/**\n * Projects a blueprint into the project labels its root Vitest configuration registers.\n *\n * @param blueprint - The workspace specification.\n * @returns Project labels in registration order, including wrapper-registered sheet faces.\n *\n * @example\n * ```ts\n * import { blueprintToProjects, createBlueprint } from '@orkestrel/scaffold'\n *\n * blueprintToProjects(createBlueprint('desk')).includes('policy') // true\n * ```\n */\nexport function blueprintToProjects(blueprint: Blueprint): readonly string[] {\n\tconst sheets = blueprintToSheets(blueprint)\n\tconst styled = sheets.length > 0 || blueprint.themes\n\tconst faces = blueprintToFaces(blueprint)\n\treturn [\n\t\t...sheets.map((name) => `src:${name}`),\n\t\t...(blueprint.themes && !blueprint.styles ? ['src:themes'] : []),\n\t\t...AXES.flatMap((axis) => [\n\t\t\t...ENVIRONMENTS.filter(\n\t\t\t\t(environment) =>\n\t\t\t\t\t(axis !== 'app' || environment !== 'server') && blueprint[axis].includes(environment),\n\t\t\t).map((environment) => `${axis}:${environment}`),\n\t\t\t...faces.filter((face) => face.axes.includes(axis)).map((face) => `${axis}:${face.name}`),\n\t\t\t...(axis === 'src' && blueprint.bin ? ['src:bin'] : []),\n\t\t\t...(axis === 'app' && blueprint.app.includes('server') ? ['app:server'] : []),\n\t\t]),\n\t\t'policy',\n\t\t'config',\n\t\t...(blueprint.setup.includes('node') || blueprint.global ? ['setup'] : []),\n\t\t...(blueprint.setup.includes('browser') ? ['setup:browser'] : []),\n\t\t...(blueprint.guides ? ['guides'] : []),\n\t\t...(blueprint.skills ? ['skills'] : []),\n\t\t...(blueprint.conformance ? ['conformance'] : []),\n\t\t...(blueprint.tree ? ['tree'] : []),\n\t\t...(blueprint.service ? ['service'] : []),\n\t\t...(blueprint.studies ? ['studies'] : []),\n\t\t...(blueprint.src.length > 0 || styled ? ['distribution'] : []),\n\t\t...(blueprint.integration ? ['integration'] : []),\n\t\t'probe',\n\t]\n}\n\n/**\n * Compiles the browser projects' pre-bundled dependency list for a blueprint.\n *\n * @remarks\n * A browser-mode run that discovers a runtime package mid-collection reloads the page, so the\n * list names the test package, its browser entry, and every Orkestrel runtime package the\n * blueprint declares or peers with, inline when the line fits the print width and stacked\n * otherwise.\n *\n * @example\n * ```ts\n * import { blueprintToOptimizedDependencies, createBlueprint } from '@orkestrel/scaffold'\n *\n * const blueprint = createBlueprint('router', { src: ['core'] })\n *\n * blueprintToOptimizedDependencies(blueprint).includes(\"'@orkestrel/test/browser'\") // true\n * ```\n */\nexport function blueprintToOptimizedDependencies(blueprint: Blueprint): string {\n\tconst names = [\n\t\t'@orkestrel/test',\n\t\t'@orkestrel/test/browser',\n\t\t...[\n\t\t\t...new Set([\n\t\t\t\t...(Object.hasOwn(blueprintToDevDependencies(blueprint), '@orkestrel/contract')\n\t\t\t\t\t? ['@orkestrel/contract']\n\t\t\t\t\t: []),\n\t\t\t\t...blueprint.dependencies.map((dependency) => dependency.name),\n\t\t\t\t...blueprint.peers.map((peer) => peer.name),\n\t\t\t]),\n\t\t]\n\t\t\t.filter((name) => name.startsWith('@orkestrel/'))\n\t\t\t.sort(),\n\t]\n\tconst inline = `\\tinclude: [${names.map((name) => `'${name}'`).join(', ')}],`\n\treturn matchesPrintWidth(inline)\n\t\t? `const optimizeDeps = {\\n${inline}\\n}\\n\\n`\n\t\t: `const optimizeDeps = {\\n\\tinclude: [\\n${names.map((name) => `\\t\\t'${name}',`).join('\\n')}\\n\\t],\\n}\\n\\n`\n}\n\n/**\n * Compiles 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 planned = new Set(blueprintToProjects(blueprint))\n\tconst sheets = blueprintToSheets(blueprint)\n\tconst styled = sheets.length > 0 || blueprint.themes\n\t// A browser test runs in the browser, so it cannot start a Node fixture for\n\t// itself. That is the case a global setup exists for, and it is why\n\t// `src:browser`, `setup:browser`, and `integration` take the same span.\n\tconst global = blueprint.global ? \"\\t\\t\\tglobalSetup: ['./tests/setupGlobal.ts'],\\n\" : ''\n\tconst imports = [\n\t\t...(styled || machinery.showcase\n\t\t\t? [\n\t\t\t\t\t`import { ${[...(styled ? ['existsSync'] : []), ...(machinery.showcase ? ['renameSync'] : [])].join(', ')} } from 'node:fs'`,\n\t\t\t\t]\n\t\t\t: []),\n\t\t...(machinery.browser ? [\"import { playwright } from '@vitest/browser-playwright'\"] : []),\n\t\t...(machinery.frameworks.includes('vue') ? [\"import vue from '@vitejs/plugin-vue'\"] : []),\n\t\t...(machinery.showcase\n\t\t\t? [\n\t\t\t\t\t\"import { viteSingleFile } from 'vite-plugin-singlefile'\",\n\t\t\t\t\t\"import { resolve as resolvePath } from 'node:path'\",\n\t\t\t\t]\n\t\t\t: []),\n\t]\n\tconst external = 'external: resolveSourceExternal,'\n\t// Each factory and the row that registers it are chosen by the same condition, in the order\n\t// the generated configuration declares them.\n\tconst factories = [\n\t\t...(blueprint.src.includes('browser') || blueprint.src.includes('server')\n\t\t\t? [\n\t\t\t\t\tblueprint.src.includes('core')\n\t\t\t\t\t\t? `function resolveSourceExternal(id: string): boolean {\n\treturn (\n\t\tid === '@src/core' ||\n\t\tresolveExternal(id, {\n\t\t\tpeers,\n\t\t\trefused: [],\n\t\t\tsiblings: [resolveWorkspacePath('src/core/index.ts')],\n\t\t})\n\t)\n}\n`\n\t\t\t\t\t\t: `function resolveSourceExternal(id: string): boolean {\n\treturn resolveExternal(id, { peers, refused: [], siblings: [] })\n}\n`,\n\t\t\t\t]\n\t\t\t: []),\n\t\t...(styled ? [CONFIG_TEMPLATES.factories.sheet] : []),\n\t\t...(planned.has('src:core') ? [CONFIG_TEMPLATES.factories.src.core] : []),\n\t\t// Each of the two source factories asks the axis for core once, where it renders.\n\t\t...(planned.has('src:browser')\n\t\t\t? [blueprint.src.includes('core')].map((core) =>\n\t\t\t\t\tfillTemplate(CONFIG_TEMPLATES.factories.src.browser, {\n\t\t\t\t\t\texternal,\n\t\t\t\t\t\toutput: core\n\t\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\\t\\toutput: {},',\n\t\t\t\t\t\texclude: core ? \"\\t\\t\\texclude: ['tests/src/core/**/*.test.ts'],\\n\" : '',\n\t\t\t\t\t\tglobal,\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t: []),\n\t\t...(planned.has('src:server')\n\t\t\t? [blueprint.src.includes('core')].map((core) =>\n\t\t\t\t\tfillTemplate(CONFIG_TEMPLATES.factories.src.server, {\n\t\t\t\t\t\texternal,\n\t\t\t\t\t\toutput: core\n\t\t\t\t\t\t\t? `\\t\\t\\t\\toutput: [\n\t\t\t\t\t{\n\t\t\t\t\t\tformat: 'es',\n\t\t\t\t\t\tentryFileNames: 'index.js',\n\t\t\t\t\t\tpaths: { '@src/core': '../core/index.js' },\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tformat: 'cjs',\n\t\t\t\t\t\tentryFileNames: 'index.cjs',\n\t\t\t\t\t\tpaths: { '@src/core': '../core/index.cjs' },\n\t\t\t\t\t},\n\t\t\t\t],`\n\t\t\t\t\t\t\t: '\\t\\t\\t\\toutput: {},',\n\t\t\t\t\t\texclude: core ? \"\\t\\t\\texclude: ['tests/src/core/**/*.test.ts'],\\n\" : '',\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t: []),\n\t\t...(planned.has('src:vue') ? [CONFIG_TEMPLATES.factories.src.vue] : []),\n\t\t...(planned.has('src:bin') ? [CONFIG_TEMPLATES.factories.src.bin] : []),\n\t\t...(planned.has('app:core') ? [CONFIG_TEMPLATES.factories.app.core] : []),\n\t\t...(planned.has('app:browser')\n\t\t\t? [\n\t\t\t\t\tfillTemplate(CONFIG_TEMPLATES.factories.app.browser, {\n\t\t\t\t\t\tshowcaseFactory: machinery.showcase ? CONFIG_TEMPLATES.factories.app.showcase : '',\n\t\t\t\t\t\tjourneyFactory: blueprint.journey ? CONFIG_TEMPLATES.factories.app.journey : '',\n\t\t\t\t\t\tjourneyExclude: blueprint.journey\n\t\t\t\t\t\t\t? \"\\t\\t\\texclude: ['tests/app/browser/integration.test.ts'],\\n\"\n\t\t\t\t\t\t\t: '',\n\t\t\t\t\t}),\n\t\t\t\t]\n\t\t\t: []),\n\t\t...(planned.has('app:vue')\n\t\t\t? [\n\t\t\t\t\tfillTemplate(CONFIG_TEMPLATES.factories.app.vue, {\n\t\t\t\t\t\tjourneyExclude: blueprint.journey\n\t\t\t\t\t\t\t? \"\\t\\t\\texclude: ['tests/app/vue/integration.test.ts'],\\n\"\n\t\t\t\t\t\t\t: '\\t\\t\\texclude: [],\\n',\n\t\t\t\t\t}),\n\t\t\t\t]\n\t\t\t: []),\n\t\t...(planned.has('app:server') ? [CONFIG_TEMPLATES.factories.app.server] : []),\n\t\tCONFIG_TEMPLATES.factories.policy,\n\t\tCONFIG_TEMPLATES.factories.config,\n\t\t...(planned.has('setup') ? [CONFIG_TEMPLATES.factories.setup] : []),\n\t\t...(planned.has('setup:browser')\n\t\t\t? [\n\t\t\t\t\tfillTemplate(CONFIG_TEMPLATES.factories.browser, {\n\t\t\t\t\t\toptimization: machinery.frameworks.includes('vue')\n\t\t\t\t\t\t\t? \"optimizeDeps: { include: [...optimizeDeps.include, 'vue'] }\"\n\t\t\t\t\t\t\t: 'optimizeDeps',\n\t\t\t\t\t\tplugins: machinery.frameworks.includes('vue') ? '\\t\\tplugins: [vue()],\\n' : '',\n\t\t\t\t\t\tglobal,\n\t\t\t\t\t}),\n\t\t\t\t]\n\t\t\t: []),\n\t\t...(planned.has('guides') ? [CONFIG_TEMPLATES.factories.guides] : []),\n\t\t...(planned.has('skills') ? [CONFIG_TEMPLATES.factories.skills] : []),\n\t\t...(planned.has('conformance') ? [CONFIG_TEMPLATES.factories.conformance] : []),\n\t\t...(planned.has('tree') ? [CONFIG_TEMPLATES.factories.tree] : []),\n\t\t...(planned.has('service') ? [CONFIG_TEMPLATES.factories.service] : []),\n\t\t...(planned.has('studies') ? [CONFIG_TEMPLATES.factories.studies] : []),\n\t\t...(planned.has('distribution') ? [CONFIG_TEMPLATES.factories.distribution] : []),\n\t\t...(planned.has('integration')\n\t\t\t? [\n\t\t\t\t\tfillTemplate(\n\t\t\t\t\t\tstyled\n\t\t\t\t\t\t\t? CONFIG_TEMPLATES.factories.integration.sheet\n\t\t\t\t\t\t\t: CONFIG_TEMPLATES.factories.integration.module,\n\t\t\t\t\t\t{ global },\n\t\t\t\t\t),\n\t\t\t\t]\n\t\t\t: []),\n\t\tCONFIG_TEMPLATES.factories.probe,\n\t]\n\t// The `app:browser` row is the factory itself, never a call of it. Vitest hands the command\n\t// line's `--mode` only to a project it calls, and `mergeOverride` sets that mode on the\n\t// project it returns, so an evaluated row silently turns the release-mode publish gate into\n\t// a skip.\n\tconst projects = [\n\t\t...(styled\n\t\t\t? [\n\t\t\t\t\t...sheets.map((name) => `'./configs/src/vite.${name}.config.ts'`),\n\t\t\t\t\t...(planned.has('src:themes') ? [\"'./configs/src/vite.themes.config.ts'\"] : []),\n\t\t\t\t]\n\t\t\t: []),\n\t\t...(planned.has('src:core') ? ['srcCore'] : []),\n\t\t...(planned.has('src:browser') ? ['srcBrowser'] : []),\n\t\t...(planned.has('src:server') ? ['srcServer'] : []),\n\t\t...(planned.has('src:vue') ? ['srcVue'] : []),\n\t\t...(planned.has('src:bin') ? ['srcBin'] : []),\n\t\t...(planned.has('app:core') ? ['appCore'] : []),\n\t\t...(planned.has('app:browser') ? ['appBrowser'] : []),\n\t\t...(planned.has('app:vue') ? ['appVue'] : []),\n\t\t...(planned.has('app:server') ? ['appServer'] : []),\n\t\t'policy',\n\t\t'config',\n\t\t...(planned.has('setup') ? ['setup'] : []),\n\t\t...(planned.has('setup:browser') ? ['setupBrowser'] : []),\n\t\t...(planned.has('guides') ? ['guides'] : []),\n\t\t...(planned.has('skills') ? ['skills'] : []),\n\t\t...(planned.has('conformance') ? ['conformance'] : []),\n\t\t...(planned.has('tree') ? ['tree'] : []),\n\t\t...(planned.has('service') ? ['service'] : []),\n\t\t...(planned.has('studies') ? ['studies'] : []),\n\t\t...(planned.has('distribution') ? ['distribution'] : []),\n\t\t...(planned.has('integration') ? ['integration'] : []),\n\t\t'probe',\n\t]\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 configuration helpers 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.\n\tconst body = `${factories.join('\\n')}\\n`\n\tconst helpers = [\n\t\t'enforceBuildLog',\n\t\t'environmentBoundary',\n\t\t'outputBoundary',\n\t\t'resolveApplication',\n\t\t'resolveExternal',\n\t\t'stampPage',\n\t].filter((helper) => body.includes(helper))\n\tconst helperImport = `import { ${helpers.join(', ')} } from './configs/helpers.js'\\n`\n\treturn fillTemplate(CONFIG_TEMPLATES.root.vite, {\n\t\tjourney:\n\t\t\tblueprint.journey && blueprint.app.includes('browser')\n\t\t\t\t? \"import type { JourneyVariant } from '@orkestrel/test'\\n\"\n\t\t\t\t: '',\n\t\timports: imports.length === 0 ? '' : `${imports.join('\\n')}\\n`,\n\t\thelpers:\n\t\t\thelpers.length === 0\n\t\t\t\t? ''\n\t\t\t\t: matchesPrintWidth(helperImport.trimEnd())\n\t\t\t\t\t? helperImport\n\t\t\t\t\t: `import {\\n${helpers.map((helper) => `\\t${helper},`).join('\\n')}\\n} 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. The same\n\t\t// selection emits `configs/commands.ts`, whose record every factory that names\n\t\t// the provider reads.\n\t\tbrowsers: machinery.browser\n\t\t\t? \"import { resolveBrowser, resolvePinnedBrowser } from './configs/browsers.js'\\nimport { commands } from './configs/commands.js'\\n\"\n\t\t\t: '',\n\t\toptions:\n\t\t\t(machinery.browser\n\t\t\t\t? 'const browserOptions = resolveBrowser(resolvePinnedBrowser(), process.platform, process.env)\\n\\n' +\n\t\t\t\t\tblueprintToOptimizedDependencies(blueprint)\n\t\t\t\t: '') +\n\t\t\t(blueprint.journey && blueprint.app.includes('browser')\n\t\t\t\t? \"const capture = process.env.CAPTURE === '1'\\n\\n\"\n\t\t\t\t: '') +\n\t\t\t((blueprint.journey || blueprint.showcase) && blueprint.app.includes('browser')\n\t\t\t\t? `const applications = {\\n\\tbrowser: appBrowser,\\n${blueprintToFaces(blueprint)\n\t\t\t\t\t\t.filter(\n\t\t\t\t\t\t\t(extension) => extension.surface === 'browser' && extension.axes.includes('app'),\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t(extension) =>\n\t\t\t\t\t\t\t\t`\\t${extension.name}: app${extension.name[0]?.toUpperCase()}${extension.name.slice(1)},\\n`,\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.join('')}}\\n\\n`\n\t\t\t\t: ''),\n\t\tfactories: body,\n\t\tprojects: projectRows,\n\t})\n}\n\n/**\n * Compiles 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 roots: readonly 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. The commands\n\t// module holds the package's own browser commands, so it is presence-owned: a\n\t// missing file is restored and a written one is kept.\n\tconst browsers: readonly Artifact[] = blueprintToMachinery(blueprint).browser\n\t\t? [\n\t\t\t\t{\n\t\t\t\t\tpath: 'configs/browsers.ts',\n\t\t\t\t\tgroup: 'configs',\n\t\t\t\t\townership: 'content',\n\t\t\t\t\torigin: 'template',\n\t\t\t\t\tcontent: CONFIG_TEMPLATES.browsers,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tpath: 'configs/commands.ts',\n\t\t\t\t\tgroup: 'configs',\n\t\t\t\t\townership: 'presence',\n\t\t\t\t\torigin: 'template',\n\t\t\t\t\tcontent: CONFIG_TEMPLATES.commands,\n\t\t\t\t},\n\t\t\t]\n\t\t: []\n\tconst sheets: readonly Artifact[] = [\n\t\t...blueprintToSheets(blueprint),\n\t\t...(blueprint.themes ? ['styles/themes'] : []),\n\t].flatMap((name): readonly Artifact[] => {\n\t\tconst wrapper: Artifact = {\n\t\t\tpath: `configs/src/vite.${name === 'styles/themes' ? 'themes' : name}.config.ts`,\n\t\t\tgroup: 'configs',\n\t\t\townership: 'content',\n\t\t\torigin: 'template',\n\t\t\tcontent: fillTemplate(CONFIG_TEMPLATES.vites.sheet, {\n\t\t\t\tname,\n\t\t\t\tlabel: name === 'styles/themes' ? 'themes' : name,\n\t\t\t}),\n\t\t}\n\t\treturn name === 'styles/themes'\n\t\t\t? [wrapper]\n\t\t\t: [\n\t\t\t\t\twrapper,\n\t\t\t\t\t{\n\t\t\t\t\t\tpath: `configs/src/tsconfig.${name}.json`,\n\t\t\t\t\t\tgroup: 'configs',\n\t\t\t\t\t\townership: 'content',\n\t\t\t\t\t\torigin: 'template',\n\t\t\t\t\t\tcontent: fillTemplate(CONFIG_TEMPLATES.tsconfigs.sheet, { name }),\n\t\t\t\t\t},\n\t\t\t\t]\n\t})\n\t// The iterator consumes one environment at a time, and reads a hole in `src` or `app` as an\n\t// `undefined` environment, which the matrix refuses before a later environment is read.\n\tconst sources: readonly Artifact[] = Iterator.from(blueprint.src)\n\t\t.flatMap((environment) =>\n\t\t\tSRC_MATRIX[environment].configs.map((path): Artifact => ({\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\t\tpath === 'configs/src/tsconfig.core.json'\n\t\t\t\t\t\t? CONFIG_TEMPLATES.tsconfigs.src.core\n\t\t\t\t\t\t: path === 'configs/src/vite.browser.config.ts'\n\t\t\t\t\t\t\t? CONFIG_TEMPLATES.vites.src.browser\n\t\t\t\t\t\t\t: path === 'configs/src/tsconfig.browser.json'\n\t\t\t\t\t\t\t\t? CONFIG_TEMPLATES.tsconfigs.src.browser\n\t\t\t\t\t\t\t\t: path === 'configs/src/vite.server.config.ts'\n\t\t\t\t\t\t\t\t\t? CONFIG_TEMPLATES.vites.src.server\n\t\t\t\t\t\t\t\t\t: path === 'configs/src/tsconfig.server.json'\n\t\t\t\t\t\t\t\t\t\t? CONFIG_TEMPLATES.tsconfigs.src.server\n\t\t\t\t\t\t\t\t\t\t: CONFIG_TEMPLATES.vites.src.core,\n\t\t\t})),\n\t\t)\n\t\t.toArray()\n\t// The paths are read only for a bin selection, once, after the sources.\n\tconst paths = blueprint.bin\n\t\t? blueprint.src.map(\n\t\t\t\t(environment) => `\\t\\t\\t\\t\\t\\t'@src/${environment}': '../src/${environment}/index.js',`,\n\t\t\t)\n\t\t: []\n\tconst renderedPaths =\n\t\tpaths.length === 0\n\t\t\t? '\\t\\t\\t\\t\\tpaths: {},'\n\t\t\t: `\\t\\t\\t\\t\\tpaths: {\n${paths.join('\\n')}\n\t\t\t\t\t},`\n\tconst bins: readonly Artifact[] = blueprint.bin\n\t\t? BIN_CONFIGS.map((path): Artifact => ({\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\tconst includeSuffixes = ['cts', 'mts', 'ts', 'tsx']\n\t// Each browser and server tsconfig asks the application axis for core where it renders its own\n\t// include list, so the axis is read once per such config and never for another.\n\tconst applications: readonly Artifact[] = Iterator.from(blueprint.app)\n\t\t.flatMap((environment) =>\n\t\t\tAPP_MATRIX[environment].configs.map((path): Artifact => ({\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\t\tpath === 'configs/app/vite.browser.config.ts'\n\t\t\t\t\t\t? CONFIG_TEMPLATES.vites.app.browser\n\t\t\t\t\t\t: path === 'configs/app/tsconfig.browser.json'\n\t\t\t\t\t\t\t? fillTemplate(CONFIG_TEMPLATES.tsconfigs.app.browser, {\n\t\t\t\t\t\t\t\t\tinclude: [\n\t\t\t\t\t\t\t\t\t\t...includeSuffixes.map((suffix) => `../../app/browser/**/*.${suffix}`),\n\t\t\t\t\t\t\t\t\t\t...(blueprint.app.includes('core')\n\t\t\t\t\t\t\t\t\t\t\t? includeSuffixes.map((suffix) => `../../app/core/**/*.${suffix}`)\n\t\t\t\t\t\t\t\t\t\t\t: []),\n\t\t\t\t\t\t\t\t\t\t...includeSuffixes.map((suffix) => `../../tests/app/browser/**/*.${suffix}`),\n\t\t\t\t\t\t\t\t\t\t'../../tests/setup.ts',\n\t\t\t\t\t\t\t\t\t\t'../../tests/setupBrowser.ts',\n\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t\t\t(entry, index, entries) =>\n\t\t\t\t\t\t\t\t\t\t\t\t`\\t\\t${JSON.stringify(entry)}${index === entries.length - 1 ? '' : ','}`,\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t.join('\\n'),\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t: path === 'configs/app/vite.server.config.ts'\n\t\t\t\t\t\t\t\t? CONFIG_TEMPLATES.vites.app.server\n\t\t\t\t\t\t\t\t: path === 'configs/app/tsconfig.server.json'\n\t\t\t\t\t\t\t\t\t? fillTemplate(CONFIG_TEMPLATES.tsconfigs.app.server, {\n\t\t\t\t\t\t\t\t\t\t\tinclude: [\n\t\t\t\t\t\t\t\t\t\t\t\t...includeSuffixes.map((suffix) => `../../app/server/**/*.${suffix}`),\n\t\t\t\t\t\t\t\t\t\t\t\t...(blueprint.app.includes('core')\n\t\t\t\t\t\t\t\t\t\t\t\t\t? includeSuffixes.map((suffix) => `../../app/core/**/*.${suffix}`)\n\t\t\t\t\t\t\t\t\t\t\t\t\t: []),\n\t\t\t\t\t\t\t\t\t\t\t\t...includeSuffixes.map((suffix) => `../../tests/app/server/**/*.${suffix}`),\n\t\t\t\t\t\t\t\t\t\t\t\t'../../tests/setup.ts',\n\t\t\t\t\t\t\t\t\t\t\t\t'../../tests/setupServer.ts',\n\t\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t\t\t\t\t(entry, index, entries) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t`\\t\\t${JSON.stringify(entry)}${index === entries.length - 1 ? '' : ','}`,\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t.join('\\n'),\n\t\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\t: CONFIG_TEMPLATES.tsconfigs.app.core,\n\t\t\t})),\n\t\t)\n\t\t.toArray()\n\tconst faces: readonly Artifact[] = blueprintToFaces(blueprint).flatMap((extension) =>\n\t\textension.axes.flatMap((axis): readonly Artifact[] => {\n\t\t\tconst include = [\n\t\t\t\t...['cts', 'mts', 'ts', 'tsx', ...FRAMEWORK_MATRIX[extension.name].suffixes].map(\n\t\t\t\t\t(suffix) => `../../app/${extension.name}/**/*.${suffix}`,\n\t\t\t\t),\n\t\t\t\t...(blueprint.app.includes('core')\n\t\t\t\t\t? ['cts', 'mts', 'ts', 'tsx'].map((suffix) => `../../app/core/**/*.${suffix}`)\n\t\t\t\t\t: []),\n\t\t\t\t...['cts', 'mts', 'ts', 'tsx', ...FRAMEWORK_MATRIX[extension.name].suffixes].map(\n\t\t\t\t\t(suffix) => `../../tests/app/${extension.name}/**/*.${suffix}`,\n\t\t\t\t),\n\t\t\t\t'../../tests/setup.ts',\n\t\t\t\t'../../tests/setupBrowser.ts',\n\t\t\t]\n\t\t\tconst siblings = blueprint.src\n\t\t\t\t.filter((environment) => environment === 'core' || environment === 'browser')\n\t\t\t\t.flatMap((environment) =>\n\t\t\t\t\t['ts', 'js'].map((suffix) => {\n\t\t\t\t\t\tconst key = `\\t[resolveWorkspacePath('src/${environment}/index.${suffix}').replaceAll('\\\\\\\\', '/')]:`\n\t\t\t\t\t\tconst value = `'@orkestrel/${blueprint.name}${environment === 'browser' ? '/browser' : ''}',`\n\t\t\t\t\t\treturn matchesPrintWidth(`${key} ${value}`) ? `${key} ${value}` : `${key}\\n\\t\\t${value}`\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t\t.join('\\n')\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tpath: `configs/${axis}/vite.${extension.name}.config.ts`,\n\t\t\t\t\tgroup: 'configs',\n\t\t\t\t\townership: 'content',\n\t\t\t\t\torigin: 'template',\n\t\t\t\t\tenvironment: 'browser',\n\t\t\t\t\tcontent:\n\t\t\t\t\t\taxis === 'src'\n\t\t\t\t\t\t\t? fillTemplate(CONFIG_TEMPLATES.vites.src.vue, {\n\t\t\t\t\t\t\t\t\tsiblings,\n\t\t\t\t\t\t\t\t\trefused: `[${FRAMEWORK_MATRIX[extension.name].refused.map((name) => serializeTypeScriptString(name)).join(', ')}]`,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t: CONFIG_TEMPLATES.vites.app.vue,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tpath: `configs/${axis}/tsconfig.${extension.name}.json`,\n\t\t\t\t\tgroup: 'configs',\n\t\t\t\t\townership: 'content',\n\t\t\t\t\torigin: 'template',\n\t\t\t\t\tenvironment: 'browser',\n\t\t\t\t\tcontent:\n\t\t\t\t\t\taxis === 'src'\n\t\t\t\t\t\t\t? CONFIG_TEMPLATES.tsconfigs.vue.src\n\t\t\t\t\t\t\t: fillTemplate(CONFIG_TEMPLATES.tsconfigs.vue.app, {\n\t\t\t\t\t\t\t\t\tinclude: include\n\t\t\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t\t\t(entry, index) =>\n\t\t\t\t\t\t\t\t\t\t\t\t`\\t\\t${JSON.stringify(entry)}${index === include.length - 1 ? '' : ','}`,\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t.join('\\n'),\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t},\n\t\t\t]\n\t\t}),\n\t)\n\tconst showcase: readonly Artifact[] =\n\t\tblueprint.showcase && blueprint.app.includes('browser')\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tpath: SHOWCASE_CONFIG_PATH,\n\t\t\t\t\t\tgroup: 'configs',\n\t\t\t\t\t\townership: 'content',\n\t\t\t\t\t\torigin: 'template',\n\t\t\t\t\t\tenvironment: 'browser',\n\t\t\t\t\t\tcontent: CONFIG_TEMPLATES.vites.app.showcase,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: []\n\tconst journey: readonly Artifact[] =\n\t\tblueprint.journey && blueprint.app.includes('browser')\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tpath: JOURNEY_CONFIG_PATH,\n\t\t\t\t\t\tgroup: 'configs',\n\t\t\t\t\t\townership: 'birth',\n\t\t\t\t\t\torigin: 'template',\n\t\t\t\t\t\tenvironment: 'browser',\n\t\t\t\t\t\tcontent: CONFIG_TEMPLATES.vites.app.journey,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: []\n\tconst skills: readonly Artifact[] = blueprint.skills\n\t\t? [\n\t\t\t\t{\n\t\t\t\t\tpath: SKILLS_CONFIG_PATH,\n\t\t\t\t\tgroup: 'configs',\n\t\t\t\t\townership: 'content',\n\t\t\t\t\torigin: 'template',\n\t\t\t\t\tcontent: CONFIG_TEMPLATES.tsconfigs.skills,\n\t\t\t\t},\n\t\t\t]\n\t\t: []\n\treturn [\n\t\t...roots,\n\t\t...browsers,\n\t\t...sheets,\n\t\t...sources,\n\t\t...bins,\n\t\t...applications,\n\t\t...faces,\n\t\t...showcase,\n\t\t...journey,\n\t\t...skills,\n\t]\n}\n\n/**\n * Compiles every artifact in the `source` group.\n *\n * @param blueprint - The workspace specification.\n * @returns Published barrels, sheet seeds, selected application entries, and the optional bin entry.\n *\n * @remarks\n * Barrels, server entries, and bin entries hold no starter implementation. Browser entries\n * render the workspace name as a level-one heading; the Vue face mounts its arrival component.\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 tokens: readonly ContentArtifact[] =\n\t\tblueprint.themes && !blueprint.styles\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tpath: 'src/styles/_tokens.scss',\n\t\t\t\t\t\tgroup: 'source',\n\t\t\t\t\t\townership: 'birth',\n\t\t\t\t\t\torigin: 'template',\n\t\t\t\t\t\tcontent: ARTIFACT_TEMPLATES.source.sheet['_tokens.scss'],\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: []\n\tconst sheets: readonly ContentArtifact[] = [\n\t\t...blueprintToSheets(blueprint),\n\t\t...(blueprint.themes ? ['styles/themes'] : []),\n\t].flatMap((name) =>\n\t\tObject.entries(\n\t\t\tname === 'styles/themes' ? ARTIFACT_TEMPLATES.source.themes : ARTIFACT_TEMPLATES.source.sheet,\n\t\t).map(([path, content]): ContentArtifact => ({\n\t\t\tpath: `src/${name}/${path}`,\n\t\t\tgroup: 'source',\n\t\t\townership: 'birth',\n\t\t\torigin: 'template',\n\t\t\tcontent,\n\t\t})),\n\t)\n\t// A hole in `src` or `app` reads as an `undefined` environment, as a `for…of` over it would.\n\tconst sources: readonly ContentArtifact[] = Iterator.from(blueprint.src)\n\t\t.map((environment): ContentArtifact => ({\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\t.toArray()\n\tconst applications: readonly ContentArtifact[] = Iterator.from(blueprint.app)\n\t\t.flatMap((environment): readonly ContentArtifact[] => {\n\t\t\tconst entry: ContentArtifact = {\n\t\t\t\tpath: `app/${environment}/index.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\tif (environment === 'browser') {\n\t\t\t\treturn [\n\t\t\t\t\tentry,\n\t\t\t\t\t{\n\t\t\t\t\t\tpath: 'app/browser/main.ts',\n\t\t\t\t\t\tgroup: 'source',\n\t\t\t\t\t\townership: 'birth',\n\t\t\t\t\t\torigin: 'template',\n\t\t\t\t\t\tenvironment,\n\t\t\t\t\t\tcontent: fillTemplate(ARTIFACT_TEMPLATES.source.main, {\n\t\t\t\t\t\t\theading: `${matchesPrintWidth(`\\t.appendChild(document.createElement('h1')).textContent = ${serializeTypeScriptString(blueprint.name)}`) ? ' ' : '\\n\\t'}${serializeTypeScriptString(blueprint.name)}`,\n\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tpath: 'app/browser/index.html',\n\t\t\t\t\t\tgroup: 'source',\n\t\t\t\t\t\townership: 'birth',\n\t\t\t\t\t\torigin: 'template',\n\t\t\t\t\t\tenvironment,\n\t\t\t\t\t\tcontent: ARTIFACT_TEMPLATES.source.browser,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t}\n\t\t\treturn environment === 'server'\n\t\t\t\t? [\n\t\t\t\t\t\tentry,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tpath: 'app/server/main.ts',\n\t\t\t\t\t\t\tgroup: 'source',\n\t\t\t\t\t\t\townership: 'birth',\n\t\t\t\t\t\t\torigin: 'template',\n\t\t\t\t\t\t\tenvironment,\n\t\t\t\t\t\t\tcontent: ARTIFACT_TEMPLATES.source.empty,\n\t\t\t\t\t\t},\n\t\t\t\t\t]\n\t\t\t\t: [entry]\n\t\t})\n\t\t.toArray()\n\tconst faces: readonly ContentArtifact[] = blueprintToFaces(blueprint).flatMap((extension) =>\n\t\textension.axes.flatMap((axis): readonly ContentArtifact[] => {\n\t\t\tconst barrel: ContentArtifact = {\n\t\t\t\tpath: `${axis}/${extension.name}/index.ts`,\n\t\t\t\tgroup: 'source',\n\t\t\t\townership: 'birth',\n\t\t\t\torigin: 'template',\n\t\t\t\tenvironment: 'browser',\n\t\t\t\tcontent:\n\t\t\t\t\taxis === 'app' ? ARTIFACT_TEMPLATES.source.empty : ARTIFACT_TEMPLATES.source.barrel,\n\t\t\t}\n\t\t\treturn axis === 'app'\n\t\t\t\t? [\n\t\t\t\t\t\tbarrel,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tpath: `app/${extension.name}/index.html`,\n\t\t\t\t\t\t\tgroup: 'source',\n\t\t\t\t\t\t\townership: 'birth',\n\t\t\t\t\t\t\torigin: 'template',\n\t\t\t\t\t\t\tenvironment: 'browser',\n\t\t\t\t\t\t\tcontent: ARTIFACT_TEMPLATES.source.browser,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t...Object.entries(ARTIFACT_TEMPLATES.source.vue).map(\n\t\t\t\t\t\t\t([path, content]): ContentArtifact => ({\n\t\t\t\t\t\t\t\tpath: `app/${extension.name}/${path}`,\n\t\t\t\t\t\t\t\tgroup: 'source',\n\t\t\t\t\t\t\t\townership: 'birth',\n\t\t\t\t\t\t\t\torigin: 'template',\n\t\t\t\t\t\t\t\tenvironment: 'browser',\n\t\t\t\t\t\t\t\tcontent: fillTemplate(content, {\n\t\t\t\t\t\t\t\t\theading: matchesPrintWidth(`\\t<h1>${blueprint.name}</h1>`)\n\t\t\t\t\t\t\t\t\t\t? blueprint.name\n\t\t\t\t\t\t\t\t\t\t: `\\n\\t\\t${blueprint.name}\\n\\t`,\n\t\t\t\t\t\t\t\t}),\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: [barrel]\n\t\t}),\n\t)\n\tconst bin: readonly ContentArtifact[] = blueprint.bin\n\t\t? [\n\t\t\t\t{\n\t\t\t\t\tpath: BIN_ENTRY_PATH,\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\tcontent: ARTIFACT_TEMPLATES.source.empty,\n\t\t\t\t},\n\t\t\t]\n\t\t: []\n\treturn [...tokens, ...sheets, ...sources, ...applications, ...faces, ...bin]\n}\n\n/**\n * Compiles 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 and proofs, axis and sheet tests, journey suites, 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. `studies` emits nothing: the root configuration names no study harness,\n * so `tests/setupStudy.ts` is the package's own module.\n *\n * The content-owned distribution harness `tests/setupDistribution.ts` and the presence-owned\n * proof `tests/distribution.test.ts` are emitted because the proof measures the packed tarball\n * rather than anything only the package knows. Every assertion derives from the installed tree\n * at run time, so nothing has to be named. The proof follows the published source it packs and\n * alone is claimed by presence: a target lacking the proof reports as drift, and a package that\n * replaced the proof with a better one keeps that proof.\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 sheets = [...blueprintToSheets(blueprint), ...(blueprint.themes ? ['styles/themes'] : [])]\n\tconst faces: readonly ContentArtifact[] = blueprintToFaces(blueprint).flatMap((extension) =>\n\t\textension.axes.map((axis): ContentArtifact => ({\n\t\t\tpath: `tests/${axis}/${extension.name}/index.test.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: fillTemplate(ARTIFACT_TEMPLATES.tests.entry, {\n\t\t\t\tspecifier: serializeTypeScriptString(`@${axis}/${extension.name}`),\n\t\t\t\tlabel: serializeTypeScriptString(`${axis} ${extension.name} entry`),\n\t\t\t}),\n\t\t})),\n\t)\n\tconst styles: readonly ContentArtifact[] =\n\t\tsheets.length > 0\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tpath: 'tests/setupStyles.ts',\n\t\t\t\t\t\tgroup: 'tests',\n\t\t\t\t\t\townership: 'birth',\n\t\t\t\t\t\torigin: 'template',\n\t\t\t\t\t\tcontent: ARTIFACT_TEMPLATES.tests.styles.module,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tpath: 'tests/setupStyles.test.ts',\n\t\t\t\t\t\tgroup: 'tests',\n\t\t\t\t\t\townership: 'birth',\n\t\t\t\t\t\torigin: 'template',\n\t\t\t\t\t\tcontent: ARTIFACT_TEMPLATES.tests.styles.proof,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: []\n\t// Oxlint's `import/no-absolute-path` refuses a root-relative specifier, so the sheet import\n\t// climbs from `tests/src/<name>/`.\n\tconst sheetTests: readonly ContentArtifact[] = sheets.map((name): ContentArtifact => {\n\t\tconst tests = '../'.repeat(name.split('/').length + 1)\n\t\treturn {\n\t\t\tpath: `tests/src/${name}/index.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.sheet, {\n\t\t\t\tname,\n\t\t\t\troot: `${tests}../`,\n\t\t\t}),\n\t\t}\n\t})\n\tconst browsers: readonly ContentArtifact[] = blueprintToMachinery(blueprint).browser\n\t\t? [\n\t\t\t\t{\n\t\t\t\t\tpath: 'tests/setupBrowser.ts',\n\t\t\t\t\tgroup: 'tests',\n\t\t\t\t\townership: 'birth',\n\t\t\t\t\torigin: 'template',\n\t\t\t\t\tenvironment: 'browser',\n\t\t\t\t\tcontent: blueprint.journey\n\t\t\t\t\t\t? ARTIFACT_TEMPLATES.tests.browser\n\t\t\t\t\t\t: ARTIFACT_TEMPLATES.tests.setup,\n\t\t\t\t},\n\t\t\t]\n\t\t: []\n\tconst servers: readonly ContentArtifact[] =\n\t\tblueprint.src.includes('server') ||\n\t\tblueprint.app.includes('server') ||\n\t\tblueprint.bin ||\n\t\tblueprint.conformance ||\n\t\tblueprint.tree\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tpath: 'tests/setupServer.ts',\n\t\t\t\t\t\tgroup: 'tests',\n\t\t\t\t\t\townership: 'birth',\n\t\t\t\t\t\torigin: 'template',\n\t\t\t\t\t\tenvironment: 'server',\n\t\t\t\t\t\tcontent: ARTIFACT_TEMPLATES.tests.setup,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\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\tconst services: readonly ContentArtifact[] = blueprint.service\n\t\t? [\n\t\t\t\t{\n\t\t\t\t\tpath: SERVICE_SETUP_PATH,\n\t\t\t\t\tgroup: 'tests',\n\t\t\t\t\townership: 'birth',\n\t\t\t\t\torigin: 'template',\n\t\t\t\t\tcontent: ARTIFACT_TEMPLATES.tests.setup,\n\t\t\t\t},\n\t\t\t]\n\t\t: []\n\tconst globals: readonly ContentArtifact[] = blueprint.global\n\t\t? [\n\t\t\t\t{\n\t\t\t\t\tpath: GLOBAL_SETUP_PATH,\n\t\t\t\t\tgroup: 'tests',\n\t\t\t\t\townership: 'birth',\n\t\t\t\t\torigin: 'template',\n\t\t\t\t\tcontent: ARTIFACT_TEMPLATES.tests.global.module,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tpath: 'tests/setupGlobal.test.ts',\n\t\t\t\t\tgroup: 'tests',\n\t\t\t\t\townership: 'birth',\n\t\t\t\t\torigin: 'template',\n\t\t\t\t\tcontent: ARTIFACT_TEMPLATES.tests.global.proof,\n\t\t\t\t},\n\t\t\t]\n\t\t: []\n\tconst journeys: readonly ContentArtifact[] =\n\t\tblueprint.journey && blueprint.app.includes('browser')\n\t\t\t? [\n\t\t\t\t\t'browser',\n\t\t\t\t\t...blueprintToFaces(blueprint).flatMap((extension) =>\n\t\t\t\t\t\textension.surface === 'browser' && extension.axes.includes('app')\n\t\t\t\t\t\t\t? [extension.name]\n\t\t\t\t\t\t\t: [],\n\t\t\t\t\t),\n\t\t\t\t].map((application): ContentArtifact => ({\n\t\t\t\t\tpath: `tests/app/${application}/integration.test.ts`,\n\t\t\t\t\tgroup: 'tests',\n\t\t\t\t\townership: 'birth',\n\t\t\t\t\torigin: 'template',\n\t\t\t\t\tenvironment: 'browser',\n\t\t\t\t\tcontent: fillTemplate(ARTIFACT_TEMPLATES.tests.journey, {\n\t\t\t\t\t\tapplication,\n\t\t\t\t\t\theading: serializeTypeScriptString(blueprint.name),\n\t\t\t\t\t\timports:\n\t\t\t\t\t\t\tapplication === 'vue'\n\t\t\t\t\t\t\t\t? \"import { createApp } from 'vue'\\nimport App from '../../../app/vue/App.vue'\\n\"\n\t\t\t\t\t\t\t\t: '',\n\t\t\t\t\t\tmount:\n\t\t\t\t\t\t\tapplication === 'vue'\n\t\t\t\t\t\t\t\t? \"\\t\\tconst container = document.body.appendChild(document.createElement('main'))\\n\\t\\tconst app = createApp(App)\\n\"\n\t\t\t\t\t\t\t\t: '',\n\t\t\t\t\t\tarrival:\n\t\t\t\t\t\t\tapplication === 'vue'\n\t\t\t\t\t\t\t\t? '\\t\\t\\tapp.mount(container)\\n'\n\t\t\t\t\t\t\t\t: \"\\t\\t\\tawait import('../../../app/browser/main.js')\\n\",\n\t\t\t\t\t\tcleanup:\n\t\t\t\t\t\t\tapplication === 'vue'\n\t\t\t\t\t\t\t\t? '\\t\\t\\tapp.unmount()\\n\\t\\t\\tcontainer.remove()\\n'\n\t\t\t\t\t\t\t\t: \"\\t\\t\\tfor (const main of page.getByRole('main').elements()) main.remove()\\n\",\n\t\t\t\t\t}),\n\t\t\t\t}))\n\t\t\t: []\n\t// A hole in `src` or `app` reads as an `undefined` environment, as a `for…of` over it would.\n\tconst sources: readonly ContentArtifact[] = Iterator.from(blueprint.src)\n\t\t.map((environment): ContentArtifact => ({\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\t.toArray()\n\tconst binSpecifier = serializeTypeScriptString('../../../src/bin/main.js')\n\tconst joinedImport = `\\t\\tconst entry = await import(${binSpecifier})`\n\tconst bins: readonly ContentArtifact[] = blueprint.bin\n\t\t? [\n\t\t\t\t{\n\t\t\t\t\tpath: 'tests/src/bin/main.test.ts',\n\t\t\t\t\tgroup: 'tests',\n\t\t\t\t\townership: 'birth',\n\t\t\t\t\torigin: 'template',\n\t\t\t\t\tcontent: fillTemplate(ARTIFACT_TEMPLATES.tests.bin, {\n\t\t\t\t\t\timport: matchesPrintWidth(joinedImport)\n\t\t\t\t\t\t\t? joinedImport\n\t\t\t\t\t\t\t: `\\t\\tconst entry =\\n\\t\\t\\tawait import(${binSpecifier})`,\n\t\t\t\t\t}),\n\t\t\t\t},\n\t\t\t]\n\t\t: []\n\tconst applications: readonly ContentArtifact[] = Iterator.from(blueprint.app)\n\t\t.map((environment): ContentArtifact => ({\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\t.toArray()\n\t// The packed artifact is what this proof measures, and that subject is the same\n\t// in every publishing workspace: an installed tree, its exports map, and the\n\t// declarations beside it. So it is derived rather than named, and a workspace\n\t// that packs no published source has nothing for it to read. Ownership is\n\t// presence, which is what reports a target still lacking the proof as drift\n\t// while leaving a package that wrote a better one exactly as it is.\n\t//\n\t// The browser branch follows a published `src` browser face, because the browser\n\t// drive measures the packed artifact and only a published face is packed. A\n\t// workspace selecting `browser` on its `app` axis alone declares\n\t// `@vitest/browser-playwright` and `playwright` and gets `configs/browsers.ts`\n\t// emitted, and its proof still carries no branch: those imports are declared by\n\t// either axis, so they do not select the branch. `vite` selects nothing either,\n\t// though the branch imports it: `vite` sits in `BASE_DEV_DEPENDENCIES` and every\n\t// workspace declares it. Presence ownership never rewrites the file, so\n\t// a workspace publishing a browser face later keeps a proof with no branch for it.\n\t// The core-only variant therefore carries the guard that reddens on such an entry\n\t// rather than skipping it.\n\t// The `src` axis is asked for a browser face only when the proof is planned, and the integration\n\t// proof reads both axes only when it is planned, so each read stays where the condition puts it.\n\tconst distribution = ARTIFACT_TEMPLATES.tests.distribution\n\tconst distributions: readonly ContentArtifact[] =\n\t\tblueprint.src.length > 0 || blueprintToSheets(blueprint).length > 0 || blueprint.themes\n\t\t\t? [blueprint.src.includes('browser')].flatMap((browser): readonly ContentArtifact[] => [\n\t\t\t\t\t{\n\t\t\t\t\t\tpath: DISTRIBUTION_SETUP_PATH,\n\t\t\t\t\t\tgroup: 'tests',\n\t\t\t\t\t\townership: 'content',\n\t\t\t\t\t\torigin: 'template',\n\t\t\t\t\t\tcontent: fillTemplate(distribution.module, {\n\t\t\t\t\t\t\ttypes: browser ? distribution.types : '',\n\t\t\t\t\t\t\ttransport: browser ? distribution.transport : '',\n\t\t\t\t\t\t\tlauncher: browser ? distribution.launcher : '',\n\t\t\t\t\t\t\thelpers: browser ? distribution.helpers : '',\n\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tpath: DISTRIBUTION_TEST_PATH,\n\t\t\t\t\t\tgroup: 'tests',\n\t\t\t\t\t\townership: 'presence',\n\t\t\t\t\t\torigin: 'template',\n\t\t\t\t\t\tcontent: fillTemplate(distribution.proof, {\n\t\t\t\t\t\t\timport: browser ? distribution.import : '',\n\t\t\t\t\t\t\tdrive: browser ? distribution.drive : '',\n\t\t\t\t\t\t\tguard: browser ? '' : distribution.guard,\n\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t])\n\t\t\t: []\n\tconst integrations: readonly ContentArtifact[] = blueprint.integration\n\t\t? [\n\t\t\t\t[\n\t\t\t\t\t...Iterator.from(blueprint.src)\n\t\t\t\t\t\t.map((environment) => ({\n\t\t\t\t\t\t\tentry:\n\t\t\t\t\t\t\t\tenvironment === 'core'\n\t\t\t\t\t\t\t\t\t? 'srcCore'\n\t\t\t\t\t\t\t\t\t: environment === 'browser'\n\t\t\t\t\t\t\t\t\t\t? 'srcBrowser'\n\t\t\t\t\t\t\t\t\t\t: 'srcServer',\n\t\t\t\t\t\t\tspecifier: `@src/${environment}`,\n\t\t\t\t\t\t}))\n\t\t\t\t\t\t.toArray(),\n\t\t\t\t\t...Iterator.from(blueprint.app)\n\t\t\t\t\t\t.map((environment) => ({\n\t\t\t\t\t\t\tentry:\n\t\t\t\t\t\t\t\tenvironment === 'core'\n\t\t\t\t\t\t\t\t\t? 'appCore'\n\t\t\t\t\t\t\t\t\t: environment === 'browser'\n\t\t\t\t\t\t\t\t\t\t? 'appBrowser'\n\t\t\t\t\t\t\t\t\t\t: 'appServer',\n\t\t\t\t\t\t\tspecifier: `@app/${environment}`,\n\t\t\t\t\t\t}))\n\t\t\t\t\t\t.toArray(),\n\t\t\t\t],\n\t\t\t].map((modules): ContentArtifact => {\n\t\t\t\tconst entries = modules.map(({ entry }) => entry)\n\t\t\t\tconst imports = modules.map(\n\t\t\t\t\t({ entry, specifier }) => `import * as ${entry} from '${specifier}'`,\n\t\t\t\t)\n\t\t\t\tconst joined = `expect([${entries.map((entry) => `Object.keys(${entry})`).join(', ')}]).toStrictEqual(`\n\t\t\t\tconst actual = matchesPrintWidth(`\\t\\t${joined}[`)\n\t\t\t\t\t? joined\n\t\t\t\t\t: `expect([\\n${entries.map((entry) => `\\t\\t\\tObject.keys(${entry}),`).join('\\n')}\\n\\t\\t]).toStrictEqual(`\n\t\t\t\tconst expectedInline = `[${entries.map(() => '[]').join(', ')}]`\n\t\t\t\tconst expected =\n\t\t\t\t\tactual !== joined || matchesPrintWidth(`\\t\\t${joined}${expectedInline})`)\n\t\t\t\t\t\t? expectedInline\n\t\t\t\t\t\t: `[\\n${entries.map(() => '\\t\\t\\t[],').join('\\n')}\\n\\t\\t]`\n\t\t\t\treturn {\n\t\t\t\t\tpath: INTEGRATION_TEST_PATH,\n\t\t\t\t\tgroup: 'tests',\n\t\t\t\t\townership: 'birth',\n\t\t\t\t\torigin: 'template',\n\t\t\t\t\tcontent: fillTemplate(ARTIFACT_TEMPLATES.tests.integration, {\n\t\t\t\t\t\timports: `${imports.join('\\n')}\\n`,\n\t\t\t\t\t\tactual,\n\t\t\t\t\t\texpected,\n\t\t\t\t\t}),\n\t\t\t\t}\n\t\t\t})\n\t\t: []\n\treturn [\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\t...faces,\n\t\t...styles.filter(({ content }) => content.length > 0),\n\t\t...sheetTests,\n\t\t...browsers,\n\t\t...servers,\n\t\t...services,\n\t\t...globals,\n\t\t...journeys,\n\t\t...sources,\n\t\t...bins,\n\t\t...applications,\n\t\t...distributions,\n\t\t...integrations,\n\t]\n}\n\n/**\n * Compiles 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 *\n * @example\n * ```ts\n * import { blueprintToGuideArtifacts, createBlueprint } from '@orkestrel/scaffold'\n *\n * const blueprint = createBlueprint('router', { src: ['core'] })\n *\n * blueprintToGuideArtifacts(blueprint)[0]?.path // 'guides/README.md'\n * ```\n */\nexport function blueprintToGuideArtifacts(blueprint: Blueprint): readonly ContentArtifact[] {\n\tconst guide = `guides/${blueprint.name}.md`\n\tconst rows = [\n\t\t...[\n\t\t\t...blueprint.src,\n\t\t\t...blueprintToFaces(blueprint)\n\t\t\t\t.filter((extension) => extension.axes.includes('src'))\n\t\t\t\t.map((extension) => extension.name),\n\t\t\t...blueprintToSheets(blueprint),\n\t\t\t...(blueprint.themes ? ['styles/themes'] : []),\n\t\t].map((environment) => ({\n\t\t\tdirectory: `src/${environment}`,\n\t\t\ttest: `tests/src/${environment}`,\n\t\t})),\n\t\t...(blueprint.bin ? [{ directory: 'src/bin', test: 'tests/src/bin' }] : []),\n\t\t...[\n\t\t\t...blueprint.app,\n\t\t\t...blueprintToFaces(blueprint)\n\t\t\t\t.filter((extension) => extension.axes.includes('app'))\n\t\t\t\t.map((extension) => extension.name),\n\t\t].map((environment) => ({\n\t\t\tdirectory: `app/${environment}`,\n\t\t\ttest: `tests/app/${environment}`,\n\t\t})),\n\t]\n\tconst source = rows.map(({ directory }) => ` - [\\`${directory}\\`](../${directory})`)\n\tconst tests = rows.map(({ test }) => ` - [\\`${test}\\`](../${test})`)\n\tconst directories = rows.map(\n\t\t({ directory, test }) =>\n\t\t\t`- [\\`${directory}\\`](../${directory})\\n - Guide: Not created. Create this file when the workspace has a public surface:\\n \\`${guide}\\`\\n - Tests: [\\`${test}\\`](../${test})`,\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:\n\t\t\t\t\ttests.join('\\n') +\n\t\t\t\t\t(blueprint.showcase && blueprint.app.includes('browser')\n\t\t\t\t\t\t? '\\n - Showcase:\\n' +\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t'browser',\n\t\t\t\t\t\t\t\t...blueprintToFaces(blueprint)\n\t\t\t\t\t\t\t\t\t.filter((extension) => extension.axes.includes('app'))\n\t\t\t\t\t\t\t\t\t.map((extension) => extension.name),\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t(application) =>\n\t\t\t\t\t\t\t\t\t\t` - [\\`showcase/${application}.html\\`](../showcase/${application}.html)`,\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.join('\\n')\n\t\t\t\t\t\t: ''),\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 * Compiles the generated workspace's root documentation.\n *\n * @param blueprint - The workspace specification.\n * @returns The birth-owned package front page and the content-owned `AGENTS.md`\n * pointer.\n *\n * @remarks\n * The front page is the workspace's own prose, so it is written once and left\n * alone from then on. The pointer is scaffold's, so it is content-owned and\n * restored whenever it drifts.\n *\n * The pointer is planned here rather than vendored because `stageHost` refuses two\n * vendored paths at one storage name, and `AGENTS.md` already stores the canon a\n * release ships. Planning it as this package's own content leaves the path with\n * one claimant. No `CLAUDE.md` is planned: a target holding one stops Claude Code\n * from reading `AGENTS.md`, so the path stays canon without a claimant, `audit`\n * reports a copy `foreign`, and `overwrite` deletes it.\n *\n * The pointer carries no varying span, so it is not filled: a workspace's name\n * never reaches the text, and the paths a reader follows are the same in every\n * target.\n *\n * @example\n * ```ts\n * import { blueprintToDocumentArtifacts, createBlueprint } from '@orkestrel/scaffold'\n *\n * const blueprint = createBlueprint('router', { src: ['core'] })\n *\n * blueprintToDocumentArtifacts(blueprint).map((artifact) => artifact.path) // ['README.md', 'AGENTS.md']\n * ```\n */\nexport function blueprintToDocumentArtifacts(blueprint: Blueprint): readonly ContentArtifact[] {\n\tconst publishes =\n\t\tblueprint.src.length > 0 || blueprintToSheets(blueprint).length > 0 || blueprint.themes\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\t{\n\t\t\tpath: 'AGENTS.md',\n\t\t\tgroup: 'docs',\n\t\t\townership: 'content',\n\t\t\torigin: 'template',\n\t\t\tcontent: ARTIFACT_TEMPLATES.docs.agents,\n\t\t},\n\t]\n}\n\n/**\n * Compiles 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 *\n * @example\n * ```ts\n * import { blueprintToOrchestrationArtifacts, createBlueprint } from '@orkestrel/scaffold'\n *\n * const plain = createBlueprint('router', { src: ['core'] })\n * const served = createBlueprint('router', { src: ['core'], vendors: ['ollama'] })\n *\n * blueprintToOrchestrationArtifacts(plain) // []\n * blueprintToOrchestrationArtifacts(served)[0]?.path // 'scripts/service.sh'\n * ```\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 * Compiles the vendored host artifacts a workspace plans.\n *\n * @param blueprint - The workspace specification.\n * @returns One artifact per selected vendored path in `HOST_PATHS` order, then\n * the seed guide mirrors and the catalog file.\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 * {@link CATALOG_AGENT_PATH} is appended rather than listed, and it is the canon\n * path this compiler claims. The catalog verb refuses a target that lacks the\n * file, so the plan has to carry it; repair restores its absence from the\n * staged bytes; and the `.claude/agents` directory in `CANON_PATHS` is what\n * stages those bytes, so listing the file in `HOST_PATHS` as well would claim one\n * storage name twice and refuse the stage. The rest of the canon a target reads\n * from the installed package, at the locations the `AGENTS.md` pointer\n * {@link blueprintToDocumentArtifacts} emits names.\n *\n * The {@link SEED_GUIDE_PATHS} mirrors are claimed explicitly\n * from `REFERENCE_PATHS`. The target's own guide is excluded by\n * {@link selectHostPaths}; the remaining reference guides grant no target claim.\n *\n * The skill pointer set follows, for each name in {@link TARGET_SKILL_NAMES}:\n * the `.claude/skills/<name>/SKILL.md` bridge and the\n * `.agents/skills/<name>/agents/openai.yaml` sidecar as copies, then the\n * `.agents/skills/<name>/SKILL.md` pointer with `pointer` set, whose bytes\n * hydration derives from the canonical skill. A blueprint with `skills` set\n * ships its own skill canon, so it plans no pointer set.\n *\n * @example\n * ```ts\n * import { blueprintToHostArtifacts, createBlueprint } from '@orkestrel/scaffold'\n *\n * const blueprint = createBlueprint('router')\n *\n * blueprintToHostArtifacts(blueprint).some((artifact) => artifact.path === 'tests/guides.test.ts') // false\n * blueprintToHostArtifacts(blueprint).some((artifact) => artifact.path === 'guides/router.md') // false\n * blueprintToHostArtifacts(blueprint).find((artifact) => artifact.path === '.agents/skills/orkestrel-harden/SKILL.md')?.pointer // true\n * ```\n */\nexport function blueprintToHostArtifacts(blueprint: Blueprint): readonly Artifact[] {\n\tconst selected = selectHostPaths([...HOST_PATHS, ...SEED_GUIDE_PATHS], blueprint.name)\n\tconst vendored = [...selected, CATALOG_AGENT_PATH].map((path): Artifact => ({\n\t\tpath,\n\t\tgroup: inferGroup(path),\n\t\townership: 'presence',\n\t\torigin: 'host',\n\t}))\n\tif (blueprint.skills) return vendored\n\tconst skills = TARGET_SKILL_NAMES.flatMap((name): readonly Artifact[] => {\n\t\tconst bridge = `.claude/skills/${name}/SKILL.md`\n\t\tconst sidecar = `.agents/skills/${name}/agents/openai.yaml`\n\t\tconst pointer = `.agents/skills/${name}/SKILL.md`\n\t\treturn [\n\t\t\t{ path: bridge, group: inferGroup(bridge), ownership: 'presence', origin: 'host' },\n\t\t\t{ path: sidecar, group: inferGroup(sidecar), ownership: 'presence', origin: 'host' },\n\t\t\t{\n\t\t\t\tpath: pointer,\n\t\t\t\tgroup: inferGroup(pointer),\n\t\t\t\townership: 'presence',\n\t\t\t\torigin: 'host',\n\t\t\t\tpointer: true,\n\t\t\t},\n\t\t]\n\t})\n\treturn [...vendored, ...skills]\n}\n\n/**\n * Replaces 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 * Replaces the runtime and development dependency ranges in package manifest text, and never a\n * peer range.\n *\n * @param manifest - The manifest text to compile.\n * @param pins - The runtime and development names and replacement ranges.\n * @returns The manifest with every matching writable value replaced, or\n * `undefined` when a name has no quoted declaration in its named section.\n *\n * @remarks\n * The compiler replaces values in place instead of serializing the manifest,\n * so description, keywords, scripts, key order, indentation, and every byte\n * outside the named ranges survive. Runtime pins apply only to `dependencies`,\n * and development pins apply only to `devDependencies`. The compiler never\n * reads or writes `peerDependencies` or `peerDependenciesMeta`. An override or\n * resolution with the same name stays untouched.\n *\n * @example\n * ```ts\n * import { replaceManifestRanges } from '@orkestrel/scaffold'\n *\n * const manifest = '{\"devDependencies\":{\"typescript\":\"^6\"}}\\n'\n * replaceManifestRanges(manifest, {\n * runtime: [],\n * development: [{ name: 'typescript', range: '^7' }],\n * })\n * // the manifest with the declared range replaced\n * ```\n */\nexport function replaceManifestRanges(\n\tmanifest: string,\n\tpins: DependencyPinSet,\n): string | undefined {\n\tif (pins.runtime.length === 0 && pins.development.length === 0) return manifest\n\tconst tokens = scanManifestTokens(manifest)\n\tif (tokens === undefined) return undefined\n\tconst sectionNames = new Set(['dependencies', 'devDependencies'])\n\t// A section is the object a top-level `dependencies` or `devDependencies` key holds.\n\tconst sections = tokens.flatMap((token, at) => {\n\t\tif (token.depth !== 1 || token.value === undefined) return []\n\t\tif (manifest.charAt(token.value) !== '{') return []\n\t\tconst key: unknown = parseJSON(token.text)\n\t\tif (!isString(key) || !sectionNames.has(key)) return []\n\t\tconst close = tokens.slice(at + 1).find((next) => next.text === '}' && next.depth === 1)\n\t\treturn close === undefined ? [] : [{ name: key, start: token.value, end: close.index + 1 }]\n\t})\n\t// Each section reads its own entries in text order. The guard on the log's last edit skips the\n\t// literal the previous edit replaced, which only text that is not JSON can present as a key. A\n\t// value with no literal after it refuses the whole write.\n\tconst readings = sections.map((bounds) => {\n\t\tconst replacements = new Map(\n\t\t\t(bounds.name === 'dependencies' ? pins.runtime : pins.development).map(({ name, range }) => [\n\t\t\t\tname,\n\t\t\t\trange,\n\t\t\t]),\n\t\t)\n\t\treturn {\n\t\t\tname: bounds.name,\n\t\t\tlog: tokens.reduce<\n\t\t\t\tReadonlyArray<{ readonly name: string; readonly edit: ManifestEdit }> | undefined\n\t\t\t>((log, token, at) => {\n\t\t\t\tif (log === undefined) return undefined\n\t\t\t\tif (token.index < bounds.start || token.index >= bounds.end) return log\n\t\t\t\tif (log.at(-1)?.edit.start === token.index) return log\n\t\t\t\tif (token.depth !== 2 || token.value === undefined) return log\n\t\t\t\tconst key: unknown = parseJSON(token.text)\n\t\t\t\tif (!isString(key) || manifest.charAt(token.value) !== '\"') return log\n\t\t\t\tconst replacement = replacements.get(key)\n\t\t\t\tif (replacement === undefined) return log\n\t\t\t\tconst literal = tokens[at + 1]\n\t\t\t\tif (literal === undefined) return undefined\n\t\t\t\treturn [\n\t\t\t\t\t...log,\n\t\t\t\t\t{\n\t\t\t\t\t\tname: key,\n\t\t\t\t\t\tedit: {\n\t\t\t\t\t\t\tstart: literal.index,\n\t\t\t\t\t\t\tend: literal.index + literal.text.length,\n\t\t\t\t\t\t\ttext: JSON.stringify(replacement),\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})\n\tconst settled = readings.flatMap(({ name, log }) => (log === undefined ? [] : [{ name, log }]))\n\tif (settled.length < readings.length) return undefined\n\tconst compiled = settled\n\t\t.flatMap(({ log }) => log.map(({ edit }) => edit))\n\t\t.sort((left, right) => right.start - left.start)\n\t\t.reduce((text, edit) => text.slice(0, edit.start) + edit.text + text.slice(edit.end), manifest)\n\tconst declaredRuntime = pins.runtime.every(({ name }) =>\n\t\tsettled.some(\n\t\t\t(section) =>\n\t\t\t\tsection.name === 'dependencies' && section.log.some((entry) => entry.name === name),\n\t\t),\n\t)\n\tconst declaredDevelopment = pins.development.every(({ name }) =>\n\t\tsettled.some(\n\t\t\t(section) =>\n\t\t\t\tsection.name === 'devDependencies' && section.log.some((entry) => entry.name === name),\n\t\t),\n\t)\n\treturn declaredRuntime && declaredDevelopment ? compiled : undefined\n}\n\n/**\n * Inserts dependencies a package manifest does not declare into the section each one names.\n *\n * @param manifest - The manifest text to compile.\n * @param additions - The runtime and development names and ranges to declare.\n * @returns The manifest declaring every addition, or `undefined` when the text is not a\n * manifest, an addition's section is not an object or holds a value that is not a range, a name\n * is repeated, or `dependencies` or `devDependencies` already declares a name.\n *\n * @remarks\n * Runtime additions enter `dependencies` and development additions enter `devDependencies`. The\n * compiler inserts text instead of serializing the manifest, so every declared byte survives.\n * Each addition lands before the first declared key that sorts after it, or after the last\n * declared key when none does, so a section kept in key order stays in key order. An addition\n * copies the indentation of the section's first entry; an empty section takes its entries one\n * level inside the indentation of its opening line. An absent section is created as one\n * top-level key holding its additions: `devDependencies` after `dependencies`, `dependencies`\n * before `devDependencies`, and either one last in the manifest object when its sibling is\n * absent. The created key copies the indentation of the manifest's first key, and its entries sit\n * one level further in. A name either writable section already declares is the caller's mistake\n * rather than an addition, so the compiler refuses it instead of declaring a package twice.\n *\n * @example\n * ```ts\n * import { insertManifestDependencies } from '@orkestrel/scaffold'\n *\n * insertManifestDependencies('{\\n\\t\"devDependencies\": {\\n\\t\\t\"vite\": \"^8.3.2\"\\n\\t}\\n}\\n', {\n * runtime: [],\n * development: [{ name: 'typescript', range: '^6.0.3' }],\n * })\n * // '{\\n\\t\"devDependencies\": {\\n\\t\\t\"typescript\": \"^6.0.3\",\\n\\t\\t\"vite\": \"^8.3.2\"\\n\\t}\\n}\\n'\n * ```\n */\nexport function insertManifestDependencies(\n\tmanifest: string,\n\tadditions: DependencyPinSet,\n): string | undefined {\n\tconst requested = [...additions.runtime, ...additions.development]\n\tif (requested.length === 0) return manifest\n\tconst parsed = parseJSON(manifest)\n\tif (!isRecord(parsed)) return undefined\n\tconst declared = new Set(\n\t\t['dependencies', 'devDependencies'].flatMap((section) => {\n\t\t\tconst entries = parsed[section]\n\t\t\treturn isRecord(entries) ? Object.keys(entries) : []\n\t\t}),\n\t)\n\tconst names = new Set(requested.map(({ name }) => name))\n\tif (names.size !== requested.length || [...names].some((name) => declared.has(name))) {\n\t\treturn undefined\n\t}\n\tconst sections: ReadonlyArray<{\n\t\treadonly name: 'dependencies' | 'devDependencies'\n\t\treadonly dependencies: readonly Dependency[]\n\t}> = [\n\t\t{ name: 'dependencies', dependencies: additions.runtime },\n\t\t{ name: 'devDependencies', dependencies: additions.development },\n\t]\n\tconst refused = sections.some(({ name, dependencies }) => {\n\t\tconst entries = parsed[name]\n\t\treturn (\n\t\t\tdependencies.length > 0 &&\n\t\t\tentries !== undefined &&\n\t\t\t(!isRecord(entries) || !Object.values(entries).every(isString))\n\t\t)\n\t})\n\tif (refused) return undefined\n\treturn sections.reduce<string | undefined>(\n\t\t(compiled, section) =>\n\t\t\tcompiled === undefined || section.dependencies.length === 0\n\t\t\t\t? compiled\n\t\t\t\t: insertManifestSection(\n\t\t\t\t\t\tcompiled,\n\t\t\t\t\t\tsection.name,\n\t\t\t\t\t\tsection.dependencies,\n\t\t\t\t\t\tparsed[section.name] !== undefined,\n\t\t\t\t\t),\n\t\tmanifest,\n\t)\n}\n\n/**\n * Inserts dependencies into one section of package manifest text.\n *\n * @param manifest - The manifest text to compile, already known to be a JSON object.\n * @param section - The section the additions enter: `dependencies` or `devDependencies`.\n * @param dependencies - The names and ranges to declare; the section declares none of them.\n * @param present - If `true`, the manifest declares the section as an object; if `false`, it declares none.\n * @returns The manifest declaring every addition in the section, or `undefined` when the section\n * cannot be located as an object the text declares.\n *\n * @remarks\n * The one step {@link insertManifestDependencies} repeats per section. Each addition lands before\n * the first declared key that sorts after it, or after the last declared key when none does, and\n * copies the indentation of the section's first entry. An empty section takes its entries one\n * level inside the indentation of its opening line, and an absent section is created as one\n * top-level key beside its sibling, or last in the manifest object when the sibling is absent too.\n *\n * @example\n * ```ts\n * import { insertManifestSection } from '@orkestrel/scaffold'\n *\n * insertManifestSection('{\"dependencies\":{}}', 'dependencies', [{ name: 'vite', range: '^8' }], true)\n * // '{\"dependencies\":{\"vite\": \"^8\"}}'\n * ```\n */\nexport function insertManifestSection(\n\tmanifest: string,\n\tsection: 'dependencies' | 'devDependencies',\n\tdependencies: readonly Dependency[],\n\tpresent: boolean,\n): string | undefined {\n\tconst tokens = scanManifestTokens(manifest)\n\tif (tokens === undefined) return undefined\n\tconst ordered = [...dependencies].sort((left, right) => compareValues(left.name, right.name))\n\tconst lines = ordered.map(\n\t\t({ name, range }) => `${JSON.stringify(name)}: ${JSON.stringify(range)}`,\n\t)\n\t// Locate the braces of the section and of its sibling, the first top-level key,\n\t// and the manifest object's closing brace. Depth counts objects alone, exactly\n\t// as the range writer counts them, so a key nested inside another value never\n\t// reads as a top-level one.\n\tconst sibling = section === 'dependencies' ? 'devDependencies' : 'dependencies'\n\tconst occurrences = tokens.flatMap((token, at) => {\n\t\tif (token.depth !== 1 || token.value === undefined) return []\n\t\tconst key: unknown = parseJSON(token.text)\n\t\tif (!isString(key) || (key !== section && key !== sibling)) return []\n\t\tconst object = manifest.charAt(token.value) === '{'\n\t\tconst close = object\n\t\t\t? tokens.slice(at + 1).find((next) => next.text === '}' && next.depth === 1)\n\t\t\t: undefined\n\t\treturn [{ key, start: token.index, open: token.value, object, close: close?.index }]\n\t})\n\t// The first occurrence of `section` that is not an unclosed object decides it: a value that is\n\t// no object refuses the write, and a closed object locates it. The sibling is located by its\n\t// first closed object, and any other value of it is passed over.\n\tconst decisive = occurrences.find(\n\t\t({ key, object, close }) => key === section && (!object || close !== undefined),\n\t)\n\tif (decisive !== undefined && !decisive.object) return undefined\n\tconst closed = occurrences.flatMap(({ key, start, open, close }) =>\n\t\tclose === undefined ? [] : [{ key, start, open, close }],\n\t)\n\tconst bounds = closed.find(({ key }) => key === section)\n\tconst neighbor = closed.find(({ key }) => key === sibling)\n\tconst head = tokens.find((token) => token.depth === 1 && token.value !== undefined)?.index\n\tconst root = tokens.find((token) => token.text === '}' && token.depth === 0)?.index\n\tif (bounds === undefined) {\n\t\tif (present || root === undefined) return undefined\n\t\t// An absent section becomes one top-level key: `devDependencies` after\n\t\t// `dependencies` and `dependencies` before `devDependencies`, otherwise last.\n\t\t// It copies the indentation of the manifest's first key, and lands on the\n\t\t// same line when that key shares a line with the opening brace.\n\t\tconst breaking = head === undefined ? -1 : manifest.lastIndexOf('\\n', head)\n\t\tconst margin = breaking < 0 ? '' : manifest.slice(breaking + 1, head)\n\t\tconst gap = breaking < 0 || /\\S/u.test(margin) ? '' : `\\n${margin}`\n\t\tconst block = `${JSON.stringify(section)}: {${lines.map((line) => `${gap === '' ? '' : `${gap}${margin}`}${line}`).join(',')}${gap}}`\n\t\tconst tail = manifest.slice(1, root).trimEnd().length\n\t\tconst [position, insertion] =\n\t\t\tneighbor === undefined\n\t\t\t\t? [tail + 1, manifest.charAt(tail) === '{' ? block : `,${gap}${block}`]\n\t\t\t\t: section === 'devDependencies'\n\t\t\t\t\t? [neighbor.close + 1, `,${gap}${block}`]\n\t\t\t\t\t: [neighbor.start, `${block},${gap}`]\n\t\treturn manifest.slice(0, position) + insertion + manifest.slice(position)\n\t}\n\tconst { open, close } = bounds\n\t// Every value is a string, so the section's strings alternate key and value and\n\t// each entry runs from its key's opening quote to its value's closing quote.\n\tconst literals = tokens.filter(\n\t\t(token) => token.index > open && token.index < close && token.text.startsWith('\"'),\n\t)\n\tconst keys = literals.filter((_, index) => index % 2 === 0)\n\tif (keys.some((literal) => !isString(parseJSON(literal.text)))) return undefined\n\tconst declarations = keys.flatMap((literal, position) => {\n\t\tconst name: unknown = parseJSON(literal.text)\n\t\tconst value = literals[position * 2 + 1]\n\t\treturn isString(name) && value !== undefined\n\t\t\t? [{ name, start: literal.index, end: value.index + value.text.length }]\n\t\t\t: []\n\t})\n\tconst first = declarations[0]\n\tconst last = declarations.at(-1)\n\tif (first === undefined || last === undefined) {\n\t\tconst opening = manifest.lastIndexOf('\\n', open)\n\t\tconst level = opening < 0 ? '' : (/^\\s*/u.exec(manifest.slice(opening + 1, open))?.[0] ?? '')\n\t\tconst separator = opening < 0 ? '' : `\\n${level}${level}`\n\t\tconst ending = opening < 0 ? '' : `\\n${level}`\n\t\treturn `${manifest.slice(0, open + 1)}${lines.map((line) => `${separator}${line}`).join(',')}${ending}${manifest.slice(close)}`\n\t}\n\tconst newline = manifest.lastIndexOf('\\n', first.start)\n\tconst indent = newline < 0 ? '' : manifest.slice(newline + 1, first.start)\n\tconst separator = newline < 0 || /\\S/u.test(indent) ? '' : `\\n${indent}`\n\tconst placements = ordered.map((dependency, index) => {\n\t\tconst line = lines[index] ?? ''\n\t\tconst anchor = declarations.find(\n\t\t\t(declaration) => compareValues(declaration.name, dependency.name) > 0,\n\t\t)\n\t\treturn {\n\t\t\tposition: anchor?.start ?? last.end,\n\t\t\ttext: anchor === undefined ? `,${separator}${line}` : `${line},${separator}`,\n\t\t}\n\t})\n\treturn [...Map.groupBy(placements, ({ position }) => position)]\n\t\t.map(([position, group]): [number, string] => [\n\t\t\tposition,\n\t\t\tgroup.map(({ text }) => text).join(''),\n\t\t])\n\t\t.sort(([left], [right]) => right - left)\n\t\t.reduce(\n\t\t\t(text, [position, insertion]) => text.slice(0, position) + insertion + text.slice(position),\n\t\t\tmanifest,\n\t\t)\n}\n\n/**\n * Replaces named script values in package manifest text.\n *\n * @param manifest - The manifest text to compile.\n * @param scripts - The scripts to write, each with the predecessors it accepts.\n * @returns The manifest carrying every absent or accepted named script and\n * retaining every differing string value, or `undefined` when a planned key\n * holds a non-string value or the text carries no readable `scripts` object to\n * write into.\n *\n * @remarks\n * The compiler replaces values in place instead of serializing the manifest, so\n * description, keywords, dependencies, key order, indentation, and every byte\n * outside the replaced ranges survive. A named script the manifest already\n * declares is overwritten only when its value is one of its\n * {@link ManifestScript.accepted} predecessors. The planned value stands. Any\n * other string is a chain the workspace author customized, so it stays\n * byte-identical while the other named scripts are written independently. A\n * named script the manifest does not declare is appended after the last\n * declared script of its own key family, copying that section's indentation:\n * `test:setup` follows the last declared `test:` key. A name carrying no colon\n * has no family, and so does a family the section declares no member of, and\n * each of those is appended after the last declared script instead. A region\n * declaring nothing takes every named script as its first entries, indented\n * from the line its own opening brace sits on.\n *\n * @example\n * ```ts\n * import { replaceManifestScripts } from '@orkestrel/scaffold'\n *\n * const manifest = '{\\n\\t\"scripts\": {\\n\\t\\t\"test\": \"vitest run\"\\n\\t}\\n}\\n'\n * replaceManifestScripts(manifest, [\n * { name: 'test', command: 'vitest run --no-cache', accepted: ['vitest run'] },\n * ])\n * // the manifest with the declared script replaced\n * ```\n */\nexport function replaceManifestScripts(\n\tmanifest: string,\n\tscripts: readonly ManifestScript[],\n): string | undefined {\n\tif (scripts.length === 0) return manifest\n\tconst parsed: unknown = parseJSON(manifest)\n\tif (!isRecord(parsed) || !isRecord(parsed.scripts)) return undefined\n\tconst declared = parsed.scripts\n\t// A non-string planned key makes the region structurally unsafe to edit, so\n\t// rule on that shape before locating any byte range. The iterator reads one script at a time,\n\t// stops at the first that refuses, and reads a hole as an `undefined` script, as a `for…of`\n\t// over the list would. It takes the list through its iterator protocol alone.\n\tif (\n\t\tIterator.from(scripts).some(\n\t\t\t(script) => Object.hasOwn(declared, script.name) && !isString(declared[script.name]),\n\t\t)\n\t) {\n\t\treturn undefined\n\t}\n\tconst tokens = scanManifestTokens(manifest)\n\tif (tokens === undefined) return undefined\n\t// Locate the top-level scripts object. Depth counts objects alone, exactly as\n\t// the range writer counts them, so a key nested inside another object never\n\t// reads as a top-level one.\n\tconst position = tokens.findIndex(\n\t\t(token, at) =>\n\t\t\ttoken.depth === 1 &&\n\t\t\ttoken.value !== undefined &&\n\t\t\tparseJSON(token.text) === 'scripts' &&\n\t\t\tmanifest.charAt(token.value) === '{' &&\n\t\t\ttokens.slice(at + 1).some((next) => next.text === '}' && next.depth === 1),\n\t)\n\tconst region = tokens[position]\n\tconst close = tokens.slice(position + 1).find((token) => token.text === '}' && token.depth === 1)\n\tif (region?.value === undefined || close === undefined) return undefined\n\tconst start = region.value\n\tconst end = close.index + 1\n\t// Read the section's own entries for their byte ranges, and remember where the\n\t// first key sits: that column is the indentation an appended script copies.\n\t// Each string-valued entry also records where it ends, because that offset is\n\t// the anchor an appended sibling of the same key family inserts after. A string\n\t// value with no literal after it refuses the write.\n\tconst entries = tokens.reduce<\n\t\t| ReadonlyArray<{\n\t\t\t\treadonly token: ManifestToken\n\t\t\t\treadonly value: number\n\t\t\t\treadonly literal: ManifestToken | undefined\n\t\t }>\n\t\t| undefined\n\t>((log, token, at) => {\n\t\tif (log === undefined) return undefined\n\t\tif (token.index < start || token.index >= end) return log\n\t\tif (token.depth !== 2 || token.value === undefined) return log\n\t\tif (manifest.charAt(token.value) !== '\"') {\n\t\t\treturn [...log, { token, value: token.value, literal: undefined }]\n\t\t}\n\t\tconst literal = tokens[at + 1]\n\t\treturn literal === undefined ? undefined : [...log, { token, value: token.value, literal }]\n\t}, [])\n\tif (entries === undefined) return undefined\n\tconst first = entries[0]?.token.index\n\tconst keyed = entries.flatMap(({ token, value, literal }) =>\n\t\tliteral === undefined\n\t\t\t? []\n\t\t\t: [{ key: parseJSON(token.text), value, stop: literal.index + literal.text.length }],\n\t)\n\tconst anchors = keyed.flatMap(({ key, stop }) =>\n\t\tisString(key) ? [{ name: key, end: stop }] : [],\n\t)\n\tconst matched = keyed.flatMap((entry) => {\n\t\tconst script = scripts.find((candidate) => candidate.name === entry.key)\n\t\treturn script === undefined ? [] : [{ script, value: entry.value, stop: entry.stop }]\n\t})\n\tconst written = new Set(matched.map(({ script }) => script.name))\n\tconst replaced = matched.flatMap(({ script, value, stop }): readonly ManifestEdit[] => {\n\t\tconst current: unknown = declared[script.name]\n\t\treturn current === script.command || !isString(current) || !script.accepted.includes(current)\n\t\t\t? []\n\t\t\t: [{ start: value, end: stop, text: JSON.stringify(script.command) }]\n\t})\n\tconst missing = scripts.filter((script) => !written.has(script.name))\n\t// An empty region declares every named script absent, and an absent script is\n\t// always writable, so the region takes them as its first entries rather than\n\t// refusing the write. No sibling entry exists to copy a column from, so the\n\t// indentation comes from the region's own opening line: `scripts` is a\n\t// top-level key, so that line's leading whitespace is one level and an entry\n\t// inside the region sits at two. A manifest carrying no line break before the\n\t// region is written on one line, which is what the append path does with a\n\t// one-line region it finds already populated.\n\tconst opening = manifest.lastIndexOf('\\n', start)\n\tconst level = opening < 0 ? '' : (/^\\s*/u.exec(manifest.slice(opening + 1, start))?.[0] ?? '')\n\tconst emptySeparator = opening < 0 ? '' : `\\n${level}${level}`\n\tconst emptyClosing = opening < 0 ? '' : `\\n${level}`\n\t// A qualified name joins the family its prefix names, landing after that\n\t// family's last declared member so a reader finds it among its siblings\n\t// rather than behind the lifecycle scripts that close the section. An\n\t// unqualified name has no family, and a family the section never declares\n\t// has no member to follow, so each takes the section's own end.\n\tconst tail = start + manifest.slice(start, end - 1).trimEnd().length\n\tconst newline = first === undefined ? -1 : manifest.lastIndexOf('\\n', first)\n\tconst indent = first === undefined || newline < 0 ? '' : manifest.slice(newline + 1, first)\n\tconst separator = newline < 0 || /\\S/u.test(indent) ? '' : `\\n${indent}`\n\tconst placements = missing.map((script) => {\n\t\tconst colon = script.name.indexOf(':')\n\t\tconst family = colon < 0 ? undefined : script.name.slice(0, colon + 1)\n\t\tconst sibling =\n\t\t\tfamily === undefined ? undefined : anchors.findLast((entry) => entry.name.startsWith(family))\n\t\treturn {\n\t\t\tanchor: sibling?.end ?? tail,\n\t\t\ttext: `,${separator}${JSON.stringify(script.name)}: ${JSON.stringify(script.command)}`,\n\t\t}\n\t})\n\tconst appended: readonly ManifestEdit[] =\n\t\tmissing.length === 0\n\t\t\t? []\n\t\t\t: first === undefined\n\t\t\t\t? [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tstart: start + 1,\n\t\t\t\t\t\t\tend: end - 1,\n\t\t\t\t\t\t\ttext: `${missing\n\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t(script) =>\n\t\t\t\t\t\t\t\t\t\t`${emptySeparator}${JSON.stringify(script.name)}: ${JSON.stringify(script.command)}`,\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.join(',')}${emptyClosing}`,\n\t\t\t\t\t\t},\n\t\t\t\t\t]\n\t\t\t\t: [...Map.groupBy(placements, ({ anchor }) => anchor)].map(\n\t\t\t\t\t\t([anchor, group]): ManifestEdit => ({\n\t\t\t\t\t\t\tstart: anchor,\n\t\t\t\t\t\t\tend: anchor,\n\t\t\t\t\t\t\ttext: group.map(({ text }) => text).join(''),\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\treturn [...replaced, ...appended]\n\t\t.sort((left, right) => right.start - left.start)\n\t\t.reduce((text, edit) => text.slice(0, edit.start) + edit.text + text.slice(edit.end), manifest)\n}\n\n/**\n * Replaces dependency ranges in a plan's manifest and recomputes its identity.\n *\n * @param plan - The plan carrying the manifest artifact to compile.\n * @param pins - The runtime and development names and replacement ranges.\n * @returns A plan with replaced manifest ranges and a matching hash, or\n * `undefined` when the manifest or its identity cannot be compiled.\n *\n * @remarks\n * The blueprint remains the workspace specification that produced the plan.\n * Registry answers alter only the manifest artifact that materialization will\n * write. Recomputing the hash in the same compiler keeps the plan's identity\n * tied to those final bytes rather than to the unresolved floor.\n *\n * @example\n * ```ts\n * import { replacePlanRanges } from '@orkestrel/scaffold'\n *\n * replacePlanRanges(plan, pins) // the plan carrying the resolved writable ranges\n * ```\n */\nexport function replacePlanRanges(plan: Plan, pins: DependencyPinSet): Plan | undefined {\n\tconst outcomes = plan.artifacts.map(\n\t\t(\n\t\t\tartifact,\n\t\t): { readonly artifact: Artifact; readonly manifest: boolean; readonly refused: boolean } => {\n\t\t\tif (artifact.path !== 'package.json' || artifact.origin === 'host') {\n\t\t\t\treturn { artifact, manifest: false, refused: false }\n\t\t\t}\n\t\t\tconst content = replaceManifestRanges(artifact.content, pins)\n\t\t\treturn content === undefined\n\t\t\t\t? { artifact, manifest: true, refused: true }\n\t\t\t\t: { artifact: { ...artifact, content }, manifest: true, refused: false }\n\t\t},\n\t)\n\tif (\n\t\t!outcomes.some((outcome) => outcome.manifest) ||\n\t\toutcomes.some((outcome) => outcome.refused)\n\t) {\n\t\treturn undefined\n\t}\n\tconst artifacts = outcomes.map((outcome) => outcome.artifact)\n\tconst compiled: Plan = { ...plan, artifacts }\n\tconst hash = planToHash(compiled)\n\treturn hash === undefined ? undefined : { ...compiled, hash }\n}\n\n/**\n * Computes 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 { Compiler, createBlueprint, planToHash } from '@orkestrel/scaffold'\n *\n * const { plan } = new Compiler().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 * Compares 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 { Compiler, createBlueprint, planToFindings } from '@orkestrel/scaffold'\n *\n * const { plan } = new Compiler().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\t// The iterator consumes one artifact at a time and reads a hole as an `undefined` artifact, as a\n\t// `for…of` over the list would. The path is read for the plan before the finding reads it.\n\tconst listed = Iterator.from(plan.artifacts)\n\t\t.map((artifact) => ({\n\t\t\tpath: artifact.path,\n\t\t\tfinding: artifactToFinding(artifact, current[artifact.path]),\n\t\t}))\n\t\t.toArray()\n\tconst planned = new Set(listed.map(({ path }) => path))\n\treturn [\n\t\t...listed.map(({ finding }) => finding),\n\t\t...Object.entries(current).flatMap(([path, observed]): readonly Finding[] => {\n\t\t\tif (planned.has(path)) return []\n\t\t\tconst group = inferGroup(path)\n\t\t\treturn plan.groups.includes(group) ? [{ path, group, drift: 'foreign', observed }] : []\n\t\t}),\n\t]\n}\n\n/**\n * Measures 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 declared lists and peer partitions differ only in the syntaxes they\n * accept, so the rules live here once and each caller supplies its own patterns.\n * A runtime dependency name reaches a path through its guide mirror and is\n * fixed to the `@orkestrel` scope. A foreign peer or development extra reaches\n * no path and admits any 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\t// The iterator consumes one entry at a time and reads a hole as an `undefined` entry, which the\n\t// name read refuses before a later entry is read.\n\tconst listed = Iterator.from(dependencies)\n\t\t.map((dependency) => {\n\t\t\tconst declared = dependency.name\n\t\t\tconst valid = name.test(declared)\n\t\t\tconst pinned = dependency.range\n\t\t\treturn { declared, valid, pinned, accepted: range.test(pinned) }\n\t\t})\n\t\t.toArray()\n\treturn listed.flatMap(({ declared, valid, pinned, accepted }, index): readonly Question[] => [\n\t\t...(!valid\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield,\n\t\t\t\t\t\tmessage: `${declared} is not a package name ${field} accepts.`,\n\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: listed.findIndex((other) => other.declared === declared) < index\n\t\t\t\t? [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfield,\n\t\t\t\t\t\t\tmessage: `${declared} is declared more than once on ${field}.`,\n\t\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t]\n\t\t\t\t: []),\n\t\t...(!accepted\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield,\n\t\t\t\t\t\tmessage: `${declared} declares the range ${pinned}, which ${field} does not accept.`,\n\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: []),\n\t])\n}\n\n/**\n * Measures 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 environment axes admit,\n * and the overlaps between the 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 * These do not, because each describes a workspace it can describe honestly but\n * will 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 * or journey flag whose required browser axis is absent, which emits nothing; an unplaced browser\n * extension or a styles extension without the styles surface; 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\t// Each list is read where the following sections reach it, one entry at a time and once per pass, and\n\t// The iterator reads a hole in a list as an `undefined` entry, as a `for…of` over it would.\n\tconst own = `@orkestrel/${blueprint.name}`\n\treturn [\n\t\t...(!NAME_PATTERN.test(blueprint.name)\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'name',\n\t\t\t\t\t\tmessage: `${blueprint.name} is not a lowercase alphanumeric name starting with a letter.`,\n\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: []),\n\t\t...(!VERSION_PATTERN.test(blueprint.version)\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'version',\n\t\t\t\t\t\tmessage: `${blueprint.version} is not an exact three-component version.`,\n\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: []),\n\t\t...(!matchesEngines(blueprint.engines)\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'engines',\n\t\t\t\t\t\tmessage: `${blueprint.engines} is not a supported minimum-Node floor.`,\n\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: []),\n\t\t...(blueprint.src.length === 0 &&\n\t\tblueprint.app.length === 0 &&\n\t\tblueprintToSheets(blueprint).length === 0 &&\n\t\t!blueprint.themes\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'src',\n\t\t\t\t\t\tmessage: 'A workspace declares at least one environment on src or app.',\n\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t\tcandidates: ENVIRONMENTS,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: []),\n\t\t...(blueprint.src.length > 1 && !blueprint.src.includes('core')\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'src',\n\t\t\t\t\t\tmessage:\n\t\t\t\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\t\t\t\tblocking: false,\n\t\t\t\t\t\tcandidates: ENVIRONMENTS,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: []),\n\t\t...ENVIRONMENTS.flatMap((environment) => [\n\t\t\t...(blueprint.src.filter((declared) => declared === environment).length > 1\n\t\t\t\t? [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfield: 'src',\n\t\t\t\t\t\t\tmessage: `src declares ${environment} more than once.`,\n\t\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t\t\tcandidates: ENVIRONMENTS,\n\t\t\t\t\t\t},\n\t\t\t\t\t]\n\t\t\t\t: []),\n\t\t\t...(blueprint.app.filter((declared) => declared === environment).length > 1\n\t\t\t\t? [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfield: 'app',\n\t\t\t\t\t\t\tmessage: `app declares ${environment} more than once.`,\n\t\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t\t\tcandidates: ENVIRONMENTS,\n\t\t\t\t\t\t},\n\t\t\t\t\t]\n\t\t\t\t: []),\n\t\t]),\n\t\t// An extension's own questions are read with the extension, and the repeat of an earlier\n\t\t// selection is judged after every extension has been read.\n\t\t...Iterator.from(blueprint.extensions)\n\t\t\t.map((extension) => {\n\t\t\t\tconst selection = `${extension.surface}:${extension.name}`\n\t\t\t\treturn {\n\t\t\t\t\tselection,\n\t\t\t\t\tquestions:\n\t\t\t\t\t\textension.surface === 'browser'\n\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\t...(extension.axes.length === 0\n\t\t\t\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\tfield: 'extensions',\n\t\t\t\t\t\t\t\t\t\t\t\t\tmessage: `${selection} occupies no axis.`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tblocking: false,\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t\t: []),\n\t\t\t\t\t\t\t\t\t...Iterator.from(extension.axes)\n\t\t\t\t\t\t\t\t\t\t.flatMap((axis) =>\n\t\t\t\t\t\t\t\t\t\t\tblueprint[axis].includes('browser')\n\t\t\t\t\t\t\t\t\t\t\t\t? []\n\t\t\t\t\t\t\t\t\t\t\t\t: [\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfield: 'extensions',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmessage: `${selection} occupies ${axis}, whose selection lacks browser.`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tblocking: false,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t.toArray(),\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t: !blueprint.styles\n\t\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tfield: 'extensions',\n\t\t\t\t\t\t\t\t\t\t\tmessage: `${selection} extends a styles surface this workspace does not declare.`,\n\t\t\t\t\t\t\t\t\t\t\tblocking: false,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t: [],\n\t\t\t\t}\n\t\t\t})\n\t\t\t.toArray()\n\t\t\t.flatMap(({ selection, questions }, index, selected): readonly Question[] => [\n\t\t\t\t...(selected.findIndex((other) => other.selection === selection) < index\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfield: 'extensions',\n\t\t\t\t\t\t\t\tmessage: `${selection} is declared more than once on extensions.`,\n\t\t\t\t\t\t\t\tblocking: true,\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...questions,\n\t\t\t]),\n\t\t...(blueprint.integration && blueprint.src.length + blueprint.app.length < 2\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'integration',\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t'integration drives features across environments, and this workspace declares fewer than two, so its seed composes nothing.',\n\t\t\t\t\t\tblocking: false,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: []),\n\t\t...Iterator.from(blueprint.vendors)\n\t\t\t.map((vendor) => ({\n\t\t\t\tvendor,\n\t\t\t\tvalid: NAME_PATTERN.test(vendor),\n\t\t\t}))\n\t\t\t.toArray()\n\t\t\t.flatMap(({ vendor, valid }, index, declared): readonly Question[] =>\n\t\t\t\t!valid\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfield: 'vendors',\n\t\t\t\t\t\t\t\tmessage: `${vendor} is not a lowercase alphanumeric vendor name starting with a letter.`,\n\t\t\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t]\n\t\t\t\t\t: declared.findIndex((other) => other.vendor === vendor) < index\n\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tfield: 'vendors',\n\t\t\t\t\t\t\t\t\tmessage: `${vendor} is declared more than once on vendors.`,\n\t\t\t\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t: [],\n\t\t\t),\n\t\t...(blueprint.showcase && !blueprint.app.includes('browser')\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'showcase',\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t'showcase projects a browser app, and this workspace declares none, so it emits nothing.',\n\t\t\t\t\t\tblocking: false,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: []),\n\t\t...(blueprint.journey && !blueprint.app.includes('browser')\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'journey',\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t'journey projects a browser app, and this workspace declares none, so it emits nothing.',\n\t\t\t\t\t\tblocking: false,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: []),\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.filter((peer) => peer.name.startsWith('@orkestrel/')),\n\t\t\t'peers',\n\t\t\tDEPENDENCY_NAME_PATTERN,\n\t\t\tORKESTREL_RANGE_PATTERN,\n\t\t),\n\t\t...dependenciesToQuestions(\n\t\t\tblueprint.peers.filter((peer) => !peer.name.startsWith('@orkestrel/')),\n\t\t\t'peers',\n\t\t\tFOREIGN_NAME_PATTERN,\n\t\t\tFLOOR_RANGE_PATTERN,\n\t\t),\n\t\t...dependenciesToQuestions(\n\t\t\tblueprint.extras,\n\t\t\t'extras',\n\t\t\tFOREIGN_NAME_PATTERN,\n\t\t\tEXTRA_RANGE_PATTERN,\n\t\t),\n\t\t// The three lists are read in field order, and the field that first declared a name is the\n\t\t// field of the first entry that carries it.\n\t\t...(\n\t\t\t[\n\t\t\t\t['dependencies', blueprint.dependencies],\n\t\t\t\t['peers', blueprint.peers],\n\t\t\t\t['extras', blueprint.extras],\n\t\t\t] as const\n\t\t)\n\t\t\t.flatMap(([field, list]) =>\n\t\t\t\tIterator.from(list)\n\t\t\t\t\t.map((dependency) => ({ field, name: dependency.name }))\n\t\t\t\t\t.toArray(),\n\t\t\t)\n\t\t\t.flatMap(({ field, name }, _, declared): readonly Question[] => {\n\t\t\t\tconst first = declared.find((other) => other.name === name)?.field\n\t\t\t\treturn [\n\t\t\t\t\t...(name === own || name === blueprint.name\n\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tfield,\n\t\t\t\t\t\t\t\t\tmessage: `${name} is the workspace itself.`,\n\t\t\t\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t: []),\n\t\t\t\t\t...(first !== undefined && first !== field\n\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tfield,\n\t\t\t\t\t\t\t\t\tmessage: `${name} is declared on both ${first} and ${field}.`,\n\t\t\t\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t: []),\n\t\t\t\t]\n\t\t\t}),\n\t\t...Iterator.from(blueprint.extras)\n\t\t\t.flatMap((extra) =>\n\t\t\t\tObject.hasOwn(BASE_DEV_DEPENDENCIES, extra.name)\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfield: 'extras',\n\t\t\t\t\t\t\t\tmessage: `${extra.name} is pinned by the shared toolchain, which every workspace carries at one version.`,\n\t\t\t\t\t\t\t\tblocking: true,\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)\n\t\t\t.toArray(),\n\t]\n}\n\n/**\n * Measures 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\t// The iterator consumes one artifact at a time and reads a hole as an `undefined` artifact, as a\n\t// `for…of` over the list would.\n\tconst listed = Iterator.from(artifacts)\n\t\t.map((artifact) => ({\n\t\t\tpath: artifact.path,\n\t\t\tbytes:\n\t\t\t\tartifact.origin === 'host'\n\t\t\t\t\t? artifact.hex === undefined\n\t\t\t\t\t\t? 0\n\t\t\t\t\t\t: artifact.hex.length / 2\n\t\t\t\t\t: computeBytes(artifact.content),\n\t\t}))\n\t\t.toArray()\n\tconst total = computeTotal(listed.map(({ bytes }) => bytes))\n\treturn [\n\t\t...listed.flatMap(({ path, bytes }, index): readonly Question[] => [\n\t\t\t...(listed.findIndex((other) => other.path === path) < index\n\t\t\t\t? [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfield: 'artifacts',\n\t\t\t\t\t\t\tmessage: `Two artifacts claim ${path}.`,\n\t\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t]\n\t\t\t\t: []),\n\t\t\t...(bytes > MAX_ARTIFACT_BYTES\n\t\t\t\t? [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfield: 'artifacts',\n\t\t\t\t\t\t\tmessage: `${path} carries ${bytes} bytes, above the ${MAX_ARTIFACT_BYTES} one artifact admits.`,\n\t\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t]\n\t\t\t\t: []),\n\t\t]),\n\t\t...(artifacts.length > MAX_COLLECTION_ITEMS\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'artifacts',\n\t\t\t\t\t\tmessage: `A plan of ${artifacts.length} artifacts is above the ${MAX_COLLECTION_ITEMS} one collection admits.`,\n\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: []),\n\t\t...(total > MAX_TOTAL_ARTIFACT_BYTES\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'artifacts',\n\t\t\t\t\t\tmessage: `A plan of ${total} bytes is above the ${MAX_TOTAL_ARTIFACT_BYTES} one plan retains.`,\n\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: []),\n\t]\n}\n\n/**\n * Measures 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\t// The first artifact planned at a path is the one an override addresses, so the pairs are\n\t// reversed for a `Map` to keep it. The iterators consume one artifact and then one override at a\n\t// time, and reads a hole as an `undefined` entry, as a `for…of` over the list would.\n\tconst planned = new Map(\n\t\tIterator.from(artifacts)\n\t\t\t.map((artifact): readonly [string, Artifact] => [artifact.path, artifact])\n\t\t\t.toArray()\n\t\t\t.reverse(),\n\t)\n\tconst listed = Iterator.from(overrides)\n\t\t.map((override) => override.path)\n\t\t.toArray()\n\treturn listed.flatMap((path, index): readonly Question[] => {\n\t\tconst artifact = planned.get(path)\n\t\treturn [\n\t\t\t...(listed.indexOf(path) < index\n\t\t\t\t? [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfield: 'overrides',\n\t\t\t\t\t\t\tmessage: `${path} is overridden more than once.`,\n\t\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t]\n\t\t\t\t: []),\n\t\t\t...(artifact === undefined\n\t\t\t\t? [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfield: 'overrides',\n\t\t\t\t\t\t\tmessage: `${path} is not a path this plan carries.`,\n\t\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t]\n\t\t\t\t: artifact.origin === 'host'\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfield: 'overrides',\n\t\t\t\t\t\t\t\tmessage: `${path} is byte-copied from the vendored data root.`,\n\t\t\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t]\n\t\t\t\t\t: artifact.group === 'manifest'\n\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tfield: 'overrides',\n\t\t\t\t\t\t\t\t\tmessage: `${path} is the manifest, which the blueprint's own fields decide.`,\n\t\t\t\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t: []),\n\t\t]\n\t})\n}\n","import type { Blueprint } from './types.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 * Constructs 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 every part: 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 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 restate that law\n * and let the answers disagree, so a blueprint the gate will\n * refuse is still constructible.\n *\n * @example Blueprint\n * ```ts\n * import { createBlueprint } from '@orkestrel/scaffold'\n *\n * const blueprint = createBlueprint('router', {\n * \tsrc: ['core', 'server'],\n * \tdependencies: [{ name: '@orkestrel/emitter', range: '^0.0.5' }],\n * \tbin: true,\n * })\n *\n * blueprint.version // '0.0.1'\n * blueprint.engines // '>=22.18.0'\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\textensions: input?.extensions ?? [],\n\t\tstyles: input?.styles ?? false,\n\t\tthemes: input?.themes ?? false,\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\tsetup: input?.setup ?? [],\n\t\tguides: input?.guides ?? false,\n\t\tintegration: input?.integration ?? false,\n\t\tconformance: input?.conformance ?? false,\n\t\ttree: input?.tree ?? false,\n\t\tservice: input?.service ?? false,\n\t\tvendors: input?.vendors ?? [],\n\t\tstudies: input?.studies ?? false,\n\t\tglobal: input?.global ?? false,\n\t\tshowcase: input?.showcase ?? false,\n\t\tjourney: input?.journey ?? false,\n\t\tskills: input?.skills ?? 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","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\tblueprintToHostArtifacts,\n\tblueprintToManifest,\n\tblueprintToOrchestrationArtifacts,\n\tblueprintToQuestions,\n\tblueprintToSourceArtifacts,\n\tblueprintToTestArtifacts,\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 * Represents 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 * The 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 { Compiler, createBlueprint } from '@orkestrel/scaffold'\n *\n * const compiler = new Compiler()\n * const scaffolding = compiler.compile(createBlueprint('router', { src: ['core'] }))\n *\n * scaffolding.plan?.artifacts // every planned file, in group order\n * scaffolding.stages // one CompileRecord per stage that ran\n * compiler.destroy()\n * ```\n */\nexport class Compiler implements CompilerInterface {\n\treadonly #emitter: Emitter<CompilerEventMap>\n\t#destroyed = false\n\n\t/**\n\t * Constructs 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/** Exposes the compiler's observation channel. */\n\tget emitter(): EmitterInterface<CompilerEventMap> {\n\t\treturn this.#emitter\n\t}\n\n\t/**\n\t * Compiles 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 decide whether to create\n\t * it, and the questions beside it are what this compiler could not settle. A\n\t * caller creating a fresh workspace answers them first and writes nothing while\n\t * any remains, which is the rule the `new` verb applies; a caller describing or\n\t * repairing an existing target carries them through instead.\n\t * Nothing downstream repeats that check, because only the caller knows which\n\t * case it is.\n\t *\n\t * @example\n\t * ```ts\n\t * import { Compiler, createBlueprint } from '@orkestrel/scaffold'\n\t *\n\t * const blueprint = createBlueprint('router', { src: ['core'] })\n\t *\n\t * new Compiler().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 * Compiles a blueprint and compares 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 { Compiler, createBlueprint } from '@orkestrel/scaffold'\n\t *\n\t * const blueprint = createBlueprint('router', { src: ['core'] })\n\t *\n\t * new Compiler().audit(blueprint, {}, ['manifest']).findings[0]?.drift // 'aligned'\n\t * new Compiler().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 * Tears 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 { Compiler } from '@orkestrel/scaffold'\n\t *\n\t * const compiler = new Compiler()\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 stages in order, recording each one and stopping at the first\n\t// failure. Every public method runs this and choreographs its 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 = groups.flatMap((group) => draft.filter((artifact) => artifact.group === group))\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 after 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...blueprintToHostArtifacts(blueprint),\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACsBA,IAAa,eAAuC,OAAO,OAAO;CAAC;CAAQ;CAAW;AAAQ,CAAC;;AAG/F,IAAa,WAA+B,OAAO,OAAO,CAAC,WAAW,QAAQ,CAAC;;AAG/E,IAAa,OAAwB,OAAO,OAAO,CAAC,OAAO,KAAK,CAAC;;AAGjE,IAAa,aAAmC,OAAO,OAAO,CAAC,KAAK,CAAC;;AAGrE,IAAa,mBAAqE,OAAO,OAAO,EAC/F,KAAK,OAAO,OAAO;CAClB,QAAQ;CACR,SAAS;CACT,UAAU,OAAO,OAAO,CAAC,KAAK,CAAC;CAC/B,SAAS,OAAO,OAAO,CAAC,OAAO,OAAO,CAAC;CACvC,cAAc,OAAO,OAAO;EAC3B,sBAAsB;EACtB,KAAK;EACL,WAAW;CACZ,CAAC;AACF,CAAC,EACF,CAAC;;AAGD,IAAa,oBAAoB;;AAGjC,IAAa,oBAAoB;;AAGjC,IAAa,qBAAqB;;AAGlC,IAAa,mBAAmB;;AAGhC,IAAa,sBAAsB;;AAGnC,IAAa,0BAA4D,OAAO,OAAO,EACtF,MAAM,WACP,CAAC;;AAGD,IAAa,uBAA0C,OAAO,OAAO;CACpE,GAAG;CACH;CACA;CACA;CACA,GAAG;AACJ,CAAC;;;;;;;;;AAUD,IAAa,SAA2B,OAAO,OAAO;CACrD;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;;;;;;;;;;;AAYD,IAAa,aAA2D,OAAO,OAAO;CACrF,MAAM,OAAO,OAAO;EACn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,MAAM;IACN,OAAO;IACP,WAAW;IACX,QAAQ;IACR,SAAS,oBAAoB,SAAS;GACvC;GACA,GAAG,2BAA2B,SAAS;GACvC,GAAG,2BAA2B,SAAS;GACvC,GAAG,yBAAyB,SAAS;GACrC,GAAG,0BAA0B,SAAS;GACtC,GAAG,6BAA6B,SAAS;GACzC,GAAG,kCAAkC,SAAS;GAC9C,GAAG,yBAAyB,SAAS;EACtC;CACD;CAIA,MACC,WACA,OACA,WACsB;EACtB,OAAO;GACN,GAAG,qBAAqB,SAAS;GACjC,GAAG,qBAAqB,UAAU,WAAW,KAAK;GAClD,GAAG,qBAAqB,SAAS;EAClC;CACD;CAIA,QAAQ,QAAwD;EAG/D,OAAO,aADN,WAAW,KAAA,IAAY,KAAA,IAAY,KAAK,QAAQ,QAAQ,aAAa,UAAU,MAAM,CACzD;CAC9B;CAKA,QAAW,OAAgB,OAAkB,OAAe,YAAmC;EAC9F,MAAM,WAAW,MAAM,WAAW,KAAK,CAAC;EACxC,IAAI,aAAa,KAAA,GAAW,OAAO;EACnC,MAAM,KAAK,OACV,WACA,OAAO,MAAM,0DACb,eAAe,KAAA,IAAY,EAAE,MAAM,IAAI;GAAE;GAAO;EAAW,CAC5D;CACD;CAEA,eAAqB;EACpB,IAAI,KAAK,YAAY,MAAM,KAAK,OAAO,aAAa,mCAAmC;CACxF;CAIA,OAAO,MAAyB,SAAiB,SAAkC;EAClF,MAAM,QAAQ,IAAI,cAAc,MAAM,SAAS,OAAO;EACtD,KAAK,SAAS,KAAK,SAAS,KAAK;EACjC,OAAO;CACR;AACD"}
1
+ {"version":3,"file":"index.js","names":["manifest"],"sources":["../../../package.json","../../../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/factories.ts","../../../src/core/Compiler.ts"],"sourcesContent":["{\n\t\"name\": \"@orkestrel/scaffold\",\n\t\"version\": \"0.0.109\",\n\t\"description\": \"Scaffold workspaces with commands: new, audit, repair, catalog, and overwrite.\",\n\t\"keywords\": [\n\t\t\"audit\",\n\t\t\"catalog\",\n\t\t\"new\",\n\t\t\"overwrite\",\n\t\t\"repair\"\n\t],\n\t\"homepage\": \"https://github.com/orkestrel/scaffold#readme\",\n\t\"bugs\": \"https://github.com/orkestrel/scaffold/issues\",\n\t\"license\": \"MIT\",\n\t\"repository\": {\n\t\t\"type\": \"git\",\n\t\t\"url\": \"git+https://github.com/orkestrel/scaffold.git\"\n\t},\n\t\"bin\": {\n\t\t\"scaffold\": \"dist/bin/main.js\"\n\t},\n\t\"files\": [\n\t\t\"dist/src\",\n\t\t\"dist/bin\",\n\t\t\"dist/host\",\n\t\t\"dist/agents\",\n\t\t\"README.md\"\n\t],\n\t\"type\": \"module\",\n\t\"sideEffects\": [\n\t\t\"./src/bin/main.ts\",\n\t\t\"./dist/bin/main.js\"\n\t],\n\t\"main\": \"./dist/src/core/index.cjs\",\n\t\"module\": \"./dist/src/core/index.js\",\n\t\"exports\": {\n\t\t\".\": {\n\t\t\t\"import\": {\n\t\t\t\t\"types\": \"./dist/src/core/index.d.ts\",\n\t\t\t\t\"default\": \"./dist/src/core/index.js\"\n\t\t\t},\n\t\t\t\"require\": {\n\t\t\t\t\"types\": \"./dist/src/core/index.d.cts\",\n\t\t\t\t\"default\": \"./dist/src/core/index.cjs\"\n\t\t\t}\n\t\t},\n\t\t\"./server\": {\n\t\t\t\"import\": {\n\t\t\t\t\"types\": \"./dist/src/server/index.d.ts\",\n\t\t\t\t\"default\": \"./dist/src/server/index.js\"\n\t\t\t},\n\t\t\t\"require\": {\n\t\t\t\t\"types\": \"./dist/src/server/index.d.cts\",\n\t\t\t\t\"default\": \"./dist/src/server/index.cjs\"\n\t\t\t}\n\t\t},\n\t\t\"./package.json\": \"./package.json\"\n\t},\n\t\"publishConfig\": {\n\t\t\"access\": \"public\"\n\t},\n\t\"scripts\": {\n\t\t\"clean\": \"node -e \\\"require('node:fs').rmSync('dist',{recursive:true,force:true})\\\"\",\n\t\t\"copy\": \"node -e \\\"const fs=require('node:fs'),p=require('node:path'),a=process.argv[1],b=process.argv[2];fs.mkdirSync(p.dirname(b),{recursive:true});fs.cpSync(a,b,{force:true});console.log('Copied: '+a+' to '+b)\\\"\",\n\t\t\"scaffold\": \"node ./dist/bin/main.js\",\n\t\t\"lint\": \"oxlint --config .oxlintrc.json --fix .\",\n\t\t\"check\": \"tsc --noEmit --project tsconfig.json && npm run check:src && npm run check:skills\",\n\t\t\"check:src\": \"npm run check:src:core && npm run check:src:server && npm run check:src:bin\",\n\t\t\"check:src:core\": \"tsc --noEmit -p configs/src/tsconfig.core.json\",\n\t\t\"check:src:server\": \"tsc --noEmit -p configs/src/tsconfig.server.json\",\n\t\t\"check:src:bin\": \"tsc --noEmit -p configs/src/tsconfig.bin.json\",\n\t\t\"check:skills\": \"tsc --noEmit -p configs/agents/tsconfig.skills.json\",\n\t\t\"format\": \"oxfmt --config .oxfmtrc.json --write .\",\n\t\t\"format:check\": \"oxfmt --config .oxfmtrc.json --check .\",\n\t\t\"lint:check\": \"oxlint --config .oxlintrc.json --deny-warnings .\",\n\t\t\"test\": \"npm run test:src:core && npm run test:src:server && npm run test:src:bin && npm run test:policy && npm run test:config && npm run test:setup && npm run test:skills && npm run test:guides\",\n\t\t\"test:src:core\": \"vitest run --config vite.config.ts --no-cache --reporter=dot --project src:core\",\n\t\t\"test:src:server\": \"vitest run --config vite.config.ts --no-cache --reporter=dot --project src:server\",\n\t\t\"test:src:bin\": \"vitest run --config vite.config.ts --no-cache --reporter=dot --project src:bin\",\n\t\t\"test:policy\": \"vitest run --config vite.config.ts --no-cache --reporter=dot --project policy\",\n\t\t\"test:config\": \"vitest run --config vite.config.ts --no-cache --reporter=dot --project config\",\n\t\t\"test:guides\": \"node --experimental-strip-types tests/guides.test.ts\",\n\t\t\"test:skills\": \"vitest run --config vite.config.ts --no-cache --reporter=dot --project skills\",\n\t\t\"test:templates\": \"vitest run --config vite.config.ts --no-cache --reporter=dot --project templates\",\n\t\t\"test:distribution\": \"vitest run --config vite.config.ts --no-cache --reporter=dot --project distribution\",\n\t\t\"test:probe\": \"vitest run --config vite.config.ts --no-cache --reporter=verbose --project probe\",\n\t\t\"test:bench\": \"vitest bench --config vite.config.ts --no-cache --project \\\"probe (bench)\\\" --mode benchmark\",\n\t\t\"test:setup\": \"vitest run --config vite.config.ts --no-cache --reporter=dot --project setup\",\n\t\t\"build\": \"npm run clean && npm run build:src && npm run build:host && npm run build:skills && npm run build:inventory\",\n\t\t\"build:src\": \"npm run build:src:core && npm run build:src:server && npm run build:src:bin\",\n\t\t\"build:src:core\": \"vite build --config configs/src/vite.core.config.ts && npm run copy dist/src/core/index.d.ts dist/src/core/index.d.cts\",\n\t\t\"build:src:server\": \"vite build --config configs/src/vite.server.config.ts && npm run copy dist/src/server/index.d.ts dist/src/server/index.d.cts\",\n\t\t\"build:src:bin\": \"vite build --config configs/src/vite.bin.config.ts\",\n\t\t\"build:host\": \"node -e \\\"import('./dist/src/server/index.js').then((m)=>{const n=m.stageHost(process.cwd(),'dist/host',{report: (message) => console.error(message)}).length;console.log('build-host: staged '+n+' file(s) into dist/host')})\\\"\",\n\t\t\"build:inventory\": \"node -e \\\"import('./dist/src/server/index.js').then((m)=>{const p=process.argv[1]??'host.json',n=m.stageInventory(process.cwd(),p).entries.length;console.log('build-inventory: staged '+n+' file(s) into '+p)})\\\"\",\n\t\t\"build:skills\": \"tsc -p configs/agents/tsconfig.skills.json --noEmit false --allowImportingTsExtensions false --rewriteRelativeImportExtensions --declaration false --sourceMap false --rootDir .agents/skills --outDir dist/agents/skills && npm run copy .agents/templates/brief.md dist/agents/templates/brief.md\",\n\t\t\"prepack\": \"npm run build\",\n\t\t\"prepublishOnly\": \"npm run format:check && npm run lint:check && npm run check && npm run build && npm test && npm run test:templates && npm run test:distribution -- --mode release\"\n\t},\n\t\"dependencies\": {\n\t\t\"@orkestrel/console\": \"^0.0.16\",\n\t\t\"@orkestrel/contract\": \"^0.0.19\",\n\t\t\"@orkestrel/emitter\": \"^0.0.12\",\n\t\t\"@orkestrel/markdown\": \"^0.0.17\",\n\t\t\"@orkestrel/process\": \"^0.0.15\",\n\t\t\"@orkestrel/template\": \"^0.0.10\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@microsoft/api-extractor\": \"^7.60.0\",\n\t\t\"@orkestrel/browser\": \"^0.0.29\",\n\t\t\"@orkestrel/guide\": \"^0.0.25\",\n\t\t\"@orkestrel/html\": \"^0.0.12\",\n\t\t\"@orkestrel/probe\": \"^0.0.25\",\n\t\t\"@orkestrel/test\": \"^0.0.30\",\n\t\t\"@types/node\": \"^24.19.2\",\n\t\t\"@vitest/browser-playwright\": \"^5.0.5\",\n\t\t\"oxfmt\": \"^0.75.0\",\n\t\t\"oxlint\": \"^1.90.0\",\n\t\t\"playwright\": \"^1.64.1\",\n\t\t\"typescript\": \"^7.0.2\",\n\t\t\"vite\": \"^8.3.5\",\n\t\t\"vitest\": \"^5.0.5\"\n\t},\n\t\"engines\": {\n\t\t\"node\": \">=22.18.0\"\n\t}\n}\n","import type {\n\tAppDefinition,\n\tAxis,\n\tBuildFormat,\n\tEnvironment,\n\tFramework,\n\tFrameworkDefinition,\n\tGroup,\n\tSrcDefinition,\n\tSurface,\n\tToolchainHold,\n} from './types.js'\nimport manifest from '../../package.json' with { type: 'json' }\n\n/**\n * Lists the `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/** Lists the surfaces an extension may extend, frozen. */\nexport const SURFACES: readonly Surface[] = Object.freeze(['browser', 'styles'])\n\n/** Lists the axes a browser extension may occupy, frozen. */\nexport const AXES: readonly Axis[] = Object.freeze(['src', 'app'])\n\n/** Lists the supported browser frameworks, frozen. */\nexport const FRAMEWORKS: readonly Framework[] = Object.freeze(['vue'])\n\n/** Describes the tooling and package boundaries of each browser framework, frozen. */\nexport const FRAMEWORK_MATRIX: Readonly<Record<Framework, FrameworkDefinition>> = Object.freeze({\n\tvue: Object.freeze({\n\t\tplugin: '@vitejs/plugin-vue',\n\t\tchecker: 'vue-tsc',\n\t\tsuffixes: Object.freeze(['vue']),\n\t\trefused: Object.freeze(['vue', '@vue/']),\n\t\tdependencies: Object.freeze({\n\t\t\t'@vitejs/plugin-vue': '^6.0.8',\n\t\t\tvue: '^3.5.40',\n\t\t\t'vue-tsc': '^3.3.7',\n\t\t}),\n\t}),\n})\n\n/** Names the base stylesheet marker. */\nexport const STYLES_ENTRY_PATH = 'src/styles/index.scss'\n\n/** Names the themes build entry marker. */\nexport const THEMES_ENTRY_PATH = 'src/styles/themes/sheet.ts'\n\n/** Names the themes stylesheet marker. */\nexport const THEMES_BARREL_PATH = 'src/styles/themes/index.scss'\n\n/** Names the build entry beside each stylesheet marker. */\nexport const SHEET_ENTRY_NAME = 'sheet.ts'\n\n/** Names the physical showcase output directory. */\nexport const SHOWCASE_PAGES_PATH = 'showcase'\n\n/** Lists the development dependencies the styles surface adds, frozen. */\nexport const STYLES_DEV_DEPENDENCIES: Readonly<Record<string, string>> = Object.freeze({\n\tsass: '^1.105.1',\n})\n\n/** Lists the names a styles extension cannot occupy, frozen. */\nexport const RESERVED_SHEET_NAMES: readonly string[] = Object.freeze([\n\t...ENVIRONMENTS,\n\t'bin',\n\t'styles',\n\t'themes',\n\t...FRAMEWORKS,\n])\n\n/**\n * Lists the `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 * Holds 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 * Holds the configuration and runtime-entry settings each private `app` environment\n * 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 environments 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/** Lists 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/** Names the executable entry whose presence makes a workspace `bin`. */\nexport const BIN_ENTRY_PATH = 'src/bin/main.ts'\n\n/** Names the built executable a bin workspace's manifest command runs. */\nexport const BIN_OUTPUT_PATH = 'dist/bin/main.js'\n\n/**\n * Lists the paths a target receives from the vendored data root, frozen.\n *\n * @remarks\n * These are the files the fleet shares verbatim, and each target holds a copy\n * of the paths it selects: the licence, the harness permission file, the\n * session-start hooks, the shared policy\n * register, the shared policy proof, the shared policy plugin, the shared\n * configuration leaf and its proof, and the byte-identical root dotfiles.\n * A directory entry vendors everything beneath it.\n *\n * A plan carries the subset its target selects. The seed guide mirrors are\n * claimed separately by `blueprintToHostArtifacts` through {@link SEED_GUIDE_PATHS}.\n *\n * Neither the instruction canon nor the bench and MCP wiring is here. A target reads\n * its rules, its skills, its agent roles, its bench configuration, and its MCP\n * registrations from {@link CANON_PATHS} inside the installed package, so no\n * file scaffold leaves in a target names a path the target does not hold.\n * `blueprintToHostArtifacts` appends {@link CATALOG_AGENT_PATH} to what this list\n * selects, which is what keeps the list itself disjoint from the canon.\n */\nexport const HOST_PATHS: readonly string[] = Object.freeze([\n\t'LICENSE',\n\t'.claude/settings.json',\n\t'scripts',\n\t'tests/setupPolicy.ts',\n\t'tests/policy.test.ts',\n\t'tests/config.test.ts',\n\t'configs/helpers.ts',\n\t'configs/policy.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])\n\n/**\n * Lists the instruction-canon paths staged for reading rather than for a target, frozen.\n *\n * @remarks\n * The root instruction documents, the orchestration contract every harness\n * bridge points at, the rule map's rules, the skills, the templates, the\n * transport contracts, the agent roles each harness dispatches, the bench\n * configuration, and the MCP registrations. A directory entry covers everything\n * beneath it.\n *\n * Staging walks these beside {@link HOST_PATHS}, so a release ships them and a\n * reader reaches them two ways: a scaffold checkout sitting beside the\n * repository, or the `node_modules/@orkestrel/scaffold/dist/host/` root inside\n * the installed package. The `AGENTS.md` pointer scaffold plans is what names\n * each location.\n *\n * This list, {@link HOST_PATHS}, and {@link REFERENCE_PATHS} are disjoint by\n * prefix in every direction: no member equals or sits beneath another list's\n * member. Staging depends on that, because\n * the walk covers the union and a path it discovers twice claims one storage\n * name twice, which refuses the stage.\n *\n * The plan claims paths inside the canon deliberately, and each has a reason.\n * `blueprintToDocumentArtifacts` claims `AGENTS.md` as this package's own\n * template pointer. `blueprintToHostArtifacts` claims\n * {@link CATALOG_AGENT_PATH}, because the catalog verb refuses a target that\n * lacks the file and repair restores its absence.\n *\n * A target therefore holds a file at a canon path only where the plan claims it.\n * That is the rule every verb obeys, and it is what makes a copy found anywhere\n * else superseded. A member this checkout no longer holds, `CLAUDE.md` since\n * Claude Code began reading `AGENTS.md` directly, stays listed for exactly that\n * reason: the stager ships nothing for it, `audit` reports a target's copy\n * `foreign`, and `overwrite` deletes it.\n */\nexport const CANON_PATHS: readonly string[] = Object.freeze([\n\t'AGENTS.md',\n\t'CLAUDE.md',\n\t'.claude/AGENTS.md',\n\t'.mcp.json',\n\t'.agents/orchestration.md',\n\t'.agents/platforms',\n\t'.agents/skills',\n\t'.agents/templates',\n\t'.agents/transports',\n\t'.claude/agents',\n\t'.claude/rules',\n\t'.claude/skills',\n\t'.codex/agents',\n\t'.codex/config.toml',\n\t'.cursor/mcp.json',\n\t'.cursor/rules',\n])\n\n/**\n * Lists the reference paths staged for offline reading, frozen.\n *\n * @remarks\n * A directory entry covers everything beneath it. Reference membership grants\n * no target ownership and no instruction-canon membership. Keep this list,\n * {@link HOST_PATHS}, and {@link CANON_PATHS} disjoint by prefix in every\n * direction; duplicate discovery refuses the stage.\n */\nexport const REFERENCE_PATHS: readonly string[] = Object.freeze(['guides'])\n\n/**\n * Lists the guide paths a generated workspace starts with, frozen.\n *\n * @remarks\n * `blueprintToHostArtifacts` claims these mirrors from {@link REFERENCE_PATHS}.\n * `selectHostPaths` excludes the workspace's own guide from that claim.\n */\nexport const SEED_GUIDE_PATHS: readonly string[] = Object.freeze([\n\t'guides/guide.md',\n\t'guides/scaffold.md',\n])\n\n/** Names the repository-relative path where the committed vendored-file inventory is served. */\nexport const HOST_INVENTORY_PATH = 'host.json'\n\n/**\n * Lists 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 * Lists 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/browsers.sh',\n\t'scripts/codex.sh',\n\t'scripts/cursor.sh',\n\t'scripts/deps.sh',\n\t'scripts/npm.sh',\n\t'scripts/ollama.sh',\n])\n\n/**\n * Lists 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 * an added 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 * Lists the exact root paths that wire an agent bench or own an orchestration directory, frozen.\n *\n * @remarks\n * `.mcp.json` registers MCP servers for the harness. `scripts` is the owned\n * directory whose members wire the development environment.\n */\nexport const ORCHESTRATION_PATH_NAMES: readonly string[] = Object.freeze(['.mcp.json', 'scripts'])\n\n/**\n * Names the agent file whose marker-bounded package table the catalog verb alone owns.\n *\n * @remarks\n * A plan claims it at a canon path, because the catalog verb refuses a target\n * that lacks the file. `blueprintToHostArtifacts` appends it to the vendored\n * selection, and it reaches a release through the `.claude/agents` directory in\n * {@link CANON_PATHS} rather than through {@link HOST_PATHS}, which is what\n * keeps the two lists disjoint.\n *\n * It is claimed by presence rather than content, so a consumer's own edits to\n * the file survive every verb and only the catalog verb rewrites the region\n * inside the markers.\n */\nexport const CATALOG_AGENT_PATH = '.claude/agents/orkestrel.md'\n\n/**\n * Names the marker opening the package table inside {@link CATALOG_AGENT_PATH}.\n *\n * @remarks\n * The catalog verb rewrites the region between this marker and\n * {@link CATALOG_END_MARKER} and leaves every other byte of the file alone,\n * so the writer and every proof that reads the rendered file read the pair from\n * here rather than repeating a literal that only agrees by inspection.\n */\nexport const CATALOG_START_MARKER = '<!-- orkestrel:catalog -->'\n\n/**\n * Names the marker closing the package table inside {@link CATALOG_AGENT_PATH}.\n *\n * @remarks\n * It pairs with {@link CATALOG_START_MARKER}; a file missing either marker is\n * refused rather than rewritten.\n */\nexport const CATALOG_END_MARKER = '<!-- /orkestrel:catalog -->'\n\n/**\n * Lists the package-facing skills a target receives pointers for, frozen and alphabetical.\n *\n * @remarks\n * `blueprintToHostArtifacts` plans, for each name, the Claude bridge, the Codex\n * sidecar, and the derived `SKILL.md` pointer, so every harness discovers the\n * skill while its body, references, and scripts stay in the installed package.\n * `orkestrel-align`, `orkestrel-dispatch`, `orkestrel-publish`, and\n * `orkestrel-scout` are excluded because they run from the scaffold checkout\n * and a target is not an orchestration host.\n */\nexport const TARGET_SKILL_NAMES: readonly string[] = Object.freeze([\n\t'enterprise-bootstrap',\n\t'orkestrel-build',\n\t'orkestrel-debrief',\n\t'orkestrel-falsify',\n\t'orkestrel-harden',\n\t'orkestrel-journey',\n\t'orkestrel-parallel',\n\t'orkestrel-polish',\n])\n\n/** Names the inventory skeleton a workspace with declared service vendors is given once. */\nexport const SERVICE_SCRIPT_PATH = 'scripts/service.sh'\n\n/** Names the shared Vitest global-setup module whose presence makes a workspace `global`. */\nexport const GLOBAL_SETUP_PATH = 'tests/setupGlobal.ts'\n\n/** Names the package-owned guide-parity entry used by `test:guides` and to select the `guides` project. */\nexport const GUIDES_TEST_PATH = 'tests/guides.test.ts'\n\n/** Names the generated packed-package proof every publishing workspace is planned at. */\nexport const DISTRIBUTION_TEST_PATH = 'tests/distribution.test.ts'\n\n/** Names the content-owned harness imported by the generated distribution proof. */\nexport const DISTRIBUTION_SETUP_PATH = 'tests/setupDistribution.ts'\n\n/**\n * Names the `prepublishOnly` row that runs the packed-package proof against a real registry.\n *\n * @remarks\n * The proof reads `import.meta.env.MODE`, so without `--mode release` it passes\n * on an unreachable registry instead of failing. The row therefore has one home\n * and both the script compiler and the manifest region writer read it from here.\n */\nexport const RELEASE_PROOF_COMMAND = 'npm run test:distribution -- --mode release'\n\n/**\n * Names the cross-environment composition proof whose presence makes a workspace\n * `integration`.\n */\nexport const INTEGRATION_TEST_PATH = 'tests/integration.test.ts'\n\n/** Names the manifest path every compiler plan emits with birth ownership. */\nexport const MANIFEST_PATH = 'package.json'\n\n/** Names the official-tooling drift proof whose presence makes a workspace `conformance`. */\nexport const CONFORMANCE_TEST_PATH = 'tests/conformance.test.ts'\n\n/** Names the real-tree proof whose presence makes a workspace `tree`. */\nexport const TREE_TEST_PATH = 'tests/tree.test.ts'\n\n/** Names the live-service readiness module whose presence makes a workspace `service`. */\nexport const SERVICE_SETUP_PATH = 'tests/setupService.ts'\n\n/**\n * Names the include the live-service project covers, which is a directory rather than\n * one proof.\n */\nexport const SERVICE_TEST_INCLUDE = 'tests/service/**/*.test.ts'\n\n/**\n * Names the include the study project covers, where an exact-case `*.test.ts` file beneath\n * `tests/studies`, outside any `node_modules` or `.git` directory, makes a workspace `studies`.\n *\n * @remarks\n * The selector reads the include's population less Vitest's default exclude: an exact-case file\n * beneath `tests/studies`, nested or direct, whose name ends in `.test.ts`, outside any\n * `node_modules` or `.git` directory, which Vitest's default exclude never collects.\n */\nexport const STUDIES_TEST_INCLUDE = 'tests/studies/**/*.test.ts'\n\n/** Names the Vite wrapper whose presence makes a workspace `showcase`. */\nexport const SHOWCASE_CONFIG_PATH = 'configs/app/vite.showcase.config.ts'\n\n/** Names the Vite wrapper whose presence makes a workspace `journey`. */\nexport const JOURNEY_CONFIG_PATH = 'configs/app/vite.journey.config.ts'\n\n/** Names the TypeScript wrapper whose presence makes a workspace `skills`. */\nexport const SKILLS_CONFIG_PATH = 'configs/agents/tsconfig.skills.json'\n\n/** Matches the bare workspace name syntax: lowercase alphanumeric with hyphens, letter first. */\nexport const NAME_PATTERN = /^[a-z][a-z0-9-]*$/\n\n/**\n * Matches 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 resolving outside the directory\n * the mirror belongs in.\n */\nexport const DEPENDENCY_NAME_PATTERN = /^@orkestrel\\/[a-z][a-z0-9-]*$/\n\n/**\n * Matches the package name syntax for a dependency this package does not publish.\n *\n * @remarks\n * A foreign package is one this package does not publish, so its name reaches\n * no path. It may carry any scope or no scope at all. Each name segment begins\n * with an alphanumeric character after an optional leading `@`, and the name\n * carries at most one `/`. No segment can therefore be `..`, and no backslash\n * is admitted, so the shape cannot express a traversal.\n */\nexport const FOREIGN_NAME_PATTERN = /^(?:@[a-z0-9][a-z0-9._-]*\\/)?[a-z0-9][a-z0-9._-]*$/\n\n/** Matches the exact `major.minor.patch` version syntax a blueprint declares. */\nexport const VERSION_PATTERN = /^(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)$/\n\n/**\n * Matches 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/** Matches 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/**\n * Matches the exact `major.minor.patch` floor accepted for a foreign peer's range.\n *\n * @remarks\n * This is independent from {@link ENGINES_PATTERN}. An engine floors the Node\n * runtime a workspace supports, while a peer floors a tool the consumer\n * supplies. Either obligation may change without changing the other.\n */\nexport const FLOOR_RANGE_PATTERN = /^>=(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)$/\n\n/** Matches 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/** Matches exact lowercase hexadecimal bytes: two digits per byte, and empty content is valid. */\nexport const HEX_PATTERN = /^(?:[0-9a-f]{2})*$/\n\n/**\n * Matches the Unicode controls, formatting controls, and line and paragraph separators\n * rejected in text.\n */\nexport const CONTROL_CHARACTER_PATTERN = /[\\p{Cc}\\p{Cf}\\p{Zl}\\p{Zp}]/u\n\n/** Matches the visible characters a target-relative path and a Markdown path cell both forbid. */\nexport const INVALID_PATH_CHARACTER_PATTERN = /[<>:\"|?*\\\\]/\n\n/**\n * Caps the 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/** Sets the maximum dependency package name length, scope included, as the registry caps it. */\nexport const MAX_DEPENDENCY_NAME_LENGTH = 214\n\n/** Caps the length of one declared package range. */\nexport const MAX_RANGE_LENGTH = 2_048\n\n/** Caps the length of one manifest script name or command. */\nexport const MAX_SCRIPT_LENGTH = 4_096\n\n/** Caps the length of one path, matching the longest a supported filesystem accepts. */\nexport const MAX_PATH_LENGTH = 32_767\n\n/** Caps the items accepted in one public collection. */\nexport const MAX_COLLECTION_ITEMS = 1_000\n\n/** Caps the columns one emitted line may occupy, matching `printWidth` in `.oxfmtrc.json`. */\nexport const PRINT_WIDTH = 100\n\n/** Sets the columns one tab occupies when the formatter measures a line, matching `tabWidth`. */\nexport const TAB_WIDTH = 2\n\n/** Caps the findings one audit can produce from a bounded plan and snapshot. */\nexport const MAX_AUDIT_FINDINGS = MAX_COLLECTION_ITEMS * 2\n\n/** Caps the bytes accepted for one artifact. */\nexport const MAX_ARTIFACT_BYTES = 5_242_880\n\n/** Caps the length of the hexadecimal string carrying one artifact's bytes. */\nexport const MAX_ARTIFACT_HEX_LENGTH = MAX_ARTIFACT_BYTES * 2\n\n/**\n * Caps the decoded bytes accepted from one registry response.\n *\n * @remarks\n * The 2026-08-21 abbreviated-packument measurements were 8,647,138 bytes for\n * TypeScript, 8,077,438 for Playwright, 2,315,360 for `@types/node`, 2,298,256\n * for Vite, and 1,272,652 for Vitest. The bound leaves headroom above those\n * registry answers.\n */\nexport const MAX_REGISTRY_BYTES = 33_554_432\n\n/**\n * Caps the decoded bytes accepted across one registry-reading call.\n *\n * @remarks\n * The 2026-08-21 browser-workspace registry set measured about 24 MiB. The\n * bound leaves headroom for that set to grow without making a call unbounded.\n */\nexport const MAX_TOTAL_REGISTRY_BYTES = 100_663_296\n\n/** Caps the bytes accepted for one package or vendored-host manifest. */\nexport const MAX_MANIFEST_BYTES = 1_048_576\n\n/** Caps the bytes retained across one whole plan or audit. */\nexport const MAX_TOTAL_ARTIFACT_BYTES = 104_857_600\n\n/** Names the oldest Node version the generated toolchain supports. */\nexport const MINIMUM_NODE_VERSION = '22.18.0'\n\n/** Names the oldest npm version the generated toolchain supports. */\nexport const MINIMUM_NPM_VERSION = '11.6.0'\n\n/** Names the version a workspace starts at. */\nexport const DEFAULT_VERSION = '0.0.1'\n\n/** Names the `engines.node` range a workspace starts with. */\nexport const DEFAULT_ENGINES = `>=${MINIMUM_NODE_VERSION}`\n\n/**\n * Holds the `devEngines` record every generated manifest carries.\n *\n * @remarks\n * Every generated manifest names npm at the {@link MINIMUM_NPM_VERSION} floor with the `onFail`\n * key set to the `error` value, and no blueprint field varies that record. An npm at 10.9.0 or\n * later reads the `devEngines` record. Such an npm earlier than the floor refuses an install in a\n * generated workspace rather than resolving its dependency graph.\n * The neighbouring `DEFAULT_ENGINES` constant is the Node range, and a blueprint's `engines`\n * field does replace that one.\n */\nexport const WORKSPACE_DEV_ENGINES = Object.freeze({\n\tpackageManager: Object.freeze({\n\t\tname: 'npm',\n\t\tversion: `>=${MINIMUM_NPM_VERSION}`,\n\t\tonFail: 'error',\n\t}),\n})\n\n/** Holds the baseline tooling versions, before framework holds apply. */\nexport const BASE_DEV_DEPENDENCIES: Readonly<Record<string, string>> = Object.freeze({\n\t'@orkestrel/guide': manifest.devDependencies['@orkestrel/guide'],\n\t'@orkestrel/probe': manifest.devDependencies['@orkestrel/probe'],\n\t'@orkestrel/scaffold': `^${manifest.version}`,\n\t'@orkestrel/test': manifest.devDependencies['@orkestrel/test'],\n\t'@types/node': manifest.devDependencies['@types/node'],\n\toxfmt: manifest.devDependencies.oxfmt,\n\toxlint: manifest.devDependencies.oxlint,\n\ttypescript: manifest.devDependencies.typescript,\n\tvite: manifest.devDependencies.vite,\n\tvitest: manifest.devDependencies.vitest,\n})\n\n/**\n * Holds foreign tool ranges required by selected browser frameworks, frozen.\n *\n * @remarks\n * A selected framework overrides the baseline floor with its held range. `audit` names the hold\n * where it would report a newer served major and reports a declaration past that hold. The\n * constants proof ties the held range to the baseline manifest and the framework's planned range.\n */\nexport const TOOLCHAIN_HOLDS: Readonly<Record<string, ToolchainHold>> = Object.freeze({\n\ttypescript: Object.freeze({\n\t\tframework: 'vue',\n\t\trange: '^6.0.3',\n\t\treason:\n\t\t\t'Vue workspaces require TypeScript 6.0.3 because no stable vue-tsc runs on TypeScript 7: @volar/typescript@2.4.30 declares peer typescript <7, and the TypeScript 7.0 announcement directs Vue projects to stay on TypeScript 6.0',\n\t}),\n})\n\n/**\n * Lists the development dependencies that roll declarations up for published source.\n *\n * @remarks\n * The toolchain runs the compiler it already installs as a command, emitting one declaration per\n * module, and the extractor rolls that emit into the single file each published face ships.\n */\nexport const DECLARATION_DEV_DEPENDENCIES: Readonly<Record<string, string>> = Object.freeze({\n\t'@microsoft/api-extractor': manifest.devDependencies['@microsoft/api-extractor'],\n})\n\n/** Lists 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': manifest.devDependencies['@vitest/browser-playwright'],\n\tplaywright: manifest.devDependencies.playwright,\n})\n\n/**\n * Names the development dependency a browser or styles surface adds.\n *\n * @remarks\n * The package ships the `browse` binary, an MCP server that drives a rendered page and records\n * journeys, and `.claude/rules/quality.md` § Instruments names its registration.\n * `blueprintToDevDependencies` names the blueprints that receive it, and it withholds the\n * dependency from the workspaces {@link BROWSE_UPSTREAM} lists.\n */\nexport const BROWSE_DEV_DEPENDENCIES: Readonly<Record<string, string>> = Object.freeze({\n\t'@orkestrel/browser': manifest.devDependencies['@orkestrel/browser'],\n})\n\n/**\n * Names the development dependency a browser application's journey axis adds.\n *\n * @remarks\n * Scaffold does not install this package, so its range is a seed. The planner withholds it\n * from the workspaces {@link CAPTURE_UPSTREAM} lists.\n *\n * @example\n * ```ts\n * import { CAPTURE_DEV_DEPENDENCIES } from '@orkestrel/scaffold'\n *\n * CAPTURE_DEV_DEPENDENCIES['@orkestrel/capture'] // '^0.0.1'\n * ```\n */\nexport const CAPTURE_DEV_DEPENDENCIES: Readonly<Record<string, string>> = Object.freeze({\n\t'@orkestrel/capture': '^0.0.1',\n})\n\n/**\n * Lists the capture package and its fleet runtime dependency closure, frozen.\n *\n * @remarks\n * The sorted list includes `@orkestrel/capture` and its transitive `@orkestrel/*` dependencies\n * and peers, read from capture's installed manifests, and moves with the capture pin.\n * A listed workspace cannot receive the capture development dependency without closing a cycle.\n * Scaffold does not install capture, so the proof checks planning against this list; the\n * installed closure-equality proof lands when scaffold installs capture.\n *\n * @example\n * ```ts\n * import { CAPTURE_UPSTREAM } from '@orkestrel/scaffold'\n *\n * CAPTURE_UPSTREAM.includes('@orkestrel/process') // true\n * ```\n */\nexport const CAPTURE_UPSTREAM: readonly string[] = Object.freeze([\n\t'@orkestrel/capture',\n\t'@orkestrel/contract',\n\t'@orkestrel/emitter',\n\t'@orkestrel/process',\n\t'@orkestrel/timeout',\n])\n\n/**\n * Lists the packages `@orkestrel/browser` depends on at runtime, directly or transitively, frozen.\n *\n * @remarks\n * A workspace this list names cannot declare `@orkestrel/browser`, because the declaration closes\n * a dependency cycle through the browser package's runtime dependencies. The list is the closure\n * of `dependencies` and `peerDependencies` over the installed manifests, sorted by name, and moves\n * with the `@orkestrel/browser` pin.\n */\nexport const BROWSE_UPSTREAM: readonly string[] = Object.freeze([\n\t'@orkestrel/abort',\n\t'@orkestrel/codec',\n\t'@orkestrel/contract',\n\t'@orkestrel/emitter',\n\t'@orkestrel/html',\n\t'@orkestrel/markdown',\n\t'@orkestrel/mcp',\n\t'@orkestrel/pool',\n\t'@orkestrel/process',\n\t'@orkestrel/router',\n\t'@orkestrel/server',\n\t'@orkestrel/sse',\n\t'@orkestrel/timeout',\n\t'@orkestrel/tool',\n\t'@orkestrel/websocket',\n])\n\n/** Names the development dependency every private `app` environment adds. */\nexport const APP_DEV_DEPENDENCIES: Readonly<Record<string, string>> = Object.freeze({\n\t'@orkestrel/contract': manifest.dependencies['@orkestrel/contract'],\n})\n\n/** Lists the development dependencies a private 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': manifest.devDependencies['@orkestrel/html'],\n})\n\n/**\n * Names the tested dependency pair selected 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'] // the showcase plugin range\n * ```\n */\nexport const SHOWCASE_DEV_DEPENDENCIES: Readonly<Record<string, string>> = Object.freeze({\n\t'vite-plugin-singlefile': '2.3.3',\n\tvite: manifest.devDependencies.vite,\n})\n\n/** Names the scoped npm override required by the tested showcase plugin. */\nexport const SHOWCASE_OVERRIDES: Readonly<Record<string, Readonly<Record<string, string>>>> =\n\tObject.freeze({\n\t\t[`vite-plugin-singlefile@${SHOWCASE_DEV_DEPENDENCIES['vite-plugin-singlefile']}`]:\n\t\t\tObject.freeze({\n\t\t\t\tmicromatch: 'npm:picomatch@2.3.2',\n\t\t\t}),\n\t})\n\n/** Lists the development dependencies a private server application adds. */\nexport const APP_SERVER_DEV_DEPENDENCIES: Readonly<Record<string, string>> = Object.freeze({\n\t'@orkestrel/emitter': manifest.dependencies['@orkestrel/emitter'],\n\t'@orkestrel/middleware': '^0.0.16',\n\t'@orkestrel/router': '^0.0.10',\n\t'@orkestrel/server': '^0.0.14',\n})\n","import {\n\tBIN_ENTRY_PATH,\n\tCONFORMANCE_TEST_PATH,\n\tTREE_TEST_PATH,\n\tDISTRIBUTION_TEST_PATH,\n\tGUIDES_TEST_PATH,\n\tINTEGRATION_TEST_PATH,\n\tSERVICE_TEST_INCLUDE,\n\tSTUDIES_TEST_INCLUDE,\n} from './constants.js'\n\n/**\n * Holds 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{{paths}}\n\t},\n\t\"exclude\": [\"node_modules\", \"dist\", \"tmp\"]\n}\n`,\n\t\t// The manifest import and the `peers` derivation this template emits are\n\t\t// fixed, where `{{imports}}`, `{{helpers}}`, and `{{browsers}}` are selected.\n\t\t// One fixed block costs less than a fifth conditional span, and a workspace\n\t\t// that builds nothing carries one export nothing reads.\n\t\tvite: `{{journey}}import type { PluginOption, UserConfig } from 'vite'\nimport { mergeConfig } from 'vite'\n{{imports}}import { defineConfig } from 'vitest/config'\nimport manifest from './package.json' with { type: 'json' }\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 peerDependencies = 'peerDependencies' in manifest ? manifest.peerDependencies : undefined\nif (\n\tpeerDependencies !== undefined &&\n\t(typeof peerDependencies !== 'object' ||\n\t\tpeerDependencies === null ||\n\t\tArray.isArray(peerDependencies))\n) {\n\tthrow new Error('package peerDependencies must be an object')\n}\nexport const peers: readonly string[] =\n\tpeerDependencies === undefined ? [] : Object.keys(peerDependencies)\n\nconst resolve = {\n\talias: Object.fromEntries(\n\t\tObject.entries(tsconfig.compilerOptions.paths).map(([key, values]) => {\n\t\t\tconst [path] = values\n\t\t\tif (path === undefined) throw new Error('tsconfig path alias ' + key + ' has no target')\n\t\t\treturn [key, resolveWorkspacePath(path)]\n\t\t}),\n\t),\n}\n\n// Merges a caller's override onto the configuration a factory declares, so a\n// package's own configuration reaches the factory through its parameter instead of\n// wrapping the call from outside.\n//\n// Vitest calls every registered project factory with its own invocation record —\n// \\`command\\`, \\`mode\\`, \\`isSsrBuild\\`, \\`isPreview\\` — so a factory that also takes an\n// override receives that record in the same position. A \\`UserConfig\\` declares \\`mode\\`\n// but not \\`command\\`, and the invocation record always carries both, so a value\n// carrying the pair is that record rather than an override. The merge returns the\n// base in the record's \\`mode\\` and carries none of the record's other fields. Vitest\n// runs a project that declares no \\`mode\\` in its own run mode, \\`test\\`, rather than in\n// the \\`--mode\\` value it was invoked with, so a distribution proof run with\n// \\`--mode release\\` would read \\`test\\` and skip where it must fail. A record whose\n// \\`mode\\` is not a string throws. The \\`tests/config.test.ts\\` file drives every\n// registered factory through it.\n//\n// \\`mergeConfig\\` concatenates arrays, so an override carrying \\`plugins\\` would otherwise\n// add a second copy of a plugin the base already declares. Only named top-level\n// objects replace a base plugin of the same name, in the base's position, and one\n// override entry is taken at most once. An entry no base position took appends in its\n// written order; the caller's own entries never merge with each other. Nested arrays,\n// promises, falsy entries, and anonymous objects pass through unchanged. An override\n// cannot remove a base plugin. Every key other than \\`plugins\\` merges as \\`mergeConfig\\`\n// merges it, so an override's arrays elsewhere concatenate with the base's rather than\n// replacing them.\nexport function mergeOverride(base: UserConfig, override?: UserConfig): UserConfig {\n\tif (\n\t\toverride !== undefined &&\n\t\t'command' in override &&\n\t\t'mode' in override &&\n\t\ttypeof override.mode !== 'string'\n\t) {\n\t\tthrow new Error('The project invocation carries no string mode')\n\t}\n\tconst effective: UserConfig | undefined =\n\t\toverride !== undefined && 'command' in override && typeof override.mode === 'string'\n\t\t\t? { mode: override.mode }\n\t\t\t: override\n\tconst merged: UserConfig = effective === undefined ? { ...base } : mergeConfig(base, effective)\n\tconst name = merged.test?.name\n\tconst label = typeof name === 'string' ? name : name?.label\n\tconst browser = merged.test?.browser\n\tconst named: UserConfig =\n\t\tlabel !== undefined && browser?.instances !== undefined\n\t\t\t? {\n\t\t\t\t\t...merged,\n\t\t\t\t\ttest: {\n\t\t\t\t\t\t...merged.test,\n\t\t\t\t\t\tbrowser: {\n\t\t\t\t\t\t\t...browser,\n\t\t\t\t\t\t\tinstances: browser.instances.map((instance) => ({\n\t\t\t\t\t\t\t\t...instance,\n\t\t\t\t\t\t\t\tname: instance.name ?? \\`\\${label} (\\${instance.browser})\\`,\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: merged\n\tif (named.plugins === undefined || effective === undefined) return named\n\tconst candidates = [...(effective.plugins ?? [])]\n\tconst bases = [...(base.plugins ?? [])]\n\t// A base plugin takes the first candidate of its own name that no earlier base plugin took, and\n\t// candidates of other names never compete for it, so its pick is the candidate whose rank among\n\t// its name equals the number of earlier base plugins sharing that name.\n\tconst chosen = bases.map((plugin, position) =>\n\t\tisNamedPlugin(plugin)\n\t\t\t? candidates\n\t\t\t\t\t.flatMap((candidate, index) =>\n\t\t\t\t\t\tisNamedPlugin(candidate) && candidate.name === plugin.name ? [index] : [],\n\t\t\t\t\t)\n\t\t\t\t\t.at(\n\t\t\t\t\t\tbases\n\t\t\t\t\t\t\t.slice(0, position)\n\t\t\t\t\t\t\t.filter((earlier) => isNamedPlugin(earlier) && earlier.name === plugin.name).length,\n\t\t\t\t\t)\n\t\t\t: undefined,\n\t)\n\treturn {\n\t\t...named,\n\t\tplugins: [\n\t\t\t...bases.map((plugin, position) => {\n\t\t\t\tconst index = chosen[position]\n\t\t\t\treturn index === undefined ? plugin : (candidates[index] ?? plugin)\n\t\t\t}),\n\t\t\t...candidates.filter((_, index) => !chosen.includes(index)),\n\t\t],\n\t}\n}\n\nfunction isNamedPlugin(plugin: PluginOption): plugin is { name: string } {\n\treturn (\n\t\ttypeof plugin === 'object' &&\n\t\tplugin !== null &&\n\t\t!Array.isArray(plugin) &&\n\t\t!('then' in plugin && typeof plugin.then === 'function') &&\n\t\t'name' in plugin &&\n\t\ttypeof plugin.name === 'string'\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\tsheet: `export function sheetProject(name: string, override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\toptimizeDeps,\n\t\tpublicDir: false,\n\t\ttest: {\n\t\t\tname: { label: name, color: 'magenta' },\n\t\t\troot: resolveWorkspacePath('.'),\n\t\t\tisolate: false,\n\t\t\tsetupFiles: [\n\t\t\t\t'./tests/setup.ts',\n\t\t\t\t'./tests/setupBrowser.ts',\n\t\t\t\t...(existsSync(resolveWorkspacePath('tests/setupStyles.ts'))\n\t\t\t\t\t? ['./tests/setupStyles.ts']\n\t\t\t\t\t: []),\n\t\t\t],\n\t\t\tbrowser: {\n\t\t\t\tenabled: true,\n\t\t\t\tprovider: playwright(browserOptions),\n\t\t\t\tcommands,\n\t\t\t\tinstances: [{ browser: 'chromium', headless: true }],\n\t\t\t},\n\t\t\tfileParallelism: false,\n\t\t\tsequence: { groupOrder: 1 },\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\tsrc: Object.freeze({\n\t\t\tcore: `export function srcCore(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\tpublicDir: false,\n\t\tbuild: {\n\t\t\temptyOutDir: true,\n\t\t\tsourcemap: true,\n\t\t\tminify: false,\n\t\t\trolldownOptions: { onLog: enforceBuildLog },\n\t\t},\n\t\ttest: {\n\t\t\tname: { label: 'src:core', color: 'magenta' },\n\t\t\tinclude: ['tests/src/core/**/*.test.ts'],\n\t\t\tsetupFiles: ['./tests/setup.ts'],\n\t\t\tenvironment: 'node',\n\t\t\tbrowser: { enabled: false },\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\t\tvue: `function resolveVueFilename(): string {\n\treturn 'index.js'\n}\n\nexport function srcVue(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\toptimizeDeps: { include: [...optimizeDeps.include, 'vue'] },\n\t\tpublicDir: false,\n\t\tplugins: [outputBoundary('dist/src/vue'), environmentBoundary('src/vue'), vue()],\n\t\tbuild: {\n\t\t\temptyOutDir: true,\n\t\t\tsourcemap: true,\n\t\t\tminify: false,\n\t\t\tlib: {\n\t\t\t\tentry: resolveWorkspacePath('src/vue/index.ts'),\n\t\t\t\tformats: ['es'],\n\t\t\t\tfileName: resolveVueFilename,\n\t\t\t},\n\t\t\toutDir: 'dist/src/vue',\n\t\t\trolldownOptions: { onLog: enforceBuildLog },\n\t\t},\n\t\ttest: {\n\t\t\tname: { label: 'src:vue', color: 'green' },\n\t\t\tinclude: ['tests/src/vue/**/*.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\tcommands,\n\t\t\t\tinstances: [{ browser: 'chromium', headless: true }],\n\t\t\t},\n\t\t\tfileParallelism: false,\n\t\t\tsequence: { groupOrder: 1 },\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\t\tbrowser: `function resolveBrowserFilename(): string {\n\treturn 'index.js'\n}\n\nexport function srcBrowser(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\toptimizeDeps,\n\t\tpublicDir: false,\n\t\tplugins: [outputBoundary('dist/src/browser'), environmentBoundary('src/browser')],\n\t\tbuild: {\n\t\t\temptyOutDir: true,\n\t\t\tsourcemap: true,\n\t\t\tminify: false,\n\t\t\tlib: {\n\t\t\t\tentry: resolveWorkspacePath('src/browser/index.ts'),\n\t\t\t\tformats: ['es'],\n\t\t\t\tfileName: resolveBrowserFilename,\n\t\t\t},\n\t\t\toutDir: 'dist/src/browser',\n\t\t\trolldownOptions: {\n\t\t\t\tonLog: enforceBuildLog,\n\t\t\t\t{{external}}\n{{output}}\n\t\t\t},\n\t\t},\n\t\ttest: {\n\t\t\tname: { label: 'src:browser', color: 'yellow' },\n\t\t\tinclude: ['tests/src/browser/**/*.test.ts'],\n{{exclude}}\t\t\tsetupFiles: ['./tests/setup.ts', './tests/setupBrowser.ts'],\n{{global}}\n\t\t\tbrowser: {\n\t\t\t\tenabled: true,\n\t\t\t\tprovider: playwright(browserOptions),\n\t\t\t\tcommands,\n\t\t\t\tinstances: [{ browser: 'chromium', headless: true }],\n\t\t\t},\n\t\t\tfileParallelism: false,\n\t\t\tsequence: { groupOrder: 1 },\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\t\tserver: `function resolveServerFilename(format: string): string {\n\treturn format === 'es' ? 'index.js' : 'index.cjs'\n}\n\nexport function srcServer(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\tpublicDir: false,\n\t\tplugins: [outputBoundary('dist/src/server'), environmentBoundary('src/server')],\n\t\tbuild: {\n\t\t\temptyOutDir: true,\n\t\t\tsourcemap: true,\n\t\t\tminify: false,\n\t\t\tlib: {\n\t\t\t\tentry: resolveWorkspacePath('src/server/index.ts'),\n\t\t\t\tformats: ['es', 'cjs'],\n\t\t\t\tfileName: resolveServerFilename,\n\t\t\t},\n\t\t\toutDir: 'dist/src/server',\n\t\t\ttarget: 'node22',\n\t\t\trolldownOptions: {\n\t\t\t\tonLog: enforceBuildLog,\n\t\t\t\tplatform: 'node',\n\t\t\t\t{{external}}\n{{output}}\n\t\t\t},\n\t\t},\n\t\ttest: {\n\t\t\tname: { label: 'src:server', color: 'red' },\n\t\t\tinclude: ['tests/src/server/**/*.test.ts'],\n{{exclude}}\t\t\tsetupFiles: ['./tests/setup.ts', './tests/setupServer.ts'],\n\t\t\tenvironment: 'node',\n\t\t\tbrowser: { enabled: false },\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\t\tbin: `function resolveBinFilename(): string {\n\treturn 'main.js'\n}\n\nfunction resolveBinExternal(id: string): boolean {\n\treturn id.startsWith('@src/') || resolveExternal(id, { peers, refused: [], siblings: [] })\n}\n\nexport function srcBin(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\tpublicDir: false,\n\t\tplugins: [outputBoundary('dist/bin')],\n\t\tbuild: {\n\t\t\temptyOutDir: true,\n\t\t\tsourcemap: true,\n\t\t\tminify: false,\n\t\t\tlib: {\n\t\t\t\tentry: resolveWorkspacePath('${BIN_ENTRY_PATH}'),\n\t\t\t\tformats: ['es'],\n\t\t\t\tfileName: resolveBinFilename,\n\t\t\t},\n\t\t\toutDir: 'dist/bin',\n\t\t\ttarget: 'node22',\n\t\t\trolldownOptions: {\n\t\t\t\tonLog: enforceBuildLog,\n\t\t\t\texternal: resolveBinExternal,\n\t\t\t},\n\t\t},\n\t\ttest: {\n\t\t\tname: { label: 'src:bin', color: 'yellow' },\n\t\t\tinclude: ['tests/src/bin/**/*.test.ts'],\n\t\t\tsetupFiles: ['./tests/setup.ts', './tests/setupServer.ts'],\n\t\t\tenvironment: 'node',\n\t\t\tbrowser: { enabled: false },\n\t\t\t// A bin test drives the real executable over a real temporary repository, so it\n\t\t\t// spends seconds in process startup and filesystem work rather than milliseconds.\n\t\t\t// Vitest's five-second default clears one alone and times out under a full suite.\n\t\t\ttestTimeout: 15_000,\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\t}),\n\t\tapp: Object.freeze({\n\t\t\tcore: `export function appCore(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\tpublicDir: false,\n\t\tplugins: [environmentBoundary('app/core')],\n\t\ttest: {\n\t\t\tname: { label: 'app:core', color: 'cyan' },\n\t\t\tinclude: ['tests/app/core/**/*.test.ts'],\n\t\t\tsetupFiles: ['./tests/setup.ts'],\n\t\t\tenvironment: 'node',\n\t\t\tbrowser: { enabled: false },\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\t\tbrowser: `export function appBrowser(override?: UserConfig): UserConfig {\n\tconst output = 'dist/app/browser'\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\toptimizeDeps,\n\t\tplugins: [outputBoundary(output), environmentBoundary('app/browser')],\n\t\troot: resolveWorkspacePath('app/browser'),\n\t\tpublicDir: false,\n\t\tbuild: {\n\t\t\tassetsInlineLimit: 0,\n\t\t\temptyOutDir: true,\n\t\t\toutDir: resolveWorkspacePath(output),\n\t\t\trolldownOptions: {\n\t\t\t\tonLog: enforceBuildLog,\n\t\t\t\tinput: resolveWorkspacePath('app/browser/index.html'),\n\t\t\t},\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{{journeyExclude}}\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\tcommands,\n\t\t\t\tinstances: [{ browser: 'chromium', headless: true }],\n\t\t\t},\n\t\t\tfileParallelism: false,\n\t\t\tsequence: { groupOrder: 1 },\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n{{showcaseFactory}}{{journeyFactory}}`,\n\t\t\tvue: `export function appVue(override?: UserConfig): UserConfig {\n\tconst output = 'dist/app/vue'\n\tconst browser = appBrowser()\n\tconst project: UserConfig = {\n\t\t...browser,\n\t\toptimizeDeps: { include: [...optimizeDeps.include, 'vue'] },\n\t\tplugins: [outputBoundary(output), environmentBoundary('app/vue'), vue()],\n\t\troot: resolveWorkspacePath('app/vue'),\n\t\tbuild: {\n\t\t\t...browser.build,\n\t\t\toutDir: resolveWorkspacePath(output),\n\t\t\trolldownOptions: {\n\t\t\t\t...browser.build?.rolldownOptions,\n\t\t\t\tinput: resolveWorkspacePath('app/vue/index.html'),\n\t\t\t},\n\t\t},\n\t\ttest: {\n\t\t\t...browser.test,\n\t\t\tname: { label: 'app:vue', color: 'magenta' },\n\t\t\tbrowser: {\n\t\t\t\t...browser.test?.browser,\n\t\t\t\tinstances: (browser.test?.browser?.instances ?? []).map(\n\t\t\t\t\t({ name: _name, ...instance }) => instance,\n\t\t\t\t),\n\t\t\t},\n\t\t\tinclude: ['tests/app/vue/**/*.test.ts'],\n{{journeyExclude}}\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\t\tjourney: `\n// Replace the journey fields directly: merging would concatenate the ordinary include\n// and retain the exclusion of the journey suite.\nexport function appJourney(\n\tvariant: JourneyVariant,\n\tvariants: readonly JourneyVariant[],\n\tmode?: string,\n\toverride?: UserConfig,\n): UserConfig {\n\tconst application = resolveApplication(mode, applications)\n\tconst browser = applications[application]()\n\tconst project: UserConfig = {\n\t\t...browser,\n\t\ttest: {\n\t\t\t...browser.test,\n\t\t\tname: { label: \\`journey:\\${variant.name}\\`, color: 'green' },\n\t\t\tinclude: [\\`tests/app/\\${application}/integration.test.ts\\`],\n\t\t\texclude: [],\n\t\t\tprovide: { variant: variant.name, variants, capture },\n\t\t\tbrowser: {\n\t\t\t\t...browser.test?.browser,\n\t\t\t\tenabled: true,\n\t\t\t\tviewport: { width: variant.width, height: variant.height },\n\t\t\t\tinstances: (browser.test?.browser?.instances ?? []).map(\n\t\t\t\t\t({ name: _name, ...instance }) => instance,\n\t\t\t\t),\n\t\t\t},\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\t\t// A showcase is the browser application written to its own output, so it composes\n\t\t\t// on `appBrowser` and declares only what it changes. Its output boundary carries\n\t\t\t// the plugin name the browser boundary carries, so the merge replaces that\n\t\t\t// boundary rather than adding a second one.\n\t\t\tshowcase: `\nconst showcaseStamp: PluginOption = {\n\tname: 'orkestrel-showcase-html',\n\tenforce: 'post',\n\tgenerateBundle(_, bundle) {\n\t\tfor (const file of Object.values(bundle)) {\n\t\t\tif (\n\t\t\t\tfile.type === 'asset' &&\n\t\t\t\ttypeof file.source === 'string' &&\n\t\t\t\tfile.fileName.endsWith('.html')\n\t\t\t) {\n\t\t\t\tfile.source = stampPage(file.source)\n\t\t\t}\n\t\t}\n\t},\n}\n\nfunction createShowcaseNaming(application: string): PluginOption {\n\treturn {\n\t\tname: 'orkestrel-showcase-name',\n\t\tenforce: 'post',\n\t\twriteBundle(options) {\n\t\t\tif (options.dir === undefined) throw new Error('The showcase output is absent.')\n\t\t\trenameSync(\n\t\t\t\tresolvePath(options.dir, 'index.html'),\n\t\t\t\tresolvePath(options.dir, application + '.html'),\n\t\t\t)\n\t\t},\n\t}\n}\n\nexport function appShowcase(mode: string, override?: UserConfig): UserConfig {\n\tconst application = resolveApplication(mode, applications)\n\tconst output = 'showcase'\n\tconst showcase: UserConfig = {\n\t\tplugins: [\n\t\t\toutputBoundary(output),\n\t\t\tviteSingleFile({\n\t\t\t\tremoveViteModuleLoader: true,\n\t\t\t\tuseRecommendedBuildConfig: true,\n\t\t\t}),\n\t\t\tshowcaseStamp,\n\t\t\tcreateShowcaseNaming(application),\n\t\t],\n\t\tbuild: {\n\t\t\t// The \\`appBrowser\\` factory sets \\`assetsInlineLimit\\` to 0, so every asset becomes\n\t\t\t// its own file, and 4096 is Vite's own default put back. The \\`viteSingleFile\\`\n\t\t\t// plugin overwrites the value while the \\`useRecommendedBuildConfig\\` option stays\n\t\t\t// true, so this line takes effect only in a workspace that turns that option off.\n\t\t\tassetsInlineLimit: 4096,\n\t\t\tcssMinify: 'lightningcss',\n\t\t\temptyOutDir: false,\n\t\t\tminify: 'oxc',\n\t\t\tmodulePreload: false,\n\t\t\toutDir: resolveWorkspacePath(output),\n\t\t\treportCompressedSize: false,\n\t\t\tsourcemap: false,\n\t\t\ttarget: 'esnext',\n\t\t},\n\t}\n\treturn applications[application](mergeOverride(showcase, override))\n}\n`,\n\t\t\tserver: `function resolveAppFilename(): string {\n\treturn 'main.cjs'\n}\n\nfunction resolveAppExternal(id: string): boolean {\n\treturn id.startsWith('node:')\n}\n\nexport function appServer(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\tpublicDir: false,\n\t\tplugins: [outputBoundary('dist/app/server'), environmentBoundary('app/server')],\n\t\tbuild: {\n\t\t\temptyOutDir: true,\n\t\t\tlib: {\n\t\t\t\tentry: resolveWorkspacePath('app/server/main.ts'),\n\t\t\t\tformats: ['cjs'],\n\t\t\t\tfileName: resolveAppFilename,\n\t\t\t},\n\t\t\toutDir: resolveWorkspacePath('dist/app/server'),\n\t\t\ttarget: 'node22',\n\t\t\trolldownOptions: {\n\t\t\t\tonLog: enforceBuildLog,\n\t\t\t\texternal: resolveAppExternal,\n\t\t\t},\n\t\t},\n\t\ttest: {\n\t\t\tname: { label: 'app:server', color: 'green' },\n\t\t\tinclude: ['tests/app/server/**/*.test.ts'],\n\t\t\tsetupFiles: ['./tests/setup.ts', './tests/setupServer.ts'],\n\t\t\tenvironment: 'node',\n\t\t\tbrowser: { enabled: false },\n\t\t},\n\t}\n\t// Fills the missing codeSplitting of each merged output with false and adds no output,\n\t// so an override's output list keeps its own members and their order. A member that\n\t// already supplies a value is returned as written, found by property lookup, so a value\n\t// an inherited getter supplies survives.\n\tconst merged = mergeOverride(project, override)\n\tconst rolldown = merged.build?.rolldownOptions\n\tconst output = rolldown?.output\n\tconst unsplit = { codeSplitting: false }\n\treturn {\n\t\t...merged,\n\t\tbuild: {\n\t\t\t...merged.build,\n\t\t\trolldownOptions: {\n\t\t\t\t...rolldown,\n\t\t\t\toutput: Array.isArray(output)\n\t\t\t\t\t? output.map((member) =>\n\t\t\t\t\t\t\tmember.codeSplitting === undefined ? { ...member, ...unsplit } : member,\n\t\t\t\t\t\t)\n\t\t\t\t\t: output?.codeSplitting === undefined\n\t\t\t\t\t\t? { ...output, ...unsplit }\n\t\t\t\t\t\t: output,\n\t\t\t},\n\t\t},\n\t}\n}\n`,\n\t\t}),\n\t\tpolicy: `export function policy(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\ttest: {\n\t\t\tname: { label: 'policy', color: 'white' },\n\t\t\tinclude: ['tests/policy.test.ts'],\n\t\t\tsetupFiles: ['./tests/setup.ts'],\n\t\t\tenvironment: 'node',\n\t\t\tbrowser: { enabled: false },\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\tconfig: `export function config(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\ttest: {\n\t\t\tname: { label: 'config', color: 'yellow' },\n\t\t\tinclude: ['tests/config.test.ts'],\n\t\t\tsetupFiles: ['./tests/setup.ts'],\n\t\t\tenvironment: 'node',\n\t\t\tbrowser: { enabled: false },\n\t\t\t// A config test validates every target wrapper, spawns the real linter twice under\n\t\t\t// 15-second child caps, and rolls one face up through the compiler and the extractor it\n\t\t\t// spawns, so this budget clears the capped pair with room for a contended host.\n\t\t\ttestTimeout: 60_000,\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\tsetup: `export function setup(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\ttest: {\n\t\t\tname: { label: 'setup', color: 'white' },\n\t\t\tinclude: ['tests/setup*.test.ts'],\n\t\t\texclude: ['tests/setupBrowser.test.ts', 'tests/setupStyles.test.ts'],\n\t\t\tsetupFiles: ['./tests/setup.ts'],\n\t\t\tpool: 'threads',\n\t\t\tisolate: false,\n\t\t\tenvironment: 'node',\n\t\t\tbrowser: { enabled: false },\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\tbrowser: `export function setupBrowser(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\t{{optimization}},\n{{plugins}}\t\ttest: {\n\t\t\tname: { label: 'setup:browser', color: 'blue' },\n\t\t\tinclude: ['tests/setupBrowser.test.ts', 'tests/setupStyles.test.ts'],\n\t\t\tsetupFiles: ['./tests/setup.ts', './tests/setupBrowser.ts'],\n{{global}}\t\t\tbrowser: {\n\t\t\t\tenabled: true,\n\t\t\t\tprovider: playwright(browserOptions),\n\t\t\t\tcommands,\n\t\t\t\tinstances: [{ browser: 'chromium', headless: true }],\n\t\t\t},\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\tguides: `export function guides(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\ttest: {\n\t\t\tname: { label: 'guides', color: 'green' },\n\t\t\tinclude: ['${GUIDES_TEST_PATH}'],\n\t\t\texclude: ['tests/src/**/*.test.ts', 'tests/app/**/*.test.ts', 'tests/setup.test.ts'],\n\t\t\tsetupFiles: ['./tests/setup.ts'],\n\t\t\tenvironment: 'node',\n\t\t\tbrowser: { enabled: false },\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\tskills: `// The skill scripts this package ships as canon, each driven as a child process against a\n// scratch fixture from its mirrored proof under \\`tests/agents/skills/<skill>/scripts/\\`. The\n// \\`configs/agents/tsconfig.skills.json\\` wrapper selects the project.\nexport function skills(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\ttest: {\n\t\t\tname: { label: 'skills', color: 'blue' },\n\t\t\tinclude: ['tests/agents/**/*.test.ts'],\n\t\t\tsetupFiles: ['./tests/setup.ts'],\n\t\t\tenvironment: 'node',\n\t\t\tbrowser: { enabled: false },\n\t\t\t// Each case spawns node on a script; a census case runs \\`vitest list\\` over this checkout.\n\t\t\ttestTimeout: 60_000,\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\ttree: `// The laws this package states about its own real tree.\n// Standalone Node proof; reads the tree without a build, install, or service.\nexport function tree(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\ttest: {\n\t\t\tname: { label: 'tree', color: 'magenta' },\n\t\t\tinclude: ['${TREE_TEST_PATH}'],\n\t\t\tsetupFiles: ['./tests/setup.ts', './tests/setupServer.ts'],\n\t\t\tpool: 'threads',\n\t\t\tisolate: false,\n\t\t\tenvironment: 'node',\n\t\t\tbrowser: { enabled: false },\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\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 function conformance(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\ttest: {\n\t\t\tname: { label: 'conformance', color: 'magenta' },\n\t\t\tinclude: ['${CONFORMANCE_TEST_PATH}'],\n\t\t\tsetupFiles: ['./tests/setup.ts', './tests/setupServer.ts'],\n\t\t\tpool: 'threads',\n\t\t\tisolate: false,\n\t\t\tenvironment: 'node',\n\t\t\tbrowser: { enabled: false },\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\tservice: `// The caller prepares the live external services before this project.\n// \\`tests/setupService.ts\\` verifies readiness, and the project stays out of \\`npm test\\`\n// because a real service answers it.\nexport function service(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\ttest: {\n\t\t\tname: { label: 'service', color: 'red' },\n\t\t\tinclude: ['${SERVICE_TEST_INCLUDE}'],\n\t\t\tsetupFiles: ['./tests/setup.ts', './tests/setupService.ts'],\n\t\t\tenvironment: 'node',\n\t\t\tbrowser: { enabled: false },\n\t\t\ttestTimeout: 120_000,\n\t\t\thookTimeout: 120_000,\n\t\t\tfileParallelism: false,\n\t\t\tsequence: { groupOrder: 1 },\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\tstudies: `// The @orkestrel/study engine drives these proofs, running installed packages through bounded\n// subprocesses and protocol fixtures, so this project is isolated in its own gate script,\n// test:studies.\nexport function studies(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\ttest: {\n\t\t\tname: { label: 'studies', color: 'red' },\n\t\t\tinclude: ['${STUDIES_TEST_INCLUDE}'],\n\t\t\tsetupFiles: ['./tests/setup.ts'],\n\t\t\tenvironment: 'node',\n\t\t\tbrowser: { enabled: false },\n\t\t\ttestTimeout: 120_000,\n\t\t\thookTimeout: 120_000,\n\t\t\tfileParallelism: false,\n\t\t\tsequence: { groupOrder: 1 },\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\tdistribution: `export function distribution(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\ttest: {\n\t\t\tname: { label: 'distribution', color: 'cyan' },\n\t\t\tinclude: ['${DISTRIBUTION_TEST_PATH}'],\n\t\t\tsetupFiles: ['./tests/setup.ts'],\n\t\t\tenvironment: 'node',\n\t\t\ttestTimeout: 120_000,\n\t\t\thookTimeout: 120_000,\n\t\t\tfileParallelism: false,\n\t\t\tsequence: { groupOrder: 1 },\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\tprobe: `// A workbench, not a proof. No gate selects this project. Run in test mode by the\n// \\`test:probe\\` script, it collects \\`tmp/probes/**/*.test.ts\\`. Run in benchmark mode by the\n// \\`test:bench\\` script, it collects \\`*.bench.ts\\` files under \\`tmp/probes\\` and \\`tests\\`.\n// Each benchmark is a regular test that uses its context's \\`bench\\` fixture and awaits\n// \\`bench(name, options, fn).run()\\` or \\`bench.compare(...)\\`.\nexport function probe(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\ttest: {\n\t\t\tname: { label: 'probe', color: 'black' },\n\t\t\tinclude: ['tmp/probes/**/*.test.ts'],\n\t\t\tsetupFiles: ['./tests/setup.ts'],\n\t\t\tenvironment: 'node',\n\t\t\tbrowser: { enabled: false },\n\t\t\tfileParallelism: false,\n\t\t\tsequence: { groupOrder: 1 },\n\t\t\tpool: 'threads',\n\t\t\tbenchmark: { include: ['tmp/probes/**/*.bench.ts', 'tests/**/*.bench.ts'] },\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\tintegration: Object.freeze({\n\t\t\tsheet: `export function integration(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\ttest: {\n\t\t\tinclude: ['tests/integration.test.ts'],\n{{global}}\t\t},\n\t}\n\treturn sheetProject('integration', mergeOverride(project, override))\n}\n`,\n\t\t\tmodule: `export function integration(override?: UserConfig): UserConfig {\n\tconst project: UserConfig = {\n\t\tresolve,\n\t\ttest: {\n\t\t\tname: { label: 'integration', color: 'blue' },\n\t\t\tinclude: ['${INTEGRATION_TEST_PATH}'],\n\t\t\tsetupFiles: ['./tests/setup.ts'],\n{{global}}\t\t\tenvironment: 'node',\n\t\t},\n\t}\n\treturn mergeOverride(project, override)\n}\n`,\n\t\t}),\n\t}),\n\ttsconfigs: Object.freeze({\n\t\tvue: Object.freeze({\n\t\t\tsrc: `{\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/vue/**/*.cts\",\n\t\t\"../../src/vue/**/*.mts\",\n\t\t\"../../src/vue/**/*.ts\",\n\t\t\"../../src/vue/**/*.tsx\"\n\t]\n}\n`,\n\t\t\tapp: `{\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}),\n\t\tsheet: `{\n\t\"extends\": \"../../tsconfig.json\",\n\t\"compilerOptions\": {\n\t\t\"lib\": [\"ESNext\"],\n\t\t\"types\": [\"vite/client\"],\n\t\t\"noEmit\": true\n\t},\n\t\"include\": [\"../../src/{{name}}/**/*.ts\"]\n}\n`,\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\"]\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\tskills: `{\n\t\"extends\": \"../../tsconfig.json\",\n\t\"compilerOptions\": {\n\t\t\"lib\": [\"ESNext\"],\n\t\t\"types\": [\"node\"]\n\t},\n\t\"include\": [\"../../.agents/skills/*/scripts/*.ts\"],\n\t\"exclude\": [\"../../node_modules\"]\n}\n`,\n\t}),\n\tvites: Object.freeze({\n\t\tsheet: `import { defineConfig } from 'vitest/config'\nimport { outputBoundary } from '../helpers.js'\nimport { resolveWorkspacePath, sheetProject } from '../../vite.config.ts'\n\nexport default defineConfig((invocation) => {\n\tconst project = sheetProject('src:{{label}}', {\n\t\tplugins: [outputBoundary('dist/src/{{name}}')],\n\t\tbuild: {\n\t\t\toutDir: 'dist/src/{{name}}',\n\t\t\temptyOutDir: true,\n\t\t\t// Preserve the authored layer-order statement in the published sheet.\n\t\t\tcssMinify: false,\n\t\t\tlib: {\n\t\t\t\tentry: resolveWorkspacePath('src/{{name}}/sheet.ts'),\n\t\t\t\tformats: ['es'],\n\t\t\t\tfileName: 'index',\n\t\t\t\tcssFileName: 'index',\n\t\t\t},\n\t\t},\n\t\ttest: { include: ['tests/src/{{name}}/**/*.test.ts'] },\n\t})\n\treturn { ...project, mode: invocation.mode }\n})\n`,\n\t\tsrc: Object.freeze({\n\t\t\tcore: `import { defineConfig } from 'vite'\nimport {\n\tdeclarationRollup,\n\tenvironmentBoundary,\n\toutputBoundary,\n\tresolveExternal,\n} from '../helpers.js'\nimport { peers, 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\tdeclarationRollup({\n\t\t\t\tproject: resolveWorkspacePath('configs/src/tsconfig.core.json'),\n\t\t\t\ttypes: ['node'],\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: string) => (format === 'es' ? 'index.js' : 'index.cjs'),\n\t\t\t},\n\t\t\toutDir: 'dist/src/core',\n\t\t\trolldownOptions: {\n\t\t\t\texternal: (id: string) => resolveExternal(id, { peers, refused: [], siblings: [] }),\n\t\t\t},\n\t\t},\n\t}),\n)\n`,\n\t\t\tvue: `import { defineConfig } from 'vite'\nimport {\n\tdeclarationRollup,\n\tresolveExternal,\n\trewriteBrowserSpecifier,\n\trewriteCoreSpecifier,\n} from '../helpers.js'\nimport { peers, srcVue, resolveWorkspacePath } from '../../vite.config.ts'\n\nconst siblings = {\n{{siblings}}\n}\n\nexport default defineConfig(\n\tsrcVue({\n\t\tplugins: [\n\t\t\tdeclarationRollup({\n\t\t\t\tproject: resolveWorkspacePath('configs/src/tsconfig.vue.json'),\n\t\t\t\trewrite: (content) => rewriteBrowserSpecifier(rewriteCoreSpecifier(content)),\n\t\t\t}),\n\t\t],\n\t\tbuild: {\n\t\t\trolldownOptions: {\n\t\t\t\texternal: (id: string) =>\n\t\t\t\t\tresolveExternal(id, {\n\t\t\t\t\t\tpeers,\n\t\t\t\t\t\trefused: {{refused}},\n\t\t\t\t\t\tsiblings: Object.keys(siblings),\n\t\t\t\t\t}),\n\t\t\t\toutput: { paths: siblings },\n\t\t\t},\n\t\t},\n\t}),\n)\n`,\n\t\t\tbrowser: `import { defineConfig } from 'vite'\nimport { declarationRollup, rewriteCoreSpecifier } from '../helpers.js'\nimport { srcBrowser, resolveWorkspacePath } from '../../vite.config.ts'\n\n// The roll-up reaches src/core through a specifier the tarball does not carry, so the rewrite\n// externalizes core through the package's own published root export, on the final roll-up alone.\nexport default defineConfig(\n\tsrcBrowser({\n\t\tplugins: [\n\t\t\tdeclarationRollup({\n\t\t\t\tproject: resolveWorkspacePath('configs/src/tsconfig.browser.json'),\n\t\t\t\trewrite: rewriteCoreSpecifier,\n\t\t\t}),\n\t\t],\n\t}),\n)\n`,\n\t\t\tserver: `import { defineConfig } from 'vite'\nimport { declarationRollup, rewriteCoreSpecifier } from '../helpers.js'\nimport { srcServer, resolveWorkspacePath } from '../../vite.config.ts'\n\n// The roll-up reaches src/core through a specifier the tarball does not carry, so the rewrite\n// externalizes core through the package's own published root export, on the final roll-up alone.\nexport default defineConfig(\n\tsrcServer({\n\t\tplugins: [\n\t\t\tdeclarationRollup({\n\t\t\t\tproject: resolveWorkspacePath('configs/src/tsconfig.server.json'),\n\t\t\t\trewrite: rewriteCoreSpecifier,\n\t\t\t}),\n\t\t],\n\t}),\n)\n`,\n\t\t}),\n\t\tbin: `import { defineConfig } from 'vite'\nimport { resolveExternal } from '../helpers.js'\nimport { peers, 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 through\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\texternal: (id: string) =>\n\t\t\t\t\tid.startsWith('@src/') || resolveExternal(id, { peers, refused: [], siblings: [] }),\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\tvue: `import { defineConfig } from 'vite'\nimport { appVue } from '../../vite.config.ts'\n\nexport default defineConfig(appVue())\n`,\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(({ mode }) => appShowcase(mode))\n`,\n\t\t\tjourney: `import type { JourneyVariant } from '@orkestrel/test'\nimport { defineConfig } from 'vitest/config'\nimport { appJourney } from '../../vite.config.ts'\n\n// Rename and extend these viewports for the application. Apply themes through its interface.\nconst VARIANTS: readonly JourneyVariant[] = Object.freeze([\n\t{ name: 'desktop', width: 1280, height: 800 },\n\t{ name: 'compact', width: 390, height: 844 },\n])\n\nexport default defineConfig(({ mode }) => ({\n\ttest: {\n\t\tprojects: VARIANTS.map((variant) => () => appJourney(variant, VARIANTS, mode)),\n\t},\n}))\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 * Lists the Chromium executable layouts inside a \\`chromium-<revision>\\` browsers-directory\n * entry, per 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/** Matches the \\`chromium-<revision>\\` entry name Playwright installs one managed build into. */\nexport const CHROMIUM_ENTRY_PATTERN = /^chromium-\\\\d+$/\n\n/** Matches the revision number carried by any path containing a \\`chromium-<revision>\\` segment. */\nexport const CHROMIUM_REVISION_PATTERN = /chromium-(\\\\d+)/\n\n/** Names the directory a managed Linux container installs its bundled Playwright browsers into. */\nexport const BUNDLED_BROWSERS_ROOT = '/opt/pw-browsers'\n\n/**\n * Lists the 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/** Lists the 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 * Determines whether a path identifies an executable regular file.\n *\n * @param path - The filesystem path to inspect.\n * @returns True if the path is a regular file with execute access; false otherwise.\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 * Orders 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 * Reads 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 * Resolves 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\t// One \\`dirname\\` per path segment reaches the root from any path, and the nearest\n\t// ancestor named \\`chromium-<revision>\\` is the revision directory this build sits in.\n\tconst directory = dirname(pinned)\n\tconst ancestors = directory\n\t\t.split(/[\\\\\\\\/]/u)\n\t\t.reduce<string[]>((chain) => [...chain, dirname(chain.at(-1) ?? directory)], [directory])\n\tconst revisionRoot = ancestors.find((ancestor) => CHROMIUM_ENTRY_PATTERN.test(basename(ancestor)))\n\tif (revisionRoot === undefined) return undefined\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\ttry {\n\t\tconst revisions = readdirSync(browsersRoot)\n\t\t\t.filter((entry) => CHROMIUM_ENTRY_PATTERN.test(entry))\n\t\t\t.sort(compareRevisions)\n\t\tfor (const revision of revisions) {\n\t\t\tfor (const layout of CHROMIUM_LAYOUTS) {\n\t\t\t\tconst candidate = resolvePath(browsersRoot, revision, layout)\n\t\t\t\tif (isBrowserExecutable(candidate)) return candidate\n\t\t\t}\n\t\t}\n\t\treturn undefined\n\t} catch {\n\t\treturn undefined\n\t}\n}\n\n/**\n * Resolves 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\ttry {\n\t\t\tfor (const match of globSync(layout, { cwd: root }).sort(compareRevisions)) {\n\t\t\t\tconst candidate = resolvePath(root, match)\n\t\t\t\tif (isBrowserExecutable(candidate)) return candidate\n\t\t\t}\n\t\t} catch {\n\t\t\treturn undefined\n\t\t}\n\t}\n\treturn undefined\n}\n\n/**\n * Resolves the first installed stable system Chromium channel.\n *\n * @param platform - The Node platform whose standard layouts this call probes.\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(\n\t\tplatform === 'win32'\n\t\t\t? [\n\t\t\t\t\t...[\n\t\t\t\t\t\tenvironment.LOCALAPPDATA,\n\t\t\t\t\t\tenvironment.PROGRAMFILES,\n\t\t\t\t\t\tenvironment['PROGRAMFILES(X86)'],\n\t\t\t\t\t].flatMap((root) => (root !== undefined && root.length > 0 ? [root] : [])),\n\t\t\t\t\t...[environment.HOMEDRIVE].flatMap((homeDrive) =>\n\t\t\t\t\t\thomeDrive !== undefined && homeDrive.length > 0\n\t\t\t\t\t\t\t? [join(homeDrive, 'Program Files'), join(homeDrive, 'Program Files (x86)')]\n\t\t\t\t\t\t\t: [],\n\t\t\t\t\t),\n\t\t\t\t]\n\t\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 * Resolves Playwright provider options for Chromium on this host.\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 this call probes.\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 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. Every resolved\n * managed path names the full Chromium executable so headless launches retain browser permissions.\n * Only a discovered system channel is verified before it is named. The platform default is\n * unverified as well and exists only as a last resort: Windows takes \\`msedge\\`, which ships with the\n * OS and never collides with a foreground Chrome.\n *\n * Set \\`PLAYWRIGHT_SCROLLBARS=classic\\` only for runs that measure scrollbar compensation, never\n * for a standing gate. Every Chromium launch in that run omits Playwright's \\`--hide-scrollbars\\`\n * default argument so classic scrollbars can take layout space in every case. An empty or unset\n * value preserves the launch defaults; any other value throws an \\`Error\\`. Pairing \\`classic\\`\n * with \\`PLAYWRIGHT_WS_ENDPOINT\\` throws an \\`Error\\`, even with an executable override, because the\n * server owns the launch.\n *\n * The resolver and the gate cover Chromium alone. Reopen engine selection when another\n * Playwright engine is installed and launches on the host with a \\`captureFrame\\` reading\n * back at its declared size, or when a journey or style divergence is recorded.\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 scrollbars = environment.PLAYWRIGHT_SCROLLBARS\n\tif (scrollbars !== undefined && scrollbars.length > 0 && scrollbars !== 'classic') {\n\t\tthrow new Error('PLAYWRIGHT_SCROLLBARS must be classic or empty')\n\t}\n\tconst endpoint = environment.PLAYWRIGHT_WS_ENDPOINT\n\tif (scrollbars === 'classic' && endpoint !== undefined && endpoint.length > 0) {\n\t\tthrow new Error('PLAYWRIGHT_SCROLLBARS=classic cannot be used with PLAYWRIGHT_WS_ENDPOINT')\n\t}\n\tconst launch: PlaywrightProviderOptions['launchOptions'] =\n\t\tscrollbars === 'classic' ? { ignoreDefaultArgs: ['--hide-scrollbars'] } : {}\n\tconst executable = environment.PLAYWRIGHT_EXECUTABLE_PATH\n\tif (executable !== undefined && executable.length > 0) {\n\t\treturn { launchOptions: { executablePath: executable, ...launch } }\n\t}\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, ...launch } }\n\t}\n\tconst managed = pinned === undefined ? undefined : resolveManagedBrowser(pinned)\n\tif (managed !== undefined) {\n\t\treturn { launchOptions: { executablePath: managed, ...launch } }\n\t}\n\tconst bundled = resolveBundledBrowser(platform, root)\n\tif (bundled !== undefined) return { launchOptions: { executablePath: bundled, ...launch } }\n\tconst fallback = platform === 'win32' ? 'msedge' : 'chrome'\n\treturn {\n\t\tlaunchOptions: { channel: resolveSystemBrowser(platform, environment) ?? fallback, ...launch },\n\t}\n}\n`,\n\tcommands: `import type { BrowserConfigOptions } from 'vitest/node'\n\nexport const commands: Readonly<NonNullable<BrowserConfigOptions['commands']>> = Object.freeze({})\n`,\n})\n\n/**\n * Holds 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\tsheet: Object.freeze({\n\t\t\t'index.scss': \"@use 'tokens';\\n@use 'elements';\\n@use 'components';\\n@use 'utilities';\\n\",\n\t\t\t'_tokens.scss': '@layer theme, reset, base, elements, components, utilities;\\n',\n\t\t\t'_mixins.scss': '',\n\t\t\t'elements/_index.scss': '',\n\t\t\t'components/_index.scss': '',\n\t\t\t'utilities/_index.scss': '',\n\t\t\t'sheet.ts': \"import './index.scss'\\n\",\n\t\t\t'index.ts': \"export * from './sheet.js'\\n\",\n\t\t}),\n\t\tthemes: Object.freeze({\n\t\t\t'index.scss': \"@use '../tokens';\\n@use 'default';\\n\",\n\t\t\t'_default.scss': '',\n\t\t\t'sheet.ts': \"import './index.scss'\\n\",\n\t\t}),\n\t\tempty: '',\n\t\tbarrel: '// TODO: [Feature] Export the browser extension API.\\n',\n\t\tmain: `document.body\n\t.appendChild(document.createElement('main'))\n\t.appendChild(document.createElement('h1')).textContent ={{heading}}\n`,\n\t\tvue: Object.freeze({\n\t\t\t'main.ts': `import { createApp } from 'vue'\nimport App from './App.vue'\n\ncreateApp(App).mount(document.body.appendChild(document.createElement('main')))\n`,\n\t\t\t'App.vue': `<template>\n\t<h1>{{heading}}</h1>\n</template>\n`,\n\t\t}),\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\tjourney: `import {\n\tACCESSIBLE_ROLES,\n\tcreatePortfolio,\n\texpandCaptures,\n\tisRendered,\n\treadRefusal,\n\treadStyle,\n} from '@orkestrel/test/browser'\n{{imports}}import { page } from 'vitest/browser'\nimport { describe, expect, inject, it } from 'vitest'\n\nconst VARIANT = inject('variant')\nconst VARIANTS = inject('variants')\nconst CAPTURE = inject('capture')\n\ndescribe('{{application}} arrival journey', () => {\n\tit('proves the declared arrival families', async () => {\n\t\tconst families = ['Journey', 'Refusal', 'Matrix', ...(CAPTURE ? ['Capture'] : [])]\n\t\tconst proven: string[] = []\n\t\tconst states = ['{{application}}-arrival']\n\t\tconst placed: string[] = []\n\t\tconst portfolio = createPortfolio({\n\t\t\tstates,\n\t\t\tvariants: VARIANTS,\n\t\t\tvariant: VARIANT,\n\t\t\tdirectory: '../../../tmp/captures/states',\n\t\t\tenabled: CAPTURE,\n\t\t})\n{{mount}}\t\ttry {\n{{arrival}}\t\t\tconst heading = page\n\t\t\t\t.getByRole('heading', {\n\t\t\t\t\tname: {{heading}},\n\t\t\t\t\texact: true,\n\t\t\t\t\tlevel: 1,\n\t\t\t\t})\n\t\t\t\t.element()\n\t\t\texpect(isRendered(heading)).toBe(true)\n\t\t\tproven.push('Journey')\n\t\t\tawait portfolio.place('{{application}}-arrival')\n\t\t\tplaced.push('{{application}}-arrival')\n\n\t\t\tfor (const role of ACCESSIBLE_ROLES) expect(page.getByRole(role).elements()).toEqual([])\n\t\t\texpect(readRefusal('Continue')).toBe(\n\t\t\t\t'No interactive element has the accessible name \"Continue\"',\n\t\t\t)\n\t\t\tproven.push('Refusal')\n\n\t\t\tconst measured: string[] = []\n\t\t\tfor (const variant of VARIANTS) {\n\t\t\t\tawait page.viewport(variant.width, variant.height)\n\t\t\t\texpect(readStyle(heading, 'display')).toBe('block')\n\t\t\t\texpect(window.innerWidth).toBe(variant.width)\n\t\t\t\tmeasured.push(variant.name)\n\t\t\t}\n\t\t\texpect(measured).toEqual(VARIANTS.map(({ name }) => name))\n\t\t\tproven.push('Matrix')\n\n\t\t\tconst files = expandCaptures(states, VARIANTS)\n\t\t\texpect(portfolio.files).toEqual(files)\n\t\t\texpect(new Set(files).size).toBe(states.length * VARIANTS.length)\n\t\t\texpect(placed).toEqual(states)\n\t\t\tconst expected = CAPTURE\n\t\t\t\t? expandCaptures(\n\t\t\t\t\t\tstates,\n\t\t\t\t\t\tVARIANTS.filter(({ name }) => name === VARIANT),\n\t\t\t\t\t)\n\t\t\t\t: []\n\t\t\texpect(portfolio.paths.map((path) => path.replaceAll('\\\\\\\\', '/').split('/').at(-1))).toEqual(\n\t\t\t\texpected,\n\t\t\t)\n\t\t\tif (CAPTURE) proven.push('Capture')\n\t\t\texpect(proven).toEqual(families)\n\t\t} finally {\n{{cleanup}}\t\t\tconst variant = VARIANTS.find(({ name }) => name === VARIANT)\n\t\t\tif (variant !== undefined) await page.viewport(variant.width, variant.height)\n\t\t}\n\t})\n})\n`,\n\t\tbrowser: `import type { JourneyVariant } from '@orkestrel/test'\n\ndeclare module 'vitest' {\n\texport interface ProvidedContext {\n\t\treadonly variant: string\n\t\treadonly variants: readonly JourneyVariant[]\n\t\treadonly capture: boolean\n\t}\n}\n`,\n\t\tsheet: `import sheet from '{{root}}dist/src/{{name}}/index.css?raw'\nimport { adoptSheet, readLayerNames } from '@orkestrel/test/browser'\nimport { describe, expect, it } from 'vitest'\n\ndescribe('{{name}} entry', () => {\n\tit('opens with the declared cascade order', () => {\n\t\tconst adopted = adoptSheet(sheet)\n\t\ttry {\n\t\t\texpect(adopted.sheet.cssRules[0]?.cssText).toBe(\n\t\t\t\t'@layer theme, reset, base, elements, components, utilities;',\n\t\t\t)\n\t\t\texpect(readLayerNames(adopted.sheet).slice(0, 6)).toEqual([\n\t\t\t\t'theme',\n\t\t\t\t'reset',\n\t\t\t\t'base',\n\t\t\t\t'elements',\n\t\t\t\t'components',\n\t\t\t\t'utilities',\n\t\t\t])\n\t\t} finally {\n\t\t\tadopted.release()\n\t\t}\n\t})\n})\n`,\n\t\tstyles: Object.freeze({\n\t\t\tmodule: '',\n\t\t\tproof: '',\n\t\t}),\n\t\tsetup: '',\n\t\tglobal: Object.freeze({\n\t\t\tmodule: `export function setup(): void {}\n`,\n\t\t\tproof: `import { describe, expect, it } from 'vitest'\nimport { setup } from './setupGlobal.js'\n\ndescribe('global setup', () => {\n\tit('runs without producing a teardown', () => {\n\t\texpect(setup()).toBeUndefined()\n\t\texpect(setup()).toBeUndefined()\n\t})\n})\n`,\n\t\t}),\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\tdistribution: Object.freeze({\n\t\t\tmodule: `{{types}}import type { SpawnSyncReturns } from 'node:child_process'\nimport type { TestContext } from 'vitest'\nimport { spawnSync } from 'node:child_process'\nimport {\n\texistsSync,\n\tmkdirSync,\n\tmkdtempSync,\n\treaddirSync,\n\treadFileSync,\n\trmSync,\n\tstatSync,\n\twriteFileSync,\n} from 'node:fs'\n{{transport}}import { createRequire } from 'node:module'\nimport { tmpdir } from 'node:os'\nimport { dirname, join, relative as relativePath, resolve, sep } from 'node:path'\nimport { fileURLToPath, pathToFileURL } from 'node:url'\nimport { isDeepStrictEqual } from 'node:util'\nimport { parseSync } from 'vite'\n{{launcher}}\n/** Defines the lifecycle and installed consumer read by a distribution proof. */\nexport interface DistributionSuiteInterface {\n\treadonly scratch: string\n\tstart(): void\n\tread(context: TestContext): DistributionStage\n\tdestroy(): void\n}\n\n/** Holds the observed and required values for one distribution assertion. */\nexport interface DistributionObservation {\n\treadonly actual: unknown\n\treadonly expected: unknown\n}\n\n/** Defines one independently registered distribution observation. */\nexport interface DistributionCase {\n\treadonly label: string\n\treadonly observe: (\n\t\tcontext: TestContext,\n\t) => DistributionObservation | Promise<DistributionObservation>\n}\n\n/** Holds the installed export map's classified publications. */\nexport interface DistributionClassification {\n\treadonly entries: readonly DistributionEntry[]\n\treadonly subpaths: readonly string[]\n\treadonly undeclared: readonly string[]\n\treadonly excluded: readonly string[]\n\treadonly targets: readonly string[]\n}\n\n/** Names the workspace whose packed artifact the proof consumes. */\nexport const DISTRIBUTION_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..')\n/** Names the npm executable on the running host. */\nexport const DISTRIBUTION_NPM = process.platform === 'win32' ? 'npm.cmd' : 'npm'\n// The compiler this workspace installs, run as a command rather than called in\n// process: the command and its plain-text diagnostics are the same across the\n// compiler majors this toolchain supports, and its in-process API is not. It is\n// resolved from the workspace under proof, so a consumer of the packed artifact is\n// checked by the same compiler that workspace's own \\`check\\` script runs. TypeScript 7 exports\n// \\`package.json\\` but not \\`bin/tsc\\`, so the path is joined from the manifest's directory.\n/** Names the TypeScript manifest installed by the workspace under proof. */\nexport const DISTRIBUTION_TYPESCRIPT = createRequire(\n\tjoin(DISTRIBUTION_ROOT, 'package.json'),\n).resolve('typescript/package.json')\n/** Names the compiler installed by the workspace under proof. */\nexport const DISTRIBUTION_COMPILER = join(dirname(DISTRIBUTION_TYPESCRIPT), 'bin', 'tsc')\n// Windows needs a shell to launch a \\`.cmd\\`: Node refuses one directly since the\n// batch-argument hardening, and \\`spawnSync\\` returns \\`EINVAL\\` with a null status\n// rather than an exit code a caller can read. Every following argument is a literal or\n// a path this file built, so the shell has nothing to escape.\n/** Selects the Windows command-shell route required by the npm shim. */\nexport const DISTRIBUTION_SHELL = process.platform === 'win32'\n// \\`prepublishOnly\\` runs this proof as \\`npm run test:distribution -- --mode release\\`,\n// and the root configuration's project factories carry that mode into this project.\n// Release is the publish gate, so evidence it cannot obtain fails there and skips\n// everywhere else: a gate that passes on missing evidence proves nothing.\n/** Indicates whether missing prerequisites must fail the publish gate. */\nexport const DISTRIBUTION_RELEASE = import.meta.env?.MODE === 'release'\n// The built output directory convention a browser face may publish from. Every\n// selection reads this prefix off the export target and never off the subpath name. A\n// workspace whose only published face is the browser one publishes that face at the\n// root subpath, so a rule keyed on the subpath name drives a browser bundle through\n// Node and the miss is silent.\n/** Names the conventional output prefix for a browser publication. */\nexport const DISTRIBUTION_BROWSER_OUTPUT = './dist/src/browser/'\n/** Names the unpublished subpath used as a resolution control. */\nexport const DISTRIBUTION_ABSENT_SUBPATH = '/no-subpath-is-published-under-this-name'\n// A compiler diagnostic that says where it is: the path relative to the directory\n// the compiler ran in, the 1-based line and column, the code, and the message. The\n// diagnostics are the verdict rather than the exit code, which differs between the\n// compiler majors this toolchain supports, so a reported line matching nothing here\n// came from something other than a check of a consumer module.\n/** Matches the location prefix of a consumer compiler diagnostic. */\nexport const DISTRIBUTION_DIAGNOSTIC_PATTERN = /^(.+?)\\\\(\\\\d+,\\\\d+\\\\): error TS\\\\d+: /u\n/** Lists the bounded registry-readiness command arguments. */\nexport const DISTRIBUTION_PING = Object.freeze([\n\t'ping',\n\t'--fetch-retries=0',\n\t'--fetch-timeout=5000',\n\t'--loglevel=silent',\n])\n/** Names the consumer entry that imports an installed module. */\nexport const DISTRIBUTION_ESM_DRIVER = 'drive.mjs'\n/** Names the consumer entry that requires an installed module. */\nexport const DISTRIBUTION_CJS_DRIVER = 'drive.cjs'\n/** Defines the isolated consumer package manifest. */\nexport const DISTRIBUTION_CONSUMER_MANIFEST =\n\t'{ \"name\": \"distribution-consumer\", \"private\": true, \"type\": \"module\" }\\\\n'\n/** Reads the names exported by an installed ESM entry. */\nexport const DISTRIBUTION_ESM_DRIVER_SOURCE = \\`const entry = await import(process.argv[2])\nprocess.stdout.write(JSON.stringify(Object.keys(entry).sort()))\n\\`\n/** Reads the names exported by an installed CommonJS entry. */\nexport const DISTRIBUTION_CJS_DRIVER_SOURCE = \\`const entry = require(process.argv[2])\nprocess.stdout.write(JSON.stringify(Object.keys(entry).sort()))\n\\`\n\n// The extensions a JavaScript handler loads as modules. Node loads a native addon\n// through its addon handler instead, so that extension is named separately.\n/** Lists extensions loaded as JavaScript modules. */\nexport const DISTRIBUTION_MODULE_EXTENSIONS = Object.freeze(['.js', '.mjs', '.cjs'])\n/** Names the extension loaded by the native-addon handler. */\nexport const DISTRIBUTION_ADDON_EXTENSION = '.node'\n// The extensions a declaration file carries. A \\`require\\` condition declares\n// \\`.d.cts\\` and an ESM-only one \\`.d.mts\\`, so the \\`.d.ts\\` spelling alone does not\n// name them.\n/** Lists the supported TypeScript declaration extensions. */\nexport const DISTRIBUTION_DECLARATION_EXTENSIONS = Object.freeze(['.d.ts', '.d.cts', '.d.mts'])\n/** Names the module format of a typed consumer. */\nexport type DistributionFormat = 'module' | 'commonjs'\n\n// The Node import target is resolved with the conditions that driver supplies. The\n// CommonJS compile probe is selected from its declaration's format, and its runtime\n// drive loads the same subpath through Node's require resolver. Vite's production\n// client build enables its module and browser conditions.\n/** Defines the conditions each runtime uses to resolve an entry. */\nexport const DISTRIBUTION_RUNTIME_CONDITIONS = Object.freeze({\n\tmodule: Object.freeze(['node-addons', 'node', 'import', 'module-sync']),\n\tcommonjs: Object.freeze(['node-addons', 'node', 'require', 'module-sync']),\n\tbrowser: Object.freeze(['module', 'browser', 'production', 'import']),\n})\n// TypeScript's Node resolutions add \\`node\\` to the format condition. Its bundler\n// resolution does not, so a browser drive compares against the declaration a bundler\n// consumer reads rather than borrowing the Node declaration.\n/** Defines the declaration conditions used by bundler consumers. */\nexport const DISTRIBUTION_BUNDLER_CONDITIONS = Object.freeze({\n\tmodule: Object.freeze(['types', 'import']),\n\tcommonjs: Object.freeze(['types', 'require']),\n})\n/** Defines the declaration conditions paired with each runtime. */\nexport const DISTRIBUTION_DECLARATION_CONDITIONS = Object.freeze({\n\tmodule: Object.freeze(['types', 'node', 'import']),\n\tcommonjs: Object.freeze(['types', 'node', 'require']),\n\tbrowser: DISTRIBUTION_BUNDLER_CONDITIONS.module,\n})\n\n/** Describes the compiler options and conditions for one consumer resolution. */\nexport interface DistributionResolution {\n\treadonly label: string\n\treadonly resolution: string\n\treadonly module: string\n\treadonly conditions: Readonly<Record<DistributionFormat, readonly string[]>>\n}\n\n/** Holds the target selected by package condition resolution. */\nexport interface DistributionTargetResult {\n\treadonly target: string\n}\n\n// Each compile driver carries the compiler options its scratch project sets and\n// the conditions TypeScript applies for that resolution and importing format. A\n// \\`require\\`-only subpath therefore stays in each CommonJS probe that can resolve it.\n// The option values are the spellings the project file takes, so nothing here needs\n// the compiler's own API to name them.\n/** Lists the compiler resolutions driven against installed declarations. */\nexport const DISTRIBUTION_RESOLUTIONS: readonly DistributionResolution[] = Object.freeze([\n\t{\n\t\tlabel: 'node16',\n\t\tresolution: 'node16',\n\t\tmodule: 'node16',\n\t\tconditions: DISTRIBUTION_DECLARATION_CONDITIONS,\n\t},\n\t{\n\t\tlabel: 'nodenext',\n\t\tresolution: 'nodenext',\n\t\tmodule: 'nodenext',\n\t\tconditions: DISTRIBUTION_DECLARATION_CONDITIONS,\n\t},\n\t{\n\t\tlabel: 'bundler',\n\t\tresolution: 'bundler',\n\t\tmodule: 'esnext',\n\t\tconditions: DISTRIBUTION_BUNDLER_CONDITIONS,\n\t},\n])\n\n// The driver a bundled consumer reads declarations under. A browser application\n// compiles through a bundler, so the browser drive answers under this one alone,\n// and naming it here is what keeps that selection tied to the driver it selects.\n/** Selects the compiler resolution used by a browser consumer. */\nexport const DISTRIBUTION_BROWSER_RESOLUTION = DISTRIBUTION_RESOLUTIONS.find(\n\t(candidate) => candidate.label === 'bundler',\n)\nif (DISTRIBUTION_BROWSER_RESOLUTION === undefined)\n\tthrow new Error(\"DISTRIBUTION_RESOLUTIONS carries no 'bundler' row\")\n\n/** Pairs consumer source extensions with their module formats. */\nexport const DISTRIBUTION_FORMATS: ReadonlyArray<\n\treadonly [extension: string, format: DistributionFormat]\n> = Object.freeze([\n\t['ts', 'module'],\n\t['cts', 'commonjs'],\n])\n\n// One published subpath, resolved to what this proof can drive: the specifier a\n// consumer writes, whether the declarations its consumer formats resolve at all,\n// whether the exports map answers the browser condition with a target of its own,\n// whether it answers \\`import\\` and \\`require\\` at all, and whether the target that\n// \\`require\\` answers with is one that a CommonJS consumer loads.\n/** Describes one published subpath and its runtime and declaration capabilities. */\nexport interface DistributionEntry {\n\treadonly subpath: string\n\treadonly specifier: string\n\treadonly mapping: unknown\n\treadonly declaration: {\n\t\treadonly importable: boolean\n\t\treadonly requirable: boolean\n\t\treadonly browsable: boolean\n\t}\n\treadonly browsable: boolean\n\treadonly importable: boolean\n\treadonly requirable: boolean\n\treadonly loadable: boolean\n}\n\n// The installed tree every claim is read from. Every subpath the exports map names\n// lands in exactly one of \\`entries\\`, \\`undeclared\\`, and \\`excluded\\`, so a subpath this\n// proof cannot drive is reported rather than dropped.\n/** Holds the installed consumer and the partition of its published subpaths. */\nexport interface DistributionStage {\n\treadonly consumer: string\n\treadonly installed: string\n\treadonly archives: readonly string[]\n\treadonly entries: readonly DistributionEntry[]\n\treadonly subpaths: readonly string[]\n\treadonly undeclared: readonly string[]\n\treadonly excluded: readonly string[]\n\treadonly targets: readonly string[]\n}\n\n/**\n * Checks whether a value is a non-null object other than an array.\n *\n * @param value - The value to inspect.\n * @returns True if the value is a record; false otherwise.\n */\nexport function isDistributionRecord(value: unknown): value is Readonly<Record<string, unknown>> {\n\treturn typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\n/**\n * Checks whether a value is an array of strings.\n *\n * @param value - The value to inspect.\n * @returns True if every array member is a string; false otherwise.\n */\nexport function isDistributionNames(value: unknown): value is readonly string[] {\n\treturn Array.isArray(value) && value.every((name) => typeof name === 'string')\n}\n\n// A fallback list, which is what Node reads an array in an exports entry as. The\n// narrowing is what the following walkers need: \\`Array.isArray\\` widens an \\`unknown\\`\n// member to \\`any\\`, and an entry read that way is not read at all.\n/**\n * Checks whether a value is a fallback array.\n *\n * @param value - The value to inspect.\n * @returns True if the value is an array; false otherwise.\n */\nexport function isDistributionList(value: unknown): value is readonly unknown[] {\n\treturn Array.isArray(value)\n}\n\n// Whether a string is a valid package target. Node rejects a target outside the\n// package and a target containing a dot, parent, or node_modules segment during\n// package-target resolution. A later module-resolution failure is not the same\n// thing: an array falls through the former and keeps the latter.\n/**\n * Checks whether a relative package target contains only admitted segments.\n *\n * @param target - The package-relative target.\n * @returns True if the target passes package-target validation; false otherwise.\n */\nexport function matchesDistributionPackageTarget(target: string): boolean {\n\tif (!target.startsWith('./')) return false\n\tconst refused = ['.', '..', 'node_modules']\n\treturn target\n\t\t.slice(2)\n\t\t.split(/[\\\\\\\\/]/u)\n\t\t.every((segment) => {\n\t\t\ttry {\n\t\t\t\treturn !refused.includes(decodeURIComponent(segment).toLowerCase())\n\t\t\t} catch {\n\t\t\t\treturn !refused.includes(segment.toLowerCase())\n\t\t\t}\n\t\t})\n}\n\n/**\n * Reads and parses a JSON file.\n *\n * @param path - The file to read.\n * @returns The parsed value. Throws when reading or parsing fails.\n */\nexport function readDistributionJSON(path: string): unknown {\n\tconst parsed: unknown = JSON.parse(readFileSync(path, 'utf8'))\n\treturn parsed\n}\n\n/**\n * Reads the package name from a manifest.\n *\n * @param path - The manifest to read.\n * @returns The package name. Throws when the manifest has no string name.\n */\nexport function readDistributionManifestName(path: string): string {\n\tconst manifest = readDistributionJSON(path)\n\tif (!isDistributionRecord(manifest) || typeof manifest.name !== 'string') {\n\t\tthrow new Error(\\`The manifest at \\${path} declares no package name\\`)\n\t}\n\treturn manifest.name\n}\n\n// A host carries a package's required peers at its own root. A consumer that carries none leaves\n// npm to place them, and npm can then resolve an optional peer of a peer to a release the\n// package's own range refuses, so the consumer declares them as a host would.\n/**\n * Reads the peers a host must carry: every peer dependency its metadata does not mark optional.\n *\n * @param path - The manifest to read.\n * @returns Each required peer's name mapped to its declared range.\n */\nexport function readDistributionPeers(path: string): Readonly<Record<string, string>> {\n\tconst manifest = readDistributionJSON(path)\n\tif (!isDistributionRecord(manifest) || !isDistributionRecord(manifest.peerDependencies)) {\n\t\treturn {}\n\t}\n\tconst meta = isDistributionRecord(manifest.peerDependenciesMeta)\n\t\t? manifest.peerDependenciesMeta\n\t\t: undefined\n\tconst peers = Object.entries(manifest.peerDependencies).filter(\n\t\t(entry): entry is [string, string] => typeof entry[1] === 'string',\n\t)\n\treturn Object.fromEntries(\n\t\tpeers.filter(([name]) => {\n\t\t\tconst entry = meta?.[name]\n\t\t\treturn !isDistributionRecord(entry) || entry.optional !== true\n\t\t}),\n\t)\n}\n\n/**\n * Writes the consumer manifest, declaring the required peers as dependencies.\n *\n * @param peers - Each required peer's name mapped to its declared range.\n * @returns The manifest text; the bare manifest when the package declares no required peer.\n */\nexport function createDistributionConsumerManifest(\n\tpeers: Readonly<Record<string, string>>,\n): string {\n\tconst manifest: unknown = JSON.parse(DISTRIBUTION_CONSUMER_MANIFEST)\n\tif (Object.keys(peers).length === 0 || !isDistributionRecord(manifest)) {\n\t\treturn DISTRIBUTION_CONSUMER_MANIFEST\n\t}\n\treturn \\`\\${JSON.stringify({ ...manifest, dependencies: peers })}\\\\n\\`\n}\n\n/**\n * Writes a consumer file after creating its parent directory.\n *\n * @param path - The file to write.\n * @param content - The text to write.\n */\nexport function writeDistributionFile(path: string, content: string): void {\n\tmkdirSync(dirname(path), { recursive: true })\n\twriteFileSync(path, content)\n}\n\n/**\n * Combines the output streams of a completed command.\n *\n * @param result - The completed command.\n * @returns The trimmed diagnostic text.\n */\nexport function readDistributionOutput(result: SpawnSyncReturns<string>): string {\n\treturn \\`\\${result.stdout ?? ''}\\${result.stderr ?? ''}\\`.trim()\n}\n\n/**\n * Runs npm with a cache inside the owned scratch directory.\n *\n * @param args - The npm arguments.\n * @param cwd - The working directory.\n * @param scratch - The owned scratch root.\n * @returns The command status and captured streams.\n */\nexport function runDistributionNpm(\n\targs: readonly string[],\n\tcwd: string,\n\tscratch: string,\n): SpawnSyncReturns<string> {\n\treturn spawnSync(DISTRIBUTION_NPM, [...args], {\n\t\tcwd,\n\t\tencoding: 'utf8',\n\t\tenv: { ...process.env, npm_config_cache: join(scratch, 'cache') },\n\t\tshell: DISTRIBUTION_SHELL,\n\t\twindowsHide: true,\n\t})\n}\n\n/**\n * Runs a JavaScript entry with the running Node executable.\n *\n * @param args - The Node arguments.\n * @param cwd - The working directory.\n * @returns The command status and captured streams.\n */\nexport function runDistributionNode(\n\targs: readonly string[],\n\tcwd: string,\n): SpawnSyncReturns<string> {\n\treturn spawnSync(process.execPath, [...args], { cwd, encoding: 'utf8', windowsHide: true })\n}\n\n// Node's own condition matching, read in declaration order.\n/**\n * Resolves a package target through conditions and fallback arrays.\n *\n * @param entry - The exports-map entry.\n * @param conditions - The active resolution conditions.\n * @returns The selected target, or undefined when no branch resolves.\n */\nexport function resolveDistributionPackageTarget(\n\tentry: unknown,\n\tconditions: readonly string[],\n): DistributionTargetResult | undefined {\n\tif (typeof entry === 'string') return { target: entry }\n\tif (isDistributionList(entry)) {\n\t\tfor (const member of entry) {\n\t\t\tconst resolved = resolveDistributionPackageTarget(member, conditions)\n\t\t\tif (resolved !== undefined && matchesDistributionPackageTarget(resolved.target))\n\t\t\t\treturn resolved\n\t\t}\n\t\treturn undefined\n\t}\n\tif (!isDistributionRecord(entry)) return undefined\n\tfor (const [condition, nested] of Object.entries(entry)) {\n\t\tif (condition !== 'default' && !conditions.includes(condition)) continue\n\t\tconst resolved = resolveDistributionPackageTarget(nested, conditions)\n\t\tif (resolved !== undefined) return resolved\n\t}\n\treturn undefined\n}\n\n// A flat entry, a condition-nested entry, and a fallback list all resolve through\n// one walker. An entry may declare \\`types\\` beside \\`default\\` at its top level\n// rather than inside \\`import\\`, so a fixed \\`entry.import.types\\` lookup is not\n// equivalent to condition resolution.\n/**\n * Resolves the path selected by an exports-map entry.\n *\n * @param entry - The exports-map entry.\n * @param conditions - The active resolution conditions.\n * @returns The selected path, or undefined when no branch resolves.\n */\nexport function resolveDistributionTarget(\n\tentry: unknown,\n\tconditions: readonly string[],\n): string | undefined {\n\treturn resolveDistributionPackageTarget(entry, conditions)?.target\n}\n\n// Whether a path is a physical file. TypeScript's file-existence check refuses a\n// directory at the same spelling and continues to the outer package scope.\n/**\n * Checks whether a path names a physical file.\n *\n * @param path - The filesystem path.\n * @returns True if the path names a file; false otherwise.\n */\nexport function matchesDistributionFile(path: string): boolean {\n\ttry {\n\t\treturn statSync(path).isFile()\n\t} catch {\n\t\treturn false\n\t}\n}\n\n// TypeScript resolves a declaration target by accepting an existing declaration\n// directly or by substituting beside a JavaScript target. A missing target leaves\n// the containing condition or fallback list unresolved, so the walk continues.\n/**\n * Resolves an existing declaration beside a package target.\n *\n * @param target - The package-relative target.\n * @param installed - The installed package root.\n * @returns The declaration target, or undefined when no declaration exists.\n */\nexport function targetToDistributionDeclaration(\n\ttarget: string,\n\tinstalled: string,\n): string | undefined {\n\tif (!matchesDistributionPackageTarget(target)) return undefined\n\tconst declaration = target.endsWith('.cjs')\n\t\t? \\`\\${target.slice(0, -4)}.d.cts\\`\n\t\t: target.endsWith('.mjs')\n\t\t\t? \\`\\${target.slice(0, -4)}.d.mts\\`\n\t\t\t: target.endsWith('.js')\n\t\t\t\t? \\`\\${target.slice(0, -3)}.d.ts\\`\n\t\t\t\t: target\n\tif (declaration === target && !matchesDistributionDeclaration(target)) return undefined\n\treturn matchesDistributionFile(join(installed, declaration)) ? declaration : undefined\n}\n\n// The declaration TypeScript resolves through one importing format's conditions.\n// Condition objects keep manifest order, and arrays keep fallback order.\n/**\n * Resolves an existing declaration through consumer conditions.\n *\n * @param entry - The exports-map entry.\n * @param conditions - The active declaration conditions.\n * @param installed - The installed package root.\n * @returns The declaration target, or undefined when no branch resolves.\n */\nexport function resolveDistributionDeclaration(\n\tentry: unknown,\n\tconditions: readonly string[],\n\tinstalled: string,\n): string | undefined {\n\tif (typeof entry === 'string') return targetToDistributionDeclaration(entry, installed)\n\tif (isDistributionList(entry)) {\n\t\tfor (const member of entry) {\n\t\t\tconst resolved = resolveDistributionDeclaration(member, conditions, installed)\n\t\t\tif (resolved !== undefined) return resolved\n\t\t}\n\t\treturn undefined\n\t}\n\tif (!isDistributionRecord(entry)) return undefined\n\tfor (const [condition, nested] of Object.entries(entry)) {\n\t\tif (condition !== 'default' && !conditions.includes(condition)) continue\n\t\tconst resolved = resolveDistributionDeclaration(nested, conditions, installed)\n\t\tif (resolved !== undefined) return resolved\n\t}\n\treturn undefined\n}\n\n// The nearest package scope that decides a \\`.d.ts\\` declaration's module format. A\n// physical nested manifest starts a scope even when it omits \\`type\\` or cannot be\n// parsed. A directory at that spelling is not a manifest, so the walk continues.\n/**\n * Reads the nearest package scope for a target inside an installed package.\n *\n * @param installed - The installed package root.\n * @param target - The package-relative target.\n * @returns The manifest type, or undefined when the nearest scope omits it or cannot be read.\n */\nexport function readDistributionPackageType(installed: string, target: string): unknown {\n\t// One \\`dirname\\` per path segment reaches the root from any path. The walk ends at the\n\t// installed package, so no scope above it is consulted.\n\tconst start = dirname(join(installed, target))\n\tconst chain = start\n\t\t.split(/[\\\\\\\\/]/u)\n\t\t.reduce<string[]>((climbed) => [...climbed, dirname(climbed.at(-1) ?? start)], [start])\n\tconst end = chain.indexOf(installed)\n\tconst scope = chain\n\t\t.slice(0, end === -1 ? chain.length : end + 1)\n\t\t.find((directory) => matchesDistributionFile(join(directory, 'package.json')))\n\tif (scope === undefined) return undefined\n\ttry {\n\t\tconst manifest = readDistributionJSON(join(scope, 'package.json'))\n\t\treturn isDistributionRecord(manifest) ? manifest.type : undefined\n\t} catch {\n\t\treturn undefined\n\t}\n}\n\n/**\n * Checks whether an entry publishes a distinct or conventional browser target.\n *\n * @param entry - The exports-map entry.\n * @returns True if the entry requires a browser drive; false otherwise.\n */\nexport function resolvesDistributionBrowser(entry: unknown): boolean {\n\tconst module = resolveDistributionTarget(entry, DISTRIBUTION_RUNTIME_CONDITIONS.browser)\n\tif (module !== undefined && module.startsWith(DISTRIBUTION_BROWSER_OUTPUT)) return true\n\tif (module === undefined) return false\n\tconst imported = resolveDistributionTarget(entry, DISTRIBUTION_RUNTIME_CONDITIONS.module)\n\tconst required = resolveDistributionTarget(entry, DISTRIBUTION_RUNTIME_CONDITIONS.commonjs)\n\treturn module !== imported && module !== required\n}\n\n// Whether the target selected by Node's CommonJS conditions is a module require can\n// load. A JavaScript target takes its own nearest package scope. Native addons and\n// extensionless targets have their own CommonJS handlers.\n/**\n * Checks whether Node require can load an entry selected by its conditions.\n *\n * @param entry - The exports-map entry.\n * @param installed - The installed package root.\n * @returns True if the target has a CommonJS-compatible format; false otherwise.\n */\nexport function resolvesDistributionCommonJS(entry: unknown, installed: string): boolean {\n\tconst target = resolveDistributionTarget(entry, DISTRIBUTION_RUNTIME_CONDITIONS.commonjs)\n\tif (target === undefined) return false\n\tconst name = target.slice(target.lastIndexOf('/') + 1)\n\tif (name.endsWith('.cjs')) return true\n\tif (name.endsWith('.mjs')) return false\n\tif (name.endsWith('.node')) return true\n\tif (!name.includes('.')) return true\n\treturn name.endsWith('.js') && readDistributionPackageType(installed, target) !== 'module'\n}\n\n// Whether the declaration selected by a typed CommonJS consumer admits that entry.\n// A \\`.d.cts\\` declaration admits and a \\`.d.mts\\` declaration refuses. A \\`.d.ts\\`\n// declaration takes its own nearest package scope.\n/**\n * Checks whether an entry resolves a CommonJS-compatible declaration.\n *\n * @param entry - The exports-map entry.\n * @param installed - The installed package root.\n * @returns True if the selected declaration admits CommonJS consumption; false otherwise.\n */\nexport function declaresDistributionCommonJS(entry: unknown, installed: string): boolean {\n\tconst declaration = resolveDistributionDeclaration(\n\t\tentry,\n\t\tDISTRIBUTION_DECLARATION_CONDITIONS.commonjs,\n\t\tinstalled,\n\t)\n\tif (declaration === undefined) return false\n\tif (declaration.endsWith('.d.cts')) return true\n\tif (declaration.endsWith('.d.mts')) return false\n\treturn (\n\t\tdeclaration.endsWith('.d.ts') &&\n\t\treadDistributionPackageType(installed, declaration) !== 'module'\n\t)\n}\n\n// Every target an entry names under any condition. A fallback list omits members\n// Node rejects during package-target validation, because no reader can take them.\n/**\n * Collects the targets an entry publishes under every condition.\n *\n * @param entry - The exports-map entry.\n * @returns The targets, excluding invalid members of fallback arrays.\n */\nexport function collectDistributionTargets(entry: unknown): readonly string[] {\n\tif (typeof entry === 'string') return [entry]\n\tif (isDistributionList(entry))\n\t\treturn entry.flatMap(collectDistributionTargets).filter(matchesDistributionPackageTarget)\n\tif (!isDistributionRecord(entry)) return []\n\treturn Object.values(entry).flatMap((nested) => collectDistributionTargets(nested))\n}\n\n// Whether a target is a file a runtime loads for its names, which is what a\n// declaration is owed for. The extension on the target's own file name decides it,\n// and a name carrying no extension is code: \\`require\\` reads such a file through its\n// JavaScript handler, so an extensionless target loads and publishes names. Node\n// loads \\`.node\\` through its native-addon handler. Every other extension is an asset\n// a consumer reads rather than imports — a stylesheet, a WebAssembly binary, the\n// \\`\"./package.json\"\\` manifest pointer, and a declaration alike.\n// The cost is an extensionless file published for a reader, such as a \\`LICENSE\\`:\n// that target reports undeclared until it is given an extension or a declaration.\n/**\n * Checks whether a target names a runtime module rather than an asset.\n *\n * @param target - The package-relative target.\n * @returns True if the target has a module extension or no extension; false otherwise.\n */\nexport function matchesDistributionModule(target: string): boolean {\n\tconst name = target.slice(target.lastIndexOf('/') + 1)\n\tconst dot = name.lastIndexOf('.')\n\tif (name.endsWith(DISTRIBUTION_ADDON_EXTENSION)) return true\n\treturn dot === -1 || DISTRIBUTION_MODULE_EXTENSIONS.includes(name.slice(dot))\n}\n\n// Whether a resolved target is a declaration rather than the JavaScript a\n// \\`default\\` branch answers with when the entry declares no \\`types\\` condition.\n/**\n * Checks whether a target names a TypeScript declaration.\n *\n * @param target - The package-relative target.\n * @returns True if the target has a declaration extension; false otherwise.\n */\nexport function matchesDistributionDeclaration(target: string): boolean {\n\treturn DISTRIBUTION_DECLARATION_EXTENSIONS.some((extension) => target.endsWith(extension))\n}\n\n// The declarations the Node module, Node CommonJS, and browser drives compare\n// against. Each field uses the conditions of the TypeScript consumer paired with\n// that runtime. A JavaScript target resolves through TypeScript's adjacent\n// declaration substitution rather than standing in for the declaration itself.\n/**\n * Reads the declarations paired with Node and browser consumers.\n *\n * @param entry - The exports-map entry.\n * @param installed - The installed package root.\n * @returns The declaration selected by each consumer format.\n */\nexport function readDistributionDeclaration(\n\tentry: unknown,\n\tinstalled: string,\n): {\n\treadonly module: string | undefined\n\treadonly commonjs: string | undefined\n\treadonly browser: string | undefined\n} {\n\treturn {\n\t\tmodule: resolveDistributionDeclaration(\n\t\t\tentry,\n\t\t\tDISTRIBUTION_DECLARATION_CONDITIONS.module,\n\t\t\tinstalled,\n\t\t),\n\t\tcommonjs: resolveDistributionDeclaration(\n\t\t\tentry,\n\t\t\tDISTRIBUTION_DECLARATION_CONDITIONS.commonjs,\n\t\t\tinstalled,\n\t\t),\n\t\tbrowser: resolveDistributionDeclaration(\n\t\t\tentry,\n\t\t\tDISTRIBUTION_DECLARATION_CONDITIONS.browser,\n\t\t\tinstalled,\n\t\t),\n\t}\n}\n\n// The entries one compile driver can resolve under its own conditions.\n/**\n * Filters entries to those a consumer can resolve.\n *\n * @param entries - The installed entries.\n * @param conditions - The active consumer conditions.\n * @returns The matching entries in their original order.\n */\nexport function filterDistributionEntries(\n\tentries: readonly DistributionEntry[],\n\tconditions: readonly string[],\n): readonly DistributionEntry[] {\n\treturn entries.filter(\n\t\t(entry) =>\n\t\t\tresolveDistributionTarget(entry.mapping, conditions) !== undefined &&\n\t\t\t(!conditions.includes('require') || entry.loadable),\n\t)\n}\n\n// The compile drivers whose conditions reach one entry under one importing format.\n// A driver that resolves no target for that entry compiles nothing, so a consumer\n// written under it would report a resolution failure this package never made.\n/**\n * Filters compiler resolutions to those that can read an entry.\n *\n * @param entry - The installed entry.\n * @param format - The consumer module format.\n * @returns The matching compiler resolutions.\n */\nexport function filterDistributionResolutions(\n\tentry: DistributionEntry,\n\tformat: DistributionFormat,\n): readonly DistributionResolution[] {\n\treturn DISTRIBUTION_RESOLUTIONS.filter(\n\t\t(driver) => filterDistributionEntries([entry], driver.conditions[format]).length > 0,\n\t)\n}\n\n// Requirable entries that declare CommonJS support but a typed CommonJS consumer\n// cannot compile against. A default branch resolving under the require condition\n// set makes no CommonJS claim.\n/**\n * Filters entries whose require target lacks a compatible declaration.\n *\n * @param entries - The installed entries.\n * @param installed - The installed package root.\n * @returns The entries a CommonJS consumer cannot typecheck.\n */\nexport function filterDistributionUntypable(\n\tentries: readonly DistributionEntry[],\n\tinstalled: string,\n): readonly DistributionEntry[] {\n\treturn entries.filter(\n\t\t(entry) =>\n\t\t\tentry.requirable &&\n\t\t\tisDistributionRecord(entry.mapping) &&\n\t\t\tObject.hasOwn(entry.mapping, 'require') &&\n\t\t\t!declaresDistributionCommonJS(entry.mapping, installed),\n\t)\n}\n\n// One surface comparison, written as the consumer module that proves it: the\n// installed entry that consumer imports, the file extension fixing its importing\n// format, the names a real runtime published off it, and the driver whose scratch\n// project compiles it.\n/** Describes the runtime names and declaration resolution compared for one entry. */\nexport interface DistributionSurface {\n\treadonly entry: DistributionEntry\n\treadonly extension: string\n\treadonly published: readonly string[]\n\treadonly driver: DistributionResolution\n}\n\n// A scratch project over named consumer modules, written beside them so their own\n// resolution reaches the installed package. Nothing is emitted and no ambient types\n// are pulled in, so what the check reads is the installed declarations alone.\n/**\n * Writes a compiler project for a consumer probe.\n *\n * @param stage - The installed consumer.\n * @param name - The project filename suffix.\n * @param driver - The compiler resolution.\n * @param files - The consumer source files.\n * @returns The absolute project path.\n */\nexport function writeDistributionProject(\n\tstage: DistributionStage,\n\tname: string,\n\tdriver: DistributionResolution,\n\tfiles: readonly string[],\n): string {\n\tconst path = join(stage.consumer, \\`tsconfig.\\${name}.json\\`)\n\tconst project = {\n\t\tcompilerOptions: {\n\t\t\tmodule: driver.module,\n\t\t\tmoduleResolution: driver.resolution,\n\t\t\tnoEmit: true,\n\t\t\tskipLibCheck: true,\n\t\t\tstrict: true,\n\t\t\ttarget: 'esnext',\n\t\t\ttypes: [],\n\t\t},\n\t\tfiles: [...files],\n\t}\n\twriteDistributionFile(path, \\`\\${JSON.stringify(project, undefined, '\\\\t')}\\\\n\\`)\n\treturn path\n}\n\n// The diagnostics the compiler this workspace installs reports for one scratch\n// project. The compiler runs as a command, so nothing here reaches an API that\n// moves between its majors, and the located lines it prints are the verdict rather\n// than the exit code, which moves between them. A line carrying no location, a line\n// naming the scratch project rather than a consumer module, and anything at all on\n// the error stream are faults of this proof rather than of the package under proof,\n// so each is raised where it happens instead of counted against the package.\n/**\n * Checks a consumer project with the installed TypeScript compiler.\n *\n * @param stage - The installed consumer.\n * @param project - The compiler project path.\n * @returns The located compiler diagnostics. Throws on a tool or project failure.\n */\nexport function checkDistributionProject(\n\tstage: DistributionStage,\n\tproject: string,\n): readonly string[] {\n\tconst result = runDistributionNode(\n\t\t[DISTRIBUTION_COMPILER, '--noEmit', '--pretty', 'false', '-p', project],\n\t\tstage.consumer,\n\t)\n\tconst refused = \\`\\${result.stderr ?? ''}\\`.trim()\n\tif (refused.length > 0) {\n\t\tthrow new Error(\\`The consumer compiler wrote \\${refused} to its error stream\\`)\n\t}\n\tconst lines = \\`\\${result.stdout ?? ''}\\`.split(/\\\\r\\\\n|\\\\n/u).filter((line) => line.trim().length > 0)\n\t// An elaborated diagnostic prints its detail on indented lines under its own\n\t// first line, so each of those joins the diagnostic it elaborates. The first line\n\t// has no diagnostic above it to join, so it opens one whatever its indentation.\n\tconst heads = lines.flatMap((line, index) => (index === 0 || !/^\\\\s/u.test(line) ? [index] : []))\n\tconst reported = heads.map((head, position) => {\n\t\tconst line = lines[head] ?? ''\n\t\tconst located = DISTRIBUTION_DIAGNOSTIC_PATTERN.exec(line)?.[1]\n\t\tif (located === undefined) {\n\t\t\tthrow new Error(\\`The consumer compiler reported \\${line}, which names no location\\`)\n\t\t}\n\t\tif (resolve(stage.consumer, located) === project) {\n\t\t\tthrow new Error(\\`The scratch project is itself at fault: \\${line}\\`)\n\t\t}\n\t\treturn [\n\t\t\tline,\n\t\t\t...lines.slice(head + 1, heads[position + 1] ?? lines.length).map((detail) => detail.trim()),\n\t\t].join(' ')\n\t})\n\tif (reported.length === 0 && result.status !== 0) {\n\t\tthrow new Error(\\`The consumer compiler refused the project: \\${readDistributionOutput(result)}\\`)\n\t}\n\treturn reported\n}\n\n// One installed entry's published names checked against its own declarations by\n// the compiler this workspace installs, in the direction each divergence surfaces\n// under. The runtime's key list is written into the consumer as a literal, so the\n// published side comes from a real process and the declared side from the\n// declarations that process's package ships, and the two can disagree. A name the\n// declarations carry and the runtime does not lands on \\`declared\\`. A name the\n// runtime carries and the declarations do not, and a name the declarations publish\n// as a type alone, land on \\`surfaced\\`: a variable widens into the type\n// \\`declared\\` annotates, and only \\`surfaced\\` reads the literal's own keys back.\n// Each names the member it is about, so the failure says which export moved.\n/**\n * Checks runtime export names against their installed declarations.\n *\n * @param stage - The installed consumer.\n * @param surface - The publication and declaration pair.\n * @returns The diagnostics labelled by compiler resolution.\n */\nexport function checkDistributionSurface(\n\tstage: DistributionStage,\n\tsurface: DistributionSurface,\n): readonly string[] {\n\tconst slug = surface.entry.subpath.replaceAll(/[^\\\\w]+/gu, '-')\n\tconst name = \\`surface.\\${surface.driver.label}\\${slug}.\\${surface.extension}\\`\n\tconst module = \\`\\${name}\\`\n\tconst keys = surface.published.map((key) => \\`\\${JSON.stringify(key)}: true\\`).join(', ')\n\twriteDistributionFile(\n\t\tjoin(stage.consumer, module),\n\t\t\\`import * as entry from \\${JSON.stringify(surface.entry.specifier)}\nexport const published = {\\${keys.length === 0 ? '' : \\` \\${keys} \\`}} as const\nexport const declared: Record<keyof typeof entry, true> = published\nexport const surfaced: Record<keyof typeof published, true> = declared\n\\`,\n\t)\n\tconst project = writeDistributionProject(stage, name, surface.driver, [\\`./\\${module}\\`])\n\treturn checkDistributionProject(stage, project).map((line) => \\`\\${surface.driver.label}: \\${line}\\`)\n}\n\n// One consumer module importing every installed entry, written where its own\n// resolution finds the installed package.\n/**\n * Writes a consumer importing the requested public specifiers.\n *\n * @param stage - The installed consumer.\n * @param path - The consumer-relative source path.\n * @param specifiers - The public imports to resolve.\n */\nexport function writeDistributionConsumerProbe(\n\tstage: DistributionStage,\n\tpath: string,\n\tspecifiers: readonly string[],\n): void {\n\tconst modules = specifiers.map((specifier, index) => ({\n\t\tbinding: \\`entry\\${String(index)}\\`,\n\t\tspecifier,\n\t}))\n\tconst bindings = modules.map(\n\t\t({ binding, specifier }) => \\`import * as \\${binding} from \\${JSON.stringify(specifier)}\\`,\n\t)\n\tconst names = modules.map(({ binding }) => binding)\n\tconst source = \\`\\${bindings.join('\\\\n')}\\\\nexport const surface = [\\${names.join(', ')}]\\\\n\\`\n\twriteDistributionFile(join(stage.consumer, path), source)\n}\n\n// The runtime key set a real process reads off one installed entry under one\n// condition. The driver is a file rather than an \\`--eval\\` string, so the specifier\n// travels as an argument and nothing needs escaping.\n/**\n * Reads the names a real Node process loads from an installed entry.\n *\n * @param stage - The installed consumer.\n * @param specifier - The public package specifier.\n * @param driver - The consumer driver filename.\n * @returns The exported names. Throws when loading or decoding fails.\n */\nexport function driveDistributionRuntime(\n\tstage: DistributionStage,\n\tspecifier: string,\n\tdriver: string,\n): readonly string[] {\n\tconst result = runDistributionNode([join(stage.consumer, driver), specifier], stage.consumer)\n\tif (result.status !== 0) {\n\t\tthrow new Error(\n\t\t\t\\`Loading \\${specifier} from the consumer failed: \\${readDistributionOutput(result)}\\`,\n\t\t)\n\t}\n\tconst published: unknown = JSON.parse(result.stdout)\n\tif (!isDistributionNames(published))\n\t\tthrow new Error(\\`The driver printed no name list for \\${specifier}\\`)\n\treturn published\n}\n{{helpers}}\n// Pack this workspace, install the archive into an isolated consumer, and read the\n// published surface back off the installed tree. Every later claim reads this\n// result, so a failure here is raised where it happens rather than once per entry.\n/**\n * Packs the workspace and installs its archive into an isolated consumer.\n *\n * @param scratch - The owned scratch root.\n * @returns The installed consumer and classified exports.\n * @throws Thrown when packing or installation fails.\n */\nexport function buildDistributionStage(scratch: string): DistributionStage {\n\tconst packed = join(scratch, 'packed')\n\tconst consumer = join(scratch, 'consumer')\n\tmkdirSync(packed, { recursive: true })\n\tconst pack = runDistributionNpm(\n\t\t['pack', '--ignore-scripts', '--pack-destination', packed],\n\t\tDISTRIBUTION_ROOT,\n\t\tscratch,\n\t)\n\tif (pack.status !== 0)\n\t\tthrow new Error(\\`npm pack refused this workspace: \\${readDistributionOutput(pack)}\\`)\n\tconst archives = readdirSync(packed).filter((name) => name.endsWith('.tgz'))\n\tconst archive = archives[0]\n\tif (archives.length !== 1 || archive === undefined) {\n\t\tthrow new Error(\\`npm pack wrote no single archive: \\${archives.join(', ')}\\`)\n\t}\n\tconst peers = readDistributionPeers(join(DISTRIBUTION_ROOT, 'package.json'))\n\twriteDistributionFile(join(consumer, 'package.json'), createDistributionConsumerManifest(peers))\n\twriteDistributionFile(join(consumer, DISTRIBUTION_ESM_DRIVER), DISTRIBUTION_ESM_DRIVER_SOURCE)\n\twriteDistributionFile(join(consumer, DISTRIBUTION_CJS_DRIVER), DISTRIBUTION_CJS_DRIVER_SOURCE)\n\tconst install = runDistributionNpm(\n\t\t['install', '--ignore-scripts', '--no-audit', '--no-fund', join(packed, archive)],\n\t\tconsumer,\n\t\tscratch,\n\t)\n\tif (install.status !== 0) {\n\t\tthrow new Error(\\`Installing the packed archive failed: \\${readDistributionOutput(install)}\\`)\n\t}\n\tconst name = readDistributionManifestName(join(DISTRIBUTION_ROOT, 'package.json'))\n\tconst installed = join(consumer, 'node_modules', ...name.split('/'))\n\tconst manifest = readDistributionJSON(join(installed, 'package.json'))\n\tif (!isDistributionRecord(manifest) || !isDistributionRecord(manifest.exports)) {\n\t\tthrow new Error('The installed manifest publishes no exports map')\n\t}\n\treturn { consumer, installed, archives, ...classifyDistributionStage(manifest, installed, name) }\n}\n\n// One file's run: the scratch directory and the staged consumer, which is absent when the\n// registry could not be reached.\n/** Binds an owned scratch directory to its optional installed consumer. */\nexport interface DistributionRun {\n\treadonly scratch: string\n\treadonly stage: DistributionStage | undefined\n}\n\n// The run the start hook binds once for this file and the stop hook releases.\n/** Owns the staged consumer shared by one distribution proof. */\nexport class DistributionSuite implements DistributionSuiteInterface {\n\t#run: DistributionRun | undefined\n\n\tget scratch(): string {\n\t\tif (this.#run === undefined) {\n\t\t\tthrow new Error('The distribution setup has not allocated its scratch directory')\n\t\t}\n\t\treturn this.#run.scratch\n\t}\n\n\tread(context: TestContext): DistributionStage {\n\t\tconst stage = this.#run?.stage\n\t\tif (stage === undefined) {\n\t\t\treturn context.skip('\\`npm ping\\` did not answer, so nothing was packed or installed')\n\t\t}\n\t\treturn stage\n\t}\n\n\tstart(): void {\n\t\tif (this.#run !== undefined) {\n\t\t\tthrow new Error('The distribution setup has already allocated its scratch directory')\n\t\t}\n\t\tconst scratch = mkdtempSync(join(tmpdir(), 'distribution-'))\n\t\tthis.#run = { scratch, stage: openDistributionStage(scratch) }\n\t}\n\n\tdestroy(): void {\n\t\tif (this.#run !== undefined) {\n\t\t\trmSync(this.#run.scratch, { force: true, recursive: true, maxRetries: 3, retryDelay: 100 })\n\t\t}\n\t\tthis.#run = undefined\n\t}\n}\n\n// Installing the packed archive resolves its own runtime dependencies, so an\n// unreachable registry leaves nothing to measure. Under release that is the gate\n// failing; anywhere else the suite skips and names the mechanism it wanted.\n/**\n * Opens an installed consumer after checking registry readiness.\n *\n * @param scratch - The owned scratch root.\n * @returns The installed consumer, or undefined when an ordinary run cannot reach the registry.\n * @throws Thrown in release mode or when staging fails, after removing scratch.\n */\nexport function openDistributionStage(scratch: string): DistributionStage | undefined {\n\ttry {\n\t\tmkdirSync(join(scratch, 'cache'), { recursive: true })\n\t\tif (runDistributionNpm(DISTRIBUTION_PING, DISTRIBUTION_ROOT, scratch).status !== 0) {\n\t\t\tif (!DISTRIBUTION_RELEASE) return undefined\n\t\t\tthrow new Error(\n\t\t\t\t'The release gate requires a reachable npm registry, and npm ping did not answer',\n\t\t\t)\n\t\t}\n\t\treturn buildDistributionStage(scratch)\n\t} catch (error) {\n\t\trmSync(scratch, {\n\t\t\tforce: true,\n\t\t\trecursive: true,\n\t\t\tmaxRetries: 3,\n\t\t\tretryDelay: 100,\n\t\t})\n\t\tthrow error\n\t}\n}\n\n/**\n * Partitions an installed exports map into driven, undeclared, and excluded subpaths.\n *\n * @param manifest - The installed package manifest.\n * @param installed - The installed package root.\n * @param name - The published package name.\n * @returns The classified entries and complete target population.\n * @throws Thrown when the exports map is absent.\n */\nexport function classifyDistributionStage(\n\tmanifest: Readonly<Record<string, unknown>>,\n\tinstalled: string,\n\tname: string,\n): DistributionClassification {\n\tif (!isDistributionRecord(manifest.exports))\n\t\tthrow new Error('The installed manifest publishes no exports map')\n\tconst readings = Object.entries(manifest.exports).map(([subpath, mapping]) => {\n\t\tconst files = collectDistributionTargets(mapping)\n\t\tconst declaration = readDistributionDeclaration(mapping, installed)\n\t\t// A subpath resolving no declaration is partitioned rather than dropped. It is a\n\t\t// defect when a runtime loads one of its targets for names, because a consumer\n\t\t// importing it compiles against nothing under \\`node16\\`. It is an excluded\n\t\t// publication otherwise: the \\`\"./package.json\"\\` manifest pointer and a stylesheet\n\t\t// are published for a reader rather than an importer.\n\t\tif (\n\t\t\tdeclaration.module === undefined &&\n\t\t\tdeclaration.commonjs === undefined &&\n\t\t\tdeclaration.browser === undefined\n\t\t) {\n\t\t\treturn { subpath, files, entry: undefined }\n\t\t}\n\t\tconst importTarget = resolveDistributionTarget(mapping, DISTRIBUTION_RUNTIME_CONDITIONS.module)\n\t\tconst requireTarget = resolveDistributionTarget(\n\t\t\tmapping,\n\t\t\tDISTRIBUTION_RUNTIME_CONDITIONS.commonjs,\n\t\t)\n\t\tconst browserTarget = resolveDistributionTarget(\n\t\t\tmapping,\n\t\t\tDISTRIBUTION_RUNTIME_CONDITIONS.browser,\n\t\t)\n\t\tconst browsable = resolvesDistributionBrowser(mapping)\n\t\tconst shadowed = browsable && requireTarget === browserTarget\n\t\tconst requirable = requireTarget !== undefined && !shadowed\n\t\tconst loadable = requirable && resolvesDistributionCommonJS(mapping, installed)\n\t\tconst entry: DistributionEntry = {\n\t\t\tsubpath,\n\t\t\tspecifier: subpath === '.' ? name : \\`\\${name}\\${subpath.slice(1)}\\`,\n\t\t\tmapping,\n\t\t\tdeclaration: {\n\t\t\t\timportable: declaration.module !== undefined,\n\t\t\t\trequirable: declaration.commonjs !== undefined,\n\t\t\t\tbrowsable: declaration.browser !== undefined,\n\t\t\t},\n\t\t\tbrowsable,\n\t\t\timportable: importTarget !== undefined && !(browsable && importTarget === browserTarget),\n\t\t\trequirable,\n\t\t\tloadable,\n\t\t}\n\t\treturn { subpath, files, entry }\n\t})\n\tconst entries = readings.flatMap(({ entry }) => (entry === undefined ? [] : [entry]))\n\tconst targets = readings.flatMap(({ files }) => files)\n\tconst subpaths = readings.map(({ subpath }) => subpath)\n\tconst undeclared = readings\n\t\t.filter(({ entry, files }) => entry === undefined && files.some(matchesDistributionModule))\n\t\t.map(({ subpath }) => subpath)\n\tconst excluded = readings\n\t\t.filter(({ entry, files }) => entry === undefined && !files.some(matchesDistributionModule))\n\t\t.map(({ subpath }) => subpath)\n\treturn { entries, subpaths, undeclared, excluded, targets }\n}\n\n/**\n * Creates the lifecycle boundary used by generated distribution proofs.\n * @returns The suite interface backed by an owned run.\n */\nexport function createDistributionSuite(): DistributionSuiteInterface {\n\treturn new DistributionSuite()\n}\n\n/**\n * Collects physical files beneath an installed output directory.\n * @param directory - The output directory to walk.\n * @returns The installed files, or an empty list when the directory is absent.\n */\nexport function collectDistributionFiles(directory: string): readonly string[] {\n\tif (!existsSync(directory)) return []\n\treturn readdirSync(directory, { withFileTypes: true }).flatMap((entry) => {\n\t\tconst path = join(directory, entry.name)\n\t\treturn entry.isDirectory() ? collectDistributionFiles(path) : entry.isFile() ? [path] : []\n\t})\n}\n\n/**\n * Reads the source environment owning an installed output path.\n * @param installed - The installed package root.\n * @param path - The output file.\n * @returns The source environment, or undefined outside a JavaScript face.\n */\nexport function readDistributionFace(installed: string, path: string): string | undefined {\n\tconst [output, axis, face] = relativePath(installed, path).split(sep)\n\treturn output === 'dist'\n\t\t? axis === 'src'\n\t\t\t? face\n\t\t\t: axis === 'bin'\n\t\t\t\t? 'bin'\n\t\t\t\t: undefined\n\t\t: undefined\n}\n\n/**\n * Scans installed JavaScript maps for sources copied from another environment.\n * @param installed - The installed package root.\n * @returns The copied sources and unreadable maps.\n * @throws Thrown when a code-bearing output has no readable map of its own.\n */\nexport function scanDistributionSourceMaps(installed: string): readonly string[] {\n\tconst files = collectDistributionFiles(join(installed, 'dist')).filter(\n\t\t(path) => readDistributionFace(installed, path) !== undefined,\n\t)\n\tconst outputs = files\n\t\t.filter((path) => /\\\\.(?:js|cjs|mjs)$/u.test(path))\n\t\t.map((path) => {\n\t\t\tconst parsed = parseSync(path, readFileSync(path, 'utf8'))\n\t\t\tconst code = parsed.program.body.some(\n\t\t\t\t(statement) =>\n\t\t\t\t\tstatement.type !== 'EmptyStatement' &&\n\t\t\t\t\t!(\n\t\t\t\t\t\tstatement.type === 'ExportNamedDeclaration' &&\n\t\t\t\t\t\tstatement.declaration === null &&\n\t\t\t\t\t\tstatement.specifiers.length === 0 &&\n\t\t\t\t\t\tstatement.source === null\n\t\t\t\t\t),\n\t\t\t)\n\t\t\tconst reference = parsed.comments\n\t\t\t\t.flatMap((comment) => {\n\t\t\t\t\tconst match = /^[@#]\\\\s*sourceMappingURL=(\\\\S+)\\\\s*$/u.exec(comment.value)\n\t\t\t\t\treturn match?.[1] === undefined ? [] : [match[1]]\n\t\t\t\t})\n\t\t\t\t.at(-1)\n\t\t\ttry {\n\t\t\t\tconst inline = reference?.startsWith('data:') === true\n\t\t\t\tconst target = inline\n\t\t\t\t\t? path\n\t\t\t\t\t: reference === undefined\n\t\t\t\t\t\t? \\`\\${path}.map\\`\n\t\t\t\t\t\t: fileURLToPath(new URL(reference.replaceAll('\\\\\\\\', '/'), pathToFileURL(path)))\n\t\t\t\treturn {\n\t\t\t\t\tpath: target,\n\t\t\t\t\tface: readDistributionFace(installed, path),\n\t\t\t\t\tcode,\n\t\t\t\t\treference: inline ? reference : undefined,\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\tthrow new Error(\\`Unreadable source maps for \\${path}\\`)\n\t\t\t}\n\t\t})\n\tconst maps = [\n\t\t...outputs.filter(\n\t\t\t({ path, code, reference }) => code || reference !== undefined || existsSync(path),\n\t\t),\n\t\t...files\n\t\t\t.filter(\n\t\t\t\t(path) =>\n\t\t\t\t\t/\\\\.(?:js|cjs|mjs)\\\\.map$/u.test(path) && !outputs.some((output) => output.path === path),\n\t\t\t)\n\t\t\t.map((path) => ({\n\t\t\t\tpath,\n\t\t\t\tface: readDistributionFace(installed, path),\n\t\t\t\tcode: false,\n\t\t\t\treference: undefined,\n\t\t\t})),\n\t]\n\tif (maps.length === 0)\n\t\tconsole.info('No built JavaScript face holds code, so no source map is required')\n\treturn maps.flatMap(({ path, face, code, reference }) => {\n\t\tconst label = relativePath(installed, path).split(sep).join('/')\n\t\ttry {\n\t\t\tconst payload =\n\t\t\t\treference === undefined\n\t\t\t\t\t? undefined\n\t\t\t\t\t: /^data:application\\\\/json(?:;charset=[^;,]+)?(;base64)?,(.*)$/iu.exec(reference)\n\t\t\tconst map: unknown =\n\t\t\t\treference === undefined\n\t\t\t\t\t? readDistributionJSON(path)\n\t\t\t\t\t: payload?.[2] === undefined\n\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t: JSON.parse(\n\t\t\t\t\t\t\t\tpayload[1] === undefined\n\t\t\t\t\t\t\t\t\t? decodeURIComponent(payload[2])\n\t\t\t\t\t\t\t\t\t: Buffer.from(payload[2], 'base64').toString('utf8'),\n\t\t\t\t\t\t\t)\n\t\t\tif (\n\t\t\t\t!isDistributionRecord(map) ||\n\t\t\t\t!isDistributionNames(map.sources) ||\n\t\t\t\t(map.sourceRoot !== undefined && typeof map.sourceRoot !== 'string')\n\t\t\t) {\n\t\t\t\tthrow new Error('Unreadable source map')\n\t\t\t}\n\t\t\tconst root = typeof map.sourceRoot === 'string' ? map.sourceRoot : ''\n\t\t\tconst directory = root.startsWith('file:')\n\t\t\t\t? fileURLToPath(new URL(root))\n\t\t\t\t: resolve(dirname(path), root.replaceAll('\\\\\\\\', '/'))\n\t\t\tconst sources = map.sources.map((source) =>\n\t\t\t\trelativePath(\n\t\t\t\t\tresolve(installed),\n\t\t\t\t\tsource.startsWith('file:')\n\t\t\t\t\t\t? fileURLToPath(new URL(source))\n\t\t\t\t\t\t: resolve(directory, source.replaceAll('\\\\\\\\', '/')),\n\t\t\t\t)\n\t\t\t\t\t.split(sep)\n\t\t\t\t\t.join('/'),\n\t\t\t)\n\t\t\tconst copied = sources.filter(\n\t\t\t\t(source) => source.startsWith('src/') && !source.startsWith(\\`src/\\${face}/\\`),\n\t\t\t)\n\t\t\treturn [\n\t\t\t\t...copied.map((source) => \\`\\${label}: \\${source}\\`),\n\t\t\t\t...(sources.some((source) => source.startsWith(\\`src/\\${face}/\\`))\n\t\t\t\t\t? []\n\t\t\t\t\t: [\\`\\${label}: unreadable source map (no src/\\${face}/ source)\\`]),\n\t\t\t]\n\t\t} catch {\n\t\t\tif (code) throw new Error(\\`Unreadable source maps for \\${path}\\`)\n\t\t\treturn [\\`\\${label}: unreadable source map\\`]\n\t\t}\n\t})\n}\n\n/**\n * Reads top-level names declared by a roll-up, including unexported declarations.\n * @param path - The installed declaration file.\n * @returns The declared names. Refuses syntax errors and unreadable binding patterns.\n */\nexport function readDistributionNames(path: string): readonly string[] {\n\tconst source = parseSync(path, readFileSync(path, 'utf8'))\n\tif (source.errors.length > 0) throw new Error(\\`Unreadable declarations at \\${path}\\`)\n\treturn source.program.body.flatMap((statement) => {\n\t\tconst declaration =\n\t\t\tstatement.type === 'ExportNamedDeclaration' || statement.type === 'ExportDefaultDeclaration'\n\t\t\t\t? statement.declaration\n\t\t\t\t: statement\n\t\tif (declaration === null) return []\n\t\tif (declaration.type === 'VariableDeclaration') {\n\t\t\treturn declaration.declarations.map((binding) => {\n\t\t\t\tif (binding.id.type !== 'Identifier')\n\t\t\t\t\tthrow new Error(\\`Unreadable declaration binding at \\${path}\\`)\n\t\t\t\treturn binding.id.name\n\t\t\t})\n\t\t}\n\t\tif (\n\t\t\tdeclaration.type === 'ClassDeclaration' ||\n\t\t\tdeclaration.type === 'FunctionDeclaration' ||\n\t\t\tdeclaration.type === 'TSDeclareFunction' ||\n\t\t\tdeclaration.type === 'TSInterfaceDeclaration' ||\n\t\t\tdeclaration.type === 'TSTypeAliasDeclaration' ||\n\t\t\tdeclaration.type === 'TSEnumDeclaration' ||\n\t\t\tdeclaration.type === 'TSModuleDeclaration'\n\t\t) {\n\t\t\treturn declaration.id?.type === 'Identifier' ? [declaration.id.name] : []\n\t\t}\n\t\treturn []\n\t})\n}\n\n/**\n * Checks whether a source entry exports names, following local star exports.\n * @param path - The source entry to inspect.\n * @param ancestors - The entries already visited on this export path.\n * @returns True if the entry exports a name; false otherwise.\n */\nexport function matchesDistributionSourceExports(\n\tpath: string,\n\tancestors: readonly string[] = [],\n): boolean {\n\tif (ancestors.includes(path)) return false\n\tconst source = parseSync(path, readFileSync(path, 'utf8'))\n\tif (source.errors.length > 0) throw new Error(\\`Unreadable source exports at \\${path}\\`)\n\treturn source.program.body.some((statement) => {\n\t\tif (statement.type === 'ExportDefaultDeclaration') return ancestors.length === 0\n\t\tif (statement.type === 'ExportNamedDeclaration')\n\t\t\treturn (\n\t\t\t\tstatement.declaration !== null ||\n\t\t\t\tstatement.specifiers.some((specifier) => {\n\t\t\t\t\tconst name =\n\t\t\t\t\t\tspecifier.exported.type === 'Identifier'\n\t\t\t\t\t\t\t? specifier.exported.name\n\t\t\t\t\t\t\t: specifier.exported.value\n\t\t\t\t\treturn ancestors.length === 0 || name !== 'default'\n\t\t\t\t})\n\t\t\t)\n\t\tif (statement.type !== 'ExportAllDeclaration') return false\n\t\tif (statement.exported !== null || !statement.source.value.startsWith('.')) return true\n\t\tconst target = resolve(dirname(path), statement.source.value.replace(/\\\\.js$/u, '.ts'))\n\t\treturn matchesDistributionSourceExports(target, [...ancestors, path])\n\t})\n}\n\n/**\n * Scans installed declaration faces for names declared by multiple environments.\n * @param installed - The installed package root.\n * @param source - The workspace holding the source entries being published.\n * @returns The repeated names with their declaring faces.\n * @throws Thrown when a source entry exports names but its roll-up declares none.\n */\nexport function scanDistributionDeclarations(\n\tinstalled: string,\n\tsource: string = DISTRIBUTION_ROOT,\n): readonly string[] {\n\tconst declarations = collectDistributionFiles(join(installed, 'dist'))\n\t\t.filter(matchesDistributionDeclaration)\n\t\t.map((path) => ({\n\t\t\tpath,\n\t\t\tface: readDistributionFace(installed, path),\n\t\t\tnames: readDistributionNames(path),\n\t\t}))\n\tconst entries = collectDistributionFiles(join(source, 'src')).filter((path) => {\n\t\tconst parts = relativePath(source, path).split(sep)\n\t\treturn parts.length === 3 && parts[2] === 'index.ts'\n\t})\n\tconst published = entries.filter((path) => matchesDistributionSourceExports(path))\n\tfor (const path of published) {\n\t\tconst face = relativePath(source, path).split(sep)[1]\n\t\tif (!declarations.some((entry) => entry.face === face && entry.names.length > 0))\n\t\t\tthrow new Error(\n\t\t\t\t\\`The \\${face} source entry exports names but its declaration roll-up declares none\\`,\n\t\t\t)\n\t}\n\tif (published.length === 0)\n\t\tconsole.info('No source entry exports names, so no declaration names are required')\n\tconst names = [...new Set(declarations.flatMap((entry) => entry.names))].sort()\n\treturn names.flatMap((name) => {\n\t\tconst faces = [\n\t\t\t...new Set(\n\t\t\t\tdeclarations\n\t\t\t\t\t.filter((entry) => entry.names.includes(name))\n\t\t\t\t\t.map((entry) => entry.face)\n\t\t\t\t\t.filter((face) => face !== undefined),\n\t\t\t),\n\t\t].sort()\n\t\treturn faces.length > 1 ? [\\`\\${name}: \\${faces.join(', ')}\\`] : []\n\t})\n}\n\n/**\n * Checks the installed manifest against npm's normalization in an owned scratch copy.\n * @param installed - The installed package root, read only.\n * @param scratch - The suite's owned scratch root and npm cache parent.\n * @returns The top-level keys changed by npm. Refuses an unsuccessful npm command.\n */\nexport function checkDistributionManifest(installed: string, scratch: string): readonly string[] {\n\tconst directory = mkdtempSync(join(scratch, 'manifest-'))\n\ttry {\n\t\tconst path = join(directory, 'package.json')\n\t\twriteFileSync(path, readFileSync(join(installed, 'package.json')))\n\t\tconst before = readDistributionJSON(path)\n\t\tconst result = runDistributionNpm(['pkg', 'fix'], directory, scratch)\n\t\tif (result.status !== 0)\n\t\t\tthrow new Error(\\`npm pkg fix failed: \\${readDistributionOutput(result)}\\`)\n\t\tconst after = readDistributionJSON(path)\n\t\tif (!isDistributionRecord(before) || !isDistributionRecord(after))\n\t\t\tthrow new Error('Unreadable manifest')\n\t\treturn [...new Set([...Object.keys(before), ...Object.keys(after)])]\n\t\t\t.filter((key) => !isDeepStrictEqual(before[key], after[key]))\n\t\t\t.sort()\n\t} finally {\n\t\trmSync(directory, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 })\n\t}\n}\n\n/**\n * Builds independently registered observations over the suite's installed consumer.\n * @param suite - The lifecycle shared by the proof's hooks and observations.\n * @returns The case rows whose observations each require one assertion.\n */\nexport function buildDistributionCases(\n\tsuite: DistributionSuiteInterface,\n): readonly DistributionCase[] {\n\treturn [\n\t\t{\n\t\t\tlabel: 'classifies synthetic export mappings without a registry stage',\n\t\t\tobserve: () => {\n\t\t\t\tconst root = join(suite.scratch, 'classifiers')\n\t\t\t\twriteDistributionFile(\n\t\t\t\t\tjoin(root, 'package.json'),\n\t\t\t\t\tJSON.stringify({\n\t\t\t\t\t\ttype: 'commonjs',\n\t\t\t\t\t\texports: {\n\t\t\t\t\t\t\tcondition: { browser: './b.js', default: './n.js' },\n\t\t\t\t\t\t\tconvention: { default: './dist/src/browser/index.js' },\n\t\t\t\t\t\t\tuniversal: { default: './shared.js' },\n\t\t\t\t\t\t\t'import-shared': {\n\t\t\t\t\t\t\t\tbrowser: './shared.mjs',\n\t\t\t\t\t\t\t\timport: './shared.mjs',\n\t\t\t\t\t\t\t\tdefault: './node.js',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t'require-shared': {\n\t\t\t\t\t\t\t\tbrowser: './shared.cjs',\n\t\t\t\t\t\t\t\trequire: './shared.cjs',\n\t\t\t\t\t\t\t\tdefault: './node.js',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tnode: { node: './node.js', default: './node.js' },\n\t\t\t\t\t\t\tsilent: { 'module-sync': './x.cjs', import: './x.mjs' },\n\t\t\t\t\t\t\tmodule: { require: './x.mjs' },\n\t\t\t\t\t\t\t'nested-module': { require: './module/x.js' },\n\t\t\t\t\t\t\t'nested-commonjs': { require: './commonjs/x.js' },\n\t\t\t\t\t\t\tesm: { import: './x.mjs' },\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t\twriteDistributionFile(join(root, 'module/package.json'), '{ \"type\": \"module\" }\\\\n')\n\t\t\t\twriteDistributionFile(join(root, 'commonjs/package.json'), '{ \"type\": \"commonjs\" }\\\\n')\n\t\t\t\tconst manifest = readDistributionJSON(join(root, 'package.json'))\n\t\t\t\tif (!isDistributionRecord(manifest) || !isDistributionRecord(manifest.exports)) {\n\t\t\t\t\tthrow new Error('The classifier fixture declares no exports map')\n\t\t\t\t}\n\t\t\t\tconst mappings = manifest.exports\n\n\t\t\t\treturn {\n\t\t\t\t\tactual: {\n\t\t\t\t\t\tbrowser: {\n\t\t\t\t\t\t\tcondition: resolvesDistributionBrowser(mappings.condition),\n\t\t\t\t\t\t\tconvention: resolvesDistributionBrowser(mappings.convention),\n\t\t\t\t\t\t\tuniversal: resolvesDistributionBrowser(mappings.universal),\n\t\t\t\t\t\t\timport: resolvesDistributionBrowser(mappings['import-shared']),\n\t\t\t\t\t\t\trequire: resolvesDistributionBrowser(mappings['require-shared']),\n\t\t\t\t\t\t\tnode: resolvesDistributionBrowser(mappings.node),\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcommonjs: {\n\t\t\t\t\t\t\tsilent: resolvesDistributionCommonJS(mappings.silent, root),\n\t\t\t\t\t\t\tmodule: resolvesDistributionCommonJS(mappings.module, root),\n\t\t\t\t\t\t\tnestedModule: resolvesDistributionCommonJS(mappings['nested-module'], root),\n\t\t\t\t\t\t\tnestedCommonJS: resolvesDistributionCommonJS(mappings['nested-commonjs'], root),\n\t\t\t\t\t\t\tesm: resolvesDistributionCommonJS(mappings.esm, root),\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\texpected: {\n\t\t\t\t\t\tbrowser: {\n\t\t\t\t\t\t\tcondition: true,\n\t\t\t\t\t\t\tconvention: true,\n\t\t\t\t\t\t\tuniversal: false,\n\t\t\t\t\t\t\timport: false,\n\t\t\t\t\t\t\trequire: false,\n\t\t\t\t\t\t\tnode: false,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcommonjs: {\n\t\t\t\t\t\t\tsilent: true,\n\t\t\t\t\t\t\tmodule: false,\n\t\t\t\t\t\t\tnestedModule: false,\n\t\t\t\t\t\t\tnestedCommonJS: true,\n\t\t\t\t\t\t\tesm: false,\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\t{\n\t\t\tlabel: 'keeps installed JavaScript sources in their own environment [requires the registry]',\n\t\t\tobserve: (context) => {\n\t\t\t\tconst stage = suite.read(context)\n\t\t\t\treturn { actual: scanDistributionSourceMaps(stage.installed), expected: [] }\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: 'declares each installed name in one environment [requires the registry]',\n\t\t\tobserve: (context) => {\n\t\t\t\tconst stage = suite.read(context)\n\t\t\t\tconst faces = new Set(\n\t\t\t\t\tcollectDistributionFiles(join(stage.installed, 'dist'))\n\t\t\t\t\t\t.filter(matchesDistributionDeclaration)\n\t\t\t\t\t\t.map((path) => readDistributionFace(stage.installed, path))\n\t\t\t\t\t\t.filter((face) => face !== undefined),\n\t\t\t\t)\n\t\t\t\tconst findings = scanDistributionDeclarations(stage.installed)\n\t\t\t\tif (faces.size <= 1)\n\t\t\t\t\tconsole.info(\n\t\t\t\t\t\t'Fewer than two declaration faces are installed, so no cross-face copy exists',\n\t\t\t\t\t)\n\t\t\t\treturn { actual: findings, expected: [] }\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: 'keeps the installed manifest fixed under npm pkg fix [requires the registry]',\n\t\t\tobserve: (context) => ({\n\t\t\t\tactual: checkDistributionManifest(suite.read(context).installed, suite.scratch),\n\t\t\t\texpected: [],\n\t\t\t}),\n\t\t},\n\t\t{\n\t\t\tlabel: 'packs one archive and installs it in isolation [requires the registry]',\n\t\t\tobserve: (context) => {\n\t\t\t\tconst stage = suite.read(context)\n\t\t\t\treturn {\n\t\t\t\t\tactual: {\n\t\t\t\t\t\tarchives: stage.archives.length,\n\t\t\t\t\t\tinstalled: existsSync(join(stage.installed, 'package.json')),\n\t\t\t\t\t\tentries: stage.entries.length > 0,\n\t\t\t\t\t},\n\t\t\t\t\texpected: { archives: 1, installed: true, entries: true },\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: 'ships every relative target its exports map names [requires the registry]',\n\t\t\tobserve: (context) => {\n\t\t\t\tconst stage = suite.read(context)\n\t\t\t\tconst relative = stage.targets.filter((target) => target.startsWith('./'))\n\t\t\t\treturn {\n\t\t\t\t\tactual: {\n\t\t\t\t\t\tpopulated: relative.length > 0,\n\t\t\t\t\t\tmissing: relative.filter((target) => !existsSync(join(stage.installed, target))),\n\t\t\t\t\t},\n\t\t\t\t\texpected: { populated: true, missing: [] },\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: 'declares types for every module it publishes [requires the registry]',\n\t\t\tobserve: (context) => {\n\t\t\t\tconst stage = suite.read(context)\n\t\t\t\tconst partitioned = [\n\t\t\t\t\t...stage.entries.map((entry) => entry.subpath),\n\t\t\t\t\t...stage.undeclared,\n\t\t\t\t\t...stage.excluded,\n\t\t\t\t]\n\t\t\t\treturn {\n\t\t\t\t\tactual: {\n\t\t\t\t\t\tundeclared: stage.undeclared,\n\t\t\t\t\t\tpartitioned: partitioned.sort(),\n\t\t\t\t\t\tunreachable: stage.entries\n\t\t\t\t\t\t\t.filter((entry) => !entry.importable && !entry.requirable && !entry.browsable)\n\t\t\t\t\t\t\t.map((entry) => entry.subpath),\n\t\t\t\t\t\tuntypable: filterDistributionUntypable(stage.entries, stage.installed).map(\n\t\t\t\t\t\t\t(entry) => entry.subpath,\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t\texpected: {\n\t\t\t\t\t\tundeclared: [],\n\t\t\t\t\t\tpartitioned: [...stage.subpaths].sort(),\n\t\t\t\t\t\tunreachable: [],\n\t\t\t\t\t\tuntypable: [],\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: 'refuses a subpath its exports map does not name [requires the registry]',\n\t\t\tobserve: (context) => {\n\t\t\t\tconst stage = suite.read(context)\n\t\t\t\tconst name = readDistributionManifestName(join(stage.installed, 'package.json'))\n\t\t\t\tconst result = runDistributionNode(\n\t\t\t\t\t[join(stage.consumer, DISTRIBUTION_ESM_DRIVER), \\`\\${name}\\${DISTRIBUTION_ABSENT_SUBPATH}\\`],\n\t\t\t\t\tstage.consumer,\n\t\t\t\t)\n\t\t\t\treturn {\n\t\t\t\t\tactual: {\n\t\t\t\t\t\trefused: result.status !== 0,\n\t\t\t\t\t\tcoded: readDistributionOutput(result).includes('ERR_PACKAGE_PATH_NOT_EXPORTED'),\n\t\t\t\t\t},\n\t\t\t\t\texpected: { refused: true, coded: true },\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: 'compiles a consumer under every module resolution [requires the registry]',\n\t\t\tobserve: (context) => {\n\t\t\t\tconst stage = suite.read(context)\n\t\t\t\tconst name = readDistributionManifestName(join(stage.installed, 'package.json'))\n\t\t\t\tconst readings = DISTRIBUTION_RESOLUTIONS.flatMap((driver) =>\n\t\t\t\t\tDISTRIBUTION_FORMATS.flatMap(([extension, format]) => {\n\t\t\t\t\t\tconst written = filterDistributionEntries(stage.entries, driver.conditions[format])\n\t\t\t\t\t\tif (written.length === 0) return []\n\t\t\t\t\t\tconst label = \\`\\${driver.label}.\\${extension}\\`\n\t\t\t\t\t\tconst probe = \\`probe.\\${label}\\`\n\t\t\t\t\t\tconst specifiers = written.map((entry) => entry.specifier)\n\t\t\t\t\t\twriteDistributionConsumerProbe(stage, probe, specifiers)\n\t\t\t\t\t\tconst project = writeDistributionProject(stage, probe, driver, [\\`./\\${probe}\\`])\n\t\t\t\t\t\tconst messages = checkDistributionProject(stage, project).map(\n\t\t\t\t\t\t\t(message) => \\`\\${label}: \\${message}\\`,\n\t\t\t\t\t\t)\n\t\t\t\t\t\tconst control = \\`control.\\${label}\\`\n\t\t\t\t\t\twriteDistributionConsumerProbe(stage, control, [\n\t\t\t\t\t\t\t\\`\\${name}\\${DISTRIBUTION_ABSENT_SUBPATH}\\`,\n\t\t\t\t\t\t])\n\t\t\t\t\t\tconst refused = writeDistributionProject(stage, control, driver, [\\`./\\${control}\\`])\n\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tmessages,\n\t\t\t\t\t\t\t\tsilent: checkDistributionProject(stage, refused).length === 0 ? [label] : [],\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\treturn {\n\t\t\t\t\tactual: {\n\t\t\t\t\t\tmessages: readings.flatMap(({ messages }) => messages),\n\t\t\t\t\t\tsilent: readings.flatMap(({ silent }) => silent),\n\t\t\t\t\t},\n\t\t\t\t\texpected: { messages: [], silent: [] },\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: 'publishes what it declares to a Node import, and no more',\n\t\t\tobserve: (context) => {\n\t\t\t\tconst stage = suite.read(context)\n\t\t\t\tconst entries = stage.entries.filter((entry) => entry.importable)\n\t\t\t\tif (entries.length === 0) return context.skip('No installed entry supports Node import')\n\t\t\t\tconst readings = entries.map((entry) => {\n\t\t\t\t\tif (!entry.declaration.importable)\n\t\t\t\t\t\tthrow new Error(\\`\\${entry.subpath} publishes no import declaration\\`)\n\t\t\t\t\tconst published = driveDistributionRuntime(\n\t\t\t\t\t\tstage,\n\t\t\t\t\t\tentry.specifier,\n\t\t\t\t\t\tDISTRIBUTION_ESM_DRIVER,\n\t\t\t\t\t)\n\t\t\t\t\tconst drivers = filterDistributionResolutions(entry, 'module')\n\t\t\t\t\treturn {\n\t\t\t\t\t\tentry: entry.subpath,\n\t\t\t\t\t\tdriven: drivers.length > 0,\n\t\t\t\t\t\treported: drivers.flatMap((driver) =>\n\t\t\t\t\t\t\tcheckDistributionSurface(stage, { entry, extension: 'ts', published, driver }),\n\t\t\t\t\t\t),\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\treturn {\n\t\t\t\t\tactual: readings,\n\t\t\t\t\texpected: entries.map((entry) => ({ entry: entry.subpath, driven: true, reported: [] })),\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: 'publishes what it declares to a Node require, and no more',\n\t\t\tobserve: (context) => {\n\t\t\t\tconst stage = suite.read(context)\n\t\t\t\tconst entries = stage.entries.filter((entry) => entry.requirable)\n\t\t\t\tif (entries.length === 0) return context.skip('No installed entry supports Node require')\n\t\t\t\tconst readings = entries.map((entry) => {\n\t\t\t\t\tif (!entry.declaration.requirable)\n\t\t\t\t\t\tthrow new Error(\\`\\${entry.subpath} publishes no require declaration\\`)\n\t\t\t\t\tconst published = driveDistributionRuntime(\n\t\t\t\t\t\tstage,\n\t\t\t\t\t\tentry.specifier,\n\t\t\t\t\t\tDISTRIBUTION_CJS_DRIVER,\n\t\t\t\t\t)\n\t\t\t\t\tconst drivers = filterDistributionResolutions(entry, 'commonjs')\n\t\t\t\t\treturn {\n\t\t\t\t\t\tentry: entry.subpath,\n\t\t\t\t\t\tdriven: drivers.length > 0,\n\t\t\t\t\t\treported: drivers.flatMap((driver) =>\n\t\t\t\t\t\t\tcheckDistributionSurface(stage, { entry, extension: 'cts', published, driver }),\n\t\t\t\t\t\t),\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\treturn {\n\t\t\t\t\tactual: readings,\n\t\t\t\t\texpected: entries.map((entry) => ({ entry: entry.subpath, driven: true, reported: [] })),\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t]\n}\n`,\n\t\t\tproof: `import {\n\t// These exports remain available to proofs emitted by earlier scaffold releases.\n\tbuildDistributionCases,\n\t{{import}}createDistributionSuite,\n} from './setupDistribution.js'\nimport { afterAll, beforeAll, describe, expect, it } from 'vitest'\n\nconst DISTRIBUTION_SUITE = createDistributionSuite()\n\nbeforeAll(() => DISTRIBUTION_SUITE.start())\n\nafterAll(() => DISTRIBUTION_SUITE.destroy())\n\ndescribe('installed package consumer', () => {\n\tfor (const row of buildDistributionCases(DISTRIBUTION_SUITE)) {\n\t\tit(\\`\\${row.label}\\`, async (context) => {\n\t\t\tconst observation = await row.observe(context)\n\t\t\texpect(observation.actual).toStrictEqual(observation.expected)\n\t\t})\n\t}\n{{guard}}{{drive}}})\n`,\n\t\t\ttransport: `import { createServer } from 'node:http'\n`,\n\t\t\ttypes: `import type { PlaywrightProviderOptions } from '@vitest/browser-playwright'\nimport type { Browser } from 'playwright'\n`,\n\t\t\tlauncher: `import { chromium } from 'playwright'\nimport { build } from 'vite'\nimport { resolveBrowser, resolvePinnedBrowser } from '../configs/browsers.js'\n`,\n\t\t\timport: 'checkDistributionBrowser,\\n\\t',\n\t\t\thelpers: `/** Defines the page that loads a bundled browser consumer. */\nexport const DISTRIBUTION_BROWSER_PAGE = \\`<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<meta charset=\"UTF-8\" />\n\t\t<title>Distribution</title>\n\t</head>\n\t<body>\n\t\t<script type=\"module\" src=\"./main.js\"></script>\n\t</body>\n</html>\n\\`\n\n/**\n * Infers the response media type from a bundle filename.\n *\n * @param path - The requested bundle path.\n * @returns The media type, defaulting to application/octet-stream.\n */\nexport function inferDistributionContentType(path: string): string {\n\tif (path.endsWith('.html')) return 'text/html'\n\tif (path.endsWith('.js')) return 'text/javascript'\n\tif (path.endsWith('.css')) return 'text/css'\n\tif (path.endsWith('.json') || path.endsWith('.map')) return 'application/json'\n\treturn 'application/octet-stream'\n}\n\n// \\`resolveBrowser\\` answers with provider options and never reports absence: its\n// last resort is a channel nothing verified. So the launch is attempted and its\n// rejection classified, rather than probed for and ruled on.\n/**\n * Renders the browser endpoint selected by provider options.\n *\n * @param options - The browser provider options.\n * @returns The endpoint, executable, channel, or bundled-browser description.\n */\nexport function renderDistributionBrowser(options: PlaywrightProviderOptions): string {\n\tconst endpoint = options.connectOptions?.wsEndpoint\n\tif (endpoint !== undefined) return \\`the browser server at \\${endpoint}\\`\n\tconst executable = options.launchOptions?.executablePath\n\tif (executable !== undefined) return \\`the executable at \\${executable}\\`\n\tconst channel = options.launchOptions?.channel\n\tif (channel !== undefined) return \\`the \\${channel} channel\\`\n\treturn 'the Chromium Playwright installed for itself'\n}\n\n/**\n * Launches or connects to the selected Chromium browser.\n *\n * @param options - The browser provider options.\n * @returns The real browser. Rejects when the selected browser is unavailable.\n */\nexport async function launchDistributionBrowser(\n\toptions: PlaywrightProviderOptions,\n): Promise<Browser> {\n\tconst endpoint = options.connectOptions?.wsEndpoint\n\tif (endpoint !== undefined) return chromium.connect(endpoint)\n\treturn chromium.launch({ ...options.launchOptions, headless: true })\n}\n\n// A consumer of one installed browser entry, bundled by the Vite toolchain this\n// workspace already declares. Nothing is stubbed: the bundle resolves the installed\n// package and its whole transitive graph as an application consuming it would.\n/**\n * Bundles a browser consumer against an installed public entry.\n *\n * @param stage - The installed consumer.\n * @param entry - The browser publication.\n * @returns The bundle directory. Rejects when Vite cannot build the consumer.\n */\nexport async function bundleDistributionEntry(\n\tstage: DistributionStage,\n\tentry: DistributionEntry,\n): Promise<string> {\n\tconst page = join(stage.consumer, 'pages', entry.subpath.replaceAll(/[^\\\\w]+/gu, '-'))\n\tconst specifier = JSON.stringify(entry.specifier)\n\twriteDistributionFile(join(page, 'index.html'), DISTRIBUTION_BROWSER_PAGE)\n\twriteDistributionFile(\n\t\tjoin(page, 'main.js'),\n\t\t\\`import * as entry from \\${specifier}\\\\nglobalThis.subject = Object.keys(entry).sort()\\\\n\\`,\n\t)\n\tawait build({\n\t\tbase: './',\n\t\tbuild: { emptyOutDir: true, outDir: 'bundle' },\n\t\tconfigFile: false,\n\t\tlogLevel: 'error',\n\t\troot: page,\n\t})\n\treturn join(page, 'bundle')\n}\n\n// The key set the bundled module publishes in a real browser, read off the page\n// after it has loaded over a loopback server. A module that never evaluated\n// publishes nothing, and a page error is raised rather than compared away.\n/**\n * Reads the names a real browser publishes from a served bundle.\n *\n * @param browser - The browser to drive.\n * @param bundle - The built consumer directory.\n * @returns The exported names. Rejects on a page error or an invalid name list.\n */\nexport async function readDistributionBrowserExports(\n\tbrowser: Browser,\n\tbundle: string,\n): Promise<readonly string[]> {\n\tconst server = createServer((request, response) => {\n\t\tconst asked = request.url === undefined || request.url === '/' ? '/index.html' : request.url\n\t\tconst path = join(bundle, decodeURIComponent(asked))\n\t\tif (!path.startsWith(bundle) || !existsSync(path)) {\n\t\t\tresponse.writeHead(404)\n\t\t\tresponse.end()\n\t\t\treturn\n\t\t}\n\t\tresponse.writeHead(200, { 'content-type': inferDistributionContentType(path) })\n\t\tresponse.end(readFileSync(path))\n\t})\n\ttry {\n\t\tawait new Promise<void>((settle) => {\n\t\t\tserver.listen(0, '127.0.0.1', settle)\n\t\t})\n\t\tconst address = server.address()\n\t\tif (address === null || typeof address === 'string') {\n\t\t\tthrow new Error('The bundle server bound no port')\n\t\t}\n\t\tconst page = await browser.newPage()\n\t\tconst failures: string[] = []\n\t\tpage.on('pageerror', (error) => failures.push(String(error)))\n\t\tawait page.goto(\\`http://127.0.0.1:\\${String(address.port)}/\\`, { waitUntil: 'load' })\n\t\tconst published: unknown = await page.evaluate('globalThis.subject')\n\t\tif (failures.length > 0) throw new Error(\\`The bundle raised \\${failures.join(' | ')}\\`)\n\t\tif (!isDistributionNames(published))\n\t\t\tthrow new Error('The bundled module published no name list')\n\t\treturn published\n\t} finally {\n\t\tserver.close()\n\t}\n}\n/**\n * Checks each browser publication against its installed declarations in a real browser.\n * @param stage - The installed consumer to drive.\n * @param context - The proof context that reports unavailable browser prerequisites.\n * @returns The compiler diagnostics each browser publication reports.\n */\nexport async function checkDistributionBrowser(\n\tstage: DistributionStage,\n\tcontext: TestContext,\n): Promise<readonly string[]> {\n\tconst driver = DISTRIBUTION_BROWSER_RESOLUTION\n\tif (driver === undefined) throw new Error(\"DISTRIBUTION_RESOLUTIONS carries no 'bundler' row\")\n\tconst entries = stage.entries.filter((entry) => entry.browsable)\n\tif (entries.length === 0) return context.skip('No installed entry supports a browser')\n\tconst readings: Array<readonly string[]> = []\n\tfor (const entry of entries) {\n\t\tif (!entry.declaration.browsable) {\n\t\t\tthrow new Error(\\`\\${entry.subpath} publishes no browser declaration\\`)\n\t\t}\n\t\tconst options = resolveBrowser(resolvePinnedBrowser(), process.platform, process.env)\n\t\tconst browser = await launchDistributionBrowser(options).catch((error: unknown) => {\n\t\t\tconst cause = \\`\\${renderDistributionBrowser(options)} was rejected: \\${String(error)}\\`\n\t\t\tif (DISTRIBUTION_RELEASE) throw new Error(\\`The release gate requires a browser, and \\${cause}\\`)\n\t\t\treturn context.skip(\\`No browser launched. \\${cause}\\`)\n\t\t})\n\t\ttry {\n\t\t\tconst bundle = await bundleDistributionEntry(stage, entry)\n\t\t\tconst published = await readDistributionBrowserExports(browser, bundle)\n\t\t\t// A browser consumer reads the installed declarations through a bundler, so\n\t\t\t// that is the one driver this face answers under.\n\t\t\tconst reported = checkDistributionSurface(stage, {\n\t\t\t\tentry,\n\t\t\t\textension: 'ts',\n\t\t\t\tpublished,\n\t\t\t\tdriver,\n\t\t\t})\n\t\t\treadings.push(reported)\n\t\t} finally {\n\t\t\tawait browser.close()\n\t\t}\n\t}\n\treturn readings.flat()\n}\n`,\n\t\t\tdrive: `\tit('publishes what it declares to a real browser [requires a browser]', async (context) => {\n\t\texpect(await checkDistributionBrowser(DISTRIBUTION_SUITE.read(context), context)).toStrictEqual(\n\t\t\t[],\n\t\t)\n\t})\n`,\n\t\t\tguard: `\tit('publishes no browser face this proof cannot drive [requires the registry]', (context) => {\n\t\tconst faces = DISTRIBUTION_SUITE.read(context).entries.filter((entry) => entry.browsable)\n\t\texpect(faces.map((entry) => entry.subpath)).toStrictEqual([])\n\t})\n`,\n\t\t}),\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\tagents: `# AGENTS.md\n\nThe \\`@orkestrel/scaffold\\` package is this repository's coding and orchestration authority. This\nfile points at it and states no law of its own.\n\nRead these before working: the \\`AGENTS.md\\` coding contract, the \\`.agents/orchestration.md\\`\nagent-operation contract, every applicable rule the contract's rule map names under\n\\`.claude/rules/\\`, and the dispatch-named skill under \\`.agents/skills/\\` with the references it\nrequires.\n\nResolve every one of those paths against scaffold, never against this repository:\n\n- When a scaffold checkout sits beside this repository, read \\`../scaffold/AGENTS.md\\`, the\n \\`../scaffold/.agents/orchestration.md\\` file, the \\`../scaffold/.claude/rules/\\` directory, and\n the \\`../scaffold/.agents/skills/\\` directory.\n- Otherwise read the installed copy, whose paths drop the dot that opens each segment: the\n \\`node_modules/@orkestrel/scaffold/dist/host/AGENTS.md\\` file, the\n \\`node_modules/@orkestrel/scaffold/dist/host/agents/orchestration.md\\` file, the\n \\`node_modules/@orkestrel/scaffold/dist/host/claude/rules/\\` directory, and the\n \\`node_modules/@orkestrel/scaffold/dist/host/agents/skills/\\` directory.\n\nEvery path a scaffold-supplied file names resolves the same way. Run a script such a file names\nthrough its built twin: replace \\`node .agents/skills/\\` with\n\\`node node_modules/@orkestrel/scaffold/dist/agents/skills/\\` and the \\`.ts\\` extension with \\`.js\\`,\nbecause Node runs no \\`.ts\\` file under \\`node_modules\\`. The files this repository carries\n— the \\`.claude/agents/orkestrel.md\\` catalog file, the \\`.claude/settings.json\\` permission file,\nthe bench scripts under \\`scripts/\\`, and the skill pointers under \\`.agents/skills/\\` and\n\\`.claude/skills/\\`, which name the canonical skills and how to run their scripts — are this\nrepository's own copies and resolve here.\n\nIn Claude Code, also read the Claude bridge: \\`../scaffold/.claude/AGENTS.md\\` beside a checkout, or\n\\`node_modules/@orkestrel/scaffold/dist/host/claude/AGENTS.md\\` from the installed copy. Keep no\n\\`CLAUDE.md\\` in this repository; one stops Claude Code from reading this file.\n\nEdit none of the scaffold-owned files here. The \\`scaffold repair\\` command restores them, so a\nchange to one is a commit in the scaffold repository followed by a release.\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\tskill: `\n# Load the canonical skill\n\nThis file is a pointer the \\`@orkestrel/scaffold\\` package writes into every fleet workspace; the\nskill itself ships with that package. Read the canonical \\`SKILL.md\\` completely and follow it:\n\n- beside a scaffold checkout, \\`../scaffold/.agents/skills/{{name}}/SKILL.md\\`;\n- otherwise, \\`node_modules/@orkestrel/scaffold/dist/host/agents/skills/{{name}}/SKILL.md\\`.\n\nResolve every path the canonical skill names against the same root; under \\`node_modules\\` each\nsegment drops its opening dot. Run a script the skill names through its built twin, as this\nrepository's \\`AGENTS.md\\` states. This pointer carries no process of its own; \\`AGENTS.md\\`, the applicable\nrules, and the canonical skill remain authoritative in that order.\n`,\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'\nimport { isInstance } from '@orkestrel/contract'\n\n/**\n * Represents 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 { isScaffoldError, ScaffoldError } from '@orkestrel/scaffold'\n *\n * try {\n * \tthrow new ScaffoldError('TARGET', 'The target carries no readable manifest.')\n * } catch (error) {\n * \tif (isScaffoldError(error)) error.code // 'TARGET'\n * }\n * ```\n */\nexport class ScaffoldError extends Error {\n\treadonly code: ScaffoldErrorCode\n\treadonly context?: unknown\n\n\t/**\n\t * Constructs 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 * Narrows a caught value to a {@link ScaffoldError}.\n *\n * @param value - The caught value to narrow.\n * @returns True if `value` is a {@link ScaffoldError}; false otherwise.\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 isInstance(value, ScaffoldError)\n}\n","import type { Guard } from '@orkestrel/contract'\nimport type { EmitterHooks } from '@orkestrel/emitter'\nimport type {\n\tArtifact,\n\tAudit,\n\tBlueprint,\n\tBrowserExtension,\n\tCatalogEntry,\n\tCompilerEventMap,\n\tCompilerOptions,\n\tDependency,\n\tEnvironment,\n\tExtension,\n\tFinding,\n\tGroup,\n\tManifestScript,\n\tMirror,\n\tOverride,\n\tPlan,\n\tQuestion,\n\tSnapshot,\n\tStylesExtension,\n\tSurface,\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\tAXES,\n\tCONTROL_CHARACTER_PATTERN,\n\tDEPENDENCY_NAME_PATTERN,\n\tENVIRONMENTS,\n\tFRAMEWORKS,\n\tGROUPS,\n\tHEX_PATTERN,\n\tINVALID_PATH_CHARACTER_PATTERN,\n\tMANIFEST_PATH,\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\tMAX_SCRIPT_LENGTH,\n\tNAME_PATTERN,\n\tRESERVED_SHEET_NAMES,\n\tSURFACES,\n} from './constants.js'\n\n/**\n * Narrows a value to a logical target-relative path.\n *\n * @param value - The candidate path.\n * @returns True if the value is a bounded relative path with no traversal, empty\n * segment, control character, or reserved syntax character; false otherwise.\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 * Narrows 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 * Narrows 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 places the bytes\n * are actually produced.\n */\nexport const isContent: Guard<string> = stringOf({ max: MAX_ARTIFACT_BYTES })\n\n/**\n * Narrows a value to an array within the limit one public collection accepts.\n *\n * @param value - The candidate collection.\n * @returns True if the value is an array of no more than\n * `MAX_COLLECTION_ITEMS` items; false otherwise.\n *\n * @remarks\n * Compose this ahead of an element guard so the item count is settled before\n * anything walks the items. A throwing `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 * Narrows 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 * Narrows a value to a surface an extension can extend.\n * @param value - The candidate surface.\n * @returns True if the value is a supported surface; false otherwise.\n * @example\n * ```ts\n * import { isSurface } from '@orkestrel/scaffold'\n *\n * isSurface('styles') // true\n * isSurface('themes') // false\n * ```\n */\nexport const isSurface: Guard<Surface> = literalOf(SURFACES)\n\n/**\n * Narrows a value to a non-reserved sheet face name.\n * @param value - The candidate name.\n * @returns True if the name matches the workspace pattern and is not reserved; false otherwise.\n * @example\n * ```ts\n * import { isSheetName } from '@orkestrel/scaffold'\n *\n * isSheetName('print') // true\n * isSheetName('styles') // false\n * ```\n */\nexport function isSheetName(value: unknown): value is string {\n\treturn (\n\t\tisString(value) &&\n\t\tvalue.length <= MAX_NAME_LENGTH &&\n\t\tNAME_PATTERN.test(value) &&\n\t\t!RESERVED_SHEET_NAMES.includes(value)\n\t)\n}\n\n/**\n * Narrows a value to a supported browser framework with distinct occupied axes.\n * @param value - The candidate extension.\n * @returns True if the value is an admitted extension; false otherwise.\n * @example\n * ```ts\n * import { isBrowserExtension } from '@orkestrel/scaffold'\n *\n * isBrowserExtension({ surface: 'browser', name: 'vue', axes: ['app'] }) // true\n * isBrowserExtension(undefined) // false\n * ```\n */\nexport const isBrowserExtension: Guard<BrowserExtension> = andOf(\n\trecordOf({\n\t\tsurface: literalOf('browser'),\n\t\tname: literalOf(FRAMEWORKS),\n\t\taxes: andOf(isCollection, arrayOf(literalOf(AXES))),\n\t}),\n\t(extension: BrowserExtension) => new Set(extension.axes).size === extension.axes.length,\n)\n\n/**\n * Narrows a value to a named non-reserved stylesheet face.\n * @param value - The candidate extension.\n * @returns True if the value is an admitted extension; false otherwise.\n * @example\n * ```ts\n * import { isStylesExtension } from '@orkestrel/scaffold'\n *\n * isStylesExtension({ surface: 'styles', name: 'print' }) // true\n * isStylesExtension(undefined) // false\n * ```\n */\nexport const isStylesExtension: Guard<StylesExtension> = recordOf({\n\tsurface: literalOf('styles'),\n\tname: isSheetName,\n})\n\n/**\n * Narrows a value to an extension of a supported surface.\n * @param value - The candidate extension.\n * @returns True if the value is an admitted extension; false otherwise.\n * @example\n * ```ts\n * import { isExtension } from '@orkestrel/scaffold'\n *\n * isExtension({ surface: 'styles', name: 'print' }) // true\n * isExtension(undefined) // false\n * ```\n */\nexport const isExtension: Guard<Extension> = unionOf(isBrowserExtension, isStylesExtension)\n\n/**\n * Narrows 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/** Narrows a value to a bounded group selection. */\nexport const isGroups: Guard<readonly Group[]> = andOf(isCollection, arrayOf(isGroup))\n\n/**\n * Narrows 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 * Narrows 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 * Narrows a value to a {@link ManifestScript}.\n *\n * @remarks\n * Structural and bounded, exactly as {@link isDependency} is: a script name\n * and a script command are free text a manifest may carry, and which values a\n * region writer is willing to overwrite is the caller's decision rather than\n * this guard's.\n *\n * @example\n * ```ts\n * import { isManifestScript } from '@orkestrel/scaffold'\n *\n * isManifestScript({ name: 'test', command: 'vitest run', accepted: [] }) // true\n * isManifestScript({ name: 'test', command: 'vitest run' }) // false\n * ```\n */\nexport const isManifestScript: Guard<ManifestScript> = recordOf({\n\tname: stringOf({ min: 1, max: MAX_SCRIPT_LENGTH }),\n\tcommand: stringOf({ min: 1, max: MAX_SCRIPT_LENGTH }),\n\taccepted: andOf(isCollection, arrayOf(stringOf({ min: 1, max: MAX_SCRIPT_LENGTH }))),\n})\n\n/**\n * Narrows 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 * Narrows 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\textensions: andOf(isCollection, arrayOf(isExtension)),\n\t\tstyles: isBoolean,\n\t\tthemes: isBoolean,\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\tsetup: andOf(isCollection, arrayOf(literalOf('node', 'browser'))),\n\t\tguides: isBoolean,\n\t\tintegration: isBoolean,\n\t\tconformance: isBoolean,\n\t\ttree: isBoolean,\n\t\tservice: isBoolean,\n\t\tvendors: andOf(isCollection, arrayOf(isString)),\n\t\tstudies: isBoolean,\n\t\tglobal: isBoolean,\n\t\tshowcase: isBoolean,\n\t\tjourney: isBoolean,\n\t\tskills: isBoolean,\n\t},\n\t['description'],\n)\n\n/**\n * Narrows 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\tpointer: isBoolean,\n\t\t},\n\t\t['environment', 'source', 'pointer'],\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 * Narrows 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. An artifact at {@link MANIFEST_PATH}\n * must carry `birth` ownership. A plan claiming `content` or `presence` there\n * is refused because the compiler emits the manifest only as birth-owned.\n */\nexport const isPlan: Guard<Plan> = andOf(\n\trecordOf(\n\t\t{\n\t\t\tblueprint: isBlueprint,\n\t\t\tgroups: isGroups,\n\t\t\tartifacts: andOf(isCollection, arrayOf(isArtifact)),\n\t\t\thash: isHex,\n\t\t},\n\t\t['hash'],\n\t),\n\t(plan: Plan) =>\n\t\tplan.artifacts.every(\n\t\t\t(artifact) => artifact.path !== MANIFEST_PATH || artifact.ownership === 'birth',\n\t\t),\n)\n\n/**\n * Narrows 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 * Narrows 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 * Narrows 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 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 * Narrows 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 they 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', 'unmatched', 'failed'),\n\t\t\tnote: isString,\n\t\t\tobserved: isHex,\n\t\t},\n\t\t['observed'],\n\t),\n)\n\n/**\n * Narrows 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\tpeers: andOf(isCollection, arrayOf(isDependency)),\n\t}),\n\trecordOf({\n\t\tname: isDependencyName,\n\t\tlookup: literalOf('missing', 'unmatched', 'failed'),\n\t\tnote: isString,\n\t}),\n)\n\n/**\n * Narrows a value to a {@link Snapshot}.\n *\n * @param value - The candidate target snapshot.\n * @returns True if the value is a bounded plain record whose every key is a path and\n * whose every value is exact lowercase hexadecimal bytes; false otherwise.\n *\n * @remarks\n * Read through the shared total key lens, so an `ownKeys` trap that throws 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 * Narrows 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 * Narrows 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 * Snapshots 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, Extension, Group, Snapshot } from './types.js'\nimport { isString } from '@orkestrel/contract'\nimport {\n\tisBlueprint,\n\tisCompilerOptions,\n\tisExtension,\n\tisGroups,\n\tisSnapshot,\n\tisSurface,\n} from './validators.js'\n\n/**\n * Coerces an extension value or a `surface:name` selection into an extension.\n * @param value - An extension record or its selection text.\n * @returns The extension, or `undefined` for a malformed or unsupported selection.\n * @remarks Browser text has empty axes; the creating command supplies its selected browser axes.\n * @example\n * ```ts\n * import { parseExtension } from '@orkestrel/scaffold'\n *\n * parseExtension('browser:vue') // { surface: 'browser', name: 'vue', axes: [] }\n * parseExtension('styles:print') // { surface: 'styles', name: 'print' }\n * ```\n */\nexport function parseExtension(value: unknown): Extension | undefined {\n\tif (isExtension(value)) return value\n\tif (!isString(value)) return undefined\n\tconst [surface, name, excess] = value.split(':')\n\tif (excess !== undefined || !isSurface(surface)) return undefined\n\tconst candidate = surface === 'browser' ? { surface, name, axes: [] } : { surface, name }\n\treturn isExtension(candidate) ? candidate : undefined\n}\n\n/**\n * Coerces 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 * Coerces 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 * Coerces 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 * Coerces 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\tManifestDependencySet,\n\tManifestToken,\n\tDrift,\n\tEnvironment,\n\tFinding,\n\tGroup,\n\tOwnership,\n\tPlan,\n\tPlanSummary,\n} from './types.js'\nimport { compareValues, isRecord, isString, limitEntries, parseJSON } from '@orkestrel/contract'\nimport { fillTemplate } from '@orkestrel/template'\nimport {\n\tCANON_PATHS,\n\tCATALOG_AGENT_PATH,\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\tWORKSPACE_OWNED_PATHS,\n} from './constants.js'\nimport { ARTIFACT_TEMPLATES } from './templates.js'\n\n/**\n * Encodes 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\tconst digits = Array.from({ length: 256 }, (_, value) => value.toString(16).padStart(2, '0'))\n\treturn Iterator.from(bytes)\n\t\t.map((byte) => digits[byte] ?? '')\n\t\t.toArray()\n\t\t.join('')\n}\n\n/**\n * Encodes 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 * Counts 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\treturn content[Symbol.iterator]().reduce((bytes, character) => {\n\t\tconst code = character.codePointAt(0) ?? 0\n\t\treturn bytes + (code <= 0x7f ? 1 : code <= 0x7ff ? 2 : code <= 0xffff ? 3 : 4)\n\t}, 0)\n}\n\n/**\n * Computes the sum of a list of numbers.\n *\n * @param values - The numbers to add.\n * @returns The sum, and `0` for no numbers.\n *\n * @remarks\n * The one place a running tally is derived from the amounts that make it up, so a\n * byte budget is the allowance less what was spent rather than a counter that is\n * reassigned as reads land.\n *\n * @example\n * ```ts\n * import { computeTotal } from '@orkestrel/scaffold'\n *\n * computeTotal([65536, 65536, 12]) // 131084\n * computeTotal([]) // 0\n * ```\n */\nexport function computeTotal(values: readonly number[]): number {\n\treturn values.reduce((total, value) => total + value, 0)\n}\n\n/**\n * Yields the answer to each value of a source and ends after the first refused answer.\n *\n * @param source - The values to answer, requested one at a time as the answers are read.\n * @param answer - Answers one value, or returns `undefined` to refuse it.\n * @returns A generator of the answers in source order, whose last answer is the first refusal when\n * the source holds one.\n * @throws Thrown when `answer` throws for a value, with that error, or when closing `source` after\n * a refusal throws, with the close's error.\n *\n * @remarks\n * The body is a `for…of` loop, so the source's iterator is requested once, when the first answer\n * is read, and stepped only as the answers are read: a length the source reports never bounds the\n * read, a hole reads as an `undefined` value, and an infinite source is read as far as the first\n * refusal. The iterator is closed after a refusal with a normal completion, so a raising close\n * surfaces, and is closed when `answer` throws with a throw completion, so the error from `answer`\n * wins. An iterator that ends is left alone. A caller that stops at a refusal and keeps what came\n * before it reads the answers into a list and checks that none is `undefined`.\n *\n * @example\n * ```ts\n * import { iterateAnswers } from '@orkestrel/scaffold'\n *\n * const halve = (value: number): number | undefined => (value % 2 === 0 ? value / 2 : undefined)\n *\n * Array.from(iterateAnswers([2, 4, 5, 6], halve)).length // 3\n * Array.from(iterateAnswers([2, 4], halve)) // [1, 2]\n * ```\n */\nexport function* iterateAnswers<TValue, TAnswer>(\n\tsource: Iterable<TValue>,\n\tanswer: (value: TValue) => TAnswer | undefined,\n): Generator<TAnswer | undefined, void, undefined> {\n\tfor (const value of source) {\n\t\tconst answered = answer(value)\n\t\tyield answered\n\t\tif (answered === undefined) return\n\t}\n}\n\n/**\n * Computes 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\t// The iterator yields code points; a surrogate pair folds as its two code units.\n\tconst hash = text[Symbol.iterator]().reduce((digest, character) => {\n\t\tconst first = BigInt.asUintN(64, (digest ^ BigInt(character.charCodeAt(0))) * 0x100000001b3n)\n\t\treturn character.length === 1\n\t\t\t? first\n\t\t\t: BigInt.asUintN(64, (first ^ BigInt(character.charCodeAt(1))) * 0x100000001b3n)\n\t}, 0xcbf29ce484222325n)\n\treturn hash.toString(16).padStart(16, '0')\n}\n\n/**\n * Tests 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 if the path is beneath a harness directory or is one of the exact\n * root filenames that wires an agent bench; false otherwise.\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 an added\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 * Checks whether another surface owns the vendored bytes at a path.\n *\n * @param path - The target-relative vendored path to test.\n * @returns True if the path is the catalog agent file or a Markdown guide\n * mirror; false otherwise.\n *\n * @remarks\n * The materializer keeps these paths presence-owned because the catalog or\n * mirror surface writes their bytes. A live host fill therefore keeps the\n * installed floor's bytes for them and requests only the host-owned paths.\n *\n * @example\n * ```ts\n * import { isDeferredPath } from '@orkestrel/scaffold'\n *\n * isDeferredPath('guides/router.md') // true\n * isDeferredPath('AGENTS.md') // false\n * ```\n */\nexport function isDeferredPath(path: string): boolean {\n\treturn path === CATALOG_AGENT_PATH || (path.startsWith('guides/') && path.endsWith('.md'))\n}\n\n/**\n * Checks whether a path belongs to the instruction canon a target reads rather than holds.\n *\n * @param path - The target-relative path to test.\n * @returns True if the path is a {@link CANON_PATHS} member or sits beneath a\n * member that is a directory; false otherwise.\n *\n * @remarks\n * The one reading of canon membership, so the live overlay and the executable's\n * fetch list never disagree about what a path is. The match runs to a segment\n * boundary, so a sibling whose name opens with a member's name —\n * `.claude/rulesets` beside `.claude/rules` — stays outside.\n *\n * Membership answers whether scaffold owns the path, not whether a plan claims\n * it. A plan claims `AGENTS.md` and {@link CATALOG_AGENT_PATH} at canon paths\n * deliberately, so a consumer deciding whether to write, restore, or remove a\n * path reads the plan rather than this predicate. A member the checkout no\n * longer holds is still canon, so a copy a target keeps reports as foreign.\n *\n * @example\n * ```ts\n * import { isCanonPath } from '@orkestrel/scaffold'\n *\n * isCanonPath('.claude/rules/names.md') // true\n * isCanonPath('.claude/settings.json') // false\n * ```\n */\nexport function isCanonPath(path: string): boolean {\n\treturn CANON_PATHS.some((canon) => path === canon || path.startsWith(`${canon}/`))\n}\n\n/**\n * Checks whether another surface owns a target's present bytes at a path.\n *\n * @param path - The target-relative path to test.\n * @returns True if the path is a {@link WORKSPACE_OWNED_PATHS} member or a\n * deferred path; false otherwise.\n *\n * @remarks\n * The one reading of presence ownership. A workspace-owned path carries bytes\n * the consumer's own workspace writes, and a deferred path carries bytes the\n * catalog or mirror surface writes, so a vendored expansion plans either by\n * presence rather than reading and claiming its content.\n *\n * @example\n * ```ts\n * import { isRetainedPath } from '@orkestrel/scaffold'\n *\n * isRetainedPath('.gitignore') // true\n * isRetainedPath('LICENSE') // false\n * ```\n */\nexport function isRetainedPath(path: string): boolean {\n\treturn WORKSPACE_OWNED_PATHS.includes(path) || isDeferredPath(path)\n}\n\n/**\n * Checks whether a destination's floor bytes survive a live overlay.\n *\n * @param path - The target-relative destination to test.\n * @returns True if the path is deferred or belongs to the instruction\n * canon; false otherwise.\n *\n * @remarks\n * The one reading of what a live fill does not replace, so the overlay assembler\n * and the executable's fetch list never disagree about a destination. A deferred\n * path's bytes belong to the catalog or mirror verb, and a canon destination is\n * staged for reading rather than for a target, so the installed floor's bytes\n * stand for both. A reader that requested either would spend a round trip on\n * bytes the overlay would not take.\n *\n * @example\n * ```ts\n * import { isFloorPath } from '@orkestrel/scaffold'\n *\n * isFloorPath('AGENTS.md') // true\n * isFloorPath('scripts/codex.sh') // false\n * ```\n */\nexport function isFloorPath(path: string): boolean {\n\treturn isDeferredPath(path) || isCanonPath(path)\n}\n\n/**\n * Infers 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\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 row holds the licence, the workspace's own front page, and the\n\t// scaffold-owned root pointers. The group carries placement rather than\n\t// authorship, so `Ownership` is what separates them.\n\tif (path === 'LICENSE') return 'docs'\n\tif (!path.includes('/') && path.endsWith('.md')) return 'docs'\n\treturn 'configs'\n}\n\n/**\n * Serializes 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\tconst escapes: Readonly<Record<string, string>> = {\n\t\t\"'\": \"\\\\'\",\n\t\t'\\\\': '\\\\\\\\',\n\t\t'\\b': '\\\\b',\n\t\t'\\f': '\\\\f',\n\t\t'\\n': '\\\\n',\n\t\t'\\r': '\\\\r',\n\t\t'\\t': '\\\\t',\n\t\t'
': '\\\\u2028',\n\t\t'
': '\\\\u2029',\n\t}\n\t// The iterator yields code points, so a surrogate pair is one two-unit character\n\t// that passes through and a lone surrogate is a one-unit character that escapes.\n\tconst serialized = Array.from(value, (character) => {\n\t\tconst escape = escapes[character]\n\t\tif (escape !== undefined) return escape\n\t\tconst code = character.charCodeAt(0)\n\t\treturn character.length === 1 && (code < 0x20 || (code >= 0xd800 && code <= 0xdfff))\n\t\t\t? `\\\\u${code.toString(16).padStart(4, '0')}`\n\t\t\t: character\n\t}).join('')\n\treturn `'${serialized}'`\n}\n\n/**\n * Derives 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 * Tests whether one emitted line fits the vendored formatter width.\n *\n * @param line - One emitted line, leading tabs included.\n * @returns True if the expanded line fits; false otherwise.\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 * Selects 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 * Selects 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 * The candidates include the seed guide mirrors beside `HOST_PATHS`. 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 * Selects 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 * Projects 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 * Infers 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 * Projects 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 every ownership tier.\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 * Tests 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 True if the ownership and verdict are reachable through\n * {@link inferDrift}; false otherwise.\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 *\n * @example\n * ```ts\n * import type { Finding } from '@orkestrel/scaffold'\n * import { matchesDriftReachability } from '@orkestrel/scaffold'\n *\n * const aligned: Finding = {\n * \tpath: 'README.md',\n * \tgroup: 'docs',\n * \townership: 'birth',\n * \tdrift: 'aligned',\n * }\n * const stale: Finding = {\n * \tpath: 'README.md',\n * \tgroup: 'docs',\n * \townership: 'birth',\n * \tdrift: 'stale',\n * \tobserved: '6279650a',\n * }\n *\n * matchesDriftReachability('birth', aligned) // true\n * matchesDriftReachability('birth', stale) // false\n * ```\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 * Projects 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 and PEER 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. A\n * peer edge counts like a runtime edge, because a caret peer range at `0.0.x`\n * names one exact release the dependent cannot publish ahead of.\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 ranges that disagree install\n * duplicate copies of one package that the compiler reads as 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 Fleet catalog\n * ```ts\n * import { catalogToLayers } from '@orkestrel/scaffold'\n *\n * const layers = catalogToLayers(entries)\n * layers[0] // the names that depend on nothing else in the fleet\n * ```\n */\nexport function catalogToLayers(\n\tentries: readonly CatalogEntry[],\n): ReadonlyArray<readonly string[]> {\n\t// The names come from a first pass that skips a hole. The edges come from a second pass, whose\n\t// iterator consumes one entry at a time and which reads a hole as an `undefined` entry, as a\n\t// `for…of` over the list would.\n\tconst published = new Set(\n\t\tentries.filter((entry) => entry.lookup === 'found').map((entry) => entry.name),\n\t)\n\t// A later entry of one name replaces an earlier one at the earlier position, as a keyed\n\t// write does, and an edge to a name that is not published constrains nothing.\n\tconst found = Iterator.from(entries)\n\t\t.flatMap((entry): ReadonlyArray<readonly [string, readonly string[]]> =>\n\t\t\tentry.lookup === 'found'\n\t\t\t\t? [\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\tentry.name,\n\t\t\t\t\t\t\t[...entry.dependencies, ...entry.peers]\n\t\t\t\t\t\t\t\t.map((dependency) => dependency.name)\n\t\t\t\t\t\t\t\t.filter((name) => published.has(name)),\n\t\t\t\t\t\t],\n\t\t\t\t\t]\n\t\t\t\t: [],\n\t\t)\n\t\t.toArray()\n\tconst dependencies = new Map(found)\n\t// Each round places every name whose edges are all placed, in name order. A round that places\n\t// nothing leaves the state as it was, which ends the layers: a cycle never becomes ready.\n\t// One round per found entry is enough, because a round that places anything places one name.\n\treturn found.reduce<{\n\t\treadonly layers: ReadonlyArray<readonly string[]>\n\t\treadonly placed: ReadonlySet<string>\n\t}>(\n\t\t(state) => {\n\t\t\tconst ready = [...dependencies]\n\t\t\t\t.filter(\n\t\t\t\t\t([name, edges]) =>\n\t\t\t\t\t\t!state.placed.has(name) && edges.every((edge) => state.placed.has(edge)),\n\t\t\t\t)\n\t\t\t\t.map(([name]) => name)\n\t\t\t\t.sort()\n\t\t\treturn ready.length === 0\n\t\t\t\t? state\n\t\t\t\t: { layers: [...state.layers, ready], placed: new Set([...state.placed, ...ready]) }\n\t\t},\n\t\t{ layers: [], placed: new Set() },\n\t).layers\n}\n\n/**\n * Projects 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\t// The iterator reads a hole as an `undefined` artifact, as a `for…of` over the list would, and the\n\t// tally counts the artifacts it yields rather than the length the list reports.\n\tconst origins = Iterator.from(plan.artifacts)\n\t\t.map((artifact) => artifact.origin)\n\t\t.toArray()\n\tconst host = origins.filter((origin) => origin === 'host').length\n\tconst template = origins.filter((origin) => origin === 'template').length\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: origins.length - host - template,\n\t}\n}\n\n/**\n * Extracts the major, minor, and patch 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 `major.minor.patch` 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 * Extracts the major component of an admitted dependency range.\n *\n * @param range - The candidate range text.\n * @returns The major number, or `undefined` when the text is not a canonical\n * major caret or an admitted full-version form.\n *\n * @remarks\n * A canonical toolchain range is `^MAJOR`. Existing consumer declarations may\n * instead carry an exact `major.minor.patch` version or that version under a\n * caret or tilde. The projection reads those forms without deciding whether a\n * version satisfies them; {@link matchesRange} owns that separate question.\n *\n * @example\n * ```ts\n * import { extractRangeMajor } from '@orkestrel/scaffold'\n *\n * extractRangeMajor('^6') // the declared major\n * extractRangeMajor('>=6.0.0') // undefined\n * ```\n */\nexport function extractRangeMajor(range: string): number | undefined {\n\tconst match =\n\t\t/^(?:\\^(0|[1-9]\\d*)|(?:\\^|~)?(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-]*))*)?)$/.exec(\n\t\t\trange,\n\t\t)\n\tconst major = match?.[1] ?? match?.[2]\n\treturn major === undefined ? undefined : Number(major)\n}\n\n/**\n * Compares 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 (const [index, component] of first.entries()) {\n\t\tconst order = compareValues(component, second[index] ?? 0)\n\t\tif (order !== 0) return order\n\t}\n\treturn 0\n}\n\n/**\n * Tests whether a declared range already admits a published version.\n *\n * @param range - The declared dependency range.\n * @param latest - The version the registry's `latest` tag reports.\n * @returns True if the range admits that version; false otherwise.\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 fields it sits next to.\n *\n * Readability is decided first, and it is `EXTRA_RANGE_PATTERN`: an optional\n * caret or tilde over `major.minor.patch` 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 * Tests whether a declared engines floor is at or above the supported minimum.\n *\n * @param engines - The declared `engines.node` range.\n * @returns True if the range is the accepted syntax and its floor is at or above\n * `MINIMUM_NODE_VERSION`; false otherwise.\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.18.0') // true\n * matchesEngines('>=20.0.0') // false\n * matchesEngines('22.18.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 * Projects 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 * Projects a package manifest's text to the `@orkestrel/*` packages each dependency\n * section declares.\n *\n * @param manifest - The `package.json` text.\n * @returns The runtime, development, and peer declarations as separate lists.\n *\n * @remarks\n * Every other name is skipped rather than refused: a workspace's unrelated\n * dependencies are not this package's to report on. Keeping the sections\n * separate prevents a caller from treating a peer as a writable floor.\n *\n * Never throws, and every row it returns satisfies `isDependency` while each\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 * // { runtime: [{ name: '@orkestrel/emitter', range: '^0.0.5' }], development: [], peer: [] }\n * ```\n */\nexport function manifestToDependencies(manifest: string): ManifestDependencySet {\n\tif (computeBytes(manifest) > MAX_MANIFEST_BYTES) {\n\t\treturn { runtime: [], development: [], peer: [] }\n\t}\n\tconst parsed = parseJSON(manifest)\n\tif (!isRecord(parsed)) return { runtime: [], development: [], peer: [] }\n\tconst [runtime = [], development = [], peer = []] = [\n\t\t'dependencies',\n\t\t'devDependencies',\n\t\t'peerDependencies',\n\t].map((section): readonly Dependency[] => {\n\t\tconst entries = parsed[section]\n\t\treturn isRecord(entries)\n\t\t\t? Object.entries(entries).flatMap(([name, range]): readonly Dependency[] =>\n\t\t\t\t\t!DEPENDENCY_NAME_PATTERN.test(name) ||\n\t\t\t\t\tname.length > MAX_DEPENDENCY_NAME_LENGTH ||\n\t\t\t\t\t!isString(range) ||\n\t\t\t\t\trange.length === 0 ||\n\t\t\t\t\trange.length > MAX_RANGE_LENGTH\n\t\t\t\t\t\t? []\n\t\t\t\t\t\t: [{ name, range }],\n\t\t\t\t)\n\t\t\t: []\n\t})\n\treturn {\n\t\truntime: limitEntries(runtime, MAX_COLLECTION_ITEMS),\n\t\tdevelopment: limitEntries(development, MAX_COLLECTION_ITEMS),\n\t\tpeer: limitEntries(peer, MAX_COLLECTION_ITEMS),\n\t}\n}\n\n/**\n * Renders the `SKILL.md` pointer a target carries in place of a canonical skill.\n *\n * @param canonical - The canonical `SKILL.md` text, which opens with a frontmatter block.\n * @param name - The skill directory name the pointer body names.\n * @returns The canonical frontmatter block copied line for line, from its opening `---` line through\n * its closing `---` line, then the filled `ARTIFACT_TEMPLATES.orchestration.skill` body, with `\\n`\n * line endings; `undefined` when the canonical text does not open with a complete frontmatter block.\n *\n * @remarks\n * The frontmatter is copied rather than rewritten, so every harness that\n * discovers the pointer reads the canonical `name` and `description` and\n * triggers the skill exactly as the canonical file would. A CRLF canonical\n * text yields the same pointer as its LF form.\n *\n * @example\n * ```ts\n * import { renderSkillPointer } from '@orkestrel/scaffold'\n *\n * renderSkillPointer('---\\nname: orkestrel-harden\\ndescription: Hardens a package.\\n---\\n\\n# Harden\\n', 'orkestrel-harden')?.startsWith('---\\nname: orkestrel-harden\\ndescription: Hardens a package.\\n---\\n\\n# Load the canonical skill\\n') // true\n * renderSkillPointer('# Harden\\n', 'orkestrel-harden') // undefined\n * ```\n */\nexport function renderSkillPointer(canonical: string, name: string): string | undefined {\n\tconst lines = canonical.split(/\\r\\n|\\n/u)\n\tif (lines[0] !== '---') return undefined\n\tconst end = lines.indexOf('---', 1)\n\tif (end === -1) return undefined\n\tconst frontmatter = lines.slice(0, end + 1).join('\\n')\n\treturn `${frontmatter}\\n${fillTemplate(ARTIFACT_TEMPLATES.orchestration.skill, { name })}`\n}\n\n/**\n * Scans manifest text for its strings and object braces, in order.\n *\n * @param text - The manifest text to scan.\n * @returns One token per quoted string and per `{` or `}` outside a string, or\n * `undefined` when a string is never closed.\n *\n * @remarks\n * Native JSON validation owns syntax; this scan only locates the byte ranges an\n * in-place writer edits. A string is opaque, so a brace inside one is never read,\n * and a backslash escapes the character after it. Depth counts objects alone and\n * ignores arrays, exactly as the range writers count them, so a key nested inside\n * another object never reads as a top-level one. A string that a colon follows\n * carries `value`, the offset of the character after that colon and the\n * whitespace beside it.\n *\n * @example\n * ```ts\n * import { scanManifestTokens } from '@orkestrel/scaffold'\n *\n * scanManifestTokens('{\"a\": \"b\"}')?.length // 4\n * scanManifestTokens('{\"a') // undefined\n * ```\n */\nexport function scanManifestTokens(text: string): readonly ManifestToken[] | undefined {\n\tconst tokens: ManifestToken[] = []\n\tfor (const match of text.matchAll(\n\t\t/(?<string>\"(?:\\\\[\\s\\S]|[^\"\\\\])*\")(?<colon>\\s*:\\s*)?|[{}]|\"/gu,\n\t)) {\n\t\tif (match[0] === '\"') return undefined\n\t\tconst literal = match.groups?.string\n\t\tconst depth = (tokens.at(-1)?.depth ?? 0) + (match[0] === '{' ? 1 : match[0] === '}' ? -1 : 0)\n\t\ttokens.push(\n\t\t\tliteral === undefined\n\t\t\t\t? { text: match[0], index: match.index, depth, value: undefined }\n\t\t\t\t: {\n\t\t\t\t\t\ttext: literal,\n\t\t\t\t\t\tindex: match.index,\n\t\t\t\t\t\tdepth,\n\t\t\t\t\t\tvalue: match.groups?.colon === undefined ? undefined : match.index + match[0].length,\n\t\t\t\t\t},\n\t\t)\n\t}\n\treturn tokens\n}\n","import type {\n\tArtifact,\n\tBuildFormat,\n\tBlueprint,\n\tBrowserExtension,\n\tContentArtifact,\n\tDependency,\n\tDependencyPinSet,\n\tEnvironment,\n\tFinding,\n\tManifestEdit,\n\tManifestScript,\n\tManifestToken,\n\tOverride,\n\tPlan,\n\tQuestion,\n\tSnapshot,\n\tToolchainHold,\n\tViteMachinery,\n} from './types.js'\nimport {\n\tattempt,\n\tcanonicalStringify,\n\tcompareValues,\n\tisRecord,\n\tisString,\n\tparseJSON,\n\tsortValues,\n} 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\tAXES,\n\tBASE_DEV_DEPENDENCIES,\n\tBIN_CONFIGS,\n\tBIN_ENTRY_PATH,\n\tBIN_OUTPUT_PATH,\n\tBROWSE_DEV_DEPENDENCIES,\n\tBROWSE_UPSTREAM,\n\tCAPTURE_DEV_DEPENDENCIES,\n\tCAPTURE_UPSTREAM,\n\tCATALOG_AGENT_PATH,\n\tDECLARATION_DEV_DEPENDENCIES,\n\tDEPENDENCY_NAME_PATTERN,\n\tDISTRIBUTION_SETUP_PATH,\n\tDISTRIBUTION_TEST_PATH,\n\tENVIRONMENTS,\n\tEXTRA_RANGE_PATTERN,\n\tFLOOR_RANGE_PATTERN,\n\tFOREIGN_NAME_PATTERN,\n\tFRAMEWORK_MATRIX,\n\tFRAMEWORKS,\n\tGLOBAL_SETUP_PATH,\n\tGUIDES_TEST_PATH,\n\tHOST_PATHS,\n\tINTEGRATION_TEST_PATH,\n\tJOURNEY_CONFIG_PATH,\n\tMAX_ARTIFACT_BYTES,\n\tMAX_COLLECTION_ITEMS,\n\tMAX_TOTAL_ARTIFACT_BYTES,\n\tNAME_PATTERN,\n\tORKESTREL_RANGE_PATTERN,\n\tRELEASE_PROOF_COMMAND,\n\tSEED_GUIDE_PATHS,\n\tSERVICE_SCRIPT_PATH,\n\tSERVICE_SETUP_PATH,\n\tSHOWCASE_CONFIG_PATH,\n\tSHOWCASE_DEV_DEPENDENCIES,\n\tSHOWCASE_OVERRIDES,\n\tSKILLS_CONFIG_PATH,\n\tSOURCE_BROWSER_DEV_DEPENDENCIES,\n\tSRC_MATRIX,\n\tSTYLES_DEV_DEPENDENCIES,\n\tTARGET_SKILL_NAMES,\n\tTOOLCHAIN_HOLDS,\n\tVERSION_PATTERN,\n\tWORKSPACE_DEV_ENGINES,\n} from './constants.js'\nimport {\n\tartifactToFinding,\n\tcomputeBytes,\n\tcomputeHash,\n\tcomputeTotal,\n\tinferGroup,\n\tmatchesEngines,\n\tmatchesPrintWidth,\n\tscanManifestTokens,\n\tserializeTypeScriptString,\n\tselectHostPaths,\n\tsrcToRoot,\n} from './helpers.js'\nimport { ARTIFACT_TEMPLATES, CONFIG_TEMPLATES } from './templates.js'\nimport { isSheetName } from './validators.js'\n\n/**\n * Projects a blueprint into browser extensions restricted to occupied browser axes.\n * @param blueprint - The workspace specification.\n * @returns Browser extensions with their occupied axes, omitting unplaced extensions.\n * @example\n * ```ts\n * import { blueprintToFaces, createBlueprint } from '@orkestrel/scaffold'\n *\n * blueprintToFaces(createBlueprint('desk', { app: ['core'] })).length // 0\n * ```\n */\nexport function blueprintToFaces(blueprint: Blueprint): readonly BrowserExtension[] {\n\treturn blueprint.extensions.flatMap((extension) => {\n\t\tif (extension.surface !== 'browser') return []\n\t\tconst axes = extension.axes.filter((axis) => blueprint[axis].includes('browser'))\n\t\treturn axes.length === 0 ? [] : [{ ...extension, axes }]\n\t})\n}\n\n/**\n * Projects a blueprint into its validated sheet-face names in stable order.\n * @param blueprint - The workspace specification.\n * @returns The base face followed by named styles extensions; themes remain a separate target.\n * @example\n * ```ts\n * import { blueprintToSheets, createBlueprint } from '@orkestrel/scaffold'\n *\n * blueprintToSheets(createBlueprint('paper', { styles: true })) // ['styles']\n * ```\n */\nexport function blueprintToSheets(blueprint: Blueprint): readonly string[] {\n\treturn [\n\t\t...(blueprint.styles ? ['styles'] : []),\n\t\t...sortValues(\n\t\t\tblueprint.extensions.flatMap((extension) =>\n\t\t\t\textension.surface === 'styles' && isSheetName(extension.name) ? [extension.name] : [],\n\t\t\t),\n\t\t),\n\t]\n}\n\n/**\n * Projects published environments and sheets into the manifest export map.\n * @param blueprint - The workspace specification.\n * @returns JavaScript conditions and CSS and SCSS subpaths, without an invented JavaScript root.\n * @example\n * ```ts\n * import { blueprintToExports, createBlueprint } from '@orkestrel/scaffold'\n *\n * blueprintToExports(createBlueprint('paper', { styles: true }))['./styles']\n * // './dist/src/styles/index.css'\n * ```\n */\nexport function blueprintToExports(blueprint: Blueprint): Readonly<Record<string, unknown>> {\n\t// A repeated key keeps its first position and takes its last value, so the browser subpath\n\t// written once per face and the package manifest named twice land where assignment put them.\n\tconst exported: Readonly<Record<string, unknown>> = {\n\t\t...srcToExports(blueprint.src),\n\t\t...Object.fromEntries(\n\t\t\tblueprintToFaces(blueprint)\n\t\t\t\t.filter((extension) => extension.axes.includes('src'))\n\t\t\t\t.flatMap((extension): ReadonlyArray<readonly [string, unknown]> => {\n\t\t\t\t\tconst face: readonly [string, unknown] = [\n\t\t\t\t\t\t`./${extension.name}`,\n\t\t\t\t\t\tpathToCondition(`./dist/src/${extension.name}/index`, ['es']),\n\t\t\t\t\t]\n\t\t\t\t\t// Declaration rewrites name the browser subpath even when browser owns the root export.\n\t\t\t\t\treturn blueprint.src.includes('browser')\n\t\t\t\t\t\t? [face, ['./browser', pathToCondition('./dist/src/browser/index', ['es'])]]\n\t\t\t\t\t\t: [face]\n\t\t\t\t}),\n\t\t),\n\t\t...Object.fromEntries(\n\t\t\t[...blueprintToSheets(blueprint), ...(blueprint.themes ? ['styles/themes'] : [])].flatMap(\n\t\t\t\t(name) => [\n\t\t\t\t\t[`./${name}`, `./dist/src/${name}/index.css`],\n\t\t\t\t\t[`./${name}/scss`, `./src/${name}/index.scss`],\n\t\t\t\t],\n\t\t\t),\n\t\t),\n\t}\n\treturn Object.keys(exported).length > 0\n\t\t? { ...exported, './package.json': './package.json' }\n\t\t: exported\n}\n\n/**\n * Builds 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 * Projects 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 * Projects 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 root = srcToRoot(src)\n\tconst environment = root ?? 'core'\n\tconst entries: ReadonlyArray<readonly [string, unknown]> = [\n\t\t['.', pathToCondition(`./dist/src/${environment}/index`, SRC_MATRIX[environment].formats)],\n\t\t...(root === undefined\n\t\t\t? ENVIRONMENTS.filter((declared) => declared !== 'core' && src.includes(declared)).map(\n\t\t\t\t\t(declared): readonly [string, unknown] => [\n\t\t\t\t\t\tSRC_MATRIX[declared].path,\n\t\t\t\t\t\tpathToCondition(`./dist/src/${declared}/index`, SRC_MATRIX[declared].formats),\n\t\t\t\t\t],\n\t\t\t\t)\n\t\t\t: []),\n\t\t['./package.json', './package.json'],\n\t]\n\treturn Object.fromEntries(entries)\n}\n\n/**\n * Projects 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.\n * A selected browser framework applies its toolchain hold before the host-specific sets.\n * Vue faces on either axis select TypeScript 6.0.3; other workspaces select TypeScript 7.0.2.\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. A peer\n * that names a development tool already selected keeps that tool's pin, because\n * the peer's floor states what consumers may supply rather than what this workspace\n * develops against.\n *\n * A workspace that renders a surface receives {@link BROWSE_DEV_DEPENDENCIES}: a browser\n * environment on either axis, a sheet, or themes. A framework face counts without a clause of\n * its own, because a face is selected only on an axis that carries a browser environment.\n * A browser setup runtime alone receives nothing, because it renders no surface for `browse`\n * to drive. A workspace {@link BROWSE_UPSTREAM} names receives nothing either, because\n * `@orkestrel/browser` depends on it at runtime and the declaration would close a cycle.\n *\n * A journey axis with a browser application receives {@link CAPTURE_DEV_DEPENDENCIES}.\n * A workspace {@link CAPTURE_UPSTREAM} names receives no capture seed, because it is capture\n * itself or a member of capture's runtime closure. A browser source, styles surface, or browser\n * setup alone selects no capture dependency.\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 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 sheets = blueprintToSheets(blueprint).length > 0 || blueprint.themes\n\tconst rendered = blueprint.src.includes('browser') || blueprint.app.includes('browser') || sheets\n\tconst own = blueprint.src.length > 0 || sheets ? `@orkestrel/${blueprint.name}` : blueprint.name\n\tconst prior: Readonly<Record<string, string>> = {\n\t\t...BASE_DEV_DEPENDENCIES,\n\t\t...Object.fromEntries(\n\t\t\tObject.entries(blueprintToToolchainHolds(blueprint)).map(([name, hold]) => [\n\t\t\t\tname,\n\t\t\t\thold.range,\n\t\t\t]),\n\t\t),\n\t\t...(rendered && !BROWSE_UPSTREAM.includes(own) ? BROWSE_DEV_DEPENDENCIES : {}),\n\t\t...(blueprint.journey && blueprint.app.includes('browser') && !CAPTURE_UPSTREAM.includes(own)\n\t\t\t? CAPTURE_DEV_DEPENDENCIES\n\t\t\t: {}),\n\t\t...(sheets ? STYLES_DEV_DEPENDENCIES : {}),\n\t\t...(blueprint.src.length > 0 || blueprint.bin ? DECLARATION_DEV_DEPENDENCIES : {}),\n\t\t...(blueprint.src.includes('browser') || blueprint.setup.includes('browser') || sheets\n\t\t\t? SOURCE_BROWSER_DEV_DEPENDENCIES\n\t\t\t: {}),\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.app.includes('server') ? APP_SERVER_DEV_DEPENDENCIES : {}),\n\t\t...Object.fromEntries(\n\t\t\tblueprintToMachinery(blueprint).frameworks.flatMap((framework) =>\n\t\t\t\tObject.entries(FRAMEWORK_MATRIX[framework].dependencies),\n\t\t\t),\n\t\t),\n\t\t// The iterator consumes one extra at a time and reads a hole as an `undefined` extra, which the\n\t\t// name read refuses before a later extra is read. It takes the list through its iterator\n\t\t// protocol alone, so a list without one is refused as the loop refused it.\n\t\t...Object.fromEntries(\n\t\t\tIterator.from(blueprint.extras)\n\t\t\t\t.map((extra) => [extra.name, extra.range])\n\t\t\t\t.toArray(),\n\t\t),\n\t\t...(blueprint.showcase && blueprint.app.includes('browser') ? SHOWCASE_DEV_DEPENDENCIES : {}),\n\t}\n\t// A peer keeps the pin of a development tool already selected, and the first of two peers\n\t// naming one package wins, because its floor was the one the workspace declared first. Each peer is\n\t// read once, in order, and only a peer the selection lacks has its range read.\n\tconst peers = Iterator.from(blueprint.peers)\n\t\t.flatMap((peer): ReadonlyArray<readonly [string, string]> =>\n\t\t\tObject.hasOwn(prior, peer.name) ? [] : [[peer.name, peer.range]],\n\t\t)\n\t\t.toArray()\n\tconst merged: Readonly<Record<string, string>> = {\n\t\t...prior,\n\t\t...Object.fromEntries(\n\t\t\tpeers.filter(([name], index) => peers.findIndex(([other]) => other === name) === index),\n\t\t),\n\t}\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 * Projects a blueprint into the toolchain holds its browser frameworks require.\n * @param blueprint - The workspace specification.\n * @returns The held tools for selected browser framework faces; empty without a framework.\n * @example\n * ```ts\n * import { blueprintToToolchainHolds, createBlueprint } from '@orkestrel/scaffold'\n *\n * blueprintToToolchainHolds(createBlueprint('router', { src: ['core'] })) // {}\n * ```\n */\nexport function blueprintToToolchainHolds(\n\tblueprint: Blueprint,\n): Readonly<Record<string, ToolchainHold>> {\n\tconst frameworks = blueprintToFaces(blueprint).map((face) => face.name)\n\treturn Object.fromEntries(\n\t\tObject.entries(TOOLCHAIN_HOLDS).filter(([, hold]) => frameworks.includes(hold.framework)),\n\t)\n}\n\n/**\n * Projects the scoped npm overrides required by a selected browser showcase.\n *\n * @param blueprint - The workspace specification.\n * @returns The showcase override map, or an empty map for other workspaces.\n * @example\n * ```ts\n * import { blueprintToManifestOverrides, createBlueprint } from '@orkestrel/scaffold'\n * blueprintToManifestOverrides(createBlueprint('desk', { app: ['browser'], showcase: true }))\n * // { 'vite-plugin-singlefile@2.3.3': { micromatch: 'npm:picomatch@2.3.2' } }\n * ```\n */\nexport function blueprintToManifestOverrides(\n\tblueprint: Blueprint,\n): Readonly<Record<string, Readonly<Record<string, string>>>> {\n\treturn blueprint.showcase && blueprint.app.includes('browser') ? SHOWCASE_OVERRIDES : {}\n}\n\n/**\n * Replaces selected npm override leaves while preserving every byte outside the edited path.\n *\n * @param manifest - The JSON package manifest text.\n * @param overrides - The scoped selectors and string leaves to write.\n * @returns The aligned text, or `undefined` for invalid JSON, duplicate selected keys, malformed ancestors, or non-string owned leaves.\n * @remarks\n * Absent ancestors and leaves are inserted. Aligned strings retain their original spelling.\n * Unrelated overrides remain caller-owned. Artifact replacements in `Blueprint.overrides` are independent.\n * @example\n * ```ts\n * import { replaceManifestOverrides } from '@orkestrel/scaffold'\n * replaceManifestOverrides('{}', { 'plugin@1.0.0': { child: '2.0.0' } })\n * // '{\"overrides\":{\"plugin@1.0.0\":{\"child\":\"2.0.0\"}}}'\n * ```\n */\nexport function replaceManifestOverrides(\n\tmanifest: string,\n\toverrides: Readonly<Record<string, Readonly<Record<string, string>>>>,\n): string | undefined {\n\tif (!isRecord(parseJSON(manifest))) return undefined\n\treturn Object.entries(overrides)\n\t\t.flatMap(([selector, children]) =>\n\t\t\tObject.entries(children).map(([child, range]) => ({\n\t\t\t\tpath: ['overrides', selector, child],\n\t\t\t\trange,\n\t\t\t})),\n\t\t)\n\t\t.reduce<string | undefined>(\n\t\t\t(compiled, leaf) =>\n\t\t\t\tcompiled === undefined\n\t\t\t\t\t? undefined\n\t\t\t\t\t: replaceManifestOverride(compiled, leaf.path, leaf.range),\n\t\t\tmanifest,\n\t\t)\n}\n\n/**\n * Replaces one npm override leaf in manifest text, inserting its absent ancestors.\n *\n * @param manifest - The JSON package manifest text, already known to be an object.\n * @param path - The object keys from the manifest root to the leaf, ending at the leaf's key.\n * @param range - The string the leaf must hold.\n * @returns The text carrying the leaf, or `undefined` for a duplicate selected key, a malformed\n * ancestor, or a non-string leaf.\n *\n * @remarks\n * The one step {@link replaceManifestOverrides} repeats per leaf. Absent ancestors and the leaf are\n * inserted after the last member of the deepest ancestor the text declares, and a leaf already\n * holding `range` keeps its original spelling. Every byte outside the edited path survives.\n *\n * @example\n * ```ts\n * import { replaceManifestOverride } from '@orkestrel/scaffold'\n *\n * replaceManifestOverride('{}', ['overrides', 'plugin@1.0.0', 'child'], '2.0.0')\n * // '{\"overrides\":{\"plugin@1.0.0\":{\"child\":\"2.0.0\"}}}'\n * ```\n */\nexport function replaceManifestOverride(\n\tmanifest: string,\n\tpath: readonly string[],\n\trange: string,\n): string | undefined {\n\tconst tokens = scanManifestTokens(manifest)\n\tif (tokens === undefined) return undefined\n\t// Each level descends into the object the previous level's value opened, so the fold carries\n\t// that object's offset and stops after a level answers.\n\tconst outcome = path.reduce<{\n\t\treadonly done: boolean\n\t\treadonly open: number\n\t\treadonly text: string | undefined\n\t}>(\n\t\t(state, key, level) => {\n\t\t\tif (state.done) return state\n\t\t\tconst refused = { ...state, done: true, text: undefined }\n\t\t\tconst brace = tokens.find((token) => token.index === state.open && token.text === '{')\n\t\t\tif (brace === undefined) return refused\n\t\t\tconst close = tokens.find(\n\t\t\t\t(token) =>\n\t\t\t\t\ttoken.text === '}' && token.index > state.open && token.depth === brace.depth - 1,\n\t\t\t)\n\t\t\tif (close === undefined) return refused\n\t\t\t// Only the selected object's immediate keys count; strings and nested values are opaque.\n\t\t\tconst matches = tokens.flatMap((token, at) =>\n\t\t\t\ttoken.index > state.open &&\n\t\t\t\ttoken.index < close.index &&\n\t\t\t\ttoken.depth === brace.depth &&\n\t\t\t\ttoken.value !== undefined &&\n\t\t\t\tparseJSON(token.text) === key\n\t\t\t\t\t? [at]\n\t\t\t\t\t: [],\n\t\t\t)\n\t\t\tif (matches.length > 1) return refused\n\t\t\tconst at = matches[0]\n\t\t\tconst entry = at === undefined ? undefined : tokens[at]\n\t\t\tif (at === undefined || entry === undefined) {\n\t\t\t\tconst insertion = path\n\t\t\t\t\t.slice(level)\n\t\t\t\t\t.reduceRight((inner, name) => `{${JSON.stringify(name)}:${inner}}`, JSON.stringify(range))\n\t\t\t\tconst tail = state.open + manifest.slice(state.open + 1, close.index).trimEnd().length\n\t\t\t\treturn {\n\t\t\t\t\t...state,\n\t\t\t\t\tdone: true,\n\t\t\t\t\ttext:\n\t\t\t\t\t\tmanifest.slice(0, tail + 1) +\n\t\t\t\t\t\t(tail === state.open ? '' : ',') +\n\t\t\t\t\t\tinsertion.slice(1, -1) +\n\t\t\t\t\t\tmanifest.slice(tail + 1),\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst start = entry.value\n\t\t\tif (start === undefined) return refused\n\t\t\tif (level < path.length - 1) {\n\t\t\t\treturn manifest.charAt(start) === '{' ? { ...state, open: start } : refused\n\t\t\t}\n\t\t\tconst literal = tokens[at + 1]\n\t\t\tif (manifest.charAt(start) !== '\"' || literal === undefined) return refused\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tdone: true,\n\t\t\t\ttext:\n\t\t\t\t\tparseJSON(literal.text) === range\n\t\t\t\t\t\t? manifest\n\t\t\t\t\t\t: manifest.slice(0, start) +\n\t\t\t\t\t\t\tJSON.stringify(range) +\n\t\t\t\t\t\t\tmanifest.slice(literal.index + literal.text.length),\n\t\t\t}\n\t\t},\n\t\t{ done: false, open: manifest.indexOf('{'), text: manifest },\n\t)\n\treturn outcome.text\n}\n\n/**\n * Projects 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 its distribution, study, and live-service proofs\n * from `test` and runs them from `prepublishOnly` instead. Publishing is what\n * selects the distribution proof: what that proof measures is the packed tarball,\n * so a workspace that packs no published source has nothing for it to read. A\n * private workspace therefore omits it and runs a study proof and a live-service\n * proof from `test`, the study proof first.\n * Integration and conformance stay in `test` because they neither pack nor\n * install the workspace and drive no external service. A conformance run may\n * start a server, but it starts its own and reaches it over loopback, so the run\n * 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 * A browser application's journey axis adds `journey` (`capture journey`) and `capture`\n * (`capture frames`) beside `test:journey`. The scoped commands take an explicit selection;\n * the whole-suite `test:journey` invocation remains in the test chain.\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 source = blueprintToFaces(blueprint).flatMap((extension) =>\n\t\textension.surface === 'browser' && extension.axes.includes('src') ? [extension.name] : [],\n\t)\n\tconst application = blueprintToFaces(blueprint).flatMap((extension) =>\n\t\textension.surface === 'browser' && extension.axes.includes('app') ? [extension.name] : [],\n\t)\n\tconst sheets = blueprintToSheets(blueprint)\n\tconst targets = [...sheets, ...(blueprint.themes && !blueprint.styles ? ['themes'] : [])]\n\tconst checker = application.includes('vue') ? FRAMEWORK_MATRIX.vue.checker : 'tsc'\n\tconst publishes = blueprint.src.length > 0 || targets.length > 0\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 checks = [...blueprint.src, ...source, ...sheets, ...(blueprint.bin ? ['bin'] : [])].map(\n\t\t(name) => `npm run check:src:${name}`,\n\t)\n\tconst journey = `vitest run --config ${JOURNEY_CONFIG_PATH} --no-cache --reporter=dot`\n\tconst showcase = `vite --config ${SHOWCASE_CONFIG_PATH}`\n\tconst buildShowcase = `vite build --config ${SHOWCASE_CONFIG_PATH}`\n\treturn {\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`${checker} --noEmit --project tsconfig.json`,\n\t\t\t...(checks.length > 0 ? ['npm run check:src'] : []),\n\t\t\t...(blueprint.app.length > 0 ? ['npm run check:app'] : []),\n\t\t\t...(blueprint.skills ? ['npm run check:skills'] : []),\n\t\t].join(' && '),\n\t\t...(checks.length > 0\n\t\t\t? {\n\t\t\t\t\t'check:src': checks.join(' && '),\n\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\tIterator.from(blueprint.src)\n\t\t\t\t\t\t\t.map((environment) => [\n\t\t\t\t\t\t\t\t`check:src:${environment}`,\n\t\t\t\t\t\t\t\t`tsc --noEmit -p configs/src/tsconfig.${environment}.json`,\n\t\t\t\t\t\t\t])\n\t\t\t\t\t\t\t.toArray(),\n\t\t\t\t\t),\n\t\t\t\t\t...(blueprint.bin\n\t\t\t\t\t\t? { 'check:src:bin': 'tsc --noEmit -p configs/src/tsconfig.bin.json' }\n\t\t\t\t\t\t: {}),\n\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\t[...sheets, ...source].map((name) => [\n\t\t\t\t\t\t\t`check:src:${name}`,\n\t\t\t\t\t\t\t`tsc --noEmit -p configs/src/tsconfig.${name}.json`,\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...(blueprint.app.length > 0\n\t\t\t? {\n\t\t\t\t\t'check:app': [...blueprint.app, ...application]\n\t\t\t\t\t\t.map((environment) => `npm run check:app:${environment}`)\n\t\t\t\t\t\t.join(' && '),\n\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\tIterator.from(blueprint.app)\n\t\t\t\t\t\t\t.map((environment) => [\n\t\t\t\t\t\t\t\t`check:app:${environment}`,\n\t\t\t\t\t\t\t\t`tsc --noEmit -p configs/app/tsconfig.${environment}.json`,\n\t\t\t\t\t\t\t])\n\t\t\t\t\t\t\t.toArray(),\n\t\t\t\t\t),\n\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\tapplication.map((name) => [\n\t\t\t\t\t\t\t`check:app:${name}`,\n\t\t\t\t\t\t\t`${FRAMEWORK_MATRIX[name].checker} --noEmit -p configs/app/tsconfig.${name}.json`,\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...(blueprint.skills ? { 'check:skills': `tsc --noEmit -p ${SKILLS_CONFIG_PATH}` } : {}),\n\t\ttest: [\n\t\t\t...(compiles ? ['npm run test:src'] : []),\n\t\t\t...(blueprint.app.length > 0 ? ['npm run test:app'] : []),\n\t\t\t...(blueprint.journey && blueprint.app.includes('browser')\n\t\t\t\t? ['npm run test:journey', ...application.map((name) => `npm run test:journey:${name}`)]\n\t\t\t\t: []),\n\t\t\t'npm run test:policy',\n\t\t\t'npm run test:config',\n\t\t\t...(blueprint.setup.includes('node') || blueprint.global ? ['npm run test:setup'] : []),\n\t\t\t...(blueprint.setup.includes('browser') ? ['npm run test:setup:browser'] : []),\n\t\t\t...(blueprint.skills ? ['npm run test:skills'] : []),\n\t\t\t...(blueprint.guides ? ['npm run test:guides'] : []),\n\t\t\t...(blueprint.conformance ? ['npm run test:conformance'] : []),\n\t\t\t...(blueprint.tree ? ['npm run test:tree'] : []),\n\t\t\t...(integrates ? ['npm run test:integration'] : []),\n\t\t\t...(!publishes && blueprint.studies ? ['npm run test:studies'] : []),\n\t\t\t...(!publishes && blueprint.service ? ['npm run test:service'] : []),\n\t\t].join(' && '),\n\t\t...(compiles\n\t\t\t? {\n\t\t\t\t\t// The aggregate keeps the position its first appearance gave it, with the value the sheet\n\t\t\t\t\t// targets extend, so it is computed once rather than written and then rewritten. It is\n\t\t\t\t\t// computed here, after the checks, so the environments are read where the baseline read them.\n\t\t\t\t\t'test:src': [\n\t\t\t\t\t\t...(blueprint.src.length > 0 || blueprint.bin\n\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\tvitest,\n\t\t\t\t\t\t\t\t\t\t...blueprint.src.map(\n\t\t\t\t\t\t\t\t\t\t\t(environment) => `--project ${SRC_MATRIX[environment].project}`,\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t...source.map((name) => `--project src:${name}`),\n\t\t\t\t\t\t\t\t\t\t...(blueprint.bin ? ['--project src:bin'] : []),\n\t\t\t\t\t\t\t\t\t].join(' '),\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t: []),\n\t\t\t\t\t\t...targets.map((name) => `npm run test:src:${name}`),\n\t\t\t\t\t].join(' && '),\n\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\tIterator.from(blueprint.src)\n\t\t\t\t\t\t\t.map((environment) => [\n\t\t\t\t\t\t\t\t`test:src:${environment}`,\n\t\t\t\t\t\t\t\t`${vitest} --project ${SRC_MATRIX[environment].project}`,\n\t\t\t\t\t\t\t])\n\t\t\t\t\t\t\t.toArray(),\n\t\t\t\t\t),\n\t\t\t\t\t...(blueprint.bin ? { 'test:src:bin': `${vitest} --project src:bin` } : {}),\n\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\tsource.map((name) => [`test:src:${name}`, `${vitest} --project src:${name}`]),\n\t\t\t\t\t),\n\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\ttargets.map((name) => [\n\t\t\t\t\t\t\t`test:src:${name}`,\n\t\t\t\t\t\t\t`npm run build:src:${name} && ${vitest} --project src:${name}`,\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...(blueprint.app.length > 0\n\t\t\t? {\n\t\t\t\t\t'test:app': [\n\t\t\t\t\t\tvitest,\n\t\t\t\t\t\t...blueprint.app.map((environment) => `--project ${APP_MATRIX[environment].project}`),\n\t\t\t\t\t\t...application.map((name) => `--project app:${name}`),\n\t\t\t\t\t].join(' '),\n\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\tIterator.from(blueprint.app)\n\t\t\t\t\t\t\t.map((environment) => [\n\t\t\t\t\t\t\t\t`test:app:${environment}`,\n\t\t\t\t\t\t\t\t`${vitest} --project ${APP_MATRIX[environment].project}`,\n\t\t\t\t\t\t\t])\n\t\t\t\t\t\t\t.toArray(),\n\t\t\t\t\t),\n\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\tapplication.map((name) => [`test:app:${name}`, `${vitest} --project app:${name}`]),\n\t\t\t\t\t),\n\t\t\t\t}\n\t\t\t: {}),\n\t\t'test:policy': `${vitest} --project policy`,\n\t\t'test:config': `${vitest} --project config`,\n\t\t...(blueprint.setup.includes('node') || blueprint.global\n\t\t\t? { 'test:setup': `${vitest} --project setup` }\n\t\t\t: {}),\n\t\t...(blueprint.setup.includes('browser')\n\t\t\t? { 'test:setup:browser': `${vitest} --project setup:browser` }\n\t\t\t: {}),\n\t\t...(blueprint.journey && blueprint.app.includes('browser')\n\t\t\t? {\n\t\t\t\t\t'test:journey': journey,\n\t\t\t\t\tjourney: 'capture journey',\n\t\t\t\t\tcapture: 'capture frames',\n\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\tapplication.map((name) => [`test:journey:${name}`, `${journey} --mode ${name}`]),\n\t\t\t\t\t),\n\t\t\t\t}\n\t\t\t: {}),\n\t\t...(blueprint.skills ? { 'test:skills': `${vitest} --project skills` } : {}),\n\t\t...(blueprint.guides\n\t\t\t? { 'test:guides': `node --experimental-strip-types ${GUIDES_TEST_PATH}` }\n\t\t\t: {}),\n\t\t...(blueprint.conformance ? { 'test:conformance': `${vitest} --project conformance` } : {}),\n\t\t...(blueprint.tree ? { 'test:tree': `${vitest} --project tree` } : {}),\n\t\t'test:probe':\n\t\t\t'vitest run --config vite.config.ts --no-cache --reporter=verbose --project probe',\n\t\t'test:bench':\n\t\t\t'vitest bench --config vite.config.ts --no-cache --project \"probe (bench)\" --mode benchmark',\n\t\t...(publishes ? { 'test:distribution': `${vitest} --project distribution` } : {}),\n\t\t...(integrates ? { 'test:integration': `${vitest} --project integration` } : {}),\n\t\t...(blueprint.service ? { 'test:service': `${vitest} --project service` } : {}),\n\t\t...(blueprint.studies ? { 'test:studies': `${vitest} --project studies` } : {}),\n\t\tbuild: [\n\t\t\t'npm run clean',\n\t\t\t...(compiles ? ['npm run build:src'] : []),\n\t\t\t...(blueprint.app.length > 0 ? ['npm run build:app'] : []),\n\t\t].join(' && '),\n\t\t...(compiles\n\t\t\t? {\n\t\t\t\t\t'build:src': [\n\t\t\t\t\t\t...blueprint.src.map((environment) => `npm run build:src:${environment}`),\n\t\t\t\t\t\t...source.map((name) => `npm run build:src:${name}`),\n\t\t\t\t\t\t...targets.map((name) => `npm run build:src:${name}`),\n\t\t\t\t\t\t...(blueprint.bin ? ['npm run build:src:bin'] : []),\n\t\t\t\t\t].join(' && '),\n\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\tIterator.from(blueprint.src)\n\t\t\t\t\t\t\t.map((environment) => [\n\t\t\t\t\t\t\t\t`build:src:${environment}`,\n\t\t\t\t\t\t\t\tSRC_MATRIX[environment].formats.includes('cjs')\n\t\t\t\t\t\t\t\t\t? `vite build --config configs/src/vite.${environment}.config.ts && npm run copy dist/src/${environment}/index.d.ts dist/src/${environment}/index.d.cts`\n\t\t\t\t\t\t\t\t\t: `vite build --config configs/src/vite.${environment}.config.ts`,\n\t\t\t\t\t\t\t])\n\t\t\t\t\t\t\t.toArray(),\n\t\t\t\t\t),\n\t\t\t\t\t...(blueprint.bin\n\t\t\t\t\t\t? { 'build:src:bin': 'vite build --config configs/src/vite.bin.config.ts' }\n\t\t\t\t\t\t: {}),\n\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\tsource.map((name) => [\n\t\t\t\t\t\t\t`build:src:${name}`,\n\t\t\t\t\t\t\t`vite build --config configs/src/vite.${name}.config.ts`,\n\t\t\t\t\t\t]),\n\t\t\t\t\t),\n\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\ttargets.map((name) => [\n\t\t\t\t\t\t\t`build:src:${name}`,\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t`vite build --config configs/src/vite.${name}.config.ts`,\n\t\t\t\t\t\t\t\t...(name === 'styles' && blueprint.themes\n\t\t\t\t\t\t\t\t\t? ['vite build --config configs/src/vite.themes.config.ts']\n\t\t\t\t\t\t\t\t\t: []),\n\t\t\t\t\t\t\t].join(' && '),\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...(blueprint.app.length > 0\n\t\t\t? {\n\t\t\t\t\t'build:app':\n\t\t\t\t\t\truntime.length > 0\n\t\t\t\t\t\t\t? [...runtime, ...application]\n\t\t\t\t\t\t\t\t\t.map((environment) => `npm run build:app:${environment}`)\n\t\t\t\t\t\t\t\t\t.join(' && ')\n\t\t\t\t\t\t\t: 'npm run check:app:core',\n\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\t[...runtime, ...application].map((environment) => [\n\t\t\t\t\t\t\t`build:app:${environment}`,\n\t\t\t\t\t\t\t`vite build --config configs/app/vite.${environment}.config.ts`,\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...(blueprint.app.includes('browser')\n\t\t\t? {\n\t\t\t\t\tdev: 'vite --config configs/app/vite.browser.config.ts',\n\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\tapplication.map((name) => [\n\t\t\t\t\t\t\t`dev:${name}`,\n\t\t\t\t\t\t\t`vite --config configs/app/vite.${name}.config.ts`,\n\t\t\t\t\t\t]),\n\t\t\t\t\t),\n\t\t\t\t\t...(blueprint.showcase\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tshowcase,\n\t\t\t\t\t\t\t\t'build:showcase': buildShowcase,\n\t\t\t\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\t\t\t\tapplication.flatMap((name): ReadonlyArray<readonly [string, string]> => [\n\t\t\t\t\t\t\t\t\t\t[`showcase:${name}`, `${showcase} --mode ${name}`],\n\t\t\t\t\t\t\t\t\t\t[`build:showcase:${name}`, `${buildShowcase} --mode ${name}`],\n\t\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: {}),\n\t\t\t\t}\n\t\t\t: {}),\n\t\t...(blueprint.app.includes('server')\n\t\t\t? {\n\t\t\t\t\tserve: 'node dist/app/server/main.cjs',\n\t\t\t\t\t'serve:build': 'npm run build:app:server && npm run serve',\n\t\t\t\t}\n\t\t\t: {}),\n\t\t...(publishes\n\t\t\t? {\n\t\t\t\t\tprepack: 'npm run build',\n\t\t\t\t\tprepublishOnly: [\n\t\t\t\t\t\t'npm run format:check && npm run lint:check && npm run check && npm run build',\n\t\t\t\t\t\t...(blueprint.showcase && blueprint.app.includes('browser')\n\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\t'npm run build:showcase',\n\t\t\t\t\t\t\t\t\t...application.map((name) => `npm run build:showcase:${name}`),\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t: []),\n\t\t\t\t\t\t'npm test',\n\t\t\t\t\t\t...(blueprint.studies ? ['npm run test:studies'] : []),\n\t\t\t\t\t\tRELEASE_PROOF_COMMAND,\n\t\t\t\t\t\t...(blueprint.service ? ['npm run test:service'] : []),\n\t\t\t\t\t].join(' && '),\n\t\t\t\t}\n\t\t\t: {}),\n\t}\n}\n\n/**\n * Projects a blueprint into the manifest scripts a region write may replace.\n *\n * @param blueprint - The workspace specification.\n * @returns One entry per writable script.\n *\n * @remarks\n * Every direct `test:<project>` script is writable, together with the probe and\n * benchmark workbench scripts. A workspace carrying guides adds `test:guides`,\n * whose package-owned entry runs the guides project and handles explicit parity\n * rewrites, and one carrying skills adds `test:skills`. Publishing adds the pack and publication lifecycle scripts.\n * Sheet and framework faces add their check and build scripts, application frameworks add dev scripts,\n * and selected showcases and journeys add their mode scripts.\n * A browser application's journey axis also adds `journey` and `capture`. Their generated\n * commands are writable and have no predecessor forms; customized values remain caller-owned.\n * Aggregate test scripts and\n * maintainer-owned gate chains stay outside the region.\n *\n * `accepted` carries each generated predecessor the region can replace. The\n * guides entry accepts the generated command that invoked the guides project\n * through Vitest alone. The pack hook accepts the build chain emitted before it\n * delegated to `build`. The publication hook accepts the same gate chain without\n * {@link RELEASE_PROOF_COMMAND}. A workspace carrying studies also accepts the\n * chain without its study step and the chain without both its study step and\n * the release proof. The value being written is always writable, so\n * it is not repeated there. Any other value is a script the workspace author\n * customized, and {@link replaceManifestScripts} retains it while writing the\n * other named scripts independently.\n *\n * @example\n * ```ts\n * import { blueprintToWritableScripts, createBlueprint } from '@orkestrel/scaffold'\n *\n * const blueprint = createBlueprint('router', { src: ['core'] })\n *\n * blueprintToWritableScripts(blueprint)[0]?.name // 'test:src:core'\n * ```\n */\nexport function blueprintToWritableScripts(blueprint: Blueprint): readonly ManifestScript[] {\n\tconst scripts = blueprintToScripts(blueprint)\n\tconst sheets = [\n\t\t...blueprintToSheets(blueprint),\n\t\t...(blueprint.themes && !blueprint.styles ? ['themes'] : []),\n\t]\n\tconst body = Object.entries(scripts).flatMap(([name, command]): readonly ManifestScript[] => {\n\t\tconst direct = name.startsWith('test:') && name !== 'test:src' && name !== 'test:app'\n\t\tconst sheet = sheets.some(\n\t\t\t(face) => name === `build:src:${face}` || name === `check:src:${face}`,\n\t\t)\n\t\t// The faces are read for each script, so the extensions are read as many times as before.\n\t\tconst framework = blueprintToFaces(blueprint).some(\n\t\t\t(extension) =>\n\t\t\t\textension.surface === 'browser' &&\n\t\t\t\textension.axes.some(\n\t\t\t\t\t(axis) =>\n\t\t\t\t\t\tname === `check:${axis}:${extension.name}` ||\n\t\t\t\t\t\tname === `build:${axis}:${extension.name}` ||\n\t\t\t\t\t\t(axis === 'app' && name === `dev:${extension.name}`),\n\t\t\t\t),\n\t\t)\n\t\tconst showcase =\n\t\t\tname === 'showcase' ||\n\t\t\tname.startsWith('showcase:') ||\n\t\t\tname === 'build:showcase' ||\n\t\t\tname.startsWith('build:showcase:')\n\t\tconst capture = name === 'journey' || name === 'capture'\n\t\tif (!direct && !sheet && !framework && !showcase && !capture) return []\n\t\treturn [\n\t\t\t{\n\t\t\t\tname,\n\t\t\t\tcommand,\n\t\t\t\taccepted:\n\t\t\t\t\tname === 'test:guides'\n\t\t\t\t\t\t? ['vitest run --config vite.config.ts --no-cache --reporter=dot --project guides']\n\t\t\t\t\t\t: name === 'build:src:styles' && blueprint.themes\n\t\t\t\t\t\t\t? ['vite build --config configs/src/vite.styles.config.ts']\n\t\t\t\t\t\t\t: sheets.some((face) => name === `test:src:${face}`)\n\t\t\t\t\t\t\t\t? [command.slice(command.indexOf(' && ') + 4)]\n\t\t\t\t\t\t\t\t: [],\n\t\t\t},\n\t\t]\n\t})\n\tconst prepack = scripts.prepack\n\tconst prepublish = scripts.prepublishOnly\n\tconst unreleased = prepublish?.replace(` && ${RELEASE_PROOF_COMMAND}`, '')\n\treturn [\n\t\t...body,\n\t\t...(prepack === undefined\n\t\t\t? []\n\t\t\t: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'prepack',\n\t\t\t\t\t\tcommand: prepack,\n\t\t\t\t\t\taccepted: scripts.build === undefined ? [] : [scripts.build],\n\t\t\t\t\t},\n\t\t\t\t]),\n\t\t...(prepublish === undefined || unreleased === undefined\n\t\t\t? []\n\t\t\t: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'prepublishOnly',\n\t\t\t\t\t\tcommand: prepublish,\n\t\t\t\t\t\taccepted: blueprint.studies\n\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\tunreleased,\n\t\t\t\t\t\t\t\t\tprepublish.replace(' && npm run test:studies', ''),\n\t\t\t\t\t\t\t\t\tunreleased.replace(' && npm run test:studies', ''),\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t: [unreleased],\n\t\t\t\t\t},\n\t\t\t\t]),\n\t]\n}\n\n/**\n * Compiles 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 after 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 sheets = blueprintToSheets(blueprint)\n\tconst targets = [...sheets, ...(blueprint.themes ? ['styles/themes'] : [])]\n\tconst publishes = blueprint.src.length > 0 || targets.length > 0\n\tconst name = publishes ? `@orkestrel/${blueprint.name}` : blueprint.name\n\tconst dependencies = Object.fromEntries(\n\t\t[...blueprint.dependencies]\n\t\t\t.sort((left, right) => compareValues(left.name, right.name))\n\t\t\t.map((dependency) => [dependency.name, dependency.range]),\n\t)\n\tconst peers = [...blueprint.peers].sort((left, right) => compareValues(left.name, right.name))\n\tconst peerDependencies = Object.fromEntries(peers.map((peer) => [peer.name, peer.range]))\n\tconst peerDependenciesMeta = Object.fromEntries(\n\t\tpeers.filter((peer) => peer.optional === true).map((peer) => [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]: BIN_OUTPUT_PATH } } : {}),\n\t\tfiles: [\n\t\t\tblueprint.bin || publishes ? 'dist/src' : 'dist/app',\n\t\t\t...(blueprint.bin ? ['dist/bin'] : []),\n\t\t\t...targets.map((face) => `!dist/src/${face}/index.js`),\n\t\t\t...sheets.map((face) => `src/${face}/**/*.scss`),\n\t\t\t...(blueprint.themes && !blueprint.styles ? ['src/styles/themes/**/*.scss'] : []),\n\t\t\t'README.md',\n\t\t],\n\t\ttype: 'module',\n\t\t...(publishes\n\t\t\t? {\n\t\t\t\t\tsideEffects:\n\t\t\t\t\t\ttargets.length > 0 || blueprint.bin\n\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\t...(targets.length > 0 ? ['**/*.css', '**/*.scss'] : []),\n\t\t\t\t\t\t\t\t\t...(blueprint.bin ? [`./${BIN_ENTRY_PATH}`, `./${BIN_OUTPUT_PATH}`] : []),\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t: false,\n\t\t\t\t\t...(blueprint.src.length > 0 ? entry : {}),\n\t\t\t\t\texports: blueprintToExports(blueprint),\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(blueprintToManifestOverrides(blueprint)).length > 0\n\t\t\t? { overrides: blueprintToManifestOverrides(blueprint) }\n\t\t\t: {}),\n\t\t...(Object.keys(peerDependencies).length > 0 ? { peerDependencies } : {}),\n\t\t...(Object.keys(peerDependenciesMeta).length > 0 ? { peerDependenciesMeta } : {}),\n\t\tdevEngines: WORKSPACE_DEV_ENGINES,\n\t\tengines: { node: blueprint.engines },\n\t}\n\treturn `${JSON.stringify(manifest, undefined, '\\t')}\\n`\n}\n\n/**\n * Derives the host-specific machinery a generated root Vite configuration carries.\n *\n * @param blueprint - The workspace specification.\n * @returns The 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).frameworks // []\n * ```\n */\nexport function blueprintToMachinery(blueprint: Blueprint): ViteMachinery {\n\tconst hosted = blueprint.app.some((environment) => environment !== 'core')\n\tconst frameworks = FRAMEWORKS.filter((framework) =>\n\t\tblueprintToFaces(blueprint).some(\n\t\t\t(extension) =>\n\t\t\t\textension.surface === 'browser' &&\n\t\t\t\textension.name === framework &&\n\t\t\t\textension.axes.some((axis) => blueprint[axis].includes('browser')),\n\t\t),\n\t)\n\treturn {\n\t\tbrowser:\n\t\t\tblueprint.src.includes('browser') ||\n\t\t\tblueprint.app.includes('browser') ||\n\t\t\tblueprint.setup.includes('browser') ||\n\t\t\tblueprintToSheets(blueprint).length > 0 ||\n\t\t\tblueprint.themes ||\n\t\t\tframeworks.length > 0,\n\t\tframeworks,\n\t\toutput:\n\t\t\tblueprint.src.length > 0 ||\n\t\t\tblueprint.bin ||\n\t\t\thosted ||\n\t\t\tblueprintToSheets(blueprint).length > 0 ||\n\t\t\tblueprint.themes,\n\t\tshowcase: blueprint.showcase && blueprint.app.includes('browser'),\n\t}\n}\n\n/**\n * Compiles the root TypeScript configuration for a blueprint.\n *\n * @param blueprint - The workspace specification.\n * @returns Formatter-stable `tsconfig.json` text.\n *\n * @remarks\n * `paths` carries the workspace's own published specifiers beside the `@src` and\n * `@app` aliases, mapped to source. The published set is what\n * {@link srcToExports} publishes, read the same way here so the two never name\n * different subpaths, and the `app` axis publishes nothing so it maps nothing.\n * A package's own name resolves inside its own checkout through that `exports`\n * map, to the built `dist/` entry, so a module importing it would make the root\n * typecheck depend on a build; mapping the specifier to source is what keeps\n * `npm run check` independent of `npm run build`. The root Vite configuration\n * derives its `alias` record from every `paths` entry, so the same specifiers\n * resolve to source under Vitest, and every subpath is emitted before the bare\n * specifier: an alias record is matched in declaration order and a bare pattern\n * also matches its own subpaths, so the reverse order would resolve\n * `@orkestrel/<name>/server` through the core entry.\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 root = srcToRoot(blueprint.src)\n\tconst aliases = [\n\t\t...blueprintToFaces(blueprint).flatMap((extension) => [\n\t\t\t...extension.axes.map((axis) => ({\n\t\t\t\tspecifier: `@${axis}/${extension.name}`,\n\t\t\t\ttarget: `./${axis}/${extension.name}/index.ts`,\n\t\t\t})),\n\t\t\t...(extension.axes.includes('src')\n\t\t\t\t? [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tspecifier: `@orkestrel/${blueprint.name}/${extension.name}`,\n\t\t\t\t\t\t\ttarget: `./src/${extension.name}/index.ts`,\n\t\t\t\t\t\t},\n\t\t\t\t\t]\n\t\t\t\t: []),\n\t\t]),\n\t\t...blueprintToSheets(blueprint).map((name) => ({\n\t\t\tspecifier: `@src/${name}`,\n\t\t\ttarget: `./src/${name}/index.ts`,\n\t\t})),\n\t\t...ENVIRONMENTS.filter((environment) => blueprint.src.includes(environment)).map(\n\t\t\t(environment) => ({\n\t\t\t\tspecifier: `@src/${environment}`,\n\t\t\t\ttarget: `./src/${environment}/index.ts`,\n\t\t\t}),\n\t\t),\n\t\t...ENVIRONMENTS.filter((environment) => blueprint.app.includes(environment)).map(\n\t\t\t(environment) => ({\n\t\t\t\tspecifier: `@app/${environment}`,\n\t\t\t\ttarget: `./app/${environment}/index.ts`,\n\t\t\t}),\n\t\t),\n\t\t...(root === undefined\n\t\t\t? ENVIRONMENTS.filter(\n\t\t\t\t\t(environment) => environment !== 'core' && blueprint.src.includes(environment),\n\t\t\t\t).map((environment) => ({\n\t\t\t\t\tspecifier: `@orkestrel/${blueprint.name}${SRC_MATRIX[environment].path.slice(1)}`,\n\t\t\t\t\ttarget: `./src/${environment}/index.ts`,\n\t\t\t\t}))\n\t\t\t: []),\n\t\t...(blueprint.src.length > 0\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tspecifier: `@orkestrel/${blueprint.name}`,\n\t\t\t\t\t\ttarget: `./src/${root ?? 'core'}/index.ts`,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: []),\n\t]\n\tconst paths = aliases\n\t\t.map(({ specifier, target }, index) => {\n\t\t\tconst separator = index === aliases.length - 1 ? '' : ','\n\t\t\tconst line = `\\t\\t\\t\"${specifier}\": [\"${target}\"]${separator}`\n\t\t\t// A published specifier carries the package name, and npm accepts one long\n\t\t\t// enough to push the entry past the formatter's width. oxfmt breaks such an\n\t\t\t// entry over its own lines, so emitting the flat form would leave the generated\n\t\t\t// file outside the fixed point the emit corpus holds it to.\n\t\t\tif (matchesPrintWidth(line)) return line\n\t\t\treturn `\\t\\t\\t\"${specifier}\": [\\n\\t\\t\\t\\t\"${target}\"\\n\\t\\t\\t]${separator}`\n\t\t})\n\t\t.join('\\n')\n\treturn fillTemplate(CONFIG_TEMPLATES.root.tsconfig, {\n\t\tpaths: aliases.length === 0 ? '\\t\\t\"paths\": {}' : `\\t\\t\"paths\": {\\n${paths}\\n\\t\\t}`,\n\t})\n}\n\n/**\n * Projects a blueprint into the project labels its root Vitest configuration registers.\n *\n * @param blueprint - The workspace specification.\n * @returns Project labels in registration order, including wrapper-registered sheet faces and\n * the probe benchmark variant.\n *\n * @example\n * ```ts\n * import { blueprintToProjects, createBlueprint } from '@orkestrel/scaffold'\n *\n * blueprintToProjects(createBlueprint('desk')).includes('policy') // true\n * ```\n */\nexport function blueprintToProjects(blueprint: Blueprint): readonly string[] {\n\tconst sheets = blueprintToSheets(blueprint)\n\tconst styled = sheets.length > 0 || blueprint.themes\n\tconst faces = blueprintToFaces(blueprint)\n\treturn [\n\t\t...sheets.map((name) => `src:${name}`),\n\t\t...(blueprint.themes && !blueprint.styles ? ['src:themes'] : []),\n\t\t...AXES.flatMap((axis) => [\n\t\t\t...ENVIRONMENTS.filter(\n\t\t\t\t(environment) =>\n\t\t\t\t\t(axis !== 'app' || environment !== 'server') && blueprint[axis].includes(environment),\n\t\t\t).map((environment) => `${axis}:${environment}`),\n\t\t\t...faces.filter((face) => face.axes.includes(axis)).map((face) => `${axis}:${face.name}`),\n\t\t\t...(axis === 'src' && blueprint.bin ? ['src:bin'] : []),\n\t\t\t...(axis === 'app' && blueprint.app.includes('server') ? ['app:server'] : []),\n\t\t]),\n\t\t'policy',\n\t\t'config',\n\t\t...(blueprint.setup.includes('node') || blueprint.global ? ['setup'] : []),\n\t\t...(blueprint.setup.includes('browser') ? ['setup:browser'] : []),\n\t\t...(blueprint.guides ? ['guides'] : []),\n\t\t...(blueprint.skills ? ['skills'] : []),\n\t\t...(blueprint.conformance ? ['conformance'] : []),\n\t\t...(blueprint.tree ? ['tree'] : []),\n\t\t...(blueprint.service ? ['service'] : []),\n\t\t...(blueprint.studies ? ['studies'] : []),\n\t\t...(blueprint.src.length > 0 || styled ? ['distribution'] : []),\n\t\t...(blueprint.integration ? ['integration'] : []),\n\t\t'probe',\n\t\t'probe (bench)',\n\t]\n}\n\n/**\n * Compiles the browser projects' pre-bundled dependency list for a blueprint.\n *\n * @remarks\n * A browser-mode run that discovers a runtime package mid-collection reloads the page, so the\n * list names the test package, its browser entry, and every Orkestrel runtime package the\n * blueprint declares or peers with, inline when the line fits the print width and stacked\n * otherwise.\n *\n * @example\n * ```ts\n * import { blueprintToOptimizedDependencies, createBlueprint } from '@orkestrel/scaffold'\n *\n * const blueprint = createBlueprint('router', { src: ['core'] })\n *\n * blueprintToOptimizedDependencies(blueprint).includes(\"'@orkestrel/test/browser'\") // true\n * ```\n */\nexport function blueprintToOptimizedDependencies(blueprint: Blueprint): string {\n\tconst names = [\n\t\t'@orkestrel/test',\n\t\t'@orkestrel/test/browser',\n\t\t...[\n\t\t\t...new Set([\n\t\t\t\t...(Object.hasOwn(blueprintToDevDependencies(blueprint), '@orkestrel/contract')\n\t\t\t\t\t? ['@orkestrel/contract']\n\t\t\t\t\t: []),\n\t\t\t\t...blueprint.dependencies.map((dependency) => dependency.name),\n\t\t\t\t...blueprint.peers.map((peer) => peer.name),\n\t\t\t]),\n\t\t]\n\t\t\t.filter((name) => name.startsWith('@orkestrel/'))\n\t\t\t.sort(),\n\t]\n\tconst inline = `\\tinclude: [${names.map((name) => `'${name}'`).join(', ')}],`\n\treturn matchesPrintWidth(inline)\n\t\t? `const optimizeDeps = {\\n${inline}\\n}\\n\\n`\n\t\t: `const optimizeDeps = {\\n\\tinclude: [\\n${names.map((name) => `\\t\\t'${name}',`).join('\\n')}\\n\\t],\\n}\\n\\n`\n}\n\n/**\n * Compiles 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 planned = new Set(blueprintToProjects(blueprint))\n\tconst sheets = blueprintToSheets(blueprint)\n\tconst styled = sheets.length > 0 || blueprint.themes\n\t// A browser test runs in the browser, so it cannot start a Node fixture for\n\t// itself. That is the case a global setup exists for, and it is why\n\t// `src:browser`, `setup:browser`, and `integration` take the same span.\n\tconst global = blueprint.global ? \"\\t\\t\\tglobalSetup: ['./tests/setupGlobal.ts'],\\n\" : ''\n\tconst imports = [\n\t\t...(styled || machinery.showcase\n\t\t\t? [\n\t\t\t\t\t`import { ${[...(styled ? ['existsSync'] : []), ...(machinery.showcase ? ['renameSync'] : [])].join(', ')} } from 'node:fs'`,\n\t\t\t\t]\n\t\t\t: []),\n\t\t...(machinery.browser ? [\"import { playwright } from '@vitest/browser-playwright'\"] : []),\n\t\t...(machinery.frameworks.includes('vue') ? [\"import vue from '@vitejs/plugin-vue'\"] : []),\n\t\t...(machinery.showcase\n\t\t\t? [\n\t\t\t\t\t\"import { viteSingleFile } from 'vite-plugin-singlefile'\",\n\t\t\t\t\t\"import { resolve as resolvePath } from 'node:path'\",\n\t\t\t\t]\n\t\t\t: []),\n\t]\n\tconst external = 'external: resolveSourceExternal,'\n\t// Each factory and the row that registers it are chosen by the same condition, in the order\n\t// the generated configuration declares them.\n\tconst factories = [\n\t\t...(blueprint.src.includes('browser') || blueprint.src.includes('server')\n\t\t\t? [\n\t\t\t\t\tblueprint.src.includes('core')\n\t\t\t\t\t\t? `function resolveSourceExternal(id: string): boolean {\n\treturn (\n\t\tid === '@src/core' ||\n\t\tresolveExternal(id, {\n\t\t\tpeers,\n\t\t\trefused: [],\n\t\t\tsiblings: [resolveWorkspacePath('src/core/index.ts')],\n\t\t})\n\t)\n}\n`\n\t\t\t\t\t\t: `function resolveSourceExternal(id: string): boolean {\n\treturn resolveExternal(id, { peers, refused: [], siblings: [] })\n}\n`,\n\t\t\t\t]\n\t\t\t: []),\n\t\t...(styled ? [CONFIG_TEMPLATES.factories.sheet] : []),\n\t\t...(planned.has('src:core') ? [CONFIG_TEMPLATES.factories.src.core] : []),\n\t\t// Each of the two source factories asks the axis for core once, where it renders.\n\t\t...(planned.has('src:browser')\n\t\t\t? [blueprint.src.includes('core')].map((core) =>\n\t\t\t\t\tfillTemplate(CONFIG_TEMPLATES.factories.src.browser, {\n\t\t\t\t\t\texternal,\n\t\t\t\t\t\toutput: core\n\t\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\\t\\toutput: {},',\n\t\t\t\t\t\texclude: core ? \"\\t\\t\\texclude: ['tests/src/core/**/*.test.ts'],\\n\" : '',\n\t\t\t\t\t\tglobal,\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t: []),\n\t\t...(planned.has('src:server')\n\t\t\t? [blueprint.src.includes('core')].map((core) =>\n\t\t\t\t\tfillTemplate(CONFIG_TEMPLATES.factories.src.server, {\n\t\t\t\t\t\texternal,\n\t\t\t\t\t\toutput: core\n\t\t\t\t\t\t\t? `\\t\\t\\t\\toutput: [\n\t\t\t\t\t{\n\t\t\t\t\t\tformat: 'es',\n\t\t\t\t\t\tentryFileNames: 'index.js',\n\t\t\t\t\t\tpaths: { '@src/core': '../core/index.js' },\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tformat: 'cjs',\n\t\t\t\t\t\tentryFileNames: 'index.cjs',\n\t\t\t\t\t\tpaths: { '@src/core': '../core/index.cjs' },\n\t\t\t\t\t},\n\t\t\t\t],`\n\t\t\t\t\t\t\t: '\\t\\t\\t\\toutput: {},',\n\t\t\t\t\t\texclude: core ? \"\\t\\t\\texclude: ['tests/src/core/**/*.test.ts'],\\n\" : '',\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t: []),\n\t\t...(planned.has('src:vue') ? [CONFIG_TEMPLATES.factories.src.vue] : []),\n\t\t...(planned.has('src:bin') ? [CONFIG_TEMPLATES.factories.src.bin] : []),\n\t\t...(planned.has('app:core') ? [CONFIG_TEMPLATES.factories.app.core] : []),\n\t\t...(planned.has('app:browser')\n\t\t\t? [\n\t\t\t\t\tfillTemplate(CONFIG_TEMPLATES.factories.app.browser, {\n\t\t\t\t\t\tshowcaseFactory: machinery.showcase ? CONFIG_TEMPLATES.factories.app.showcase : '',\n\t\t\t\t\t\tjourneyFactory: blueprint.journey ? CONFIG_TEMPLATES.factories.app.journey : '',\n\t\t\t\t\t\tjourneyExclude: blueprint.journey\n\t\t\t\t\t\t\t? \"\\t\\t\\texclude: ['tests/app/browser/integration.test.ts'],\\n\"\n\t\t\t\t\t\t\t: '',\n\t\t\t\t\t}),\n\t\t\t\t]\n\t\t\t: []),\n\t\t...(planned.has('app:vue')\n\t\t\t? [\n\t\t\t\t\tfillTemplate(CONFIG_TEMPLATES.factories.app.vue, {\n\t\t\t\t\t\tjourneyExclude: blueprint.journey\n\t\t\t\t\t\t\t? \"\\t\\t\\texclude: ['tests/app/vue/integration.test.ts'],\\n\"\n\t\t\t\t\t\t\t: '\\t\\t\\texclude: [],\\n',\n\t\t\t\t\t}),\n\t\t\t\t]\n\t\t\t: []),\n\t\t...(planned.has('app:server') ? [CONFIG_TEMPLATES.factories.app.server] : []),\n\t\tCONFIG_TEMPLATES.factories.policy,\n\t\tCONFIG_TEMPLATES.factories.config,\n\t\t...(planned.has('setup') ? [CONFIG_TEMPLATES.factories.setup] : []),\n\t\t...(planned.has('setup:browser')\n\t\t\t? [\n\t\t\t\t\tfillTemplate(CONFIG_TEMPLATES.factories.browser, {\n\t\t\t\t\t\toptimization: machinery.frameworks.includes('vue')\n\t\t\t\t\t\t\t? \"optimizeDeps: { include: [...optimizeDeps.include, 'vue'] }\"\n\t\t\t\t\t\t\t: 'optimizeDeps',\n\t\t\t\t\t\tplugins: machinery.frameworks.includes('vue') ? '\\t\\tplugins: [vue()],\\n' : '',\n\t\t\t\t\t\tglobal,\n\t\t\t\t\t}),\n\t\t\t\t]\n\t\t\t: []),\n\t\t...(planned.has('guides') ? [CONFIG_TEMPLATES.factories.guides] : []),\n\t\t...(planned.has('skills') ? [CONFIG_TEMPLATES.factories.skills] : []),\n\t\t...(planned.has('conformance') ? [CONFIG_TEMPLATES.factories.conformance] : []),\n\t\t...(planned.has('tree') ? [CONFIG_TEMPLATES.factories.tree] : []),\n\t\t...(planned.has('service') ? [CONFIG_TEMPLATES.factories.service] : []),\n\t\t...(planned.has('studies') ? [CONFIG_TEMPLATES.factories.studies] : []),\n\t\t...(planned.has('distribution') ? [CONFIG_TEMPLATES.factories.distribution] : []),\n\t\t...(planned.has('integration')\n\t\t\t? [\n\t\t\t\t\tfillTemplate(\n\t\t\t\t\t\tstyled\n\t\t\t\t\t\t\t? CONFIG_TEMPLATES.factories.integration.sheet\n\t\t\t\t\t\t\t: CONFIG_TEMPLATES.factories.integration.module,\n\t\t\t\t\t\t{ global },\n\t\t\t\t\t),\n\t\t\t\t]\n\t\t\t: []),\n\t\tCONFIG_TEMPLATES.factories.probe,\n\t]\n\t// The `app:browser` row is the factory itself, never a call of it. Vitest hands the command\n\t// line's `--mode` only to a project it calls, and `mergeOverride` sets that mode on the\n\t// project it returns, so an evaluated row silently turns the release-mode publish gate into\n\t// a skip.\n\tconst projects = [\n\t\t...(styled\n\t\t\t? [\n\t\t\t\t\t...sheets.map((name) => `'./configs/src/vite.${name}.config.ts'`),\n\t\t\t\t\t...(planned.has('src:themes') ? [\"'./configs/src/vite.themes.config.ts'\"] : []),\n\t\t\t\t]\n\t\t\t: []),\n\t\t...(planned.has('src:core') ? ['srcCore'] : []),\n\t\t...(planned.has('src:browser') ? ['srcBrowser'] : []),\n\t\t...(planned.has('src:server') ? ['srcServer'] : []),\n\t\t...(planned.has('src:vue') ? ['srcVue'] : []),\n\t\t...(planned.has('src:bin') ? ['srcBin'] : []),\n\t\t...(planned.has('app:core') ? ['appCore'] : []),\n\t\t...(planned.has('app:browser') ? ['appBrowser'] : []),\n\t\t...(planned.has('app:vue') ? ['appVue'] : []),\n\t\t...(planned.has('app:server') ? ['appServer'] : []),\n\t\t'policy',\n\t\t'config',\n\t\t...(planned.has('setup') ? ['setup'] : []),\n\t\t...(planned.has('setup:browser') ? ['setupBrowser'] : []),\n\t\t...(planned.has('guides') ? ['guides'] : []),\n\t\t...(planned.has('skills') ? ['skills'] : []),\n\t\t...(planned.has('conformance') ? ['conformance'] : []),\n\t\t...(planned.has('tree') ? ['tree'] : []),\n\t\t...(planned.has('service') ? ['service'] : []),\n\t\t...(planned.has('studies') ? ['studies'] : []),\n\t\t...(planned.has('distribution') ? ['distribution'] : []),\n\t\t...(planned.has('integration') ? ['integration'] : []),\n\t\t'probe',\n\t]\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 configuration helpers 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.\n\tconst body = `${factories.join('\\n')}\\n`\n\tconst helpers = [\n\t\t'enforceBuildLog',\n\t\t'environmentBoundary',\n\t\t'outputBoundary',\n\t\t'resolveApplication',\n\t\t'resolveExternal',\n\t\t'stampPage',\n\t].filter((helper) => body.includes(helper))\n\tconst helperImport = `import { ${helpers.join(', ')} } from './configs/helpers.js'\\n`\n\treturn fillTemplate(CONFIG_TEMPLATES.root.vite, {\n\t\tjourney:\n\t\t\tblueprint.journey && blueprint.app.includes('browser')\n\t\t\t\t? \"import type { JourneyVariant } from '@orkestrel/test'\\n\"\n\t\t\t\t: '',\n\t\timports: imports.length === 0 ? '' : `${imports.join('\\n')}\\n`,\n\t\thelpers:\n\t\t\thelpers.length === 0\n\t\t\t\t? ''\n\t\t\t\t: matchesPrintWidth(helperImport.trimEnd())\n\t\t\t\t\t? helperImport\n\t\t\t\t\t: `import {\\n${helpers.map((helper) => `\\t${helper},`).join('\\n')}\\n} 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. The same\n\t\t// selection emits `configs/commands.ts`, whose record every factory that names\n\t\t// the provider reads.\n\t\tbrowsers: machinery.browser\n\t\t\t? \"import { resolveBrowser, resolvePinnedBrowser } from './configs/browsers.js'\\nimport { commands } from './configs/commands.js'\\n\"\n\t\t\t: '',\n\t\toptions:\n\t\t\t(machinery.browser\n\t\t\t\t? 'const browserOptions = resolveBrowser(resolvePinnedBrowser(), process.platform, process.env)\\n\\n' +\n\t\t\t\t\tblueprintToOptimizedDependencies(blueprint)\n\t\t\t\t: '') +\n\t\t\t(blueprint.journey && blueprint.app.includes('browser')\n\t\t\t\t? \"const capture = process.env.CAPTURE === '1'\\n\\n\"\n\t\t\t\t: '') +\n\t\t\t((blueprint.journey || blueprint.showcase) && blueprint.app.includes('browser')\n\t\t\t\t? `const applications = {\\n\\tbrowser: appBrowser,\\n${blueprintToFaces(blueprint)\n\t\t\t\t\t\t.filter(\n\t\t\t\t\t\t\t(extension) => extension.surface === 'browser' && extension.axes.includes('app'),\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t(extension) =>\n\t\t\t\t\t\t\t\t`\\t${extension.name}: app${extension.name[0]?.toUpperCase()}${extension.name.slice(1)},\\n`,\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.join('')}}\\n\\n`\n\t\t\t\t: ''),\n\t\tfactories: body,\n\t\tprojects: projectRows,\n\t})\n}\n\n/**\n * Compiles 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 roots: readonly 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. The commands\n\t// module holds the package's own browser commands, so it is presence-owned: a\n\t// missing file is restored and a written one is kept.\n\tconst browsers: readonly Artifact[] = blueprintToMachinery(blueprint).browser\n\t\t? [\n\t\t\t\t{\n\t\t\t\t\tpath: 'configs/browsers.ts',\n\t\t\t\t\tgroup: 'configs',\n\t\t\t\t\townership: 'content',\n\t\t\t\t\torigin: 'template',\n\t\t\t\t\tcontent: CONFIG_TEMPLATES.browsers,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tpath: 'configs/commands.ts',\n\t\t\t\t\tgroup: 'configs',\n\t\t\t\t\townership: 'presence',\n\t\t\t\t\torigin: 'template',\n\t\t\t\t\tcontent: CONFIG_TEMPLATES.commands,\n\t\t\t\t},\n\t\t\t]\n\t\t: []\n\tconst sheets: readonly Artifact[] = [\n\t\t...blueprintToSheets(blueprint),\n\t\t...(blueprint.themes ? ['styles/themes'] : []),\n\t].flatMap((name): readonly Artifact[] => {\n\t\tconst wrapper: Artifact = {\n\t\t\tpath: `configs/src/vite.${name === 'styles/themes' ? 'themes' : name}.config.ts`,\n\t\t\tgroup: 'configs',\n\t\t\townership: 'content',\n\t\t\torigin: 'template',\n\t\t\tcontent: fillTemplate(CONFIG_TEMPLATES.vites.sheet, {\n\t\t\t\tname,\n\t\t\t\tlabel: name === 'styles/themes' ? 'themes' : name,\n\t\t\t}),\n\t\t}\n\t\treturn name === 'styles/themes'\n\t\t\t? [wrapper]\n\t\t\t: [\n\t\t\t\t\twrapper,\n\t\t\t\t\t{\n\t\t\t\t\t\tpath: `configs/src/tsconfig.${name}.json`,\n\t\t\t\t\t\tgroup: 'configs',\n\t\t\t\t\t\townership: 'content',\n\t\t\t\t\t\torigin: 'template',\n\t\t\t\t\t\tcontent: fillTemplate(CONFIG_TEMPLATES.tsconfigs.sheet, { name }),\n\t\t\t\t\t},\n\t\t\t\t]\n\t})\n\t// The iterator consumes one environment at a time, and reads a hole in `src` or `app` as an\n\t// `undefined` environment, which the matrix refuses before a later environment is read.\n\tconst sources: readonly Artifact[] = Iterator.from(blueprint.src)\n\t\t.flatMap((environment) =>\n\t\t\tSRC_MATRIX[environment].configs.map((path): Artifact => ({\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\t\tpath === 'configs/src/tsconfig.core.json'\n\t\t\t\t\t\t? CONFIG_TEMPLATES.tsconfigs.src.core\n\t\t\t\t\t\t: path === 'configs/src/vite.browser.config.ts'\n\t\t\t\t\t\t\t? CONFIG_TEMPLATES.vites.src.browser\n\t\t\t\t\t\t\t: path === 'configs/src/tsconfig.browser.json'\n\t\t\t\t\t\t\t\t? CONFIG_TEMPLATES.tsconfigs.src.browser\n\t\t\t\t\t\t\t\t: path === 'configs/src/vite.server.config.ts'\n\t\t\t\t\t\t\t\t\t? CONFIG_TEMPLATES.vites.src.server\n\t\t\t\t\t\t\t\t\t: path === 'configs/src/tsconfig.server.json'\n\t\t\t\t\t\t\t\t\t\t? CONFIG_TEMPLATES.tsconfigs.src.server\n\t\t\t\t\t\t\t\t\t\t: CONFIG_TEMPLATES.vites.src.core,\n\t\t\t})),\n\t\t)\n\t\t.toArray()\n\t// The paths are read only for a bin selection, once, after the sources.\n\tconst paths = blueprint.bin\n\t\t? blueprint.src.map(\n\t\t\t\t(environment) => `\\t\\t\\t\\t\\t\\t'@src/${environment}': '../src/${environment}/index.js',`,\n\t\t\t)\n\t\t: []\n\tconst renderedPaths =\n\t\tpaths.length === 0\n\t\t\t? '\\t\\t\\t\\t\\tpaths: {},'\n\t\t\t: `\\t\\t\\t\\t\\tpaths: {\n${paths.join('\\n')}\n\t\t\t\t\t},`\n\tconst bins: readonly Artifact[] = blueprint.bin\n\t\t? BIN_CONFIGS.map((path): Artifact => ({\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\tconst includeSuffixes = ['cts', 'mts', 'ts', 'tsx']\n\t// Each browser and server tsconfig asks the application axis for core where it renders its own\n\t// include list, so the axis is read once per such config and never for another.\n\tconst applications: readonly Artifact[] = Iterator.from(blueprint.app)\n\t\t.flatMap((environment) =>\n\t\t\tAPP_MATRIX[environment].configs.map((path): Artifact => ({\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\t\tpath === 'configs/app/vite.browser.config.ts'\n\t\t\t\t\t\t? CONFIG_TEMPLATES.vites.app.browser\n\t\t\t\t\t\t: path === 'configs/app/tsconfig.browser.json'\n\t\t\t\t\t\t\t? fillTemplate(CONFIG_TEMPLATES.tsconfigs.app.browser, {\n\t\t\t\t\t\t\t\t\tinclude: [\n\t\t\t\t\t\t\t\t\t\t...includeSuffixes.map((suffix) => `../../app/browser/**/*.${suffix}`),\n\t\t\t\t\t\t\t\t\t\t...(blueprint.app.includes('core')\n\t\t\t\t\t\t\t\t\t\t\t? includeSuffixes.map((suffix) => `../../app/core/**/*.${suffix}`)\n\t\t\t\t\t\t\t\t\t\t\t: []),\n\t\t\t\t\t\t\t\t\t\t...includeSuffixes.map((suffix) => `../../tests/app/browser/**/*.${suffix}`),\n\t\t\t\t\t\t\t\t\t\t'../../tests/setup.ts',\n\t\t\t\t\t\t\t\t\t\t'../../tests/setupBrowser.ts',\n\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t\t\t(entry, index, entries) =>\n\t\t\t\t\t\t\t\t\t\t\t\t`\\t\\t${JSON.stringify(entry)}${index === entries.length - 1 ? '' : ','}`,\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t.join('\\n'),\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t: path === 'configs/app/vite.server.config.ts'\n\t\t\t\t\t\t\t\t? CONFIG_TEMPLATES.vites.app.server\n\t\t\t\t\t\t\t\t: path === 'configs/app/tsconfig.server.json'\n\t\t\t\t\t\t\t\t\t? fillTemplate(CONFIG_TEMPLATES.tsconfigs.app.server, {\n\t\t\t\t\t\t\t\t\t\t\tinclude: [\n\t\t\t\t\t\t\t\t\t\t\t\t...includeSuffixes.map((suffix) => `../../app/server/**/*.${suffix}`),\n\t\t\t\t\t\t\t\t\t\t\t\t...(blueprint.app.includes('core')\n\t\t\t\t\t\t\t\t\t\t\t\t\t? includeSuffixes.map((suffix) => `../../app/core/**/*.${suffix}`)\n\t\t\t\t\t\t\t\t\t\t\t\t\t: []),\n\t\t\t\t\t\t\t\t\t\t\t\t...includeSuffixes.map((suffix) => `../../tests/app/server/**/*.${suffix}`),\n\t\t\t\t\t\t\t\t\t\t\t\t'../../tests/setup.ts',\n\t\t\t\t\t\t\t\t\t\t\t\t'../../tests/setupServer.ts',\n\t\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t\t\t\t\t(entry, index, entries) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t`\\t\\t${JSON.stringify(entry)}${index === entries.length - 1 ? '' : ','}`,\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t.join('\\n'),\n\t\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\t: CONFIG_TEMPLATES.tsconfigs.app.core,\n\t\t\t})),\n\t\t)\n\t\t.toArray()\n\tconst faces: readonly Artifact[] = blueprintToFaces(blueprint).flatMap((extension) =>\n\t\textension.axes.flatMap((axis): readonly Artifact[] => {\n\t\t\tconst include = [\n\t\t\t\t...['cts', 'mts', 'ts', 'tsx', ...FRAMEWORK_MATRIX[extension.name].suffixes].map(\n\t\t\t\t\t(suffix) => `../../app/${extension.name}/**/*.${suffix}`,\n\t\t\t\t),\n\t\t\t\t...(blueprint.app.includes('core')\n\t\t\t\t\t? ['cts', 'mts', 'ts', 'tsx'].map((suffix) => `../../app/core/**/*.${suffix}`)\n\t\t\t\t\t: []),\n\t\t\t\t...['cts', 'mts', 'ts', 'tsx', ...FRAMEWORK_MATRIX[extension.name].suffixes].map(\n\t\t\t\t\t(suffix) => `../../tests/app/${extension.name}/**/*.${suffix}`,\n\t\t\t\t),\n\t\t\t\t'../../tests/setup.ts',\n\t\t\t\t'../../tests/setupBrowser.ts',\n\t\t\t]\n\t\t\tconst siblings = blueprint.src\n\t\t\t\t.filter((environment) => environment === 'core' || environment === 'browser')\n\t\t\t\t.flatMap((environment) =>\n\t\t\t\t\t['ts', 'js'].map((suffix) => {\n\t\t\t\t\t\tconst key = `\\t[resolveWorkspacePath('src/${environment}/index.${suffix}').replaceAll('\\\\\\\\', '/')]:`\n\t\t\t\t\t\tconst value = `'@orkestrel/${blueprint.name}${environment === 'browser' ? '/browser' : ''}',`\n\t\t\t\t\t\treturn matchesPrintWidth(`${key} ${value}`) ? `${key} ${value}` : `${key}\\n\\t\\t${value}`\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t\t.join('\\n')\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tpath: `configs/${axis}/vite.${extension.name}.config.ts`,\n\t\t\t\t\tgroup: 'configs',\n\t\t\t\t\townership: 'content',\n\t\t\t\t\torigin: 'template',\n\t\t\t\t\tenvironment: 'browser',\n\t\t\t\t\tcontent:\n\t\t\t\t\t\taxis === 'src'\n\t\t\t\t\t\t\t? fillTemplate(CONFIG_TEMPLATES.vites.src.vue, {\n\t\t\t\t\t\t\t\t\tsiblings,\n\t\t\t\t\t\t\t\t\trefused: `[${FRAMEWORK_MATRIX[extension.name].refused.map((name) => serializeTypeScriptString(name)).join(', ')}]`,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t: CONFIG_TEMPLATES.vites.app.vue,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tpath: `configs/${axis}/tsconfig.${extension.name}.json`,\n\t\t\t\t\tgroup: 'configs',\n\t\t\t\t\townership: 'content',\n\t\t\t\t\torigin: 'template',\n\t\t\t\t\tenvironment: 'browser',\n\t\t\t\t\tcontent:\n\t\t\t\t\t\taxis === 'src'\n\t\t\t\t\t\t\t? CONFIG_TEMPLATES.tsconfigs.vue.src\n\t\t\t\t\t\t\t: fillTemplate(CONFIG_TEMPLATES.tsconfigs.vue.app, {\n\t\t\t\t\t\t\t\t\tinclude: include\n\t\t\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t\t\t(entry, index) =>\n\t\t\t\t\t\t\t\t\t\t\t\t`\\t\\t${JSON.stringify(entry)}${index === include.length - 1 ? '' : ','}`,\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t.join('\\n'),\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t},\n\t\t\t]\n\t\t}),\n\t)\n\tconst showcase: readonly Artifact[] =\n\t\tblueprint.showcase && blueprint.app.includes('browser')\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tpath: SHOWCASE_CONFIG_PATH,\n\t\t\t\t\t\tgroup: 'configs',\n\t\t\t\t\t\townership: 'content',\n\t\t\t\t\t\torigin: 'template',\n\t\t\t\t\t\tenvironment: 'browser',\n\t\t\t\t\t\tcontent: CONFIG_TEMPLATES.vites.app.showcase,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: []\n\tconst journey: readonly Artifact[] =\n\t\tblueprint.journey && blueprint.app.includes('browser')\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tpath: JOURNEY_CONFIG_PATH,\n\t\t\t\t\t\tgroup: 'configs',\n\t\t\t\t\t\townership: 'birth',\n\t\t\t\t\t\torigin: 'template',\n\t\t\t\t\t\tenvironment: 'browser',\n\t\t\t\t\t\tcontent: CONFIG_TEMPLATES.vites.app.journey,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: []\n\tconst skills: readonly Artifact[] = blueprint.skills\n\t\t? [\n\t\t\t\t{\n\t\t\t\t\tpath: SKILLS_CONFIG_PATH,\n\t\t\t\t\tgroup: 'configs',\n\t\t\t\t\townership: 'content',\n\t\t\t\t\torigin: 'template',\n\t\t\t\t\tcontent: CONFIG_TEMPLATES.tsconfigs.skills,\n\t\t\t\t},\n\t\t\t]\n\t\t: []\n\treturn [\n\t\t...roots,\n\t\t...browsers,\n\t\t...sheets,\n\t\t...sources,\n\t\t...bins,\n\t\t...applications,\n\t\t...faces,\n\t\t...showcase,\n\t\t...journey,\n\t\t...skills,\n\t]\n}\n\n/**\n * Compiles every artifact in the `source` group.\n *\n * @param blueprint - The workspace specification.\n * @returns Published barrels, sheet seeds, selected application entries, and the optional bin entry.\n *\n * @remarks\n * Barrels, server entries, and bin entries hold no starter implementation. Browser entries\n * render the workspace name as a level-one heading; the Vue face mounts its arrival component.\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 tokens: readonly ContentArtifact[] =\n\t\tblueprint.themes && !blueprint.styles\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tpath: 'src/styles/_tokens.scss',\n\t\t\t\t\t\tgroup: 'source',\n\t\t\t\t\t\townership: 'birth',\n\t\t\t\t\t\torigin: 'template',\n\t\t\t\t\t\tcontent: ARTIFACT_TEMPLATES.source.sheet['_tokens.scss'],\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: []\n\tconst sheets: readonly ContentArtifact[] = [\n\t\t...blueprintToSheets(blueprint),\n\t\t...(blueprint.themes ? ['styles/themes'] : []),\n\t].flatMap((name) =>\n\t\tObject.entries(\n\t\t\tname === 'styles/themes' ? ARTIFACT_TEMPLATES.source.themes : ARTIFACT_TEMPLATES.source.sheet,\n\t\t).map(([path, content]): ContentArtifact => ({\n\t\t\tpath: `src/${name}/${path}`,\n\t\t\tgroup: 'source',\n\t\t\townership: 'birth',\n\t\t\torigin: 'template',\n\t\t\tcontent,\n\t\t})),\n\t)\n\t// A hole in `src` or `app` reads as an `undefined` environment, as a `for…of` over it would.\n\tconst sources: readonly ContentArtifact[] = Iterator.from(blueprint.src)\n\t\t.map((environment): ContentArtifact => ({\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\t.toArray()\n\tconst applications: readonly ContentArtifact[] = Iterator.from(blueprint.app)\n\t\t.flatMap((environment): readonly ContentArtifact[] => {\n\t\t\tconst entry: ContentArtifact = {\n\t\t\t\tpath: `app/${environment}/index.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\tif (environment === 'browser') {\n\t\t\t\treturn [\n\t\t\t\t\tentry,\n\t\t\t\t\t{\n\t\t\t\t\t\tpath: 'app/browser/main.ts',\n\t\t\t\t\t\tgroup: 'source',\n\t\t\t\t\t\townership: 'birth',\n\t\t\t\t\t\torigin: 'template',\n\t\t\t\t\t\tenvironment,\n\t\t\t\t\t\tcontent: fillTemplate(ARTIFACT_TEMPLATES.source.main, {\n\t\t\t\t\t\t\theading: `${matchesPrintWidth(`\\t.appendChild(document.createElement('h1')).textContent = ${serializeTypeScriptString(blueprint.name)}`) ? ' ' : '\\n\\t'}${serializeTypeScriptString(blueprint.name)}`,\n\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tpath: 'app/browser/index.html',\n\t\t\t\t\t\tgroup: 'source',\n\t\t\t\t\t\townership: 'birth',\n\t\t\t\t\t\torigin: 'template',\n\t\t\t\t\t\tenvironment,\n\t\t\t\t\t\tcontent: ARTIFACT_TEMPLATES.source.browser,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t}\n\t\t\treturn environment === 'server'\n\t\t\t\t? [\n\t\t\t\t\t\tentry,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tpath: 'app/server/main.ts',\n\t\t\t\t\t\t\tgroup: 'source',\n\t\t\t\t\t\t\townership: 'birth',\n\t\t\t\t\t\t\torigin: 'template',\n\t\t\t\t\t\t\tenvironment,\n\t\t\t\t\t\t\tcontent: ARTIFACT_TEMPLATES.source.empty,\n\t\t\t\t\t\t},\n\t\t\t\t\t]\n\t\t\t\t: [entry]\n\t\t})\n\t\t.toArray()\n\tconst faces: readonly ContentArtifact[] = blueprintToFaces(blueprint).flatMap((extension) =>\n\t\textension.axes.flatMap((axis): readonly ContentArtifact[] => {\n\t\t\tconst barrel: ContentArtifact = {\n\t\t\t\tpath: `${axis}/${extension.name}/index.ts`,\n\t\t\t\tgroup: 'source',\n\t\t\t\townership: 'birth',\n\t\t\t\torigin: 'template',\n\t\t\t\tenvironment: 'browser',\n\t\t\t\tcontent:\n\t\t\t\t\taxis === 'app' ? ARTIFACT_TEMPLATES.source.empty : ARTIFACT_TEMPLATES.source.barrel,\n\t\t\t}\n\t\t\treturn axis === 'app'\n\t\t\t\t? [\n\t\t\t\t\t\tbarrel,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tpath: `app/${extension.name}/index.html`,\n\t\t\t\t\t\t\tgroup: 'source',\n\t\t\t\t\t\t\townership: 'birth',\n\t\t\t\t\t\t\torigin: 'template',\n\t\t\t\t\t\t\tenvironment: 'browser',\n\t\t\t\t\t\t\tcontent: ARTIFACT_TEMPLATES.source.browser,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t...Object.entries(ARTIFACT_TEMPLATES.source.vue).map(\n\t\t\t\t\t\t\t([path, content]): ContentArtifact => ({\n\t\t\t\t\t\t\t\tpath: `app/${extension.name}/${path}`,\n\t\t\t\t\t\t\t\tgroup: 'source',\n\t\t\t\t\t\t\t\townership: 'birth',\n\t\t\t\t\t\t\t\torigin: 'template',\n\t\t\t\t\t\t\t\tenvironment: 'browser',\n\t\t\t\t\t\t\t\tcontent: fillTemplate(content, {\n\t\t\t\t\t\t\t\t\theading: matchesPrintWidth(`\\t<h1>${blueprint.name}</h1>`)\n\t\t\t\t\t\t\t\t\t\t? blueprint.name\n\t\t\t\t\t\t\t\t\t\t: `\\n\\t\\t${blueprint.name}\\n\\t`,\n\t\t\t\t\t\t\t\t}),\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: [barrel]\n\t\t}),\n\t)\n\tconst bin: readonly ContentArtifact[] = blueprint.bin\n\t\t? [\n\t\t\t\t{\n\t\t\t\t\tpath: BIN_ENTRY_PATH,\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\tcontent: ARTIFACT_TEMPLATES.source.empty,\n\t\t\t\t},\n\t\t\t]\n\t\t: []\n\treturn [...tokens, ...sheets, ...sources, ...applications, ...faces, ...bin]\n}\n\n/**\n * Compiles 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 and proofs, axis and sheet tests, journey suites, 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. `studies` emits nothing: the root configuration names no study harness,\n * so `tests/setupStudy.ts` is the package's own module.\n *\n * The content-owned distribution harness `tests/setupDistribution.ts` and the presence-owned\n * proof `tests/distribution.test.ts` are emitted because the proof measures the packed tarball\n * rather than anything only the package knows. Every assertion derives from the installed tree\n * at run time, so nothing has to be named. The proof follows the published source it packs and\n * alone is claimed by presence: a target lacking the proof reports as drift, and a package that\n * replaced the proof with a better one keeps that proof.\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 sheets = [...blueprintToSheets(blueprint), ...(blueprint.themes ? ['styles/themes'] : [])]\n\tconst faces: readonly ContentArtifact[] = blueprintToFaces(blueprint).flatMap((extension) =>\n\t\textension.axes.map((axis): ContentArtifact => ({\n\t\t\tpath: `tests/${axis}/${extension.name}/index.test.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: fillTemplate(ARTIFACT_TEMPLATES.tests.entry, {\n\t\t\t\tspecifier: serializeTypeScriptString(`@${axis}/${extension.name}`),\n\t\t\t\tlabel: serializeTypeScriptString(`${axis} ${extension.name} entry`),\n\t\t\t}),\n\t\t})),\n\t)\n\tconst styles: readonly ContentArtifact[] =\n\t\tsheets.length > 0\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tpath: 'tests/setupStyles.ts',\n\t\t\t\t\t\tgroup: 'tests',\n\t\t\t\t\t\townership: 'birth',\n\t\t\t\t\t\torigin: 'template',\n\t\t\t\t\t\tcontent: ARTIFACT_TEMPLATES.tests.styles.module,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tpath: 'tests/setupStyles.test.ts',\n\t\t\t\t\t\tgroup: 'tests',\n\t\t\t\t\t\townership: 'birth',\n\t\t\t\t\t\torigin: 'template',\n\t\t\t\t\t\tcontent: ARTIFACT_TEMPLATES.tests.styles.proof,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: []\n\t// Oxlint's `import/no-absolute-path` refuses a root-relative specifier, so the sheet import\n\t// climbs from `tests/src/<name>/`.\n\tconst sheetTests: readonly ContentArtifact[] = sheets.map((name): ContentArtifact => {\n\t\tconst tests = '../'.repeat(name.split('/').length + 1)\n\t\treturn {\n\t\t\tpath: `tests/src/${name}/index.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.sheet, {\n\t\t\t\tname,\n\t\t\t\troot: `${tests}../`,\n\t\t\t}),\n\t\t}\n\t})\n\tconst browsers: readonly ContentArtifact[] = blueprintToMachinery(blueprint).browser\n\t\t? [\n\t\t\t\t{\n\t\t\t\t\tpath: 'tests/setupBrowser.ts',\n\t\t\t\t\tgroup: 'tests',\n\t\t\t\t\townership: 'birth',\n\t\t\t\t\torigin: 'template',\n\t\t\t\t\tenvironment: 'browser',\n\t\t\t\t\tcontent: blueprint.journey\n\t\t\t\t\t\t? ARTIFACT_TEMPLATES.tests.browser\n\t\t\t\t\t\t: ARTIFACT_TEMPLATES.tests.setup,\n\t\t\t\t},\n\t\t\t]\n\t\t: []\n\tconst servers: readonly ContentArtifact[] =\n\t\tblueprint.src.includes('server') ||\n\t\tblueprint.app.includes('server') ||\n\t\tblueprint.bin ||\n\t\tblueprint.conformance ||\n\t\tblueprint.tree\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tpath: 'tests/setupServer.ts',\n\t\t\t\t\t\tgroup: 'tests',\n\t\t\t\t\t\townership: 'birth',\n\t\t\t\t\t\torigin: 'template',\n\t\t\t\t\t\tenvironment: 'server',\n\t\t\t\t\t\tcontent: ARTIFACT_TEMPLATES.tests.setup,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\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\tconst services: readonly ContentArtifact[] = blueprint.service\n\t\t? [\n\t\t\t\t{\n\t\t\t\t\tpath: SERVICE_SETUP_PATH,\n\t\t\t\t\tgroup: 'tests',\n\t\t\t\t\townership: 'birth',\n\t\t\t\t\torigin: 'template',\n\t\t\t\t\tcontent: ARTIFACT_TEMPLATES.tests.setup,\n\t\t\t\t},\n\t\t\t]\n\t\t: []\n\tconst globals: readonly ContentArtifact[] = blueprint.global\n\t\t? [\n\t\t\t\t{\n\t\t\t\t\tpath: GLOBAL_SETUP_PATH,\n\t\t\t\t\tgroup: 'tests',\n\t\t\t\t\townership: 'birth',\n\t\t\t\t\torigin: 'template',\n\t\t\t\t\tcontent: ARTIFACT_TEMPLATES.tests.global.module,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tpath: 'tests/setupGlobal.test.ts',\n\t\t\t\t\tgroup: 'tests',\n\t\t\t\t\townership: 'birth',\n\t\t\t\t\torigin: 'template',\n\t\t\t\t\tcontent: ARTIFACT_TEMPLATES.tests.global.proof,\n\t\t\t\t},\n\t\t\t]\n\t\t: []\n\tconst journeys: readonly ContentArtifact[] =\n\t\tblueprint.journey && blueprint.app.includes('browser')\n\t\t\t? [\n\t\t\t\t\t'browser',\n\t\t\t\t\t...blueprintToFaces(blueprint).flatMap((extension) =>\n\t\t\t\t\t\textension.surface === 'browser' && extension.axes.includes('app')\n\t\t\t\t\t\t\t? [extension.name]\n\t\t\t\t\t\t\t: [],\n\t\t\t\t\t),\n\t\t\t\t].map((application): ContentArtifact => ({\n\t\t\t\t\tpath: `tests/app/${application}/integration.test.ts`,\n\t\t\t\t\tgroup: 'tests',\n\t\t\t\t\townership: 'birth',\n\t\t\t\t\torigin: 'template',\n\t\t\t\t\tenvironment: 'browser',\n\t\t\t\t\tcontent: fillTemplate(ARTIFACT_TEMPLATES.tests.journey, {\n\t\t\t\t\t\tapplication,\n\t\t\t\t\t\theading: serializeTypeScriptString(blueprint.name),\n\t\t\t\t\t\timports:\n\t\t\t\t\t\t\tapplication === 'vue'\n\t\t\t\t\t\t\t\t? \"import { createApp } from 'vue'\\nimport App from '../../../app/vue/App.vue'\\n\"\n\t\t\t\t\t\t\t\t: '',\n\t\t\t\t\t\tmount:\n\t\t\t\t\t\t\tapplication === 'vue'\n\t\t\t\t\t\t\t\t? \"\\t\\tconst container = document.body.appendChild(document.createElement('main'))\\n\\t\\tconst app = createApp(App)\\n\"\n\t\t\t\t\t\t\t\t: '',\n\t\t\t\t\t\tarrival:\n\t\t\t\t\t\t\tapplication === 'vue'\n\t\t\t\t\t\t\t\t? '\\t\\t\\tapp.mount(container)\\n'\n\t\t\t\t\t\t\t\t: \"\\t\\t\\tawait import('../../../app/browser/main.js')\\n\",\n\t\t\t\t\t\tcleanup:\n\t\t\t\t\t\t\tapplication === 'vue'\n\t\t\t\t\t\t\t\t? '\\t\\t\\tapp.unmount()\\n\\t\\t\\tcontainer.remove()\\n'\n\t\t\t\t\t\t\t\t: \"\\t\\t\\tfor (const main of page.getByRole('main').elements()) main.remove()\\n\",\n\t\t\t\t\t}),\n\t\t\t\t}))\n\t\t\t: []\n\t// A hole in `src` or `app` reads as an `undefined` environment, as a `for…of` over it would.\n\tconst sources: readonly ContentArtifact[] = Iterator.from(blueprint.src)\n\t\t.map((environment): ContentArtifact => ({\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\t.toArray()\n\tconst binSpecifier = serializeTypeScriptString('../../../src/bin/main.js')\n\tconst joinedImport = `\\t\\tconst entry = await import(${binSpecifier})`\n\tconst bins: readonly ContentArtifact[] = blueprint.bin\n\t\t? [\n\t\t\t\t{\n\t\t\t\t\tpath: 'tests/src/bin/main.test.ts',\n\t\t\t\t\tgroup: 'tests',\n\t\t\t\t\townership: 'birth',\n\t\t\t\t\torigin: 'template',\n\t\t\t\t\tcontent: fillTemplate(ARTIFACT_TEMPLATES.tests.bin, {\n\t\t\t\t\t\timport: matchesPrintWidth(joinedImport)\n\t\t\t\t\t\t\t? joinedImport\n\t\t\t\t\t\t\t: `\\t\\tconst entry =\\n\\t\\t\\tawait import(${binSpecifier})`,\n\t\t\t\t\t}),\n\t\t\t\t},\n\t\t\t]\n\t\t: []\n\tconst applications: readonly ContentArtifact[] = Iterator.from(blueprint.app)\n\t\t.map((environment): ContentArtifact => ({\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\t.toArray()\n\t// The packed artifact is what this proof measures, and that subject is the same\n\t// in every publishing workspace: an installed tree, its exports map, and the\n\t// declarations beside it. So it is derived rather than named, and a workspace\n\t// that packs no published source has nothing for it to read. Ownership is\n\t// presence, which is what reports a target still lacking the proof as drift\n\t// while leaving a package that wrote a better one exactly as it is.\n\t//\n\t// The browser branch follows a published `src` browser face, because the browser\n\t// drive measures the packed artifact and only a published face is packed. A\n\t// workspace selecting `browser` on its `app` axis alone declares\n\t// `@vitest/browser-playwright` and `playwright` and gets `configs/browsers.ts`\n\t// emitted, and its proof still carries no branch: those imports are declared by\n\t// either axis, so they do not select the branch. `vite` selects nothing either,\n\t// though the branch imports it: `vite` sits in `BASE_DEV_DEPENDENCIES` and every\n\t// workspace declares it. Presence ownership never rewrites the file, so\n\t// a workspace publishing a browser face later keeps a proof with no branch for it.\n\t// The core-only variant therefore carries the guard that reddens on such an entry\n\t// rather than skipping it.\n\t// The `src` axis is asked for a browser face only when the proof is planned, and the integration\n\t// proof reads both axes only when it is planned, so each read stays where the condition puts it.\n\tconst distribution = ARTIFACT_TEMPLATES.tests.distribution\n\tconst distributions: readonly ContentArtifact[] =\n\t\tblueprint.src.length > 0 || blueprintToSheets(blueprint).length > 0 || blueprint.themes\n\t\t\t? [blueprint.src.includes('browser')].flatMap((browser): readonly ContentArtifact[] => [\n\t\t\t\t\t{\n\t\t\t\t\t\tpath: DISTRIBUTION_SETUP_PATH,\n\t\t\t\t\t\tgroup: 'tests',\n\t\t\t\t\t\townership: 'content',\n\t\t\t\t\t\torigin: 'template',\n\t\t\t\t\t\tcontent: fillTemplate(distribution.module, {\n\t\t\t\t\t\t\ttypes: browser ? distribution.types : '',\n\t\t\t\t\t\t\ttransport: browser ? distribution.transport : '',\n\t\t\t\t\t\t\tlauncher: browser ? distribution.launcher : '',\n\t\t\t\t\t\t\thelpers: browser ? distribution.helpers : '',\n\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tpath: DISTRIBUTION_TEST_PATH,\n\t\t\t\t\t\tgroup: 'tests',\n\t\t\t\t\t\townership: 'presence',\n\t\t\t\t\t\torigin: 'template',\n\t\t\t\t\t\tcontent: fillTemplate(distribution.proof, {\n\t\t\t\t\t\t\timport: browser ? distribution.import : '',\n\t\t\t\t\t\t\tdrive: browser ? distribution.drive : '',\n\t\t\t\t\t\t\tguard: browser ? '' : distribution.guard,\n\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t])\n\t\t\t: []\n\tconst integrations: readonly ContentArtifact[] = blueprint.integration\n\t\t? [\n\t\t\t\t[\n\t\t\t\t\t...Iterator.from(blueprint.src)\n\t\t\t\t\t\t.map((environment) => ({\n\t\t\t\t\t\t\tentry:\n\t\t\t\t\t\t\t\tenvironment === 'core'\n\t\t\t\t\t\t\t\t\t? 'srcCore'\n\t\t\t\t\t\t\t\t\t: environment === 'browser'\n\t\t\t\t\t\t\t\t\t\t? 'srcBrowser'\n\t\t\t\t\t\t\t\t\t\t: 'srcServer',\n\t\t\t\t\t\t\tspecifier: `@src/${environment}`,\n\t\t\t\t\t\t}))\n\t\t\t\t\t\t.toArray(),\n\t\t\t\t\t...Iterator.from(blueprint.app)\n\t\t\t\t\t\t.map((environment) => ({\n\t\t\t\t\t\t\tentry:\n\t\t\t\t\t\t\t\tenvironment === 'core'\n\t\t\t\t\t\t\t\t\t? 'appCore'\n\t\t\t\t\t\t\t\t\t: environment === 'browser'\n\t\t\t\t\t\t\t\t\t\t? 'appBrowser'\n\t\t\t\t\t\t\t\t\t\t: 'appServer',\n\t\t\t\t\t\t\tspecifier: `@app/${environment}`,\n\t\t\t\t\t\t}))\n\t\t\t\t\t\t.toArray(),\n\t\t\t\t],\n\t\t\t].map((modules): ContentArtifact => {\n\t\t\t\tconst entries = modules.map(({ entry }) => entry)\n\t\t\t\tconst imports = modules.map(\n\t\t\t\t\t({ entry, specifier }) => `import * as ${entry} from '${specifier}'`,\n\t\t\t\t)\n\t\t\t\tconst joined = `expect([${entries.map((entry) => `Object.keys(${entry})`).join(', ')}]).toStrictEqual(`\n\t\t\t\tconst actual = matchesPrintWidth(`\\t\\t${joined}[`)\n\t\t\t\t\t? joined\n\t\t\t\t\t: `expect([\\n${entries.map((entry) => `\\t\\t\\tObject.keys(${entry}),`).join('\\n')}\\n\\t\\t]).toStrictEqual(`\n\t\t\t\tconst expectedInline = `[${entries.map(() => '[]').join(', ')}]`\n\t\t\t\tconst expected =\n\t\t\t\t\tactual !== joined || matchesPrintWidth(`\\t\\t${joined}${expectedInline})`)\n\t\t\t\t\t\t? expectedInline\n\t\t\t\t\t\t: `[\\n${entries.map(() => '\\t\\t\\t[],').join('\\n')}\\n\\t\\t]`\n\t\t\t\treturn {\n\t\t\t\t\tpath: INTEGRATION_TEST_PATH,\n\t\t\t\t\tgroup: 'tests',\n\t\t\t\t\townership: 'birth',\n\t\t\t\t\torigin: 'template',\n\t\t\t\t\tcontent: fillTemplate(ARTIFACT_TEMPLATES.tests.integration, {\n\t\t\t\t\t\timports: `${imports.join('\\n')}\\n`,\n\t\t\t\t\t\tactual,\n\t\t\t\t\t\texpected,\n\t\t\t\t\t}),\n\t\t\t\t}\n\t\t\t})\n\t\t: []\n\treturn [\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\t...faces,\n\t\t...styles.filter(({ content }) => content.length > 0),\n\t\t...sheetTests,\n\t\t...browsers,\n\t\t...servers,\n\t\t...services,\n\t\t...globals,\n\t\t...journeys,\n\t\t...sources,\n\t\t...bins,\n\t\t...applications,\n\t\t...distributions,\n\t\t...integrations,\n\t]\n}\n\n/**\n * Compiles 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 *\n * @example\n * ```ts\n * import { blueprintToGuideArtifacts, createBlueprint } from '@orkestrel/scaffold'\n *\n * const blueprint = createBlueprint('router', { src: ['core'] })\n *\n * blueprintToGuideArtifacts(blueprint)[0]?.path // 'guides/README.md'\n * ```\n */\nexport function blueprintToGuideArtifacts(blueprint: Blueprint): readonly ContentArtifact[] {\n\tconst guide = `guides/${blueprint.name}.md`\n\tconst rows = [\n\t\t...[\n\t\t\t...blueprint.src,\n\t\t\t...blueprintToFaces(blueprint)\n\t\t\t\t.filter((extension) => extension.axes.includes('src'))\n\t\t\t\t.map((extension) => extension.name),\n\t\t\t...blueprintToSheets(blueprint),\n\t\t\t...(blueprint.themes ? ['styles/themes'] : []),\n\t\t].map((environment) => ({\n\t\t\tdirectory: `src/${environment}`,\n\t\t\ttest: `tests/src/${environment}`,\n\t\t})),\n\t\t...(blueprint.bin ? [{ directory: 'src/bin', test: 'tests/src/bin' }] : []),\n\t\t...[\n\t\t\t...blueprint.app,\n\t\t\t...blueprintToFaces(blueprint)\n\t\t\t\t.filter((extension) => extension.axes.includes('app'))\n\t\t\t\t.map((extension) => extension.name),\n\t\t].map((environment) => ({\n\t\t\tdirectory: `app/${environment}`,\n\t\t\ttest: `tests/app/${environment}`,\n\t\t})),\n\t]\n\tconst source = rows.map(({ directory }) => ` - [\\`${directory}\\`](../${directory})`)\n\tconst tests = rows.map(({ test }) => ` - [\\`${test}\\`](../${test})`)\n\tconst directories = rows.map(\n\t\t({ directory, test }) =>\n\t\t\t`- [\\`${directory}\\`](../${directory})\\n - Guide: Not created. Create this file when the workspace has a public surface:\\n \\`${guide}\\`\\n - Tests: [\\`${test}\\`](../${test})`,\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:\n\t\t\t\t\ttests.join('\\n') +\n\t\t\t\t\t(blueprint.showcase && blueprint.app.includes('browser')\n\t\t\t\t\t\t? '\\n - Showcase:\\n' +\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t'browser',\n\t\t\t\t\t\t\t\t...blueprintToFaces(blueprint)\n\t\t\t\t\t\t\t\t\t.filter((extension) => extension.axes.includes('app'))\n\t\t\t\t\t\t\t\t\t.map((extension) => extension.name),\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t(application) =>\n\t\t\t\t\t\t\t\t\t\t` - [\\`showcase/${application}.html\\`](../showcase/${application}.html)`,\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.join('\\n')\n\t\t\t\t\t\t: ''),\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 * Compiles the generated workspace's root documentation.\n *\n * @param blueprint - The workspace specification.\n * @returns The birth-owned package front page and the content-owned `AGENTS.md`\n * pointer.\n *\n * @remarks\n * The front page is the workspace's own prose, so it is written once and left\n * alone from then on. The pointer is scaffold's, so it is content-owned and\n * restored whenever it drifts.\n *\n * The pointer is planned here rather than vendored because `stageHost` refuses two\n * vendored paths at one storage name, and `AGENTS.md` already stores the canon a\n * release ships. Planning it as this package's own content leaves the path with\n * one claimant. No `CLAUDE.md` is planned: a target holding one stops Claude Code\n * from reading `AGENTS.md`, so the path stays canon without a claimant, `audit`\n * reports a copy `foreign`, and `overwrite` deletes it.\n *\n * The pointer carries no varying span, so it is not filled: a workspace's name\n * never reaches the text, and the paths a reader follows are the same in every\n * target.\n *\n * @example\n * ```ts\n * import { blueprintToDocumentArtifacts, createBlueprint } from '@orkestrel/scaffold'\n *\n * const blueprint = createBlueprint('router', { src: ['core'] })\n *\n * blueprintToDocumentArtifacts(blueprint).map((artifact) => artifact.path) // ['README.md', 'AGENTS.md']\n * ```\n */\nexport function blueprintToDocumentArtifacts(blueprint: Blueprint): readonly ContentArtifact[] {\n\tconst publishes =\n\t\tblueprint.src.length > 0 || blueprintToSheets(blueprint).length > 0 || blueprint.themes\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\t{\n\t\t\tpath: 'AGENTS.md',\n\t\t\tgroup: 'docs',\n\t\t\townership: 'content',\n\t\t\torigin: 'template',\n\t\t\tcontent: ARTIFACT_TEMPLATES.docs.agents,\n\t\t},\n\t]\n}\n\n/**\n * Compiles 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 *\n * @example\n * ```ts\n * import { blueprintToOrchestrationArtifacts, createBlueprint } from '@orkestrel/scaffold'\n *\n * const plain = createBlueprint('router', { src: ['core'] })\n * const served = createBlueprint('router', { src: ['core'], vendors: ['ollama'] })\n *\n * blueprintToOrchestrationArtifacts(plain) // []\n * blueprintToOrchestrationArtifacts(served)[0]?.path // 'scripts/service.sh'\n * ```\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 * Compiles the vendored host artifacts a workspace plans.\n *\n * @param blueprint - The workspace specification.\n * @returns One artifact per selected vendored path in `HOST_PATHS` order, then\n * the seed guide mirrors and the catalog file.\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 * {@link CATALOG_AGENT_PATH} is appended rather than listed, and it is the canon\n * path this compiler claims. The catalog verb refuses a target that lacks the\n * file, so the plan has to carry it; repair restores its absence from the\n * staged bytes; and the `.claude/agents` directory in `CANON_PATHS` is what\n * stages those bytes, so listing the file in `HOST_PATHS` as well would claim one\n * storage name twice and refuse the stage. The rest of the canon a target reads\n * from the installed package, at the locations the `AGENTS.md` pointer\n * {@link blueprintToDocumentArtifacts} emits names.\n *\n * The {@link SEED_GUIDE_PATHS} mirrors are claimed explicitly\n * from `REFERENCE_PATHS`. The target's own guide is excluded by\n * {@link selectHostPaths}; the remaining reference guides grant no target claim.\n *\n * The skill pointer set follows, for each name in {@link TARGET_SKILL_NAMES}:\n * the `.claude/skills/<name>/SKILL.md` bridge and the\n * `.agents/skills/<name>/agents/openai.yaml` sidecar as copies, then the\n * `.agents/skills/<name>/SKILL.md` pointer with `pointer` set, whose bytes\n * hydration derives from the canonical skill. A blueprint with `skills` set\n * ships its own skill canon, so it plans no pointer set.\n *\n * @example\n * ```ts\n * import { blueprintToHostArtifacts, createBlueprint } from '@orkestrel/scaffold'\n *\n * const blueprint = createBlueprint('router')\n *\n * blueprintToHostArtifacts(blueprint).some((artifact) => artifact.path === 'tests/guides.test.ts') // false\n * blueprintToHostArtifacts(blueprint).some((artifact) => artifact.path === 'guides/router.md') // false\n * blueprintToHostArtifacts(blueprint).find((artifact) => artifact.path === '.agents/skills/orkestrel-harden/SKILL.md')?.pointer // true\n * ```\n */\nexport function blueprintToHostArtifacts(blueprint: Blueprint): readonly Artifact[] {\n\tconst selected = selectHostPaths([...HOST_PATHS, ...SEED_GUIDE_PATHS], blueprint.name)\n\tconst vendored = [...selected, CATALOG_AGENT_PATH].map((path): Artifact => ({\n\t\tpath,\n\t\tgroup: inferGroup(path),\n\t\townership: 'presence',\n\t\torigin: 'host',\n\t}))\n\tif (blueprint.skills) return vendored\n\tconst skills = TARGET_SKILL_NAMES.flatMap((name): readonly Artifact[] => {\n\t\tconst bridge = `.claude/skills/${name}/SKILL.md`\n\t\tconst sidecar = `.agents/skills/${name}/agents/openai.yaml`\n\t\tconst pointer = `.agents/skills/${name}/SKILL.md`\n\t\treturn [\n\t\t\t{ path: bridge, group: inferGroup(bridge), ownership: 'presence', origin: 'host' },\n\t\t\t{ path: sidecar, group: inferGroup(sidecar), ownership: 'presence', origin: 'host' },\n\t\t\t{\n\t\t\t\tpath: pointer,\n\t\t\t\tgroup: inferGroup(pointer),\n\t\t\t\townership: 'presence',\n\t\t\t\torigin: 'host',\n\t\t\t\tpointer: true,\n\t\t\t},\n\t\t]\n\t})\n\treturn [...vendored, ...skills]\n}\n\n/**\n * Replaces 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 * Replaces the runtime and development dependency ranges in package manifest text, and never a\n * peer range.\n *\n * @param manifest - The manifest text to compile.\n * @param pins - The runtime and development names and replacement ranges.\n * @returns The manifest with every matching writable value replaced, or\n * `undefined` when a name has no quoted declaration in its named section.\n *\n * @remarks\n * The compiler replaces values in place instead of serializing the manifest,\n * so description, keywords, scripts, key order, indentation, and every byte\n * outside the named ranges survive. Runtime pins apply only to `dependencies`,\n * and development pins apply only to `devDependencies`. The compiler never\n * reads or writes `peerDependencies` or `peerDependenciesMeta`. An override or\n * resolution with the same name stays untouched.\n *\n * @example\n * ```ts\n * import { replaceManifestRanges } from '@orkestrel/scaffold'\n *\n * const manifest = '{\"devDependencies\":{\"typescript\":\"^6\"}}\\n'\n * replaceManifestRanges(manifest, {\n * runtime: [],\n * development: [{ name: 'typescript', range: '^7' }],\n * })\n * // the manifest with the declared range replaced\n * ```\n */\nexport function replaceManifestRanges(\n\tmanifest: string,\n\tpins: DependencyPinSet,\n): string | undefined {\n\tif (pins.runtime.length === 0 && pins.development.length === 0) return manifest\n\tconst tokens = scanManifestTokens(manifest)\n\tif (tokens === undefined) return undefined\n\tconst sectionNames = new Set(['dependencies', 'devDependencies'])\n\t// A section is the object a top-level `dependencies` or `devDependencies` key holds.\n\tconst sections = tokens.flatMap((token, at) => {\n\t\tif (token.depth !== 1 || token.value === undefined) return []\n\t\tif (manifest.charAt(token.value) !== '{') return []\n\t\tconst key: unknown = parseJSON(token.text)\n\t\tif (!isString(key) || !sectionNames.has(key)) return []\n\t\tconst close = tokens.slice(at + 1).find((next) => next.text === '}' && next.depth === 1)\n\t\treturn close === undefined ? [] : [{ name: key, start: token.value, end: close.index + 1 }]\n\t})\n\t// Each section reads its own entries in text order. The guard on the log's last edit skips the\n\t// literal the previous edit replaced, which only text that is not JSON can present as a key. A\n\t// value with no literal after it refuses the whole write.\n\tconst readings = sections.map((bounds) => {\n\t\tconst replacements = new Map(\n\t\t\t(bounds.name === 'dependencies' ? pins.runtime : pins.development).map(({ name, range }) => [\n\t\t\t\tname,\n\t\t\t\trange,\n\t\t\t]),\n\t\t)\n\t\treturn {\n\t\t\tname: bounds.name,\n\t\t\tlog: tokens.reduce<\n\t\t\t\tReadonlyArray<{ readonly name: string; readonly edit: ManifestEdit }> | undefined\n\t\t\t>((log, token, at) => {\n\t\t\t\tif (log === undefined) return undefined\n\t\t\t\tif (token.index < bounds.start || token.index >= bounds.end) return log\n\t\t\t\tif (log.at(-1)?.edit.start === token.index) return log\n\t\t\t\tif (token.depth !== 2 || token.value === undefined) return log\n\t\t\t\tconst key: unknown = parseJSON(token.text)\n\t\t\t\tif (!isString(key) || manifest.charAt(token.value) !== '\"') return log\n\t\t\t\tconst replacement = replacements.get(key)\n\t\t\t\tif (replacement === undefined) return log\n\t\t\t\tconst literal = tokens[at + 1]\n\t\t\t\tif (literal === undefined) return undefined\n\t\t\t\treturn [\n\t\t\t\t\t...log,\n\t\t\t\t\t{\n\t\t\t\t\t\tname: key,\n\t\t\t\t\t\tedit: {\n\t\t\t\t\t\t\tstart: literal.index,\n\t\t\t\t\t\t\tend: literal.index + literal.text.length,\n\t\t\t\t\t\t\ttext: JSON.stringify(replacement),\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})\n\tconst settled = readings.flatMap(({ name, log }) => (log === undefined ? [] : [{ name, log }]))\n\tif (settled.length < readings.length) return undefined\n\tconst compiled = settled\n\t\t.flatMap(({ log }) => log.map(({ edit }) => edit))\n\t\t.sort((left, right) => right.start - left.start)\n\t\t.reduce((text, edit) => text.slice(0, edit.start) + edit.text + text.slice(edit.end), manifest)\n\tconst declaredRuntime = pins.runtime.every(({ name }) =>\n\t\tsettled.some(\n\t\t\t(section) =>\n\t\t\t\tsection.name === 'dependencies' && section.log.some((entry) => entry.name === name),\n\t\t),\n\t)\n\tconst declaredDevelopment = pins.development.every(({ name }) =>\n\t\tsettled.some(\n\t\t\t(section) =>\n\t\t\t\tsection.name === 'devDependencies' && section.log.some((entry) => entry.name === name),\n\t\t),\n\t)\n\treturn declaredRuntime && declaredDevelopment ? compiled : undefined\n}\n\n/**\n * Inserts dependencies a package manifest does not declare into the section each one names.\n *\n * @param manifest - The manifest text to compile.\n * @param additions - The runtime and development names and ranges to declare.\n * @returns The manifest declaring every addition, or `undefined` when the text is not a\n * manifest, an addition's section is not an object or holds a value that is not a range, a name\n * is repeated, or `dependencies` or `devDependencies` already declares a name.\n *\n * @remarks\n * Runtime additions enter `dependencies` and development additions enter `devDependencies`. The\n * compiler inserts text instead of serializing the manifest, so every declared byte survives.\n * Each addition lands before the first declared key that sorts after it, or after the last\n * declared key when none does, so a section kept in key order stays in key order. An addition\n * copies the indentation of the section's first entry; an empty section takes its entries one\n * level inside the indentation of its opening line. An absent section is created as one\n * top-level key holding its additions: `devDependencies` after `dependencies`, `dependencies`\n * before `devDependencies`, and either one last in the manifest object when its sibling is\n * absent. The created key copies the indentation of the manifest's first key, and its entries sit\n * one level further in. A name either writable section already declares is the caller's mistake\n * rather than an addition, so the compiler refuses it instead of declaring a package twice.\n *\n * @example\n * ```ts\n * import { insertManifestDependencies } from '@orkestrel/scaffold'\n *\n * insertManifestDependencies('{\\n\\t\"devDependencies\": {\\n\\t\\t\"vite\": \"^8.3.2\"\\n\\t}\\n}\\n', {\n * runtime: [],\n * development: [{ name: 'typescript', range: '^6.0.3' }],\n * })\n * // '{\\n\\t\"devDependencies\": {\\n\\t\\t\"typescript\": \"^6.0.3\",\\n\\t\\t\"vite\": \"^8.3.2\"\\n\\t}\\n}\\n'\n * ```\n */\nexport function insertManifestDependencies(\n\tmanifest: string,\n\tadditions: DependencyPinSet,\n): string | undefined {\n\tconst requested = [...additions.runtime, ...additions.development]\n\tif (requested.length === 0) return manifest\n\tconst parsed = parseJSON(manifest)\n\tif (!isRecord(parsed)) return undefined\n\tconst declared = new Set(\n\t\t['dependencies', 'devDependencies'].flatMap((section) => {\n\t\t\tconst entries = parsed[section]\n\t\t\treturn isRecord(entries) ? Object.keys(entries) : []\n\t\t}),\n\t)\n\tconst names = new Set(requested.map(({ name }) => name))\n\tif (names.size !== requested.length || [...names].some((name) => declared.has(name))) {\n\t\treturn undefined\n\t}\n\tconst sections: ReadonlyArray<{\n\t\treadonly name: 'dependencies' | 'devDependencies'\n\t\treadonly dependencies: readonly Dependency[]\n\t}> = [\n\t\t{ name: 'dependencies', dependencies: additions.runtime },\n\t\t{ name: 'devDependencies', dependencies: additions.development },\n\t]\n\tconst refused = sections.some(({ name, dependencies }) => {\n\t\tconst entries = parsed[name]\n\t\treturn (\n\t\t\tdependencies.length > 0 &&\n\t\t\tentries !== undefined &&\n\t\t\t(!isRecord(entries) || !Object.values(entries).every(isString))\n\t\t)\n\t})\n\tif (refused) return undefined\n\treturn sections.reduce<string | undefined>(\n\t\t(compiled, section) =>\n\t\t\tcompiled === undefined || section.dependencies.length === 0\n\t\t\t\t? compiled\n\t\t\t\t: insertManifestSection(\n\t\t\t\t\t\tcompiled,\n\t\t\t\t\t\tsection.name,\n\t\t\t\t\t\tsection.dependencies,\n\t\t\t\t\t\tparsed[section.name] !== undefined,\n\t\t\t\t\t),\n\t\tmanifest,\n\t)\n}\n\n/**\n * Inserts dependencies into one section of package manifest text.\n *\n * @param manifest - The manifest text to compile, already known to be a JSON object.\n * @param section - The section the additions enter: `dependencies` or `devDependencies`.\n * @param dependencies - The names and ranges to declare; the section declares none of them.\n * @param present - If `true`, the manifest declares the section as an object; if `false`, it declares none.\n * @returns The manifest declaring every addition in the section, or `undefined` when the section\n * cannot be located as an object the text declares.\n *\n * @remarks\n * The one step {@link insertManifestDependencies} repeats per section. Each addition lands before\n * the first declared key that sorts after it, or after the last declared key when none does, and\n * copies the indentation of the section's first entry. An empty section takes its entries one\n * level inside the indentation of its opening line, and an absent section is created as one\n * top-level key beside its sibling, or last in the manifest object when the sibling is absent too.\n *\n * @example\n * ```ts\n * import { insertManifestSection } from '@orkestrel/scaffold'\n *\n * insertManifestSection('{\"dependencies\":{}}', 'dependencies', [{ name: 'vite', range: '^8' }], true)\n * // '{\"dependencies\":{\"vite\": \"^8\"}}'\n * ```\n */\nexport function insertManifestSection(\n\tmanifest: string,\n\tsection: 'dependencies' | 'devDependencies',\n\tdependencies: readonly Dependency[],\n\tpresent: boolean,\n): string | undefined {\n\tconst tokens = scanManifestTokens(manifest)\n\tif (tokens === undefined) return undefined\n\tconst ordered = [...dependencies].sort((left, right) => compareValues(left.name, right.name))\n\tconst lines = ordered.map(\n\t\t({ name, range }) => `${JSON.stringify(name)}: ${JSON.stringify(range)}`,\n\t)\n\t// Locate the braces of the section and of its sibling, the first top-level key,\n\t// and the manifest object's closing brace. Depth counts objects alone, exactly\n\t// as the range writer counts them, so a key nested inside another value never\n\t// reads as a top-level one.\n\tconst sibling = section === 'dependencies' ? 'devDependencies' : 'dependencies'\n\tconst occurrences = tokens.flatMap((token, at) => {\n\t\tif (token.depth !== 1 || token.value === undefined) return []\n\t\tconst key: unknown = parseJSON(token.text)\n\t\tif (!isString(key) || (key !== section && key !== sibling)) return []\n\t\tconst object = manifest.charAt(token.value) === '{'\n\t\tconst close = object\n\t\t\t? tokens.slice(at + 1).find((next) => next.text === '}' && next.depth === 1)\n\t\t\t: undefined\n\t\treturn [{ key, start: token.index, open: token.value, object, close: close?.index }]\n\t})\n\t// The first occurrence of `section` that is not an unclosed object decides it: a value that is\n\t// no object refuses the write, and a closed object locates it. The sibling is located by its\n\t// first closed object, and any other value of it is passed over.\n\tconst decisive = occurrences.find(\n\t\t({ key, object, close }) => key === section && (!object || close !== undefined),\n\t)\n\tif (decisive !== undefined && !decisive.object) return undefined\n\tconst closed = occurrences.flatMap(({ key, start, open, close }) =>\n\t\tclose === undefined ? [] : [{ key, start, open, close }],\n\t)\n\tconst bounds = closed.find(({ key }) => key === section)\n\tconst neighbor = closed.find(({ key }) => key === sibling)\n\tconst head = tokens.find((token) => token.depth === 1 && token.value !== undefined)?.index\n\tconst root = tokens.find((token) => token.text === '}' && token.depth === 0)?.index\n\tif (bounds === undefined) {\n\t\tif (present || root === undefined) return undefined\n\t\t// An absent section becomes one top-level key: `devDependencies` after\n\t\t// `dependencies` and `dependencies` before `devDependencies`, otherwise last.\n\t\t// It copies the indentation of the manifest's first key, and lands on the\n\t\t// same line when that key shares a line with the opening brace.\n\t\tconst lineBreak = head === undefined ? -1 : manifest.lastIndexOf('\\n', head)\n\t\tconst margin = lineBreak < 0 ? '' : manifest.slice(lineBreak + 1, head)\n\t\tconst gap = lineBreak < 0 || /\\S/u.test(margin) ? '' : `\\n${margin}`\n\t\tconst block = `${JSON.stringify(section)}: {${lines.map((line) => `${gap === '' ? '' : `${gap}${margin}`}${line}`).join(',')}${gap}}`\n\t\tconst tail = manifest.slice(1, root).trimEnd().length\n\t\tconst [position, insertion] =\n\t\t\tneighbor === undefined\n\t\t\t\t? [tail + 1, manifest.charAt(tail) === '{' ? block : `,${gap}${block}`]\n\t\t\t\t: section === 'devDependencies'\n\t\t\t\t\t? [neighbor.close + 1, `,${gap}${block}`]\n\t\t\t\t\t: [neighbor.start, `${block},${gap}`]\n\t\treturn manifest.slice(0, position) + insertion + manifest.slice(position)\n\t}\n\tconst { open, close } = bounds\n\t// Every value is a string, so the section's strings alternate key and value and\n\t// each entry runs from its key's opening quote to its value's closing quote.\n\tconst literals = tokens.filter(\n\t\t(token) => token.index > open && token.index < close && token.text.startsWith('\"'),\n\t)\n\tconst keys = literals.filter((_, index) => index % 2 === 0)\n\tif (keys.some((literal) => !isString(parseJSON(literal.text)))) return undefined\n\tconst declarations = keys.flatMap((literal, position) => {\n\t\tconst name: unknown = parseJSON(literal.text)\n\t\tconst value = literals[position * 2 + 1]\n\t\treturn isString(name) && value !== undefined\n\t\t\t? [{ name, start: literal.index, end: value.index + value.text.length }]\n\t\t\t: []\n\t})\n\tconst first = declarations[0]\n\tconst last = declarations.at(-1)\n\tif (first === undefined || last === undefined) {\n\t\tconst lineBreak = manifest.lastIndexOf('\\n', open)\n\t\tconst level =\n\t\t\tlineBreak < 0 ? '' : (/^\\s*/u.exec(manifest.slice(lineBreak + 1, open))?.[0] ?? '')\n\t\tconst separator = lineBreak < 0 ? '' : `\\n${level}${level}`\n\t\tconst suffix = lineBreak < 0 ? '' : `\\n${level}`\n\t\treturn `${manifest.slice(0, open + 1)}${lines.map((line) => `${separator}${line}`).join(',')}${suffix}${manifest.slice(close)}`\n\t}\n\tconst newline = manifest.lastIndexOf('\\n', first.start)\n\tconst indent = newline < 0 ? '' : manifest.slice(newline + 1, first.start)\n\tconst separator = newline < 0 || /\\S/u.test(indent) ? '' : `\\n${indent}`\n\tconst placements = ordered.map((dependency, index) => {\n\t\tconst line = lines[index] ?? ''\n\t\tconst anchor = declarations.find(\n\t\t\t(declaration) => compareValues(declaration.name, dependency.name) > 0,\n\t\t)\n\t\treturn {\n\t\t\tposition: anchor?.start ?? last.end,\n\t\t\ttext: anchor === undefined ? `,${separator}${line}` : `${line},${separator}`,\n\t\t}\n\t})\n\treturn [...Map.groupBy(placements, ({ position }) => position)]\n\t\t.map(([position, group]): [number, string] => [\n\t\t\tposition,\n\t\t\tgroup.map(({ text }) => text).join(''),\n\t\t])\n\t\t.sort(([left], [right]) => right - left)\n\t\t.reduce(\n\t\t\t(text, [position, insertion]) => text.slice(0, position) + insertion + text.slice(position),\n\t\t\tmanifest,\n\t\t)\n}\n\n/**\n * Replaces named script values in package manifest text.\n *\n * @param manifest - The manifest text to compile.\n * @param scripts - The scripts to write, each with the predecessors it accepts.\n * @returns The manifest carrying every absent or accepted named script and\n * retaining every differing string value, or `undefined` when a planned key\n * holds a non-string value or the text carries no readable `scripts` object to\n * write into.\n *\n * @remarks\n * The compiler replaces values in place instead of serializing the manifest, so\n * description, keywords, dependencies, key order, indentation, and every byte\n * outside the replaced ranges survive. A named script the manifest already\n * declares is overwritten only when its value is one of its\n * {@link ManifestScript.accepted} predecessors. The planned value stands. Any\n * other string is a chain the workspace author customized, so it stays\n * byte-identical while the other named scripts are written independently. A\n * named script the manifest does not declare is appended after the last\n * declared script of its own key family, copying that section's indentation:\n * `test:setup` follows the last declared `test:` key. A name carrying no colon\n * has no family, and so does a family the section declares no member of, and\n * each of those is appended after the last declared script instead. A region\n * declaring nothing takes every named script as its first entries, indented\n * from the line its own opening brace sits on.\n *\n * @example\n * ```ts\n * import { replaceManifestScripts } from '@orkestrel/scaffold'\n *\n * const manifest = '{\\n\\t\"scripts\": {\\n\\t\\t\"test\": \"vitest run\"\\n\\t}\\n}\\n'\n * replaceManifestScripts(manifest, [\n * { name: 'test', command: 'vitest run --no-cache', accepted: ['vitest run'] },\n * ])\n * // the manifest with the declared script replaced\n * ```\n */\nexport function replaceManifestScripts(\n\tmanifest: string,\n\tscripts: readonly ManifestScript[],\n): string | undefined {\n\tif (scripts.length === 0) return manifest\n\tconst parsed: unknown = parseJSON(manifest)\n\tif (!isRecord(parsed) || !isRecord(parsed.scripts)) return undefined\n\tconst declared = parsed.scripts\n\t// A non-string planned key makes the region structurally unsafe to edit, so\n\t// rule on that shape before locating any byte range. The iterator reads one script at a time,\n\t// stops at the first that refuses, and reads a hole as an `undefined` script, as a `for…of`\n\t// over the list would. It takes the list through its iterator protocol alone.\n\tif (\n\t\tIterator.from(scripts).some(\n\t\t\t(script) => Object.hasOwn(declared, script.name) && !isString(declared[script.name]),\n\t\t)\n\t) {\n\t\treturn undefined\n\t}\n\tconst tokens = scanManifestTokens(manifest)\n\tif (tokens === undefined) return undefined\n\t// Locate the top-level scripts object. Depth counts objects alone, exactly as\n\t// the range writer counts them, so a key nested inside another object never\n\t// reads as a top-level one.\n\tconst position = tokens.findIndex(\n\t\t(token, at) =>\n\t\t\ttoken.depth === 1 &&\n\t\t\ttoken.value !== undefined &&\n\t\t\tparseJSON(token.text) === 'scripts' &&\n\t\t\tmanifest.charAt(token.value) === '{' &&\n\t\t\ttokens.slice(at + 1).some((next) => next.text === '}' && next.depth === 1),\n\t)\n\tconst region = tokens[position]\n\tconst close = tokens.slice(position + 1).find((token) => token.text === '}' && token.depth === 1)\n\tif (region?.value === undefined || close === undefined) return undefined\n\tconst start = region.value\n\tconst end = close.index + 1\n\t// Read the section's own entries for their byte ranges, and remember where the\n\t// first key sits: that column is the indentation an appended script copies.\n\t// Each string-valued entry also records where it ends, because that offset is\n\t// the anchor an appended sibling of the same key family inserts after. A string\n\t// value with no literal after it refuses the write.\n\tconst entries = tokens.reduce<\n\t\t| ReadonlyArray<{\n\t\t\t\treadonly token: ManifestToken\n\t\t\t\treadonly value: number\n\t\t\t\treadonly literal: ManifestToken | undefined\n\t\t }>\n\t\t| undefined\n\t>((log, token, at) => {\n\t\tif (log === undefined) return undefined\n\t\tif (token.index < start || token.index >= end) return log\n\t\tif (token.depth !== 2 || token.value === undefined) return log\n\t\tif (manifest.charAt(token.value) !== '\"') {\n\t\t\treturn [...log, { token, value: token.value, literal: undefined }]\n\t\t}\n\t\tconst literal = tokens[at + 1]\n\t\treturn literal === undefined ? undefined : [...log, { token, value: token.value, literal }]\n\t}, [])\n\tif (entries === undefined) return undefined\n\tconst first = entries[0]?.token.index\n\tconst keyed = entries.flatMap(({ token, value, literal }) =>\n\t\tliteral === undefined\n\t\t\t? []\n\t\t\t: [{ key: parseJSON(token.text), value, stop: literal.index + literal.text.length }],\n\t)\n\tconst anchors = keyed.flatMap(({ key, stop }) =>\n\t\tisString(key) ? [{ name: key, end: stop }] : [],\n\t)\n\tconst matched = keyed.flatMap((entry) => {\n\t\tconst script = scripts.find((candidate) => candidate.name === entry.key)\n\t\treturn script === undefined ? [] : [{ script, value: entry.value, stop: entry.stop }]\n\t})\n\tconst written = new Set(matched.map(({ script }) => script.name))\n\tconst replaced = matched.flatMap(({ script, value, stop }): readonly ManifestEdit[] => {\n\t\tconst current: unknown = declared[script.name]\n\t\treturn current === script.command || !isString(current) || !script.accepted.includes(current)\n\t\t\t? []\n\t\t\t: [{ start: value, end: stop, text: JSON.stringify(script.command) }]\n\t})\n\tconst missing = scripts.filter((script) => !written.has(script.name))\n\t// An empty region declares every named script absent, and an absent script is\n\t// always writable, so the region takes them as its first entries rather than\n\t// refusing the write. No sibling entry exists to copy a column from, so the\n\t// indentation comes from the region's own opening line: `scripts` is a\n\t// top-level key, so that line's leading whitespace is one level and an entry\n\t// inside the region sits at two. A manifest carrying no line break before the\n\t// region is written on one line, which is what the append path does with a\n\t// one-line region it finds already populated.\n\tconst lineBreak = manifest.lastIndexOf('\\n', start)\n\tconst level = lineBreak < 0 ? '' : (/^\\s*/u.exec(manifest.slice(lineBreak + 1, start))?.[0] ?? '')\n\tconst emptySeparator = lineBreak < 0 ? '' : `\\n${level}${level}`\n\tconst emptySuffix = lineBreak < 0 ? '' : `\\n${level}`\n\t// A qualified name joins the family its prefix names, landing after that\n\t// family's last declared member so a reader finds it among its siblings\n\t// rather than behind the lifecycle scripts that close the section. An\n\t// unqualified name has no family, and a family the section never declares\n\t// has no member to follow, so each takes the section's own end.\n\tconst tail = start + manifest.slice(start, end - 1).trimEnd().length\n\tconst newline = first === undefined ? -1 : manifest.lastIndexOf('\\n', first)\n\tconst indent = first === undefined || newline < 0 ? '' : manifest.slice(newline + 1, first)\n\tconst separator = newline < 0 || /\\S/u.test(indent) ? '' : `\\n${indent}`\n\tconst placements = missing.map((script) => {\n\t\tconst colon = script.name.indexOf(':')\n\t\tconst family = colon < 0 ? undefined : script.name.slice(0, colon + 1)\n\t\tconst sibling =\n\t\t\tfamily === undefined ? undefined : anchors.findLast((entry) => entry.name.startsWith(family))\n\t\treturn {\n\t\t\tanchor: sibling?.end ?? tail,\n\t\t\ttext: `,${separator}${JSON.stringify(script.name)}: ${JSON.stringify(script.command)}`,\n\t\t}\n\t})\n\tconst appended: readonly ManifestEdit[] =\n\t\tmissing.length === 0\n\t\t\t? []\n\t\t\t: first === undefined\n\t\t\t\t? [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tstart: start + 1,\n\t\t\t\t\t\t\tend: end - 1,\n\t\t\t\t\t\t\ttext: `${missing\n\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t(script) =>\n\t\t\t\t\t\t\t\t\t\t`${emptySeparator}${JSON.stringify(script.name)}: ${JSON.stringify(script.command)}`,\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.join(',')}${emptySuffix}`,\n\t\t\t\t\t\t},\n\t\t\t\t\t]\n\t\t\t\t: [...Map.groupBy(placements, ({ anchor }) => anchor)].map(\n\t\t\t\t\t\t([anchor, group]): ManifestEdit => ({\n\t\t\t\t\t\t\tstart: anchor,\n\t\t\t\t\t\t\tend: anchor,\n\t\t\t\t\t\t\ttext: group.map(({ text }) => text).join(''),\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\treturn [...replaced, ...appended]\n\t\t.sort((left, right) => right.start - left.start)\n\t\t.reduce((text, edit) => text.slice(0, edit.start) + edit.text + text.slice(edit.end), manifest)\n}\n\n/**\n * Replaces dependency ranges in a plan's manifest and recomputes its identity.\n *\n * @param plan - The plan carrying the manifest artifact to compile.\n * @param pins - The runtime and development names and replacement ranges.\n * @returns A plan with replaced manifest ranges and a matching hash, or\n * `undefined` when the manifest or its identity cannot be compiled.\n *\n * @remarks\n * The blueprint remains the workspace specification that produced the plan.\n * Registry answers alter only the manifest artifact that materialization will\n * write. Recomputing the hash in the same compiler keeps the plan's identity\n * tied to those final bytes rather than to the unresolved floor.\n *\n * @example\n * ```ts\n * import { replacePlanRanges } from '@orkestrel/scaffold'\n *\n * replacePlanRanges(plan, pins) // the plan carrying the resolved writable ranges\n * ```\n */\nexport function replacePlanRanges(plan: Plan, pins: DependencyPinSet): Plan | undefined {\n\tconst outcomes = plan.artifacts.map(\n\t\t(\n\t\t\tartifact,\n\t\t): { readonly artifact: Artifact; readonly manifest: boolean; readonly refused: boolean } => {\n\t\t\tif (artifact.path !== 'package.json' || artifact.origin === 'host') {\n\t\t\t\treturn { artifact, manifest: false, refused: false }\n\t\t\t}\n\t\t\tconst content = replaceManifestRanges(artifact.content, pins)\n\t\t\treturn content === undefined\n\t\t\t\t? { artifact, manifest: true, refused: true }\n\t\t\t\t: { artifact: { ...artifact, content }, manifest: true, refused: false }\n\t\t},\n\t)\n\tif (\n\t\t!outcomes.some((outcome) => outcome.manifest) ||\n\t\toutcomes.some((outcome) => outcome.refused)\n\t) {\n\t\treturn undefined\n\t}\n\tconst artifacts = outcomes.map((outcome) => outcome.artifact)\n\tconst compiled: Plan = { ...plan, artifacts }\n\tconst hash = planToHash(compiled)\n\treturn hash === undefined ? undefined : { ...compiled, hash }\n}\n\n/**\n * Computes 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 { Compiler, createBlueprint, planToHash } from '@orkestrel/scaffold'\n *\n * const { plan } = new Compiler().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 * Compares 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 { Compiler, createBlueprint, planToFindings } from '@orkestrel/scaffold'\n *\n * const { plan } = new Compiler().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\t// The iterator consumes one artifact at a time and reads a hole as an `undefined` artifact, as a\n\t// `for…of` over the list would. The path is read for the plan before the finding reads it.\n\tconst listed = Iterator.from(plan.artifacts)\n\t\t.map((artifact) => ({\n\t\t\tpath: artifact.path,\n\t\t\tfinding: artifactToFinding(artifact, current[artifact.path]),\n\t\t}))\n\t\t.toArray()\n\tconst planned = new Set(listed.map(({ path }) => path))\n\treturn [\n\t\t...listed.map(({ finding }) => finding),\n\t\t...Object.entries(current).flatMap(([path, observed]): readonly Finding[] => {\n\t\t\tif (planned.has(path)) return []\n\t\t\tconst group = inferGroup(path)\n\t\t\treturn plan.groups.includes(group) ? [{ path, group, drift: 'foreign', observed }] : []\n\t\t}),\n\t]\n}\n\n/**\n * Measures 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 declared lists and peer partitions differ only in the syntaxes they\n * accept, so the rules live here once and each caller supplies its own patterns.\n * A runtime dependency name reaches a path through its guide mirror and is\n * fixed to the `@orkestrel` scope. A foreign peer or development extra reaches\n * no path and admits any 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\t// The iterator consumes one entry at a time and reads a hole as an `undefined` entry, which the\n\t// name read refuses before a later entry is read.\n\tconst listed = Iterator.from(dependencies)\n\t\t.map((dependency) => {\n\t\t\tconst declared = dependency.name\n\t\t\tconst valid = name.test(declared)\n\t\t\tconst pinned = dependency.range\n\t\t\treturn { declared, valid, pinned, accepted: range.test(pinned) }\n\t\t})\n\t\t.toArray()\n\treturn listed.flatMap(({ declared, valid, pinned, accepted }, index): readonly Question[] => [\n\t\t...(!valid\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield,\n\t\t\t\t\t\tmessage: `${declared} is not a package name ${field} accepts.`,\n\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: listed.findIndex((other) => other.declared === declared) < index\n\t\t\t\t? [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfield,\n\t\t\t\t\t\t\tmessage: `${declared} is declared more than once on ${field}.`,\n\t\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t]\n\t\t\t\t: []),\n\t\t...(!accepted\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield,\n\t\t\t\t\t\tmessage: `${declared} declares the range ${pinned}, which ${field} does not accept.`,\n\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: []),\n\t])\n}\n\n/**\n * Measures 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 environment axes admit,\n * and the overlaps between the 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 * These do not, because each describes a workspace it can describe honestly but\n * will 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 * or journey flag whose required browser axis is absent, which emits nothing; an unplaced browser\n * extension or a styles extension without the styles surface; 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\t// Each list is read where the following sections reach it, one entry at a time and once per pass, and\n\t// The iterator reads a hole in a list as an `undefined` entry, as a `for…of` over it would.\n\tconst own = `@orkestrel/${blueprint.name}`\n\treturn [\n\t\t...(!NAME_PATTERN.test(blueprint.name)\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'name',\n\t\t\t\t\t\tmessage: `${blueprint.name} is not a lowercase alphanumeric name starting with a letter.`,\n\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: []),\n\t\t...(!VERSION_PATTERN.test(blueprint.version)\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'version',\n\t\t\t\t\t\tmessage: `${blueprint.version} is not an exact three-component version.`,\n\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: []),\n\t\t...(!matchesEngines(blueprint.engines)\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'engines',\n\t\t\t\t\t\tmessage: `${blueprint.engines} is not a supported minimum-Node floor.`,\n\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: []),\n\t\t...(blueprint.src.length === 0 &&\n\t\tblueprint.app.length === 0 &&\n\t\tblueprintToSheets(blueprint).length === 0 &&\n\t\t!blueprint.themes\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'src',\n\t\t\t\t\t\tmessage: 'A workspace declares at least one environment on src or app.',\n\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t\tcandidates: ENVIRONMENTS,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: []),\n\t\t...(blueprint.src.length > 1 && !blueprint.src.includes('core')\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'src',\n\t\t\t\t\t\tmessage:\n\t\t\t\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\t\t\t\tblocking: false,\n\t\t\t\t\t\tcandidates: ENVIRONMENTS,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: []),\n\t\t...ENVIRONMENTS.flatMap((environment) => [\n\t\t\t...(blueprint.src.filter((declared) => declared === environment).length > 1\n\t\t\t\t? [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfield: 'src',\n\t\t\t\t\t\t\tmessage: `src declares ${environment} more than once.`,\n\t\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t\t\tcandidates: ENVIRONMENTS,\n\t\t\t\t\t\t},\n\t\t\t\t\t]\n\t\t\t\t: []),\n\t\t\t...(blueprint.app.filter((declared) => declared === environment).length > 1\n\t\t\t\t? [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfield: 'app',\n\t\t\t\t\t\t\tmessage: `app declares ${environment} more than once.`,\n\t\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t\t\tcandidates: ENVIRONMENTS,\n\t\t\t\t\t\t},\n\t\t\t\t\t]\n\t\t\t\t: []),\n\t\t]),\n\t\t// An extension's own questions are read with the extension, and the repeat of an earlier\n\t\t// selection is judged after every extension has been read.\n\t\t...Iterator.from(blueprint.extensions)\n\t\t\t.map((extension) => {\n\t\t\t\tconst selection = `${extension.surface}:${extension.name}`\n\t\t\t\treturn {\n\t\t\t\t\tselection,\n\t\t\t\t\tquestions:\n\t\t\t\t\t\textension.surface === 'browser'\n\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\t...(extension.axes.length === 0\n\t\t\t\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\tfield: 'extensions',\n\t\t\t\t\t\t\t\t\t\t\t\t\tmessage: `${selection} occupies no axis.`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tblocking: false,\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t\t: []),\n\t\t\t\t\t\t\t\t\t...Iterator.from(extension.axes)\n\t\t\t\t\t\t\t\t\t\t.flatMap((axis) =>\n\t\t\t\t\t\t\t\t\t\t\tblueprint[axis].includes('browser')\n\t\t\t\t\t\t\t\t\t\t\t\t? []\n\t\t\t\t\t\t\t\t\t\t\t\t: [\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfield: 'extensions',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmessage: `${selection} occupies ${axis}, whose selection lacks browser.`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tblocking: false,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t.toArray(),\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t: !blueprint.styles\n\t\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tfield: 'extensions',\n\t\t\t\t\t\t\t\t\t\t\tmessage: `${selection} extends a styles surface this workspace does not declare.`,\n\t\t\t\t\t\t\t\t\t\t\tblocking: false,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t: [],\n\t\t\t\t}\n\t\t\t})\n\t\t\t.toArray()\n\t\t\t.flatMap(({ selection, questions }, index, selected): readonly Question[] => [\n\t\t\t\t...(selected.findIndex((other) => other.selection === selection) < index\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfield: 'extensions',\n\t\t\t\t\t\t\t\tmessage: `${selection} is declared more than once on extensions.`,\n\t\t\t\t\t\t\t\tblocking: true,\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...questions,\n\t\t\t]),\n\t\t...(blueprint.integration && blueprint.src.length + blueprint.app.length < 2\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'integration',\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t'integration drives features across environments, and this workspace declares fewer than two, so its seed composes nothing.',\n\t\t\t\t\t\tblocking: false,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: []),\n\t\t...Iterator.from(blueprint.vendors)\n\t\t\t.map((vendor) => ({\n\t\t\t\tvendor,\n\t\t\t\tvalid: NAME_PATTERN.test(vendor),\n\t\t\t}))\n\t\t\t.toArray()\n\t\t\t.flatMap(({ vendor, valid }, index, declared): readonly Question[] =>\n\t\t\t\t!valid\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfield: 'vendors',\n\t\t\t\t\t\t\t\tmessage: `${vendor} is not a lowercase alphanumeric vendor name starting with a letter.`,\n\t\t\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t]\n\t\t\t\t\t: declared.findIndex((other) => other.vendor === vendor) < index\n\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tfield: 'vendors',\n\t\t\t\t\t\t\t\t\tmessage: `${vendor} is declared more than once on vendors.`,\n\t\t\t\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t: [],\n\t\t\t),\n\t\t...(blueprint.showcase && !blueprint.app.includes('browser')\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'showcase',\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t'showcase projects a browser app, and this workspace declares none, so it emits nothing.',\n\t\t\t\t\t\tblocking: false,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: []),\n\t\t...(blueprint.journey && !blueprint.app.includes('browser')\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'journey',\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t'journey projects a browser app, and this workspace declares none, so it emits nothing.',\n\t\t\t\t\t\tblocking: false,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: []),\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.filter((peer) => peer.name.startsWith('@orkestrel/')),\n\t\t\t'peers',\n\t\t\tDEPENDENCY_NAME_PATTERN,\n\t\t\tORKESTREL_RANGE_PATTERN,\n\t\t),\n\t\t...dependenciesToQuestions(\n\t\t\tblueprint.peers.filter((peer) => !peer.name.startsWith('@orkestrel/')),\n\t\t\t'peers',\n\t\t\tFOREIGN_NAME_PATTERN,\n\t\t\tFLOOR_RANGE_PATTERN,\n\t\t),\n\t\t...dependenciesToQuestions(\n\t\t\tblueprint.extras,\n\t\t\t'extras',\n\t\t\tFOREIGN_NAME_PATTERN,\n\t\t\tEXTRA_RANGE_PATTERN,\n\t\t),\n\t\t// The three lists are read in field order, and the field that first declared a name is the\n\t\t// field of the first entry that carries it.\n\t\t...(\n\t\t\t[\n\t\t\t\t['dependencies', blueprint.dependencies],\n\t\t\t\t['peers', blueprint.peers],\n\t\t\t\t['extras', blueprint.extras],\n\t\t\t] as const\n\t\t)\n\t\t\t.flatMap(([field, list]) =>\n\t\t\t\tIterator.from(list)\n\t\t\t\t\t.map((dependency) => ({ field, name: dependency.name }))\n\t\t\t\t\t.toArray(),\n\t\t\t)\n\t\t\t.flatMap(({ field, name }, _, declared): readonly Question[] => {\n\t\t\t\tconst first = declared.find((other) => other.name === name)?.field\n\t\t\t\treturn [\n\t\t\t\t\t...(name === own || name === blueprint.name\n\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tfield,\n\t\t\t\t\t\t\t\t\tmessage: `${name} is the workspace itself.`,\n\t\t\t\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t: []),\n\t\t\t\t\t...(first !== undefined && first !== field\n\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tfield,\n\t\t\t\t\t\t\t\t\tmessage: `${name} is declared on both ${first} and ${field}.`,\n\t\t\t\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t: []),\n\t\t\t\t]\n\t\t\t}),\n\t\t...Iterator.from(blueprint.extras)\n\t\t\t.flatMap((extra) =>\n\t\t\t\tObject.hasOwn(BASE_DEV_DEPENDENCIES, extra.name)\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfield: 'extras',\n\t\t\t\t\t\t\t\tmessage: `${extra.name} is pinned by the shared toolchain, which every workspace carries at one version.`,\n\t\t\t\t\t\t\t\tblocking: true,\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)\n\t\t\t.toArray(),\n\t]\n}\n\n/**\n * Measures 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\t// The iterator consumes one artifact at a time and reads a hole as an `undefined` artifact, as a\n\t// `for…of` over the list would.\n\tconst listed = Iterator.from(artifacts)\n\t\t.map((artifact) => ({\n\t\t\tpath: artifact.path,\n\t\t\tbytes:\n\t\t\t\tartifact.origin === 'host'\n\t\t\t\t\t? artifact.hex === undefined\n\t\t\t\t\t\t? 0\n\t\t\t\t\t\t: artifact.hex.length / 2\n\t\t\t\t\t: computeBytes(artifact.content),\n\t\t}))\n\t\t.toArray()\n\tconst total = computeTotal(listed.map(({ bytes }) => bytes))\n\treturn [\n\t\t...listed.flatMap(({ path, bytes }, index): readonly Question[] => [\n\t\t\t...(listed.findIndex((other) => other.path === path) < index\n\t\t\t\t? [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfield: 'artifacts',\n\t\t\t\t\t\t\tmessage: `Two artifacts claim ${path}.`,\n\t\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t]\n\t\t\t\t: []),\n\t\t\t...(bytes > MAX_ARTIFACT_BYTES\n\t\t\t\t? [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfield: 'artifacts',\n\t\t\t\t\t\t\tmessage: `${path} carries ${bytes} bytes, above the ${MAX_ARTIFACT_BYTES} one artifact admits.`,\n\t\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t]\n\t\t\t\t: []),\n\t\t]),\n\t\t...(artifacts.length > MAX_COLLECTION_ITEMS\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'artifacts',\n\t\t\t\t\t\tmessage: `A plan of ${artifacts.length} artifacts is above the ${MAX_COLLECTION_ITEMS} one collection admits.`,\n\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: []),\n\t\t...(total > MAX_TOTAL_ARTIFACT_BYTES\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'artifacts',\n\t\t\t\t\t\tmessage: `A plan of ${total} bytes is above the ${MAX_TOTAL_ARTIFACT_BYTES} one plan retains.`,\n\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: []),\n\t]\n}\n\n/**\n * Measures 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\t// The first artifact planned at a path is the one an override addresses, so the pairs are\n\t// reversed for a `Map` to keep it. The iterators consume one artifact and then one override at a\n\t// time, and reads a hole as an `undefined` entry, as a `for…of` over the list would.\n\tconst planned = new Map(\n\t\tIterator.from(artifacts)\n\t\t\t.map((artifact): readonly [string, Artifact] => [artifact.path, artifact])\n\t\t\t.toArray()\n\t\t\t.reverse(),\n\t)\n\tconst listed = Iterator.from(overrides)\n\t\t.map((override) => override.path)\n\t\t.toArray()\n\treturn listed.flatMap((path, index): readonly Question[] => {\n\t\tconst artifact = planned.get(path)\n\t\treturn [\n\t\t\t...(listed.indexOf(path) < index\n\t\t\t\t? [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfield: 'overrides',\n\t\t\t\t\t\t\tmessage: `${path} is overridden more than once.`,\n\t\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t]\n\t\t\t\t: []),\n\t\t\t...(artifact === undefined\n\t\t\t\t? [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfield: 'overrides',\n\t\t\t\t\t\t\tmessage: `${path} is not a path this plan carries.`,\n\t\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t]\n\t\t\t\t: artifact.origin === 'host'\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfield: 'overrides',\n\t\t\t\t\t\t\t\tmessage: `${path} is byte-copied from the vendored data root.`,\n\t\t\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t]\n\t\t\t\t\t: artifact.group === 'manifest'\n\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tfield: 'overrides',\n\t\t\t\t\t\t\t\t\tmessage: `${path} is the manifest, which the blueprint's own fields decide.`,\n\t\t\t\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t: []),\n\t\t]\n\t})\n}\n","import type { Blueprint } from './types.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 * Constructs 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 every part: 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 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 restate that law\n * and let the answers disagree, so a blueprint the gate will\n * refuse is still constructible.\n *\n * @example Blueprint\n * ```ts\n * import { createBlueprint } from '@orkestrel/scaffold'\n *\n * const blueprint = createBlueprint('router', {\n * \tsrc: ['core', 'server'],\n * \tdependencies: [{ name: '@orkestrel/emitter', range: '^0.0.5' }],\n * \tbin: true,\n * })\n *\n * blueprint.version // '0.0.1'\n * blueprint.engines // '>=22.18.0'\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\textensions: input?.extensions ?? [],\n\t\tstyles: input?.styles ?? false,\n\t\tthemes: input?.themes ?? false,\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\tsetup: input?.setup ?? [],\n\t\tguides: input?.guides ?? false,\n\t\tintegration: input?.integration ?? false,\n\t\tconformance: input?.conformance ?? false,\n\t\ttree: input?.tree ?? false,\n\t\tservice: input?.service ?? false,\n\t\tvendors: input?.vendors ?? [],\n\t\tstudies: input?.studies ?? false,\n\t\tglobal: input?.global ?? false,\n\t\tshowcase: input?.showcase ?? false,\n\t\tjourney: input?.journey ?? false,\n\t\tskills: input?.skills ?? 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","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\tCompileResult,\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\tblueprintToHostArtifacts,\n\tblueprintToManifest,\n\tblueprintToOrchestrationArtifacts,\n\tblueprintToQuestions,\n\tblueprintToSourceArtifacts,\n\tblueprintToTestArtifacts,\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 * Represents 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 compile result 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 * The 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 { Compiler, createBlueprint } from '@orkestrel/scaffold'\n *\n * const compiler = new Compiler()\n * const result = compiler.compile(createBlueprint('router', { src: ['core'] }))\n *\n * result.plan?.artifacts // every planned file, in group order\n * result.stages // one CompileRecord per stage that ran\n * compiler.destroy()\n * ```\n */\nexport class Compiler implements CompilerInterface {\n\treadonly #emitter: Emitter<CompilerEventMap>\n\t#destroyed = false\n\n\t/**\n\t * Constructs 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/** Exposes the compiler's observation channel. */\n\tget emitter(): EmitterInterface<CompilerEventMap> {\n\t\treturn this.#emitter\n\t}\n\n\t/**\n\t * Compiles 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 compile result, 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 decide whether to create\n\t * it, and the questions beside it are what this compiler could not settle. A\n\t * caller creating a fresh workspace answers them first and writes nothing while\n\t * any remains, which is the rule the `new` verb applies; a caller describing or\n\t * repairing an existing target carries them through instead.\n\t * Nothing downstream repeats that check, because only the caller knows which\n\t * case it is.\n\t *\n\t * @example\n\t * ```ts\n\t * import { Compiler, createBlueprint } from '@orkestrel/scaffold'\n\t *\n\t * const blueprint = createBlueprint('router', { src: ['core'] })\n\t *\n\t * new Compiler().compile(blueprint, ['manifest']).plan?.artifacts.length // 1\n\t * ```\n\t */\n\tcompile(blueprint: Blueprint, groups?: readonly Group[]): CompileResult {\n\t\tthis.#assertAlive()\n\t\tconst accepted = this.#accept(blueprint, parseBlueprint, 'blueprint')\n\t\tconst result = this.#scaffold(accepted, this.#select(groups))\n\t\tif (result.plan === undefined) this.#emitter.emit('block', result.questions)\n\t\tthis.#emitter.emit('compile', result)\n\t\treturn result\n\t}\n\n\t/**\n\t * Compiles a blueprint and compares 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 { Compiler, createBlueprint } from '@orkestrel/scaffold'\n\t *\n\t * const blueprint = createBlueprint('router', { src: ['core'] })\n\t *\n\t * new Compiler().audit(blueprint, {}, ['manifest']).findings[0]?.drift // 'aligned'\n\t * new Compiler().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 compiled = this.#scaffold(accepted, this.#select(groups))\n\t\tif (compiled.plan === undefined) this.#emitter.emit('block', compiled.questions)\n\t\tconst result: Audit = {\n\t\t\tfindings: compiled.plan === undefined ? [] : planToFindings(compiled.plan, observed),\n\t\t\tquestions: compiled.questions,\n\t\t}\n\t\tthis.#emitter.emit('audit', result)\n\t\treturn result\n\t}\n\n\t/**\n\t * Tears 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 { Compiler } from '@orkestrel/scaffold'\n\t *\n\t * const compiler = new Compiler()\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 stages in order, recording each one and stopping at the first\n\t// failure. Every public method runs this and choreographs its own events, so\n\t// an audit never emits a compile's completion.\n\t#scaffold(blueprint: Blueprint, groups: readonly Group[]): CompileResult {\n\t\tconst stages: CompileRecord[] = []\n\t\tconst draft = this.#draft(blueprint)\n\t\tconst selected = groups.flatMap((group) => draft.filter((artifact) => artifact.group === group))\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 after 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...blueprintToHostArtifacts(blueprint),\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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