@orkestrel/scaffold 0.0.49 → 0.0.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/dist/bin/main.js +184 -72
- package/dist/bin/main.js.map +1 -1
- package/dist/host/agents/orchestration.md +28 -3
- package/dist/host/claude/agents/orkestrel.md +44 -44
- package/dist/host/claude/rules/tests.md +6 -2
- package/dist/host/guides/scaffold.md +328 -96
- package/dist/host/manifest.json +6 -6
- package/dist/host/scripts/codex.sh +0 -0
- package/dist/host/scripts/cursor.sh +0 -0
- package/dist/host/scripts/deps.sh +0 -0
- package/dist/host/scripts/ollama.sh +0 -0
- package/dist/host/tests/config.test.ts +26 -5
- package/dist/src/core/index.cjs +1285 -80
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +200 -36
- package/dist/src/core/index.d.ts +200 -36
- package/dist/src/core/index.js +1280 -81
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +47 -15
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +42 -15
- package/dist/src/server/index.d.ts +42 -15
- package/dist/src/server/index.js +48 -17
- package/dist/src/server/index.js.map +1 -1
- package/package.json +9 -9
package/dist/bin/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","names":["#stdout","#stderr","#output","#diagnostic","#upstream","#say","#refuse","#dispatch","#create","#inspect","#restore","#refresh","#replace","#environments","#packages","#compile","#versions","#assertVersions","#host","#report","#tally","#reportBaselines","#manifest","#derive","#groups","#targetQuestions","#survey","#present","#reportReleases","#assertTarget","#merge","#reportReplacements","#warn","#previous","#fetch","#catalogReleases","#pin","#assertFetched","#publish","#recount","#worktree","#offline","#reconcile","#lookup","#probe","#invocations","#projectQuestion","#dependencyQuestion","#inventory","#sanitize"],"sources":["../../src/bin/constants.ts","../../src/bin/errors.ts","../../src/bin/helpers.ts","../../src/bin/CLI.ts","../../src/bin/main.ts"],"sourcesContent":["import type { ParseArgsOptionsConfig } from 'node:util'\nimport type { Verb } from './types.js'\n\n/**\n * The name the executable installs as.\n *\n * @remarks\n * `package.json`'s `bin` field is the authority for what the command is called;\n * this is the same word, so every usage line the executable prints is a command\n * a reader can paste back.\n */\nexport const EXECUTABLE_NAME = 'scaffold'\n\n/**\n * The {@link Verb} values in usage order, frozen.\n *\n * @remarks\n * The order the type declares them in, which is also the order usage lists them:\n * the verb that creates a workspace, then the one that only reads it, then the\n * ones that write to one that already exists, widest last.\n */\nexport const VERBS: readonly Verb[] = Object.freeze([\n\t'new',\n\t'audit',\n\t'repair',\n\t'catalog',\n\t'overwrite',\n])\n\n/** The exit code reporting that the target matched its plan and every step completed. */\nexport const EXIT_CLEAN = 0\n\n/** The exit code reporting that the target drifted, or that a step failed. */\nexport const EXIT_DRIFT = 1\n\n/** The exit code reporting that the command line was not a command. */\nexport const EXIT_USAGE = 2\n\n/**\n * What each exit code means, frozen.\n *\n * @remarks\n * Keyed by the code constants rather than by literals, so the usage block\n * cannot document a code the executable does not return.\n */\nexport const EXIT_SUMMARY: Readonly<Record<number, string>> = Object.freeze({\n\t[EXIT_CLEAN]: 'clean',\n\t[EXIT_DRIFT]: 'drift or failure',\n\t[EXIT_USAGE]: 'usage error',\n})\n\n/**\n * The machine-readable code a malformed command line reports.\n *\n * @remarks\n * The executable contributes its own codes to the failure envelope, which is why\n * that envelope's `code` is a plain string rather than a `ScaffoldErrorCode`: a\n * command line that never became a command failed before any coded package\n * operation could.\n */\nexport const USAGE_CODE = 'USAGE'\n\n/** The machine-readable code a failure carrying no code of its own reports. */\nexport const FAILED_CODE = 'FAILED'\n\n/** What the failure envelope says when the raised value carried no message. */\nexport const FAILED_MESSAGE = 'The command failed for an unrecognized reason'\n\n/**\n * The positional argument `new` alone takes, as usage writes it.\n *\n * @remarks\n * The workspace name is the only positional argument any verb takes, so it is\n * one value rather than a per-verb table with holes in it.\n */\nexport const NAME_ARGUMENT = '<name>'\n\n/**\n * Every option the executable accepts, as `node:util` parses them, frozen.\n *\n * @remarks\n * One table for every verb rather than one per verb, because the verb an option\n * belongs to is a domain fact the command union already fixes: parsing decides\n * only whether the word is an option at all, and {@link VERB_OPTIONS} decides\n * whether this verb takes it. No option declares a default, so the parsed keys\n * are exactly the options the caller supplied, which is what makes an option\n * offered to the wrong verb visible rather than silently absorbed. `from`\n * collects repeats because `catalog` may draw on more than one local source; a\n * verb that takes it once refuses the second.\n */\nexport const COMMAND_OPTIONS: ParseArgsOptionsConfig = Object.freeze({\n\tsrc: Object.freeze({ type: 'string' }),\n\tapp: Object.freeze({ type: 'string' }),\n\tbin: Object.freeze({ type: 'boolean' }),\n\tdeps: Object.freeze({ type: 'string' }),\n\tgroups: Object.freeze({ type: 'string' }),\n\tall: Object.freeze({ type: 'boolean' }),\n\tdirty: Object.freeze({ type: 'boolean' }),\n\toffline: Object.freeze({ type: 'boolean' }),\n\tfrom: Object.freeze({ type: 'string', multiple: true }),\n\ttarget: Object.freeze({ type: 'string' }),\n\tjson: Object.freeze({ type: 'boolean' }),\n})\n\n/**\n * What each option does, keyed by the token usage prints, frozen.\n *\n * @remarks\n * The key order is the glossary order. A key is the whole displayed token,\n * value placeholder included, because that token is what a reader copies and\n * what {@link VERB_OPTIONS} lists.\n */\nexport const OPTION_SUMMARY: Readonly<Record<string, string>> = Object.freeze({\n\t'--src <list>': 'the published library environments to build: core, browser, server',\n\t'--app <list>': 'the private application environments to build: core, browser, server',\n\t'--bin': 'scaffold a command-line executable at src/bin/main.ts',\n\t'--deps <list>': 'the @orkestrel/* packages the workspace depends on',\n\t'--groups <list>': 'the artifact groups to cover; every group when absent',\n\t'--all':\n\t\t'fetch a guide for every package the organization publishes, not the declared ones alone',\n\t'--dirty': 'delete from a tree carrying uncommitted changes',\n\t'--offline': 'use the distributed dependency and vendored-host floors without reading upstream',\n\t'--from <path>':\n\t\t'read the data root from a local path instead of the bundled one; catalog alone accepts it more than once',\n\t'--target <path>': 'the directory the verb operates on; the working directory when absent',\n\t'--json': 'emit one machine-readable value instead of a report',\n\tORKESTREL_SCAFFOLD_REGISTRY: 'the registry base mapped to upstream.registry.base',\n\tORKESTREL_SCAFFOLD_REPOSITORY: 'the repository base mapped to upstream.repository.base',\n})\n\n/**\n * The options each verb takes, in usage order, frozen.\n *\n * @remarks\n * The executable's half of the frozen command union: every option a branch\n * declares is listed against its verb, and every option a branch excludes is\n * absent from it. An option a verb does not list is refused by name rather than\n * parsed and ignored.\n */\nexport const VERB_OPTIONS: Readonly<Record<Verb, readonly string[]>> = Object.freeze({\n\tnew: Object.freeze([\n\t\t'--src <list>',\n\t\t'--app <list>',\n\t\t'--bin',\n\t\t'--deps <list>',\n\t\t'--offline',\n\t\t'--from <path>',\n\t\t'--target <path>',\n\t\t'--json',\n\t]),\n\taudit: Object.freeze([\n\t\t'--groups <list>',\n\t\t'--offline',\n\t\t'--from <path>',\n\t\t'--target <path>',\n\t\t'--json',\n\t]),\n\trepair: Object.freeze([\n\t\t'--groups <list>',\n\t\t'--offline',\n\t\t'--from <path>',\n\t\t'--target <path>',\n\t\t'--json',\n\t]),\n\tcatalog: Object.freeze(['--all', '--from <path>', '--target <path>', '--json']),\n\toverwrite: Object.freeze([\n\t\t'--groups <list>',\n\t\t'--dirty',\n\t\t'--offline',\n\t\t'--from <path>',\n\t\t'--target <path>',\n\t\t'--json',\n\t]),\n})\n\n/**\n * What each verb does, in one line, frozen.\n *\n * @remarks\n * Each line names what the verb writes, because authority is the verb's: a\n * reader deciding which one to run is deciding what they are authorizing.\n */\nexport const VERB_SUMMARY: Readonly<Record<Verb, string>> = Object.freeze({\n\tnew: 'scaffold a workspace',\n\taudit: 'report how the target compares to its plan, writing nothing',\n\trepair: 'write each planned path the target is missing or has let drift',\n\tcatalog: 'regenerate the package table and refresh the guide mirrors',\n\toverwrite:\n\t\t'do everything repair and catalog do, then delete what the plan does not own and re-declare the dependency ranges',\n})\n","import { USAGE_CODE } from './constants.js'\n\n/**\n * The error raised when a command line is not a command.\n *\n * @remarks\n * Distinct from `ScaffoldError` because they answer different questions and\n * exit differently: a `ScaffoldError` says the package could not serve a\n * well-formed request and exits `1`, while this says there was no request to\n * serve and exits `2`. Folding a usage error into `INVALID` would report a\n * mistyped flag as a failed run.\n *\n * It carries no `context`. Everything a caller can act on is in the message,\n * because the reader of a usage error is a person at a terminal rather than a\n * program branching on a cause.\n *\n * @example\n * ```ts\n * import { isUsageError, UsageError } from './errors.js'\n *\n * try {\n * \tthrow new UsageError(\"Unknown command 'pull'.\")\n * } catch (error) {\n * \tif (isUsageError(error)) error.code // 'USAGE'\n * }\n * ```\n */\nexport class UsageError extends Error {\n\treadonly code: string\n\n\t/**\n\t * Construct a usage error.\n\t *\n\t * @param message - What was wrong with the command line, in one sentence.\n\t */\n\tconstructor(message: string) {\n\t\tsuper(message)\n\t\tthis.name = 'UsageError'\n\t\tthis.code = USAGE_CODE\n\t}\n}\n\n/**\n * Narrow a caught value to a {@link UsageError}.\n *\n * @param value - The caught value to narrow.\n * @returns `true` when `value` is a {@link UsageError}.\n *\n * @example\n * ```ts\n * import { isUsageError } from './errors.js'\n *\n * isUsageError(new Error('plain')) // false\n * isUsageError(undefined) // false\n * ```\n */\nexport function isUsageError(value: unknown): value is UsageError {\n\treturn value instanceof UsageError\n}\n","import type { Audit, Blueprint, Dependency, Question, Release } from '@src/core'\nimport type { CLICommand, ErrorEnvelope, Verb } from './types.js'\nimport type { UpstreamOptions } from '@src/server'\nimport { align, width } from '@orkestrel/console'\nimport { attempt, isRecord, isString, parseJSON } from '@orkestrel/contract'\nimport {\n\tblueprintToDevDependencies,\n\tcompareVersions,\n\textractRangeMajor,\n\textractVersion,\n\tisScaffoldError,\n\tmanifestToDependencies,\n} from '@src/core'\nimport { parseArgs } from 'node:util'\nimport {\n\tCOMMAND_OPTIONS,\n\tEXECUTABLE_NAME,\n\tEXIT_CLEAN,\n\tEXIT_DRIFT,\n\tEXIT_SUMMARY,\n\tFAILED_CODE,\n\tFAILED_MESSAGE,\n\tNAME_ARGUMENT,\n\tOPTION_SUMMARY,\n\tVERB_OPTIONS,\n\tVERB_SUMMARY,\n\tVERBS,\n} from './constants.js'\nimport { isUsageError, UsageError } from './errors.js'\n\n/**\n * Read the option name out of the token usage displays it as.\n *\n * @param option - The displayed token, such as `--from <path>`.\n * @returns The bare name `node:util` parses the option under.\n *\n * @remarks\n * One token serves both readers: a person reads the value placeholder and the\n * parser reads the name in front of it. Deriving the name means a documented\n * option and an accepted option cannot be separate lists.\n *\n * @example\n * ```ts\n * import { optionToName } from './helpers.js'\n *\n * optionToName('--from <path>') // 'from'\n * optionToName('--json') // 'json'\n * ```\n */\nexport function optionToName(option: string): string {\n\tconst [token = option] = option.split(' ')\n\treturn token.startsWith('--') ? token.slice(2) : token\n}\n\n/**\n * Project process environment endpoints into upstream reader options.\n *\n * @param environment - The process environment to read.\n * @returns The configured endpoint groups, or `undefined` when neither endpoint\n * is configured.\n */\nexport function environmentToUpstream(\n\tenvironment: Readonly<Record<string, string | undefined>>,\n): UpstreamOptions | undefined {\n\tconst registry = environment.ORKESTREL_SCAFFOLD_REGISTRY\n\tconst repository = environment.ORKESTREL_SCAFFOLD_REPOSITORY\n\tif (registry === undefined && repository === undefined) return undefined\n\treturn {\n\t\t...(registry === undefined ? {} : { registry: { base: registry } }),\n\t\t...(repository === undefined ? {} : { repository: { base: repository } }),\n\t}\n}\n\n/**\n * Render one verb's synopsis.\n *\n * @param verb - The verb to describe.\n * @returns The command line this verb accepts, with every option bracketed.\n *\n * @remarks\n * The synopsis is derived from the verb's own option list rather than stored\n * beside it, so a line that documents an option the verb does not take cannot be\n * written. `new` alone carries the positional argument.\n *\n * @example\n * ```ts\n * import { verbToSyntax } from './helpers.js'\n *\n * verbToSyntax('audit') // 'scaffold audit [--groups <list>] …'\n * ```\n */\nexport function verbToSyntax(verb: Verb): string {\n\tconst argument = verb === 'new' ? ` ${NAME_ARGUMENT}` : ''\n\tconst options = VERB_OPTIONS[verb].map((option) => `[${option}]`).join(' ')\n\treturn `${EXECUTABLE_NAME} ${verb}${argument} ${options}`\n}\n\n/**\n * Render the whole command reference.\n *\n * @returns One line per output call: the synopsis, every verb, the option glossary, and the exit codes.\n *\n * @remarks\n * Returned as lines because the executable writes through a handler that takes\n * one line, so the caller never has to split a block back apart. The glossary is\n * printed once for every verb rather than repeated per verb, because\n * `--from <path>`, `--target <path>`, and `--json` are shared by every verb and\n * a reader comparing two verbs wants the difference, not the repetition.\n */\nexport function renderUsage(): readonly string[] {\n\tconst summaries = Object.entries(OPTION_SUMMARY)\n\tconst column = Math.max(...summaries.map(([option]) => width(option)))\n\treturn [\n\t\t`${EXECUTABLE_NAME} <verb> [options]`,\n\t\t'',\n\t\t...VERBS.flatMap((verb) => [` ${verbToSyntax(verb)}`, ` ${VERB_SUMMARY[verb]}`]),\n\t\t'',\n\t\t'options',\n\t\t...summaries.map(([option, summary]) => ` ${align(option, column)} ${summary}`),\n\t\t'',\n\t\t'exit codes',\n\t\t...Object.entries(EXIT_SUMMARY).map(([code, meaning]) => ` ${code} ${meaning}`),\n\t]\n}\n\n/**\n * Read one command out of the arguments following the executable's own name.\n *\n * @param argv - The arguments the executable was given.\n * @returns The command the arguments denote.\n * @throws {@link UsageError} when they denote no command.\n *\n * @remarks\n * The one place untrusted argument text becomes a domain value, and it stays one\n * function because the command union admits no partial command to hand on: every\n * refusal has to happen before the value exists. It refuses in these ways, each\n * naming what was wrong — a word that is not a verb, a word that is not an\n * option, an option this verb does not take, and an argument this verb does not\n * take. `node:util` decides the unknown option and this decides the rest, so an unknown\n * option is reported by the parser that found it rather than re-derived here.\n *\n * A request for usage is not a command and never reaches this: the caller\n * answers it first.\n *\n * @example\n * ```ts\n * import { argvToCommand } from './helpers.js'\n *\n * argvToCommand(['audit', '--json']) // { verb: 'audit', json: true }\n * ```\n */\nexport function argvToCommand(argv: readonly string[]): CLICommand {\n\tconst [head, ...rest] = argv\n\tconst verb = VERBS.find((candidate) => candidate === head)\n\tif (verb === undefined) {\n\t\tconst found = head === undefined ? 'No command given.' : `Unknown command '${head}'.`\n\t\tthrow new UsageError(`${found} Run '${EXECUTABLE_NAME} --help' for the command list.`)\n\t}\n\tconst parsed = attempt(() =>\n\t\tparseArgs({ args: rest, options: COMMAND_OPTIONS, allowPositionals: true, strict: true }),\n\t)\n\tif (!parsed.success) {\n\t\tconst cause = parsed.error\n\t\tthrow new UsageError(\n\t\t\tcause instanceof Error ? cause.message : `Could not read the arguments to '${verb}'.`,\n\t\t)\n\t}\n\tconst { positionals, values } = parsed.value\n\tconst accepted = VERB_OPTIONS[verb].map((option) => optionToName(option))\n\tconst refused = Object.keys(values).filter((name) => !accepted.includes(name))\n\tif (refused.length > 0) {\n\t\tconst names = refused.map((name) => `--${name}`).join(', ')\n\t\tthrow new UsageError(`'${verb}' does not take ${names}.`)\n\t}\n\tconst [name] = positionals\n\tif (positionals.length > 1) {\n\t\tthrow new UsageError(\n\t\t\t`'${verb}' takes at most one argument, and was given ${String(positionals.length)}.`,\n\t\t)\n\t}\n\tif (verb !== 'new' && name !== undefined) {\n\t\tthrow new UsageError(`'${verb}' takes no argument, and was given '${name}'.`)\n\t}\n\tconst paths = Array.isArray(values.from)\n\t\t? values.from.filter((value) => typeof value === 'string')\n\t\t: []\n\tif (verb !== 'catalog' && paths.length > 1) {\n\t\tthrow new UsageError(\n\t\t\t`'${verb}' takes --from once, and was given it ${String(paths.length)} times.`,\n\t\t)\n\t}\n\tconst src = typeof values.src === 'string' ? values.src : undefined\n\tconst app = typeof values.app === 'string' ? values.app : undefined\n\tconst bin = values.bin === true\n\tconst offline = values.offline === true\n\tconst dependencies = typeof values.deps === 'string' ? values.deps : undefined\n\tconst target = typeof values.target === 'string' ? values.target : undefined\n\tconst json = values.json === true\n\tconst [from] = paths\n\tconst location = target === undefined ? {} : { target }\n\tconst source = from === undefined ? {} : { from }\n\tconst selection = typeof values.groups === 'string' ? { groups: values.groups } : {}\n\tswitch (verb) {\n\t\tcase 'new':\n\t\t\tif (name === undefined) {\n\t\t\t\tthrow new UsageError(`'new' needs the workspace ${NAME_ARGUMENT} it is scaffolding.`)\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tverb,\n\t\t\t\tname,\n\t\t\t\tjson,\n\t\t\t\t...location,\n\t\t\t\t...source,\n\t\t\t\t...(src === undefined ? {} : { src }),\n\t\t\t\t...(app === undefined ? {} : { app }),\n\t\t\t\t...(bin ? { bin } : {}),\n\t\t\t\t...(offline ? { offline } : {}),\n\t\t\t\t...(dependencies === undefined ? {} : { dependencies }),\n\t\t\t}\n\t\tcase 'audit':\n\t\t\treturn { verb, json, ...location, ...source, ...selection, ...(offline ? { offline } : {}) }\n\t\tcase 'repair':\n\t\t\treturn { verb, json, ...location, ...source, ...selection, ...(offline ? { offline } : {}) }\n\t\tcase 'catalog':\n\t\t\treturn {\n\t\t\t\tverb,\n\t\t\t\tjson,\n\t\t\t\tall: values.all === true,\n\t\t\t\t...location,\n\t\t\t\t...(paths.length === 0 ? {} : { from: paths }),\n\t\t\t}\n\t\tcase 'overwrite':\n\t\t\treturn {\n\t\t\t\tverb,\n\t\t\t\tjson,\n\t\t\t\tdirty: values.dirty === true,\n\t\t\t\t...(offline ? { offline } : {}),\n\t\t\t\t...location,\n\t\t\t\t...source,\n\t\t\t\t...selection,\n\t\t\t}\n\t}\n}\n\n/**\n * Read the exit code an audit reports.\n *\n * @param audit - The comparison of a plan against a target.\n * @returns `EXIT_CLEAN` when the target matched the plan, `EXIT_DRIFT` otherwise.\n *\n * @remarks\n * One rule for every verb that carries an audit, so `audit`, `repair`, and\n * `overwrite` cannot disagree about what a clean run is. A blocking question\n * means the gate refused the blueprint, so the audit says nothing about the\n * target and the run is a failure. A foreign finding counts: the target holds a\n * file the plan does not own, which is a difference from the plan whether or not\n * this verb was allowed to remove it. A non-blocking question rides a complete\n * result and does not.\n *\n * @example\n * ```ts\n * import { auditToExit } from './helpers.js'\n *\n * auditToExit({ findings: [], questions: [] }) // 0\n * ```\n */\nexport function auditToExit(audit: Audit): number {\n\tconst blocked = audit.questions.some((question) => question.blocking)\n\tconst drifted = audit.findings.some((finding) => finding.drift !== 'aligned')\n\treturn blocked || drifted ? EXIT_DRIFT : EXIT_CLEAN\n}\n\n/**\n * Read the fleet rows and planned foreign tools a target manifest declares.\n *\n * @param manifest - The target manifest text.\n * @param blueprint - The workspace shape that supplies the planned tool set.\n * @returns The declared fleet rows followed by declared planned foreign rows.\n */\nexport function manifestToPlannedDependencies(\n\tmanifest: string,\n\tblueprint: Blueprint,\n): readonly Dependency[] {\n\tconst dependencies = [...dependenciesToFleet(manifestToDependencies(manifest))]\n\tconst parsed = parseJSON(manifest)\n\tif (!isRecord(parsed)) return dependencies\n\tconst runtime = isRecord(parsed.dependencies) ? parsed.dependencies : {}\n\tconst development = isRecord(parsed.devDependencies) ? parsed.devDependencies : {}\n\tfor (const name of Object.keys(blueprintToDevDependencies(blueprint)).sort()) {\n\t\tif (name.startsWith('@orkestrel/')) continue\n\t\tconst range = runtime[name] ?? development[name]\n\t\tif (isString(range)) dependencies.push({ name, range })\n\t}\n\treturn dependencies\n}\n\n/**\n * Keep only dependencies published by the Orkestrel fleet.\n *\n * @param dependencies - The declared dependencies to inspect.\n * @returns The fleet declarations in their original order.\n */\nexport function dependenciesToFleet(dependencies: readonly Dependency[]): readonly Dependency[] {\n\treturn dependencies.filter((dependency) => dependency.name.startsWith('@orkestrel/'))\n}\n\n/**\n * Project declared concrete ranges to their distributed release floors.\n *\n * @param dependencies - The declarations whose floor versions to read.\n * @returns One found floor per declaration, or `undefined` when any range names\n * no concrete version.\n */\nexport function dependenciesToFloors(\n\tdependencies: readonly Dependency[],\n): readonly Release[] | undefined {\n\tconst releases: Release[] = []\n\tfor (const dependency of dependencies) {\n\t\tconst version =\n\t\t\tdependency.range.startsWith('^') || dependency.range.startsWith('~')\n\t\t\t\t? dependency.range.slice(1)\n\t\t\t\t: dependency.range\n\t\tif (extractVersion(version) === undefined) return undefined\n\t\treleases.push({ ...dependency, lookup: 'found', latest: version })\n\t}\n\treturn releases\n}\n\n/**\n * Read the exit code registry release evidence earns.\n *\n * @param releases - The release verdicts to measure.\n * @returns `EXIT_DRIFT` for a failed lookup or an exact fleet mismatch; `EXIT_CLEAN` otherwise.\n */\nexport function releasesToExit(releases: readonly Release[]): number {\n\treturn releases.some(\n\t\t(release) =>\n\t\t\trelease.lookup !== 'found' ||\n\t\t\t(release.name.startsWith('@orkestrel/') && release.range !== `^${release.latest}`),\n\t)\n\t\t? EXIT_DRIFT\n\t\t: EXIT_CLEAN\n}\n\n/**\n * Project foreign floor and supported-major drift into audit questions.\n *\n * @param releases - The release verdicts to measure.\n * @param served - Alternate release verdicts used to detect a newer served major.\n * @returns One non-blocking question for each stale floor and each crossed major.\n */\nexport function releasesToQuestions(\n\treleases: readonly Release[],\n\tserved: readonly Release[] = releases,\n): readonly Question[] {\n\tconst questions: Question[] = []\n\tfor (const release of releases) {\n\t\tif (release.name.startsWith('@orkestrel/')) continue\n\t\tconst declared = extractRangeMajor(release.range)\n\t\tconst current = release.lookup === 'found' ? release.latest : undefined\n\t\tconst resolved = current === undefined ? undefined : extractVersion(current)\n\t\tconst floor = extractVersion(\n\t\t\trelease.range.startsWith('^') || release.range.startsWith('~')\n\t\t\t\t? release.range.slice(1)\n\t\t\t\t: release.range,\n\t\t)\n\t\tif (\n\t\t\tdeclared !== undefined &&\n\t\t\tcurrent !== undefined &&\n\t\t\tresolved !== undefined &&\n\t\t\tfloor !== undefined &&\n\t\t\tresolved[0] === declared &&\n\t\t\tcompareVersions(current, floor.join('.')) > 0\n\t\t) {\n\t\t\tquestions.push({\n\t\t\t\tfield: 'dependencies',\n\t\t\t\tmessage: `${release.name} declares the floor ${release.range}, while the registry serves ${current} within major ${String(declared)}.`,\n\t\t\t\tblocking: false,\n\t\t\t})\n\t\t}\n\t\tconst alternate = served.find((candidate) => candidate.name === release.name)\n\t\tconst published =\n\t\t\trelease.major ??\n\t\t\t(alternate?.lookup === 'found' ? extractVersion(alternate.latest)?.[0] : undefined)\n\t\tif (declared !== undefined && published !== undefined && declared < published) {\n\t\t\tquestions.push({\n\t\t\t\tfield: 'dependencies',\n\t\t\t\tmessage: `${release.name} declares major ${String(declared)}, while the registry serves major ${String(published)}.`,\n\t\t\t\tblocking: false,\n\t\t\t})\n\t\t}\n\t}\n\treturn questions\n}\n\n/**\n * Project an audit into the human summary of its outcome.\n *\n * @param audit - The comparison to summarize.\n * @returns The refusal, or the planned-path outcome, its grounds, and any foreign-path count.\n *\n * @remarks\n * A blocking question means the gate produced no plan, so the target was not\n * compared and no finding count is reported. Otherwise the grounds\n * describe what this run did. `bytes` means content-owned\n * bytes were observed, `existence` means presence or absence alone decided the\n * finding, and `nothing` means a birth-owned path was not examined. Foreign\n * paths remain a separate population because no planned ownership accounts for\n * them.\n *\n * @example\n * ```ts\n * import { auditToSummary } from './helpers.js'\n *\n * auditToSummary({\n * findings: [],\n * questions: [{ field: 'src', message: 'Core is required.', blocking: true }],\n * })\n * // 'Audit did not compare the target because the blueprint was refused.'\n * ```\n */\nexport function auditToSummary(audit: Audit): string {\n\tif (audit.questions.some((question) => question.blocking)) {\n\t\treturn 'Audit did not compare the target because the blueprint was refused.'\n\t}\n\tconst planned = audit.findings.filter((finding) => finding.drift !== 'foreign')\n\tconst drifted = planned.filter((finding) => finding.drift !== 'aligned').length\n\t// These counts say what decided each verdict on this run. They partition the\n\t// planned findings, so they sum to `planned.length` and never to `drifted`.\n\tconst bytes = planned.filter(\n\t\t(finding) => finding.ownership === 'content' && finding.observed !== undefined,\n\t).length\n\tconst existence = planned.filter(\n\t\t(finding) =>\n\t\t\tfinding.ownership === 'presence' ||\n\t\t\t(finding.ownership === 'content' && finding.drift === 'missing'),\n\t).length\n\tconst nothing = planned.filter((finding) => finding.ownership === 'birth').length\n\tconst foreign = audit.findings.length - planned.length\n\tconst summary = `${String(drifted)} of ${String(planned.length)} planned path${planned.length === 1 ? '' : 's'} drifted from the plan. Audit compared bytes at ${String(bytes)}, existence at ${String(existence)}, and nothing at ${String(nothing)}.`\n\treturn foreign === 0\n\t\t? summary\n\t\t: `${summary} The plan does not own ${String(foreign)} further path${foreign === 1 ? '' : 's'} beneath its groups.`\n}\n\n/**\n * Project a raised value into the machine-readable failure envelope.\n *\n * @param error - The value a command raised.\n * @returns The envelope naming the coded reason and what went wrong.\n *\n * @remarks\n * A `ScaffoldError` and a {@link UsageError} both publish a code, so both are\n * reported under their own. Anything else failed without saying why, and is\n * reported under one code rather than under an invented reading of it; a raised\n * value that is not an `Error` carries no message worth quoting, so the envelope\n * says so instead of stringifying whatever it was.\n *\n * @example\n * ```ts\n * import { errorToEnvelope } from './helpers.js'\n *\n * errorToEnvelope(new Error('boom')) // { error: { code: 'FAILED', message: 'boom' } }\n * ```\n */\nexport function errorToEnvelope(error: unknown): ErrorEnvelope {\n\tif (isUsageError(error) || isScaffoldError(error)) {\n\t\treturn { error: { code: error.code, message: error.message } }\n\t}\n\tconst message = error instanceof Error ? error.message : FAILED_MESSAGE\n\treturn { error: { code: FAILED_CODE, message } }\n}\n","import type {\n\tAudit,\n\tBlueprint,\n\tCatalogEntry,\n\tDependency,\n\tEnvironment,\n\tGroup,\n\tMirror,\n\tPlan,\n\tQuestion,\n\tRelease,\n} from '@src/core'\nimport type {\n\tMaterializeResult,\n\tMaterializerInterface,\n\tWorktree,\n\tUpstreamOptions,\n} from '@src/server'\nimport type {\n\tAuditCommand,\n\tAuditResult,\n\tBaseline,\n\tCatalogCommand,\n\tCatalogResult,\n\tCLICommand,\n\tCLIInterface,\n\tCLIOptions,\n\tHostResolution,\n\tNewCommand,\n\tNewResult,\n\tOutputHandler,\n\tOverwriteCommand,\n\tOverwriteResult,\n\tProvenance,\n\tRepairCommand,\n\tRepairResult,\n\tVersionResolution,\n} from './types.js'\nimport { renderTable, strip, stripControls } from '@orkestrel/console'\nimport { attempt, isRecord, isString, parseJSON } from '@orkestrel/contract'\nimport { createMarkdown, flattenText, isTableNode } from '@orkestrel/markdown'\nimport { executeSync } from '@orkestrel/process/server'\nimport {\n\tCATALOG_AGENT_PATH,\n\tBIN_ENTRY_PATH,\n\tblueprintToDevDependencies,\n\tblueprintToRootVite,\n\tblueprintToScripts,\n\tCONFORMANCE_TEST_PATH,\n\tDISTRIBUTION_TEST_PATH,\n\tcreateBlueprint,\n\tCompiler,\n\tDEPENDENCY_NAME_PATTERN,\n\tENVIRONMENTS,\n\textractRangeMajor,\n\tGROUPS,\n\tGLOBAL_SETUP_PATH,\n\tGUIDES_TEST_PATH,\n\tINTEGRATION_TEST_PATH,\n\tisDeferredPath,\n\tmanifestToDependencies,\n\tmanifestToName,\n\tMAX_MANIFEST_BYTES,\n\tnameToGuide,\n\treplacePlanRanges,\n\tScaffoldError,\n\tSERVICE_SETUP_PATH,\n\tSHOWCASE_CONFIG_PATH,\n} from '@src/core'\nimport {\n\tMaterializer,\n\tUpstream,\n\tfilesToHost,\n\tisExactCaseFile,\n\tisPhysicalDirectory,\n\tisWorktree,\n\tlistFiles,\n\treadFileText,\n\treadHostFloor,\n\treadSnapshot,\n\tresolveContainedPath,\n} from '@src/server'\nimport { EXIT_CLEAN, EXIT_DRIFT, EXIT_USAGE } from './constants.js'\nimport { isUsageError, UsageError } from './errors.js'\nimport {\n\targvToCommand,\n\tauditToExit,\n\tauditToSummary,\n\tdependenciesToFloors,\n\tdependenciesToFleet,\n\terrorToEnvelope,\n\tmanifestToPlannedDependencies,\n\treleasesToExit,\n\treleasesToQuestions,\n\trenderUsage,\n} from './helpers.js'\n\n/**\n * The executable: one command line in, one exit code out.\n *\n * @remarks\n * Every destination this class writes to is a handler it was given, and the run\n * ends by returning its code rather than by setting one, so the whole executable\n * is drivable from inside another process. That is what makes proving what a\n * command prints cost a function call: `src/bin/main.ts` is the only module\n * that reads `process.argv` or assigns `process.exitCode`.\n *\n * Every line leaving here is stripped of ANSI escapes and control characters\n * once, on the way out, because a refusal quotes the argument that caused it and\n * that argument came from an untrusted command line. The machine-readable path\n * needs no second pass: `JSON.stringify` escapes a control character into text\n * before it reaches the handler.\n *\n * The collaborators are constructed per run rather than received, because\n * `--from` decides the vendored root the materializer reads and an instance\n * handed in before the command line was parsed could not honour it. The\n * upstream reader is built the same way but from the options, because no\n * command line names an endpoint: a terminal caller means the published\n * registry and the published guide host, and only the process driving the\n * executable can mean anything else. That is the seam that makes the verbs\n * which read the network provable without one.\n *\n * @example\n * ```ts\n * import { CLI } from './CLI.js'\n *\n * const lines: string[] = []\n * const code = await new CLI({ output: (line) => lines.push(line) }).execute(['--help'])\n * code // 0\n * ```\n */\nexport class CLI implements CLIInterface {\n\t// The destinations a terminal caller means. They are the only process\n\t// streams this class names, and it names them once: a handler is what every\n\t// write goes through, so the default is a handler too rather than a branch at\n\t// each write site.\n\tstatic readonly #stdout: OutputHandler = (line) => void process.stdout.write(`${line}\\n`)\n\tstatic readonly #stderr: OutputHandler = (line) => void process.stderr.write(`${line}\\n`)\n\treadonly #output: OutputHandler\n\treadonly #diagnostic: OutputHandler\n\t// What every upstream reader this class builds is constructed from. It is held\n\t// once and read by each verb that reads the network, so they\n\t// cannot disagree about which registry and which guide host a run addresses.\n\treadonly #upstream: UpstreamOptions | undefined\n\n\t/**\n\t * Construct the executable over the destinations it writes to.\n\t *\n\t * @param options - The report and diagnostic handlers and the upstream\n\t * endpoints; the process streams and the published endpoints when absent.\n\t */\n\tconstructor(options?: CLIOptions) {\n\t\tthis.#output = options?.output ?? CLI.#stdout\n\t\tthis.#diagnostic = options?.diagnostic ?? CLI.#stderr\n\t\tthis.#upstream = options?.upstream\n\t}\n\n\t/**\n\t * Run one command line to completion and report through the configured output.\n\t *\n\t * @param argv - The arguments following the executable's own name.\n\t * @returns The exit code: `0` clean, `1` drift or failure, `2` a usage error.\n\t *\n\t * @remarks\n\t * A request for usage is answered before anything is parsed, because it\n\t * replaces the run rather than modifying it, and because `--help` is not an\n\t * option any verb takes. Everything after that is one command: read it,\n\t * dispatch it, render what it produced, and answer with the code it earned.\n\t *\n\t * @example\n\t * ```ts\n\t * import { CLI } from './CLI.js'\n\t *\n\t * await new CLI().execute(['audit', '--json']) // 0 when the target matches its plan\n\t * ```\n\t */\n\tasync execute(argv: readonly string[]): Promise<number> {\n\t\tif (argv.includes('--help')) {\n\t\t\tfor (const line of renderUsage()) this.#say(line)\n\t\t\treturn EXIT_CLEAN\n\t\t}\n\t\tconst read = attempt(() => argvToCommand(argv))\n\t\t// A command line that never became a command is refused in prose even when\n\t\t// the line carries `--json`, because the flag is read from the command and\n\t\t// no command was read: there is no machine-readable value for it to pollute.\n\t\tif (!read.success) return this.#refuse(read.error, false)\n\t\tconst command = read.value\n\t\ttry {\n\t\t\treturn await this.#dispatch(command)\n\t\t} catch (error) {\n\t\t\treturn this.#refuse(error, command.json === true)\n\t\t}\n\t}\n\n\t// One verb per branch, each answering with its own exit code. The switch is\n\t// exhaustive over the command union, so a new verb fails to compile here.\n\tasync #dispatch(command: CLICommand): Promise<number> {\n\t\tswitch (command.verb) {\n\t\t\tcase 'new':\n\t\t\t\treturn this.#create(command)\n\t\t\tcase 'audit':\n\t\t\t\treturn this.#inspect(command)\n\t\t\tcase 'repair':\n\t\t\t\treturn this.#restore(command)\n\t\t\tcase 'catalog':\n\t\t\t\treturn this.#refresh(command)\n\t\t\tcase 'overwrite':\n\t\t\t\treturn this.#replace(command)\n\t\t}\n\t}\n\n\t// `new` — resolve the declared dependencies against the registry, compile the\n\t// blueprint the command line describes, and write it into a vacant target.\n\tasync #create(command: NewCommand): Promise<number> {\n\t\tconst target = command.target ?? command.name\n\t\tconst blueprint = createBlueprint(command.name, {\n\t\t\tsrc: this.#environments(command.src, 'src'),\n\t\t\tapp: this.#environments(command.app, 'app'),\n\t\t\tbin: command.bin === true,\n\t\t\tsetup: false,\n\t\t\tdependencies: this.#packages(command.dependencies).map((name) => ({\n\t\t\t\tname,\n\t\t\t\trange: '^0.0.0',\n\t\t\t})),\n\t\t})\n\t\tconst plan = this.#compile(blueprint)\n\t\tconst manifest = plan.artifacts.find(\n\t\t\t(artifact) => artifact.path === 'package.json' && artifact.origin !== 'host',\n\t\t)\n\t\tif (manifest === undefined || manifest.origin === 'host') {\n\t\t\tthrow new ScaffoldError('BLOCKED', 'The compiled plan carries no replaceable manifest.')\n\t\t}\n\t\tconst versions = await this.#versions(\n\t\t\tdependenciesToFleet(manifestToDependencies(manifest.content)),\n\t\t\tcommand.offline === true,\n\t\t)\n\t\tthis.#assertVersions(versions)\n\t\tconst resolved = replacePlanRanges(plan, versions.pins)\n\t\tif (resolved === undefined) {\n\t\t\tthrow new ScaffoldError('BLOCKED', 'The compiled plan ranges could not be replaced.')\n\t\t}\n\t\tconst host = await this.#host(command.from, undefined, command.offline === true)\n\t\ttry {\n\t\t\tconst result = host.materializer.materialize(resolved, target)\n\t\t\tconst outcome: NewResult = {\n\t\t\t\t...result,\n\t\t\t\tprovenance: {\n\t\t\t\t\t...(versions.baseline === undefined ? {} : { versions: versions.baseline }),\n\t\t\t\t\t...(host.baseline === undefined ? {} : { host: host.baseline }),\n\t\t\t\t},\n\t\t\t}\n\t\t\tif (command.json === true) this.#report(outcome)\n\t\t\telse {\n\t\t\t\tthis.#say(`Scaffolded ${blueprint.name} into ${result.target}.`)\n\t\t\t\tthis.#say(this.#tally(result))\n\t\t\t}\n\t\t\tif (versions.forced || host.forced) this.#reportBaselines(outcome.provenance)\n\t\t\treturn EXIT_CLEAN\n\t\t} finally {\n\t\t\thost.materializer.destroy()\n\t\t}\n\t}\n\n\t// `audit` — compare a target to the plan its own manifest and directories\n\t// describe, through the vendored host a repair would write from, and write\n\t// nothing whatever it finds.\n\t//\n\t// The host is load-bearing here where it once was not, so `--from` reaches the\n\t// comparison and a host that cannot be read refuses the run under its own\n\t// coded reason. Refusing is the honest answer: the comparison this verb\n\t// reports is the hydrated one, and a fallback to the pure compile would report\n\t// `aligned` for exactly the files whose bytes it failed to read.\n\tasync #inspect(command: AuditCommand): Promise<number> {\n\t\tconst target = command.target ?? '.'\n\t\tconst manifest = this.#manifest(target)\n\t\tconst blueprint = this.#derive(target)\n\t\tconst groups = this.#groups(command.groups)\n\t\tconst declared = manifestToPlannedDependencies(manifest, blueprint)\n\t\tconst versions = await this.#versions(declared, command.offline === true)\n\t\tconst questions = [\n\t\t\t...this.#targetQuestions(target, blueprint),\n\t\t\t...releasesToQuestions(versions.releases),\n\t\t]\n\t\tconst host = await this.#host(command.from, target, command.offline === true)\n\t\ttry {\n\t\t\tconst [measured] = this.#survey(host.materializer, blueprint, target, groups)\n\t\t\tconst audit: Audit =\n\t\t\t\tquestions.length === 0\n\t\t\t\t\t? measured\n\t\t\t\t\t: { ...measured, questions: [...measured.questions, ...questions] }\n\t\t\tconst outcome: AuditResult = {\n\t\t\t\t...audit,\n\t\t\t\treleases: versions.releases,\n\t\t\t\tprovenance: {\n\t\t\t\t\t...(versions.baseline === undefined ? {} : { versions: versions.baseline }),\n\t\t\t\t\t...(host.baseline === undefined ? {} : { host: host.baseline }),\n\t\t\t\t},\n\t\t\t}\n\t\t\tif (command.json === true) this.#report(outcome)\n\t\t\telse {\n\t\t\t\tthis.#present(audit)\n\t\t\t\tif (command.offline !== true) this.#reportReleases(versions.releases)\n\t\t\t}\n\t\t\tif (versions.forced || host.forced) this.#reportBaselines(outcome.provenance)\n\t\t\tif (command.offline === true) return auditToExit(audit)\n\t\t\treturn Math.max(\n\t\t\t\tauditToExit(audit),\n\t\t\t\treleasesToExit(versions.releases),\n\t\t\t\tversions.forced || host.forced ? EXIT_DRIFT : EXIT_CLEAN,\n\t\t\t)\n\t\t} finally {\n\t\t\thost.materializer.destroy()\n\t\t}\n\t}\n\n\t// `repair` — write each planned path the target is missing or has let drift,\n\t// then re-audit, because the audit a repair reports is the one taken after it.\n\t// One materializer spans the whole verb: the audit that guides the write, the\n\t// write, and the audit that answers for it are readings of one vendored\n\t// host, and a second instance could not promise they were.\n\tasync #restore(command: RepairCommand): Promise<number> {\n\t\tconst target = command.target ?? '.'\n\t\tconst groups = this.#groups(command.groups)\n\t\tconst blueprint = this.#derive(target)\n\t\tthis.#assertTarget(target, blueprint)\n\t\tconst host = await this.#host(command.from, target, command.offline === true)\n\t\ttry {\n\t\t\tconst [audit, plan] = this.#survey(host.materializer, blueprint, target, groups)\n\t\t\tif (plan === undefined) {\n\t\t\t\tif (command.json === true) {\n\t\t\t\t\tthis.#report({\n\t\t\t\t\t\t...audit,\n\t\t\t\t\t\tprovenance: {\n\t\t\t\t\t\t\t...(host.baseline === undefined ? {} : { host: host.baseline }),\n\t\t\t\t\t\t},\n\t\t\t\t\t})\n\t\t\t\t} else this.#present(audit)\n\t\t\t\treturn EXIT_DRIFT\n\t\t\t}\n\t\t\tconst versions = await this.#versions(\n\t\t\t\tmanifestToPlannedDependencies(this.#manifest(target), blueprint),\n\t\t\t\tcommand.offline === true,\n\t\t\t)\n\t\t\tthis.#assertVersions(versions)\n\t\t\tconst result = this.#merge(\n\t\t\t\thost.materializer.repair(plan, audit, target),\n\t\t\t\thost.materializer.declare(versions.pins, target),\n\t\t\t)\n\t\t\tconst [terminal] = this.#survey(host.materializer, this.#derive(target), target, groups)\n\t\t\tconst outcome: RepairResult = {\n\t\t\t\t...result,\n\t\t\t\taudit: terminal,\n\t\t\t\treleases: versions.releases,\n\t\t\t\tprovenance: {\n\t\t\t\t\t...(versions.baseline === undefined ? {} : { versions: versions.baseline }),\n\t\t\t\t\t...(host.baseline === undefined ? {} : { host: host.baseline }),\n\t\t\t\t},\n\t\t\t}\n\t\t\tif (command.json === true) this.#report(outcome)\n\t\t\telse {\n\t\t\t\tthis.#present(terminal)\n\t\t\t\tthis.#reportReplacements(audit, terminal)\n\t\t\t\tthis.#say(this.#tally(result))\n\t\t\t}\n\t\t\tif (versions.forced || host.forced) this.#reportBaselines(outcome.provenance)\n\t\t\tif (command.offline !== true && (versions.forced || host.forced)) return EXIT_DRIFT\n\t\t\treturn auditToExit(terminal)\n\t\t} finally {\n\t\t\thost.materializer.destroy()\n\t\t}\n\t}\n\n\t// `catalog` — regenerate the package table from the organization's published\n\t// list and refresh the guide mirrors the target draws on.\n\tasync #refresh(command: CatalogCommand): Promise<number> {\n\t\tconst target = command.target ?? '.'\n\t\tconst [host, ...extra] = command.from ?? []\n\t\tif (extra.length > 0) {\n\t\t\tthis.#warn(\n\t\t\t\t`Read the data root from ${String(host)}. The other ${String(extra.length)} local root${extra.length === 1 ? '' : 's'} named by --from reach nothing this run does.`,\n\t\t\t)\n\t\t}\n\t\tconst previous = this.#previous(target)\n\t\tconst fetched = await this.#fetch(target, command.all === true)\n\t\tconst releases = this.#catalogReleases(\n\t\t\tdependenciesToFleet(manifestToDependencies(this.#manifest(target))),\n\t\t\tfetched.entries,\n\t\t)\n\t\tconst pins = this.#pin(releases)\n\t\tthis.#assertFetched(fetched.entries, fetched.mirrors)\n\t\tconst guides: Baseline | undefined =\n\t\t\tfetched.mirrors.length === 0\n\t\t\t\t? undefined\n\t\t\t\t: fetched.mirrors.some((mirror) => mirror.lookup === 'failed')\n\t\t\t\t\t? 'floor'\n\t\t\t\t\t: 'live'\n\t\tconst materializer = new Materializer({ host: host ?? readHostFloor() })\n\t\tlet result: MaterializeResult\n\t\ttry {\n\t\t\tresult = this.#merge(\n\t\t\t\tthis.#publish(materializer, target, fetched.entries, fetched.mirrors),\n\t\t\t\tmaterializer.declare(pins, target),\n\t\t\t)\n\t\t} finally {\n\t\t\tmaterializer.destroy()\n\t\t}\n\t\tconst outcome: CatalogResult = {\n\t\t\t...result,\n\t\t\tentries: fetched.entries,\n\t\t\tmirrors: fetched.mirrors,\n\t\t\tdropped: previous.filter((name) => !fetched.entries.some((entry) => entry.name === name)),\n\t\t\treleases,\n\t\t\tprovenance: {\n\t\t\t\tversions: 'live',\n\t\t\t\t...(guides === undefined ? {} : { guides }),\n\t\t\t},\n\t\t}\n\t\tif (command.json === true) this.#report(outcome)\n\t\telse this.#recount(outcome)\n\t\treturn guides === 'floor' ? EXIT_DRIFT : EXIT_CLEAN\n\t}\n\n\t// `overwrite` — everything repair and catalog do, plus the steps only this\n\t// verb carries. The offline half runs first and persists whatever it did,\n\t// because it is the destructive one: a run that cannot reach upstream still\n\t// leaves the target repaired and says which step it could not complete.\n\tasync #replace(command: OverwriteCommand): Promise<number> {\n\t\tconst target = command.target ?? '.'\n\t\tconst groups = this.#groups(command.groups)\n\t\tconst blueprint = this.#derive(target)\n\t\tthis.#assertTarget(target, blueprint)\n\t\tconst worktree = this.#worktree(target)\n\t\tif (worktree.dirty.length > 0 && command.dirty !== true) {\n\t\t\tthrow new ScaffoldError(\n\t\t\t\t'TARGET',\n\t\t\t\t`The target at ${target} carries ${String(worktree.dirty.length)} uncommitted change${worktree.dirty.length === 1 ? '' : 's'}. Commit them, or pass --dirty to waive the refusal.`,\n\t\t\t\t{ target, dirty: worktree.dirty.length },\n\t\t\t)\n\t\t}\n\t\tconst host = await this.#host(command.from, target, command.offline === true)\n\t\ttry {\n\t\t\tconst [audit, plan] = this.#survey(host.materializer, blueprint, target, groups)\n\t\t\tif (plan === undefined) {\n\t\t\t\tif (command.json === true) {\n\t\t\t\t\tthis.#report({\n\t\t\t\t\t\t...audit,\n\t\t\t\t\t\tprovenance: {\n\t\t\t\t\t\t\t...(host.baseline === undefined ? {} : { host: host.baseline }),\n\t\t\t\t\t\t},\n\t\t\t\t\t})\n\t\t\t\t} else this.#present(audit)\n\t\t\t\treturn EXIT_DRIFT\n\t\t\t}\n\t\t\tconst declared = manifestToPlannedDependencies(this.#manifest(target), blueprint)\n\t\t\tconst repaired = host.materializer.repair(plan, audit, target)\n\t\t\t// The candidate set is re-derived from the plan and target, then held to\n\t\t\t// the audit's foreign findings. A path the plan claims is never a deletion\n\t\t\t// candidate, and neither is a path outside the vendored directories this\n\t\t\t// plan expands.\n\t\t\t// `--dirty` is expressed here and nowhere else: the waiver clears the\n\t\t\t// refusal the observed dirty set would otherwise trigger downstream, and\n\t\t\t// waives nothing about which paths are eligible.\n\t\t\tconst removed = host.materializer.remove(\n\t\t\t\tplan,\n\t\t\t\taudit,\n\t\t\t\tcommand.dirty === true ? { tracked: worktree.tracked, dirty: [] } : worktree,\n\t\t\t\ttarget,\n\t\t\t)\n\t\t\tconst offline = this.#merge(repaired, removed)\n\t\t\tconst online: Omit<OverwriteResult, 'audit'> =\n\t\t\t\tcommand.offline === true\n\t\t\t\t\t? await this.#offline(host.materializer, target, declared, host.baseline)\n\t\t\t\t\t: await this.#reconcile(host.materializer, target, declared, host.baseline, host.forced)\n\t\t\tconst [terminal] = this.#survey(host.materializer, blueprint, target, groups)\n\t\t\tconst outcome: OverwriteResult = {\n\t\t\t\t...online,\n\t\t\t\t...this.#merge(offline, online),\n\t\t\t\taudit: terminal,\n\t\t\t}\n\t\t\tif (command.json === true) this.#report(outcome)\n\t\t\telse {\n\t\t\t\tthis.#present(terminal)\n\t\t\t\tthis.#reportReplacements(audit, terminal)\n\t\t\t\tthis.#recount(outcome)\n\t\t\t\tif (online.note !== undefined) this.#warn(online.note)\n\t\t\t}\n\t\t\tif (online.note !== undefined) return EXIT_DRIFT\n\t\t\treturn auditToExit(terminal)\n\t\t} finally {\n\t\t\thost.materializer.destroy()\n\t\t}\n\t}\n\n\t// The network half of `overwrite`, collected rather than thrown: the offline\n\t// half has already written, so a step that cannot complete is reported as the\n\t// step it was instead of discarding what already landed. It writes through the\n\t// verb's own materializer rather than opening a second one, so every byte the\n\t// run lands comes from the host the caller named once.\n\tasync #offline(\n\t\tmaterializer: MaterializerInterface,\n\t\ttarget: string,\n\t\tdeclared: readonly Dependency[],\n\t\thost: Baseline | undefined,\n\t): Promise<Omit<OverwriteResult, 'audit'>> {\n\t\tconst versions = await this.#versions(declared, true)\n\t\tthis.#assertVersions(versions)\n\t\tconst written = materializer.declare(versions.pins, target)\n\t\treturn {\n\t\t\t...written,\n\t\t\tentries: [],\n\t\t\tmirrors: [],\n\t\t\tdropped: [],\n\t\t\treleases: versions.releases,\n\t\t\tprovenance: {\n\t\t\t\t...(versions.baseline === undefined ? {} : { versions: versions.baseline }),\n\t\t\t\t...(host === undefined ? {} : { host }),\n\t\t\t},\n\t\t\tnote: \"The catalog step did not complete: USAGE: 'catalog' does not take --offline.\",\n\t\t}\n\t}\n\n\tasync #reconcile(\n\t\tmaterializer: MaterializerInterface,\n\t\ttarget: string,\n\t\tdeclared: readonly Dependency[],\n\t\thost: Baseline | undefined,\n\t\thostForced: boolean,\n\t): Promise<Omit<OverwriteResult, 'audit'>> {\n\t\tconst previous = this.#previous(target)\n\t\tlet releases: readonly Release[] = []\n\t\tlet provenance: Provenance = { ...(host === undefined ? {} : { host }) }\n\t\ttry {\n\t\t\tconst versions = await this.#versions(declared, false)\n\t\t\treleases = versions.releases\n\t\t\tprovenance = {\n\t\t\t\t...(versions.baseline === undefined ? {} : { versions: versions.baseline }),\n\t\t\t\t...(host === undefined ? {} : { host }),\n\t\t\t}\n\t\t\tthis.#assertVersions(versions)\n\t\t\tconst fetched = await this.#fetch(target, false)\n\t\t\tthis.#assertFetched(fetched.entries, fetched.mirrors)\n\t\t\tconst guides: Baseline | undefined =\n\t\t\t\tfetched.mirrors.length === 0\n\t\t\t\t\t? undefined\n\t\t\t\t\t: fetched.mirrors.some((mirror) => mirror.lookup === 'failed')\n\t\t\t\t\t\t? 'floor'\n\t\t\t\t\t\t: 'live'\n\t\t\tprovenance = {\n\t\t\t\t...(versions.baseline === undefined ? {} : { versions: versions.baseline }),\n\t\t\t\t...(guides === undefined ? {} : { guides }),\n\t\t\t\t...(host === undefined ? {} : { host }),\n\t\t\t}\n\t\t\tconst written = this.#merge(\n\t\t\t\tthis.#publish(materializer, target, fetched.entries, fetched.mirrors),\n\t\t\t\tmaterializer.declare(versions.pins, target),\n\t\t\t)\n\t\t\tconst floors: string[] = []\n\t\t\tif (hostForced) floors.push('host')\n\t\t\tif (versions.forced) floors.push('versions')\n\t\t\tif (guides === 'floor') floors.push('guides')\n\t\t\treturn {\n\t\t\t\t...written,\n\t\t\t\tentries: fetched.entries,\n\t\t\t\tmirrors: fetched.mirrors,\n\t\t\t\tdropped: previous.filter((name) => !fetched.entries.some((entry) => entry.name === name)),\n\t\t\t\treleases,\n\t\t\t\tprovenance,\n\t\t\t\t...(floors.length === 0\n\t\t\t\t\t? {}\n\t\t\t\t\t: {\n\t\t\t\t\t\t\tnote: `The ${floors.join(', ')} step used the distributed floor after its upstream read did not complete.`,\n\t\t\t\t\t\t}),\n\t\t\t}\n\t\t} catch (error) {\n\t\t\treturn {\n\t\t\t\ttarget,\n\t\t\t\twritten: [],\n\t\t\t\tskipped: [],\n\t\t\t\tremoved: [],\n\t\t\t\tentries: [],\n\t\t\t\tmirrors: [],\n\t\t\t\tdropped: [],\n\t\t\t\treleases,\n\t\t\t\tprovenance,\n\t\t\t\tnote: `The catalog step did not complete: ${errorToEnvelope(error).error.message}`,\n\t\t\t}\n\t\t}\n\t}\n\n\t// Resolve the vendored host without letting a partial repository answer reach\n\t// the materializer.\n\tasync #host(\n\t\tfrom: string | undefined,\n\t\ttarget: string | undefined,\n\t\toffline: boolean,\n\t): Promise<HostResolution> {\n\t\tif (from !== undefined) {\n\t\t\treturn { materializer: new Materializer({ host: from }), forced: false }\n\t\t}\n\t\tconst floor = readHostFloor()\n\t\tif (offline) {\n\t\t\treturn {\n\t\t\t\tmaterializer: new Materializer({ host: floor }),\n\t\t\t\tbaseline: 'floor',\n\t\t\t\tforced: false,\n\t\t\t}\n\t\t}\n\t\tconst paths = floor.manifest.entries\n\t\t\t.filter((entry) => !isDeferredPath(entry.destination))\n\t\t\t.map((entry) => entry.destination)\n\t\tconst current = target === undefined ? floor.bytes : readSnapshot(target, paths)\n\t\tconst upstream = new Upstream(this.#upstream)\n\t\ttry {\n\t\t\tconst files = await upstream.read(paths, current)\n\t\t\tconst live = filesToHost(files, floor)\n\t\t\treturn {\n\t\t\t\tmaterializer: new Materializer({ host: live ?? floor }),\n\t\t\t\tbaseline: live === undefined ? 'floor' : 'live',\n\t\t\t\tforced: live === undefined,\n\t\t\t}\n\t\t} finally {\n\t\t\tupstream.destroy()\n\t\t}\n\t}\n\n\t// Resolve one whole version surface. Authoritative absence refuses, while a\n\t// read that did not complete selects every declaration's distributed floor.\n\tasync #versions(declared: readonly Dependency[], offline: boolean): Promise<VersionResolution> {\n\t\tif (declared.length === 0) {\n\t\t\treturn { releases: [], pins: [], forced: false, complete: true }\n\t\t}\n\t\tconst floors = dependenciesToFloors(declared)\n\t\tif (offline) {\n\t\t\tif (floors === undefined) {\n\t\t\t\treturn {\n\t\t\t\t\treleases: [],\n\t\t\t\t\tpins: [],\n\t\t\t\t\tbaseline: 'floor',\n\t\t\t\t\tforced: false,\n\t\t\t\t\tcomplete: false,\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\treleases: floors,\n\t\t\t\tpins: floors.map((release) => ({ name: release.name, range: release.range })),\n\t\t\t\tbaseline: 'floor',\n\t\t\t\tforced: false,\n\t\t\t\tcomplete: true,\n\t\t\t}\n\t\t}\n\t\tconst releases = await this.#lookup(declared)\n\t\tconst absent = releases.filter(\n\t\t\t(release) => release.lookup === 'missing' || release.lookup === 'unmatched',\n\t\t)\n\t\tif (absent.length > 0) {\n\t\t\treturn {\n\t\t\t\treleases,\n\t\t\t\tpins: [],\n\t\t\t\tbaseline: 'live',\n\t\t\t\tforced: false,\n\t\t\t\tcomplete: false,\n\t\t\t}\n\t\t}\n\t\tconst failed = releases.some((release) => release.lookup === 'failed')\n\t\tif (failed) {\n\t\t\tif (floors === undefined) {\n\t\t\t\treturn {\n\t\t\t\t\treleases,\n\t\t\t\t\tpins: [],\n\t\t\t\t\tbaseline: 'floor',\n\t\t\t\t\tforced: true,\n\t\t\t\t\tcomplete: false,\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\treleases,\n\t\t\t\tpins: floors.map((release) => ({ name: release.name, range: release.range })),\n\t\t\t\tbaseline: 'floor',\n\t\t\t\tforced: true,\n\t\t\t\tcomplete: true,\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\treleases,\n\t\t\tpins: this.#pin(releases),\n\t\t\tbaseline: 'live',\n\t\t\tforced: false,\n\t\t\tcomplete: true,\n\t\t}\n\t}\n\n\t// Refuse an incomplete version resolution before a caller opens a write.\n\t#assertVersions(versions: VersionResolution): void {\n\t\tif (versions.complete) return\n\t\tconst names = versions.releases\n\t\t\t.filter((release) => release.lookup !== 'found')\n\t\t\t.map((release) => release.name)\n\t\tthrow new ScaffoldError(\n\t\t\t'FETCH',\n\t\t\tnames.length === 0\n\t\t\t\t? 'A declared dependency names no concrete floor.'\n\t\t\t\t: `The registry named no release for ${names.join(', ')}.`,\n\t\t\t{ names: names.length },\n\t\t)\n\t}\n\n\t// Measure each fleet row against the registry's newest release and each\n\t// foreign row against the newest release its declared major admits.\n\tasync #lookup(declared: readonly Dependency[]): Promise<readonly Release[]> {\n\t\tif (declared.length === 0) return []\n\t\tconst upstream = new Upstream(this.#upstream)\n\t\ttry {\n\t\t\tconst releases = await upstream.lookup(\n\t\t\t\tdeclared.map((dependency) => {\n\t\t\t\t\tconst major = extractRangeMajor(dependency.range)\n\t\t\t\t\treturn {\n\t\t\t\t\t\tname: dependency.name,\n\t\t\t\t\t\trange: dependency.name.startsWith('@orkestrel/')\n\t\t\t\t\t\t\t? '*'\n\t\t\t\t\t\t\t: major === undefined\n\t\t\t\t\t\t\t\t? dependency.range\n\t\t\t\t\t\t\t\t: `^${String(major)}`,\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t)\n\t\t\treturn releases.map((release, index): Release => {\n\t\t\t\tconst dependency = declared[index]\n\t\t\t\tif (dependency === undefined) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tname: release.name,\n\t\t\t\t\t\trange: release.range,\n\t\t\t\t\t\tlookup: 'failed',\n\t\t\t\t\t\tnote: 'the release answer has no matching declaration',\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn { ...release, range: dependency.range }\n\t\t\t})\n\t\t} finally {\n\t\t\tupstream.destroy()\n\t\t}\n\t}\n\n\t// Read the organization's published list and the guides the target draws on.\n\t// The workspace never fetches its own guide: that file is its own product.\n\tasync #fetch(\n\t\ttarget: string,\n\t\tall: boolean,\n\t): Promise<{ readonly entries: readonly CatalogEntry[]; readonly mirrors: readonly Mirror[] }> {\n\t\tconst manifest = this.#manifest(target)\n\t\tconst own = manifestToName(manifest)\n\t\tconst declared = manifestToDependencies(manifest).map((dependency) => dependency.name)\n\t\tconst upstream = new Upstream(this.#upstream)\n\t\ttry {\n\t\t\tconst entries = await upstream.catalog()\n\t\t\tconst names = (all ? entries.map((entry) => entry.name) : declared).filter(\n\t\t\t\t(name) => name !== own,\n\t\t\t)\n\t\t\tconst mirrors = await upstream.fetch(names, readSnapshot(target, names.map(nameToGuide)))\n\t\t\treturn { entries, mirrors }\n\t\t} finally {\n\t\t\tupstream.destroy()\n\t\t}\n\t}\n\n\t// Write the fetched guides to their mirrors and the published list to the\n\t// marker-bounded table, as one result.\n\t#publish(\n\t\tmaterializer: MaterializerInterface,\n\t\ttarget: string,\n\t\tentries: readonly CatalogEntry[],\n\t\tmirrors: readonly Mirror[],\n\t): MaterializeResult {\n\t\treturn this.#merge(materializer.mirror(mirrors, target), materializer.catalog(entries, target))\n\t}\n\n\t// Derive declared release evidence from the catalog packuments already read.\n\t#catalogReleases(\n\t\tdeclared: readonly Dependency[],\n\t\tentries: readonly CatalogEntry[],\n\t): readonly Release[] {\n\t\treturn declared.map((dependency): Release => {\n\t\t\tconst entry = entries.find((candidate) => candidate.name === dependency.name)\n\t\t\tif (entry?.lookup === 'found') {\n\t\t\t\treturn { ...dependency, lookup: 'found', latest: entry.version }\n\t\t\t}\n\t\t\treturn {\n\t\t\t\t...dependency,\n\t\t\t\tlookup: entry?.lookup ?? 'missing',\n\t\t\t\tnote: entry?.note ?? 'the organization catalog does not list the declared package',\n\t\t\t}\n\t\t})\n\t}\n\n\t// A catalog transaction starts only after every packument and mirror answered.\n\t#assertFetched(entries: readonly CatalogEntry[], mirrors: readonly Mirror[]): void {\n\t\tconst failed = [\n\t\t\t...entries.filter((entry) => entry.lookup !== 'found').map((entry) => entry.name),\n\t\t\t...mirrors\n\t\t\t\t.filter((mirror) => mirror.lookup !== 'found' && mirror.lookup !== 'failed')\n\t\t\t\t.map((mirror) => mirror.name),\n\t\t]\n\t\tif (failed.length === 0) return\n\t\tthrow new ScaffoldError(\n\t\t\t'FETCH',\n\t\t\t`Upstream produced no complete catalog answer for ${failed.join(', ')}.`,\n\t\t\t{ names: failed.length },\n\t\t)\n\t}\n\n\t// Build the complete pin set or refuse before any caller writes a range.\n\t#pin(releases: readonly Release[]): readonly Dependency[] {\n\t\tconst refused = releases.filter((release) => release.lookup !== 'found')\n\t\tif (refused.length > 0) {\n\t\t\tthrow new ScaffoldError(\n\t\t\t\t'FETCH',\n\t\t\t\t`The registry named no release for ${refused.map((release) => release.name).join(', ')}.`,\n\t\t\t\t{ names: refused.length },\n\t\t\t)\n\t\t}\n\t\treturn releases.map((release) => {\n\t\t\tif (release.lookup !== 'found') {\n\t\t\t\tthrow new ScaffoldError('FETCH', `The registry named no release for ${release.name}.`)\n\t\t\t}\n\t\t\treturn { name: release.name, range: `^${release.latest}` }\n\t\t})\n\t}\n\n\t// Compile a blueprint into the plan it describes, or refuse with the questions\n\t// the gate raised.\n\t//\n\t// `new` is the only caller, and it chooses the shape rather than reading one, so\n\t// it refuses every question the gate raises, advisory or not: an advisory names\n\t// a workspace this package can describe honestly but will not create, and this\n\t// is the last moment the caller can pick a different shape. `#survey` is the\n\t// reading counterpart, and it carries the same advisories through instead.\n\t//\n\t// The refusal is `BLOCKED` whichever kind of question earned it, because both\n\t// are the one fact that code names: this blueprint will not be built. The\n\t// questions the message quotes are what tells them apart, and a second code\n\t// would be a label for a fact they already carry.\n\t#compile(blueprint: Blueprint, groups?: readonly Group[]): Plan {\n\t\tconst compiler = new Compiler()\n\t\ttry {\n\t\t\tconst scaffolding = compiler.compile(blueprint, groups)\n\t\t\tif (scaffolding.plan !== undefined && scaffolding.questions.length === 0) {\n\t\t\t\treturn scaffolding.plan\n\t\t\t}\n\t\t\tthrow new ScaffoldError(\n\t\t\t\t'BLOCKED',\n\t\t\t\tscaffolding.questions.map((question) => `${question.field}: ${question.message}`).join(' '),\n\t\t\t\t{ questions: scaffolding.questions.length },\n\t\t\t)\n\t\t} finally {\n\t\t\tcompiler.destroy()\n\t\t}\n\t}\n\n\t// Compile a blueprint and compare its plan to what the target holds,\n\t// through the vendored host a write would draw on.\n\t//\n\t// The materializer owns the comparison because it is the only one that can\n\t// make it: the pure compile claims presence alone, so it reads a canon file a\n\t// consumer has edited as aligned and a vendored directory as one missing path\n\t// no write could ever satisfy. Hydrating first states the bytes and expands\n\t// the directory into the files the host actually stores, which is the same\n\t// derivation the repair that follows is held to.\n\t//\n\t// The compiler answers the refused case alone. A blueprint the gate closed\n\t// carries no plan, so there is nothing to hydrate and nothing to say about the\n\t// target; the audit carries the questions instead.\n\t#survey(\n\t\tmaterializer: MaterializerInterface,\n\t\tblueprint: Blueprint,\n\t\ttarget: string,\n\t\tgroups?: readonly Group[],\n\t): readonly [audit: Audit, plan: Plan | undefined] {\n\t\tconst compiler = new Compiler()\n\t\ttry {\n\t\t\tconst scaffolding = compiler.compile(blueprint, groups)\n\t\t\tif (scaffolding.plan === undefined) return [compiler.audit(blueprint, {}, groups), undefined]\n\t\t\t// The materializer answers for the target and the gate answers for the\n\t\t\t// blueprint, so an advisory the gate raised rides the comparison rather\n\t\t\t// than being dropped between them. It is non-blocking, so it changes no\n\t\t\t// exit code and never makes an aligned target drift.\n\t\t\tconst measured = materializer.audit(scaffolding.plan, target)\n\t\t\treturn [\n\t\t\t\t{ ...measured, questions: [...measured.questions, ...scaffolding.questions] },\n\t\t\t\tscaffolding.plan,\n\t\t\t]\n\t\t} finally {\n\t\t\tcompiler.destroy()\n\t\t}\n\t}\n\n\t// The blueprint a target describes about itself: manifest identity and fleet\n\t// packages, environment directories, and exact structural files. Vendors stay\n\t// unknown because their birth-owned script is not a declaration of its list.\n\t// The live-service project does not wait on that list: it follows its own\n\t// readiness module, which the root configuration names by path.\n\t#derive(target: string): Blueprint {\n\t\tconst manifest = this.#manifest(target)\n\t\tconst declared = manifestToName(manifest)\n\t\tif (declared === undefined) {\n\t\t\tthrow new ScaffoldError('TARGET', `The manifest at ${target} declares no package name.`, {\n\t\t\t\ttarget,\n\t\t\t})\n\t\t}\n\t\tconst bin = resolveContainedPath(target, BIN_ENTRY_PATH)\n\t\tconst tests = resolveContainedPath(target, 'tests')\n\t\tconst guides = resolveContainedPath(target, GUIDES_TEST_PATH)\n\t\tconst distribution = resolveContainedPath(target, DISTRIBUTION_TEST_PATH)\n\t\tconst integration = resolveContainedPath(target, INTEGRATION_TEST_PATH)\n\t\tconst conformance = resolveContainedPath(target, CONFORMANCE_TEST_PATH)\n\t\tconst service = resolveContainedPath(target, SERVICE_SETUP_PATH)\n\t\tconst global = resolveContainedPath(target, GLOBAL_SETUP_PATH)\n\t\tconst showcase = resolveContainedPath(target, SHOWCASE_CONFIG_PATH)\n\t\treturn createBlueprint(declared.slice(declared.lastIndexOf('/') + 1), {\n\t\t\tsrc: this.#probe(target, 'src'),\n\t\t\tapp: this.#probe(target, 'app'),\n\t\t\tdependencies: manifestToDependencies(manifest),\n\t\t\tbin: bin !== undefined && isExactCaseFile(bin),\n\t\t\tsetup:\n\t\t\t\ttests !== undefined &&\n\t\t\t\tlistFiles(tests).some((path) => {\n\t\t\t\t\tif (path.includes('/') || !path.startsWith('setup') || !path.endsWith('.test.ts')) {\n\t\t\t\t\t\treturn false\n\t\t\t\t\t}\n\t\t\t\t\tconst proof = resolveContainedPath(tests, path)\n\t\t\t\t\treturn proof !== undefined && isExactCaseFile(proof)\n\t\t\t\t}),\n\t\t\tguides: guides !== undefined && isExactCaseFile(guides),\n\t\t\tdistribution: distribution !== undefined && isExactCaseFile(distribution),\n\t\t\tintegration: integration !== undefined && isExactCaseFile(integration),\n\t\t\tconformance: conformance !== undefined && isExactCaseFile(conformance),\n\t\t\tservice: service !== undefined && isExactCaseFile(service),\n\t\t\tglobal: global !== undefined && isExactCaseFile(global),\n\t\t\tshowcase: showcase !== undefined && isExactCaseFile(showcase),\n\t\t})\n\t}\n\n\t// Read the literal Vitest projects and npm run scripts one shell command\n\t// invokes. Quotes group a token but do not hide the option, while shell\n\t// expansions make its value unresolved and therefore refuse the write that\n\t// asked the question.\n\t#invocations(\n\t\tscript: string,\n\t): { readonly projects: readonly string[]; readonly scripts: readonly string[] } | undefined {\n\t\tconst tokens: Array<{ value: string; resolved: boolean }> = []\n\t\tlet value = ''\n\t\tlet resolved = true\n\t\tlet started = false\n\t\tlet quote: string | undefined\n\t\tfor (let index = 0; index < script.length; index += 1) {\n\t\t\tconst character = script[index]\n\t\t\tif (character === undefined) return undefined\n\t\t\tif (quote === undefined) {\n\t\t\t\tif (/\\s/.test(character)) {\n\t\t\t\t\tif (started) tokens.push({ value, resolved })\n\t\t\t\t\tvalue = ''\n\t\t\t\t\tresolved = true\n\t\t\t\t\tstarted = false\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif (';&|()'.includes(character)) {\n\t\t\t\t\tif (started) tokens.push({ value, resolved })\n\t\t\t\t\tconst paired = script[index + 1] === character && (character === '&' || character === '|')\n\t\t\t\t\ttokens.push({ value: paired ? `${character}${character}` : character, resolved: true })\n\t\t\t\t\tvalue = ''\n\t\t\t\t\tresolved = true\n\t\t\t\t\tstarted = false\n\t\t\t\t\tif (paired) index += 1\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif (character === '\"' || character === \"'\") {\n\t\t\t\t\tquote = character\n\t\t\t\t\tstarted = true\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif (character === '\\\\') {\n\t\t\t\t\tconst escaped = script[index + 1]\n\t\t\t\t\tif (escaped === undefined) return undefined\n\t\t\t\t\tvalue += escaped\n\t\t\t\t\tstarted = true\n\t\t\t\t\tindex += 1\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif (character === '$' || character === '`' || character === '%') resolved = false\n\t\t\t\tvalue += character\n\t\t\t\tstarted = true\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (character === quote) {\n\t\t\t\tquote = undefined\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (character === '\\\\' && quote === '\"') {\n\t\t\t\tconst escaped = script[index + 1]\n\t\t\t\tif (escaped === undefined) return undefined\n\t\t\t\tvalue += escaped\n\t\t\t\tindex += 1\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (quote === '\"' && (character === '$' || character === '`' || character === '%')) {\n\t\t\t\tresolved = false\n\t\t\t}\n\t\t\tvalue += character\n\t\t\tstarted = true\n\t\t}\n\t\tif (quote !== undefined) return undefined\n\t\tif (started) tokens.push({ value, resolved })\n\n\t\tconst projects: string[] = []\n\t\tconst scripts: string[] = []\n\t\tfor (let index = 0; index < tokens.length; index += 1) {\n\t\t\tconst token = tokens[index]\n\t\t\tif (token === undefined) return undefined\n\t\t\tif (token.value === 'npm' && tokens[index + 1]?.value === 'run') {\n\t\t\t\tconst name = tokens[index + 2]\n\t\t\t\tif (\n\t\t\t\t\tname === undefined ||\n\t\t\t\t\t!name.resolved ||\n\t\t\t\t\tname.value.length === 0 ||\n\t\t\t\t\t['&&', '||', ';', '|', '&', '(', ')'].includes(name.value)\n\t\t\t\t)\n\t\t\t\t\treturn undefined\n\t\t\t\tscripts.push(name.value)\n\t\t\t\tindex += 2\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (token.value === '--project') {\n\t\t\t\tconst project = tokens[index + 1]\n\t\t\t\tif (\n\t\t\t\t\tproject === undefined ||\n\t\t\t\t\t!project.resolved ||\n\t\t\t\t\tproject.value.length === 0 ||\n\t\t\t\t\t['&&', '||', ';', '|', '&', '(', ')'].includes(project.value)\n\t\t\t\t)\n\t\t\t\t\treturn undefined\n\t\t\t\tprojects.push(project.value)\n\t\t\t\tindex += 1\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (token.value.startsWith('--project=')) {\n\t\t\t\tconst project = token.value.slice('--project='.length)\n\t\t\t\tif (!token.resolved || project.length === 0) return undefined\n\t\t\t\tprojects.push(project)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (!token.resolved && token.value.includes('--project')) return undefined\n\t\t}\n\t\treturn { projects, scripts }\n\t}\n\n\t// Report either side of the planned-project invariant. Audit carries the\n\t// advisory; writing verbs turn it into the hard boundary that keeps a\n\t// birth-owned manifest from disagreeing with content-owned configuration.\n\t#projectQuestion(target: string, blueprint: Blueprint, writing = false): Question | undefined {\n\t\tconst manifest = this.#manifest(target)\n\t\tconst planned = blueprintToRootVite(blueprint)\n\t\tconst parsed = parseJSON(manifest)\n\t\tconst scripts = isRecord(parsed) && isRecord(parsed.scripts) ? parsed.scripts : {}\n\t\tconst publishes = !isRecord(parsed) || parsed.private !== true\n\t\tconst gates = publishes ? ['test', 'prepublishOnly'] : ['test']\n\t\tconst gateNames = gates.join(' or ')\n\t\tconst absent = new Set<string>()\n\t\tlet unresolved = false\n\t\tfor (const script of Object.values(scripts)) {\n\t\t\tif (!isString(script) || !script.includes('vitest')) continue\n\t\t\tconst invoked = this.#invocations(script)\n\t\t\tif (invoked === undefined) {\n\t\t\t\tunresolved = true\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor (const project of invoked.projects) {\n\t\t\t\tif (!planned.includes(`name: { label: '${project}',`)) absent.add(project)\n\t\t\t}\n\t\t}\n\t\tconst projects = [...absent].sort()\n\t\tif (unresolved) {\n\t\t\treturn {\n\t\t\t\tfield: 'projects',\n\t\t\t\tmessage: `The manifest at ${target} contains a Vitest project expression that cannot be resolved statically.${projects.length === 0 ? '' : ` It also names projects the planned configuration does not register: ${projects.join(', ')}.`} ${writing ? 'Replace it with a literal --project value or remove the script before using a scaffold writing verb.' : 'Replace it with a literal --project value before relying on the planned configuration.'}`,\n\t\t\t\tblocking: false,\n\t\t\t}\n\t\t}\n\t\tif (projects.length > 0) {\n\t\t\treturn {\n\t\t\t\tfield: 'projects',\n\t\t\t\tmessage: writing\n\t\t\t\t\t? `The manifest at ${target} names ${projects.length === 1 ? 'a Vitest project' : 'Vitest projects'} the planned configuration does not register: ${projects.join(', ')}. To continue, remove the ${projects.length === 1 ? 'script that names it' : 'scripts that name them'} or do not use scaffold writing verbs on a workspace that needs ${projects.length === 1 ? 'a custom Vitest project' : 'custom Vitest projects'}.`\n\t\t\t\t\t: `The manifest at ${target} names ${projects.length === 1 ? 'a Vitest project' : 'Vitest projects'} the planned configuration does not register: ${projects.join(', ')}. Add ${projects.length === 1 ? 'the project' : 'each project'} to vite.config.ts or remove the ${projects.length === 1 ? 'script that names it' : 'scripts that name them'}.`,\n\t\t\t\tblocking: false,\n\t\t\t}\n\t\t}\n\t\tconst expected = blueprintToScripts(blueprint)\n\t\tconst expectedLines = new Map<string, string>()\n\t\tfor (const [name, script] of Object.entries(expected)) {\n\t\t\tif (!name.startsWith('test:')) continue\n\t\t\tconst invoked = this.#invocations(script)\n\t\t\tif (invoked === undefined) continue\n\t\t\tfor (const project of invoked.projects) {\n\t\t\t\tif (project === 'probe') continue\n\t\t\t\tconst direct = `test:${project}`\n\t\t\t\tconst command = expected[direct]\n\t\t\t\tif (command !== undefined) {\n\t\t\t\t\texpectedLines.set(project, `\"${direct}\": ${JSON.stringify(command)},`)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst reachable = new Set<string>()\n\t\tconst visited = new Set<string>()\n\t\tconst pending = [...gates]\n\t\twhile (pending.length > 0) {\n\t\t\tconst name = pending.shift()\n\t\t\tif (name === undefined || visited.has(name)) continue\n\t\t\tvisited.add(name)\n\t\t\tconst script = scripts[name]\n\t\t\tif (!isString(script)) continue\n\t\t\tconst invoked = this.#invocations(script)\n\t\t\tif (invoked === undefined) {\n\t\t\t\tunresolved = true\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor (const project of invoked.projects) reachable.add(project)\n\t\t\tfor (const called of invoked.scripts) {\n\t\t\t\tif (!visited.has(called)) pending.push(called)\n\t\t\t}\n\t\t}\n\t\tif (unresolved) {\n\t\t\treturn {\n\t\t\t\tfield: 'projects',\n\t\t\t\tmessage: `The manifest at ${target} contains a ${gateNames} chain that cannot be resolved statically. ${writing ? 'Replace it with literal npm run script names before using a scaffold writing verb.' : 'Replace it with literal npm run script names before relying on the planned configuration.'}`,\n\t\t\t\tblocking: false,\n\t\t\t}\n\t\t}\n\t\tconst missing = [...expectedLines]\n\t\t\t.filter(([project]) => !reachable.has(project))\n\t\t\t.sort(([left], [right]) => left.localeCompare(right))\n\t\tif (missing.length === 0) return undefined\n\t\tconst names = missing.map(([project]) => project)\n\t\t// A project goes unreached for one of these reasons, and they take opposite\n\t\t// repairs. Where the direct script is absent, the script is what is missing.\n\t\t// Where the target already declares it, adding that line again changes\n\t\t// nothing and the gate chain is what is missing.\n\t\tconst unscripted = missing.filter(([project]) => !isString(scripts[`test:${project}`]))\n\t\tconst ungated = missing.filter(([project]) => isString(scripts[`test:${project}`]))\n\t\t// The script lines are meant to be pasted and end in a trailing comma, so\n\t\t// they go last. Any prose after them reads as part of the paste.\n\t\tconst remedies: string[] = []\n\t\tif (ungated.length > 0) {\n\t\t\tconst declared = ungated.map(([project]) => `test:${project}`)\n\t\t\tremedies.push(\n\t\t\t\t`${declared.join(', ')} ${declared.length === 1 ? 'is' : 'are'} already declared, so the gate is missing rather than the script: invoke ${declared.length === 1 ? 'it' : 'each of them'} by name from the ${gateNames} chain.`,\n\t\t\t)\n\t\t}\n\t\tif (unscripted.length > 0) {\n\t\t\tconst lines = unscripted.map(([, line]) => line)\n\t\t\tremedies.push(\n\t\t\t\t`${writing ? 'To continue, add' : 'Add'} ${lines.length === 1 ? 'this exact script line' : 'these exact script lines'} to package.json: ${lines.join(' ')}`,\n\t\t\t)\n\t\t}\n\t\treturn {\n\t\t\tfield: 'projects',\n\t\t\tmessage: `The manifest at ${target} does not reach ${names.length === 1 ? 'a Vitest project' : 'Vitest projects'} the planned configuration registers: ${names.join(', ')}. No chain from ${gateNames} invokes ${names.length === 1 ? 'it' : 'them'}. ${remedies.join(' ')}`,\n\t\t\tblocking: false,\n\t\t}\n\t}\n\n\t// Compare planned tooling membership here. Registry release evidence owns\n\t// fleet range equality and foreign supported-major drift, so this question\n\t// reports only rows the target omitted or malformed sections it cannot read.\n\t#dependencyQuestion(target: string, blueprint: Blueprint, writing = false): Question | undefined {\n\t\tconst parsed = parseJSON(this.#manifest(target))\n\t\tif (!isRecord(parsed)) return undefined\n\t\tconst malformed = ['dependencies', 'devDependencies'].filter(\n\t\t\t(section) => parsed[section] !== undefined && !isRecord(parsed[section]),\n\t\t)\n\t\tif (malformed.length > 0) {\n\t\t\treturn {\n\t\t\t\tfield: 'dependencies',\n\t\t\t\tmessage: `The manifest at ${target} declares ${malformed.join(' and ')} as ${malformed.length === 1 ? 'a value' : 'values'} that ${malformed.length === 1 ? 'is' : 'are'} not ${malformed.length === 1 ? 'an object' : 'objects'}. Replace ${malformed.length === 1 ? 'it' : 'them'} with ${malformed.length === 1 ? 'an object' : 'objects'} before ${writing ? 'using a scaffold writing verb' : 'relying on the planned dependency set'}.`,\n\t\t\t\tblocking: false,\n\t\t\t}\n\t\t}\n\t\tconst dependencies = isRecord(parsed.dependencies) ? parsed.dependencies : {}\n\t\tconst development = isRecord(parsed.devDependencies) ? parsed.devDependencies : {}\n\t\tconst missing = Object.entries(blueprintToDevDependencies(blueprint))\n\t\t\t.filter(([name]) => !Object.hasOwn(dependencies, name) && !Object.hasOwn(development, name))\n\t\t\t.sort(([left], [right]) => left.localeCompare(right))\n\t\tif (missing.length === 0) return undefined\n\t\tconst names = missing.map(([name]) => name)\n\t\tconst lines = missing.map(\n\t\t\t([name, range]) => `${JSON.stringify(name)}: ${JSON.stringify(range)},`,\n\t\t)\n\t\treturn {\n\t\t\tfield: 'dependencies',\n\t\t\tmessage: `The manifest at ${target} does not declare ${names.length === 1 ? 'a planned dependency' : 'planned dependencies'}: ${names.join(', ')}. ${writing ? 'To continue, add' : 'Add'} ${lines.length === 1 ? 'this exact dependency line' : 'these exact dependency lines'} to dependencies or devDependencies in package.json: ${lines.join(' ')}`,\n\t\t\tblocking: false,\n\t\t}\n\t}\n\n\t// Collect the target questions in a fixed order so audit reports every\n\t// independent advisory and writing verbs refuse the same complete answer.\n\t#targetQuestions(target: string, blueprint: Blueprint, writing = false): readonly Question[] {\n\t\tconst questions: Question[] = []\n\t\tconst project = this.#projectQuestion(target, blueprint, writing)\n\t\tif (project !== undefined) questions.push(project)\n\t\tconst dependency = this.#dependencyQuestion(target, blueprint, writing)\n\t\tif (dependency !== undefined) questions.push(dependency)\n\t\treturn questions\n\t}\n\n\t// Writing verbs refuse the advisories because their next step would replace\n\t// planned configuration. Audit alone reports them without changing the target.\n\t#assertTarget(target: string, blueprint: Blueprint): void {\n\t\tconst questions = this.#targetQuestions(target, blueprint, true)\n\t\tif (questions.length === 0) return\n\t\tthrow new ScaffoldError('TARGET', questions.map((question) => question.message).join(' '), {\n\t\t\ttarget,\n\t\t})\n\t}\n\n\t// A target's manifest text, which every reading verb needs before it can say\n\t// anything about the target at all.\n\t#manifest(target: string): string {\n\t\tconst manifest = readFileText(target, 'package.json', MAX_MANIFEST_BYTES)\n\t\tif (manifest === undefined) {\n\t\t\tthrow new ScaffoldError('TARGET', `The target at ${target} carries no readable manifest.`, {\n\t\t\t\ttarget,\n\t\t\t})\n\t\t}\n\t\treturn manifest\n\t}\n\n\t// The environments one axis physically ships, read as directories rather than\n\t// declared, because a directory is the fact and a declaration would be a\n\t// second copy of it free to disagree.\n\t#probe(target: string, axis: string): readonly Environment[] {\n\t\treturn ENVIRONMENTS.filter((environment) => {\n\t\t\tconst full = resolveContainedPath(target, `${axis}/${environment}`)\n\t\t\treturn full !== undefined && isPhysicalDirectory(full)\n\t\t})\n\t}\n\n\t// The packages the target's catalog table listed before this run. Read through\n\t// the declared markdown parser rather than by pattern, so a row is a row\n\t// because the document says so.\n\t#previous(target: string): readonly string[] {\n\t\tconst text = readFileText(target, CATALOG_AGENT_PATH)\n\t\tif (text === undefined) return []\n\t\tconst names: string[] = []\n\t\tfor (const table of createMarkdown(text).filter(isTableNode)) {\n\t\t\tfor (const row of table.rows) {\n\t\t\t\tconst [cell] = row\n\t\t\t\tif (cell === undefined) continue\n\t\t\t\tconst name = cell.map(flattenText).join('').trim()\n\t\t\t\tif (DEPENDENCY_NAME_PATTERN.test(name)) names.push(name)\n\t\t\t}\n\t\t}\n\t\treturn names\n\t}\n\n\t// What git reports about the target's working tree. Deletion draws only on\n\t// what git tracks and refuses a tree carrying uncommitted work, so a target\n\t// that is not a repository has no recovery mechanism and is refused here.\n\t#worktree(target: string): Worktree {\n\t\tconst tracked = this.#inventory(target, ['ls-files', '-z'])\n\t\tconst dirty = this.#inventory(target, [\n\t\t\t'status',\n\t\t\t'--porcelain=v1',\n\t\t\t'--untracked-files=all',\n\t\t\t'-z',\n\t\t]).map((record) => (record.length > 3 && record[2] === ' ' ? record.slice(3) : record))\n\t\tconst state = { tracked, dirty }\n\t\tif (!isWorktree(state)) {\n\t\t\tthrow new ScaffoldError('TARGET', `The git state at ${target} is not a readable inventory.`, {\n\t\t\t\ttarget,\n\t\t\t\ttracked: tracked.length,\n\t\t\t\tdirty: dirty.length,\n\t\t\t})\n\t\t}\n\t\treturn state\n\t}\n\n\t// One git query, answered as its NUL-separated records. Git is asked rather\n\t// than reimplemented, because the tracked set and the dirty set are git's own\n\t// answers and nothing else can give them. `executeSync` resolves the bare `git`\n\t// name against `PATH` and `PATHEXT` on Windows, never through a shell, so the\n\t// query runs without an extension of its own.\n\t#inventory(target: string, args: readonly string[]): readonly string[] {\n\t\t// A failed run resolves instead of throwing, so this class stays the owner of\n\t\t// what leaves it: git's own refusal is buffered into the result rather than\n\t\t// written onto a stream nobody chose, and the failure is reported through the\n\t\t// diagnostic handler the caller supplied.\n\t\tconst result = executeSync(\n\t\t\t{ file: 'git', arguments: [...args] },\n\t\t\t{ workspace: target, limit: MAX_MANIFEST_BYTES, strict: false },\n\t\t)\n\t\tif (result.failed) {\n\t\t\tthrow new ScaffoldError('TARGET', `The target at ${target} is not a git repository.`, {\n\t\t\t\ttarget,\n\t\t\t})\n\t\t}\n\t\treturn result.stdout.split('\\0').filter((record) => record.length > 0)\n\t}\n\n\t// The environments a comma-separated selection names, refused by name when it\n\t// names something that is not one.\n\t#environments(selection: string | undefined, axis: string): readonly Environment[] {\n\t\tif (selection === undefined) return []\n\t\tconst requested = selection.split(',')\n\t\tconst refused = requested.filter(\n\t\t\t(name) => !ENVIRONMENTS.some((environment) => environment === name),\n\t\t)\n\t\tif (refused.length > 0) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`'--${axis}' does not take ${refused.join(', ')}. It takes ${ENVIRONMENTS.join(', ')}.`,\n\t\t\t)\n\t\t}\n\t\treturn ENVIRONMENTS.filter((environment) => requested.includes(environment))\n\t}\n\n\t// The groups a comma-separated selection names; absence covers every group.\n\t#groups(selection: string | undefined): readonly Group[] | undefined {\n\t\tif (selection === undefined) return undefined\n\t\tconst requested = selection.split(',')\n\t\tconst refused = requested.filter((name) => !GROUPS.some((group) => group === name))\n\t\tif (refused.length > 0) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`'--groups' does not take ${refused.join(', ')}. It takes ${GROUPS.join(', ')}.`,\n\t\t\t)\n\t\t}\n\t\treturn GROUPS.filter((group) => requested.includes(group))\n\t}\n\n\t// The fleet packages a comma-separated selection names.\n\t#packages(selection: string | undefined): readonly string[] {\n\t\tif (selection === undefined) return []\n\t\tconst requested = selection.split(',')\n\t\tconst refused = requested.filter((name) => !DEPENDENCY_NAME_PATTERN.test(name))\n\t\tif (refused.length > 0) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`'--deps' does not take ${refused.join(', ')}. Every name is a published @orkestrel package.`,\n\t\t\t)\n\t\t}\n\t\treturn requested\n\t}\n\n\t// The results of one run, read as one. Written and skipped never overlap\n\t// across the calls a verb makes, because each call answers for its own paths.\n\t#merge(first: MaterializeResult, second: MaterializeResult): MaterializeResult {\n\t\treturn {\n\t\t\ttarget: first.target,\n\t\t\twritten: [...first.written, ...second.written],\n\t\t\tskipped: [...first.skipped, ...second.skipped],\n\t\t\tremoved: [...first.removed, ...second.removed],\n\t\t}\n\t}\n\n\t// Name every surface baseline after a network read forced a floor.\n\t#reportBaselines(provenance: Provenance): void {\n\t\tconst baselines: string[] = []\n\t\tif (provenance.versions !== undefined) {\n\t\t\tbaselines.push(`versions=${provenance.versions}`)\n\t\t}\n\t\tif (provenance.guides !== undefined) baselines.push(`guides=${provenance.guides}`)\n\t\tif (provenance.host !== undefined) baselines.push(`host=${provenance.host}`)\n\t\tthis.#warn(`Upstream fallback selected the distributed baseline: ${baselines.join(', ')}.`)\n\t}\n\n\t// The audit as a person reads it: every advisory first, then one row per path\n\t// that differs, then the summary. An aligned path is not listed, because a\n\t// report of everything that is fine is a report nobody reads.\n\t#present(audit: Audit): void {\n\t\tfor (const question of audit.questions) this.#warn(`${question.field}: ${question.message}`)\n\t\tconst rows = audit.findings\n\t\t\t.filter((finding) => finding.drift !== 'aligned')\n\t\t\t.map((finding) => [finding.path, finding.group, finding.drift])\n\t\tif (rows.length > 0) {\n\t\t\tconst table = renderTable({\n\t\t\t\tcolumns: [{ label: 'path' }, { label: 'group' }, { label: 'drift' }],\n\t\t\t\trows,\n\t\t\t})\n\t\t\tfor (const line of table.split('\\n')) this.#say(line)\n\t\t}\n\t\tthis.#say(auditToSummary(audit))\n\t}\n\n\t// Report failed release reads and exact fleet drift beside the audit.\n\t#reportReleases(releases: readonly Release[]): void {\n\t\tfor (const release of releases) {\n\t\t\tif (release.lookup !== 'found') {\n\t\t\t\tthis.#warn(`${release.name}: ${release.note}`)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (release.name.startsWith('@orkestrel/') && release.range !== `^${release.latest}`) {\n\t\t\t\tthis.#warn(`${release.name}: ${release.range} differs from ^${release.latest}.`)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Name each stale content path the verb replaced, beside the line-count\n\t// difference between the bytes it audited and the bytes its terminal audit\n\t// read back. Missing paths are creations and never enter this report.\n\t#reportReplacements(before: Audit, after: Audit): void {\n\t\tconst terminal = new Map(after.findings.map((finding) => [finding.path, finding]))\n\t\tfor (const finding of before.findings) {\n\t\t\tif (finding.drift !== 'stale') continue\n\t\t\tconst current = terminal.get(finding.path)\n\t\t\tif (current?.drift !== 'aligned' || current.observed === undefined) continue\n\t\t\tconst previousLines = Buffer.from(finding.observed, 'hex')\n\t\t\t\t.toString('utf8')\n\t\t\t\t.split(/\\r\\n|\\r|\\n/u).length\n\t\t\tconst currentLines = Buffer.from(current.observed, 'hex')\n\t\t\t\t.toString('utf8')\n\t\t\t\t.split(/\\r\\n|\\r|\\n/u).length\n\t\t\tconst delta = currentLines - previousLines\n\t\t\tif (delta === 0) {\n\t\t\t\tthis.#say(`${finding.path} replaced (0-line delta).`)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tconst count = Math.abs(delta)\n\t\t\tthis.#say(\n\t\t\t\t`${finding.path} replaced (${String(count)} line${count === 1 ? '' : 's'} ${delta > 0 ? 'added' : 'removed'}).`,\n\t\t\t)\n\t\t}\n\t}\n\n\t// The catalog outcome as a person reads it.\n\t#recount(result: CatalogResult): void {\n\t\tthis.#say(this.#tally(result))\n\t\tthis.#say(\n\t\t\t`${String(result.entries.length)} published, ${String(result.mirrors.filter((mirror) => mirror.lookup === 'found').length)} guide${result.mirrors.length === 1 ? '' : 's'} fetched, ${String(result.dropped.length)} no longer listed.`,\n\t\t)\n\t\tfor (const mirror of result.mirrors) {\n\t\t\tif (mirror.lookup !== 'found') this.#warn(`${mirror.name}: ${mirror.note}`)\n\t\t}\n\t}\n\n\t// One line stating what a mutation did.\n\t#tally(result: MaterializeResult): string {\n\t\treturn `${String(result.written.length)} written, ${String(result.skipped.length)} unchanged, ${String(result.removed.length)} removed in ${result.target}.`\n\t}\n\n\t// The one machine-readable value a `--json` run emits.\n\t#report(value: unknown): void {\n\t\tthis.#say(JSON.stringify(value))\n\t}\n\n\t// Report a refusal under the code it carries and answer with the code it\n\t// earned: a command line that was not a command is a usage error, and\n\t// everything else is a failed run.\n\t#refuse(error: unknown, json: boolean): number {\n\t\tconst envelope = errorToEnvelope(error)\n\t\tif (json) this.#report(envelope)\n\t\telse this.#warn(`${envelope.error.code}: ${envelope.error.message}`)\n\t\treturn isUsageError(error) ? EXIT_USAGE : EXIT_DRIFT\n\t}\n\n\t#say(line: string): void {\n\t\tthis.#output(this.#sanitize(line))\n\t}\n\n\t#warn(line: string): void {\n\t\tthis.#diagnostic(this.#sanitize(line))\n\t}\n\n\t// The single write path, and the only place hostile bytes are answered for.\n\t// A refusal quotes the argument that caused it, so an escape sequence, a bell,\n\t// or a forged second line arrives here inside otherwise ordinary prose. ANSI\n\t// escapes go first because they are what repaints a terminal, control\n\t// characters next, and what remains is folded onto one line because a handler\n\t// takes one line and a caller writing a record per call must get one record.\n\t#sanitize(line: string): string {\n\t\treturn stripControls(strip(line)).split(/\\r?\\n/).join(' ')\n\t}\n}\n","// The executable entry, and the only module that touches process state: it reads\n// the arguments the process was given and assigns the code the run returned. The\n// `#!/usr/bin/env node` shebang is re-emitted by the build's `output.banner`\n// rather than written here, because the bundler strips a shebang from source.\nimport { CLI } from './CLI.js'\nimport { environmentToUpstream } from './helpers.js'\n\nprocess.stdout.on('error', (error) => {\n\tif ('code' in error && error.code === 'EPIPE') return\n\tthrow error\n})\nprocess.exitCode = await new CLI({ upstream: environmentToUpstream(process.env) }).execute(\n\tprocess.argv.slice(2),\n)\n"],"mappings":";;;;;;;;;;;;;;;;;AAWA,IAAa,kBAAkB;;;;;;;;;AAU/B,IAAa,QAAyB,OAAO,OAAO;CACnD;CACA;CACA;CACA;CACA;AACD,CAAC;;;;;;;;AAkBD,IAAa,eAAiD,OAAO,OAAO;EAC7D,IAAA;EACA,IAAA;EACA,IAAA;AACf,CAAC;;;;;;;;;;AAWD,IAAa,aAAa;;AAG1B,IAAa,cAAc;;AAG3B,IAAa,iBAAiB;;;;;;;;AAS9B,IAAa,gBAAgB;;;;;;;;;;;;;;AAe7B,IAAa,kBAA0C,OAAO,OAAO;CACpE,KAAK,OAAO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AW,gBAAgB,KAAK;EACtC,IAAI,MAAM,KAAKc,QAAQ,QAAQ;OAC1B,KAAKa,MAAM,GAAG,SAAS,MAAM,KAAK,IAAI,SAAS,MAAM,SAAS;EACnE,OAAO,aAAa,KAAK,IAAA,IAAA;CAC1B;CAEA,KAAK,MAAoB;EACxB,KAAK9B,QAAQ,KAAK+C,UAAU,IAAI,CAAC;CAClC;CAEA,MAAM,MAAoB;EACzB,KAAK9C,YAAY,KAAK8C,UAAU,IAAI,CAAC;CACtC;CAQA,UAAU,MAAsB;EAC/B,OAAO,cAAc,MAAM,IAAI,CAAC,CAAC,CAAC,MAAM,OAAO,CAAC,CAAC,KAAK,GAAG;CAC1D;AACD;;;AC97CA,QAAQ,OAAO,GAAG,UAAU,UAAU;CACrC,IAAI,UAAU,SAAS,MAAM,SAAS,SAAS;CAC/C,MAAM;AACP,CAAC;AACD,QAAQ,WAAW,MAAM,IAAI,IAAI,EAAE,UAAU,sBAAsB,QAAQ,GAAG,EAAE,CAAC,CAAC,CAAC,QAClF,QAAQ,KAAK,MAAM,CAAC,CACrB"}
|
|
1
|
+
{"version":3,"file":"main.js","names":["#stdout","#stderr","#output","#diagnostic","#upstream","#say","#refuse","#dispatch","#create","#inspect","#restore","#refresh","#replace","#environments","#packages","#compile","#versions","#assertVersions","#host","#report","#tally","#reportBaselines","#manifest","#derive","#groups","#targetQuestions","#survey","#present","#reportReleases","#assertTarget","#merge","#reportReplacements","#warn","#previous","#fetch","#catalogReleases","#pin","#assertFetched","#publish","#recount","#worktree","#offline","#reconcile","#lookup","#probe","#invocations","#projectQuestion","#dependencyQuestion","#setupQuestion","#inventory","#sanitize"],"sources":["../../src/bin/constants.ts","../../src/bin/errors.ts","../../src/bin/helpers.ts","../../src/bin/CLI.ts","../../src/bin/main.ts"],"sourcesContent":["import type { ParseArgsOptionsConfig } from 'node:util'\nimport type { Verb } from './types.js'\n\n/**\n * The name the executable installs as.\n *\n * @remarks\n * `package.json`'s `bin` field is the authority for what the command is called;\n * this is the same word, so every usage line the executable prints is a command\n * a reader can paste back.\n */\nexport const EXECUTABLE_NAME = 'scaffold'\n\n/**\n * The {@link Verb} values in usage order, frozen.\n *\n * @remarks\n * The order the type declares them in, which is also the order usage lists them:\n * the verb that creates a workspace, then the one that only reads it, then the\n * ones that write to one that already exists, widest last.\n */\nexport const VERBS: readonly Verb[] = Object.freeze([\n\t'new',\n\t'audit',\n\t'repair',\n\t'catalog',\n\t'overwrite',\n])\n\n/** The exit code reporting that the target matched its plan and every step completed. */\nexport const EXIT_CLEAN = 0\n\n/** The exit code reporting that the target drifted, or that a step failed. */\nexport const EXIT_DRIFT = 1\n\n/** The exit code reporting that the command line was not a command. */\nexport const EXIT_USAGE = 2\n\n/**\n * What each exit code means, frozen.\n *\n * @remarks\n * Keyed by the code constants rather than by literals, so the usage block\n * cannot document a code the executable does not return.\n */\nexport const EXIT_SUMMARY: Readonly<Record<number, string>> = Object.freeze({\n\t[EXIT_CLEAN]: 'clean',\n\t[EXIT_DRIFT]: 'drift or failure',\n\t[EXIT_USAGE]: 'usage error',\n})\n\n/**\n * The machine-readable code a malformed command line reports.\n *\n * @remarks\n * The executable contributes its own codes to the failure envelope, which is why\n * that envelope's `code` is a plain string rather than a `ScaffoldErrorCode`: a\n * command line that never became a command failed before any coded package\n * operation could.\n */\nexport const USAGE_CODE = 'USAGE'\n\n/** The machine-readable code a failure carrying no code of its own reports. */\nexport const FAILED_CODE = 'FAILED'\n\n/** What the failure envelope says when the raised value carried no message. */\nexport const FAILED_MESSAGE = 'The command failed for an unrecognized reason'\n\n/**\n * The positional argument `new` alone takes, as usage writes it.\n *\n * @remarks\n * The workspace name is the only positional argument any verb takes, so it is\n * one value rather than a per-verb table with holes in it.\n */\nexport const NAME_ARGUMENT = '<name>'\n\n/**\n * Every option the executable accepts, as `node:util` parses them, frozen.\n *\n * @remarks\n * One table for every verb rather than one per verb, because the verb an option\n * belongs to is a domain fact the command union already fixes: parsing decides\n * only whether the word is an option at all, and {@link VERB_OPTIONS} decides\n * whether this verb takes it. No option declares a default, so the parsed keys\n * are exactly the options the caller supplied, which is what makes an option\n * offered to the wrong verb visible rather than silently absorbed. `from`\n * collects repeats because `catalog` may draw on more than one local source; a\n * verb that takes it once refuses the second.\n */\nexport const COMMAND_OPTIONS: ParseArgsOptionsConfig = Object.freeze({\n\tsrc: Object.freeze({ type: 'string' }),\n\tapp: Object.freeze({ type: 'string' }),\n\tbin: Object.freeze({ type: 'boolean' }),\n\tdeps: Object.freeze({ type: 'string' }),\n\tgroups: Object.freeze({ type: 'string' }),\n\tall: Object.freeze({ type: 'boolean' }),\n\tdirty: Object.freeze({ type: 'boolean' }),\n\toffline: Object.freeze({ type: 'boolean' }),\n\tfrom: Object.freeze({ type: 'string', multiple: true }),\n\ttarget: Object.freeze({ type: 'string' }),\n\tjson: Object.freeze({ type: 'boolean' }),\n})\n\n/**\n * What each option does, keyed by the token usage prints, frozen.\n *\n * @remarks\n * The key order is the glossary order. A key is the whole displayed token,\n * value placeholder included, because that token is what a reader copies and\n * what {@link VERB_OPTIONS} lists.\n */\nexport const OPTION_SUMMARY: Readonly<Record<string, string>> = Object.freeze({\n\t'--src <list>': 'the published library environments to build: core, browser, server',\n\t'--app <list>': 'the private application environments to build: core, browser, server',\n\t'--bin': 'scaffold a command-line executable at src/bin/main.ts',\n\t'--deps <list>': 'the @orkestrel/* packages the workspace depends on',\n\t'--groups <list>': 'the artifact groups to cover; every group when absent',\n\t'--all':\n\t\t'fetch a guide for every package the organization publishes, not the declared ones alone',\n\t'--dirty': 'delete from a tree carrying uncommitted changes',\n\t'--offline': 'use the distributed dependency and vendored-host floors without reading upstream',\n\t'--from <path>':\n\t\t'read the data root from a local path instead of the bundled one; catalog alone accepts it more than once',\n\t'--target <path>': 'the directory the verb operates on; the working directory when absent',\n\t'--json': 'emit one machine-readable value instead of a report',\n\tORKESTREL_SCAFFOLD_REGISTRY: 'the registry base mapped to upstream.registry.base',\n\tORKESTREL_SCAFFOLD_REPOSITORY: 'the repository base mapped to upstream.repository.base',\n})\n\n/**\n * The options each verb takes, in usage order, frozen.\n *\n * @remarks\n * The executable's half of the frozen command union: every option a branch\n * declares is listed against its verb, and every option a branch excludes is\n * absent from it. An option a verb does not list is refused by name rather than\n * parsed and ignored.\n */\nexport const VERB_OPTIONS: Readonly<Record<Verb, readonly string[]>> = Object.freeze({\n\tnew: Object.freeze([\n\t\t'--src <list>',\n\t\t'--app <list>',\n\t\t'--bin',\n\t\t'--deps <list>',\n\t\t'--offline',\n\t\t'--from <path>',\n\t\t'--target <path>',\n\t\t'--json',\n\t]),\n\taudit: Object.freeze([\n\t\t'--groups <list>',\n\t\t'--offline',\n\t\t'--from <path>',\n\t\t'--target <path>',\n\t\t'--json',\n\t]),\n\trepair: Object.freeze([\n\t\t'--groups <list>',\n\t\t'--offline',\n\t\t'--from <path>',\n\t\t'--target <path>',\n\t\t'--json',\n\t]),\n\tcatalog: Object.freeze(['--all', '--from <path>', '--target <path>', '--json']),\n\toverwrite: Object.freeze([\n\t\t'--groups <list>',\n\t\t'--dirty',\n\t\t'--offline',\n\t\t'--from <path>',\n\t\t'--target <path>',\n\t\t'--json',\n\t]),\n})\n\n/**\n * What each verb does, in one line, frozen.\n *\n * @remarks\n * Each line names what the verb writes, because authority is the verb's: a\n * reader deciding which one to run is deciding what they are authorizing.\n */\nexport const VERB_SUMMARY: Readonly<Record<Verb, string>> = Object.freeze({\n\tnew: 'scaffold a workspace',\n\taudit: 'report how the target compares to its plan, writing nothing',\n\trepair: 'write each planned path the target is missing or has let drift',\n\tcatalog: 'regenerate the package table and refresh the guide mirrors',\n\toverwrite:\n\t\t'do everything repair and catalog do, then delete what the plan does not own and re-declare the dependency ranges',\n})\n","import { USAGE_CODE } from './constants.js'\n\n/**\n * The error raised when a command line is not a command.\n *\n * @remarks\n * Distinct from `ScaffoldError` because they answer different questions and\n * exit differently: a `ScaffoldError` says the package could not serve a\n * well-formed request and exits `1`, while this says there was no request to\n * serve and exits `2`. Folding a usage error into `INVALID` would report a\n * mistyped flag as a failed run.\n *\n * It carries no `context`. Everything a caller can act on is in the message,\n * because the reader of a usage error is a person at a terminal rather than a\n * program branching on a cause.\n *\n * @example\n * ```ts\n * import { isUsageError, UsageError } from './errors.js'\n *\n * try {\n * \tthrow new UsageError(\"Unknown command 'pull'.\")\n * } catch (error) {\n * \tif (isUsageError(error)) error.code // 'USAGE'\n * }\n * ```\n */\nexport class UsageError extends Error {\n\treadonly code: string\n\n\t/**\n\t * Construct a usage error.\n\t *\n\t * @param message - What was wrong with the command line, in one sentence.\n\t */\n\tconstructor(message: string) {\n\t\tsuper(message)\n\t\tthis.name = 'UsageError'\n\t\tthis.code = USAGE_CODE\n\t}\n}\n\n/**\n * Narrow a caught value to a {@link UsageError}.\n *\n * @param value - The caught value to narrow.\n * @returns `true` when `value` is a {@link UsageError}.\n *\n * @example\n * ```ts\n * import { isUsageError } from './errors.js'\n *\n * isUsageError(new Error('plain')) // false\n * isUsageError(undefined) // false\n * ```\n */\nexport function isUsageError(value: unknown): value is UsageError {\n\treturn value instanceof UsageError\n}\n","import type { Audit, Blueprint, Dependency, DependencyPinSet, Question, Release } from '@src/core'\nimport type { CLICommand, ErrorEnvelope, Verb } from './types.js'\nimport type { UpstreamOptions } from '@src/server'\nimport { align, width } from '@orkestrel/console'\nimport { attempt, isRecord, isString, parseJSON } from '@orkestrel/contract'\nimport {\n\tblueprintToDevDependencies,\n\tcompareVersions,\n\textractRangeMajor,\n\textractVersion,\n\tisScaffoldError,\n\tmanifestToDependencies,\n} from '@src/core'\nimport { parseArgs } from 'node:util'\nimport {\n\tCOMMAND_OPTIONS,\n\tEXECUTABLE_NAME,\n\tEXIT_CLEAN,\n\tEXIT_DRIFT,\n\tEXIT_SUMMARY,\n\tFAILED_CODE,\n\tFAILED_MESSAGE,\n\tNAME_ARGUMENT,\n\tOPTION_SUMMARY,\n\tVERB_OPTIONS,\n\tVERB_SUMMARY,\n\tVERBS,\n} from './constants.js'\nimport { isUsageError, UsageError } from './errors.js'\n\n/**\n * Read the option name out of the token usage displays it as.\n *\n * @param option - The displayed token, such as `--from <path>`.\n * @returns The bare name `node:util` parses the option under.\n *\n * @remarks\n * One token serves both readers: a person reads the value placeholder and the\n * parser reads the name in front of it. Deriving the name means a documented\n * option and an accepted option cannot be separate lists.\n *\n * @example\n * ```ts\n * import { optionToName } from './helpers.js'\n *\n * optionToName('--from <path>') // 'from'\n * optionToName('--json') // 'json'\n * ```\n */\nexport function optionToName(option: string): string {\n\tconst [token = option] = option.split(' ')\n\treturn token.startsWith('--') ? token.slice(2) : token\n}\n\n/**\n * Project process environment endpoints into upstream reader options.\n *\n * @param environment - The process environment to read.\n * @returns The configured endpoint groups, or `undefined` when neither endpoint\n * is configured.\n */\nexport function environmentToUpstream(\n\tenvironment: Readonly<Record<string, string | undefined>>,\n): UpstreamOptions | undefined {\n\tconst registry = environment.ORKESTREL_SCAFFOLD_REGISTRY\n\tconst repository = environment.ORKESTREL_SCAFFOLD_REPOSITORY\n\tif (registry === undefined && repository === undefined) return undefined\n\treturn {\n\t\t...(registry === undefined ? {} : { registry: { base: registry } }),\n\t\t...(repository === undefined ? {} : { repository: { base: repository } }),\n\t}\n}\n\n/**\n * Render one verb's synopsis.\n *\n * @param verb - The verb to describe.\n * @returns The command line this verb accepts, with every option bracketed.\n *\n * @remarks\n * The synopsis is derived from the verb's own option list rather than stored\n * beside it, so a line that documents an option the verb does not take cannot be\n * written. `new` alone carries the positional argument.\n *\n * @example\n * ```ts\n * import { verbToSyntax } from './helpers.js'\n *\n * verbToSyntax('audit') // 'scaffold audit [--groups <list>] …'\n * ```\n */\nexport function verbToSyntax(verb: Verb): string {\n\tconst argument = verb === 'new' ? ` ${NAME_ARGUMENT}` : ''\n\tconst options = VERB_OPTIONS[verb].map((option) => `[${option}]`).join(' ')\n\treturn `${EXECUTABLE_NAME} ${verb}${argument} ${options}`\n}\n\n/**\n * Render the whole command reference.\n *\n * @returns One line per output call: the synopsis, every verb, the option glossary, and the exit codes.\n *\n * @remarks\n * Returned as lines because the executable writes through a handler that takes\n * one line, so the caller never has to split a block back apart. The glossary is\n * printed once for every verb rather than repeated per verb, because\n * `--from <path>`, `--target <path>`, and `--json` are shared by every verb and\n * a reader comparing two verbs wants the difference, not the repetition.\n */\nexport function renderUsage(): readonly string[] {\n\tconst summaries = Object.entries(OPTION_SUMMARY)\n\tconst column = Math.max(...summaries.map(([option]) => width(option)))\n\treturn [\n\t\t`${EXECUTABLE_NAME} <verb> [options]`,\n\t\t'',\n\t\t...VERBS.flatMap((verb) => [` ${verbToSyntax(verb)}`, ` ${VERB_SUMMARY[verb]}`]),\n\t\t'',\n\t\t'options',\n\t\t...summaries.map(([option, summary]) => ` ${align(option, column)} ${summary}`),\n\t\t'',\n\t\t'exit codes',\n\t\t...Object.entries(EXIT_SUMMARY).map(([code, meaning]) => ` ${code} ${meaning}`),\n\t]\n}\n\n/**\n * Read one command out of the arguments following the executable's own name.\n *\n * @param argv - The arguments the executable was given.\n * @returns The command the arguments denote.\n * @throws {@link UsageError} when they denote no command.\n *\n * @remarks\n * The one place untrusted argument text becomes a domain value, and it stays one\n * function because the command union admits no partial command to hand on: every\n * refusal has to happen before the value exists. It refuses in these ways, each\n * naming what was wrong — a word that is not a verb, a word that is not an\n * option, an option this verb does not take, and an argument this verb does not\n * take. `node:util` decides the unknown option and this decides the rest, so an unknown\n * option is reported by the parser that found it rather than re-derived here.\n *\n * A request for usage is not a command and never reaches this: the caller\n * answers it first.\n *\n * @example\n * ```ts\n * import { argvToCommand } from './helpers.js'\n *\n * argvToCommand(['audit', '--json']) // { verb: 'audit', json: true }\n * ```\n */\nexport function argvToCommand(argv: readonly string[]): CLICommand {\n\tconst [head, ...rest] = argv\n\tconst verb = VERBS.find((candidate) => candidate === head)\n\tif (verb === undefined) {\n\t\tconst found = head === undefined ? 'No command given.' : `Unknown command '${head}'.`\n\t\tthrow new UsageError(`${found} Run '${EXECUTABLE_NAME} --help' for the command list.`)\n\t}\n\tconst parsed = attempt(() =>\n\t\tparseArgs({ args: rest, options: COMMAND_OPTIONS, allowPositionals: true, strict: true }),\n\t)\n\tif (!parsed.success) {\n\t\tconst cause = parsed.error\n\t\tthrow new UsageError(\n\t\t\tcause instanceof Error ? cause.message : `Could not read the arguments to '${verb}'.`,\n\t\t)\n\t}\n\tconst { positionals, values } = parsed.value\n\tconst accepted = VERB_OPTIONS[verb].map((option) => optionToName(option))\n\tconst refused = Object.keys(values).filter((name) => !accepted.includes(name))\n\tif (refused.length > 0) {\n\t\tconst names = refused.map((name) => `--${name}`).join(', ')\n\t\tthrow new UsageError(`'${verb}' does not take ${names}.`)\n\t}\n\tconst [name] = positionals\n\tif (positionals.length > 1) {\n\t\tthrow new UsageError(\n\t\t\t`'${verb}' takes at most one argument, and was given ${String(positionals.length)}.`,\n\t\t)\n\t}\n\tif (verb !== 'new' && name !== undefined) {\n\t\tthrow new UsageError(`'${verb}' takes no argument, and was given '${name}'.`)\n\t}\n\tconst paths = Array.isArray(values.from)\n\t\t? values.from.filter((value) => typeof value === 'string')\n\t\t: []\n\tif (verb !== 'catalog' && paths.length > 1) {\n\t\tthrow new UsageError(\n\t\t\t`'${verb}' takes --from once, and was given it ${String(paths.length)} times.`,\n\t\t)\n\t}\n\tconst src = typeof values.src === 'string' ? values.src : undefined\n\tconst app = typeof values.app === 'string' ? values.app : undefined\n\tconst bin = values.bin === true\n\tconst offline = values.offline === true\n\tconst dependencies = typeof values.deps === 'string' ? values.deps : undefined\n\tconst target = typeof values.target === 'string' ? values.target : undefined\n\tconst json = values.json === true\n\tconst [from] = paths\n\tconst location = target === undefined ? {} : { target }\n\tconst source = from === undefined ? {} : { from }\n\tconst selection = typeof values.groups === 'string' ? { groups: values.groups } : {}\n\tswitch (verb) {\n\t\tcase 'new':\n\t\t\tif (name === undefined) {\n\t\t\t\tthrow new UsageError(`'new' needs the workspace ${NAME_ARGUMENT} it is scaffolding.`)\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tverb,\n\t\t\t\tname,\n\t\t\t\tjson,\n\t\t\t\t...location,\n\t\t\t\t...source,\n\t\t\t\t...(src === undefined ? {} : { src }),\n\t\t\t\t...(app === undefined ? {} : { app }),\n\t\t\t\t...(bin ? { bin } : {}),\n\t\t\t\t...(offline ? { offline } : {}),\n\t\t\t\t...(dependencies === undefined ? {} : { dependencies }),\n\t\t\t}\n\t\tcase 'audit':\n\t\t\treturn { verb, json, ...location, ...source, ...selection, ...(offline ? { offline } : {}) }\n\t\tcase 'repair':\n\t\t\treturn { verb, json, ...location, ...source, ...selection, ...(offline ? { offline } : {}) }\n\t\tcase 'catalog':\n\t\t\treturn {\n\t\t\t\tverb,\n\t\t\t\tjson,\n\t\t\t\tall: values.all === true,\n\t\t\t\t...location,\n\t\t\t\t...(paths.length === 0 ? {} : { from: paths }),\n\t\t\t}\n\t\tcase 'overwrite':\n\t\t\treturn {\n\t\t\t\tverb,\n\t\t\t\tjson,\n\t\t\t\tdirty: values.dirty === true,\n\t\t\t\t...(offline ? { offline } : {}),\n\t\t\t\t...location,\n\t\t\t\t...source,\n\t\t\t\t...selection,\n\t\t\t}\n\t}\n}\n\n/**\n * Read the exit code an audit reports.\n *\n * @param audit - The comparison of a plan against a target.\n * @returns `EXIT_CLEAN` when the target matched the plan, `EXIT_DRIFT` otherwise.\n *\n * @remarks\n * One rule for every verb that carries an audit, so `audit`, `repair`, and\n * `overwrite` cannot disagree about what a clean run is. A blocking question\n * means the gate refused the blueprint, so the audit says nothing about the\n * target and the run is a failure. A foreign finding counts: the target holds a\n * file the plan does not own, which is a difference from the plan whether or not\n * this verb was allowed to remove it. A non-blocking question rides a complete\n * result and does not.\n *\n * @example\n * ```ts\n * import { auditToExit } from './helpers.js'\n *\n * auditToExit({ findings: [], questions: [] }) // 0\n * ```\n */\nexport function auditToExit(audit: Audit): number {\n\tconst blocked = audit.questions.some((question) => question.blocking)\n\tconst drifted = audit.findings.some((finding) => finding.drift !== 'aligned')\n\treturn blocked || drifted ? EXIT_DRIFT : EXIT_CLEAN\n}\n\n/**\n * Read the runtime and development rows a writing verb may raise.\n *\n * @param manifest - The target manifest text.\n * @param blueprint - The workspace shape that supplies the planned tool set.\n * @returns The declared fleet rows and planned foreign tools in their writable sections.\n */\nexport function manifestToWritableDependencies(\n\tmanifest: string,\n\tblueprint: Blueprint,\n): DependencyPinSet {\n\tconst declared = manifestToDependencies(manifest)\n\tconst runtime = [...dependenciesToFleet(declared.runtime)]\n\tconst development = [...dependenciesToFleet(declared.development)]\n\tconst parsed = parseJSON(manifest)\n\tif (!isRecord(parsed)) return { runtime, development }\n\tconst runtimeRecord = isRecord(parsed.dependencies) ? parsed.dependencies : {}\n\tconst developmentRecord = isRecord(parsed.devDependencies) ? parsed.devDependencies : {}\n\tfor (const name of Object.keys(blueprintToDevDependencies(blueprint)).sort()) {\n\t\tif (name.startsWith('@orkestrel/')) continue\n\t\tconst runtimeRange = runtimeRecord[name]\n\t\tif (isString(runtimeRange)) {\n\t\t\truntime.push({ name, range: runtimeRange })\n\t\t\tcontinue\n\t\t}\n\t\tconst developmentRange = developmentRecord[name]\n\t\tif (isString(developmentRange)) development.push({ name, range: developmentRange })\n\t}\n\treturn { runtime, development }\n}\n\n/**\n * Keep only dependencies published by the Orkestrel fleet.\n *\n * @param dependencies - The declared dependencies to inspect.\n * @returns The fleet declarations in their original order.\n */\nexport function dependenciesToFleet(dependencies: readonly Dependency[]): readonly Dependency[] {\n\treturn dependencies.filter((dependency) => dependency.name.startsWith('@orkestrel/'))\n}\n\n/**\n * Project declared concrete ranges to their distributed release floors.\n *\n * @param dependencies - The declarations whose floor versions to read.\n * @returns One found floor per declaration, or `undefined` when any range names\n * no concrete version.\n */\nexport function dependenciesToFloors(\n\tdependencies: readonly Dependency[],\n): readonly Release[] | undefined {\n\tconst releases: Release[] = []\n\tfor (const dependency of dependencies) {\n\t\tconst version =\n\t\t\tdependency.range.startsWith('^') || dependency.range.startsWith('~')\n\t\t\t\t? dependency.range.slice(1)\n\t\t\t\t: dependency.range\n\t\tif (extractVersion(version) === undefined) return undefined\n\t\treleases.push({ ...dependency, lookup: 'found', latest: version })\n\t}\n\treturn releases\n}\n\n/**\n * Read the exit code registry release evidence earns.\n *\n * @param releases - The release verdicts to measure.\n * @returns `EXIT_DRIFT` for a failed lookup or an exact fleet mismatch; `EXIT_CLEAN` otherwise.\n */\nexport function releasesToExit(releases: readonly Release[]): number {\n\treturn releases.some(\n\t\t(release) =>\n\t\t\trelease.lookup !== 'found' ||\n\t\t\t(release.name.startsWith('@orkestrel/') && release.range !== `^${release.latest}`),\n\t)\n\t\t? EXIT_DRIFT\n\t\t: EXIT_CLEAN\n}\n\n/**\n * Project foreign floor and supported-major drift into audit questions.\n *\n * @param releases - The release verdicts to measure.\n * @param served - Alternate release verdicts used to detect a newer served major.\n * @returns One non-blocking question for each stale floor and each crossed major.\n */\nexport function releasesToQuestions(\n\treleases: readonly Release[],\n\tserved: readonly Release[] = releases,\n): readonly Question[] {\n\tconst questions: Question[] = []\n\tfor (const release of releases) {\n\t\tif (release.name.startsWith('@orkestrel/')) continue\n\t\tconst declared = extractRangeMajor(release.range)\n\t\tconst current = release.lookup === 'found' ? release.latest : undefined\n\t\tconst resolved = current === undefined ? undefined : extractVersion(current)\n\t\tconst floor = extractVersion(\n\t\t\trelease.range.startsWith('^') || release.range.startsWith('~')\n\t\t\t\t? release.range.slice(1)\n\t\t\t\t: release.range,\n\t\t)\n\t\tif (\n\t\t\tdeclared !== undefined &&\n\t\t\tcurrent !== undefined &&\n\t\t\tresolved !== undefined &&\n\t\t\tfloor !== undefined &&\n\t\t\tresolved[0] === declared &&\n\t\t\tcompareVersions(current, floor.join('.')) > 0\n\t\t) {\n\t\t\tquestions.push({\n\t\t\t\tfield: 'dependencies',\n\t\t\t\tmessage: `${release.name} declares the floor ${release.range}, while the registry serves ${current} within major ${String(declared)}.`,\n\t\t\t\tblocking: false,\n\t\t\t})\n\t\t}\n\t\tconst alternate = served.find((candidate) => candidate.name === release.name)\n\t\tconst published =\n\t\t\trelease.major ??\n\t\t\t(alternate?.lookup === 'found' ? extractVersion(alternate.latest)?.[0] : undefined)\n\t\tif (declared !== undefined && published !== undefined && declared < published) {\n\t\t\tquestions.push({\n\t\t\t\tfield: 'dependencies',\n\t\t\t\tmessage: `${release.name} declares major ${String(declared)}, while the registry serves major ${String(published)}.`,\n\t\t\t\tblocking: false,\n\t\t\t})\n\t\t}\n\t}\n\treturn questions\n}\n\n/**\n * Project an audit into the human summary of its outcome.\n *\n * @param audit - The comparison to summarize.\n * @returns The refusal, or the planned-path outcome, its grounds, and any foreign-path count.\n *\n * @remarks\n * A blocking question means the gate produced no plan, so the target was not\n * compared and no finding count is reported. Otherwise the grounds\n * describe what this run did. `bytes` means content-owned\n * bytes were observed, `existence` means presence or absence alone decided the\n * finding, and `nothing` means a birth-owned path was not examined. Foreign\n * paths remain a separate population because no planned ownership accounts for\n * them.\n *\n * @example\n * ```ts\n * import { auditToSummary } from './helpers.js'\n *\n * auditToSummary({\n * findings: [],\n * questions: [{ field: 'src', message: 'Core is required.', blocking: true }],\n * })\n * // 'Audit did not compare the target because the blueprint was refused.'\n * ```\n */\nexport function auditToSummary(audit: Audit): string {\n\tif (audit.questions.some((question) => question.blocking)) {\n\t\treturn 'Audit did not compare the target because the blueprint was refused.'\n\t}\n\tconst planned = audit.findings.filter((finding) => finding.drift !== 'foreign')\n\tconst drifted = planned.filter((finding) => finding.drift !== 'aligned').length\n\t// These counts say what decided each verdict on this run. They partition the\n\t// planned findings, so they sum to `planned.length` and never to `drifted`.\n\tconst bytes = planned.filter(\n\t\t(finding) => finding.ownership === 'content' && finding.observed !== undefined,\n\t).length\n\tconst existence = planned.filter(\n\t\t(finding) =>\n\t\t\tfinding.ownership === 'presence' ||\n\t\t\t(finding.ownership === 'content' && finding.drift === 'missing'),\n\t).length\n\tconst nothing = planned.filter((finding) => finding.ownership === 'birth').length\n\tconst foreign = audit.findings.length - planned.length\n\tconst summary = `${String(drifted)} of ${String(planned.length)} planned path${planned.length === 1 ? '' : 's'} drifted from the plan. Audit compared bytes at ${String(bytes)}, existence at ${String(existence)}, and nothing at ${String(nothing)}.`\n\treturn foreign === 0\n\t\t? summary\n\t\t: `${summary} The plan does not own ${String(foreign)} further path${foreign === 1 ? '' : 's'} beneath its groups.`\n}\n\n/**\n * Project a raised value into the machine-readable failure envelope.\n *\n * @param error - The value a command raised.\n * @returns The envelope naming the coded reason and what went wrong.\n *\n * @remarks\n * A `ScaffoldError` and a {@link UsageError} both publish a code, so both are\n * reported under their own. Anything else failed without saying why, and is\n * reported under one code rather than under an invented reading of it; a raised\n * value that is not an `Error` carries no message worth quoting, so the envelope\n * says so instead of stringifying whatever it was.\n *\n * @example\n * ```ts\n * import { errorToEnvelope } from './helpers.js'\n *\n * errorToEnvelope(new Error('boom')) // { error: { code: 'FAILED', message: 'boom' } }\n * ```\n */\nexport function errorToEnvelope(error: unknown): ErrorEnvelope {\n\tif (isUsageError(error) || isScaffoldError(error)) {\n\t\treturn { error: { code: error.code, message: error.message } }\n\t}\n\tconst message = error instanceof Error ? error.message : FAILED_MESSAGE\n\treturn { error: { code: FAILED_CODE, message } }\n}\n","import type {\n\tAudit,\n\tBlueprint,\n\tCatalogEntry,\n\tDependency,\n\tDependencyPinSet,\n\tEnvironment,\n\tGroup,\n\tManifestRegionSet,\n\tMirror,\n\tPlan,\n\tQuestion,\n\tRelease,\n} from '@src/core'\nimport type {\n\tMaterializeResult,\n\tMaterializerInterface,\n\tWorktree,\n\tUpstreamOptions,\n} from '@src/server'\nimport type {\n\tAuditCommand,\n\tAuditResult,\n\tBaseline,\n\tCatalogCommand,\n\tCatalogResult,\n\tCLICommand,\n\tCLIInterface,\n\tCLIOptions,\n\tHostResolution,\n\tNewCommand,\n\tNewResult,\n\tOutputHandler,\n\tOverwriteCommand,\n\tOverwriteResult,\n\tProvenance,\n\tRepairCommand,\n\tRepairResult,\n\tTargetQuestion,\n\tVersionResolution,\n} from './types.js'\nimport { renderTable, strip, stripControls } from '@orkestrel/console'\nimport { attempt, isRecord, isString, parseJSON } from '@orkestrel/contract'\nimport { createMarkdown, flattenText, isTableNode } from '@orkestrel/markdown'\nimport { executeSync } from '@orkestrel/process/server'\nimport {\n\tCATALOG_AGENT_PATH,\n\tBIN_ENTRY_PATH,\n\tblueprintToDevDependencies,\n\tblueprintToRootVite,\n\tblueprintToScripts,\n\tblueprintToTestArtifacts,\n\tblueprintToWritableScripts,\n\tCONFORMANCE_TEST_PATH,\n\tcreateBlueprint,\n\tCompiler,\n\tDEPENDENCY_NAME_PATTERN,\n\tENVIRONMENTS,\n\textractRangeMajor,\n\tGROUPS,\n\tGLOBAL_SETUP_PATH,\n\tGUIDES_TEST_PATH,\n\tHOST_PATHS,\n\tINTEGRATION_TEST_PATH,\n\tisDeferredPath,\n\tmanifestToDependencies,\n\tmanifestToName,\n\tMAX_MANIFEST_BYTES,\n\tnameToGuide,\n\treplaceManifestScripts,\n\treplacePlanRanges,\n\tScaffoldError,\n\tSERVICE_SETUP_PATH,\n\tSHOWCASE_CONFIG_PATH,\n} from '@src/core'\nimport {\n\tMaterializer,\n\tUpstream,\n\tfilesToHost,\n\tisExactCaseFile,\n\tisPhysicalDirectory,\n\tisWorktree,\n\tlistFiles,\n\treadFileText,\n\treadHostFloor,\n\treadSnapshot,\n\tresolveContainedPath,\n} from '@src/server'\nimport { EXIT_CLEAN, EXIT_DRIFT, EXIT_USAGE } from './constants.js'\nimport { isUsageError, UsageError } from './errors.js'\nimport {\n\targvToCommand,\n\tauditToExit,\n\tauditToSummary,\n\tdependenciesToFloors,\n\tdependenciesToFleet,\n\terrorToEnvelope,\n\tmanifestToWritableDependencies,\n\treleasesToExit,\n\treleasesToQuestions,\n\trenderUsage,\n} from './helpers.js'\n\n/**\n * The executable: one command line in, one exit code out.\n *\n * @remarks\n * Every destination this class writes to is a handler it was given, and the run\n * ends by returning its code rather than by setting one, so the whole executable\n * is drivable from inside another process. That is what makes proving what a\n * command prints cost a function call: `src/bin/main.ts` is the only module\n * that reads `process.argv` or assigns `process.exitCode`.\n *\n * Every line leaving here is stripped of ANSI escapes and control characters\n * once, on the way out, because a refusal quotes the argument that caused it and\n * that argument came from an untrusted command line. The machine-readable path\n * needs no second pass: `JSON.stringify` escapes a control character into text\n * before it reaches the handler.\n *\n * The collaborators are constructed per run rather than received, because\n * `--from` decides the vendored root the materializer reads and an instance\n * handed in before the command line was parsed could not honour it. The\n * upstream reader is built the same way but from the options, because no\n * command line names an endpoint: a terminal caller means the published\n * registry and the published guide host, and only the process driving the\n * executable can mean anything else. That is the seam that makes the verbs\n * which read the network provable without one.\n *\n * @example\n * ```ts\n * import { CLI } from './CLI.js'\n *\n * const lines: string[] = []\n * const code = await new CLI({ output: (line) => lines.push(line) }).execute(['--help'])\n * code // 0\n * ```\n */\nexport class CLI implements CLIInterface {\n\t// The destinations a terminal caller means. They are the only process\n\t// streams this class names, and it names them once: a handler is what every\n\t// write goes through, so the default is a handler too rather than a branch at\n\t// each write site.\n\tstatic readonly #stdout: OutputHandler = (line) => void process.stdout.write(`${line}\\n`)\n\tstatic readonly #stderr: OutputHandler = (line) => void process.stderr.write(`${line}\\n`)\n\treadonly #output: OutputHandler\n\treadonly #diagnostic: OutputHandler\n\t// What every upstream reader this class builds is constructed from. It is held\n\t// once and read by each verb that reads the network, so they\n\t// cannot disagree about which registry and which guide host a run addresses.\n\treadonly #upstream: UpstreamOptions | undefined\n\n\t/**\n\t * Construct the executable over the destinations it writes to.\n\t *\n\t * @param options - The report and diagnostic handlers and the upstream\n\t * endpoints; the process streams and the published endpoints when absent.\n\t */\n\tconstructor(options?: CLIOptions) {\n\t\tthis.#output = options?.output ?? CLI.#stdout\n\t\tthis.#diagnostic = options?.diagnostic ?? CLI.#stderr\n\t\tthis.#upstream = options?.upstream\n\t}\n\n\t/**\n\t * Run one command line to completion and report through the configured output.\n\t *\n\t * @param argv - The arguments following the executable's own name.\n\t * @returns The exit code: `0` clean, `1` drift or failure, `2` a usage error.\n\t *\n\t * @remarks\n\t * A request for usage is answered before anything is parsed, because it\n\t * replaces the run rather than modifying it, and because `--help` is not an\n\t * option any verb takes. Everything after that is one command: read it,\n\t * dispatch it, render what it produced, and answer with the code it earned.\n\t *\n\t * @example\n\t * ```ts\n\t * import { CLI } from './CLI.js'\n\t *\n\t * await new CLI().execute(['audit', '--json']) // 0 when the target matches its plan\n\t * ```\n\t */\n\tasync execute(argv: readonly string[]): Promise<number> {\n\t\tif (argv.includes('--help')) {\n\t\t\tfor (const line of renderUsage()) this.#say(line)\n\t\t\treturn EXIT_CLEAN\n\t\t}\n\t\tconst read = attempt(() => argvToCommand(argv))\n\t\t// A command line that never became a command is refused in prose even when\n\t\t// the line carries `--json`, because the flag is read from the command and\n\t\t// no command was read: there is no machine-readable value for it to pollute.\n\t\tif (!read.success) return this.#refuse(read.error, false)\n\t\tconst command = read.value\n\t\ttry {\n\t\t\treturn await this.#dispatch(command)\n\t\t} catch (error) {\n\t\t\treturn this.#refuse(error, command.json === true)\n\t\t}\n\t}\n\n\t// One verb per branch, each answering with its own exit code. The switch is\n\t// exhaustive over the command union, so a new verb fails to compile here.\n\tasync #dispatch(command: CLICommand): Promise<number> {\n\t\tswitch (command.verb) {\n\t\t\tcase 'new':\n\t\t\t\treturn this.#create(command)\n\t\t\tcase 'audit':\n\t\t\t\treturn this.#inspect(command)\n\t\t\tcase 'repair':\n\t\t\t\treturn this.#restore(command)\n\t\t\tcase 'catalog':\n\t\t\t\treturn this.#refresh(command)\n\t\t\tcase 'overwrite':\n\t\t\t\treturn this.#replace(command)\n\t\t}\n\t}\n\n\t// `new` — resolve the declared dependencies against the registry, compile the\n\t// blueprint the command line describes, and write it into a vacant target.\n\tasync #create(command: NewCommand): Promise<number> {\n\t\tconst target = command.target ?? command.name\n\t\tconst blueprint = createBlueprint(command.name, {\n\t\t\tsrc: this.#environments(command.src, 'src'),\n\t\t\tapp: this.#environments(command.app, 'app'),\n\t\t\tbin: command.bin === true,\n\t\t\tsetup: false,\n\t\t\tdependencies: this.#packages(command.dependencies).map((name) => ({\n\t\t\t\tname,\n\t\t\t\trange: '^0.0.0',\n\t\t\t})),\n\t\t})\n\t\tconst plan = this.#compile(blueprint)\n\t\tconst manifest = plan.artifacts.find(\n\t\t\t(artifact) => artifact.path === 'package.json' && artifact.origin !== 'host',\n\t\t)\n\t\tif (manifest === undefined || manifest.origin === 'host') {\n\t\t\tthrow new ScaffoldError('BLOCKED', 'The compiled plan carries no replaceable manifest.')\n\t\t}\n\t\tconst declarations = manifestToDependencies(manifest.content)\n\t\tconst versions = await this.#versions(\n\t\t\t{\n\t\t\t\truntime: dependenciesToFleet(declarations.runtime),\n\t\t\t\tdevelopment: dependenciesToFleet(declarations.development),\n\t\t\t},\n\t\t\tcommand.offline === true,\n\t\t)\n\t\tthis.#assertVersions(versions)\n\t\tconst resolved = replacePlanRanges(plan, versions.pins)\n\t\tif (resolved === undefined) {\n\t\t\tthrow new ScaffoldError('BLOCKED', 'The compiled plan ranges could not be replaced.')\n\t\t}\n\t\tconst host = await this.#host(command.from, undefined, command.offline === true)\n\t\ttry {\n\t\t\tconst result = host.materializer.materialize(resolved, target)\n\t\t\tconst outcome: NewResult = {\n\t\t\t\t...result,\n\t\t\t\tprovenance: {\n\t\t\t\t\t...(versions.baseline === undefined ? {} : { versions: versions.baseline }),\n\t\t\t\t\t...(host.baseline === undefined ? {} : { host: host.baseline }),\n\t\t\t\t},\n\t\t\t}\n\t\t\tif (command.json === true) this.#report(outcome)\n\t\t\telse {\n\t\t\t\tthis.#say(`Scaffolded ${blueprint.name} into ${result.target}.`)\n\t\t\t\tthis.#say(this.#tally(result))\n\t\t\t}\n\t\t\tif (versions.forced || host.forced) this.#reportBaselines(outcome.provenance)\n\t\t\treturn EXIT_CLEAN\n\t\t} finally {\n\t\t\thost.materializer.destroy()\n\t\t}\n\t}\n\n\t// `audit` — compare a target to the plan its own manifest and directories\n\t// describe, through the vendored host a repair would write from, and write\n\t// nothing whatever it finds.\n\t//\n\t// The host is load-bearing here where it once was not, so `--from` reaches the\n\t// comparison and a host that cannot be read refuses the run under its own\n\t// coded reason. Refusing is the honest answer: the comparison this verb\n\t// reports is the hydrated one, and a fallback to the pure compile would report\n\t// `aligned` for exactly the files whose bytes it failed to read.\n\tasync #inspect(command: AuditCommand): Promise<number> {\n\t\tconst target = command.target ?? '.'\n\t\tconst manifest = this.#manifest(target)\n\t\tconst blueprint = this.#derive(target)\n\t\tconst groups = this.#groups(command.groups)\n\t\tconst declared = manifestToWritableDependencies(manifest, blueprint)\n\t\tconst versions = await this.#versions(declared, command.offline === true)\n\t\tconst questions = [\n\t\t\t...this.#targetQuestions(target, blueprint, groups),\n\t\t\t...releasesToQuestions(versions.releases),\n\t\t]\n\t\tconst host = await this.#host(command.from, target, command.offline === true)\n\t\ttry {\n\t\t\tconst [measured] = this.#survey(host.materializer, blueprint, target, groups)\n\t\t\tconst audit: Audit =\n\t\t\t\tquestions.length === 0\n\t\t\t\t\t? measured\n\t\t\t\t\t: { ...measured, questions: [...measured.questions, ...questions] }\n\t\t\tconst outcome: AuditResult = {\n\t\t\t\t...audit,\n\t\t\t\treleases: versions.releases,\n\t\t\t\tprovenance: {\n\t\t\t\t\t...(versions.baseline === undefined ? {} : { versions: versions.baseline }),\n\t\t\t\t\t...(host.baseline === undefined ? {} : { host: host.baseline }),\n\t\t\t\t},\n\t\t\t}\n\t\t\tif (command.json === true) this.#report(outcome)\n\t\t\telse {\n\t\t\t\tthis.#present(audit)\n\t\t\t\tif (command.offline !== true) this.#reportReleases(versions.releases)\n\t\t\t}\n\t\t\tif (versions.forced || host.forced) this.#reportBaselines(outcome.provenance)\n\t\t\tif (command.offline === true) return auditToExit(audit)\n\t\t\treturn Math.max(\n\t\t\t\tauditToExit(audit),\n\t\t\t\treleasesToExit(versions.releases),\n\t\t\t\tversions.forced || host.forced ? EXIT_DRIFT : EXIT_CLEAN,\n\t\t\t)\n\t\t} finally {\n\t\t\thost.materializer.destroy()\n\t\t}\n\t}\n\n\t// `repair` — write each planned path the target is missing or has let drift,\n\t// then re-audit, because the audit a repair reports is the one taken after it.\n\t// One materializer spans the whole verb: the audit that guides the write, the\n\t// write, and the audit that answers for it are readings of one vendored\n\t// host, and a second instance could not promise they were.\n\tasync #restore(command: RepairCommand): Promise<number> {\n\t\tconst target = command.target ?? '.'\n\t\tconst groups = this.#groups(command.groups)\n\t\tconst blueprint = this.#derive(target)\n\t\tthis.#assertTarget(target, blueprint, groups)\n\t\tconst host = await this.#host(command.from, target, command.offline === true)\n\t\ttry {\n\t\t\tconst [audit, plan] = this.#survey(host.materializer, blueprint, target, groups)\n\t\t\tif (plan === undefined) {\n\t\t\t\tif (command.json === true) {\n\t\t\t\t\tthis.#report({\n\t\t\t\t\t\t...audit,\n\t\t\t\t\t\tprovenance: {\n\t\t\t\t\t\t\t...(host.baseline === undefined ? {} : { host: host.baseline }),\n\t\t\t\t\t\t},\n\t\t\t\t\t})\n\t\t\t\t} else this.#present(audit)\n\t\t\t\treturn EXIT_DRIFT\n\t\t\t}\n\t\t\tconst versions = await this.#versions(\n\t\t\t\tmanifestToWritableDependencies(this.#manifest(target), blueprint),\n\t\t\t\tcommand.offline === true,\n\t\t\t)\n\t\t\tthis.#assertVersions(versions)\n\t\t\tconst result = this.#merge(\n\t\t\t\thost.materializer.repair(plan, audit, target),\n\t\t\t\thost.materializer.declare(\n\t\t\t\t\t{ pins: versions.pins, scripts: blueprintToWritableScripts(blueprint) },\n\t\t\t\t\ttarget,\n\t\t\t\t),\n\t\t\t)\n\t\t\tconst [terminal] = this.#survey(host.materializer, this.#derive(target), target, groups)\n\t\t\tconst outcome: RepairResult = {\n\t\t\t\t...result,\n\t\t\t\taudit: terminal,\n\t\t\t\treleases: versions.releases,\n\t\t\t\tprovenance: {\n\t\t\t\t\t...(versions.baseline === undefined ? {} : { versions: versions.baseline }),\n\t\t\t\t\t...(host.baseline === undefined ? {} : { host: host.baseline }),\n\t\t\t\t},\n\t\t\t}\n\t\t\tif (command.json === true) this.#report(outcome)\n\t\t\telse {\n\t\t\t\tthis.#present(terminal)\n\t\t\t\tthis.#reportReplacements(audit, terminal)\n\t\t\t\tthis.#say(this.#tally(result))\n\t\t\t}\n\t\t\tif (versions.forced || host.forced) this.#reportBaselines(outcome.provenance)\n\t\t\tif (command.offline !== true && (versions.forced || host.forced)) return EXIT_DRIFT\n\t\t\treturn auditToExit(terminal)\n\t\t} finally {\n\t\t\thost.materializer.destroy()\n\t\t}\n\t}\n\n\t// `catalog` — regenerate the package table from the organization's published\n\t// list and refresh the guide mirrors the target draws on.\n\tasync #refresh(command: CatalogCommand): Promise<number> {\n\t\tconst target = command.target ?? '.'\n\t\tconst [host, ...extra] = command.from ?? []\n\t\tif (extra.length > 0) {\n\t\t\tthis.#warn(\n\t\t\t\t`Read the data root from ${String(host)}. The other ${String(extra.length)} local root${extra.length === 1 ? '' : 's'} named by --from reach nothing this run does.`,\n\t\t\t)\n\t\t}\n\t\tconst previous = this.#previous(target)\n\t\tconst fetched = await this.#fetch(target, command.all === true)\n\t\tconst declarations = manifestToDependencies(this.#manifest(target))\n\t\tconst writable: DependencyPinSet = {\n\t\t\truntime: dependenciesToFleet(declarations.runtime),\n\t\t\tdevelopment: dependenciesToFleet(declarations.development),\n\t\t}\n\t\tconst releases = this.#catalogReleases(\n\t\t\t[...writable.runtime, ...writable.development],\n\t\t\tfetched.entries,\n\t\t)\n\t\tconst pins = this.#pin(releases, writable)\n\t\tthis.#assertFetched(fetched.entries, fetched.mirrors)\n\t\tconst guides: Baseline | undefined =\n\t\t\tfetched.mirrors.length === 0\n\t\t\t\t? undefined\n\t\t\t\t: fetched.mirrors.some((mirror) => mirror.lookup === 'failed')\n\t\t\t\t\t? 'floor'\n\t\t\t\t\t: 'live'\n\t\tconst materializer = new Materializer({ host: host ?? readHostFloor() })\n\t\tlet result: MaterializeResult\n\t\ttry {\n\t\t\tresult = this.#merge(\n\t\t\t\tthis.#publish(materializer, target, fetched.entries, fetched.mirrors),\n\t\t\t\tmaterializer.declare({ pins, scripts: [] }, target),\n\t\t\t)\n\t\t} finally {\n\t\t\tmaterializer.destroy()\n\t\t}\n\t\tconst outcome: CatalogResult = {\n\t\t\t...result,\n\t\t\tentries: fetched.entries,\n\t\t\tmirrors: fetched.mirrors,\n\t\t\tdropped: previous.filter((name) => !fetched.entries.some((entry) => entry.name === name)),\n\t\t\treleases,\n\t\t\tprovenance: {\n\t\t\t\tversions: 'live',\n\t\t\t\t...(guides === undefined ? {} : { guides }),\n\t\t\t},\n\t\t}\n\t\tif (command.json === true) this.#report(outcome)\n\t\telse this.#recount(outcome)\n\t\treturn guides === 'floor' ? EXIT_DRIFT : EXIT_CLEAN\n\t}\n\n\t// `overwrite` — everything repair and catalog do, plus the steps only this\n\t// verb carries. The offline half runs first and persists whatever it did,\n\t// because it is the destructive one: a run that cannot reach upstream still\n\t// leaves the target repaired and says which step it could not complete.\n\tasync #replace(command: OverwriteCommand): Promise<number> {\n\t\tconst target = command.target ?? '.'\n\t\tconst groups = this.#groups(command.groups)\n\t\tconst blueprint = this.#derive(target)\n\t\tthis.#assertTarget(target, blueprint, groups)\n\t\tconst worktree = this.#worktree(target)\n\t\tif (worktree.dirty.length > 0 && command.dirty !== true) {\n\t\t\tthrow new ScaffoldError(\n\t\t\t\t'TARGET',\n\t\t\t\t`The target at ${target} carries ${String(worktree.dirty.length)} uncommitted change${worktree.dirty.length === 1 ? '' : 's'}. Commit them, or pass --dirty to waive the refusal.`,\n\t\t\t\t{ target, dirty: worktree.dirty.length },\n\t\t\t)\n\t\t}\n\t\tconst host = await this.#host(command.from, target, command.offline === true)\n\t\ttry {\n\t\t\tconst [audit, plan] = this.#survey(host.materializer, blueprint, target, groups)\n\t\t\tif (plan === undefined) {\n\t\t\t\tif (command.json === true) {\n\t\t\t\t\tthis.#report({\n\t\t\t\t\t\t...audit,\n\t\t\t\t\t\tprovenance: {\n\t\t\t\t\t\t\t...(host.baseline === undefined ? {} : { host: host.baseline }),\n\t\t\t\t\t\t},\n\t\t\t\t\t})\n\t\t\t\t} else this.#present(audit)\n\t\t\t\treturn EXIT_DRIFT\n\t\t\t}\n\t\t\tconst declared: ManifestRegionSet = {\n\t\t\t\tpins: manifestToWritableDependencies(this.#manifest(target), blueprint),\n\t\t\t\tscripts: blueprintToWritableScripts(blueprint),\n\t\t\t}\n\t\t\tconst repaired = host.materializer.repair(plan, audit, target)\n\t\t\t// The candidate set is re-derived from the plan and target, then held to\n\t\t\t// the audit's foreign findings. A path the plan claims is never a deletion\n\t\t\t// candidate, and neither is a path outside the vendored directories this\n\t\t\t// plan expands.\n\t\t\t// `--dirty` is expressed here and nowhere else: the waiver clears the\n\t\t\t// refusal the observed dirty set would otherwise trigger downstream, and\n\t\t\t// waives nothing about which paths are eligible.\n\t\t\tconst removed = host.materializer.remove(\n\t\t\t\tplan,\n\t\t\t\taudit,\n\t\t\t\tcommand.dirty === true ? { tracked: worktree.tracked, dirty: [] } : worktree,\n\t\t\t\ttarget,\n\t\t\t)\n\t\t\tconst offline = this.#merge(repaired, removed)\n\t\t\tconst online: Omit<OverwriteResult, 'audit'> =\n\t\t\t\tcommand.offline === true\n\t\t\t\t\t? await this.#offline(host.materializer, target, declared, host.baseline)\n\t\t\t\t\t: await this.#reconcile(host.materializer, target, declared, host.baseline, host.forced)\n\t\t\tconst [terminal] = this.#survey(host.materializer, blueprint, target, groups)\n\t\t\tconst outcome: OverwriteResult = {\n\t\t\t\t...online,\n\t\t\t\t...this.#merge(offline, online),\n\t\t\t\taudit: terminal,\n\t\t\t}\n\t\t\tif (command.json === true) this.#report(outcome)\n\t\t\telse {\n\t\t\t\tthis.#present(terminal)\n\t\t\t\tthis.#reportReplacements(audit, terminal)\n\t\t\t\tthis.#recount(outcome)\n\t\t\t\tif (online.note !== undefined) this.#warn(online.note)\n\t\t\t}\n\t\t\tif (online.note !== undefined) return EXIT_DRIFT\n\t\t\treturn auditToExit(terminal)\n\t\t} finally {\n\t\t\thost.materializer.destroy()\n\t\t}\n\t}\n\n\t// The network half of `overwrite`, collected rather than thrown: the offline\n\t// half has already written, so a step that cannot complete is reported as the\n\t// step it was instead of discarding what already landed. It writes through the\n\t// verb's own materializer rather than opening a second one, so every byte the\n\t// run lands comes from the host the caller named once.\n\tasync #offline(\n\t\tmaterializer: MaterializerInterface,\n\t\ttarget: string,\n\t\tdeclared: ManifestRegionSet,\n\t\thost: Baseline | undefined,\n\t): Promise<Omit<OverwriteResult, 'audit'>> {\n\t\tconst versions = await this.#versions(declared.pins, true)\n\t\tthis.#assertVersions(versions)\n\t\tconst written = materializer.declare({ pins: versions.pins, scripts: declared.scripts }, target)\n\t\treturn {\n\t\t\t...written,\n\t\t\tentries: [],\n\t\t\tmirrors: [],\n\t\t\tdropped: [],\n\t\t\treleases: versions.releases,\n\t\t\tprovenance: {\n\t\t\t\t...(versions.baseline === undefined ? {} : { versions: versions.baseline }),\n\t\t\t\t...(host === undefined ? {} : { host }),\n\t\t\t},\n\t\t\tnote: \"The catalog step did not complete: USAGE: 'catalog' does not take --offline.\",\n\t\t}\n\t}\n\n\tasync #reconcile(\n\t\tmaterializer: MaterializerInterface,\n\t\ttarget: string,\n\t\tdeclared: ManifestRegionSet,\n\t\thost: Baseline | undefined,\n\t\thostForced: boolean,\n\t): Promise<Omit<OverwriteResult, 'audit'>> {\n\t\tconst previous = this.#previous(target)\n\t\tlet releases: readonly Release[] = []\n\t\tlet provenance: Provenance = { ...(host === undefined ? {} : { host }) }\n\t\ttry {\n\t\t\tconst versions = await this.#versions(declared.pins, false)\n\t\t\treleases = versions.releases\n\t\t\tprovenance = {\n\t\t\t\t...(versions.baseline === undefined ? {} : { versions: versions.baseline }),\n\t\t\t\t...(host === undefined ? {} : { host }),\n\t\t\t}\n\t\t\tthis.#assertVersions(versions)\n\t\t\tconst fetched = await this.#fetch(target, false)\n\t\t\tthis.#assertFetched(fetched.entries, fetched.mirrors)\n\t\t\tconst guides: Baseline | undefined =\n\t\t\t\tfetched.mirrors.length === 0\n\t\t\t\t\t? undefined\n\t\t\t\t\t: fetched.mirrors.some((mirror) => mirror.lookup === 'failed')\n\t\t\t\t\t\t? 'floor'\n\t\t\t\t\t\t: 'live'\n\t\t\tprovenance = {\n\t\t\t\t...(versions.baseline === undefined ? {} : { versions: versions.baseline }),\n\t\t\t\t...(guides === undefined ? {} : { guides }),\n\t\t\t\t...(host === undefined ? {} : { host }),\n\t\t\t}\n\t\t\tconst written = this.#merge(\n\t\t\t\tthis.#publish(materializer, target, fetched.entries, fetched.mirrors),\n\t\t\t\tmaterializer.declare({ pins: versions.pins, scripts: declared.scripts }, target),\n\t\t\t)\n\t\t\tconst floors: string[] = []\n\t\t\tif (hostForced) floors.push('host')\n\t\t\tif (versions.forced) floors.push('versions')\n\t\t\tif (guides === 'floor') floors.push('guides')\n\t\t\treturn {\n\t\t\t\t...written,\n\t\t\t\tentries: fetched.entries,\n\t\t\t\tmirrors: fetched.mirrors,\n\t\t\t\tdropped: previous.filter((name) => !fetched.entries.some((entry) => entry.name === name)),\n\t\t\t\treleases,\n\t\t\t\tprovenance,\n\t\t\t\t...(floors.length === 0\n\t\t\t\t\t? {}\n\t\t\t\t\t: {\n\t\t\t\t\t\t\tnote: `The ${floors.join(', ')} step used the distributed floor after its upstream read did not complete.`,\n\t\t\t\t\t\t}),\n\t\t\t}\n\t\t} catch (error) {\n\t\t\treturn {\n\t\t\t\ttarget,\n\t\t\t\twritten: [],\n\t\t\t\tskipped: [],\n\t\t\t\tremoved: [],\n\t\t\t\tentries: [],\n\t\t\t\tmirrors: [],\n\t\t\t\tdropped: [],\n\t\t\t\treleases,\n\t\t\t\tprovenance,\n\t\t\t\tnote: `The catalog step did not complete: ${errorToEnvelope(error).error.message}`,\n\t\t\t}\n\t\t}\n\t}\n\n\t// Resolve the vendored host without letting a partial repository answer reach\n\t// the materializer.\n\tasync #host(\n\t\tfrom: string | undefined,\n\t\ttarget: string | undefined,\n\t\toffline: boolean,\n\t): Promise<HostResolution> {\n\t\tif (from !== undefined) {\n\t\t\treturn { materializer: new Materializer({ host: from }), forced: false }\n\t\t}\n\t\tconst floor = readHostFloor()\n\t\tif (offline) {\n\t\t\treturn {\n\t\t\t\tmaterializer: new Materializer({ host: floor }),\n\t\t\t\tbaseline: 'floor',\n\t\t\t\tforced: false,\n\t\t\t}\n\t\t}\n\t\tconst paths = floor.manifest.entries\n\t\t\t.filter((entry) => !isDeferredPath(entry.destination))\n\t\t\t.map((entry) => entry.destination)\n\t\tconst current = target === undefined ? floor.bytes : readSnapshot(target, paths)\n\t\tconst upstream = new Upstream(this.#upstream)\n\t\ttry {\n\t\t\tconst files = await upstream.read(paths, current)\n\t\t\tconst live = filesToHost(files, floor)\n\t\t\treturn {\n\t\t\t\tmaterializer: new Materializer({ host: live ?? floor }),\n\t\t\t\tbaseline: live === undefined ? 'floor' : 'live',\n\t\t\t\tforced: live === undefined,\n\t\t\t}\n\t\t} finally {\n\t\t\tupstream.destroy()\n\t\t}\n\t}\n\n\t// Resolve one whole version surface. Authoritative absence refuses, while a\n\t// read that did not complete selects every declaration's distributed floor.\n\tasync #versions(declared: DependencyPinSet, offline: boolean): Promise<VersionResolution> {\n\t\tconst dependencies = [...declared.runtime, ...declared.development]\n\t\tif (dependencies.length === 0) {\n\t\t\treturn {\n\t\t\t\treleases: [],\n\t\t\t\tpins: { runtime: [], development: [] },\n\t\t\t\tforced: false,\n\t\t\t\tcomplete: true,\n\t\t\t}\n\t\t}\n\t\tconst floors = dependenciesToFloors(dependencies)\n\t\tconst floorPins: DependencyPinSet | undefined =\n\t\t\tfloors === undefined\n\t\t\t\t? undefined\n\t\t\t\t: {\n\t\t\t\t\t\truntime: floors\n\t\t\t\t\t\t\t.slice(0, declared.runtime.length)\n\t\t\t\t\t\t\t.map((release) => ({ name: release.name, range: release.range })),\n\t\t\t\t\t\tdevelopment: floors\n\t\t\t\t\t\t\t.slice(declared.runtime.length)\n\t\t\t\t\t\t\t.map((release) => ({ name: release.name, range: release.range })),\n\t\t\t\t\t}\n\t\tif (offline) {\n\t\t\tif (floors === undefined || floorPins === undefined) {\n\t\t\t\treturn {\n\t\t\t\t\treleases: [],\n\t\t\t\t\tpins: { runtime: [], development: [] },\n\t\t\t\t\tbaseline: 'floor',\n\t\t\t\t\tforced: false,\n\t\t\t\t\tcomplete: false,\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\treleases: floors,\n\t\t\t\tpins: floorPins,\n\t\t\t\tbaseline: 'floor',\n\t\t\t\tforced: false,\n\t\t\t\tcomplete: true,\n\t\t\t}\n\t\t}\n\t\tconst releases = await this.#lookup(dependencies)\n\t\tconst absent = releases.filter(\n\t\t\t(release) => release.lookup === 'missing' || release.lookup === 'unmatched',\n\t\t)\n\t\tif (absent.length > 0) {\n\t\t\treturn {\n\t\t\t\treleases,\n\t\t\t\tpins: { runtime: [], development: [] },\n\t\t\t\tbaseline: 'live',\n\t\t\t\tforced: false,\n\t\t\t\tcomplete: false,\n\t\t\t}\n\t\t}\n\t\tconst failed = releases.some((release) => release.lookup === 'failed')\n\t\tif (failed) {\n\t\t\tif (floorPins === undefined) {\n\t\t\t\treturn {\n\t\t\t\t\treleases,\n\t\t\t\t\tpins: { runtime: [], development: [] },\n\t\t\t\t\tbaseline: 'floor',\n\t\t\t\t\tforced: true,\n\t\t\t\t\tcomplete: false,\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\treleases,\n\t\t\t\tpins: floorPins,\n\t\t\t\tbaseline: 'floor',\n\t\t\t\tforced: true,\n\t\t\t\tcomplete: true,\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\treleases,\n\t\t\tpins: this.#pin(releases, declared),\n\t\t\tbaseline: 'live',\n\t\t\tforced: false,\n\t\t\tcomplete: true,\n\t\t}\n\t}\n\n\t// Refuse an incomplete version resolution before a caller opens a write.\n\t#assertVersions(versions: VersionResolution): void {\n\t\tif (versions.complete) return\n\t\tconst names = versions.releases\n\t\t\t.filter((release) => release.lookup !== 'found')\n\t\t\t.map((release) => release.name)\n\t\tthrow new ScaffoldError(\n\t\t\t'FETCH',\n\t\t\tnames.length === 0\n\t\t\t\t? 'A declared dependency names no concrete floor.'\n\t\t\t\t: `The registry named no release for ${names.join(', ')}.`,\n\t\t\t{ names: names.length },\n\t\t)\n\t}\n\n\t// Measure each fleet row against the registry's newest release and each\n\t// foreign row against the newest release its declared major admits.\n\tasync #lookup(declared: readonly Dependency[]): Promise<readonly Release[]> {\n\t\tif (declared.length === 0) return []\n\t\tconst upstream = new Upstream(this.#upstream)\n\t\ttry {\n\t\t\tconst releases = await upstream.lookup(\n\t\t\t\tdeclared.map((dependency) => {\n\t\t\t\t\tconst major = extractRangeMajor(dependency.range)\n\t\t\t\t\treturn {\n\t\t\t\t\t\tname: dependency.name,\n\t\t\t\t\t\trange: dependency.name.startsWith('@orkestrel/')\n\t\t\t\t\t\t\t? '*'\n\t\t\t\t\t\t\t: major === undefined\n\t\t\t\t\t\t\t\t? dependency.range\n\t\t\t\t\t\t\t\t: `^${String(major)}`,\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t)\n\t\t\treturn releases.map((release, index): Release => {\n\t\t\t\tconst dependency = declared[index]\n\t\t\t\tif (dependency === undefined) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tname: release.name,\n\t\t\t\t\t\trange: release.range,\n\t\t\t\t\t\tlookup: 'failed',\n\t\t\t\t\t\tnote: 'the release answer has no matching declaration',\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn { ...release, range: dependency.range }\n\t\t\t})\n\t\t} finally {\n\t\t\tupstream.destroy()\n\t\t}\n\t}\n\n\t// Read the organization's published list and the guides the target draws on.\n\t// The workspace never fetches its own guide: that file is its own product.\n\tasync #fetch(\n\t\ttarget: string,\n\t\tall: boolean,\n\t): Promise<{ readonly entries: readonly CatalogEntry[]; readonly mirrors: readonly Mirror[] }> {\n\t\tconst manifest = this.#manifest(target)\n\t\tconst own = manifestToName(manifest)\n\t\tconst dependencies = manifestToDependencies(manifest)\n\t\tconst declared = [\n\t\t\t...new Set(\n\t\t\t\t[...dependencies.runtime, ...dependencies.development, ...dependencies.peer].map(\n\t\t\t\t\t(dependency) => dependency.name,\n\t\t\t\t),\n\t\t\t),\n\t\t]\n\t\tconst upstream = new Upstream(this.#upstream)\n\t\ttry {\n\t\t\tconst entries = await upstream.catalog()\n\t\t\tconst names = (all ? entries.map((entry) => entry.name) : declared).filter(\n\t\t\t\t(name) => name !== own,\n\t\t\t)\n\t\t\tconst mirrors = await upstream.fetch(names, readSnapshot(target, names.map(nameToGuide)))\n\t\t\treturn { entries, mirrors }\n\t\t} finally {\n\t\t\tupstream.destroy()\n\t\t}\n\t}\n\n\t// Write the fetched guides to their mirrors and the published list to the\n\t// marker-bounded table, as one result.\n\t#publish(\n\t\tmaterializer: MaterializerInterface,\n\t\ttarget: string,\n\t\tentries: readonly CatalogEntry[],\n\t\tmirrors: readonly Mirror[],\n\t): MaterializeResult {\n\t\treturn this.#merge(materializer.mirror(mirrors, target), materializer.catalog(entries, target))\n\t}\n\n\t// Derive declared release evidence from the catalog packuments already read.\n\t#catalogReleases(\n\t\tdeclared: readonly Dependency[],\n\t\tentries: readonly CatalogEntry[],\n\t): readonly Release[] {\n\t\treturn declared.map((dependency): Release => {\n\t\t\tconst entry = entries.find((candidate) => candidate.name === dependency.name)\n\t\t\tif (entry?.lookup === 'found') {\n\t\t\t\treturn { ...dependency, lookup: 'found', latest: entry.version }\n\t\t\t}\n\t\t\treturn {\n\t\t\t\t...dependency,\n\t\t\t\tlookup: entry?.lookup ?? 'missing',\n\t\t\t\tnote: entry?.note ?? 'the organization catalog does not list the declared package',\n\t\t\t}\n\t\t})\n\t}\n\n\t// A catalog transaction starts only after every packument and mirror answered.\n\t#assertFetched(entries: readonly CatalogEntry[], mirrors: readonly Mirror[]): void {\n\t\tconst failed = [\n\t\t\t...entries.filter((entry) => entry.lookup !== 'found').map((entry) => entry.name),\n\t\t\t...mirrors\n\t\t\t\t.filter((mirror) => mirror.lookup !== 'found' && mirror.lookup !== 'failed')\n\t\t\t\t.map((mirror) => mirror.name),\n\t\t]\n\t\tif (failed.length === 0) return\n\t\tthrow new ScaffoldError(\n\t\t\t'FETCH',\n\t\t\t`Upstream produced no complete catalog answer for ${failed.join(', ')}.`,\n\t\t\t{ names: failed.length },\n\t\t)\n\t}\n\n\t// Build the complete pin set or refuse before any caller writes a range.\n\t#pin(releases: readonly Release[], declared: DependencyPinSet): DependencyPinSet {\n\t\tconst refused = releases.filter((release) => release.lookup !== 'found')\n\t\tif (refused.length > 0) {\n\t\t\tthrow new ScaffoldError(\n\t\t\t\t'FETCH',\n\t\t\t\t`The registry named no release for ${refused.map((release) => release.name).join(', ')}.`,\n\t\t\t\t{ names: refused.length },\n\t\t\t)\n\t\t}\n\t\tconst dependencies = [...declared.runtime, ...declared.development]\n\t\tconst pins: Dependency[] = []\n\t\tfor (let index = 0; index < releases.length; index += 1) {\n\t\t\tconst release = releases[index]\n\t\t\tconst dependency = dependencies[index]\n\t\t\tif (release === undefined || dependency === undefined) {\n\t\t\t\tthrow new ScaffoldError('FETCH', 'The release answer has no matching declaration.')\n\t\t\t}\n\t\t\tif (release.lookup !== 'found') {\n\t\t\t\tthrow new ScaffoldError('FETCH', `The registry named no release for ${release.name}.`)\n\t\t\t}\n\t\t\tpins.push({ name: dependency.name, range: `^${release.latest}` })\n\t\t}\n\t\tif (pins.length !== dependencies.length) {\n\t\t\tthrow new ScaffoldError('FETCH', 'The release answer does not match the declaration set.')\n\t\t}\n\t\treturn {\n\t\t\truntime: pins.slice(0, declared.runtime.length),\n\t\t\tdevelopment: pins.slice(declared.runtime.length),\n\t\t}\n\t}\n\n\t// Compile a blueprint into the plan it describes, or refuse with the questions\n\t// the gate raised.\n\t//\n\t// `new` is the only caller, and it chooses the shape rather than reading one, so\n\t// it refuses every question the gate raises, advisory or not: an advisory names\n\t// a workspace this package can describe honestly but will not create, and this\n\t// is the last moment the caller can pick a different shape. `#survey` is the\n\t// reading counterpart, and it carries the same advisories through instead.\n\t//\n\t// The refusal is `BLOCKED` whichever kind of question earned it, because both\n\t// are the one fact that code names: this blueprint will not be built. The\n\t// questions the message quotes are what tells them apart, and a second code\n\t// would be a label for a fact they already carry.\n\t#compile(blueprint: Blueprint, groups?: readonly Group[]): Plan {\n\t\tconst compiler = new Compiler()\n\t\ttry {\n\t\t\tconst scaffolding = compiler.compile(blueprint, groups)\n\t\t\tif (scaffolding.plan !== undefined && scaffolding.questions.length === 0) {\n\t\t\t\treturn scaffolding.plan\n\t\t\t}\n\t\t\tthrow new ScaffoldError(\n\t\t\t\t'BLOCKED',\n\t\t\t\tscaffolding.questions.map((question) => `${question.field}: ${question.message}`).join(' '),\n\t\t\t\t{ questions: scaffolding.questions.length },\n\t\t\t)\n\t\t} finally {\n\t\t\tcompiler.destroy()\n\t\t}\n\t}\n\n\t// Compile a blueprint and compare its plan to what the target holds,\n\t// through the vendored host a write would draw on.\n\t//\n\t// The materializer owns the comparison because it is the only one that can\n\t// make it: the pure compile claims presence alone, so it reads a canon file a\n\t// consumer has edited as aligned and a vendored directory as one missing path\n\t// no write could ever satisfy. Hydrating first states the bytes and expands\n\t// the directory into the files the host actually stores, which is the same\n\t// derivation the repair that follows is held to.\n\t//\n\t// The compiler answers the refused case alone. A blueprint the gate closed\n\t// carries no plan, so there is nothing to hydrate and nothing to say about the\n\t// target; the audit carries the questions instead.\n\t#survey(\n\t\tmaterializer: MaterializerInterface,\n\t\tblueprint: Blueprint,\n\t\ttarget: string,\n\t\tgroups?: readonly Group[],\n\t): readonly [audit: Audit, plan: Plan | undefined] {\n\t\tconst compiler = new Compiler()\n\t\ttry {\n\t\t\tconst scaffolding = compiler.compile(blueprint, groups)\n\t\t\tif (scaffolding.plan === undefined) return [compiler.audit(blueprint, {}, groups), undefined]\n\t\t\t// The materializer answers for the target and the gate answers for the\n\t\t\t// blueprint, so an advisory the gate raised rides the comparison rather\n\t\t\t// than being dropped between them. It is non-blocking, so it changes no\n\t\t\t// exit code and never makes an aligned target drift.\n\t\t\tconst measured = materializer.audit(scaffolding.plan, target)\n\t\t\treturn [\n\t\t\t\t{ ...measured, questions: [...measured.questions, ...scaffolding.questions] },\n\t\t\t\tscaffolding.plan,\n\t\t\t]\n\t\t} finally {\n\t\t\tcompiler.destroy()\n\t\t}\n\t}\n\n\t// The blueprint a target describes about itself: manifest identity and fleet\n\t// packages, environment directories, and exact structural files. Vendors stay\n\t// unknown because their birth-owned script is not a declaration of its list.\n\t// The live-service project does not wait on that list: it follows its own\n\t// readiness module, which the root configuration names by path.\n\t#derive(target: string): Blueprint {\n\t\tconst manifest = this.#manifest(target)\n\t\tconst declared = manifestToName(manifest)\n\t\tif (declared === undefined) {\n\t\t\tthrow new ScaffoldError('TARGET', `The manifest at ${target} declares no package name.`, {\n\t\t\t\ttarget,\n\t\t\t})\n\t\t}\n\t\tconst bin = resolveContainedPath(target, BIN_ENTRY_PATH)\n\t\tconst tests = resolveContainedPath(target, 'tests')\n\t\tconst guides = resolveContainedPath(target, GUIDES_TEST_PATH)\n\t\tconst integration = resolveContainedPath(target, INTEGRATION_TEST_PATH)\n\t\tconst conformance = resolveContainedPath(target, CONFORMANCE_TEST_PATH)\n\t\tconst service = resolveContainedPath(target, SERVICE_SETUP_PATH)\n\t\tconst global = resolveContainedPath(target, GLOBAL_SETUP_PATH)\n\t\tconst showcase = resolveContainedPath(target, SHOWCASE_CONFIG_PATH)\n\t\treturn createBlueprint(declared.slice(declared.lastIndexOf('/') + 1), {\n\t\t\tsrc: this.#probe(target, 'src'),\n\t\t\tapp: this.#probe(target, 'app'),\n\t\t\tdependencies: manifestToDependencies(manifest).runtime,\n\t\t\tbin: bin !== undefined && isExactCaseFile(bin),\n\t\t\tsetup:\n\t\t\t\ttests !== undefined &&\n\t\t\t\tlistFiles(tests).some((path) => {\n\t\t\t\t\tif (path.includes('/') || !path.startsWith('setup') || !path.endsWith('.test.ts')) {\n\t\t\t\t\t\treturn false\n\t\t\t\t\t}\n\t\t\t\t\tconst proof = resolveContainedPath(tests, path)\n\t\t\t\t\treturn proof !== undefined && isExactCaseFile(proof)\n\t\t\t\t}),\n\t\t\tguides: guides !== undefined && isExactCaseFile(guides),\n\t\t\tintegration: integration !== undefined && isExactCaseFile(integration),\n\t\t\tconformance: conformance !== undefined && isExactCaseFile(conformance),\n\t\t\tservice: service !== undefined && isExactCaseFile(service),\n\t\t\tglobal: global !== undefined && isExactCaseFile(global),\n\t\t\tshowcase: showcase !== undefined && isExactCaseFile(showcase),\n\t\t})\n\t}\n\n\t// Read the literal Vitest projects and npm run scripts one shell command\n\t// invokes. Quotes group a token but do not hide the option, while shell\n\t// expansions make its value unresolved and therefore refuse the write that\n\t// asked the question.\n\t#invocations(\n\t\tscript: string,\n\t): { readonly projects: readonly string[]; readonly scripts: readonly string[] } | undefined {\n\t\tconst tokens: Array<{ value: string; resolved: boolean }> = []\n\t\tlet value = ''\n\t\tlet resolved = true\n\t\tlet started = false\n\t\tlet quote: string | undefined\n\t\tfor (let index = 0; index < script.length; index += 1) {\n\t\t\tconst character = script[index]\n\t\t\tif (character === undefined) return undefined\n\t\t\tif (quote === undefined) {\n\t\t\t\tif (/\\s/.test(character)) {\n\t\t\t\t\tif (started) tokens.push({ value, resolved })\n\t\t\t\t\tvalue = ''\n\t\t\t\t\tresolved = true\n\t\t\t\t\tstarted = false\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif (';&|()'.includes(character)) {\n\t\t\t\t\tif (started) tokens.push({ value, resolved })\n\t\t\t\t\tconst paired = script[index + 1] === character && (character === '&' || character === '|')\n\t\t\t\t\ttokens.push({ value: paired ? `${character}${character}` : character, resolved: true })\n\t\t\t\t\tvalue = ''\n\t\t\t\t\tresolved = true\n\t\t\t\t\tstarted = false\n\t\t\t\t\tif (paired) index += 1\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif (character === '\"' || character === \"'\") {\n\t\t\t\t\tquote = character\n\t\t\t\t\tstarted = true\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif (character === '\\\\') {\n\t\t\t\t\tconst escaped = script[index + 1]\n\t\t\t\t\tif (escaped === undefined) return undefined\n\t\t\t\t\tvalue += escaped\n\t\t\t\t\tstarted = true\n\t\t\t\t\tindex += 1\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif (character === '$' || character === '`' || character === '%') resolved = false\n\t\t\t\tvalue += character\n\t\t\t\tstarted = true\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (character === quote) {\n\t\t\t\tquote = undefined\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (character === '\\\\' && quote === '\"') {\n\t\t\t\tconst escaped = script[index + 1]\n\t\t\t\tif (escaped === undefined) return undefined\n\t\t\t\tvalue += escaped\n\t\t\t\tindex += 1\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (quote === '\"' && (character === '$' || character === '`' || character === '%')) {\n\t\t\t\tresolved = false\n\t\t\t}\n\t\t\tvalue += character\n\t\t\tstarted = true\n\t\t}\n\t\tif (quote !== undefined) return undefined\n\t\tif (started) tokens.push({ value, resolved })\n\n\t\tconst projects: string[] = []\n\t\tconst scripts: string[] = []\n\t\tfor (let index = 0; index < tokens.length; index += 1) {\n\t\t\tconst token = tokens[index]\n\t\t\tif (token === undefined) return undefined\n\t\t\tif (token.value === 'npm' && tokens[index + 1]?.value === 'run') {\n\t\t\t\tconst name = tokens[index + 2]\n\t\t\t\tif (\n\t\t\t\t\tname === undefined ||\n\t\t\t\t\t!name.resolved ||\n\t\t\t\t\tname.value.length === 0 ||\n\t\t\t\t\t['&&', '||', ';', '|', '&', '(', ')'].includes(name.value)\n\t\t\t\t)\n\t\t\t\t\treturn undefined\n\t\t\t\tscripts.push(name.value)\n\t\t\t\tindex += 2\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (token.value === '--project') {\n\t\t\t\tconst project = tokens[index + 1]\n\t\t\t\tif (\n\t\t\t\t\tproject === undefined ||\n\t\t\t\t\t!project.resolved ||\n\t\t\t\t\tproject.value.length === 0 ||\n\t\t\t\t\t['&&', '||', ';', '|', '&', '(', ')'].includes(project.value)\n\t\t\t\t)\n\t\t\t\t\treturn undefined\n\t\t\t\tprojects.push(project.value)\n\t\t\t\tindex += 1\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (token.value.startsWith('--project=')) {\n\t\t\t\tconst project = token.value.slice('--project='.length)\n\t\t\t\tif (!token.resolved || project.length === 0) return undefined\n\t\t\t\tprojects.push(project)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (!token.resolved && token.value.includes('--project')) return undefined\n\t\t}\n\t\treturn { projects, scripts }\n\t}\n\n\t// Report either side of the planned-project invariant. Audit carries the\n\t// advisory; writing verbs turn it into the hard boundary that keeps a\n\t// birth-owned manifest from disagreeing with content-owned configuration.\n\t//\n\t// The subject is the manifest a write would leave, not the one on disk: a\n\t// script region this package writes itself is not something to ask the\n\t// maintainer to paste. Where the region is refused the projection is the\n\t// disk text, so a customized chain still raises the advisory it always did.\n\t#projectQuestion(\n\t\ttarget: string,\n\t\tblueprint: Blueprint,\n\t\twriting = false,\n\t): TargetQuestion | undefined {\n\t\tconst text = this.#manifest(target)\n\t\tconst manifest = replaceManifestScripts(text, blueprintToWritableScripts(blueprint)) ?? text\n\t\tconst planned = blueprintToRootVite(blueprint)\n\t\tconst parsed = parseJSON(manifest)\n\t\tconst scripts = isRecord(parsed) && isRecord(parsed.scripts) ? parsed.scripts : {}\n\t\tconst publishes = !isRecord(parsed) || parsed.private !== true\n\t\tconst gates = publishes ? ['test', 'prepublishOnly'] : ['test']\n\t\tconst gateNames = gates.join(' or ')\n\t\tconst absent = new Set<string>()\n\t\tlet unresolved = false\n\t\tfor (const script of Object.values(scripts)) {\n\t\t\tif (!isString(script) || !script.includes('vitest')) continue\n\t\t\tconst invoked = this.#invocations(script)\n\t\t\tif (invoked === undefined) {\n\t\t\t\tunresolved = true\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor (const project of invoked.projects) {\n\t\t\t\tif (!planned.includes(`name: { label: '${project}',`)) absent.add(project)\n\t\t\t}\n\t\t}\n\t\tconst projects = [...absent].sort()\n\t\tif (unresolved) {\n\t\t\treturn {\n\t\t\t\tfield: 'projects',\n\t\t\t\tmessage: `The manifest at ${target} contains a Vitest project expression that cannot be resolved statically.${projects.length === 0 ? '' : ` It also names projects the planned vite.config.ts does not register: ${projects.join(', ')}.`} ${writing ? 'The configs group is blocked. Replace the expression with a literal --project value before selecting configs, or exclude configs from --groups.' : 'Replace it with a literal --project value before relying on the planned configuration.'}`,\n\t\t\t\tblocking: false,\n\t\t\t\tgroups: ['configs'],\n\t\t\t}\n\t\t}\n\t\tif (projects.length > 0) {\n\t\t\treturn {\n\t\t\t\tfield: 'projects',\n\t\t\t\tmessage: writing\n\t\t\t\t\t? `The configs group is blocked because the manifest at ${target} names ${projects.length === 1 ? 'a Vitest project' : 'Vitest projects'} the planned vite.config.ts does not register: ${projects.join(', ')}. Remove the ${projects.length === 1 ? 'script that names it' : 'scripts that name them'} before selecting configs, or exclude configs from --groups.`\n\t\t\t\t\t: `The manifest at ${target} names ${projects.length === 1 ? 'a Vitest project' : 'Vitest projects'} the planned configuration does not register: ${projects.join(', ')}. Add ${projects.length === 1 ? 'the project' : 'each project'} to vite.config.ts or remove the ${projects.length === 1 ? 'script that names it' : 'scripts that name them'}.`,\n\t\t\t\tblocking: false,\n\t\t\t\tgroups: ['configs'],\n\t\t\t}\n\t\t}\n\t\tconst expected = blueprintToScripts(blueprint)\n\t\tconst expectedLines = new Map<string, string>()\n\t\tfor (const [name, script] of Object.entries(expected)) {\n\t\t\tif (!name.startsWith('test:')) continue\n\t\t\tconst invoked = this.#invocations(script)\n\t\t\tif (invoked === undefined) continue\n\t\t\tfor (const project of invoked.projects) {\n\t\t\t\tif (project === 'probe') continue\n\t\t\t\tconst direct = `test:${project}`\n\t\t\t\tconst command = expected[direct]\n\t\t\t\tif (command !== undefined) {\n\t\t\t\t\texpectedLines.set(project, `\"${direct}\": ${JSON.stringify(command)},`)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst reachable = new Set<string>()\n\t\tconst visited = new Set<string>()\n\t\tconst pending = [...gates]\n\t\twhile (pending.length > 0) {\n\t\t\tconst name = pending.shift()\n\t\t\tif (name === undefined || visited.has(name)) continue\n\t\t\tvisited.add(name)\n\t\t\tconst script = scripts[name]\n\t\t\tif (!isString(script)) continue\n\t\t\tconst invoked = this.#invocations(script)\n\t\t\tif (invoked === undefined) {\n\t\t\t\tunresolved = true\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor (const project of invoked.projects) reachable.add(project)\n\t\t\tfor (const called of invoked.scripts) {\n\t\t\t\tif (!visited.has(called)) pending.push(called)\n\t\t\t}\n\t\t}\n\t\tif (unresolved) {\n\t\t\treturn {\n\t\t\t\tfield: 'projects',\n\t\t\t\tmessage: `The manifest at ${target} contains a ${gateNames} chain that cannot be resolved statically. ${writing ? 'The configs group is blocked. Replace it with literal npm run script names before selecting configs, or exclude configs from --groups.' : 'Replace it with literal npm run script names before relying on the planned configuration.'}`,\n\t\t\t\tblocking: false,\n\t\t\t\tgroups: ['configs'],\n\t\t\t}\n\t\t}\n\t\tconst missing = [...expectedLines]\n\t\t\t.filter(([project]) => !reachable.has(project))\n\t\t\t.sort(([left], [right]) => left.localeCompare(right))\n\t\tif (missing.length === 0) return undefined\n\t\tconst names = missing.map(([project]) => project)\n\t\t// A project goes unreached for one of these reasons, and they take opposite\n\t\t// repairs. Where the direct script is absent, the script is what is missing.\n\t\t// Where the target already declares it, adding that line again changes\n\t\t// nothing and the gate chain is what is missing.\n\t\tconst unscripted = missing.filter(([project]) => !isString(scripts[`test:${project}`]))\n\t\tconst ungated = missing.filter(([project]) => isString(scripts[`test:${project}`]))\n\t\t// The script lines are meant to be pasted and end in a trailing comma, so\n\t\t// they go last. Any prose after them reads as part of the paste.\n\t\tconst remedies: string[] = []\n\t\tif (ungated.length > 0) {\n\t\t\tconst declared = ungated.map(([project]) => `test:${project}`)\n\t\t\tremedies.push(\n\t\t\t\t`${declared.join(', ')} ${declared.length === 1 ? 'is' : 'are'} already declared, so the gate is missing rather than the script: invoke ${declared.length === 1 ? 'it' : 'each of them'} by name from the ${gateNames} chain.`,\n\t\t\t)\n\t\t}\n\t\tif (unscripted.length > 0) {\n\t\t\tconst lines = unscripted.map(([, line]) => line)\n\t\t\tremedies.push(\n\t\t\t\t`${writing ? 'To continue, add' : 'Add'} ${lines.length === 1 ? 'this exact script line' : 'these exact script lines'} to package.json: ${lines.join(' ')}`,\n\t\t\t)\n\t\t}\n\t\treturn {\n\t\t\tfield: 'projects',\n\t\t\tmessage: `${writing ? 'The configs group is blocked because ' : ''}the manifest at ${target} does not reach ${names.length === 1 ? 'a Vitest project' : 'Vitest projects'} the planned configuration registers: ${names.join(', ')}. No chain from ${gateNames} invokes ${names.length === 1 ? 'it' : 'them'}. ${remedies.join(' ')}${writing ? ' Exclude configs from --groups to write another group.' : ''}`,\n\t\t\tblocking: false,\n\t\t\tgroups: ['configs'],\n\t\t}\n\t}\n\n\t// Compare planned tooling membership here. Registry release evidence owns\n\t// fleet range equality and foreign supported-major drift, so this question\n\t// reports only rows the target omitted or malformed sections it cannot read.\n\t#dependencyQuestion(\n\t\ttarget: string,\n\t\tblueprint: Blueprint,\n\t\twriting = false,\n\t): TargetQuestion | undefined {\n\t\tconst parsed = parseJSON(this.#manifest(target))\n\t\tif (!isRecord(parsed)) return undefined\n\t\tconst malformed = ['dependencies', 'devDependencies'].filter(\n\t\t\t(section) => parsed[section] !== undefined && !isRecord(parsed[section]),\n\t\t)\n\t\tif (malformed.length > 0) {\n\t\t\treturn {\n\t\t\t\tfield: 'dependencies',\n\t\t\t\tmessage: `The manifest at ${target} declares ${malformed.join(' and ')} as ${malformed.length === 1 ? 'a value' : 'values'} that ${malformed.length === 1 ? 'is' : 'are'} not ${malformed.length === 1 ? 'an object' : 'objects'}. ${writing ? `The configs and tests groups are blocked. Replace ${malformed.length === 1 ? 'it' : 'them'} with ${malformed.length === 1 ? 'an object' : 'objects'} before selecting configs or tests, or exclude those groups from --groups.` : `Replace ${malformed.length === 1 ? 'it' : 'them'} with ${malformed.length === 1 ? 'an object' : 'objects'} before relying on the planned dependency set.`}`,\n\t\t\t\tblocking: false,\n\t\t\t\tgroups: ['configs', 'tests'],\n\t\t\t}\n\t\t}\n\t\tconst dependencies = isRecord(parsed.dependencies) ? parsed.dependencies : {}\n\t\tconst development = isRecord(parsed.devDependencies) ? parsed.devDependencies : {}\n\t\tconst missing = Object.entries(blueprintToDevDependencies(blueprint))\n\t\t\t.filter(([name]) => !Object.hasOwn(dependencies, name) && !Object.hasOwn(development, name))\n\t\t\t.sort(([left], [right]) => left.localeCompare(right))\n\t\tif (missing.length === 0) return undefined\n\t\tconst names = missing.map(([name]) => name)\n\t\tconst lines = missing.map(\n\t\t\t([name, range]) => `${JSON.stringify(name)}: ${JSON.stringify(range)},`,\n\t\t)\n\t\treturn {\n\t\t\tfield: 'dependencies',\n\t\t\tmessage: `The manifest at ${target} does not declare ${names.length === 1 ? 'a planned dependency' : 'planned dependencies'}: ${names.join(', ')}. ${writing ? 'The configs and tests groups are blocked. Add' : 'Add'} ${lines.length === 1 ? 'this exact dependency line' : 'these exact dependency lines'} to dependencies or devDependencies in package.json: ${lines.join(' ')}${writing ? ' Add the dependency before selecting configs or tests, or exclude those groups from --groups.' : ''}`,\n\t\t\tblocking: false,\n\t\t\tgroups: ['configs', 'tests'],\n\t\t}\n\t}\n\n\t// Report a setup surface no proof covers. The reading is the target's own\n\t// tests directory rather than the plan, because scaffold writes no setup\n\t// proof: `.claude/rules/tests.md` fixes that proof's subject as the behavior\n\t// a workspace's own helpers export, and no generated file can assert that.\n\t//\n\t// A module counts as filled when its text differs from the seed this blueprint\n\t// plans at that same path, with both sides read trimmed. The seeds differ by\n\t// path: `tests/setup.ts` is seeded with the empty string, and\n\t// `tests/setupGlobal.ts` is seeded with a `setup` function body. So emptiness\n\t// alone would raise the question against a workspace scaffold had\n\t// materialized, and the planned seed is what the text is held to instead. It\n\t// stays a text comparison because `typescript` is a development dependency\n\t// here, so `src/` cannot parse a module to count what it exports, and scanning\n\t// the text for the keyword would be a second source-language analyzer that is\n\t// wrong about comments and strings.\n\t//\n\t// Coverage is read per module: `tests/<name>.ts` is covered by\n\t// `tests/<name>.test.ts` and by nothing else, which is the pairing the vendored\n\t// policy proof resolves through `stemToPolicyCandidates`. Keying the silence on\n\t// the presence of any setup proof instead would retire the question on the\n\t// first proof a maintainer writes and leave every other module uncovered with\n\t// no further signal.\n\t//\n\t// A vendored module is excluded because `repair` restores it in every target,\n\t// so a question naming one would fire everywhere and name nothing the\n\t// maintainer owns.\n\t//\n\t// Audit alone raises this. A writing verb refuses an advisory whose next step\n\t// would replace planned configuration, and this one names nothing scaffold\n\t// plans, so refusing a repair over it would block a write on a gap no write\n\t// could close.\n\t#setupQuestion(target: string, blueprint: Blueprint): TargetQuestion | undefined {\n\t\tconst tests = resolveContainedPath(target, 'tests')\n\t\tif (tests === undefined) return undefined\n\t\tconst entries = listFiles(tests).filter((path) => !path.includes('/'))\n\t\tconst proofs = new Set(entries.filter((path) => path.endsWith('.test.ts')))\n\t\tconst seeds = new Map(\n\t\t\tblueprintToTestArtifacts(blueprint).map(({ path, content }) => [path, content.trim()]),\n\t\t)\n\t\tconst modules = entries\n\t\t\t.filter((path) => {\n\t\t\t\tif (!path.startsWith('setup') || !path.endsWith('.ts')) return false\n\t\t\t\tif (path.endsWith('.test.ts') || HOST_PATHS.includes(`tests/${path}`)) return false\n\t\t\t\tif (proofs.has(`${path.slice(0, -'.ts'.length)}.test.ts`)) return false\n\t\t\t\tif (resolveContainedPath(tests, path) === undefined) return false\n\t\t\t\tconst content = (readFileText(tests, path) ?? '').trim()\n\t\t\t\treturn content !== '' && content !== (seeds.get(`tests/${path}`) ?? '')\n\t\t\t})\n\t\t\t.sort()\n\t\tif (modules.length === 0) return undefined\n\t\tconst single = modules.length === 1\n\t\tconst named = modules.map((path) => `tests/${path}`).join(', ')\n\t\tconst remedies = modules\n\t\t\t.map((path) => `tests/${path.slice(0, -'.ts'.length)}.test.ts`)\n\t\t\t.join(', ')\n\t\t// The remedy asks for coverage, which is the fact the preceding filter decides.\n\t\t// It does not say what the proof asserts: the reading is text against a\n\t\t// seed, so a module that exports nothing and only registers a hook reaches\n\t\t// here, and a remedy demanding a proof of exported behavior leaves that\n\t\t// maintainer a permanent advisory or a proof that measures nothing.\n\t\tconst remedy = single\n\t\t\t? `Add ${remedies} to cover it.`\n\t\t\t: `Add ${remedies}, each covering the module of the same name.`\n\t\treturn {\n\t\t\tfield: 'setup',\n\t\t\tmessage: `The target at ${target} carries ${single ? 'a test setup module' : 'test setup modules'} that no proof covers: ${named}. ${remedy} The proof's subject is behavior only this workspace can assert, so scaffold does not write it.`,\n\t\t\tblocking: false,\n\t\t\tgroups: ['tests'],\n\t\t}\n\t}\n\n\t// Collect the target questions in a fixed order so audit reports every\n\t// independent advisory and writing verbs refuse the ones a write would act on.\n\t#targetQuestions(\n\t\ttarget: string,\n\t\tblueprint: Blueprint,\n\t\tgroups: readonly Group[] | undefined,\n\t\twriting = false,\n\t): readonly Question[] {\n\t\tconst questions: TargetQuestion[] = []\n\t\tconst project = this.#projectQuestion(target, blueprint, writing)\n\t\tif (project !== undefined) questions.push(project)\n\t\tconst dependency = this.#dependencyQuestion(target, blueprint, writing)\n\t\tif (dependency !== undefined) questions.push(dependency)\n\t\tif (!writing) {\n\t\t\tconst setup = this.#setupQuestion(target, blueprint)\n\t\t\tif (setup !== undefined) questions.push(setup)\n\t\t}\n\t\treturn questions\n\t\t\t.filter(\n\t\t\t\t(question) =>\n\t\t\t\t\tgroups === undefined || question.groups.some((group) => groups.includes(group)),\n\t\t\t)\n\t\t\t.map(({ field, message, blocking, candidates }): Question => ({\n\t\t\t\tfield,\n\t\t\t\tmessage,\n\t\t\t\tblocking,\n\t\t\t\t...(candidates === undefined ? {} : { candidates }),\n\t\t\t}))\n\t}\n\n\t// Writing verbs refuse the advisories because their next step would replace\n\t// planned configuration. Audit alone reports them without changing the target.\n\t#assertTarget(target: string, blueprint: Blueprint, groups: readonly Group[] | undefined): void {\n\t\tconst questions = this.#targetQuestions(target, blueprint, groups, true)\n\t\tif (questions.length === 0) return\n\t\tthrow new ScaffoldError('TARGET', questions.map((question) => question.message).join(' '), {\n\t\t\ttarget,\n\t\t})\n\t}\n\n\t// A target's manifest text, which every reading verb needs before it can say\n\t// anything about the target at all.\n\t#manifest(target: string): string {\n\t\tconst manifest = readFileText(target, 'package.json', MAX_MANIFEST_BYTES)\n\t\tif (manifest === undefined) {\n\t\t\tthrow new ScaffoldError('TARGET', `The target at ${target} carries no readable manifest.`, {\n\t\t\t\ttarget,\n\t\t\t})\n\t\t}\n\t\treturn manifest\n\t}\n\n\t// The environments one axis physically ships, read as directories rather than\n\t// declared, because a directory is the fact and a declaration would be a\n\t// second copy of it free to disagree.\n\t#probe(target: string, axis: string): readonly Environment[] {\n\t\treturn ENVIRONMENTS.filter((environment) => {\n\t\t\tconst full = resolveContainedPath(target, `${axis}/${environment}`)\n\t\t\treturn full !== undefined && isPhysicalDirectory(full)\n\t\t})\n\t}\n\n\t// The packages the target's catalog table listed before this run. Read through\n\t// the declared markdown parser rather than by pattern, so a row is a row\n\t// because the document says so.\n\t#previous(target: string): readonly string[] {\n\t\tconst text = readFileText(target, CATALOG_AGENT_PATH)\n\t\tif (text === undefined) return []\n\t\tconst names: string[] = []\n\t\tfor (const table of createMarkdown(text).filter(isTableNode)) {\n\t\t\tfor (const row of table.rows) {\n\t\t\t\tconst [cell] = row\n\t\t\t\tif (cell === undefined) continue\n\t\t\t\tconst name = cell.map(flattenText).join('').trim()\n\t\t\t\tif (DEPENDENCY_NAME_PATTERN.test(name)) names.push(name)\n\t\t\t}\n\t\t}\n\t\treturn names\n\t}\n\n\t// What git reports about the target's working tree. Deletion draws only on\n\t// what git tracks and refuses a tree carrying uncommitted work, so a target\n\t// that is not a repository has no recovery mechanism and is refused here.\n\t#worktree(target: string): Worktree {\n\t\tconst tracked = this.#inventory(target, ['ls-files', '-z'])\n\t\tconst dirty = this.#inventory(target, [\n\t\t\t'status',\n\t\t\t'--porcelain=v1',\n\t\t\t'--untracked-files=all',\n\t\t\t'-z',\n\t\t]).map((record) => (record.length > 3 && record[2] === ' ' ? record.slice(3) : record))\n\t\tconst state = { tracked, dirty }\n\t\tif (!isWorktree(state)) {\n\t\t\tthrow new ScaffoldError('TARGET', `The git state at ${target} is not a readable inventory.`, {\n\t\t\t\ttarget,\n\t\t\t\ttracked: tracked.length,\n\t\t\t\tdirty: dirty.length,\n\t\t\t})\n\t\t}\n\t\treturn state\n\t}\n\n\t// One git query, answered as its NUL-separated records. Git is asked rather\n\t// than reimplemented, because the tracked set and the dirty set are git's own\n\t// answers and nothing else can give them. `executeSync` resolves the bare `git`\n\t// name against `PATH` and `PATHEXT` on Windows, never through a shell, so the\n\t// query runs without an extension of its own.\n\t#inventory(target: string, args: readonly string[]): readonly string[] {\n\t\t// A failed run resolves instead of throwing, so this class stays the owner of\n\t\t// what leaves it: git's own refusal is buffered into the result rather than\n\t\t// written onto a stream nobody chose, and the failure is reported through the\n\t\t// diagnostic handler the caller supplied.\n\t\tconst result = executeSync(\n\t\t\t{ file: 'git', arguments: [...args] },\n\t\t\t{ workspace: target, limit: MAX_MANIFEST_BYTES, strict: false },\n\t\t)\n\t\tif (result.failed) {\n\t\t\tthrow new ScaffoldError('TARGET', `The target at ${target} is not a git repository.`, {\n\t\t\t\ttarget,\n\t\t\t})\n\t\t}\n\t\treturn result.stdout.split('\\0').filter((record) => record.length > 0)\n\t}\n\n\t// The environments a comma-separated selection names, refused by name when it\n\t// names something that is not one.\n\t#environments(selection: string | undefined, axis: string): readonly Environment[] {\n\t\tif (selection === undefined) return []\n\t\tconst requested = selection.split(',')\n\t\tconst refused = requested.filter(\n\t\t\t(name) => !ENVIRONMENTS.some((environment) => environment === name),\n\t\t)\n\t\tif (refused.length > 0) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`'--${axis}' does not take ${refused.join(', ')}. It takes ${ENVIRONMENTS.join(', ')}.`,\n\t\t\t)\n\t\t}\n\t\treturn ENVIRONMENTS.filter((environment) => requested.includes(environment))\n\t}\n\n\t// The groups a comma-separated selection names; absence covers every group.\n\t#groups(selection: string | undefined): readonly Group[] | undefined {\n\t\tif (selection === undefined) return undefined\n\t\tconst requested = selection.split(',')\n\t\tconst refused = requested.filter((name) => !GROUPS.some((group) => group === name))\n\t\tif (refused.length > 0) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`'--groups' does not take ${refused.join(', ')}. It takes ${GROUPS.join(', ')}.`,\n\t\t\t)\n\t\t}\n\t\treturn GROUPS.filter((group) => requested.includes(group))\n\t}\n\n\t// The fleet packages a comma-separated selection names.\n\t#packages(selection: string | undefined): readonly string[] {\n\t\tif (selection === undefined) return []\n\t\tconst requested = selection.split(',')\n\t\tconst refused = requested.filter((name) => !DEPENDENCY_NAME_PATTERN.test(name))\n\t\tif (refused.length > 0) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`'--deps' does not take ${refused.join(', ')}. Every name is a published @orkestrel package.`,\n\t\t\t)\n\t\t}\n\t\treturn requested\n\t}\n\n\t// The results of one run, read as one. Written and skipped never overlap\n\t// across the calls a verb makes, because each call answers for its own paths.\n\t#merge(first: MaterializeResult, second: MaterializeResult): MaterializeResult {\n\t\treturn {\n\t\t\ttarget: first.target,\n\t\t\twritten: [...first.written, ...second.written],\n\t\t\tskipped: [...first.skipped, ...second.skipped],\n\t\t\tremoved: [...first.removed, ...second.removed],\n\t\t}\n\t}\n\n\t// Name every surface baseline after a network read forced a floor.\n\t#reportBaselines(provenance: Provenance): void {\n\t\tconst baselines: string[] = []\n\t\tif (provenance.versions !== undefined) {\n\t\t\tbaselines.push(`versions=${provenance.versions}`)\n\t\t}\n\t\tif (provenance.guides !== undefined) baselines.push(`guides=${provenance.guides}`)\n\t\tif (provenance.host !== undefined) baselines.push(`host=${provenance.host}`)\n\t\tthis.#warn(`Upstream fallback selected the distributed baseline: ${baselines.join(', ')}.`)\n\t}\n\n\t// The audit as a person reads it: every advisory first, then one row per path\n\t// that differs, then the summary. An aligned path is not listed, because a\n\t// report of everything that is fine is a report nobody reads.\n\t#present(audit: Audit): void {\n\t\tfor (const question of audit.questions) this.#warn(`${question.field}: ${question.message}`)\n\t\tconst rows = audit.findings\n\t\t\t.filter((finding) => finding.drift !== 'aligned')\n\t\t\t.map((finding) => [finding.path, finding.group, finding.drift])\n\t\tif (rows.length > 0) {\n\t\t\tconst table = renderTable({\n\t\t\t\tcolumns: [{ label: 'path' }, { label: 'group' }, { label: 'drift' }],\n\t\t\t\trows,\n\t\t\t})\n\t\t\tfor (const line of table.split('\\n')) this.#say(line)\n\t\t}\n\t\tthis.#say(auditToSummary(audit))\n\t}\n\n\t// Report failed release reads and exact fleet drift beside the audit.\n\t#reportReleases(releases: readonly Release[]): void {\n\t\tfor (const release of releases) {\n\t\t\tif (release.lookup !== 'found') {\n\t\t\t\tthis.#warn(`${release.name}: ${release.note}`)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (release.name.startsWith('@orkestrel/') && release.range !== `^${release.latest}`) {\n\t\t\t\tthis.#warn(`${release.name}: ${release.range} differs from ^${release.latest}.`)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Name each stale content path the verb replaced, beside the line-count\n\t// difference between the bytes it audited and the bytes its terminal audit\n\t// read back. Missing paths are creations and never enter this report.\n\t#reportReplacements(before: Audit, after: Audit): void {\n\t\tconst terminal = new Map(after.findings.map((finding) => [finding.path, finding]))\n\t\tfor (const finding of before.findings) {\n\t\t\tif (finding.drift !== 'stale') continue\n\t\t\tconst current = terminal.get(finding.path)\n\t\t\tif (current?.drift !== 'aligned' || current.observed === undefined) continue\n\t\t\tconst previousLines = Buffer.from(finding.observed, 'hex')\n\t\t\t\t.toString('utf8')\n\t\t\t\t.split(/\\r\\n|\\r|\\n/u).length\n\t\t\tconst currentLines = Buffer.from(current.observed, 'hex')\n\t\t\t\t.toString('utf8')\n\t\t\t\t.split(/\\r\\n|\\r|\\n/u).length\n\t\t\tconst delta = currentLines - previousLines\n\t\t\tif (delta === 0) {\n\t\t\t\tthis.#say(`${finding.path} replaced (0-line delta).`)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tconst count = Math.abs(delta)\n\t\t\tthis.#say(\n\t\t\t\t`${finding.path} replaced (${String(count)} line${count === 1 ? '' : 's'} ${delta > 0 ? 'added' : 'removed'}).`,\n\t\t\t)\n\t\t}\n\t}\n\n\t// The catalog outcome as a person reads it.\n\t#recount(result: CatalogResult): void {\n\t\tthis.#say(this.#tally(result))\n\t\tthis.#say(\n\t\t\t`${String(result.entries.length)} published, ${String(result.mirrors.filter((mirror) => mirror.lookup === 'found').length)} guide${result.mirrors.length === 1 ? '' : 's'} fetched, ${String(result.dropped.length)} no longer listed.`,\n\t\t)\n\t\tfor (const mirror of result.mirrors) {\n\t\t\tif (mirror.lookup !== 'found') this.#warn(`${mirror.name}: ${mirror.note}`)\n\t\t}\n\t}\n\n\t// One line stating what a mutation did.\n\t#tally(result: MaterializeResult): string {\n\t\treturn `${String(result.written.length)} written, ${String(result.skipped.length)} unchanged, ${String(result.removed.length)} removed in ${result.target}.`\n\t}\n\n\t// The one machine-readable value a `--json` run emits.\n\t#report(value: unknown): void {\n\t\tthis.#say(JSON.stringify(value))\n\t}\n\n\t// Report a refusal under the code it carries and answer with the code it\n\t// earned: a command line that was not a command is a usage error, and\n\t// everything else is a failed run.\n\t#refuse(error: unknown, json: boolean): number {\n\t\tconst envelope = errorToEnvelope(error)\n\t\tif (json) this.#report(envelope)\n\t\telse this.#warn(`${envelope.error.code}: ${envelope.error.message}`)\n\t\treturn isUsageError(error) ? EXIT_USAGE : EXIT_DRIFT\n\t}\n\n\t#say(line: string): void {\n\t\tthis.#output(this.#sanitize(line))\n\t}\n\n\t#warn(line: string): void {\n\t\tthis.#diagnostic(this.#sanitize(line))\n\t}\n\n\t// The single write path, and the only place hostile bytes are answered for.\n\t// A refusal quotes the argument that caused it, so an escape sequence, a bell,\n\t// or a forged second line arrives here inside otherwise ordinary prose. ANSI\n\t// escapes go first because they are what repaints a terminal, control\n\t// characters next, and what remains is folded onto one line because a handler\n\t// takes one line and a caller writing a record per call must get one record.\n\t#sanitize(line: string): string {\n\t\treturn stripControls(strip(line)).split(/\\r?\\n/).join(' ')\n\t}\n}\n","// The executable entry, and the only module that touches process state: it reads\n// the arguments the process was given and assigns the code the run returned. The\n// `#!/usr/bin/env node` shebang is re-emitted by the build's `output.banner`\n// rather than written here, because the bundler strips a shebang from source.\nimport { CLI } from './CLI.js'\nimport { environmentToUpstream } from './helpers.js'\n\nprocess.stdout.on('error', (error) => {\n\tif ('code' in error && error.code === 'EPIPE') return\n\tthrow error\n})\nprocess.exitCode = await new CLI({ upstream: environmentToUpstream(process.env) }).execute(\n\tprocess.argv.slice(2),\n)\n"],"mappings":";;;;;;;;;;;;;;;;;AAWA,IAAa,kBAAkB;;;;;;;;;AAU/B,IAAa,QAAyB,OAAO,OAAO;CACnD;CACA;CACA;CACA;CACA;AACD,CAAC;;;;;;;;AAkBD,IAAa,eAAiD,OAAO,OAAO;EAC7D,IAAA;EACA,IAAA;EACA,IAAA;AACf,CAAC;;;;;;;;;;AAWD,IAAa,aAAa;;AAG1B,IAAa,cAAc;;AAG3B,IAAa,iBAAiB;;;;;;;;AAS9B,IAAa,gBAAgB;;;;;;;;;;;;;;AAe7B,IAAa,kBAA0C,OAAO,OAAO;CACpE,KAAK,OAAO,OAAO,EAAE,MAAM,SAAS,CAAC;CACrC,KAAK,OAAO,OAAO,EAAE,MAAM,SAAS,CAAC;CACrC,KAAK,OAAO,OAAO,EAAE,MAAM,UAAU,CAAC;CACtC,MAAM,OAAO,OAAO,EAAE,MAAM,SAAS,CAAC;CACtC,QAAQ,OAAO,OAAO,EAAE,MAAM,SAAS,CAAC;CACxC,KAAK,OAAO,OAAO,EAAE,MAAM,UAAU,CAAC;CACtC,OAAO,OAAO,OAAO,EAAE,MAAM,UAAU,CAAC;CACxC,SAAS,OAAO,OAAO,EAAE,MAAM,UAAU,CAAC;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