@orkestrel/scaffold 0.0.21 → 0.0.23
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/dist/bin/scaffold.js +371 -140
- package/dist/bin/scaffold.js.map +1 -1
- package/dist/host/AGENTS.md +61 -42
- package/dist/host/CLAUDE.md +39 -408
- package/dist/host/agents/orchestration.md +454 -0
- package/dist/host/agents/skills/enterprise-bootstrap/SKILL.md +25 -7
- package/dist/host/agents/skills/orkestrel-align-packages/SKILL.md +2 -2
- package/dist/host/agents/skills/orkestrel-build-application/SKILL.md +42 -31
- package/dist/host/agents/skills/orkestrel-build-application/references/application.md +129 -0
- package/dist/host/agents/skills/orkestrel-debrief/SKILL.md +3 -3
- package/dist/host/agents/skills/orkestrel-debrief/references/field-testing.md +2 -2
- package/dist/host/agents/skills/orkestrel-falsify/SKILL.md +167 -0
- package/dist/host/agents/skills/orkestrel-falsify/references/brief.md +98 -0
- package/dist/host/agents/skills/orkestrel-falsify/references/reconcile.md +148 -0
- package/dist/host/agents/skills/orkestrel-harden-package/SKILL.md +4 -2
- package/dist/host/agents/skills/orkestrel-harden-package/references/centralization.md +5 -5
- package/dist/host/agents/skills/orkestrel-harden-package/references/research.md +2 -0
- package/dist/host/agents/skills/orkestrel-polish-surface/SKILL.md +11 -6
- package/dist/host/claude/agents/analyst.md +59 -0
- package/dist/host/claude/agents/application.md +1 -1
- package/dist/host/claude/agents/builder.md +1 -1
- package/dist/host/claude/agents/checker.md +5 -1
- package/dist/host/claude/agents/codex.md +120 -94
- package/dist/host/claude/agents/grok.md +44 -32
- package/dist/host/claude/agents/implementer.md +1 -1
- package/dist/host/claude/agents/orkestrel.md +5 -5
- package/dist/host/claude/agents/planner.md +9 -3
- package/dist/host/claude/agents/researcher.md +6 -5
- package/dist/host/claude/agents/reviewer.md +12 -6
- package/dist/host/claude/agents/scout.md +7 -4
- package/dist/host/claude/agents/verifier.md +1 -1
- package/dist/host/claude/rules/application.md +17 -16
- package/dist/host/claude/rules/architecture.md +41 -22
- package/dist/host/claude/rules/documentation.md +2 -1
- package/dist/host/claude/rules/names.md +7 -6
- package/dist/host/claude/rules/quality.md +65 -18
- package/dist/host/claude/rules/styles.md +1 -1
- package/dist/host/claude/rules/tests.md +12 -6
- package/dist/host/claude/rules/typescript.md +1 -1
- package/dist/host/claude/rules/workspace.md +6 -3
- package/dist/host/claude/settings.json +2 -0
- package/dist/host/claude/skills/orkestrel-falsify/SKILL.md +10 -0
- package/dist/host/codex/agents/analyst.toml +13 -4
- package/dist/host/codex/agents/checker.toml +1 -1
- package/dist/host/codex/agents/grok.toml +2 -1
- package/dist/host/codex/agents/opus.toml +1 -1
- package/dist/host/codex/agents/planner.toml +1 -1
- package/dist/host/codex/agents/researcher.toml +2 -2
- package/dist/host/codex/agents/reviewer.toml +1 -1
- package/dist/host/codex/agents/scout.toml +2 -2
- package/dist/host/codex/config.toml +23 -70
- package/dist/host/cursor/rules/orchestration.mdc +33 -0
- package/dist/host/guides/src/scaffold.md +339 -125
- package/dist/host/manifest.json +47 -1
- package/dist/host/tests/setupPolicy.ts +210 -3
- package/dist/src/core/index.cjs +477 -69
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +132 -43
- package/dist/src/core/index.d.ts +132 -43
- package/dist/src/core/index.js +474 -70
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +83 -33
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +43 -27
- package/dist/src/server/index.d.ts +43 -27
- package/dist/src/server/index.js +84 -35
- package/dist/src/server/index.js.map +1 -1
- package/package.json +4 -4
package/dist/bin/scaffold.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scaffold.js","names":["#sync","#tty","#sink","#styler","#trust","#dispatch","#json","#write","#reporter","#error","#fail","#prunePaths","#scan","#compile","#guard","#apply","#prune","#prompt","#new","#usage","#contain","#names","#spinner","#succeed","#reject","#pull","#refresh","#mirror","#audit","#scanSafe","#repair","#prepareRepair","#outside","#fleet","#catalog"],"sources":["../../src/bin/constants.ts","../../src/bin/errors.ts","../../src/bin/shapers.ts","../../src/bin/helpers.ts","../../src/bin/parsers.ts","../../src/bin/validators.ts","../../src/bin/CLI.ts","../../src/bin/scaffold.ts"],"sourcesContent":["import type { Drift, Origin } from '@src/core'\nimport type { CheckboxChoice } from '@orkestrel/terminal'\nimport type { Verb } from './types.js'\n\n/** The command-line interface's closed command vocabulary. */\nexport const KNOWN_VERBS: readonly Verb[] = Object.freeze([\n\t'new',\n\t'pull',\n\t'mirror',\n\t'audit',\n\t'repair',\n\t'fleet',\n\t'catalog',\n])\n\n/** Internal artifact origins translated into user-facing labels. */\nexport const ORIGIN_LABEL: Readonly<Record<Origin, string>> = Object.freeze({\n\thost: 'host-owned',\n\ttemplate: 'starter',\n\tcomputed: 'generated',\n})\n\n/** Internal drift states translated into user-facing labels. */\nexport const DRIFT_LABEL: Readonly<Record<Drift, string>> = Object.freeze({\n\taligned: 'unchanged',\n\tstale: 'drifted',\n\tmissing: 'missing',\n\tforeign: 'unexpected file',\n})\n\n/** Dependency freshness states translated into user-facing labels. */\nexport const FRESHNESS_LABEL: Readonly<Record<string, string>> = Object.freeze({\n\tcurrent: 'unchanged',\n\tbehind: 'behind',\n\tmissing: 'missing upstream',\n\tfailed: 'fetch failed',\n})\n\n/** Materializer actions translated into user-facing labels. */\nexport const ACTION_LABEL: Readonly<Record<string, string>> = Object.freeze({\n\twritten: 'wrote',\n\tcopied: 'wrote',\n\tskipped: 'unchanged',\n\tremoved: 'removed',\n})\n\n/** Repair's deliberately limited ownership boundary. */\nexport const REPAIR_SCOPE =\n\t'repair scope: shared host-owned artifacts only — starter and generated files are never touched'\n\n/** Repair's opt-in generated-canon ownership boundary. */\nexport const REPAIR_GENERATED_SCOPE =\n\t'repair scope: shared host-owned and generated artifacts — starter files and package.json are never touched'\n\n/** The dry-run note for `new`. */\nexport const NEW_DRY_RUN_NOTE = 'dry run — pass --apply to write'\n\n/** The fallback message for a malformed command line without an error message. */\nexport const INVALID_ARGUMENTS_MESSAGE = 'invalid arguments'\n\n/** Shared prompt-cancellation message. */\nexport const CANCELLED_MESSAGE = 'cancelled — nothing written'\n\n/** Terminal choices for a new workspace's src and app environments. */\nexport const ENVIRONMENT_CHOICES: readonly CheckboxChoice[] = Object.freeze([\n\t{ name: 'core', value: 'core', description: 'the pure engine' },\n\t{ name: 'browser', value: 'browser', description: 'DOM-facing environment' },\n\t{ name: 'server', value: 'server', description: 'node-facing environment' },\n])\n\n/** The safety model included in full help. */\nexport const SAFETY_BANNER = [\n\t'safety: every verb is a dry run by default.',\n\t'on a terminal, a write prompts for confirmation; in a script, pass --apply (and --yes to skip the confirm).',\n\t'every write is confined to the current working directory — cd there first.',\n\t'when Node exposes system-CA controls, TLS adds the OS certificate store; earlier supported Node 22 releases use default roots. NODE_EXTRA_CA_CERTS adds custom PEMs.',\n].join('\\n')\n\n/** Stable command exit-code meanings. */\nexport const EXIT_CODES: readonly (readonly [string, string])[] = Object.freeze([\n\t['0', 'clean / success'],\n\t['1', 'drift or failure'],\n\t['2', 'usage error'],\n])\n\n/** One-line command summaries. */\nexport const VERB_SUMMARY: Readonly<Record<Verb, string>> = Object.freeze({\n\tnew: 'scaffold a workspace into ./<name>',\n\tpull: 'refresh vendored guides/versions, report drift',\n\tmirror: 'refresh every published Orkestrel package guide',\n\taudit: 'whole-plan conformance report',\n\trepair: 'restore host-owned files, plus generated canon with --generated',\n\tfleet: \"audit/repair every workspace under the cwd's immediate children\",\n\tcatalog: 'regenerate the fleet package-catalog table',\n})\n\n/** Compact command flag references. */\nexport const VERB_FLAGS: Readonly<Record<Verb, string>> = Object.freeze({\n\tnew: '--src a,b --app a,b --deps x,y --apply --yes --target <path> --from <path>',\n\tpull: '--target . --deps x,y --apply --yes --strict',\n\tmirror: '--target . --apply --yes --strict',\n\taudit: '--target . --live --generated --from <path> --groups a,b',\n\trepair: '--target . --generated --apply --yes --prune --from <path>',\n\tfleet: '--generated --apply --yes --prune --from <path>',\n\tcatalog: '--from <path> ... --target <repo> --offline --apply --yes',\n})\n\n/** Plain-language command flag descriptions. */\nexport const VERB_FLAG_HELP: Readonly<Record<Verb, readonly (readonly [string, string])[]>> =\n\tObject.freeze({\n\t\tnew: [\n\t\t\t['--src a,b', 'which src environments to include (core, browser, server)'],\n\t\t\t['--app a,b', 'which app environments to include (core, browser, server)'],\n\t\t\t['--deps x,y', '@orkestrel/* dependencies to add (installed as dependencies)'],\n\t\t\t['--apply', 'write the files (default is a dry run)'],\n\t\t\t['--yes', 'skip the confirmation question'],\n\t\t\t['--target <path>', 'destination directory (default: ./<name>)'],\n\t\t\t['--from <path>', 'read the template from a local path instead of the bundled one'],\n\t\t],\n\t\tpull: [\n\t\t\t['--target .', 'directory to refresh (default: current directory)'],\n\t\t\t['--deps x,y', 'limit the refresh to these dependencies'],\n\t\t\t['--apply', 'write the refreshed files (default is a dry run)'],\n\t\t\t['--yes', 'skip the confirmation question'],\n\t\t\t['--strict', 'fail (exit 1) on any drift, even non-fatal'],\n\t\t],\n\t\tmirror: [\n\t\t\t['--target .', 'directory whose guide mirror is refreshed (default: current directory)'],\n\t\t\t['--apply', 'write the refreshed guides (default is a dry run)'],\n\t\t\t['--yes', 'skip the confirmation question'],\n\t\t\t['--strict', 'fail immediately when an upstream guide cannot be fetched'],\n\t\t],\n\t\taudit: [\n\t\t\t['--target .', 'directory to audit (default: current directory)'],\n\t\t\t['--live', 'also check upstream freshness over the network'],\n\t\t\t['--generated', 'include generated canon if the repair hand-off is accepted'],\n\t\t\t['--from <path>', 'read the template from a local path instead of the bundled one'],\n\t\t\t['--groups a,b', 'limit the audit to these artifact groups'],\n\t\t],\n\t\trepair: [\n\t\t\t['--target .', 'directory to repair (default: current directory)'],\n\t\t\t['--generated', 'also restore generated canon except package.json'],\n\t\t\t['--apply', 'write the fixes (default is a dry run)'],\n\t\t\t['--yes', 'skip the confirmation question'],\n\t\t\t['--prune', 'also DELETE unexpected files under .claude/agents, .codex/agents, and scripts'],\n\t\t\t['--from <path>', 'read the template from a local path instead of the bundled one'],\n\t\t],\n\t\tfleet: [\n\t\t\t['--generated', 'also restore generated canon except package.json in every package'],\n\t\t\t['--apply', 'write fixes across every package (default is a dry run)'],\n\t\t\t['--yes', 'skip the confirmation question'],\n\t\t\t[\n\t\t\t\t'--prune',\n\t\t\t\t'also DELETE unexpected files under .claude/agents, .codex/agents, and scripts, per package',\n\t\t\t],\n\t\t\t['--from <path>', 'read the template from a local path instead of the bundled one'],\n\t\t],\n\t\tcatalog: [\n\t\t\t['--from <path> ...', 'one or more local package paths to include'],\n\t\t\t['--target <repo>', 'the repository whose Orkestrel agent catalog table gets updated'],\n\t\t\t['--offline', 'skip network lookups (npm registry) for package descriptions'],\n\t\t\t['--apply', 'write the updated table (default is a dry run)'],\n\t\t\t['--yes', 'skip the confirmation question'],\n\t\t],\n\t})\n\n/** Dry-run and confirmation notes per command. */\nexport const VERB_DRY_RUN_NOTE: Readonly<Record<Verb, string>> = Object.freeze({\n\tnew: 'dry run by default — add --apply to write the files, --yes to skip the question',\n\tpull: 'dry run by default — add --apply to write the refreshed files, --yes to skip the question',\n\tmirror:\n\t\t'dry run by default — add --apply to write every published package guide, --yes to skip the question',\n\taudit: 'read-only — audit never writes; pass --live to also check upstream freshness',\n\trepair: 'dry run by default — add --apply to write, --yes to skip the question',\n\tfleet:\n\t\t'dry run by default — add --apply to write across every package, --yes to skip the question',\n\tcatalog: 'dry run by default — add --apply to write, --yes to skip the question',\n})\n\n/** One concrete invocation per command. */\nexport const VERB_EXAMPLE: Readonly<Record<Verb, string>> = Object.freeze({\n\tnew: 'example: scaffold new widget --src core,server --app core,browser --apply',\n\tpull: 'example: scaffold pull --apply',\n\tmirror: 'example: scaffold mirror --apply --yes',\n\taudit: 'example: scaffold audit --live',\n\trepair: 'example: scaffold repair --apply',\n\tfleet: 'example: scaffold fleet --apply --yes',\n\tcatalog: 'example: scaffold catalog --apply',\n})\n\n/** Message used when a prune scan has no candidates. */\nexport const PRUNE_EMPTY = 'no unexpected files to delete'\n\n/** Guidance for unexpected files outside a non-pruning repair handoff. */\nexport const FOREIGN_HINT = \"unexpected files found — run 'scaffold repair --prune' to delete them\"\n\n/** Interactive dependency prompt. */\nexport const ORKESTREL_DEPS_PROMPT =\n\t'@orkestrel dependencies (comma-separated short names, e.g. contract, emitter — installed as dependencies)'\n\n/** Catalog-degraded validation note. */\nexport const CATALOG_UNRESOLVED_NOTE =\n\t\"couldn't resolve the vendored @orkestrel catalog — validating names by shape only\"\n\n/** Catalog block destination in a scaffolded repository. */\nexport const CATALOG_AGENT_PATH = '.claude/agents/orkestrel.md'\n\n/** Opening marker for the generated package catalog block. */\nexport const CATALOG_START_MARKER = '<!-- catalog:start -->'\n\n/** Closing marker for the generated package catalog block. */\nexport const CATALOG_END_MARKER = '<!-- catalog:end -->'\n\n/** Non-terminal prune safety note. */\nexport const PRUNE_SKIPPED =\n\t'prune skipped — not a terminal; add --apply (or --yes) to delete non-interactively'\n\n/** Degraded unexpected-file scan note. */\nexport const SCAN_SKIPPED =\n\t\"unexpected-file scanning skipped — couldn't establish the template source\"\n","/** Internal sentinel that unwinds command dispatch without bypassing cleanup. */\nexport class CLIExitError extends Error {\n\treadonly code: number\n\n\tconstructor(code: number) {\n\t\tsuper(`cli-exit:${String(code)}`)\n\t\tthis.code = code\n\t}\n}\n","import type { Audit, CatalogEntry, Finding, Plan, PlanSummary } from '@src/core'\nimport type { MaterializeResult } from '@src/server'\nimport type {\n\tAuditCounts,\n\tCatalogResult,\n\tErrorEnvelope,\n\tFleetEntry,\n\tNewResult,\n\tOriginPartition,\n\tRepairResult,\n} from './types.js'\n\n/** Partition findings by whether repair owns their artifact origin. */\nexport function partitionFindings(findings: readonly Finding[], plan: Plan): OriginPartition {\n\tconst origins = new Map(plan.artifacts.map((artifact) => [artifact.path, artifact.origin]))\n\tlet ownedDrifted = 0\n\tlet ownedMissing = 0\n\tlet ownedForeign = 0\n\tlet generatedDrifted = 0\n\tlet generatedMissing = 0\n\tlet generatedForeign = 0\n\tfor (const finding of findings) {\n\t\tconst origin = origins.get(finding.path)\n\t\tconst owned = origin === 'host' || origin === 'template'\n\t\tif (finding.drift === 'aligned') continue\n\t\tif (finding.drift === 'stale') {\n\t\t\tif (owned) ownedDrifted += 1\n\t\t\telse generatedDrifted += 1\n\t\t} else if (finding.drift === 'missing') {\n\t\t\tif (owned) ownedMissing += 1\n\t\t\telse generatedMissing += 1\n\t\t} else if (owned) {\n\t\t\townedForeign += 1\n\t\t} else {\n\t\t\tgeneratedForeign += 1\n\t\t}\n\t}\n\treturn {\n\t\towned: { drifted: ownedDrifted, missing: ownedMissing, foreign: ownedForeign },\n\t\tgenerated: {\n\t\t\tdrifted: generatedDrifted,\n\t\t\tmissing: generatedMissing,\n\t\t\tforeign: generatedForeign,\n\t\t},\n\t}\n}\n\n/** Create one deterministic fleet result entry. */\nexport function fleetEntryOf(\n\tname: string,\n\tcounts: AuditCounts | undefined,\n\tfailed: boolean,\n): FleetEntry {\n\treturn {\n\t\tname,\n\t\tdrifted: counts?.drifted ?? 0,\n\t\tmissing: counts?.missing ?? 0,\n\t\tforeign: counts?.foreign ?? 0,\n\t\tfailed,\n\t}\n}\n\n/** Create the command-line interface's machine-readable failure envelope. */\nexport function errorEnvelopeOf(code: string, message: string): ErrorEnvelope {\n\treturn { error: { code, message } }\n}\n\n/** Project a plan summary to the stable machine-readable `new` result. */\nexport function summaryToNewResult(summary: PlanSummary, applied: boolean): NewResult {\n\treturn {\n\t\tname: summary.name,\n\t\tsrc: summary.src,\n\t\tapp: summary.app,\n\t\thost: summary.host,\n\t\ttemplate: summary.template,\n\t\tcomputed: summary.computed,\n\t\tapplied,\n\t}\n}\n\n/** Add a materialization result to an audit. */\nexport function auditToRepairResult(audit: Audit, result: MaterializeResult): RepairResult {\n\treturn { ...audit, result }\n}\n\n/** Create the stable machine-readable catalog result. */\nexport function catalogResultOf(\n\tentries: readonly CatalogEntry[],\n\tdrift: boolean,\n\tshrink?: number,\n): CatalogResult {\n\treturn shrink === undefined ? { entries, drift } : { entries, drift, shrink }\n}\n","import type { Audit, CatalogEntry, Finding, Plan, PlanSummary, SyncReport } from '@src/core'\nimport { DEPENDENCY_NAME_PATTERN, isScaffoldError, ScaffoldError } from '@src/core'\nimport { isFilesystemPath, resolvePhysicalPath } from '@src/server'\nimport type { MaterializeResult } from '@src/server'\nimport type { TableOptions } from '@orkestrel/console'\nimport { attempt } from '@orkestrel/contract'\nimport {\n\tACTION_LABEL,\n\tDRIFT_LABEL,\n\tEXIT_CODES,\n\tFRESHNESS_LABEL,\n\tKNOWN_VERBS,\n\tORIGIN_LABEL,\n\tSAFETY_BANNER,\n\tVERB_DRY_RUN_NOTE,\n\tVERB_EXAMPLE,\n\tVERB_FLAG_HELP,\n\tVERB_FLAGS,\n\tVERB_SUMMARY,\n} from './constants.js'\nimport { partitionFindings } from './shapers.js'\nimport type { AuditCounts, FleetOutcome, Verb } from './types.js'\n\n/** Render one pluralized count. */\nexport function countPart(count: number, label: string): string {\n\treturn `${count} ${label}${count === 1 ? '' : 's'}`\n}\n\n/** Render nonzero audit buckets or `clean`. */\nexport function bucketText(counts: AuditCounts): string {\n\tconst parts: string[] = []\n\tif (counts.drifted > 0) parts.push(countPart(counts.drifted, 'drifted'))\n\tif (counts.missing > 0) parts.push(countPart(counts.missing, 'missing'))\n\tif (counts.foreign > 0) parts.push(countPart(counts.foreign, 'unexpected'))\n\treturn parts.length > 0 ? parts.join(', ') : 'clean'\n}\n\n/** Render audit's origin-aware verdict. */\nexport function auditVerdict(audit: Audit, plan: Plan): string {\n\tconst count = audit.findings.length\n\tif (audit.clean) return `audit: ${countPart(count, 'artifact')} — clean`\n\tconst split = partitionFindings(audit.findings, plan)\n\tconst owned = split.owned.drifted === 0 && split.owned.missing === 0 && split.owned.foreign === 0\n\treturn owned\n\t\t? `audit: ${countPart(count, 'artifact')} — host-owned clean; ${bucketText(split.generated)} (generated)`\n\t\t: `audit: ${countPart(count, 'artifact')} — host-owned: ${bucketText(split.owned)}; generated: ${bucketText(split.generated)}`\n}\n\n/** Render non-aligned audit findings as terminal table rows. */\nexport function findingRows(\n\tfindings: readonly Finding[],\n\tplan: Plan,\n): readonly (readonly [string, string, string])[] {\n\tconst origins = new Map(plan.artifacts.map((artifact) => [artifact.path, artifact.origin]))\n\treturn findings\n\t\t.filter((finding) => finding.drift !== 'aligned')\n\t\t.map((finding): readonly [string, string, string] => {\n\t\t\tconst origin = origins.get(finding.path)\n\t\t\tconst category = origin === undefined ? 'unexpected file' : ORIGIN_LABEL[origin]\n\t\t\treturn [DRIFT_LABEL[finding.drift], category, finding.path]\n\t\t})\n}\n\n/** Create audit's terminal table. */\nexport function auditTable(audit: Audit, plan: Plan): TableOptions {\n\treturn {\n\t\tcolumns: [{ label: 'Status' }, { label: 'Kind' }, { label: 'Path' }],\n\t\trows: findingRows(audit.findings, plan),\n\t}\n}\n\n/**\n * Render drift outside repair's selected ownership boundary.\n *\n * @param count - The number of findings outside the selected scope.\n * @param generated - Whether generated canon was included in the repair scope.\n * @returns The scope guidance line, or `undefined` when no findings remain outside scope.\n */\nexport function scopeNote(count: number, generated: boolean): string | undefined {\n\tif (count === 0) return undefined\n\treturn generated\n\t\t? `note: ${countPart(count, 'finding')} outside host-owned and generated repair scope — run 'audit' for the list; starter files and package.json remain protected`\n\t\t: `note: ${countPart(count, 'finding')} outside host-owned repair scope — run 'audit' for the list`\n}\n\n/**\n * Render repair's dry-run verdict.\n *\n * @param audit - The audit over the selected repair plan.\n * @param generated - Whether generated canon was included in the repair scope.\n * @returns The scope-aware clean or drifted verdict.\n */\nexport function repairVerdict(audit: Audit, generated: boolean): string {\n\tconst scope = generated ? 'host-owned and generated' : 'host-owned'\n\tif (audit.clean) {\n\t\treturn `repair: ${countPart(audit.findings.length, `${scope} artifact`)} aligned — nothing to write`\n\t}\n\treturn `repair: ${scope}: ${bucketText(audit)} — pass --apply to write`\n}\n\n/** Render repair's materialization tally. */\nexport function repairSuccess(result: MaterializeResult, removed: readonly string[]): string {\n\tconst written = result.written.length + result.copied.length\n\treturn `${ACTION_LABEL.written} ${written}, ${ACTION_LABEL.skipped} ${result.skipped.length}, ${ACTION_LABEL.removed} ${removed.length}`\n}\n\n/** Render synchronization freshness as table rows. */\nexport function syncRows(report: SyncReport): readonly (readonly [string, string, string])[] {\n\tconst guides = report.guides.map((guide): readonly [string, string, string] => [\n\t\tguide.name,\n\t\t'guide',\n\t\tFRESHNESS_LABEL[guide.freshness] ?? guide.freshness,\n\t])\n\tconst versions = report.versions.map((version): readonly [string, string, string] => [\n\t\tversion.name,\n\t\t'version',\n\t\tFRESHNESS_LABEL[version.freshness] ?? version.freshness,\n\t])\n\treturn [...guides, ...versions]\n}\n\n/** Create a synchronization terminal table. */\nexport function syncTable(report: SyncReport): TableOptions {\n\treturn {\n\t\tcolumns: [{ label: 'Name' }, { label: 'Kind' }, { label: 'Freshness' }],\n\t\trows: syncRows(report),\n\t}\n}\n\n/** Render cause notes from non-current synchronization entries. */\nexport function syncCauseNotes(report: SyncReport): readonly string[] {\n\treturn [...report.guides, ...report.versions]\n\t\t.filter((entry) => entry.note !== undefined)\n\t\t.map(\n\t\t\t(entry) =>\n\t\t\t\t` ${entry.name}: ${FRESHNESS_LABEL[entry.freshness] ?? entry.freshness} — ${entry.note}`,\n\t\t)\n}\n\n/** Render a command-specific synchronization tally. */\nexport function syncVerdict(report: SyncReport, action: 'pull' | 'mirror'): string {\n\tconst count = report.guides.length + report.versions.length\n\treturn `${action}: ${String(count)} ${count === 1 ? 'entry' : 'entries'} — ${String(report.failed)} failed`\n}\n\n/** Render a synchronization success tally. */\nexport function syncSuccess(count: number): string {\n\treturn `wrote ${countPart(count, 'guide')}`\n}\n\n/** Render one fleet repository outcome. */\nexport function fleetRepoLine(name: string, outcome: FleetOutcome): string {\n\tif (outcome.state === 'clean') return `${name}: clean`\n\tif (outcome.state === 'drifted') return `${name}: ${bucketText(outcome)}`\n\tif (outcome.state === 'repaired') {\n\t\treturn `${name}: repaired (${countPart(outcome.remaining, 'finding')} remaining)`\n\t}\n\treturn `${name}: ${outcome.message}`\n}\n\n/** Render fleet's repository totals. */\nexport function fleetTotals(drifted: number, failed: number): string {\n\treturn `total: ${countPart(drifted, 'drifted repo')}, ${countPart(failed, 'failed')}`\n}\n\n/** Create catalog's terminal table. */\nexport function catalogTable(entries: readonly CatalogEntry[]): TableOptions {\n\treturn {\n\t\tcolumns: [{ label: 'Package' }, { label: 'Version' }],\n\t\trows: entries.map((entry) => [entry.name, entry.version]),\n\t}\n}\n\n/** Render catalog shrink risk when present. */\nexport function catalogShrinkWarning(oldRows: number, newRows: number): string | undefined {\n\tif (newRows >= oldRows) return undefined\n\treturn `warning: catalog shrinks from ${countPart(oldRows, 'row')} to ${newRows}`\n}\n\n/** Render catalog source tallies. */\nexport function catalogCounts(published: number, local: number): string {\n\treturn `catalog: ${countPart(published, 'published package')}, ${countPart(local, 'local-only')}`\n}\n\n/** Create `new`'s plan summary table. */\nexport function newPlanTable(summary: PlanSummary): TableOptions {\n\treturn {\n\t\tcolumns: [{ label: 'Origin' }, { label: 'Count', align: 'right' }],\n\t\trows: [\n\t\t\t['host-owned', String(summary.host)],\n\t\t\t['starter', String(summary.template)],\n\t\t\t['generated', String(summary.computed)],\n\t\t],\n\t}\n}\n\n/** Render `new`'s dry-run destination. */\nexport function newPlanPreview(name: string): string {\n\treturn `will write into ./${name}`\n}\n\n/** Render `new`'s write result. */\nexport function newApplySuccess(count: number, name: string): string {\n\treturn `wrote ${countPart(count, 'file')} into ./${name}`\n}\n\n/** Render catalog's write result. */\nexport function catalogApplySuccess(path: string): string {\n\treturn `wrote ${path}`\n}\n\n/** Render the shared write confirmation. */\nexport function applyConfirmMessage(files: number, repos?: number): string {\n\tconst scope = repos === undefined ? '' : ` across ${countPart(repos, 'repo')}`\n\treturn `Apply — write ${countPart(files, 'file')}${scope}? `\n}\n\n/** Render the separate prune confirmation. */\nexport function pruneConfirmMessage(count: number): string {\n\treturn `Also delete ${countPart(count, 'unexpected file')} under .claude/agents, .codex/agents, and scripts? `\n}\n\n/** Render the interactive audit-to-repair handoff. */\nexport function repairHandoff(owned: number, foreign: number, prune: boolean): string {\n\tconst parts: string[] = []\n\tif (owned > 0) {\n\t\tparts.push(`${countPart(owned, 'host-owned file')} ${owned === 1 ? 'has' : 'have'} drift`)\n\t}\n\tif (prune && foreign > 0) {\n\t\tparts.push(`${countPart(foreign, 'unexpected file')} will be deleted`)\n\t}\n\treturn `${parts.join(' and ')} — run repair now? `\n}\n\n/** Render one unresolved Orkestrel dependency token. */\nexport function unknownOrkestrelToken(token: string, suggestion: string | undefined): string {\n\tconst message = `\"${token}\" is not a published @orkestrel package`\n\treturn suggestion === undefined\n\t\t? `${message} — try again`\n\t\t: `${message} — did you mean \"${suggestion}\"? try again`\n}\n\n/** Render compact command usage. */\nexport function shortUsage(): string {\n\tconst lines = KNOWN_VERBS.map((verb) => ` ${verb.padEnd(8)}${VERB_SUMMARY[verb]}`)\n\treturn [\n\t\t'scaffold <verb> [options]',\n\t\t'',\n\t\t...lines,\n\t\t'',\n\t\t\"run 'scaffold <verb> --help' for a verb's full reference\",\n\t].join('\\n')\n}\n\n/** Render the full command reference. */\nexport function fullHelp(): string {\n\tconst verbs = KNOWN_VERBS.map(\n\t\t(verb) => ` ${verb} ${VERB_FLAGS[verb]}\\n ${VERB_SUMMARY[verb]}`,\n\t)\n\tconst exits = EXIT_CODES.map(([code, meaning]) => ` ${code} ${meaning}`)\n\treturn [\n\t\t'scaffold <verb> [options]',\n\t\t'',\n\t\t...verbs,\n\t\t'',\n\t\tSAFETY_BANNER,\n\t\t'',\n\t\t'exit codes:',\n\t\t...exits,\n\t].join('\\n')\n}\n\n/** Render one command's help reference. */\nexport function verbHelp(verb: Verb): string {\n\tconst flags = VERB_FLAG_HELP[verb].map(([flag, meaning]) => ` ${flag.padEnd(20)}${meaning}`)\n\treturn [\n\t\t`scaffold ${verb} ${VERB_FLAGS[verb]}`,\n\t\t'',\n\t\tVERB_SUMMARY[verb],\n\t\tVERB_DRY_RUN_NOTE[verb],\n\t\t'',\n\t\t...flags,\n\t\t'',\n\t\tVERB_EXAMPLE[verb],\n\t].join('\\n')\n}\n\n/** Compute Levenshtein edit distance. */\nexport function editDistance(left: string, right: string): number {\n\tconst rows = left.length + 1\n\tconst columns = right.length + 1\n\tconst table = new Uint32Array(rows * columns)\n\tfor (let row = 0; row < rows; row += 1) table[row * columns] = row\n\tfor (let column = 0; column < columns; column += 1) table[column] = column\n\tfor (let row = 1; row < rows; row += 1) {\n\t\tfor (let column = 1; column < columns; column += 1) {\n\t\t\tconst cost = left[row - 1] === right[column - 1] ? 0 : 1\n\t\t\tconst index = row * columns + column\n\t\t\ttable[index] = Math.min(\n\t\t\t\t(table[index - columns] ?? 0) + 1,\n\t\t\t\t(table[index - 1] ?? 0) + 1,\n\t\t\t\t(table[index - columns - 1] ?? 0) + cost,\n\t\t\t)\n\t\t}\n\t}\n\treturn table[rows * columns - 1] ?? 0\n}\n\n/** Find the nearest string by edit distance. */\nexport function nearest(input: string, set: readonly string[]): string | undefined {\n\tlet best: string | undefined\n\tlet distance = Number.POSITIVE_INFINITY\n\tfor (const candidate of set) {\n\t\tconst candidateDistance = editDistance(input, candidate)\n\t\tif (candidateDistance < distance) {\n\t\t\tdistance = candidateDistance\n\t\t\tbest = candidate\n\t\t}\n\t}\n\treturn best\n}\n\n/** Render an unknown command with a nearest-command hint. */\nexport function didYouMean(command: string): string {\n\tconst suggestion = nearest(command, KNOWN_VERBS)\n\treturn suggestion === undefined\n\t\t? `unknown command \"${command}\"`\n\t\t: `unknown command \"${command}\" — did you mean \"${suggestion}\"?`\n}\n\n/** Render one prune preview line per exact path. */\nexport function prunePreview(paths: readonly string[]): readonly string[] {\n\treturn paths.map((path) => ` delete ${path}`)\n}\n\n/** Render non-terminal guidance for missing input. */\nexport function missingInput(input: string, verb: string): string {\n\treturn `missing ${input} — pass it as a flag/argument, or run 'scaffold ${verb}' on a terminal to be guided`\n}\n\n/** Render an invalid package name. */\nexport function invalidName(name: string, pattern: string): string {\n\treturn `Package name \"${name}\" must match ${pattern}`\n}\n\n/** Render dependencies whose latest versions could not be resolved. */\nexport function unresolvedVersion(names: readonly string[]): string {\n\treturn `could not resolve the latest version for ${names.map((name) => `\"${name}\"`).join(', ')} — check the name or pass name@range`\n}\n\n/** Render drift that belongs to generated artifacts. */\nexport function generatedNote(count: number): string {\n\treturn `${countPart(count, 'finding')} in generated files — these are regenerated, not hand-edited; run 'scaffold repair --generated' to restore them`\n}\n\n/**\n * Render honest repair guidance for computed and protected manifest drift.\n *\n * @param findings - The audit findings to classify.\n * @param plan - The plan that owns each computed artifact.\n * @returns One line for repairable computed drift and one for protected manifest drift when present.\n */\nexport function renderComputedNotes(findings: readonly Finding[], plan: Plan): readonly string[] {\n\tconst origins = new Map(plan.artifacts.map((artifact) => [artifact.path, artifact.origin]))\n\tlet computed = 0\n\tlet manifest = 0\n\tfor (const finding of findings) {\n\t\tif (finding.drift === 'aligned' || origins.get(finding.path) !== 'computed') continue\n\t\tif (finding.path === 'package.json') manifest += 1\n\t\telse computed += 1\n\t}\n\tconst notes: string[] = []\n\tif (computed > 0) notes.push(generatedNote(computed))\n\tif (manifest > 0) {\n\t\tnotes.push(\n\t\t\t`${countPart(manifest, 'finding')} in package.json — repair does not rewrite protected publication metadata; review and edit it directly`,\n\t\t)\n\t}\n\treturn notes\n}\n\n/** Render live dependency freshness tallies. */\nexport function auditLiveNote(current: number, behind: number, failed: number): string {\n\treturn `live: ${countPart(current, 'current')}, ${countPart(behind, 'behind')}, ${countPart(failed, 'failed')}`\n}\n\n/** Render whether an audit compared content or presence. */\nexport function comparisonLine(aware: boolean): string {\n\treturn aware\n\t\t? 'comparing: file contents for host-owned files'\n\t\t: 'comparing: file names only for host-owned files (no vendored source found)'\n}\n\n/** Render catalog's final verdict. */\nexport function catalogVerdict(clean: boolean): string {\n\treturn clean ? 'catalog: clean' : 'catalog: drifted — pass --apply to write'\n}\n\n/** Render a caught error without leaking implementation detail. */\nexport function describeError(error: unknown): string {\n\tif (isScaffoldError(error)) return `[${error.code}] ${error.message}`\n\treturn error instanceof Error ? error.message : 'unknown error'\n}\n\n/** Resolve and confine one write destination to its invocation root. */\nexport function containDestination(root: string, candidate: string): string {\n\tif (!isFilesystemPath(root) || !isFilesystemPath(candidate)) {\n\t\tthrow new ScaffoldError('INVALID', 'Target paths must not contain control characters')\n\t}\n\tconst contained = attempt(() =>\n\t\tresolvePhysicalPath(root, candidate, 'INVALID', 'working directory'),\n\t)\n\tif (contained.success) return contained.value\n\tif (isScaffoldError(contained.error) && contained.error.code === 'INVALID') {\n\t\tthrow new ScaffoldError(\n\t\t\t'INVALID',\n\t\t\t`Target \"${candidate}\" is outside or traverses a linked parent of the working directory — run scaffold from the physical directory you want to write beneath.`,\n\t\t\t{ path: candidate },\n\t\t)\n\t}\n\tthrow contained.error\n}\n\n/** Return one dependency-token issue, or absence when it is valid. */\nexport function orkestrelTokenIssue(\n\tnormalized: string,\n\tcatalog: readonly string[] | undefined,\n): string | undefined {\n\tif (catalog === undefined) {\n\t\treturn DEPENDENCY_NAME_PATTERN.test(normalized)\n\t\t\t? undefined\n\t\t\t: unknownOrkestrelToken(normalized, undefined)\n\t}\n\tif (catalog.includes(normalized)) return undefined\n\treturn unknownOrkestrelToken(normalized, nearest(normalized, catalog))\n}\n","import { parseArgs } from 'node:util'\nimport type { Dependency } from '@src/core'\nimport { isTerminalText } from '@src/server'\nimport { DEPENDENCY_NAME_PATTERN, ScaffoldError } from '@src/core'\nimport type { CLIArguments } from './types.js'\n\n/** Parse a strict command-line argument vector. */\nexport function parseArguments(argv: readonly string[]): CLIArguments {\n\tif (argv.some((argument) => !isTerminalText(argument))) {\n\t\tthrow new ScaffoldError('INVALID', 'Command arguments must not contain control characters')\n\t}\n\tconst args = argv[0] === '--' ? argv.slice(1) : [...argv]\n\treturn parseArgs({\n\t\targs,\n\t\tallowPositionals: true,\n\t\toptions: {\n\t\t\tsrc: { type: 'string' },\n\t\t\tapp: { type: 'string' },\n\t\t\tdeps: { type: 'string' },\n\t\t\tgroups: { type: 'string' },\n\t\t\ttarget: { type: 'string' },\n\t\t\tfrom: { type: 'string', multiple: true },\n\t\t\tapply: { type: 'boolean', default: false },\n\t\t\tyes: { type: 'boolean', default: false },\n\t\t\tjson: { type: 'boolean', default: false },\n\t\t\tprune: { type: 'boolean', default: false },\n\t\t\tgenerated: { type: 'boolean', default: false },\n\t\t\tstrict: { type: 'boolean', default: false },\n\t\t\tlive: { type: 'boolean', default: false },\n\t\t\toffline: { type: 'boolean', default: false },\n\t\t\thelp: { type: 'boolean', default: false, short: 'h' },\n\t\t},\n\t})\n}\n\n/** Split a comma-separated token list, trimming and dropping empty entries. */\nexport function splitTokens(raw: string): readonly string[] {\n\treturn raw\n\t\t.split(',')\n\t\t.map((token) => token.trim())\n\t\t.filter((token) => token.length > 0)\n}\n\n/** Normalize an Orkestrel dependency token to its full package name. */\nexport function normalizeOrkestrelToken(token: string): string {\n\treturn token.startsWith('@orkestrel/') ? token : `@orkestrel/${token}`\n}\n\n/**\n * Parse and resolve a pull dependency selection against the target manifest.\n *\n * @param raw - The comma-separated full package names, or `undefined` for all.\n * @param declared - The target's declared Orkestrel dependencies.\n * @returns `undefined` for all dependencies, otherwise the exact selected records.\n * @throws `ScaffoldError('INVALID')` for empty, malformed, repeated, or undeclared names.\n */\nexport function parsePullDependencies(\n\traw: string | undefined,\n\tdeclared: readonly Dependency[],\n): readonly Dependency[] | undefined {\n\tif (raw === undefined) return undefined\n\tconst names = raw.split(',').map((name) => name.trim())\n\tif (\n\t\tnames.length === 0 ||\n\t\tnames.some((name) => !DEPENDENCY_NAME_PATTERN.test(name)) ||\n\t\tnew Set(names).size !== names.length\n\t) {\n\t\tthrow new ScaffoldError(\n\t\t\t'INVALID',\n\t\t\t'Pull dependencies must be unique, comma-separated @orkestrel/* package names',\n\t\t)\n\t}\n\tconst selected = declared.filter((dependency) => names.includes(dependency.name))\n\tconst found = new Set(selected.map((dependency) => dependency.name))\n\tconst missing = names.filter((name) => !found.has(name))\n\tif (missing.length > 0) {\n\t\tthrow new ScaffoldError(\n\t\t\t'INVALID',\n\t\t\t`Pull dependencies are not declared by the target: ${missing.join(', ')}`,\n\t\t\t{ dependencies: missing },\n\t\t)\n\t}\n\treturn selected\n}\n","import { KNOWN_VERBS } from './constants.js'\nimport type { Verb } from './types.js'\n\n/** Narrow a positional command to the command-line interface's vocabulary. */\nexport function isVerb(value: string): value is Verb {\n\treturn KNOWN_VERBS.some((verb) => verb === value)\n}\n","// The `#!/usr/bin/env node` shebang is re-emitted by the build's `output.banner`, not source.\nimport { existsSync, mkdirSync, writeFileSync } from 'node:fs'\nimport { basename, dirname, join, relative as relativeOf } from 'node:path'\nimport * as tls from 'node:tls'\nimport type {\n\tAudit,\n\tBlueprint,\n\tCatalogEntry,\n\tFinding,\n\tDependency,\n\tGroup,\n\tPlan,\n\tQuestion,\n\tSnapshot,\n\tSyncReport,\n} from '@src/core'\nimport type { SyncInterface, SyncOptions } from '@src/server'\nimport {\n\tblueprint,\n\tcatalogNames,\n\tcatalogToBlock,\n\tcreateCompiler,\n\tdependency,\n\tDEPENDENCY_NAME_PATTERN,\n\tdiffPlan,\n\tGROUPS,\n\tisScaffoldError,\n\tmanifestToDependencies,\n\tmanifestToName,\n\tMAX_ARTIFACT_BYTES,\n\tNAME_PATTERN,\n\tplanToSummary,\n\tScaffoldError,\n\tSERVICE_SCRIPT_PATH,\n\tENVIRONMENTS,\n} from '@src/core'\nimport {\n\tcatalogPackages,\n\tcommitWriteTransaction,\n\tcreateMaterializer,\n\tcreateSync,\n\tderiveBlueprint,\n\tdiscoverPackages,\n\tdigestFile,\n\tdigestText,\n\tdiscardWriteTransaction,\n\thostRoot,\n\thydratePlan,\n\tisRealDirectory,\n\tisVacant,\n\tlocateHostSource,\n\tpruneTargets,\n\treadFileText,\n\treadHostManifest,\n\treadManifest,\n\treadTarget,\n\tparseSyncOptions,\n\tresolvePhysicalPath,\n\tvalidateWriteDirectories,\n\tWriteTransaction,\n} from '@src/server'\nimport type { SpinnerInterface } from '@orkestrel/console'\nimport { createReporter, createSpinner, createStyler } from '@orkestrel/console'\nimport { createServerSink } from '@orkestrel/console/server'\nimport { attempt } from '@orkestrel/contract'\nimport { isTerminalError } from '@orkestrel/terminal'\nimport type { TerminalInterface } from '@orkestrel/terminal/server'\nimport { createTerminal } from '@orkestrel/terminal/server'\nimport {\n\tCANCELLED_MESSAGE,\n\tCATALOG_UNRESOLVED_NOTE,\n\tCATALOG_AGENT_PATH,\n\tCATALOG_END_MARKER,\n\tCATALOG_START_MARKER,\n\tFOREIGN_HINT,\n\tINVALID_ARGUMENTS_MESSAGE,\n\tNEW_DRY_RUN_NOTE,\n\tORKESTREL_DEPS_PROMPT,\n\tPRUNE_EMPTY,\n\tPRUNE_SKIPPED,\n\tREPAIR_GENERATED_SCOPE,\n\tREPAIR_SCOPE,\n\tSCAN_SKIPPED,\n\tENVIRONMENT_CHOICES,\n} from './constants.js'\nimport { CLIExitError } from './errors.js'\nimport {\n\tapplyConfirmMessage,\n\tauditLiveNote,\n\tauditTable,\n\tauditVerdict,\n\tcatalogApplySuccess,\n\tcatalogCounts,\n\tcatalogShrinkWarning,\n\tcatalogTable,\n\tcatalogVerdict,\n\tcomparisonLine,\n\tcontainDestination,\n\tdescribeError,\n\tdidYouMean,\n\tfleetRepoLine,\n\tfleetTotals,\n\tfullHelp,\n\tinvalidName,\n\tmissingInput,\n\tnewApplySuccess,\n\tnewPlanPreview,\n\tnewPlanTable,\n\torkestrelTokenIssue,\n\tprunePreview,\n\tpruneConfirmMessage,\n\tsyncCauseNotes,\n\tsyncSuccess,\n\tsyncTable,\n\tsyncVerdict,\n\trepairHandoff,\n\trepairSuccess,\n\trepairVerdict,\n\trenderComputedNotes,\n\tscopeNote,\n\tshortUsage,\n\tunresolvedVersion,\n\tverbHelp,\n} from './helpers.js'\nimport {\n\tnormalizeOrkestrelToken,\n\tparseArguments,\n\tparsePullDependencies,\n\tsplitTokens,\n} from './parsers.js'\nimport {\n\tauditToRepairResult,\n\tcatalogResultOf,\n\terrorEnvelopeOf,\n\tfleetEntryOf,\n\tpartitionFindings,\n\tsummaryToNewResult,\n} from './shapers.js'\nimport type {\n\tCLIArguments,\n\tCLIInterface,\n\tCLIValues,\n\tFleetEntry,\n\tFleetFailure,\n\tFleetRepo,\n\tForeignScanResult,\n\tLiveResult,\n} from './types.js'\nimport { isVerb } from './validators.js'\n\n/** Stateful command-line orchestration and its process boundary. */\nexport class CLI implements CLIInterface {\n\treadonly #sync: SyncOptions\n\t#sink = createServerSink()\n\t#tty = process.stdout.isTTY === true\n\t#styler = createStyler({ enabled: process.env.NO_COLOR === undefined && this.#tty })\n\t#reporter = createReporter({\n\t\tsink: this.#sink,\n\t\twidth: this.#sink.columns,\n\t\tstyler: this.#styler,\n\t})\n\t#json = false\n\n\t/**\n\t * Create command-line orchestration with optional upstream endpoint settings.\n\t *\n\t * @param sync - Sync settings used by every live dependency operation.\n\t */\n\tconstructor(sync?: SyncOptions) {\n\t\tthis.#sync = parseSyncOptions(sync)\n\t}\n\n\t/** Execute one command-line argument vector. */\n\tasync run(argv: readonly string[]): Promise<void> {\n\t\tthis.#trust()\n\t\ttry {\n\t\t\tawait this.#dispatch(argv)\n\t\t} catch (error) {\n\t\t\tif (error instanceof CLIExitError) {\n\t\t\t\tprocess.exitCode = error.code\n\t\t\t} else if (this.#json) {\n\t\t\t\tconst code = isScaffoldError(error) ? error.code : 'ERROR'\n\t\t\t\tconst message = isScaffoldError(error) ? error.message : describeError(error)\n\t\t\t\tthis.#write(errorEnvelopeOf(code, message))\n\t\t\t\tprocess.exitCode = 1\n\t\t\t} else {\n\t\t\t\tthis.#reporter.status('error', describeError(error))\n\t\t\t\tprocess.exitCode = 1\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Widen Node's default trusted-issuer set to include the OS certificate\n\t * store, so `fetch` behind a corporate TLS-inspecting proxy behaves like npm\n\t * (`cafile`) and browsers (OS trust store) instead of failing with\n\t * `UNABLE_TO_GET_ISSUER_CERT_LOCALLY` against Node's bundled CA list alone.\n\t * Feature-detected (`tls.getCACertificates` / `tls.setDefaultCACertificates`\n\t * ship on Node ≈22.16+/24.5+; this package's floor is `>=22.12.0`) and captured\n\t * through `attempt` — any failure is a silent no-op, never a crash. This only ADDS\n\t * trusted issuers; it never touches `rejectUnauthorized` or\n\t * `NODE_TLS_REJECT_UNAUTHORIZED`, so certificate verification stays on.\n\t */\n\t#trust(): void {\n\t\tif (\n\t\t\ttypeof tls.getCACertificates !== 'function' ||\n\t\t\ttypeof tls.setDefaultCACertificates !== 'function'\n\t\t) {\n\t\t\treturn\n\t\t}\n\t\tattempt(() => {\n\t\t\tconst merged = new Set([\n\t\t\t\t...tls.getCACertificates('default'),\n\t\t\t\t...tls.getCACertificates('system'),\n\t\t\t])\n\t\t\ttls.setDefaultCACertificates([...merged])\n\t\t})\n\t}\n\n\t/** Write ONE machine-readable JSON value to stdout — the entire `--json` output contract. */\n\t#write(value: unknown): void {\n\t\tprocess.stdout.write(`${JSON.stringify(value)}\\n`)\n\t}\n\n\t/** Report a general operation failure with exit 1 as prose or one JSON error envelope. */\n\t#fail(message: string, json: boolean): never {\n\t\tif (json) this.#write(errorEnvelopeOf('ERROR', message))\n\t\telse this.#reporter.status('error', message)\n\t\tthrow new CLIExitError(1)\n\t}\n\n\t/**\n\t * A general operation failure from a caught error — the real\n\t * `ScaffoldError` code when available ('ERROR' last resort), prose (via\n\t * `describe`, which still carries the bracketed code for a human reader) or\n\t * the one JSON error envelope under `--json` (code and message kept\n\t * SEPARATE — never double-encoding the code into the message text).\n\t */\n\t#error(error: unknown, json: boolean): never {\n\t\tif (json) {\n\t\t\tconst code = isScaffoldError(error) ? error.code : 'ERROR'\n\t\t\tconst message = isScaffoldError(error) ? error.message : describeError(error)\n\t\t\tthis.#write(errorEnvelopeOf(code, message))\n\t\t} else {\n\t\t\tthis.#reporter.status('error', describeError(error))\n\t\t}\n\t\tthrow new CLIExitError(1)\n\t}\n\n\t/** A usage error (bad flag value, unknown verb — exit 2) — stderr prose, or the one JSON error envelope under `--json`. */\n\t#usage(message: string, json: boolean): never {\n\t\tif (json) this.#write(errorEnvelopeOf('USAGE', message))\n\t\telse process.stderr.write(`${message}\\n`)\n\t\tthrow new CLIExitError(2)\n\t}\n\n\t/** Contain a destination and report any coded escape through the shared CLI error path. */\n\t#contain(candidate: string, json: boolean): string {\n\t\tconst contained = attempt(() => containDestination(process.cwd(), candidate))\n\t\tif (contained.success) return contained.value\n\t\tthis.#error(contained.error, json)\n\t}\n\n\t/** Compile a spec and report unresolved blocking questions through the shared CLI error path. */\n\t#compile(\n\t\tspec: Blueprint,\n\t\tjson: boolean,\n\t\tgroups?: readonly Group[],\n\t): readonly [plan: Plan, questions: readonly Question[]] {\n\t\tconst compiler = createCompiler()\n\t\ttry {\n\t\t\tconst scaffolding = compiler.compile(spec, groups)\n\t\t\tif (!scaffolding.plan) {\n\t\t\t\tconst blocking = scaffolding.questions.filter((question) => question.blocking)\n\t\t\t\tconst message = (blocking.length > 0 ? blocking : scaffolding.questions)\n\t\t\t\t\t.map((question) => question.text)\n\t\t\t\t\t.join('; ')\n\t\t\t\tthis.#fail(message, json)\n\t\t\t}\n\t\t\treturn [scaffolding.plan, scaffolding.questions]\n\t\t} finally {\n\t\t\tcompiler.destroy()\n\t\t}\n\t}\n\n\t// Exclude the consumer-owned service provisioner from every physical scan.\n\t#prunePaths(target: string, host: string, service: boolean): readonly string[] {\n\t\tconst seam = service ? SERVICE_SCRIPT_PATH : undefined\n\t\treturn pruneTargets(target, host).filter((path) => path !== seam)\n\t}\n\n\t/**\n\t * Merge the physical prune scan into `audit` as `foreign` findings — pure\n\t * object-spread composition in the BIN only (`src/core`'s `diffPlan` is never\n\t * modified/reimplemented). Every unexpected path except the declared service\n\t * workspace's exact `SERVICE_SCRIPT_PATH` becomes one `'orchestration'`-group\n\t * `foreign` finding (the `Group` every `PRUNE_DIRECTORIES` entry—`.claude/agents`,\n\t * `.codex/agents`, `scripts`—belongs to); any scan hit makes the merged audit\n\t * unclean, so an \"unexpected file\" is honestly counted as drift (exit 1)\n\t * instead of the structurally-always-zero `diffPlan.foreign`.\n\t */\n\t#scan(audit: Audit, target: string, host: string, service: boolean): Audit {\n\t\tconst paths = this.#prunePaths(target, host, service)\n\t\tif (paths.length === 0) return audit\n\t\tconst findings: Finding[] = paths.map((path) => ({\n\t\t\tpath,\n\t\t\tgroup: 'orchestration',\n\t\t\tdrift: 'foreign',\n\t\t}))\n\t\treturn {\n\t\t\t...audit,\n\t\t\tclean: false,\n\t\t\tforeign: audit.foreign + paths.length,\n\t\t\tfindings: [...audit.findings, ...findings],\n\t\t}\n\t}\n\n\t/**\n\t * Add unexpected-file findings when the vendored allowlist can be established.\n\t * When fail-closed allowlist discovery raises a coded `TARGET` failure, retain\n\t * the existing findings and mark the audit incomplete instead of crashing.\n\t */\n\t#scanSafe(audit: Audit, target: string, host: string, service: boolean): ForeignScanResult {\n\t\tconst scanned = attempt(() => this.#scan(audit, target, host, service))\n\t\tif (scanned.success) return { audit: scanned.value, skipped: false }\n\t\tif (isScaffoldError(scanned.error) && scanned.error.code === 'TARGET') {\n\t\t\treturn {\n\t\t\t\taudit: {\n\t\t\t\t\t...audit,\n\t\t\t\t\tclean: false,\n\t\t\t\t\tcomplete: false,\n\t\t\t\t\tquestions: [\n\t\t\t\t\t\t...audit.questions,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfield: 'host',\n\t\t\t\t\t\t\ttext: scanned.error.message,\n\t\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\tskipped: true,\n\t\t\t}\n\t\t}\n\t\tthrow scanned.error\n\t}\n\n\t/**\n\t * `repair` scopes to host-owned artifacts by default and optionally generated canon, but the\n\t * caller compiles the full plan anyway. Diff it too so a clean scoped verdict can point at drift\n\t * outside the selected boundary. The count feeds the shared `scopeNote` renderer.\n\t */\n\t#outside(compiled: Plan, target: string): number {\n\t\tconst full = diffPlan(\n\t\t\tcompiled,\n\t\t\treadTarget(\n\t\t\t\ttarget,\n\t\t\t\tcompiled.artifacts.map((artifact) => artifact.path),\n\t\t\t),\n\t\t)\n\t\treturn full.drifted + full.missing + full.foreign\n\t}\n\n\t/** Compile and audit the selected repair ownership boundary for one structural snapshot. */\n\t#prepareRepair(\n\t\tspec: Blueprint,\n\t\ttarget: string,\n\t\thost: string,\n\t\tgenerated: boolean,\n\t\tjson: boolean,\n\t): readonly [compiled: Plan, plan: Plan, audit: Audit] {\n\t\tconst [compiled] = this.#compile(spec, json)\n\t\tconst scoped: Plan = {\n\t\t\t...compiled,\n\t\t\tblueprint: { ...compiled.blueprint, overrides: [] },\n\t\t\tartifacts: compiled.artifacts.filter(\n\t\t\t\t(artifact) =>\n\t\t\t\t\tartifact.origin === 'host' ||\n\t\t\t\t\t(generated && artifact.origin === 'computed' && artifact.path !== 'package.json'),\n\t\t\t),\n\t\t}\n\n\t\tlet plan: Plan\n\t\ttry {\n\t\t\tplan = hydratePlan(scoped, host)\n\t\t} catch (error) {\n\t\t\tthis.#error(error, json)\n\t\t}\n\n\t\ttry {\n\t\t\tconst audit = diffPlan(\n\t\t\t\tplan,\n\t\t\t\treadTarget(\n\t\t\t\t\ttarget,\n\t\t\t\t\tplan.artifacts.map((artifact) => artifact.path),\n\t\t\t\t),\n\t\t\t)\n\t\t\treturn [compiled, plan, audit]\n\t\t} catch (error) {\n\t\t\tthis.#error(error, json)\n\t\t}\n\t}\n\n\t/** Reject a cancelled prompt (ctrl-c) with the shared `CANCELLED_MESSAGE` — exit 1, nothing written. */\n\tasync #guard<T>(promise: Promise<T>): Promise<T> {\n\t\ttry {\n\t\t\treturn await promise\n\t\t} catch (error) {\n\t\t\tif (isTerminalError(error) && error.code === 'CANCEL') {\n\t\t\t\tthis.#reporter.line(CANCELLED_MESSAGE)\n\t\t\t\tthrow new CLIExitError(1)\n\t\t\t}\n\t\t\tthrow error\n\t\t}\n\t}\n\n\t/**\n\t * The shared write-confirmation gate every verb calls before it touches disk.\n\t * `--apply` writes without asking; `--json` (without `--apply`) is a pure\n\t * dry-run and NEVER prompts; `--yes` auto-answers yes; otherwise a real\n\t * confirm with `default: false` (EOF on stdin resolves to the default).\n\t */\n\tasync #apply(\n\t\tterminal: TerminalInterface,\n\t\tmessage: string,\n\t\tvalues: CLIValues,\n\t\tjson: boolean,\n\t): Promise<boolean> {\n\t\tif (values.apply) return true\n\t\tif (json) return false\n\t\tif (values.yes) return true\n\t\treturn this.#guard(terminal.confirm({ message, default: false }))\n\t}\n\n\t/**\n\t * The SECOND, separate confirm for `--prune`-eligible deletions — never\n\t * bundled into `resolveApply`'s question. `--yes` only auto-answers this\n\t * when `--prune` was also passed (it never enables pruning by itself).\n\t */\n\tasync #prune(\n\t\tterminal: TerminalInterface,\n\t\tmessage: string,\n\t\tvalues: CLIValues,\n\t\tjson: boolean,\n\t): Promise<boolean> {\n\t\tif (!values.prune) return false\n\t\tif (values.apply) return true\n\t\tif (json) return false\n\t\tif (values.yes) return true\n\t\t// The write confirmation already consumed the single answer available on a\n\t\t// non-interactive stream. Never ask a second question from drained stdin;\n\t\t// skip pruning explicitly instead.\n\t\tif (!this.#tty) {\n\t\t\tthis.#reporter.line(PRUNE_SKIPPED)\n\t\t\treturn false\n\t\t}\n\t\treturn this.#guard(terminal.confirm({ message, default: false }))\n\t}\n\n\t/** A spinner for a long-running write step, absent under `--json` or off a TTY sink. */\n\t#spinner(message: string, json: boolean): SpinnerInterface | undefined {\n\t\treturn json || !this.#tty\n\t\t\t? undefined\n\t\t\t: createSpinner({ message, sink: this.#sink, styler: this.#styler })\n\t}\n\n\t/** Announce a successful write — the spinner's own success line, or a plain `reporter.status` without one (never under `--json`). */\n\t#succeed(spinner: SpinnerInterface | undefined, json: boolean, message: string): void {\n\t\tif (spinner) spinner.success(message)\n\t\telse if (!json) this.#reporter.status('success', message)\n\t}\n\n\t/** Announce a failed write and halt(1) — the spinner's own failure line (if any), then the shared `fail`. */\n\t#reject(spinner: SpinnerInterface | undefined, json: boolean, error: unknown): never {\n\t\tconst message = describeError(error)\n\t\tif (spinner) spinner.failure(message)\n\t\tthis.#fail(message, json)\n\t}\n\n\t/**\n\t * Best-effort vendored `@orkestrel` catalog names, resolved via `host`\n\t * (`hostRoot()`, or the active `--from` override) through the host manifest\n\t * — `undefined` when the catalog cannot be established (a missing/unreadable\n\t * manifest, no `.claude/agents/orkestrel.md` entry, or any other failure),\n\t * degrading the dependency prompt to shape-only validation instead of blocking on it.\n\t */\n\t#names(host: string): readonly string[] | undefined {\n\t\tconst names = attempt(() => {\n\t\t\tconst manifest = readHostManifest(host)\n\t\t\tconst full = locateHostSource(manifest, '.claude/agents/orkestrel.md', host)\n\t\t\tif (full === undefined || !existsSync(full)) return undefined\n\t\t\tconst relative = relativeOf(host, full).replaceAll('\\\\', '/')\n\t\t\treturn catalogNames(readFileText(host, relative, 'TARGET', 'host'))\n\t\t})\n\t\treturn names.success ? names.value : undefined\n\t}\n\n\t/** Prompt for `@orkestrel` short-name dependencies until every token resolves or input is empty. */\n\tasync #prompt(\n\t\tterminal: TerminalInterface,\n\t\tcatalog: readonly string[] | undefined,\n\t): Promise<readonly string[]> {\n\t\tfor (;;) {\n\t\t\tconst raw = await this.#guard(terminal.input({ message: ORKESTREL_DEPS_PROMPT, default: '' }))\n\t\t\tconst tokens = splitTokens(raw)\n\t\t\tif (tokens.length === 0) return []\n\t\t\tconst normalized = tokens.map(normalizeOrkestrelToken)\n\t\t\tconst issue = normalized\n\t\t\t\t.map((token) => orkestrelTokenIssue(token, catalog))\n\t\t\t\t.find((message) => message !== undefined)\n\t\t\tif (issue === undefined) return normalized\n\t\t\tthis.#reporter.line(issue)\n\t\t}\n\t}\n\n\t/** `scaffold new` — scaffold a package into `./<name>` (or `--target`). */\n\tasync #new(values: CLIValues, argument: string | undefined, json: boolean): Promise<void> {\n\t\tconst terminal = createTerminal()\n\n\t\tlet name: string\n\t\tif (argument !== undefined) {\n\t\t\tname = argument\n\t\t} else if (json) {\n\t\t\tthis.#usage('a package name is required with --json', json)\n\t\t} else if (!this.#tty) {\n\t\t\tthis.#usage(missingInput('a package name', 'new'), json)\n\t\t} else {\n\t\t\tname = await this.#guard(\n\t\t\t\tterminal.input({\n\t\t\t\t\tmessage: 'Package name',\n\t\t\t\t\tvalidate: { pattern: NAME_PATTERN.source },\n\t\t\t\t}),\n\t\t\t)\n\t\t}\n\t\t// Validate positional and interactively collected names against the same\n\t\t// core-owned package-name contract.\n\t\tif (!NAME_PATTERN.test(name)) {\n\t\t\tthis.#usage(invalidName(name, NAME_PATTERN.source), json)\n\t\t}\n\n\t\tlet srcInput: readonly string[]\n\t\tlet appInput: readonly string[]\n\t\tif (values.src !== undefined) {\n\t\t\tsrcInput = values.src.split(',').map((candidate) => candidate.trim())\n\t\t} else if (values.app !== undefined) {\n\t\t\tsrcInput = []\n\t\t} else if (json || !this.#tty) {\n\t\t\tthis.#usage('at least one of --src or --app is required', json)\n\t\t} else {\n\t\t\tsrcInput = await this.#guard(\n\t\t\t\tterminal.checkbox({\n\t\t\t\t\tmessage: 'Published src environments',\n\t\t\t\t\tchoices: ENVIRONMENT_CHOICES,\n\t\t\t\t\tmin: 0,\n\t\t\t\t}),\n\t\t\t)\n\t\t}\n\t\tif (values.app !== undefined) {\n\t\t\tappInput = values.app.split(',').map((candidate) => candidate.trim())\n\t\t} else if (values.src !== undefined || json || !this.#tty) {\n\t\t\tappInput = []\n\t\t} else {\n\t\t\tappInput = await this.#guard(\n\t\t\t\tterminal.checkbox({\n\t\t\t\t\tmessage: 'Application environments',\n\t\t\t\t\tchoices: ENVIRONMENT_CHOICES,\n\t\t\t\t\tmin: 0,\n\t\t\t\t}),\n\t\t\t)\n\t\t}\n\t\tconst unrecognizedSrcEnvironment = srcInput.filter(\n\t\t\t(candidate) => !ENVIRONMENTS.some((environment) => environment === candidate),\n\t\t)\n\t\tif (unrecognizedSrcEnvironment.length > 0) {\n\t\t\tthis.#usage(\n\t\t\t\t`Environment \"${unrecognizedSrcEnvironment.join('\", \"')}\" is not recognized`,\n\t\t\t\tjson,\n\t\t\t)\n\t\t}\n\t\tif (new Set(srcInput).size !== srcInput.length) {\n\t\t\tthis.#usage('Published src environments must not repeat', json)\n\t\t}\n\t\tconst src = ENVIRONMENTS.filter((environment) => srcInput.includes(environment))\n\t\tconst unrecognizedAppEnvironment = appInput.filter(\n\t\t\t(candidate) => !ENVIRONMENTS.some((environment) => environment === candidate),\n\t\t)\n\t\tif (unrecognizedAppEnvironment.length > 0) {\n\t\t\tthis.#usage(\n\t\t\t\t`Application environment \"${unrecognizedAppEnvironment.join('\", \"')}\" is not recognized`,\n\t\t\t\tjson,\n\t\t\t)\n\t\t}\n\t\tif (new Set(appInput).size !== appInput.length) {\n\t\t\tthis.#usage('Application environments must not repeat', json)\n\t\t}\n\t\tconst app = ENVIRONMENTS.filter((environment) => appInput.includes(environment))\n\t\tif (src.length === 0 && app.length === 0) {\n\t\t\tthis.#usage('at least one source or application environment is required', json)\n\t\t}\n\n\t\t// Establish containment before preview, network access, confirmation, or\n\t\t// any other work that assumes the destination is writable.\n\t\tconst destination = this.#contain(values.target ?? `./${name}`, json)\n\t\tif (!isVacant(destination)) {\n\t\t\tthis.#error(\n\t\t\t\tnew ScaffoldError('TARGET', 'new requires a vacant target', { target: destination }),\n\t\t\t\tjson,\n\t\t\t)\n\t\t}\n\t\tconst explicitHost = values.from?.[0]\n\t\tif (explicitHost !== undefined) {\n\t\t\tif (!isRealDirectory(explicitHost)) {\n\t\t\t\tthis.#error(\n\t\t\t\t\tnew ScaffoldError('TARGET', `Host root is not a physical directory at ${explicitHost}`, {\n\t\t\t\t\t\thost: explicitHost,\n\t\t\t\t\t}),\n\t\t\t\t\tjson,\n\t\t\t\t)\n\t\t\t}\n\t\t\treadHostManifest(explicitHost)\n\t\t}\n\n\t\t// `--deps` is OPTIONAL — a non-TTY session with neither `--json` nor\n\t\t// `--deps` defaults to no extra dependencies rather than failing (only a\n\t\t// REQUIRED input triggers `missingInput`'s usage error); the multi-prompt\n\t\t// guidance below stays TTY-only under the one-prompt-per-process ceiling.\n\t\t// `--deps` uses an untrimmed split and is\n\t\t// `DEPENDENCY_NAME_PATTERN`-gated BEFORE any network call. The\n\t\t// interactive prompt adds short-name\n\t\t// normalization + vendored-catalog validation (re-asking on an unknown\n\t\t// token, degrading to shape-only when the catalog cannot be resolved).\n\t\tlet depNames: readonly string[]\n\t\tif (values.deps !== undefined) {\n\t\t\tdepNames = values.deps.split(',').filter((depName) => depName.length > 0)\n\t\t\tconst badDep = depNames.find((depName) => !DEPENDENCY_NAME_PATTERN.test(depName))\n\t\t\tif (badDep !== undefined) {\n\t\t\t\tthis.#usage(\n\t\t\t\t\t`Dependency name \"${badDep}\" must match ${DEPENDENCY_NAME_PATTERN.source}`,\n\t\t\t\t\tjson,\n\t\t\t\t)\n\t\t\t}\n\t\t} else if (json || !this.#tty) {\n\t\t\tdepNames = []\n\t\t} else {\n\t\t\tconst catalogHost = values.from?.[0] ?? hostRoot()\n\t\t\tconst catalog = this.#names(catalogHost)\n\t\t\tif (catalog === undefined) this.#reporter.line(CATALOG_UNRESOLVED_NOTE)\n\t\t\tdepNames = await this.#prompt(terminal, catalog)\n\t\t}\n\n\t\t// `--deps` resolves latest versions from the registry and pins caret ranges; their\n\t\t// guides fetch into the plan.\n\t\tconst sync = createSync(this.#sync)\n\t\tlet versions\n\t\ttry {\n\t\t\tversions = await sync.lookup(depNames)\n\t\t} finally {\n\t\t\tsync.destroy()\n\t\t}\n\t\t// `createSync()` is non-strict — it never throws — so a bare-name\n\t\t// `--deps` name that the registry could not resolve (`freshness`\n\t\t// 'missing'/'failed') is a HARD failure here.\n\t\tconst unresolved = versions\n\t\t\t.filter((version) => version.freshness === 'missing' || version.freshness === 'failed')\n\t\t\t.map((version) => version.name)\n\t\tif (unresolved.length > 0) this.#fail(unresolvedVersion(unresolved), json)\n\t\tconst deps = versions.map((version) => {\n\t\t\tif (version.freshness !== 'behind') this.#fail(unresolvedVersion([version.name]), json)\n\t\t\treturn dependency(version.name, `^${version.latest}`)\n\t\t})\n\n\t\t// Extra devDependencies are authored in `package.json` after scaffolding;\n\t\t// `deriveBlueprint`'s extras round-trip\n\t\t// (`@src/server`) recompiles them back into the plan, so `audit` stays\n\t\t// clean over a hand-added `devDependencies` entry (AGENTS §21 core stays\n\t\t// the single source of truth for that relaxation).\n\t\tconst [plan] = this.#compile(blueprint(name, { src, app, dependencies: deps }), json)\n\n\t\tconst summary = planToSummary(plan)\n\n\t\tif (!json) {\n\t\t\tthis.#reporter.section('Plan')\n\t\t\tthis.#reporter.table(newPlanTable(summary))\n\t\t\tthis.#reporter.line(newPlanPreview(name))\n\t\t}\n\n\t\tconst proceed = await this.#apply(\n\t\t\tterminal,\n\t\t\tapplyConfirmMessage(summary.host + summary.template + summary.computed),\n\t\t\tvalues,\n\t\t\tjson,\n\t\t)\n\n\t\tif (!proceed) {\n\t\t\tif (json) this.#write(summaryToNewResult(summary, false))\n\t\t\telse this.#reporter.line(NEW_DRY_RUN_NOTE)\n\t\t\tprocess.exitCode = 0\n\t\t\treturn\n\t\t}\n\n\t\tconst spinner = this.#spinner('materializing', json)\n\t\tspinner?.start()\n\t\tconst host = values.from?.[0]\n\t\tconst materializer = createMaterializer(host === undefined ? undefined : { host })\n\t\ttry {\n\t\t\tconst result = materializer.materialize(plan, destination)\n\t\t\tconst count = result.written.length + result.copied.length\n\t\t\tif (json) this.#write(summaryToNewResult(summary, true))\n\t\t\telse this.#succeed(spinner, json, newApplySuccess(count, name))\n\t\t} catch (error) {\n\t\t\tthis.#reject(spinner, json, error)\n\t\t} finally {\n\t\t\tmaterializer.destroy()\n\t\t}\n\t\tprocess.exitCode = 0\n\t}\n\n\t/** `scaffold pull` — refresh vendored dependency mirrors and report range drift. */\n\tasync #pull(values: CLIValues, json: boolean): Promise<void> {\n\t\tconst target = this.#contain(values.target ?? '.', json)\n\n\t\tconst sync = createSync(\n\t\t\tvalues.strict === undefined ? this.#sync : { ...this.#sync, strict: values.strict },\n\t\t)\n\t\ttry {\n\t\t\tlet report: SyncReport\n\t\t\ttry {\n\t\t\t\tconst declared = manifestToDependencies(readManifest(target))\n\t\t\t\tconst selected = parsePullDependencies(values.deps, declared)\n\t\t\t\treport = await sync.pull(target, selected)\n\t\t\t} catch (error) {\n\t\t\t\tthis.#error(error, json)\n\t\t\t}\n\n\t\t\tawait this.#refresh(sync, report, target, values, json, 'pull', true)\n\t\t} finally {\n\t\t\tsync.destroy()\n\t\t}\n\t}\n\n\t/** `scaffold mirror` — refresh every published Orkestrel package guide. */\n\tasync #mirror(values: CLIValues, json: boolean): Promise<void> {\n\t\tconst target = this.#contain(values.target ?? '.', json)\n\t\tconst sync = createSync(\n\t\t\tvalues.strict === undefined ? this.#sync : { ...this.#sync, strict: values.strict },\n\t\t)\n\t\ttry {\n\t\t\tlet report: SyncReport\n\t\t\ttry {\n\t\t\t\treport = await sync.mirror(target)\n\t\t\t} catch (error) {\n\t\t\t\tthis.#error(error, json)\n\t\t\t}\n\t\t\tawait this.#refresh(sync, report, target, values, json, 'mirror', report.failed === 0)\n\t\t} finally {\n\t\t\tsync.destroy()\n\t\t}\n\t}\n\n\tasync #refresh(\n\t\tsync: SyncInterface,\n\t\treport: SyncReport,\n\t\ttarget: string,\n\t\tvalues: CLIValues,\n\t\tjson: boolean,\n\t\taction: 'pull' | 'mirror',\n\t\twritable: boolean,\n\t): Promise<void> {\n\t\tif (!json) {\n\t\t\tthis.#reporter.table(syncTable(report))\n\t\t\tfor (const line of syncCauseNotes(report)) this.#reporter.line(line)\n\t\t\tthis.#reporter.line(syncVerdict(report, action))\n\t\t}\n\t\tconst toWrite = [...report.guides, ...report.versions].filter(\n\t\t\t(entry) => entry.freshness !== 'current',\n\t\t).length\n\t\tconst terminal = createTerminal()\n\t\tconst proceed =\n\t\t\twritable && toWrite > 0\n\t\t\t\t? await this.#apply(terminal, applyConfirmMessage(toWrite), values, json)\n\t\t\t\t: false\n\t\tif (proceed) {\n\t\t\tconst spinner = this.#spinner('writing mirrors', json)\n\t\t\tspinner?.start()\n\t\t\ttry {\n\t\t\t\tconst written = await sync.write(report, target)\n\t\t\t\tif (json) this.#write(report)\n\t\t\t\telse this.#succeed(spinner, json, syncSuccess(written.length))\n\t\t\t} catch (error) {\n\t\t\t\tthis.#reject(spinner, json, error)\n\t\t\t}\n\t\t} else if (json) {\n\t\t\tthis.#write(report)\n\t\t}\n\t\tprocess.exitCode = report.clean ? 0 : proceed ? 0 : 1\n\t}\n\n\t/** `scaffold audit` — whole-plan conformance report; offers a repair handoff on drift. */\n\tasync #audit(values: CLIValues, json: boolean): Promise<void> {\n\t\tconst target = this.#contain(values.target ?? '.', json)\n\n\t\tlet spec: Blueprint\n\t\ttry {\n\t\t\tspec = deriveBlueprint(target)\n\t\t} catch (error) {\n\t\t\tthis.#error(error, json)\n\t\t}\n\n\t\tconst deps: readonly Dependency[] = [...spec.dependencies, ...spec.peers, ...spec.extras]\n\n\t\tconst groupsInput = values.groups?.split(',')\n\t\tlet groups: readonly Group[] | undefined\n\t\tif (groupsInput !== undefined) {\n\t\t\tconst unrecognized = groupsInput.filter((name) => !GROUPS.some((group) => group === name))\n\t\t\tif (unrecognized.length > 0) {\n\t\t\t\tthis.#usage(`Group \"${unrecognized.join('\", \"')}\" is not recognized`, json)\n\t\t\t}\n\t\t\tgroups = GROUPS.filter((group) => groupsInput.includes(group))\n\t\t}\n\n\t\tconst [compiled, questions] = this.#compile(spec, json, groups)\n\t\tconst from = values.from?.[0]\n\t\tconst host = from ?? hostRoot()\n\t\tlet plan: Plan\n\t\ttry {\n\t\t\tplan = hydratePlan(compiled, host)\n\t\t} catch (error) {\n\t\t\tthis.#error(error, json)\n\t\t}\n\t\tconst artifactPaths = plan.artifacts.map((artifact) => artifact.path)\n\n\t\t// Merge the physical unexpected-file scan into the presented audit. Only an\n\t\t// established host can positively define the vendored allowlist; a failed\n\t\t// scan marks the audit incomplete without erasing its other findings.\n\t\tconst rawAudit = {\n\t\t\t...diffPlan(plan, readTarget(target, artifactPaths)),\n\t\t\tquestions,\n\t\t}\n\t\tconst scanned = this.#scanSafe(rawAudit, target, host, spec.service)\n\t\tconst audit = scanned.audit\n\t\tlet drifted = !audit.clean\n\n\t\tlet live: LiveResult | undefined\n\t\tif (values.live) {\n\t\t\tconst sync = createSync(this.#sync)\n\t\t\ttry {\n\t\t\t\tconst manifestName = manifestToName(readManifest(target))\n\t\t\t\tconst guideDependencies = deps.filter((entry) => entry.name !== manifestName)\n\t\t\t\tconst guides = await sync.guides(guideDependencies)\n\t\t\t\tconst versions = await sync.versions(deps)\n\t\t\t\tconst entries = [...guides, ...versions]\n\t\t\t\tdrifted ||= entries.some((entry) => entry.freshness !== 'current')\n\t\t\t\tconst current = entries.filter((entry) => entry.freshness === 'current').length\n\t\t\t\tconst behind = entries.filter((entry) => entry.freshness === 'behind').length\n\t\t\t\tconst failed = entries.length - current - behind\n\t\t\t\tlive = { current, behind, failed }\n\t\t\t} finally {\n\t\t\t\tsync.destroy()\n\t\t\t}\n\t\t}\n\n\t\tif (json) {\n\t\t\tthis.#write(live === undefined ? audit : { ...audit, live })\n\t\t\tprocess.exitCode = drifted ? 1 : 0\n\t\t\treturn\n\t\t}\n\n\t\tif (scanned.skipped) this.#reporter.line(SCAN_SKIPPED)\n\t\tfor (const question of audit.questions) {\n\t\t\tif (!question.blocking) this.#reporter.line(`warning: ${question.text}`)\n\t\t}\n\t\tthis.#reporter.line(comparisonLine(true))\n\t\tthis.#reporter.table(auditTable(audit, plan))\n\t\tthis.#reporter.line(auditVerdict(audit, plan))\n\t\tif (live !== undefined) {\n\t\t\tthis.#reporter.line(auditLiveNote(live.current, live.behind, live.failed))\n\t\t}\n\n\t\tif (!audit.clean) {\n\t\t\tconst split = partitionFindings(audit.findings, plan)\n\t\t\tconst ownedCount = split.owned.drifted + split.owned.missing\n\t\t\tconst pruneRequested = values.prune === true\n\n\t\t\t// Audit never writes via flags: the handoff is an INTERACTIVE\n\t\t\t// convenience only, offered exclusively on a TTY session — `--apply` /\n\t\t\t// `--yes` NEVER count as handoff consent here (they gate the SEPARATE\n\t\t\t// `repair` run this branch may launch, never audit's own read-only\n\t\t\t// pass. A foreign-only handoff would be a dead end: the handoff also covers\n\t\t\t// foreign files, but ONLY when `--prune` was passed — an inherited\n\t\t\t// repair without `--prune` cannot delete them, so offering the handoff\n\t\t\t// for foreign-only drift without `--prune` would be a dead end.\n\t\t\tconst offerHandoff = this.#tty && (ownedCount > 0 || (audit.foreign > 0 && pruneRequested))\n\n\t\t\tlet handoffAccepted = false\n\t\t\tif (offerHandoff) {\n\t\t\t\tconst terminal = createTerminal()\n\t\t\t\tconst message = repairHandoff(ownedCount, audit.foreign, pruneRequested)\n\t\t\t\thandoffAccepted = await this.#guard(terminal.confirm({ message, default: false }))\n\t\t\t\tif (handoffAccepted) {\n\t\t\t\t\tawait this.#repair(values, false)\n\t\t\t\t\t// Repair's own exit code reflects only\n\t\t\t\t\t// ITS scope — re-diff the FULL plan (host/template/computed AND\n\t\t\t\t\t// the foreign scan) so the audit's exit code stays truthful about\n\t\t\t\t\t// ANY drift still remaining, mirroring `runFleet`'s post-repair\n\t\t\t\t\t// `finalAudit` pattern.\n\t\t\t\t\tconst rawFinal = diffPlan(plan, readTarget(target, artifactPaths))\n\t\t\t\t\tconst finalScanned = this.#scanSafe(rawFinal, target, host, spec.service)\n\t\t\t\t\tprocess.exitCode = finalScanned.audit.clean ? 0 : 1\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!handoffAccepted) {\n\t\t\t\t// When the handoff cannot help foreign files (no `--prune`, or no\n\t\t\t\t// handoff offered at all), point at the one command that can.\n\t\t\t\tif (audit.foreign > 0 && !pruneRequested) this.#reporter.line(FOREIGN_HINT)\n\t\t\t\tfor (const note of renderComputedNotes(audit.findings, plan)) {\n\t\t\t\t\tthis.#reporter.line(note)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tprocess.exitCode = drifted ? 1 : 0\n\t}\n\n\t/** `scaffold repair` — restore host-owned files and optionally generated canon for one target. */\n\tasync #repair(values: CLIValues, json: boolean): Promise<void> {\n\t\tconst target = this.#contain(values.target ?? '.', json)\n\n\t\tlet spec: Blueprint\n\t\ttry {\n\t\t\tspec = deriveBlueprint(target)\n\t\t} catch (error) {\n\t\t\tthis.#error(error, json)\n\t\t}\n\n\t\t// Repair defaults to the host-restoration boundary. `--generated` adds\n\t\t// generated canon while preserving the birth-only template boundary and\n\t\t// package.json's independent publication protection.\n\t\tconst generated = values.generated === true\n\t\tconst from = values.from?.[0]\n\t\tconst host = from ?? hostRoot()\n\t\tconst prepared = this.#prepareRepair(spec, target, host, generated, json)\n\t\tconst compiled = prepared[0]\n\t\tlet plan = prepared[1]\n\t\tlet audit = prepared[2]\n\n\t\tif (!json) {\n\t\t\tthis.#reporter.line(generated ? REPAIR_GENERATED_SCOPE : REPAIR_SCOPE)\n\t\t\tthis.#reporter.section('Audit')\n\t\t\tthis.#reporter.table(auditTable(audit, plan))\n\t\t}\n\n\t\t// The prune preview/confirm are driven by the real scan\n\t\t// (`pruneTargets`), never `audit.foreign` (which `diffPlan` can never\n\t\t// populate through this call path — it only ever reads the plan's own\n\t\t// paths). A zero-length scan skips the question entirely and is a no-op.\n\t\t// Compute this BEFORE the clean-audit check so `--prune` still reaches\n\t\t// this scan (and the deletion flow below) on a clean-host repo — a clean\n\t\t// this scan and deletion flow on a clean-host repo. Only a clean audit\n\t\t// with nothing to prune returns early.\n\t\tconst prunePaths = values.prune ? this.#prunePaths(target, host, spec.service) : []\n\t\tconst pruneSnapshot = readTarget(target, prunePaths)\n\n\t\tif (audit.clean && prunePaths.length === 0) {\n\t\t\tif (json) {\n\t\t\t\tthis.#write(audit)\n\t\t\t} else {\n\t\t\t\tthis.#reporter.line(repairVerdict(audit, generated))\n\t\t\t\tconst note = scopeNote(this.#outside(compiled, target), generated)\n\t\t\t\tif (note !== undefined) this.#reporter.line(note)\n\t\t\t}\n\t\t\tprocess.exitCode = 0\n\t\t\treturn\n\t\t}\n\n\t\tif (!json) this.#reporter.line(repairVerdict(audit, generated))\n\n\t\tconst terminal = createTerminal()\n\t\tlet proceed = true\n\t\tif (!audit.clean) {\n\t\t\tproceed = await this.#apply(\n\t\t\t\tterminal,\n\t\t\t\tapplyConfirmMessage(audit.drifted + audit.missing + audit.foreign),\n\t\t\t\tvalues,\n\t\t\t\tjson,\n\t\t\t)\n\t\t}\n\n\t\tif (!proceed) {\n\t\t\tif (json) this.#write(audit)\n\t\t\tprocess.exitCode = 1\n\t\t\treturn\n\t\t}\n\n\t\tif (values.prune && !json) {\n\t\t\tif (prunePaths.length === 0) this.#reporter.line(PRUNE_EMPTY)\n\t\t\telse for (const line of prunePreview(prunePaths)) this.#reporter.line(line)\n\t\t}\n\t\tconst doPrune =\n\t\t\tprunePaths.length > 0 &&\n\t\t\t(await this.#prune(terminal, pruneConfirmMessage(prunePaths.length), values, json))\n\n\t\tlet currentGlobal: boolean\n\t\ttry {\n\t\t\tcurrentGlobal = deriveBlueprint(target).global\n\t\t} catch (error) {\n\t\t\tthis.#error(error, json)\n\t\t}\n\t\tif (currentGlobal !== spec.global) {\n\t\t\tspec = { ...spec, global: currentGlobal }\n\t\t\tconst refreshed = this.#prepareRepair(spec, target, host, generated, json)\n\t\t\tplan = refreshed[1]\n\t\t\taudit = refreshed[2]\n\t\t}\n\n\t\tconst spinner = this.#spinner('repairing', json)\n\t\tspinner?.start()\n\t\tconst materializer = createMaterializer({ host })\n\t\ttry {\n\t\t\tconst result = materializer.repair(plan, audit, target)\n\t\t\tconst removed = doPrune ? materializer.prune(target, pruneSnapshot).removed : []\n\t\t\tif (json) this.#write(auditToRepairResult(audit, { ...result, removed }))\n\t\t\telse this.#succeed(spinner, json, repairSuccess(result, removed))\n\t\t} catch (error) {\n\t\t\tthis.#reject(spinner, json, error)\n\t\t} finally {\n\t\t\tmaterializer.destroy()\n\t\t}\n\t\tprocess.exitCode = 0\n\t}\n\n\t/** `scaffold fleet` — audit/repair every `@orkestrel` package beneath the current directory's immediate children. */\n\tasync #fleet(values: CLIValues, json: boolean): Promise<void> {\n\t\tconst root = this.#contain('.', json)\n\t\tconst generated = values.generated === true\n\n\t\tconst packages = discoverPackages(root)\n\t\tif (packages.length === 0) {\n\t\t\tthis.#fail(\n\t\t\t\t`no @orkestrel packages under \"${root}\" — fleet scans the immediate children of the current directory; stand in the folder that contains your checkouts (cd ..), or use 'repair' to true up just this repo.`,\n\t\t\t\tjson,\n\t\t\t)\n\t\t}\n\n\t\tconst from = values.from?.[0]\n\t\tconst host = from ?? hostRoot()\n\n\t\tconst repos: FleetRepo[] = []\n\t\tconst failures: FleetFailure[] = []\n\t\tfor (const directory of packages) {\n\t\t\tconst name = basename(directory)\n\t\t\ttry {\n\t\t\t\tconst compiler = createCompiler()\n\t\t\t\tlet scoped: Plan\n\t\t\t\tlet questions: readonly Question[]\n\t\t\t\ttry {\n\t\t\t\t\tconst spec = deriveBlueprint(directory)\n\t\t\t\t\tconst scaffolding = compiler.compile(spec)\n\t\t\t\t\tif (!scaffolding.plan) {\n\t\t\t\t\t\tconst message = scaffolding.questions.map((question) => question.text).join('; ')\n\t\t\t\t\t\tthrow new ScaffoldError('INVALID', message)\n\t\t\t\t\t}\n\t\t\t\t\tscoped = {\n\t\t\t\t\t\t...scaffolding.plan,\n\t\t\t\t\t\tblueprint: { ...scaffolding.plan.blueprint, overrides: [] },\n\t\t\t\t\t\tartifacts: scaffolding.plan.artifacts.filter(\n\t\t\t\t\t\t\t(artifact) =>\n\t\t\t\t\t\t\t\tartifact.origin === 'host' ||\n\t\t\t\t\t\t\t\t(generated && artifact.origin === 'computed' && artifact.path !== 'package.json'),\n\t\t\t\t\t\t),\n\t\t\t\t\t}\n\t\t\t\t\tquestions = scaffolding.questions\n\t\t\t\t} finally {\n\t\t\t\t\tcompiler.destroy()\n\t\t\t\t}\n\n\t\t\t\tconst plan = hydratePlan(scoped, host)\n\t\t\t\tconst paths = plan.artifacts.map((artifact) => artifact.path)\n\t\t\t\tconst rawAudit = {\n\t\t\t\t\t...diffPlan(plan, readTarget(directory, paths)),\n\t\t\t\t\tquestions,\n\t\t\t\t}\n\t\t\t\t// Include physical unexpected-file findings in each repository audit.\n\t\t\t\tconst audit = this.#scan(rawAudit, directory, host, plan.blueprint.service)\n\t\t\t\trepos.push({\n\t\t\t\t\tname,\n\t\t\t\t\tdirectory,\n\t\t\t\t\tplan,\n\t\t\t\t\taudit,\n\t\t\t\t})\n\t\t\t} catch (error) {\n\t\t\t\tfailures.push({ name, message: describeError(error) })\n\t\t\t}\n\t\t}\n\n\t\tif (!json) {\n\t\t\tfor (const repo of repos) {\n\t\t\t\tthis.#reporter.line(\n\t\t\t\t\tfleetRepoLine(\n\t\t\t\t\t\trepo.name,\n\t\t\t\t\t\trepo.audit.clean\n\t\t\t\t\t\t\t? { state: 'clean' }\n\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\tstate: 'drifted',\n\t\t\t\t\t\t\t\t\tdrifted: repo.audit.drifted,\n\t\t\t\t\t\t\t\t\tmissing: repo.audit.missing,\n\t\t\t\t\t\t\t\t\tforeign: repo.audit.foreign,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t\tfor (const question of repo.audit.questions) {\n\t\t\t\t\tif (!question.blocking) {\n\t\t\t\t\t\tthis.#reporter.line(`${repo.name}: warning: ${question.text}`)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (const failure of failures) {\n\t\t\t\tthis.#reporter.line(\n\t\t\t\t\tfleetRepoLine(failure.name, { state: 'failed', message: failure.message }),\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\n\t\tconst dirty = repos.filter((repo) => !repo.audit.clean)\n\n\t\tif (dirty.length === 0) {\n\t\t\tif (json) {\n\t\t\t\tthis.#write([\n\t\t\t\t\t...repos.map((repo) => fleetEntryOf(repo.name, repo.audit, false)),\n\t\t\t\t\t...failures.map((failure) => fleetEntryOf(failure.name, undefined, true)),\n\t\t\t\t])\n\t\t\t} else {\n\t\t\t\tthis.#reporter.line(fleetTotals(0, failures.length))\n\t\t\t}\n\t\t\tprocess.exitCode = failures.length > 0 ? 1 : 0\n\t\t\treturn\n\t\t}\n\n\t\tconst fileCount = dirty.reduce(\n\t\t\t(total, repo) => total + repo.audit.drifted + repo.audit.missing + repo.audit.foreign,\n\t\t\t0,\n\t\t)\n\n\t\tconst terminal = createTerminal()\n\t\tconst proceed = await this.#apply(\n\t\t\tterminal,\n\t\t\tapplyConfirmMessage(fileCount, dirty.length),\n\t\t\tvalues,\n\t\t\tjson,\n\t\t)\n\n\t\t// Drive the fleet prune preview from each repository's physical scan and\n\t\t// prefix every path with its repository name. An unestablished host cannot\n\t\t// define an allowlist, so pruning remains a no-op.\n\t\tconst pruneSets =\n\t\t\tproceed && values.prune\n\t\t\t\t? new Map(\n\t\t\t\t\t\tdirty.map((repo) => {\n\t\t\t\t\t\t\tconst paths = this.#prunePaths(repo.directory, host, repo.plan.blueprint.service)\n\t\t\t\t\t\t\treturn [repo.name, readTarget(repo.directory, paths)]\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\t\t\t\t: new Map<string, Snapshot>()\n\t\tconst prunePaths = dirty.flatMap((repo) =>\n\t\t\tObject.keys(pruneSets.get(repo.name) ?? {}).map((path) => `${repo.name}/${path}`),\n\t\t)\n\t\tif (proceed && values.prune && !json) {\n\t\t\tif (prunePaths.length === 0) this.#reporter.line(PRUNE_EMPTY)\n\t\t\telse for (const line of prunePreview(prunePaths)) this.#reporter.line(line)\n\t\t}\n\t\tconst doPrune =\n\t\t\tproceed &&\n\t\t\tprunePaths.length > 0 &&\n\t\t\t(await this.#prune(terminal, pruneConfirmMessage(prunePaths.length), values, json))\n\n\t\tif (!proceed) {\n\t\t\tif (json) {\n\t\t\t\tthis.#write([\n\t\t\t\t\t...repos.map((repo) => fleetEntryOf(repo.name, repo.audit, false)),\n\t\t\t\t\t...failures.map((failure) => fleetEntryOf(failure.name, undefined, true)),\n\t\t\t\t])\n\t\t\t} else {\n\t\t\t\tthis.#reporter.line(fleetTotals(dirty.length, failures.length))\n\t\t\t}\n\t\t\tprocess.exitCode = 1\n\t\t\treturn\n\t\t}\n\n\t\tconst materializer = createMaterializer({ host })\n\t\tlet drifted = 0\n\t\tlet failedCount = failures.length\n\t\tconst entries: FleetEntry[] = repos\n\t\t\t.filter((repo) => repo.audit.clean)\n\t\t\t.map((repo) => fleetEntryOf(repo.name, repo.audit, false))\n\n\t\ttry {\n\t\t\tfor (const repo of dirty) {\n\t\t\t\ttry {\n\t\t\t\t\tmaterializer.repair(repo.plan, repo.audit, repo.directory)\n\t\t\t\t\tif (doPrune) {\n\t\t\t\t\t\tmaterializer.prune(repo.directory, pruneSets.get(repo.name) ?? {})\n\t\t\t\t\t}\n\t\t\t\t\tconst paths = repo.plan.artifacts.map((artifact) => artifact.path)\n\t\t\t\t\tconst rawFinal = diffPlan(repo.plan, readTarget(repo.directory, paths))\n\t\t\t\t\tconst finalAudit = this.#scan(rawFinal, repo.directory, host, repo.plan.blueprint.service)\n\t\t\t\t\tif (!finalAudit.clean) drifted += 1\n\t\t\t\t\tentries.push(fleetEntryOf(repo.name, finalAudit, false))\n\t\t\t\t\tif (!json) {\n\t\t\t\t\t\tthis.#reporter.line(\n\t\t\t\t\t\t\tfleetRepoLine(repo.name, {\n\t\t\t\t\t\t\t\tstate: 'repaired',\n\t\t\t\t\t\t\t\tremaining: finalAudit.drifted + finalAudit.missing + finalAudit.foreign,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t} catch (error) {\n\t\t\t\t\tfailedCount += 1\n\t\t\t\t\tentries.push(fleetEntryOf(repo.name, undefined, true))\n\t\t\t\t\tif (!json) {\n\t\t\t\t\t\tthis.#reporter.line(\n\t\t\t\t\t\t\tfleetRepoLine(repo.name, {\n\t\t\t\t\t\t\t\tstate: 'failed',\n\t\t\t\t\t\t\t\tmessage: describeError(error),\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} finally {\n\t\t\tmaterializer.destroy()\n\t\t}\n\n\t\tif (json) {\n\t\t\tthis.#write([\n\t\t\t\t...entries,\n\t\t\t\t...failures.map((failure) => fleetEntryOf(failure.name, undefined, true)),\n\t\t\t])\n\t\t} else {\n\t\t\tthis.#reporter.line(fleetTotals(drifted, failedCount))\n\t\t}\n\t\tprocess.exitCode = drifted > 0 || failedCount > 0 ? 1 : 0\n\t}\n\n\t/** `scaffold catalog` — regenerate the fleet package catalog table embedded in `.claude/agents/orkestrel.md`. */\n\tasync #catalog(values: CLIValues, json: boolean): Promise<void> {\n\t\tconst target = this.#contain(values.target ?? '.', json)\n\n\t\tconst explicitRoots = values.from\n\t\tlet entries: readonly CatalogEntry[]\n\t\tlet published = 0\n\t\tlet localOnly = 0\n\t\tconst notes = new Map<string, string>()\n\n\t\tif (values.offline) {\n\t\t\tconst roots = explicitRoots ?? [process.cwd()]\n\t\t\ttry {\n\t\t\t\tentries = catalogPackages(roots)\n\t\t\t} catch (error) {\n\t\t\t\tthis.#error(error, json)\n\t\t\t}\n\t\t} else {\n\t\t\tconst sync = createSync(this.#sync)\n\t\t\tsync.emitter.on('package', (name, note) => {\n\t\t\t\tif (note !== '') notes.set(name, note)\n\t\t\t})\n\t\t\tlet registryEntries: readonly CatalogEntry[]\n\t\t\ttry {\n\t\t\t\tregistryEntries = await sync.catalog()\n\t\t\t} catch (error) {\n\t\t\t\tthis.#error(error, json)\n\t\t\t} finally {\n\t\t\t\tsync.destroy()\n\t\t\t}\n\t\t\tpublished = registryEntries.length\n\n\t\t\tlet localEntries: readonly CatalogEntry[] = []\n\t\t\tif (explicitRoots !== undefined) {\n\t\t\t\ttry {\n\t\t\t\t\tlocalEntries = catalogPackages(explicitRoots)\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthis.#error(error, json)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst merged = new Map<string, CatalogEntry>()\n\t\t\tfor (const entry of registryEntries) merged.set(entry.name, entry)\n\t\t\tfor (const local of localEntries) {\n\t\t\t\tconst existing = merged.get(local.name)\n\t\t\t\tif (existing === undefined) {\n\t\t\t\t\tmerged.set(local.name, local)\n\t\t\t\t\tlocalOnly += 1\n\t\t\t\t} else if (local.description.length > 0) {\n\t\t\t\t\tmerged.set(local.name, { ...existing, description: local.description })\n\t\t\t\t}\n\t\t\t}\n\t\t\tentries = [...merged.values()].sort((a, b) =>\n\t\t\t\ta.name < b.name ? -1 : a.name > b.name ? 1 : 0,\n\t\t\t)\n\t\t}\n\n\t\tconst block = catalogToBlock(entries)\n\t\t// Re-confine the exact leaf because a linked segment beneath an otherwise\n\t\t// contained target could redirect this write outside the working directory.\n\t\tconst agentPath = this.#contain(join(target, CATALOG_AGENT_PATH), json)\n\t\tlet current: string\n\t\tlet baseline: string\n\t\ttry {\n\t\t\tcurrent = readFileText(target, CATALOG_AGENT_PATH, 'TARGET', 'target')\n\t\t\tbaseline = digestText(current)\n\t\t} catch (error) {\n\t\t\tthis.#error(\n\t\t\t\tnew ScaffoldError('TARGET', `Failed to read ${agentPath}`, { path: agentPath, error }),\n\t\t\t\tjson,\n\t\t\t)\n\t\t}\n\n\t\tconst startIndex = current.indexOf(CATALOG_START_MARKER)\n\t\tconst endIndex = current.indexOf(CATALOG_END_MARKER)\n\t\tconst startParts = current.split(CATALOG_START_MARKER)\n\t\tconst endParts = current.split(CATALOG_END_MARKER)\n\t\tif (\n\t\t\tstartIndex === -1 ||\n\t\t\tendIndex === -1 ||\n\t\t\tendIndex < startIndex ||\n\t\t\tstartParts.length !== 2 ||\n\t\t\tendParts.length !== 2\n\t\t) {\n\t\t\tthis.#error(\n\t\t\t\tnew ScaffoldError(\n\t\t\t\t\t'TARGET',\n\t\t\t\t\t`Expected exactly one ordered \"${CATALOG_START_MARKER}\" / \"${CATALOG_END_MARKER}\" pair in ${agentPath}`,\n\t\t\t\t\t{ path: agentPath },\n\t\t\t\t),\n\t\t\t\tjson,\n\t\t\t)\n\t\t}\n\n\t\tconst before = current.slice(0, startIndex + CATALOG_START_MARKER.length)\n\t\tconst after = current.slice(endIndex)\n\t\tconst updated = `${before}\\n\\n${block}\\n${after}`\n\n\t\tconst oldBlock = current.slice(startIndex + CATALOG_START_MARKER.length, endIndex)\n\t\tconst oldRows = catalogNames(oldBlock).length\n\t\tconst shrink = entries.length < oldRows ? oldRows - entries.length : undefined\n\n\t\tif (updated === current) {\n\t\t\tif (json) this.#write(catalogResultOf(entries, false))\n\t\t\telse this.#reporter.line(catalogVerdict(true))\n\t\t\tprocess.exitCode = 0\n\t\t\treturn\n\t\t}\n\n\t\tif (!json) {\n\t\t\tthis.#reporter.table(catalogTable(entries))\n\t\t\tconst warning = catalogShrinkWarning(oldRows, entries.length)\n\t\t\tif (warning !== undefined) this.#reporter.line(warning)\n\t\t\tif (values.offline) {\n\t\t\t\tconst missingDescription = entries\n\t\t\t\t\t.filter((entry) => entry.description.length === 0)\n\t\t\t\t\t.map((entry) => entry.name)\n\t\t\t\tif (missingDescription.length > 0) {\n\t\t\t\t\tthis.#reporter.line(\n\t\t\t\t\t\t`${missingDescription.length} without guide description: ${missingDescription.join(', ')}`,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.#reporter.line(catalogCounts(published, localOnly))\n\t\t\t\tfor (const [name, note] of notes) this.#reporter.line(` ${name}: ${note}`)\n\t\t\t}\n\t\t}\n\n\t\tconst terminal = createTerminal()\n\t\tconst proceed = await this.#apply(terminal, applyConfirmMessage(1), values, json)\n\n\t\tif (!proceed) {\n\t\t\tif (json) this.#write(catalogResultOf(entries, true, shrink))\n\t\t\telse this.#reporter.line(catalogVerdict(false))\n\t\t\tprocess.exitCode = 1\n\t\t\treturn\n\t\t}\n\n\t\tif (Buffer.byteLength(updated, 'utf8') > MAX_ARTIFACT_BYTES) {\n\t\t\tthis.#error(\n\t\t\t\tnew ScaffoldError('WRITE', `Catalog exceeds the artifact limit at ${agentPath}`, {\n\t\t\t\t\tpath: agentPath,\n\t\t\t\t\tlimit: MAX_ARTIFACT_BYTES,\n\t\t\t\t}),\n\t\t\t\tjson,\n\t\t\t)\n\t\t}\n\t\tconst transaction = WriteTransaction.create(\n\t\t\ttarget,\n\t\t\t[CATALOG_AGENT_PATH],\n\t\t\t[{ path: CATALOG_AGENT_PATH, shape: 'file', digest: baseline }],\n\t\t)\n\t\tconst staged = attempt(() => {\n\t\t\tvalidateWriteDirectories(transaction)\n\t\t\tconst destination = resolvePhysicalPath(\n\t\t\t\ttransaction.stage,\n\t\t\t\tCATALOG_AGENT_PATH,\n\t\t\t\t'WRITE',\n\t\t\t\t'staging',\n\t\t\t)\n\t\t\tmkdirSync(dirname(destination), { recursive: true })\n\t\t\tvalidateWriteDirectories(transaction)\n\t\t\tconst contained = resolvePhysicalPath(\n\t\t\t\ttransaction.stage,\n\t\t\t\tCATALOG_AGENT_PATH,\n\t\t\t\t'WRITE',\n\t\t\t\t'staging',\n\t\t\t)\n\t\t\twriteFileSync(contained, updated, { encoding: 'utf8', flag: 'wx' })\n\t\t\tif (digestFile(contained) !== digestText(updated)) {\n\t\t\t\tthrow new ScaffoldError('WRITE', `Staged catalog changed at ${agentPath}`, {\n\t\t\t\t\tpath: agentPath,\n\t\t\t\t})\n\t\t\t}\n\t\t\tvalidateWriteDirectories(transaction)\n\t\t})\n\t\tif (!staged.success) {\n\t\t\tconst cleanup = attempt(() => discardWriteTransaction(transaction))\n\t\t\tthis.#error(\n\t\t\t\tnew ScaffoldError('WRITE', `Failed to stage ${agentPath}`, {\n\t\t\t\t\tpath: agentPath,\n\t\t\t\t\terror: staged.error,\n\t\t\t\t\tcleanup: cleanup.success ? undefined : cleanup.error,\n\t\t\t\t}),\n\t\t\t\tjson,\n\t\t\t)\n\t\t}\n\t\tconst committed = attempt(() => commitWriteTransaction(transaction, [CATALOG_AGENT_PATH]))\n\t\tif (!committed.success) this.#error(committed.error, json)\n\t\tif (json) this.#write(catalogResultOf(entries, true, shrink))\n\t\telse this.#reporter.status('success', catalogApplySuccess(agentPath))\n\t\tprocess.exitCode = 0\n\t}\n\n\t/**\n\t * The whole command dispatch — a single top-level driver (no nested function\n\t * declarations, AGENTS §4). Every verb sets `process.exitCode` (never\n\t * `process.exit`) and returns, or `halt()`s through a `finally` that\n\t * tears its entities down first; the caller at the bottom of this file\n\t * catches exactly one sentinel (`CliExit`) and stops.\n\t */\n\tasync #dispatch(argv: readonly string[]): Promise<void> {\n\t\tlet parsed: CLIArguments\n\t\ttry {\n\t\t\tparsed = parseArguments(argv)\n\t\t} catch (error) {\n\t\t\tprocess.stderr.write(\n\t\t\t\t`${error instanceof Error ? error.message : INVALID_ARGUMENTS_MESSAGE}\\n`,\n\t\t\t)\n\t\t\tprocess.exitCode = 2\n\t\t\treturn\n\t\t}\n\n\t\tconst { values, positionals } = parsed\n\t\tconst [command, argument] = positionals\n\t\tconst json = values.json === true\n\t\tthis.#json = json\n\n\t\tif (command === undefined) {\n\t\t\tprocess.stdout.write(`${values.help ? fullHelp() : shortUsage()}\\n`)\n\t\t\tprocess.exitCode = 0\n\t\t\treturn\n\t\t}\n\n\t\tif (!isVerb(command)) {\n\t\t\tthis.#usage(didYouMean(command), json)\n\t\t}\n\n\t\tif (command !== 'catalog' && values.from !== undefined && values.from.length > 1) {\n\t\t\tthis.#usage(`--from may be provided only once for '${command}'`, json)\n\t\t}\n\t\tif (command === 'mirror' && values.deps !== undefined) {\n\t\t\tthis.#usage(\"--deps is not supported for 'mirror'; use 'pull --deps'\", json)\n\t\t}\n\n\t\tif (values.help) {\n\t\t\tprocess.stdout.write(`${verbHelp(command)}\\n`)\n\t\t\tprocess.exitCode = 0\n\t\t\treturn\n\t\t}\n\n\t\tif (command === 'new') return this.#new(values, argument, json)\n\t\tif (command === 'pull') return this.#pull(values, json)\n\t\tif (command === 'mirror') return this.#mirror(values, json)\n\t\tif (command === 'audit') return this.#audit(values, json)\n\t\tif (command === 'repair') return this.#repair(values, json)\n\t\tif (command === 'fleet') return this.#fleet(values, json)\n\t\treturn this.#catalog(values, json)\n\t}\n}\n","// The `#!/usr/bin/env node` shebang is re-emitted by the build's `output.banner`, not source.\nimport { CLI } from './CLI.js'\n\nawait new CLI().run(process.argv.slice(2))\n"],"mappings":";;;;;;;;;;;;;;AAKA,IAAa,cAA+B,OAAO,OAAO;CACzD;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;;AAGD,IAAa,eAAiD,OAAO,OAAO;CAC3E,MAAM;CACN,UAAU;CACV,UAAU;AACX,CAAC;;AAGD,IAAa,cAA+C,OAAO,OAAO;CACzE,SAAS;CACT,OAAO;CACP,SAAS;CACT,SAAS;AACV,CAAC;;AAGD,IAAa,kBAAoD,OAAO,OAAO;CAC9E,SAAS;CACT,QAAQ;CACR,SAAS;CACT,QAAQ;AACT,CAAC;;AAGD,IAAa,eAAiD,OAAO,OAAO;CAC3E,SAAS;CACT,QAAQ;CACR,SAAS;CACT,SAAS;AACV,CAAC;;AAGD,IAAa,eACZ;;AAGD,IAAa,yBACZ;;AAGD,IAAa,mBAAmB;;AAGhC,IAAa,4BAA4B;;AAGzC,IAAa,oBAAoB;;AAGjC,IAAa,sBAAiD,OAAO,OAAO;CAC3E;EAAE,MAAM;EAAQ,OAAO;EAAQ,aAAa;CAAkB;CAC9D;EAAE,MAAM;EAAW,OAAO;EAAW,aAAa;CAAyB;CAC3E;EAAE,MAAM;EAAU,OAAO;EAAU,aAAa;CAA0B;AAC3E,CAAC;;AAGD,IAAa,gBAAgB;CAC5B;CACA;CACA;CACA;AACD,CAAC,CAAC,KAAK,IAAI;;AAGX,IAAa,aAAqD,OAAO,OAAO;CAC/E,CAAC,KAAK,iBAAiB;CACvB,CAAC,KAAK,kBAAkB;CACxB,CAAC,KAAK,aAAa;AACpB,CAAC;;AAGD,IAAa,eAA+C,OAAO,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,MAAM,EAAE,QAAQ,gBAAgB;EAChC,MAAM,CAAC,SAAS,YAAY;EAC5B,MAAM,OAAO,OAAO,SAAS;EAC7B,KAAKC,QAAQ;EAEb,IAAI,YAAY,KAAA,GAAW;GAC1B,QAAQ,OAAO,MAAM,GAAG,OAAO,OAAO,SAAS,IAAI,WAAW,EAAE,GAAG;GACnE,QAAQ,WAAW;GACnB;EACD;EAEA,IAAI,CAAC,OAAO,OAAO,GAClB,KAAKa,OAAO,WAAW,OAAO,GAAG,IAAI;EAGtC,IAAI,YAAY,aAAa,OAAO,SAAS,KAAA,KAAa,OAAO,KAAK,SAAS,GAC9E,KAAKA,OAAO,yCAAyC,QAAQ,IAAI,IAAI;EAEtE,IAAI,YAAY,YAAY,OAAO,SAAS,KAAA,GAC3C,KAAKA,OAAO,2DAA2D,IAAI;EAG5E,IAAI,OAAO,MAAM;GAChB,QAAQ,OAAO,MAAM,GAAG,SAAS,OAAO,EAAE,GAAG;GAC7C,QAAQ,WAAW;GACnB;EACD;EAEA,IAAI,YAAY,OAAO,OAAO,KAAKD,KAAK,QAAQ,UAAU,IAAI;EAC9D,IAAI,YAAY,QAAQ,OAAO,KAAKO,MAAM,QAAQ,IAAI;EACtD,IAAI,YAAY,UAAU,OAAO,KAAKE,QAAQ,QAAQ,IAAI;EAC1D,IAAI,YAAY,SAAS,OAAO,KAAKC,OAAO,QAAQ,IAAI;EACxD,IAAI,YAAY,UAAU,OAAO,KAAKE,QAAQ,QAAQ,IAAI;EAC1D,IAAI,YAAY,SAAS,OAAO,KAAKG,OAAO,QAAQ,IAAI;EACxD,OAAO,KAAKC,SAAS,QAAQ,IAAI;CAClC;AACD;;;ACj9CA,MAAM,IAAI,IAAI,CAAC,CAAC,IAAI,QAAQ,KAAK,MAAM,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"scaffold.js","names":["#sync","#tty","#sink","#styler","#trust","#dispatch","#json","#write","#reporter","#error","#fail","#prunePaths","#scan","#promoteServices","#compile","#scopeRepair","#guard","#apply","#prune","#prompt","#new","#usage","#contain","#names","#spinner","#succeed","#reject","#pull","#refresh","#mirror","#audit","#scanSafe","#repair","#prepareRepair","#outside","#emitRepair","#fleet","#catalog"],"sources":["../../src/bin/constants.ts","../../src/bin/errors.ts","../../src/bin/shapers.ts","../../src/bin/helpers.ts","../../src/bin/parsers.ts","../../src/bin/validators.ts","../../src/bin/CLI.ts","../../src/bin/scaffold.ts"],"sourcesContent":["import type { Drift, Origin } from '@src/core'\nimport type { CheckboxChoice } from '@orkestrel/terminal'\nimport type { Verb } from './types.js'\n\n/** The command-line interface's closed command vocabulary. */\nexport const KNOWN_VERBS: readonly Verb[] = Object.freeze([\n\t'new',\n\t'pull',\n\t'mirror',\n\t'audit',\n\t'repair',\n\t'fleet',\n\t'catalog',\n])\n\n/** Internal artifact origins translated into user-facing labels. */\nexport const ORIGIN_LABEL: Readonly<Record<Origin, string>> = Object.freeze({\n\thost: 'host-owned',\n\ttemplate: 'starter',\n\tcomputed: 'generated',\n})\n\n/** Internal drift states translated into user-facing labels. */\nexport const DRIFT_LABEL: Readonly<Record<Drift, string>> = Object.freeze({\n\taligned: 'unchanged',\n\tstale: 'drifted',\n\tmissing: 'missing',\n\tforeign: 'unexpected file',\n})\n\n/** Dependency freshness states translated into user-facing labels. */\nexport const FRESHNESS_LABEL: Readonly<Record<string, string>> = Object.freeze({\n\tcurrent: 'unchanged',\n\tbehind: 'behind',\n\tmissing: 'missing upstream',\n\tfailed: 'fetch failed',\n})\n\n/** Materializer actions translated into user-facing labels. */\nexport const ACTION_LABEL: Readonly<Record<string, string>> = Object.freeze({\n\twritten: 'wrote',\n\tcopied: 'wrote',\n\tskipped: 'unchanged',\n\tremoved: 'removed',\n})\n\n/** The deliberately limited ownership boundary every write verb repairs within. */\nexport const REPAIR_SCOPE =\n\t'shared host-owned artifacts and absent service seams — missing files are restored; drifted files change only with --replace, which discards local changes; present starter and generated files are never touched'\n\n/** The opt-in generated-canon ownership boundary `--generated` widens that write to. */\nexport const REPAIR_GENERATED_SCOPE =\n\t'shared host-owned and generated artifacts plus service manifest scripts — missing files are restored; drifted files change only with --replace, which discards local changes; present starter files and package publication metadata are never touched'\n\n/** The dry-run note for `new`. */\nexport const NEW_DRY_RUN_NOTE = 'dry run — pass --apply to write'\n\n/** The fallback message for a malformed command line without an error message. */\nexport const INVALID_ARGUMENTS_MESSAGE = 'invalid arguments'\n\n/** Shared prompt-cancellation message. */\nexport const CANCELLED_MESSAGE = 'cancelled — nothing written'\n\n/** Terminal choices for a new workspace's src and app environments. */\nexport const ENVIRONMENT_CHOICES: readonly CheckboxChoice[] = Object.freeze([\n\t{ name: 'core', value: 'core', description: 'the pure engine' },\n\t{ name: 'browser', value: 'browser', description: 'DOM-facing environment' },\n\t{ name: 'server', value: 'server', description: 'node-facing environment' },\n])\n\n/** The safety model included in full help. */\nexport const SAFETY_BANNER = [\n\t'safety: every verb is a dry run by default.',\n\t'on a terminal, a write prompts for confirmation; in a script, pass --apply (and --yes to skip the confirm).',\n\t'every write is confined to the current working directory — cd there first.',\n\t'when Node exposes system-CA controls, TLS adds the OS certificate store; earlier supported Node 22 releases use default roots. NODE_EXTRA_CA_CERTS adds custom PEMs.',\n].join('\\n')\n\n/** Stable command exit-code meanings. */\nexport const EXIT_CODES: readonly (readonly [string, string])[] = Object.freeze([\n\t['0', 'clean / success'],\n\t['1', 'drift or failure'],\n\t['2', 'usage error'],\n])\n\n/** One-line command summaries. */\nexport const VERB_SUMMARY: Readonly<Record<Verb, string>> = Object.freeze({\n\tnew: 'scaffold a workspace into ./<name>',\n\tpull: 'refresh vendored guides/versions, report drift',\n\tmirror: 'refresh every published Orkestrel package guide',\n\taudit: 'whole-plan conformance report',\n\trepair: 'restore missing host-owned files; replace drifted bytes only with --replace',\n\tfleet: \"audit/repair every workspace under the cwd's immediate children\",\n\tcatalog: 'regenerate the fleet package-catalog table',\n})\n\n/** Compact command flag references. */\nexport const VERB_FLAGS: Readonly<Record<Verb, string>> = Object.freeze({\n\tnew: '--src a,b --app a,b --deps x,y --apply --yes --target <path> --from <path>',\n\tpull: '--target . --deps x,y --apply --yes --strict',\n\tmirror: '--target . --apply --yes --strict',\n\taudit: '--target . --live --generated --replace --from <path> --groups a,b',\n\trepair: '--target . --generated --replace --apply --yes --prune --from <path>',\n\tfleet: '--generated --replace --apply --yes --prune --from <path>',\n\tcatalog: '--from <path> ... --target <repo> --offline --apply --yes',\n})\n\n/** Plain-language command flag descriptions. */\nexport const VERB_FLAG_HELP: Readonly<Record<Verb, readonly (readonly [string, string])[]>> =\n\tObject.freeze({\n\t\tnew: [\n\t\t\t['--src a,b', 'which src environments to include (core, browser, server)'],\n\t\t\t['--app a,b', 'which app environments to include (core, browser, server)'],\n\t\t\t['--deps x,y', '@orkestrel/* dependencies to add (installed as dependencies)'],\n\t\t\t['--apply', 'write the files (default is a dry run)'],\n\t\t\t['--yes', 'skip the confirmation question'],\n\t\t\t['--target <path>', 'destination directory (default: ./<name>)'],\n\t\t\t['--from <path>', 'read the template from a local path instead of the bundled one'],\n\t\t],\n\t\tpull: [\n\t\t\t['--target .', 'directory to refresh (default: current directory)'],\n\t\t\t['--deps x,y', 'limit the refresh to these dependencies'],\n\t\t\t['--apply', 'write the refreshed files (default is a dry run)'],\n\t\t\t['--yes', 'skip the confirmation question'],\n\t\t\t['--strict', 'fail (exit 1) on any drift, even non-fatal'],\n\t\t],\n\t\tmirror: [\n\t\t\t['--target .', 'directory whose guide mirror is refreshed (default: current directory)'],\n\t\t\t['--apply', 'write the refreshed guides (default is a dry run)'],\n\t\t\t['--yes', 'skip the confirmation question'],\n\t\t\t['--strict', 'fail immediately when an upstream guide cannot be fetched'],\n\t\t],\n\t\taudit: [\n\t\t\t['--target .', 'directory to audit (default: current directory)'],\n\t\t\t['--live', 'also check upstream freshness over the network'],\n\t\t\t['--generated', 'widen an accepted repair hand-off to generated files'],\n\t\t\t['--replace', 'let the repair hand-off discard local changes in the drifted files it names'],\n\t\t\t['--from <path>', 'read the template from a local path instead of the bundled one'],\n\t\t\t['--groups a,b', 'limit the audit to these artifact groups'],\n\t\t],\n\t\trepair: [\n\t\t\t['--target .', 'directory to repair (default: current directory)'],\n\t\t\t['--generated', 'widen the scope to generated files, except package.json'],\n\t\t\t['--replace', 'discard local changes in the drifted files named by the repair report'],\n\t\t\t['--apply', 'write the fixes (default is a dry run)'],\n\t\t\t['--yes', 'skip the confirmation question'],\n\t\t\t['--prune', 'also DELETE unexpected files under .claude/agents, .codex/agents, and scripts'],\n\t\t\t['--from <path>', 'read the template from a local path instead of the bundled one'],\n\t\t],\n\t\tfleet: [\n\t\t\t['--generated', 'widen the scope to generated files in every package, except package.json'],\n\t\t\t['--replace', 'discard local changes in the drifted files named in each package'],\n\t\t\t['--apply', 'write fixes across every package (default is a dry run)'],\n\t\t\t['--yes', 'skip the confirmation question'],\n\t\t\t[\n\t\t\t\t'--prune',\n\t\t\t\t'also DELETE unexpected files under .claude/agents, .codex/agents, and scripts, per package',\n\t\t\t],\n\t\t\t['--from <path>', 'read the template from a local path instead of the bundled one'],\n\t\t],\n\t\tcatalog: [\n\t\t\t['--from <path> ...', 'one or more local package paths to include'],\n\t\t\t['--target <repo>', 'the repository whose Orkestrel agent catalog table gets updated'],\n\t\t\t['--offline', 'skip network lookups (npm registry) for package descriptions'],\n\t\t\t['--apply', 'write the updated table (default is a dry run)'],\n\t\t\t['--yes', 'skip the confirmation question'],\n\t\t],\n\t})\n\n/** Dry-run and confirmation notes per command. */\nexport const VERB_DRY_RUN_NOTE: Readonly<Record<Verb, string>> = Object.freeze({\n\tnew: 'dry run by default — add --apply to write the files, --yes to skip the question',\n\tpull: 'dry run by default — add --apply to write the refreshed files, --yes to skip the question',\n\tmirror:\n\t\t'dry run by default — add --apply to write every published package guide, --yes to skip the question',\n\taudit: 'read-only — audit never writes; pass --live to also check upstream freshness',\n\trepair: 'dry run by default — add --apply to write, --yes to skip the question',\n\tfleet:\n\t\t'dry run by default — add --apply to write across every package, --yes to skip the question',\n\tcatalog: 'dry run by default — add --apply to write, --yes to skip the question',\n})\n\n/** One concrete invocation per command. */\nexport const VERB_EXAMPLE: Readonly<Record<Verb, string>> = Object.freeze({\n\tnew: 'example: scaffold new widget --src core,server --app core,browser --apply',\n\tpull: 'example: scaffold pull --apply',\n\tmirror: 'example: scaffold mirror --apply --yes',\n\taudit: 'example: scaffold audit --live',\n\trepair: 'example: scaffold repair --apply',\n\tfleet: 'example: scaffold fleet --apply --yes',\n\tcatalog: 'example: scaffold catalog --apply',\n})\n\n/** Message used when a prune scan has no candidates. */\nexport const PRUNE_EMPTY = 'no unexpected files to delete'\n\n/** Guidance for unexpected files outside a non-pruning repair handoff. */\nexport const FOREIGN_HINT =\n\t\"unexpected files are never deleted by default — run 'scaffold repair --prune --apply' to delete them; a file you added yourself is unexpected too, so check the paths above first\"\n\n/** Interactive dependency prompt. */\nexport const ORKESTREL_DEPS_PROMPT =\n\t'@orkestrel dependencies (comma-separated short names, e.g. contract, emitter — installed as dependencies)'\n\n/** Catalog-degraded validation note. */\nexport const CATALOG_UNRESOLVED_NOTE =\n\t\"couldn't resolve the vendored @orkestrel catalog — validating names by shape only\"\n\n/** Opening marker for the generated package catalog block. */\nexport const CATALOG_START_MARKER = '<!-- catalog:start -->'\n\n/** Closing marker for the generated package catalog block. */\nexport const CATALOG_END_MARKER = '<!-- catalog:end -->'\n\n/** Non-terminal prune safety note. */\nexport const PRUNE_SKIPPED =\n\t'prune skipped — pass --apply to authorize deletion; --yes only skips confirmation'\n\n/** Degraded unexpected-file scan note. */\nexport const SCAN_SKIPPED =\n\t\"unexpected-file scanning skipped — couldn't establish the template source\"\n","/** Internal sentinel that unwinds command dispatch without bypassing cleanup. */\nexport class CLIExitError extends Error {\n\treadonly code: number\n\n\tconstructor(code: number) {\n\t\tsuper(`cli-exit:${String(code)}`)\n\t\tthis.code = code\n\t}\n}\n","import type { Audit, CatalogEntry, Finding, Plan, PlanSummary } from '@src/core'\nimport type { MaterializeResult } from '@src/server'\nimport type {\n\tAuditCounts,\n\tCatalogResult,\n\tErrorEnvelope,\n\tFleetEntry,\n\tNewResult,\n\tOriginPartition,\n\tRepairAudit,\n\tRepairResult,\n} from './types.js'\n\n/** Partition findings by whether repair owns their artifact origin. The `owned` and `generated` buckets carry no foreign findings by construction. */\nexport function partitionFindings(findings: readonly Finding[], plan: Plan): OriginPartition {\n\tconst origins = new Map(plan.artifacts.map((artifact) => [artifact.path, artifact.origin]))\n\tlet ownedDrifted = 0\n\tlet ownedMissing = 0\n\tlet generatedDrifted = 0\n\tlet generatedMissing = 0\n\tlet foreign = 0\n\tfor (const finding of findings) {\n\t\tconst origin = origins.get(finding.path)\n\t\tconst owned = origin === 'host' || origin === 'template'\n\t\tif (finding.drift === 'aligned') continue\n\t\tif (finding.drift === 'foreign') {\n\t\t\tforeign += 1\n\t\t\tcontinue\n\t\t}\n\t\tif (finding.drift === 'stale') {\n\t\t\tif (owned) ownedDrifted += 1\n\t\t\telse generatedDrifted += 1\n\t\t} else if (finding.drift === 'missing') {\n\t\t\tif (owned) ownedMissing += 1\n\t\t\telse generatedMissing += 1\n\t\t}\n\t}\n\treturn {\n\t\towned: {\n\t\t\tdrifted: ownedDrifted,\n\t\t\tmissing: ownedMissing,\n\t\t\tforeign: 0,\n\t\t},\n\t\tgenerated: {\n\t\t\tdrifted: generatedDrifted,\n\t\t\tmissing: generatedMissing,\n\t\t\tforeign: 0,\n\t\t},\n\t\tforeign: { drifted: 0, missing: 0, foreign },\n\t}\n}\n\n/** Create one deterministic fleet result entry. */\nexport function fleetEntryOf(\n\tname: string,\n\tcounts: AuditCounts | undefined,\n\tfailed: boolean,\n\toutside = 0,\n): FleetEntry {\n\treturn {\n\t\tname,\n\t\tdrifted: counts?.drifted ?? 0,\n\t\tmissing: counts?.missing ?? 0,\n\t\tforeign: counts?.foreign ?? 0,\n\t\tfailed,\n\t\toutside,\n\t}\n}\n\n/** Create the command-line interface's machine-readable failure envelope. */\nexport function errorEnvelopeOf(code: string, message: string): ErrorEnvelope {\n\treturn { error: { code, message } }\n}\n\n/** Project a plan summary to the stable machine-readable `new` result. */\nexport function summaryToNewResult(summary: PlanSummary, applied: boolean): NewResult {\n\treturn {\n\t\tname: summary.name,\n\t\tsrc: summary.src,\n\t\tapp: summary.app,\n\t\thost: summary.host,\n\t\ttemplate: summary.template,\n\t\tcomputed: summary.computed,\n\t\tapplied,\n\t}\n}\n\n/** Add repair's outside-scope count to its selected audit. */\nexport function repairAuditOf(audit: Audit, outside: number): RepairAudit {\n\treturn { ...audit, outside }\n}\n\n/** Add a materialization result to a repair audit. */\nexport function auditToRepairResult(audit: RepairAudit, result: MaterializeResult): RepairResult {\n\treturn { ...audit, result }\n}\n\n/** Create the stable machine-readable catalog result. */\nexport function catalogResultOf(\n\tentries: readonly CatalogEntry[],\n\tdrift: boolean,\n\tshrink?: number,\n): CatalogResult {\n\treturn shrink === undefined ? { entries, drift } : { entries, drift, shrink }\n}\n","import type { Audit, CatalogEntry, Finding, Plan, PlanSummary, SyncReport } from '@src/core'\nimport { DEPENDENCY_NAME_PATTERN, isScaffoldError, ownDataValue, ScaffoldError } from '@src/core'\nimport { isFilesystemPath, resolvePhysicalPath } from '@src/server'\nimport type { TableOptions } from '@orkestrel/console'\nimport { attempt, isRecord, parseJSON } from '@orkestrel/contract'\nimport { relative as relativeOf } from 'node:path'\nimport {\n\tACTION_LABEL,\n\tDRIFT_LABEL,\n\tEXIT_CODES,\n\tFRESHNESS_LABEL,\n\tKNOWN_VERBS,\n\tORIGIN_LABEL,\n\tREPAIR_GENERATED_SCOPE,\n\tREPAIR_SCOPE,\n\tSAFETY_BANNER,\n\tVERB_DRY_RUN_NOTE,\n\tVERB_EXAMPLE,\n\tVERB_FLAG_HELP,\n\tVERB_FLAGS,\n\tVERB_SUMMARY,\n} from './constants.js'\nimport { partitionFindings } from './shapers.js'\nimport type { AuditCounts, FleetOutcome, RepairTally, RepairVerdictOptions, Verb } from './types.js'\n\n/** Render one pluralized count. */\nexport function countPart(count: number, label: string): string {\n\treturn `${count} ${label}${count === 1 ? '' : 's'}`\n}\n\n/** Render nonzero audit buckets or `clean`. */\nexport function bucketText(counts: AuditCounts): string {\n\tconst parts: string[] = []\n\tif (counts.drifted > 0) parts.push(`${counts.drifted} drifted`)\n\tif (counts.missing > 0) parts.push(`${counts.missing} missing`)\n\tif (counts.foreign > 0) parts.push(`${counts.foreign} unexpected`)\n\treturn parts.length > 0 ? parts.join(', ') : 'clean'\n}\n\n/** Render audit's origin-aware verdict. */\nexport function auditVerdict(audit: Audit, plan: Plan): string {\n\tconst count = audit.findings.length\n\tif (audit.clean) return `audit: ${countPart(count, 'artifact')} — clean`\n\tconst split = partitionFindings(audit.findings, plan)\n\tconst owned = split.owned.drifted === 0 && split.owned.missing === 0\n\tconst generated = bucketText(split.generated)\n\tconst foreign = bucketText(split.foreign)\n\tif (owned && generated === 'clean') {\n\t\treturn `audit: ${countPart(count, 'artifact')} — host-owned clean; ${foreign}`\n\t}\n\tconst suffix = foreign === 'clean' ? '' : `; unexpected: ${foreign}`\n\treturn owned\n\t\t? `audit: ${countPart(count, 'artifact')} — host-owned clean; ${generated} (generated)${suffix}`\n\t\t: `audit: ${countPart(count, 'artifact')} — host-owned: ${bucketText(split.owned)}; generated: ${generated}${suffix}`\n}\n\n/** Render non-aligned audit findings as terminal table rows. */\nexport function findingRows(\n\tfindings: readonly Finding[],\n\tplan: Plan,\n): readonly (readonly [string, string, string])[] {\n\tconst origins = new Map(plan.artifacts.map((artifact) => [artifact.path, artifact.origin]))\n\treturn findings\n\t\t.filter((finding) => finding.drift !== 'aligned')\n\t\t.map((finding): readonly [string, string, string] => {\n\t\t\tconst origin = origins.get(finding.path)\n\t\t\tconst category = origin === undefined ? 'unexpected file' : ORIGIN_LABEL[origin]\n\t\t\treturn [DRIFT_LABEL[finding.drift], category, finding.path]\n\t\t})\n}\n\n/** Create audit's terminal table. */\nexport function auditTable(audit: Audit, plan: Plan): TableOptions {\n\treturn {\n\t\tcolumns: [{ label: 'Status' }, { label: 'Kind' }, { label: 'Path' }],\n\t\trows: findingRows(audit.findings, plan),\n\t}\n}\n\n/**\n * Count the files one authorized write will create or overwrite.\n *\n * @param counts - The drift tallies of every target the write covers.\n * @param replace - Whether stale byte replacement was explicitly authorized.\n * @returns Every missing file, plus drifted files only under `replace`.\n * @remarks\n * The one figure every write confirmation asks about, so `repair` and `fleet`\n * cannot drift apart on it. An unexpected file is never counted here: only\n * `--prune` deletes one, and only after its own separate question.\n */\nexport function countWrites(counts: readonly AuditCounts[], replace: boolean): number {\n\tlet total = 0\n\tfor (const count of counts) total += count.missing + (replace ? count.drifted : 0)\n\treturn total\n}\n\n/**\n * Test whether a reported repository remains dirty inside or outside the selected scope.\n *\n * @param audit - The selected-scope audit.\n * @param outside - Findings outside that scope.\n * @returns Whether either source reports drift.\n */\nexport function hasFindings(audit: Audit, outside: number): boolean {\n\treturn !audit.clean || outside > 0\n}\n\n/**\n * Render one write verb's ownership boundary in that verb's own voice.\n *\n * @param verb - The command whose scope this is.\n * @param generated - Whether generated canon was included in the scope.\n * @param repos - The number of repositories the write covers, absent for a single target.\n * @returns The scope line naming what the command restores, what it replaces only with `--replace`, and what it never touches.\n */\nexport function scopeLine(verb: Verb, generated: boolean, repos?: number): string {\n\tconst across = repos === undefined ? '' : ` across ${countPart(repos, 'repo')}`\n\treturn `${verb} scope${across}: ${generated ? REPAIR_GENERATED_SCOPE : REPAIR_SCOPE}`\n}\n\n/**\n * Render drift outside repair's selected ownership boundary.\n *\n * @param count - The number of findings outside the selected scope.\n * @param generated - Whether generated canon was included in the repair scope.\n * @returns The scope guidance line, or `undefined` when no findings remain outside scope.\n */\nexport function scopeNote(count: number, generated: boolean): string | undefined {\n\tif (count === 0) return undefined\n\treturn generated\n\t\t? `note: ${countPart(count, 'finding')} outside host-owned and generated repair scope — run 'audit' for the list; present starter files and package publication metadata remain protected`\n\t\t: `note: ${countPart(count, 'finding')} outside host-owned repair scope — run 'audit' for the list`\n}\n\n/**\n * Render repair's dry-run verdict.\n *\n * @param audit - The audit over the selected repair plan.\n * @param options - The selected scope and write authorizations.\n * @returns The scope-aware clean or drifted verdict.\n */\nexport function repairVerdict(audit: Audit, options: RepairVerdictOptions): string {\n\tconst scope = options.generated ? 'host-owned and generated' : 'host-owned'\n\tif (audit.clean) {\n\t\treturn `repair: ${countPart(audit.findings.length, `${scope} artifact`)} aligned — nothing to write`\n\t}\n\tconst head = `repair: ${scope}: ${bucketText(audit)}`\n\tif (audit.drifted === 0) {\n\t\treturn options.apply\n\t\t\t? `${head} — missing files will be restored`\n\t\t\t: `${head} — pass --apply to write`\n\t}\n\t// With nothing missing there is nothing `--apply` alone can restore, so the\n\t// line names only the authorization that would change these files.\n\tif (audit.missing === 0) {\n\t\treturn options.replace\n\t\t\t? `${head} — --apply overwrites drifted files, discarding local changes`\n\t\t\t: `${head} — drifted files change only with --replace, which discards local changes`\n\t}\n\treturn options.replace\n\t\t? `${head} — --apply restores missing files and overwrites drifted ones, discarding local changes`\n\t\t: `${head} — --apply restores missing files; drifted files change only with --replace, which discards local changes`\n}\n\n/**\n * Merge only generated service scripts into an existing manifest.\n *\n * @param current - The existing consumer manifest text.\n * @param generated - The canonical manifest text for the derived service blueprint.\n * @param services - The declared service vendor names.\n * @returns Formatter-stable manifest text preserving publication metadata and unrelated scripts.\n */\nexport function mergeServiceManifest(\n\tcurrent: string,\n\tgenerated: string,\n\tservices: readonly string[],\n): string {\n\tconst currentManifest = parseJSON(current)\n\tconst generatedManifest = parseJSON(generated)\n\tif (!isRecord(currentManifest) || !isRecord(generatedManifest)) {\n\t\tthrow new ScaffoldError('INVALID', 'Service adoption requires object package manifests')\n\t}\n\tconst currentScriptsValue = ownDataValue(currentManifest, 'scripts')\n\tconst generatedScriptsValue = ownDataValue(generatedManifest, 'scripts')\n\tif (!isRecord(currentScriptsValue) || !isRecord(generatedScriptsValue)) {\n\t\tthrow new ScaffoldError('INVALID', 'Service adoption requires object package scripts')\n\t}\n\tconst serviceKeys = ['test:service', ...services.map((service) => `test:service:${service}`)]\n\tconst serviceNames = new Set(serviceKeys)\n\tconst currentPublish = ownDataValue(currentScriptsValue, 'prepublishOnly')\n\tconst generatedPublish = ownDataValue(generatedScriptsValue, 'prepublishOnly')\n\tif (typeof currentPublish !== 'string' || typeof generatedPublish !== 'string') {\n\t\tthrow new ScaffoldError('INVALID', 'Service adoption requires a prepublishOnly script')\n\t}\n\tconst suffix = ' && npm run test:service'\n\tconst publish = currentPublish.endsWith(suffix) ? currentPublish : `${currentPublish}${suffix}`\n\tconst scripts: Record<string, unknown> = {}\n\tfor (const name of Object.keys(generatedScriptsValue)) {\n\t\tif (serviceNames.has(name)) {\n\t\t\tconst value = ownDataValue(generatedScriptsValue, name)\n\t\t\tif (typeof value !== 'string') {\n\t\t\t\tthrow new ScaffoldError('INVALID', `Generated service script is missing at ${name}`)\n\t\t\t}\n\t\t\tscripts[name] = value\n\t\t\tcontinue\n\t\t}\n\t\tif (name === 'prepublishOnly') {\n\t\t\tscripts[name] = publish\n\t\t\tcontinue\n\t\t}\n\t\tconst value = ownDataValue(currentScriptsValue, name)\n\t\tif (value !== undefined) scripts[name] = value\n\t}\n\tfor (const name of Object.keys(currentScriptsValue)) {\n\t\tif (Object.hasOwn(scripts, name)) continue\n\t\tif (name === 'test:service' || name.startsWith('test:service:')) continue\n\t\tconst value = ownDataValue(currentScriptsValue, name)\n\t\tif (value !== undefined) scripts[name] = value\n\t}\n\treturn `${JSON.stringify({ ...currentManifest, scripts }, undefined, '\\t')}\\n`\n}\n\n/**\n * Render repair's closing tally.\n *\n * @param tally - The displayed counts of one repair run.\n * @returns The tally line, in the same words the audit table above it used.\n * @remarks\n * A drifted file repair was not authorized to overwrite is counted on its own\n * rather than folded in with the aligned files, because `unchanged` is already\n * the audit table's word for a file that matches canon.\n */\nexport function repairTally(tally: RepairTally): string {\n\tconst left =\n\t\ttally.drifted === 0\n\t\t\t? ''\n\t\t\t: `, ${countPart(tally.drifted, `${DRIFT_LABEL.stale} file`)} left alone`\n\treturn `${ACTION_LABEL.written} ${tally.written}, ${ACTION_LABEL.skipped} ${tally.unchanged}${left}, ${ACTION_LABEL.removed} ${tally.removed}`\n}\n\n/** Render synchronization freshness as table rows. */\nexport function syncRows(report: SyncReport): readonly (readonly [string, string, string])[] {\n\tconst guides = report.guides.map((guide): readonly [string, string, string] => [\n\t\tguide.name,\n\t\t'guide',\n\t\tFRESHNESS_LABEL[guide.freshness] ?? guide.freshness,\n\t])\n\tconst versions = report.versions.map((version): readonly [string, string, string] => [\n\t\tversion.name,\n\t\t'version',\n\t\tFRESHNESS_LABEL[version.freshness] ?? version.freshness,\n\t])\n\treturn [...guides, ...versions]\n}\n\n/** Create a synchronization terminal table. */\nexport function syncTable(report: SyncReport): TableOptions {\n\treturn {\n\t\tcolumns: [{ label: 'Name' }, { label: 'Kind' }, { label: 'Freshness' }],\n\t\trows: syncRows(report),\n\t}\n}\n\n/** Render cause notes from non-current synchronization entries. */\nexport function syncCauseNotes(report: SyncReport): readonly string[] {\n\treturn [...report.guides, ...report.versions]\n\t\t.filter((entry) => entry.note !== undefined)\n\t\t.map(\n\t\t\t(entry) =>\n\t\t\t\t` ${entry.name}: ${FRESHNESS_LABEL[entry.freshness] ?? entry.freshness} — ${entry.note}`,\n\t\t)\n}\n\n/** Render a command-specific synchronization tally. */\nexport function syncVerdict(report: SyncReport, action: 'pull' | 'mirror'): string {\n\tconst count = report.guides.length + report.versions.length\n\treturn `${action}: ${String(count)} ${count === 1 ? 'entry' : 'entries'} — ${String(report.failed)} failed`\n}\n\n/** Render a synchronization success tally. */\nexport function syncSuccess(count: number): string {\n\treturn `wrote ${countPart(count, 'guide')}`\n}\n\n/** Render one fleet repository outcome. */\nexport function fleetRepoLine(name: string, outcome: FleetOutcome): string {\n\tif (outcome.state === 'clean') return `${name}: clean`\n\tif (outcome.state === 'drifted') return `${name}: ${bucketText(outcome)}`\n\tif (outcome.state === 'repaired') {\n\t\treturn `${name}: repaired (${countPart(outcome.remaining, 'finding')} remaining)`\n\t}\n\treturn `${name}: ${outcome.message}`\n}\n\n/** Render fleet's repository totals. */\nexport function fleetTotals(drifted: number, failed: number): string {\n\treturn `total: ${countPart(drifted, 'dirty repo')}, ${failed} failed`\n}\n\n/** Create catalog's terminal table. */\nexport function catalogTable(entries: readonly CatalogEntry[]): TableOptions {\n\treturn {\n\t\tcolumns: [{ label: 'Package' }, { label: 'Version' }],\n\t\trows: entries.map((entry) => [entry.name, entry.version]),\n\t}\n}\n\n/** Render catalog shrink risk when present. */\nexport function catalogShrinkWarning(oldRows: number, newRows: number): string | undefined {\n\tif (newRows >= oldRows) return undefined\n\treturn `warning: catalog shrinks from ${countPart(oldRows, 'row')} to ${newRows}`\n}\n\n/** Render catalog source tallies. */\nexport function catalogCounts(published: number, local: number): string {\n\treturn `catalog: ${countPart(published, 'published package')}, ${countPart(local, 'local-only')}`\n}\n\n/** Create `new`'s plan summary table. */\nexport function newPlanTable(summary: PlanSummary): TableOptions {\n\treturn {\n\t\tcolumns: [{ label: 'Origin' }, { label: 'Count', align: 'right' }],\n\t\trows: [\n\t\t\t['host-owned', String(summary.host)],\n\t\t\t['starter', String(summary.template)],\n\t\t\t['generated', String(summary.computed)],\n\t\t],\n\t}\n}\n\n/**\n * Render one contained write destination as the operator's own path to it.\n *\n * @param root - The invocation directory every write is confined beneath.\n * @param destination - The contained physical destination.\n * @returns The destination relative to the invocation directory, or the absolute path when it is not beneath it.\n */\nexport function describeDestination(root: string, destination: string): string {\n\tconst path = relativeOf(root, destination).replaceAll('\\\\', '/')\n\tif (path === '') return '.'\n\treturn path.startsWith('..') ? destination : `./${path}`\n}\n\n/** Render `new`'s dry-run destination. */\nexport function newPlanPreview(destination: string): string {\n\treturn `will write into ${destination}`\n}\n\n/** Render `new`'s write result. */\nexport function newApplySuccess(count: number, destination: string): string {\n\treturn `wrote ${countPart(count, 'file')} into ${destination}`\n}\n\n/** Render catalog's write result. */\nexport function catalogApplySuccess(path: string): string {\n\treturn `wrote ${path}`\n}\n\n/** Render the shared write confirmation. */\nexport function applyConfirmMessage(files: number, repos?: number): string {\n\tconst scope = repos === undefined ? '' : ` across ${countPart(repos, 'repo')}`\n\treturn `Apply — write ${countPart(files, 'file')}${scope}? `\n}\n\n/** Render the separate prune confirmation. */\nexport function pruneConfirmMessage(count: number): string {\n\treturn `Also delete ${countPart(count, 'unexpected file')} under .claude/agents, .codex/agents, and scripts? `\n}\n\n/**\n * Render the interactive audit-to-repair handoff as the list of actions it authorizes.\n *\n * @param missing - The number of missing host-owned files the inherited repair would restore.\n * @param drifted - The number of drifted host-owned files it would overwrite, zero unless `--replace` authorized replacement.\n * @param foreign - The number of unexpected files found.\n * @param prune - Whether `--prune` authorized deletion, without which no unexpected file is touched.\n * @returns The confirmation question, naming each authorized action and the cost of overwriting.\n */\nexport function repairHandoff(\n\tmissing: number,\n\tdrifted: number,\n\tforeign: number,\n\tprune: boolean,\n): string {\n\tconst parts: string[] = []\n\tif (missing > 0) parts.push(`restore ${countPart(missing, 'missing host-owned file')}`)\n\tif (drifted > 0) {\n\t\tparts.push(\n\t\t\t`overwrite ${countPart(drifted, 'drifted host-owned file')}, discarding local changes`,\n\t\t)\n\t}\n\tif (prune && foreign > 0) parts.push(`delete ${countPart(foreign, 'unexpected file')}`)\n\treturn `${parts.join('; ')} — run repair now? `\n}\n\n/** Render one unresolved Orkestrel dependency token. */\nexport function unknownOrkestrelToken(token: string, suggestion: string | undefined): string {\n\tconst message = `\"${token}\" is not a published @orkestrel package`\n\treturn suggestion === undefined\n\t\t? `${message} — try again`\n\t\t: `${message} — did you mean \"${suggestion}\"? try again`\n}\n\n/** Render compact command usage. */\nexport function shortUsage(): string {\n\tconst lines = KNOWN_VERBS.map((verb) => ` ${verb.padEnd(8)}${VERB_SUMMARY[verb]}`)\n\treturn [\n\t\t'scaffold <verb> [options]',\n\t\t'',\n\t\t...lines,\n\t\t'',\n\t\t\"run 'scaffold <verb> --help' for a verb's full reference\",\n\t].join('\\n')\n}\n\n/** Render the full command reference. */\nexport function fullHelp(): string {\n\tconst verbs = KNOWN_VERBS.map(\n\t\t(verb) => ` ${verb} ${VERB_FLAGS[verb]}\\n ${VERB_SUMMARY[verb]}`,\n\t)\n\tconst exits = EXIT_CODES.map(([code, meaning]) => ` ${code} ${meaning}`)\n\treturn [\n\t\t'scaffold <verb> [options]',\n\t\t'',\n\t\t...verbs,\n\t\t'',\n\t\tSAFETY_BANNER,\n\t\t'',\n\t\t'exit codes:',\n\t\t...exits,\n\t].join('\\n')\n}\n\n/** Render one command's help reference. */\nexport function verbHelp(verb: Verb): string {\n\tconst flags = VERB_FLAG_HELP[verb].map(([flag, meaning]) => ` ${flag.padEnd(20)}${meaning}`)\n\treturn [\n\t\t`scaffold ${verb} ${VERB_FLAGS[verb]}`,\n\t\t'',\n\t\tVERB_SUMMARY[verb],\n\t\tVERB_DRY_RUN_NOTE[verb],\n\t\t'',\n\t\t...flags,\n\t\t'',\n\t\tVERB_EXAMPLE[verb],\n\t].join('\\n')\n}\n\n/** Compute Levenshtein edit distance. */\nexport function editDistance(left: string, right: string): number {\n\tconst rows = left.length + 1\n\tconst columns = right.length + 1\n\tconst table = new Uint32Array(rows * columns)\n\tfor (let row = 0; row < rows; row += 1) table[row * columns] = row\n\tfor (let column = 0; column < columns; column += 1) table[column] = column\n\tfor (let row = 1; row < rows; row += 1) {\n\t\tfor (let column = 1; column < columns; column += 1) {\n\t\t\tconst cost = left[row - 1] === right[column - 1] ? 0 : 1\n\t\t\tconst index = row * columns + column\n\t\t\ttable[index] = Math.min(\n\t\t\t\t(table[index - columns] ?? 0) + 1,\n\t\t\t\t(table[index - 1] ?? 0) + 1,\n\t\t\t\t(table[index - columns - 1] ?? 0) + cost,\n\t\t\t)\n\t\t}\n\t}\n\treturn table[rows * columns - 1] ?? 0\n}\n\n/** Find the nearest string by edit distance. */\nexport function nearest(input: string, set: readonly string[]): string | undefined {\n\tlet best: string | undefined\n\tlet distance = Number.POSITIVE_INFINITY\n\tfor (const candidate of set) {\n\t\tconst candidateDistance = editDistance(input, candidate)\n\t\tif (candidateDistance < distance) {\n\t\t\tdistance = candidateDistance\n\t\t\tbest = candidate\n\t\t}\n\t}\n\treturn best\n}\n\n/** Render an unknown command with a nearest-command hint. */\nexport function didYouMean(command: string): string {\n\tconst suggestion = nearest(command, KNOWN_VERBS)\n\treturn suggestion === undefined\n\t\t? `unknown command \"${command}\"`\n\t\t: `unknown command \"${command}\" — did you mean \"${suggestion}\"?`\n}\n\n/** Render one prune preview line per exact path. */\nexport function prunePreview(paths: readonly string[]): readonly string[] {\n\treturn paths.map((path) => ` delete ${path}`)\n}\n\n/** Render non-terminal guidance for missing input. */\nexport function missingInput(input: string, verb: string): string {\n\treturn `missing ${input} — pass it as a flag/argument, or run 'scaffold ${verb}' on a terminal to be guided`\n}\n\n/** Render an invalid package name. */\nexport function invalidName(name: string, pattern: string): string {\n\treturn `Package name \"${name}\" must match ${pattern}`\n}\n\n/** Render dependencies whose latest versions could not be resolved. */\nexport function unresolvedVersion(names: readonly string[]): string {\n\treturn `could not resolve the latest version for ${names.map((name) => `\"${name}\"`).join(', ')} — check the name or pass name@range`\n}\n\n/**\n * Render drift that belongs to generated artifacts.\n *\n * @param count - The number of findings on generated artifacts.\n * @returns The guidance line, stating what each repair scope does rather than how the files differ.\n */\nexport function generatedNote(count: number): string {\n\treturn `${countPart(count, 'finding')} in generated files — run 'scaffold repair --generated' to restore missing ones; add --replace to overwrite drifted ones, discarding local changes`\n}\n\n/**\n * Render the explicit destructive opt-in for stale host-owned files.\n *\n * @param count - The number of stale host-owned files.\n * @returns The replacement guidance line, naming the safe default before its destructive opt-in.\n */\nexport function replacementNote(count: number): string {\n\treturn `${countPart(count, 'drifted host-owned file')} — repair leaves drifted files alone; 'scaffold repair --replace' overwrites them, discarding local changes`\n}\n\n/**\n * Render honest repair guidance for computed and protected manifest drift.\n *\n * @param findings - The audit findings to classify.\n * @param plan - The plan that owns each computed artifact.\n * @returns One line for repairable computed drift and one for protected manifest drift when present.\n */\nexport function renderComputedNotes(findings: readonly Finding[], plan: Plan): readonly string[] {\n\tconst origins = new Map(plan.artifacts.map((artifact) => [artifact.path, artifact.origin]))\n\tlet computed = 0\n\tlet manifest = 0\n\tfor (const finding of findings) {\n\t\tif (finding.drift === 'aligned' || origins.get(finding.path) !== 'computed') continue\n\t\tif (finding.path === 'package.json') manifest += 1\n\t\telse computed += 1\n\t}\n\tconst notes: string[] = []\n\tif (computed > 0) notes.push(generatedNote(computed))\n\tif (manifest > 0 && plan.blueprint.services.length > 0) {\n\t\tnotes.push(\n\t\t\t`${countPart(manifest, 'finding')} in package.json — 'scaffold repair --generated' repairs generated service scripts; review any remaining publication metadata directly`,\n\t\t)\n\t} else if (manifest > 0) {\n\t\tnotes.push(\n\t\t\t`${countPart(manifest, 'finding')} in package.json — repair does not rewrite protected publication metadata; review and edit it directly`,\n\t\t)\n\t}\n\treturn notes\n}\n\n/** Render live dependency freshness tallies. */\nexport function auditLiveNote(current: number, behind: number, failed: number): string {\n\treturn `live: ${current} current, ${behind} behind, ${failed} failed`\n}\n\n/** Render whether an audit compared content or presence. */\nexport function comparisonLine(compared: number, presence: number): string {\n\tif (presence === 0) return 'comparing: file contents for host-owned files'\n\tif (compared === 0) {\n\t\treturn `comparing: file presence for ${countPart(presence, 'presence-owned file')}`\n\t}\n\treturn `comparing: file contents for ${countPart(compared, 'host-owned file')}; presence for ${countPart(presence, 'presence-owned file')}`\n}\n\n/** Render catalog's final verdict. */\nexport function catalogVerdict(clean: boolean): string {\n\treturn clean ? 'catalog: clean' : 'catalog: drifted — pass --apply to write'\n}\n\n/** Render a caught error without leaking implementation detail. */\nexport function describeError(error: unknown): string {\n\tif (isScaffoldError(error)) return `[${error.code}] ${error.message}`\n\treturn error instanceof Error ? error.message : 'unknown error'\n}\n\n/** Resolve and confine one write destination to its invocation root. */\nexport function containDestination(root: string, candidate: string): string {\n\tif (!isFilesystemPath(root) || !isFilesystemPath(candidate)) {\n\t\tthrow new ScaffoldError('INVALID', 'Target paths must not contain control characters')\n\t}\n\tconst contained = attempt(() =>\n\t\tresolvePhysicalPath(root, candidate, 'INVALID', 'working directory'),\n\t)\n\tif (contained.success) return contained.value\n\tif (isScaffoldError(contained.error) && contained.error.code === 'INVALID') {\n\t\tthrow new ScaffoldError(\n\t\t\t'INVALID',\n\t\t\t`Target \"${candidate}\" is outside or traverses a linked parent of the working directory — run scaffold from the physical directory you want to write beneath.`,\n\t\t\t{ path: candidate },\n\t\t)\n\t}\n\tthrow contained.error\n}\n\n/** Return one dependency-token issue, or absence when it is valid. */\nexport function orkestrelTokenIssue(\n\tnormalized: string,\n\tcatalog: readonly string[] | undefined,\n): string | undefined {\n\tif (catalog === undefined) {\n\t\treturn DEPENDENCY_NAME_PATTERN.test(normalized)\n\t\t\t? undefined\n\t\t\t: unknownOrkestrelToken(normalized, undefined)\n\t}\n\tif (catalog.includes(normalized)) return undefined\n\treturn unknownOrkestrelToken(normalized, nearest(normalized, catalog))\n}\n","import { parseArgs } from 'node:util'\nimport type { Dependency } from '@src/core'\nimport { isTerminalText } from '@src/server'\nimport { DEPENDENCY_NAME_PATTERN, ScaffoldError } from '@src/core'\nimport type { CLIArguments } from './types.js'\n\n/** Parse a strict command-line argument vector. */\nexport function parseArguments(argv: readonly string[]): CLIArguments {\n\tif (argv.some((argument) => !isTerminalText(argument))) {\n\t\tthrow new ScaffoldError('INVALID', 'Command arguments must not contain control characters')\n\t}\n\tconst args = argv[0] === '--' ? argv.slice(1) : [...argv]\n\treturn parseArgs({\n\t\targs,\n\t\tallowPositionals: true,\n\t\toptions: {\n\t\t\tsrc: { type: 'string' },\n\t\t\tapp: { type: 'string' },\n\t\t\tdeps: { type: 'string' },\n\t\t\tgroups: { type: 'string' },\n\t\t\ttarget: { type: 'string' },\n\t\t\tfrom: { type: 'string', multiple: true },\n\t\t\tapply: { type: 'boolean', default: false },\n\t\t\tyes: { type: 'boolean', default: false },\n\t\t\tjson: { type: 'boolean', default: false },\n\t\t\tprune: { type: 'boolean', default: false },\n\t\t\tgenerated: { type: 'boolean', default: false },\n\t\t\treplace: { type: 'boolean', default: false },\n\t\t\tstrict: { type: 'boolean', default: false },\n\t\t\tlive: { type: 'boolean', default: false },\n\t\t\toffline: { type: 'boolean', default: false },\n\t\t\thelp: { type: 'boolean', default: false, short: 'h' },\n\t\t},\n\t})\n}\n\n/** Split a comma-separated token list, trimming and dropping empty entries. */\nexport function splitTokens(raw: string): readonly string[] {\n\treturn raw\n\t\t.split(',')\n\t\t.map((token) => token.trim())\n\t\t.filter((token) => token.length > 0)\n}\n\n/** Normalize an Orkestrel dependency token to its full package name. */\nexport function normalizeOrkestrelToken(token: string): string {\n\treturn token.startsWith('@orkestrel/') ? token : `@orkestrel/${token}`\n}\n\n/**\n * Parse and resolve a pull dependency selection against the target manifest.\n *\n * @param raw - The comma-separated full package names, or `undefined` for all.\n * @param declared - The target's declared Orkestrel dependencies.\n * @returns `undefined` for all dependencies, otherwise the exact selected records.\n * @throws `ScaffoldError('INVALID')` for empty, malformed, repeated, or undeclared names.\n */\nexport function parsePullDependencies(\n\traw: string | undefined,\n\tdeclared: readonly Dependency[],\n): readonly Dependency[] | undefined {\n\tif (raw === undefined) return undefined\n\tconst names = raw.split(',').map((name) => name.trim())\n\tif (\n\t\tnames.length === 0 ||\n\t\tnames.some((name) => !DEPENDENCY_NAME_PATTERN.test(name)) ||\n\t\tnew Set(names).size !== names.length\n\t) {\n\t\tthrow new ScaffoldError(\n\t\t\t'INVALID',\n\t\t\t'Pull dependencies must be unique, comma-separated @orkestrel/* package names',\n\t\t)\n\t}\n\tconst selected = declared.filter((dependency) => names.includes(dependency.name))\n\tconst found = new Set(selected.map((dependency) => dependency.name))\n\tconst missing = names.filter((name) => !found.has(name))\n\tif (missing.length > 0) {\n\t\tthrow new ScaffoldError(\n\t\t\t'INVALID',\n\t\t\t`Pull dependencies are not declared by the target: ${missing.join(', ')}`,\n\t\t\t{ dependencies: missing },\n\t\t)\n\t}\n\treturn selected\n}\n","import { KNOWN_VERBS } from './constants.js'\nimport type { Verb } from './types.js'\n\n/** Narrow a positional command to the command-line interface's vocabulary. */\nexport function isVerb(value: string): value is Verb {\n\treturn KNOWN_VERBS.some((verb) => verb === value)\n}\n","// The `#!/usr/bin/env node` shebang is re-emitted by the build's `output.banner`, not source.\nimport { existsSync, mkdirSync, writeFileSync } from 'node:fs'\nimport { basename, dirname, join, relative as relativeOf } from 'node:path'\nimport * as tls from 'node:tls'\nimport type {\n\tArtifact,\n\tAudit,\n\tBlueprint,\n\tCatalogEntry,\n\tFinding,\n\tDependency,\n\tGroup,\n\tPlan,\n\tQuestion,\n\tSnapshot,\n\tSyncReport,\n} from '@src/core'\nimport type { MaterializeResult, SyncInterface, SyncOptions } from '@src/server'\nimport {\n\tblueprint,\n\tCATALOG_AGENT_PATH,\n\tcatalogNames,\n\tcatalogToBlock,\n\tcreateCompiler,\n\tdependency,\n\tDEPENDENCY_NAME_PATTERN,\n\tdiffPlan,\n\tGROUPS,\n\tisScaffoldError,\n\tmanifestToDependencies,\n\tmanifestToName,\n\tMAX_ARTIFACT_BYTES,\n\tNAME_PATTERN,\n\tplanToSummary,\n\tScaffoldError,\n\tSERVICE_SCRIPT_PATH,\n\tENVIRONMENTS,\n} from '@src/core'\nimport {\n\tcatalogPackages,\n\tcommitWriteTransaction,\n\tcreateMaterializer,\n\tcreateSync,\n\tderiveBlueprint,\n\tdiscoverPackages,\n\tdigestFile,\n\tdigestText,\n\tdiscardWriteTransaction,\n\thostRoot,\n\thydratePlan,\n\tisRealDirectory,\n\tisVacant,\n\tlocateHostSource,\n\tpruneTargets,\n\treadFileText,\n\treadHostManifest,\n\treadManifest,\n\treadTarget,\n\tparseSyncOptions,\n\tresolvePhysicalPath,\n\tvalidateWriteDirectories,\n\tWriteTransaction,\n} from '@src/server'\nimport type { SpinnerInterface } from '@orkestrel/console'\nimport { createReporter, createSpinner, createStyler } from '@orkestrel/console'\nimport { createServerSink } from '@orkestrel/console/server'\nimport { attempt } from '@orkestrel/contract'\nimport { isTerminalError } from '@orkestrel/terminal'\nimport type { TerminalInterface } from '@orkestrel/terminal/server'\nimport { createTerminal } from '@orkestrel/terminal/server'\nimport {\n\tCANCELLED_MESSAGE,\n\tCATALOG_UNRESOLVED_NOTE,\n\tCATALOG_END_MARKER,\n\tCATALOG_START_MARKER,\n\tFOREIGN_HINT,\n\tINVALID_ARGUMENTS_MESSAGE,\n\tNEW_DRY_RUN_NOTE,\n\tORKESTREL_DEPS_PROMPT,\n\tPRUNE_EMPTY,\n\tPRUNE_SKIPPED,\n\tSCAN_SKIPPED,\n\tENVIRONMENT_CHOICES,\n} from './constants.js'\nimport { CLIExitError } from './errors.js'\nimport {\n\tapplyConfirmMessage,\n\tauditLiveNote,\n\tauditTable,\n\tauditVerdict,\n\tcatalogApplySuccess,\n\tcatalogCounts,\n\tcatalogShrinkWarning,\n\tcatalogTable,\n\tcatalogVerdict,\n\tcomparisonLine,\n\tcontainDestination,\n\tcountWrites,\n\tdescribeDestination,\n\tdescribeError,\n\tdidYouMean,\n\tfleetRepoLine,\n\tfleetTotals,\n\tfullHelp,\n\thasFindings,\n\tinvalidName,\n\tmissingInput,\n\tnewApplySuccess,\n\tnewPlanPreview,\n\tnewPlanTable,\n\torkestrelTokenIssue,\n\tprunePreview,\n\tpruneConfirmMessage,\n\tmergeServiceManifest,\n\tsyncCauseNotes,\n\tsyncSuccess,\n\tsyncTable,\n\tsyncVerdict,\n\trepairHandoff,\n\trepairTally,\n\trepairVerdict,\n\treplacementNote,\n\trenderComputedNotes,\n\tscopeLine,\n\tscopeNote,\n\tshortUsage,\n\tunresolvedVersion,\n\tverbHelp,\n} from './helpers.js'\nimport {\n\tnormalizeOrkestrelToken,\n\tparseArguments,\n\tparsePullDependencies,\n\tsplitTokens,\n} from './parsers.js'\nimport {\n\tauditToRepairResult,\n\tcatalogResultOf,\n\terrorEnvelopeOf,\n\tfleetEntryOf,\n\tpartitionFindings,\n\trepairAuditOf,\n\tsummaryToNewResult,\n} from './shapers.js'\nimport type {\n\tCLIArguments,\n\tCLIInterface,\n\tCLIValues,\n\tFleetEntry,\n\tFleetFailure,\n\tFleetRepo,\n\tForeignScanResult,\n\tLiveResult,\n\tRepairAudit,\n} from './types.js'\nimport { isVerb } from './validators.js'\n\n/** Stateful command-line orchestration and its process boundary. */\nexport class CLI implements CLIInterface {\n\treadonly #sync: SyncOptions\n\t#sink = createServerSink()\n\t#tty = process.stdout.isTTY === true\n\t#styler = createStyler({ enabled: process.env.NO_COLOR === undefined && this.#tty })\n\t#reporter = createReporter({\n\t\tsink: this.#sink,\n\t\twidth: this.#sink.columns,\n\t\tstyler: this.#styler,\n\t})\n\t#json = false\n\n\t/**\n\t * Create command-line orchestration with optional upstream endpoint settings.\n\t *\n\t * @param sync - Sync settings used by every live dependency operation.\n\t */\n\tconstructor(sync?: SyncOptions) {\n\t\tthis.#sync = parseSyncOptions(sync)\n\t}\n\n\t/** Execute one command-line argument vector. */\n\tasync run(argv: readonly string[]): Promise<void> {\n\t\tthis.#trust()\n\t\ttry {\n\t\t\tawait this.#dispatch(argv)\n\t\t} catch (error) {\n\t\t\tif (error instanceof CLIExitError) {\n\t\t\t\tprocess.exitCode = error.code\n\t\t\t} else if (this.#json) {\n\t\t\t\tconst code = isScaffoldError(error) ? error.code : 'ERROR'\n\t\t\t\tconst message = isScaffoldError(error) ? error.message : describeError(error)\n\t\t\t\tthis.#write(errorEnvelopeOf(code, message))\n\t\t\t\tprocess.exitCode = 1\n\t\t\t} else {\n\t\t\t\tthis.#reporter.status('error', describeError(error))\n\t\t\t\tprocess.exitCode = 1\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Widen Node's default trusted-issuer set to include the OS certificate\n\t * store, so `fetch` behind a corporate TLS-inspecting proxy behaves like npm\n\t * (`cafile`) and browsers (OS trust store) instead of failing with\n\t * `UNABLE_TO_GET_ISSUER_CERT_LOCALLY` against Node's bundled CA list alone.\n\t * Feature-detected (`tls.getCACertificates` / `tls.setDefaultCACertificates`\n\t * ship on Node ≈22.16+/24.5+; this package's floor is `>=22.12.0`) and captured\n\t * through `attempt` — any failure is a silent no-op, never a crash. This only ADDS\n\t * trusted issuers; it never touches `rejectUnauthorized` or\n\t * `NODE_TLS_REJECT_UNAUTHORIZED`, so certificate verification stays on.\n\t */\n\t#trust(): void {\n\t\tif (\n\t\t\ttypeof tls.getCACertificates !== 'function' ||\n\t\t\ttypeof tls.setDefaultCACertificates !== 'function'\n\t\t) {\n\t\t\treturn\n\t\t}\n\t\tattempt(() => {\n\t\t\tconst merged = new Set([\n\t\t\t\t...tls.getCACertificates('default'),\n\t\t\t\t...tls.getCACertificates('system'),\n\t\t\t])\n\t\t\ttls.setDefaultCACertificates([...merged])\n\t\t})\n\t}\n\n\t/** Write ONE machine-readable JSON value to stdout — the entire `--json` output contract. */\n\t#write(value: unknown): void {\n\t\tprocess.stdout.write(`${JSON.stringify(value)}\\n`)\n\t}\n\n\t/** Report a general operation failure with exit 1 as prose or one JSON error envelope. */\n\t#fail(message: string, json: boolean): never {\n\t\tif (json) this.#write(errorEnvelopeOf('ERROR', message))\n\t\telse this.#reporter.status('error', message)\n\t\tthrow new CLIExitError(1)\n\t}\n\n\t/**\n\t * A general operation failure from a caught error — the real\n\t * `ScaffoldError` code when available ('ERROR' last resort), prose (via\n\t * `describe`, which still carries the bracketed code for a human reader) or\n\t * the one JSON error envelope under `--json` (code and message kept\n\t * SEPARATE — never double-encoding the code into the message text).\n\t */\n\t#error(error: unknown, json: boolean): never {\n\t\tif (json) {\n\t\t\tconst code = isScaffoldError(error) ? error.code : 'ERROR'\n\t\t\tconst message = isScaffoldError(error) ? error.message : describeError(error)\n\t\t\tthis.#write(errorEnvelopeOf(code, message))\n\t\t} else {\n\t\t\tthis.#reporter.status('error', describeError(error))\n\t\t}\n\t\tthrow new CLIExitError(1)\n\t}\n\n\t/** A usage error (bad flag value, unknown verb — exit 2) — stderr prose, or the one JSON error envelope under `--json`. */\n\t#usage(message: string, json: boolean): never {\n\t\tif (json) this.#write(errorEnvelopeOf('USAGE', message))\n\t\telse process.stderr.write(`${message}\\n`)\n\t\tthrow new CLIExitError(2)\n\t}\n\n\t/** Contain a destination and report any coded escape through the shared CLI error path. */\n\t#contain(candidate: string, json: boolean): string {\n\t\tconst contained = attempt(() => containDestination(process.cwd(), candidate))\n\t\tif (contained.success) return contained.value\n\t\tthis.#error(contained.error, json)\n\t}\n\n\t/** Compile a spec and report unresolved blocking questions through the shared CLI error path. */\n\t#compile(\n\t\tspec: Blueprint,\n\t\tjson: boolean,\n\t\tgroups?: readonly Group[],\n\t): readonly [plan: Plan, questions: readonly Question[]] {\n\t\tconst compiler = createCompiler()\n\t\ttry {\n\t\t\tconst scaffolding = compiler.compile(spec, groups)\n\t\t\tif (!scaffolding.plan) {\n\t\t\t\tconst blocking = scaffolding.questions.filter((question) => question.blocking)\n\t\t\t\tconst message = (blocking.length > 0 ? blocking : scaffolding.questions)\n\t\t\t\t\t.map((question) => question.text)\n\t\t\t\t\t.join('; ')\n\t\t\t\tthis.#fail(message, json)\n\t\t\t}\n\t\t\treturn [scaffolding.plan, scaffolding.questions]\n\t\t} finally {\n\t\t\tcompiler.destroy()\n\t\t}\n\t}\n\n\t// Exclude the workspace-owned service provisioner from every physical scan.\n\t#prunePaths(target: string, host: string, services: readonly string[]): readonly string[] {\n\t\tconst seam = services.length > 0 ? SERVICE_SCRIPT_PATH : undefined\n\t\treturn pruneTargets(target, host).filter((path) => path !== seam)\n\t}\n\n\t/**\n\t * Merge the physical prune scan into `audit` as `foreign` findings — pure\n\t * object-spread composition in the BIN only (`src/core`'s `diffPlan` is never\n\t * modified/reimplemented). Every unexpected path except the declared service\n\t * workspace's exact `SERVICE_SCRIPT_PATH` becomes one `'orchestration'`-group\n\t * `foreign` finding (the `Group` every `PRUNE_DIRECTORIES` entry—`.claude/agents`,\n\t * `.codex/agents`, `scripts`—belongs to); any scan hit makes the merged audit\n\t * unclean, so an \"unexpected file\" is honestly counted as drift (exit 1)\n\t * instead of the structurally-always-zero `diffPlan.foreign`.\n\t */\n\t#scan(audit: Audit, target: string, host: string, services: readonly string[]): Audit {\n\t\tconst paths = this.#prunePaths(target, host, services)\n\t\tif (paths.length === 0) return audit\n\t\tconst findings: Finding[] = paths.map((path) => ({\n\t\t\tpath,\n\t\t\tgroup: 'orchestration',\n\t\t\tdrift: 'foreign',\n\t\t}))\n\t\treturn {\n\t\t\t...audit,\n\t\t\tclean: false,\n\t\t\tforeign: audit.foreign + paths.length,\n\t\t\tfindings: [...audit.findings, ...findings],\n\t\t}\n\t}\n\n\t/**\n\t * Add unexpected-file findings when the vendored allowlist can be established.\n\t * When fail-closed allowlist discovery raises a coded `TARGET` failure, retain\n\t * the existing findings and mark the audit incomplete instead of crashing.\n\t */\n\t#scanSafe(\n\t\taudit: Audit,\n\t\ttarget: string,\n\t\thost: string,\n\t\tservices: readonly string[],\n\t): ForeignScanResult {\n\t\tconst scanned = attempt(() => this.#scan(audit, target, host, services))\n\t\tif (scanned.success) return { audit: scanned.value, skipped: false }\n\t\tif (isScaffoldError(scanned.error) && scanned.error.code === 'TARGET') {\n\t\t\treturn {\n\t\t\t\taudit: {\n\t\t\t\t\t...audit,\n\t\t\t\t\tclean: false,\n\t\t\t\t\tcomplete: false,\n\t\t\t\t\tquestions: [\n\t\t\t\t\t\t...audit.questions,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfield: 'host',\n\t\t\t\t\t\t\ttext: scanned.error.message,\n\t\t\t\t\t\t\tblocking: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\tskipped: true,\n\t\t\t}\n\t\t}\n\t\tthrow scanned.error\n\t}\n\n\t/**\n\t * `repair` scopes to host-owned artifacts by default and optionally generated canon, but the\n\t * caller compiles the full plan anyway. Diff it too so a clean scoped verdict can point at drift\n\t * outside the selected boundary. The count feeds the shared `scopeNote` renderer.\n\t */\n\t#outside(compiled: Plan, selected: Plan, target: string, host: string): number {\n\t\tconst full = hydratePlan(compiled, host)\n\t\tconst selectedPaths = new Set(selected.artifacts.map((artifact) => artifact.path))\n\t\tconst audit = diffPlan(\n\t\t\tfull,\n\t\t\treadTarget(\n\t\t\t\ttarget,\n\t\t\t\tfull.artifacts.map((artifact) => artifact.path),\n\t\t\t),\n\t\t)\n\t\treturn audit.findings.filter(\n\t\t\t(finding) => finding.drift !== 'aligned' && !selectedPaths.has(finding.path),\n\t\t).length\n\t}\n\n\t// Emit repair's machine result or its human-readable outside-scope explanation.\n\t#emitRepair(\n\t\taudit: RepairAudit,\n\t\tgenerated: boolean,\n\t\tjson: boolean,\n\t\tresult?: MaterializeResult,\n\t): void {\n\t\tif (json) {\n\t\t\tthis.#write(result === undefined ? audit : auditToRepairResult(audit, result))\n\t\t\treturn\n\t\t}\n\t\tconst note = scopeNote(audit.outside, generated)\n\t\tif (note !== undefined) this.#reporter.line(note)\n\t}\n\n\t/** Promote only absent service-owned starter seams into repairable missing artifacts. */\n\t#promoteServices(plan: Plan, target: string): Plan {\n\t\tif (plan.blueprint.services.length === 0) return plan\n\t\tconst paths = [SERVICE_SCRIPT_PATH, 'tests/config/services.test.ts']\n\t\tconst current = readTarget(target, paths)\n\t\treturn {\n\t\t\t...plan,\n\t\t\tartifacts: plan.artifacts.map((artifact) =>\n\t\t\t\tartifact.origin === 'template' &&\n\t\t\t\tpaths.includes(artifact.path) &&\n\t\t\t\t!Object.hasOwn(current, artifact.path)\n\t\t\t\t\t? { ...artifact, origin: 'computed' }\n\t\t\t\t\t: artifact,\n\t\t\t),\n\t\t}\n\t}\n\n\t/** Select repair ownership and merge only the manifest's generated service-script keys. */\n\t#scopeRepair(compiled: Plan, target: string, generated: boolean): Plan {\n\t\tconst promoted = this.#promoteServices(compiled, target)\n\t\tconst currentManifest =\n\t\t\tgenerated && promoted.blueprint.services.length > 0 ? readManifest(target) : undefined\n\t\tconst artifacts: Artifact[] = []\n\t\tfor (const artifact of promoted.artifacts) {\n\t\t\tif (\n\t\t\t\tartifact.origin === 'host' ||\n\t\t\t\tartifact.path === SERVICE_SCRIPT_PATH ||\n\t\t\t\tartifact.path === 'tests/config/services.test.ts' ||\n\t\t\t\t(generated && artifact.origin === 'computed' && artifact.path !== 'package.json')\n\t\t\t) {\n\t\t\t\tartifacts.push(artifact)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (\n\t\t\t\tcurrentManifest !== undefined &&\n\t\t\t\tartifact.origin === 'computed' &&\n\t\t\t\tartifact.path === 'package.json'\n\t\t\t) {\n\t\t\t\tconst content = mergeServiceManifest(\n\t\t\t\t\tcurrentManifest,\n\t\t\t\t\tartifact.content,\n\t\t\t\t\tpromoted.blueprint.services,\n\t\t\t\t)\n\t\t\t\tif (content !== currentManifest) artifacts.push({ ...artifact, content })\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\t...promoted,\n\t\t\tblueprint: { ...promoted.blueprint, overrides: [] },\n\t\t\tartifacts,\n\t\t}\n\t}\n\n\t/** Compile and audit the selected repair ownership boundary for one structural snapshot. */\n\t#prepareRepair(\n\t\tspec: Blueprint,\n\t\ttarget: string,\n\t\thost: string,\n\t\tgenerated: boolean,\n\t\tjson: boolean,\n\t): readonly [compiled: Plan, plan: Plan, audit: Audit] {\n\t\tconst [compiled] = this.#compile(spec, json)\n\t\tconst scoped = this.#scopeRepair(compiled, target, generated)\n\n\t\tlet plan: Plan\n\t\ttry {\n\t\t\tplan = hydratePlan(scoped, host)\n\t\t} catch (error) {\n\t\t\tthis.#error(error, json)\n\t\t}\n\n\t\ttry {\n\t\t\tconst audit = diffPlan(\n\t\t\t\tplan,\n\t\t\t\treadTarget(\n\t\t\t\t\ttarget,\n\t\t\t\t\tplan.artifacts.map((artifact) => artifact.path),\n\t\t\t\t),\n\t\t\t)\n\t\t\treturn [compiled, plan, audit]\n\t\t} catch (error) {\n\t\t\tthis.#error(error, json)\n\t\t}\n\t}\n\n\t/** Reject a cancelled prompt (ctrl-c) with the shared `CANCELLED_MESSAGE` — exit 1, nothing written. */\n\tasync #guard<T>(promise: Promise<T>): Promise<T> {\n\t\ttry {\n\t\t\treturn await promise\n\t\t} catch (error) {\n\t\t\tif (isTerminalError(error) && error.code === 'CANCEL') {\n\t\t\t\tthis.#reporter.line(CANCELLED_MESSAGE)\n\t\t\t\tthrow new CLIExitError(1)\n\t\t\t}\n\t\t\tthrow error\n\t\t}\n\t}\n\n\t/**\n\t * The shared write-confirmation gate every verb calls before it touches disk.\n\t * `--apply` is the sole write authorization. JSON and non-terminal calls do\n\t * not prompt once authorized; `--yes` skips the terminal confirmation.\n\t */\n\tasync #apply(\n\t\tterminal: TerminalInterface,\n\t\tmessage: string,\n\t\tvalues: CLIValues,\n\t\tjson: boolean,\n\t): Promise<boolean> {\n\t\tif (!values.apply) return false\n\t\tif (json || values.yes || !this.#tty) return true\n\t\treturn this.#guard(terminal.confirm({ message, default: false }))\n\t}\n\n\t/**\n\t * The SECOND, separate confirm for `--prune`-eligible deletions — never\n\t * bundled into the write question. Both `--prune` and `--apply` are required;\n\t * `--yes` only skips this confirmation and never authorizes deletion.\n\t */\n\tasync #prune(\n\t\tterminal: TerminalInterface,\n\t\tmessage: string,\n\t\tvalues: CLIValues,\n\t\tjson: boolean,\n\t): Promise<boolean> {\n\t\tif (!values.prune) return false\n\t\tif (!values.apply) {\n\t\t\tif (!json && !this.#tty) this.#reporter.line(PRUNE_SKIPPED)\n\t\t\treturn false\n\t\t}\n\t\tif (json || values.yes || !this.#tty) return true\n\t\treturn this.#guard(terminal.confirm({ message, default: false }))\n\t}\n\n\t/** A spinner for a long-running write step, absent under `--json` or off a TTY sink. */\n\t#spinner(message: string, json: boolean): SpinnerInterface | undefined {\n\t\treturn json || !this.#tty\n\t\t\t? undefined\n\t\t\t: createSpinner({ message, sink: this.#sink, styler: this.#styler })\n\t}\n\n\t/** Announce a successful write — the spinner's own success line, or a plain `reporter.status` without one (never under `--json`). */\n\t#succeed(spinner: SpinnerInterface | undefined, json: boolean, message: string): void {\n\t\tif (spinner) spinner.success(message)\n\t\telse if (!json) this.#reporter.status('success', message)\n\t}\n\n\t/** Announce a failed write and halt(1) — the spinner's own failure line (if any), then the shared `fail`. */\n\t#reject(spinner: SpinnerInterface | undefined, json: boolean, error: unknown): never {\n\t\tconst message = describeError(error)\n\t\tif (spinner) spinner.failure(message)\n\t\tthis.#fail(message, json)\n\t}\n\n\t/**\n\t * Best-effort vendored `@orkestrel` catalog names, resolved via `host`\n\t * (`hostRoot()`, or the active `--from` override) through the host manifest\n\t * — `undefined` when the catalog cannot be established (a missing/unreadable\n\t * manifest, no `CATALOG_AGENT_PATH` entry, or any other failure),\n\t * degrading the dependency prompt to shape-only validation instead of blocking on it.\n\t */\n\t#names(host: string): readonly string[] | undefined {\n\t\tconst names = attempt(() => {\n\t\t\tconst manifest = readHostManifest(host)\n\t\t\tconst full = locateHostSource(manifest, CATALOG_AGENT_PATH, host)\n\t\t\tif (full === undefined || !existsSync(full)) return undefined\n\t\t\tconst relative = relativeOf(host, full).replaceAll('\\\\', '/')\n\t\t\treturn catalogNames(readFileText(host, relative, 'TARGET', 'host'))\n\t\t})\n\t\treturn names.success ? names.value : undefined\n\t}\n\n\t/** Prompt for `@orkestrel` short-name dependencies until every token resolves or input is empty. */\n\tasync #prompt(\n\t\tterminal: TerminalInterface,\n\t\tcatalog: readonly string[] | undefined,\n\t): Promise<readonly string[]> {\n\t\tfor (;;) {\n\t\t\tconst raw = await this.#guard(terminal.input({ message: ORKESTREL_DEPS_PROMPT, default: '' }))\n\t\t\tconst tokens = splitTokens(raw)\n\t\t\tif (tokens.length === 0) return []\n\t\t\tconst normalized = tokens.map(normalizeOrkestrelToken)\n\t\t\tconst issue = normalized\n\t\t\t\t.map((token) => orkestrelTokenIssue(token, catalog))\n\t\t\t\t.find((message) => message !== undefined)\n\t\t\tif (issue === undefined) return normalized\n\t\t\tthis.#reporter.line(issue)\n\t\t}\n\t}\n\n\t/** `scaffold new` — scaffold a package into `./<name>` (or `--target`). */\n\tasync #new(values: CLIValues, argument: string | undefined, json: boolean): Promise<void> {\n\t\tconst terminal = createTerminal()\n\n\t\tlet name: string\n\t\tif (argument !== undefined) {\n\t\t\tname = argument\n\t\t} else if (json) {\n\t\t\tthis.#usage('a package name is required with --json', json)\n\t\t} else if (!this.#tty) {\n\t\t\tthis.#usage(missingInput('a package name', 'new'), json)\n\t\t} else {\n\t\t\tname = await this.#guard(\n\t\t\t\tterminal.input({\n\t\t\t\t\tmessage: 'Package name',\n\t\t\t\t\tvalidate: { pattern: NAME_PATTERN.source },\n\t\t\t\t}),\n\t\t\t)\n\t\t}\n\t\t// Validate positional and interactively collected names against the same\n\t\t// core-owned package-name contract.\n\t\tif (!NAME_PATTERN.test(name)) {\n\t\t\tthis.#usage(invalidName(name, NAME_PATTERN.source), json)\n\t\t}\n\n\t\tlet srcInput: readonly string[]\n\t\tlet appInput: readonly string[]\n\t\tif (values.src !== undefined) {\n\t\t\tsrcInput = values.src.split(',').map((candidate) => candidate.trim())\n\t\t} else if (values.app !== undefined) {\n\t\t\tsrcInput = []\n\t\t} else if (json || !this.#tty) {\n\t\t\tthis.#usage('at least one of --src or --app is required', json)\n\t\t} else {\n\t\t\tsrcInput = await this.#guard(\n\t\t\t\tterminal.checkbox({\n\t\t\t\t\tmessage: 'Published src environments',\n\t\t\t\t\tchoices: ENVIRONMENT_CHOICES,\n\t\t\t\t\tmin: 0,\n\t\t\t\t}),\n\t\t\t)\n\t\t}\n\t\tif (values.app !== undefined) {\n\t\t\tappInput = values.app.split(',').map((candidate) => candidate.trim())\n\t\t} else if (values.src !== undefined || json || !this.#tty) {\n\t\t\tappInput = []\n\t\t} else {\n\t\t\tappInput = await this.#guard(\n\t\t\t\tterminal.checkbox({\n\t\t\t\t\tmessage: 'Application environments',\n\t\t\t\t\tchoices: ENVIRONMENT_CHOICES,\n\t\t\t\t\tmin: 0,\n\t\t\t\t}),\n\t\t\t)\n\t\t}\n\t\tconst unrecognizedSrcEnvironment = srcInput.filter(\n\t\t\t(candidate) => !ENVIRONMENTS.some((environment) => environment === candidate),\n\t\t)\n\t\tif (unrecognizedSrcEnvironment.length > 0) {\n\t\t\tthis.#usage(\n\t\t\t\t`Environment \"${unrecognizedSrcEnvironment.join('\", \"')}\" is not recognized`,\n\t\t\t\tjson,\n\t\t\t)\n\t\t}\n\t\tif (new Set(srcInput).size !== srcInput.length) {\n\t\t\tthis.#usage('Published src environments must not repeat', json)\n\t\t}\n\t\tconst src = ENVIRONMENTS.filter((environment) => srcInput.includes(environment))\n\t\tconst unrecognizedAppEnvironment = appInput.filter(\n\t\t\t(candidate) => !ENVIRONMENTS.some((environment) => environment === candidate),\n\t\t)\n\t\tif (unrecognizedAppEnvironment.length > 0) {\n\t\t\tthis.#usage(\n\t\t\t\t`Application environment \"${unrecognizedAppEnvironment.join('\", \"')}\" is not recognized`,\n\t\t\t\tjson,\n\t\t\t)\n\t\t}\n\t\tif (new Set(appInput).size !== appInput.length) {\n\t\t\tthis.#usage('Application environments must not repeat', json)\n\t\t}\n\t\tconst app = ENVIRONMENTS.filter((environment) => appInput.includes(environment))\n\t\tif (src.length === 0 && app.length === 0) {\n\t\t\tthis.#usage('at least one source or application environment is required', json)\n\t\t}\n\n\t\t// Establish containment before preview, network access, confirmation, or\n\t\t// any other work that assumes the destination is writable.\n\t\tconst destination = this.#contain(values.target ?? `./${name}`, json)\n\t\tif (!isVacant(destination)) {\n\t\t\tthis.#error(\n\t\t\t\tnew ScaffoldError('TARGET', 'new requires a vacant target', { target: destination }),\n\t\t\t\tjson,\n\t\t\t)\n\t\t}\n\t\tconst explicitHost = values.from?.[0]\n\t\tif (explicitHost !== undefined) {\n\t\t\tif (!isRealDirectory(explicitHost)) {\n\t\t\t\tthis.#error(\n\t\t\t\t\tnew ScaffoldError('TARGET', `Host root is not a physical directory at ${explicitHost}`, {\n\t\t\t\t\t\thost: explicitHost,\n\t\t\t\t\t}),\n\t\t\t\t\tjson,\n\t\t\t\t)\n\t\t\t}\n\t\t\treadHostManifest(explicitHost)\n\t\t}\n\n\t\t// `--deps` is OPTIONAL — a non-TTY session with neither `--json` nor\n\t\t// `--deps` defaults to no extra dependencies rather than failing (only a\n\t\t// REQUIRED input triggers `missingInput`'s usage error); the multi-prompt\n\t\t// guidance below stays TTY-only under the one-prompt-per-process ceiling.\n\t\t// `--deps` uses an untrimmed split and is\n\t\t// `DEPENDENCY_NAME_PATTERN`-gated BEFORE any network call. The\n\t\t// interactive prompt adds short-name\n\t\t// normalization + vendored-catalog validation (re-asking on an unknown\n\t\t// token, degrading to shape-only when the catalog cannot be resolved).\n\t\tlet depNames: readonly string[]\n\t\tif (values.deps !== undefined) {\n\t\t\tdepNames = values.deps.split(',').filter((depName) => depName.length > 0)\n\t\t\tconst badDep = depNames.find((depName) => !DEPENDENCY_NAME_PATTERN.test(depName))\n\t\t\tif (badDep !== undefined) {\n\t\t\t\tthis.#usage(\n\t\t\t\t\t`Dependency name \"${badDep}\" must match ${DEPENDENCY_NAME_PATTERN.source}`,\n\t\t\t\t\tjson,\n\t\t\t\t)\n\t\t\t}\n\t\t} else if (json || !this.#tty) {\n\t\t\tdepNames = []\n\t\t} else {\n\t\t\tconst catalogHost = values.from?.[0] ?? hostRoot()\n\t\t\tconst catalog = this.#names(catalogHost)\n\t\t\tif (catalog === undefined) this.#reporter.line(CATALOG_UNRESOLVED_NOTE)\n\t\t\tdepNames = await this.#prompt(terminal, catalog)\n\t\t}\n\n\t\t// `--deps` resolves latest versions from the registry and pins caret ranges; their\n\t\t// guides fetch into the plan.\n\t\tconst sync = createSync(this.#sync)\n\t\tlet versions\n\t\ttry {\n\t\t\tversions = await sync.lookup(depNames)\n\t\t} finally {\n\t\t\tsync.destroy()\n\t\t}\n\t\t// `createSync()` is non-strict — it never throws — so a bare-name\n\t\t// `--deps` name that the registry could not resolve (`freshness`\n\t\t// 'missing'/'failed') is a HARD failure here.\n\t\tconst unresolved = versions\n\t\t\t.filter((version) => version.freshness === 'missing' || version.freshness === 'failed')\n\t\t\t.map((version) => version.name)\n\t\tif (unresolved.length > 0) this.#fail(unresolvedVersion(unresolved), json)\n\t\tconst deps = versions.map((version) => {\n\t\t\tif (version.freshness !== 'behind') this.#fail(unresolvedVersion([version.name]), json)\n\t\t\treturn dependency(version.name, `^${version.latest}`)\n\t\t})\n\n\t\t// Extra devDependencies are authored in `package.json` after scaffolding;\n\t\t// `deriveBlueprint`'s extras round-trip\n\t\t// (`@src/server`) recompiles them back into the plan, so `audit` stays\n\t\t// clean over a hand-added `devDependencies` entry (AGENTS §21 core stays\n\t\t// the single source of truth for that relaxation).\n\t\tconst [plan] = this.#compile(blueprint(name, { src, app, dependencies: deps }), json)\n\n\t\tconst summary = planToSummary(plan)\n\n\t\t// Name the directory the files land in, not the package they describe:\n\t\t// `--target .` writes into the working directory itself, and an operator\n\t\t// told `./<name>` would go looking in a directory that never existed.\n\t\tconst label = describeDestination(process.cwd(), destination)\n\n\t\tif (!json) {\n\t\t\tthis.#reporter.section('Plan')\n\t\t\tthis.#reporter.table(newPlanTable(summary))\n\t\t\tthis.#reporter.line(newPlanPreview(label))\n\t\t}\n\n\t\tconst proceed = await this.#apply(\n\t\t\tterminal,\n\t\t\tapplyConfirmMessage(summary.host + summary.template + summary.computed),\n\t\t\tvalues,\n\t\t\tjson,\n\t\t)\n\n\t\tif (!proceed) {\n\t\t\tif (json) this.#write(summaryToNewResult(summary, false))\n\t\t\telse this.#reporter.line(NEW_DRY_RUN_NOTE)\n\t\t\tprocess.exitCode = 0\n\t\t\treturn\n\t\t}\n\n\t\tconst spinner = this.#spinner('materializing', json)\n\t\tspinner?.start()\n\t\tconst host = values.from?.[0]\n\t\tconst materializer = createMaterializer(host === undefined ? undefined : { host })\n\t\ttry {\n\t\t\tconst result = materializer.materialize(plan, destination)\n\t\t\tconst count = result.written.length + result.copied.length\n\t\t\tif (json) this.#write(summaryToNewResult(summary, true))\n\t\t\telse this.#succeed(spinner, json, newApplySuccess(count, label))\n\t\t} catch (error) {\n\t\t\tthis.#reject(spinner, json, error)\n\t\t} finally {\n\t\t\tmaterializer.destroy()\n\t\t}\n\t\tprocess.exitCode = 0\n\t}\n\n\t/** `scaffold pull` — refresh vendored dependency mirrors and report range drift. */\n\tasync #pull(values: CLIValues, json: boolean): Promise<void> {\n\t\tconst target = this.#contain(values.target ?? '.', json)\n\n\t\tconst sync = createSync(\n\t\t\tvalues.strict === undefined ? this.#sync : { ...this.#sync, strict: values.strict },\n\t\t)\n\t\ttry {\n\t\t\tlet report: SyncReport\n\t\t\ttry {\n\t\t\t\tconst declared = manifestToDependencies(readManifest(target))\n\t\t\t\tconst selected = parsePullDependencies(values.deps, declared)\n\t\t\t\treport = await sync.pull(target, selected)\n\t\t\t} catch (error) {\n\t\t\t\tthis.#error(error, json)\n\t\t\t}\n\n\t\t\tawait this.#refresh(sync, report, target, values, json, 'pull', true)\n\t\t} finally {\n\t\t\tsync.destroy()\n\t\t}\n\t}\n\n\t/** `scaffold mirror` — refresh every published Orkestrel package guide. */\n\tasync #mirror(values: CLIValues, json: boolean): Promise<void> {\n\t\tconst target = this.#contain(values.target ?? '.', json)\n\t\tconst sync = createSync(\n\t\t\tvalues.strict === undefined ? this.#sync : { ...this.#sync, strict: values.strict },\n\t\t)\n\t\ttry {\n\t\t\tlet report: SyncReport\n\t\t\ttry {\n\t\t\t\treport = await sync.mirror(target)\n\t\t\t} catch (error) {\n\t\t\t\tthis.#error(error, json)\n\t\t\t}\n\t\t\tawait this.#refresh(sync, report, target, values, json, 'mirror', report.failed === 0)\n\t\t} finally {\n\t\t\tsync.destroy()\n\t\t}\n\t}\n\n\tasync #refresh(\n\t\tsync: SyncInterface,\n\t\treport: SyncReport,\n\t\ttarget: string,\n\t\tvalues: CLIValues,\n\t\tjson: boolean,\n\t\taction: 'pull' | 'mirror',\n\t\twritable: boolean,\n\t): Promise<void> {\n\t\tif (!json) {\n\t\t\tthis.#reporter.table(syncTable(report))\n\t\t\tfor (const line of syncCauseNotes(report)) this.#reporter.line(line)\n\t\t\tthis.#reporter.line(syncVerdict(report, action))\n\t\t}\n\t\tconst toWrite = [...report.guides, ...report.versions].filter(\n\t\t\t(entry) => entry.freshness !== 'current',\n\t\t).length\n\t\tconst terminal = createTerminal()\n\t\tconst proceed =\n\t\t\twritable && toWrite > 0\n\t\t\t\t? await this.#apply(terminal, applyConfirmMessage(toWrite), values, json)\n\t\t\t\t: false\n\t\tif (proceed) {\n\t\t\tconst spinner = this.#spinner('writing mirrors', json)\n\t\t\tspinner?.start()\n\t\t\ttry {\n\t\t\t\tconst written = await sync.write(report, target)\n\t\t\t\tif (json) this.#write(report)\n\t\t\t\telse this.#succeed(spinner, json, syncSuccess(written.length))\n\t\t\t} catch (error) {\n\t\t\t\tthis.#reject(spinner, json, error)\n\t\t\t}\n\t\t} else if (json) {\n\t\t\tthis.#write(report)\n\t\t}\n\t\tprocess.exitCode = report.failed > 0 ? 1 : report.clean || proceed ? 0 : 1\n\t}\n\n\t/** `scaffold audit` — whole-plan conformance report; offers a repair handoff on drift. */\n\tasync #audit(values: CLIValues, json: boolean): Promise<void> {\n\t\tconst target = this.#contain(values.target ?? '.', json)\n\n\t\tlet spec: Blueprint\n\t\ttry {\n\t\t\tspec = deriveBlueprint(target)\n\t\t} catch (error) {\n\t\t\tthis.#error(error, json)\n\t\t}\n\n\t\tconst deps: readonly Dependency[] = [...spec.dependencies, ...spec.peers, ...spec.extras]\n\n\t\tconst groupsInput = values.groups?.split(',')\n\t\tlet groups: readonly Group[] | undefined\n\t\tif (groupsInput !== undefined) {\n\t\t\tconst unrecognized = groupsInput.filter((name) => !GROUPS.some((group) => group === name))\n\t\t\tif (unrecognized.length > 0) {\n\t\t\t\tthis.#usage(`Group \"${unrecognized.join('\", \"')}\" is not recognized`, json)\n\t\t\t}\n\t\t\tgroups = GROUPS.filter((group) => groupsInput.includes(group))\n\t\t}\n\n\t\tconst [compiled, questions] = this.#compile(spec, json, groups)\n\t\tconst from = values.from?.[0]\n\t\tconst host = from ?? hostRoot()\n\t\tlet plan: Plan\n\t\ttry {\n\t\t\tplan = hydratePlan(this.#promoteServices(compiled, target), host)\n\t\t} catch (error) {\n\t\t\tthis.#error(error, json)\n\t\t}\n\t\tconst artifactPaths = plan.artifacts.map((artifact) => artifact.path)\n\n\t\t// Merge the physical unexpected-file scan into the presented audit. Only an\n\t\t// established host can positively define the vendored allowlist; a failed\n\t\t// scan marks the audit incomplete without erasing its other findings.\n\t\tconst rawAudit = {\n\t\t\t...diffPlan(plan, readTarget(target, artifactPaths)),\n\t\t\tquestions,\n\t\t}\n\t\tconst scanned = this.#scanSafe(rawAudit, target, host, spec.services)\n\t\tconst audit = scanned.audit\n\t\tlet drifted = !audit.clean\n\n\t\tlet live: LiveResult | undefined\n\t\tif (values.live) {\n\t\t\tconst sync = createSync(this.#sync)\n\t\t\ttry {\n\t\t\t\tconst manifestName = manifestToName(readManifest(target))\n\t\t\t\tconst guideDependencies = deps.filter((entry) => entry.name !== manifestName)\n\t\t\t\tconst guides = await sync.guides(guideDependencies)\n\t\t\t\tconst versions = await sync.versions(deps)\n\t\t\t\tconst entries = [...guides, ...versions]\n\t\t\t\tdrifted ||= entries.some((entry) => entry.freshness !== 'current')\n\t\t\t\tconst current = entries.filter((entry) => entry.freshness === 'current').length\n\t\t\t\tconst behind = entries.filter((entry) => entry.freshness === 'behind').length\n\t\t\t\tconst failed = entries.length - current - behind\n\t\t\t\tlive = { current, behind, failed }\n\t\t\t} finally {\n\t\t\t\tsync.destroy()\n\t\t\t}\n\t\t}\n\n\t\tif (json) {\n\t\t\tthis.#write(live === undefined ? audit : { ...audit, live })\n\t\t\tprocess.exitCode = drifted ? 1 : 0\n\t\t\treturn\n\t\t}\n\n\t\tif (scanned.skipped) this.#reporter.line(SCAN_SKIPPED)\n\t\tfor (const question of audit.questions) {\n\t\t\tif (!question.blocking) this.#reporter.line(`warning: ${question.text}`)\n\t\t}\n\t\tconst hostArtifacts = plan.artifacts.filter((artifact) => artifact.origin === 'host')\n\t\tconst presenceOwned = hostArtifacts.filter((artifact) => artifact.hex === undefined).length\n\t\tthis.#reporter.line(comparisonLine(hostArtifacts.length - presenceOwned, presenceOwned))\n\t\tthis.#reporter.table(auditTable(audit, plan))\n\t\tthis.#reporter.line(auditVerdict(audit, plan))\n\t\tif (live !== undefined) {\n\t\t\tthis.#reporter.line(auditLiveNote(live.current, live.behind, live.failed))\n\t\t}\n\n\t\tif (!audit.clean) {\n\t\t\tconst split = partitionFindings(audit.findings, plan)\n\t\t\tconst replace = values.replace === true\n\t\t\tconst ownedCount = split.owned.missing + (replace ? split.owned.drifted : 0)\n\t\t\tconst pruneRequested = values.prune === true\n\n\t\t\t// Audit never writes via flags: the handoff is an INTERACTIVE\n\t\t\t// convenience only, offered exclusively on a TTY session — `--apply` /\n\t\t\t// `--yes` NEVER count as handoff consent here (they gate the SEPARATE\n\t\t\t// `repair` run this branch may launch, never audit's own read-only\n\t\t\t// pass. A foreign-only handoff would be a dead end: the handoff also covers\n\t\t\t// foreign files, but ONLY when `--prune` was passed — an inherited\n\t\t\t// repair without `--prune` cannot delete them, so offering the handoff\n\t\t\t// for foreign-only drift without `--prune` would be a dead end.\n\t\t\tconst offerHandoff = this.#tty && (ownedCount > 0 || (audit.foreign > 0 && pruneRequested))\n\n\t\t\tlet handoffAccepted = false\n\t\t\tif (offerHandoff) {\n\t\t\t\tconst terminal = createTerminal()\n\t\t\t\tconst message = repairHandoff(\n\t\t\t\t\tsplit.owned.missing,\n\t\t\t\t\treplace ? split.owned.drifted : 0,\n\t\t\t\t\taudit.foreign,\n\t\t\t\t\tpruneRequested,\n\t\t\t\t)\n\t\t\t\thandoffAccepted = await this.#guard(terminal.confirm({ message, default: false }))\n\t\t\t\tif (handoffAccepted) {\n\t\t\t\t\tawait this.#repair(values, false)\n\t\t\t\t\t// Repair's own exit code reflects only\n\t\t\t\t\t// ITS scope — re-diff the FULL plan (host/template/computed AND\n\t\t\t\t\t// the foreign scan) so the audit's exit code stays truthful about\n\t\t\t\t\t// ANY drift still remaining, mirroring `runFleet`'s post-repair\n\t\t\t\t\t// `finalAudit` pattern.\n\t\t\t\t\tconst rawFinal = diffPlan(plan, readTarget(target, artifactPaths))\n\t\t\t\t\tconst finalScanned = this.#scanSafe(rawFinal, target, host, spec.services)\n\t\t\t\t\tprocess.exitCode = finalScanned.audit.clean ? 0 : 1\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!handoffAccepted) {\n\t\t\t\tif (split.owned.drifted > 0 && !replace) {\n\t\t\t\t\tthis.#reporter.line(replacementNote(split.owned.drifted))\n\t\t\t\t}\n\t\t\t\t// When the handoff cannot help foreign files (no `--prune`, or no\n\t\t\t\t// handoff offered at all), point at the one command that can.\n\t\t\t\tif (audit.foreign > 0 && !pruneRequested) this.#reporter.line(FOREIGN_HINT)\n\t\t\t\tfor (const note of renderComputedNotes(audit.findings, plan)) {\n\t\t\t\t\tthis.#reporter.line(note)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tprocess.exitCode = drifted ? 1 : 0\n\t}\n\n\t/** `scaffold repair` — restore host-owned files and optionally generated canon for one target. */\n\tasync #repair(values: CLIValues, json: boolean): Promise<void> {\n\t\tconst target = this.#contain(values.target ?? '.', json)\n\n\t\tlet spec: Blueprint\n\t\ttry {\n\t\t\tspec = deriveBlueprint(target)\n\t\t} catch (error) {\n\t\t\tthis.#error(error, json)\n\t\t}\n\n\t\t// Repair defaults to host restoration plus absent service seams. `--generated`\n\t\t// adds generated canon and the manifest's service scripts while preserving\n\t\t// present starters and all other manifest data.\n\t\tconst generated = values.generated === true\n\t\tconst replace = values.replace === true\n\t\tconst from = values.from?.[0]\n\t\tconst host = from ?? hostRoot()\n\t\tconst prepared = this.#prepareRepair(spec, target, host, generated, json)\n\t\tlet compiled = prepared[0]\n\t\tlet plan = prepared[1]\n\t\tlet audit = prepared[2]\n\t\tlet outcome = repairAuditOf(\n\t\t\tthis.#scanSafe(audit, target, host, spec.services).audit,\n\t\t\tthis.#outside(compiled, plan, target, host),\n\t\t)\n\t\tconst verdict = {\n\t\t\tgenerated,\n\t\t\treplace,\n\t\t\tapply: values.apply === true,\n\t\t}\n\n\t\tif (!json) {\n\t\t\t// The scope line carries the cost of discarding local changes, so it is\n\t\t\t// stated only where there is drift for that cost to apply to. A clean\n\t\t\t// run's verdict already says nothing is being written.\n\t\t\tif (!outcome.clean) this.#reporter.line(scopeLine('repair', generated))\n\t\t\tthis.#reporter.section('Audit')\n\t\t\tthis.#reporter.table(auditTable(outcome, plan))\n\t\t}\n\n\t\t// The prune preview/confirm are driven by the real scan\n\t\t// (`pruneTargets`), never `audit.foreign` (which `diffPlan` can never\n\t\t// populate through this call path — it only ever reads the plan's own\n\t\t// paths). A zero-length scan skips the question entirely and is a no-op.\n\t\t// Compute this BEFORE the clean-audit check so `--prune` still reaches\n\t\t// the deletion flow on a clean-host repo. Only a clean audit with nothing\n\t\t// to prune returns early.\n\t\tconst prunePaths = values.prune ? this.#prunePaths(target, host, spec.services) : []\n\t\tconst pruneSnapshot = readTarget(target, prunePaths)\n\n\t\tif (outcome.clean && prunePaths.length === 0) {\n\t\t\tif (!json) this.#reporter.line(repairVerdict(outcome, verdict))\n\t\t\tthis.#emitRepair(outcome, generated, json)\n\t\t\tprocess.exitCode = hasFindings(outcome, outcome.outside) ? 1 : 0\n\t\t\treturn\n\t\t}\n\n\t\tif (!json) this.#reporter.line(repairVerdict(outcome, verdict))\n\n\t\tconst repairable = countWrites([audit], replace)\n\t\tif (repairable === 0 && prunePaths.length === 0) {\n\t\t\t// Nothing here is repairable: the only findings are drifted files no\n\t\t\t// authorization on this command line covers. Close with the same tally a\n\t\t\t// run that did write ends on rather than stopping mid-screen.\n\t\t\tif (!json) {\n\t\t\t\tthis.#reporter.line(\n\t\t\t\t\trepairTally({\n\t\t\t\t\t\twritten: 0,\n\t\t\t\t\t\tunchanged: audit.findings.length - audit.drifted - audit.missing - audit.foreign,\n\t\t\t\t\t\tdrifted: audit.drifted,\n\t\t\t\t\t\tremoved: 0,\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t}\n\t\t\tthis.#emitRepair(outcome, generated, json)\n\t\t\tprocess.exitCode = 1\n\t\t\treturn\n\t\t}\n\n\t\tconst terminal = createTerminal()\n\t\tlet proceed = true\n\t\tif (!audit.clean) {\n\t\t\tproceed = await this.#apply(terminal, applyConfirmMessage(repairable), values, json)\n\t\t}\n\n\t\tif (!proceed) {\n\t\t\tthis.#emitRepair(outcome, generated, json)\n\t\t\tprocess.exitCode = 1\n\t\t\treturn\n\t\t}\n\n\t\tif (values.prune && !json) {\n\t\t\tif (prunePaths.length === 0) this.#reporter.line(PRUNE_EMPTY)\n\t\t\telse for (const line of prunePreview(prunePaths)) this.#reporter.line(line)\n\t\t}\n\t\tconst doPrune =\n\t\t\tprunePaths.length > 0 &&\n\t\t\t(await this.#prune(terminal, pruneConfirmMessage(prunePaths.length), values, json))\n\n\t\tlet currentGlobal: boolean\n\t\ttry {\n\t\t\tcurrentGlobal = deriveBlueprint(target).global\n\t\t} catch (error) {\n\t\t\tthis.#error(error, json)\n\t\t}\n\t\tif (currentGlobal !== spec.global) {\n\t\t\tspec = { ...spec, global: currentGlobal }\n\t\t\tconst refreshed = this.#prepareRepair(spec, target, host, generated, json)\n\t\t\tcompiled = refreshed[0]\n\t\t\tplan = refreshed[1]\n\t\t\taudit = refreshed[2]\n\t\t\toutcome = repairAuditOf(\n\t\t\t\tthis.#scanSafe(audit, target, host, spec.services).audit,\n\t\t\t\tthis.#outside(compiled, plan, target, host),\n\t\t\t)\n\t\t}\n\n\t\tconst spinner = this.#spinner('repairing', json)\n\t\tspinner?.start()\n\t\tconst materializer = createMaterializer({ host })\n\t\ttry {\n\t\t\tconst result = materializer.repair(plan, audit, target, replace)\n\t\t\tconst removed = doPrune ? materializer.prune(target, pruneSnapshot).removed : []\n\t\t\tconst finalAudit = repairAuditOf(\n\t\t\t\tthis.#scanSafe(\n\t\t\t\t\tdiffPlan(\n\t\t\t\t\t\tplan,\n\t\t\t\t\t\treadTarget(\n\t\t\t\t\t\t\ttarget,\n\t\t\t\t\t\t\tplan.artifacts.map((artifact) => artifact.path),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t\ttarget,\n\t\t\t\t\thost,\n\t\t\t\t\tspec.services,\n\t\t\t\t).audit,\n\t\t\t\toutcome.outside,\n\t\t\t)\n\t\t\t// Every artifact repair did not write lands in `skipped`, drifted ones\n\t\t\t// included. Split the refused drift back out so the tally's `unchanged`\n\t\t\t// means what the audit table's `unchanged` means.\n\t\t\tconst left = replace ? 0 : audit.drifted\n\t\t\tif (!json) {\n\t\t\t\tthis.#succeed(\n\t\t\t\t\tspinner,\n\t\t\t\t\tjson,\n\t\t\t\t\trepairTally({\n\t\t\t\t\t\twritten: result.written.length + result.copied.length,\n\t\t\t\t\t\tunchanged: result.skipped.length - left,\n\t\t\t\t\t\tdrifted: left,\n\t\t\t\t\t\tremoved: removed.length,\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t}\n\t\t\tthis.#emitRepair(finalAudit, generated, json, { ...result, removed })\n\t\t\tprocess.exitCode = hasFindings(finalAudit, finalAudit.outside) ? 1 : 0\n\t\t} catch (error) {\n\t\t\tthis.#reject(spinner, json, error)\n\t\t} finally {\n\t\t\tmaterializer.destroy()\n\t\t}\n\t}\n\n\t/** `scaffold fleet` — audit/repair every `@orkestrel` package beneath the current directory's immediate children. */\n\tasync #fleet(values: CLIValues, json: boolean): Promise<void> {\n\t\tconst root = this.#contain('.', json)\n\t\tconst generated = values.generated === true\n\t\tconst replace = values.replace === true\n\n\t\tconst packages = discoverPackages(root)\n\t\tif (packages.length === 0) {\n\t\t\tthis.#fail(\n\t\t\t\t`no @orkestrel packages under \"${root}\" — fleet scans the immediate children of the current directory; stand in the folder that contains your checkouts (cd ..), or use 'repair' to true up just this repo.`,\n\t\t\t\tjson,\n\t\t\t)\n\t\t}\n\n\t\tconst from = values.from?.[0]\n\t\tconst host = from ?? hostRoot()\n\n\t\tconst repos: FleetRepo[] = []\n\t\tconst failures: FleetFailure[] = []\n\t\tfor (const directory of packages) {\n\t\t\tconst name = basename(directory)\n\t\t\ttry {\n\t\t\t\tconst compiler = createCompiler()\n\t\t\t\tlet compiled: Plan\n\t\t\t\tlet scoped: Plan\n\t\t\t\tlet questions: readonly Question[]\n\t\t\t\ttry {\n\t\t\t\t\tconst spec = deriveBlueprint(directory)\n\t\t\t\t\tconst scaffolding = compiler.compile(spec)\n\t\t\t\t\tif (!scaffolding.plan) {\n\t\t\t\t\t\tconst message = scaffolding.questions.map((question) => question.text).join('; ')\n\t\t\t\t\t\tthrow new ScaffoldError('INVALID', message)\n\t\t\t\t\t}\n\t\t\t\t\tcompiled = scaffolding.plan\n\t\t\t\t\tscoped = this.#scopeRepair(compiled, directory, generated)\n\t\t\t\t\tquestions = scaffolding.questions\n\t\t\t\t} finally {\n\t\t\t\t\tcompiler.destroy()\n\t\t\t\t}\n\n\t\t\t\tconst plan = hydratePlan(scoped, host)\n\t\t\t\tconst paths = plan.artifacts.map((artifact) => artifact.path)\n\t\t\t\tconst rawAudit = {\n\t\t\t\t\t...diffPlan(plan, readTarget(directory, paths)),\n\t\t\t\t\tquestions,\n\t\t\t\t}\n\t\t\t\t// Include physical unexpected-file findings in each repository audit.\n\t\t\t\tconst audit = this.#scan(rawAudit, directory, host, plan.blueprint.services)\n\t\t\t\tconst outside = this.#outside(compiled, plan, directory, host)\n\t\t\t\trepos.push({\n\t\t\t\t\tname,\n\t\t\t\t\tdirectory,\n\t\t\t\t\tplan,\n\t\t\t\t\trawAudit,\n\t\t\t\t\taudit,\n\t\t\t\t\toutside,\n\t\t\t\t})\n\t\t\t} catch (error) {\n\t\t\t\tfailures.push({ name, message: describeError(error) })\n\t\t\t}\n\t\t}\n\n\t\tif (!json) {\n\t\t\tfor (const repo of repos) {\n\t\t\t\tthis.#reporter.line(\n\t\t\t\t\tfleetRepoLine(\n\t\t\t\t\t\trepo.name,\n\t\t\t\t\t\trepo.audit.clean\n\t\t\t\t\t\t\t? { state: 'clean' }\n\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\tstate: 'drifted',\n\t\t\t\t\t\t\t\t\tdrifted: repo.audit.drifted,\n\t\t\t\t\t\t\t\t\tmissing: repo.audit.missing,\n\t\t\t\t\t\t\t\t\tforeign: repo.audit.foreign,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t\tfor (const question of repo.audit.questions) {\n\t\t\t\t\tif (!question.blocking) {\n\t\t\t\t\t\tthis.#reporter.line(`${repo.name}: warning: ${question.text}`)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst note = scopeNote(repo.outside, generated)\n\t\t\t\tif (note !== undefined) this.#reporter.line(`${repo.name}: ${note}`)\n\t\t\t}\n\t\t\tfor (const failure of failures) {\n\t\t\t\tthis.#reporter.line(\n\t\t\t\t\tfleetRepoLine(failure.name, { state: 'failed', message: failure.message }),\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\n\t\tconst dirty = repos.filter((repo) => !repo.audit.clean)\n\t\tconst reportedDirty = repos.filter((repo) => hasFindings(repo.audit, repo.outside))\n\n\t\tif (dirty.length === 0) {\n\t\t\tif (json) {\n\t\t\t\tthis.#write([\n\t\t\t\t\t...repos.map((repo) => fleetEntryOf(repo.name, repo.audit, false, repo.outside)),\n\t\t\t\t\t...failures.map((failure) => fleetEntryOf(failure.name, undefined, true)),\n\t\t\t\t])\n\t\t\t} else {\n\t\t\t\tthis.#reporter.line(fleetTotals(reportedDirty.length, failures.length))\n\t\t\t}\n\t\t\tprocess.exitCode = reportedDirty.length > 0 || failures.length > 0 ? 1 : 0\n\t\t\treturn\n\t\t}\n\n\t\tconst fileCount = countWrites(\n\t\t\tdirty.map((repo) => repo.audit),\n\t\t\treplace,\n\t\t)\n\n\t\t// Fleet is the widest write this executable performs and its confirmation\n\t\t// names only a count, so state the boundary and what `--replace` costs\n\t\t// before asking — and only once a write is authorized, never over a dry run\n\t\t// that cannot touch anything.\n\t\tif (!json && values.apply === true) {\n\t\t\tthis.#reporter.line(scopeLine('fleet', generated, dirty.length))\n\t\t}\n\n\t\tconst terminal = createTerminal()\n\t\tconst proceed = await this.#apply(\n\t\t\tterminal,\n\t\t\tapplyConfirmMessage(fileCount, dirty.length),\n\t\t\tvalues,\n\t\t\tjson,\n\t\t)\n\n\t\t// Drive the fleet prune preview from each repository's physical scan and\n\t\t// prefix every path with its repository name. An unestablished host cannot\n\t\t// define an allowlist, so pruning remains a no-op.\n\t\tconst pruneSets =\n\t\t\tproceed && values.prune\n\t\t\t\t? new Map(\n\t\t\t\t\t\tdirty.map((repo) => {\n\t\t\t\t\t\t\tconst paths = this.#prunePaths(repo.directory, host, repo.plan.blueprint.services)\n\t\t\t\t\t\t\treturn [repo.name, readTarget(repo.directory, paths)]\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\t\t\t\t: new Map<string, Snapshot>()\n\t\tconst prunePaths = dirty.flatMap((repo) =>\n\t\t\tObject.keys(pruneSets.get(repo.name) ?? {}).map((path) => `${repo.name}/${path}`),\n\t\t)\n\t\tif (proceed && values.prune && !json) {\n\t\t\tif (prunePaths.length === 0) this.#reporter.line(PRUNE_EMPTY)\n\t\t\telse for (const line of prunePreview(prunePaths)) this.#reporter.line(line)\n\t\t}\n\t\tconst doPrune =\n\t\t\tproceed &&\n\t\t\tprunePaths.length > 0 &&\n\t\t\t(await this.#prune(terminal, pruneConfirmMessage(prunePaths.length), values, json))\n\n\t\tif (!proceed) {\n\t\t\tif (json) {\n\t\t\t\tthis.#write([\n\t\t\t\t\t...repos.map((repo) => fleetEntryOf(repo.name, repo.audit, false, repo.outside)),\n\t\t\t\t\t...failures.map((failure) => fleetEntryOf(failure.name, undefined, true)),\n\t\t\t\t])\n\t\t\t} else {\n\t\t\t\tthis.#reporter.line(fleetTotals(reportedDirty.length, failures.length))\n\t\t\t}\n\t\t\tprocess.exitCode = 1\n\t\t\treturn\n\t\t}\n\n\t\tconst materializer = createMaterializer({ host })\n\t\tlet drifted = repos.filter((repo) => repo.audit.clean && repo.outside > 0).length\n\t\tlet failedCount = failures.length\n\t\tconst entries: FleetEntry[] = repos\n\t\t\t.filter((repo) => repo.audit.clean)\n\t\t\t.map((repo) => fleetEntryOf(repo.name, repo.audit, false, repo.outside))\n\n\t\ttry {\n\t\t\tfor (const repo of dirty) {\n\t\t\t\ttry {\n\t\t\t\t\tmaterializer.repair(repo.plan, repo.rawAudit, repo.directory, replace)\n\t\t\t\t\tif (doPrune) {\n\t\t\t\t\t\tmaterializer.prune(repo.directory, pruneSets.get(repo.name) ?? {})\n\t\t\t\t\t}\n\t\t\t\t\tconst paths = repo.plan.artifacts.map((artifact) => artifact.path)\n\t\t\t\t\tconst rawFinal = diffPlan(repo.plan, readTarget(repo.directory, paths))\n\t\t\t\t\tconst finalAudit = this.#scan(\n\t\t\t\t\t\trawFinal,\n\t\t\t\t\t\trepo.directory,\n\t\t\t\t\t\thost,\n\t\t\t\t\t\trepo.plan.blueprint.services,\n\t\t\t\t\t)\n\t\t\t\t\tif (hasFindings(finalAudit, repo.outside)) drifted += 1\n\t\t\t\t\tentries.push(fleetEntryOf(repo.name, finalAudit, false, repo.outside))\n\t\t\t\t\tif (!json) {\n\t\t\t\t\t\tthis.#reporter.line(\n\t\t\t\t\t\t\tfleetRepoLine(repo.name, {\n\t\t\t\t\t\t\t\tstate: 'repaired',\n\t\t\t\t\t\t\t\tremaining:\n\t\t\t\t\t\t\t\t\tfinalAudit.drifted + finalAudit.missing + finalAudit.foreign + repo.outside,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t} catch (error) {\n\t\t\t\t\tfailedCount += 1\n\t\t\t\t\tentries.push(fleetEntryOf(repo.name, undefined, true))\n\t\t\t\t\tif (!json) {\n\t\t\t\t\t\tthis.#reporter.line(\n\t\t\t\t\t\t\tfleetRepoLine(repo.name, {\n\t\t\t\t\t\t\t\tstate: 'failed',\n\t\t\t\t\t\t\t\tmessage: describeError(error),\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} finally {\n\t\t\tmaterializer.destroy()\n\t\t}\n\n\t\tif (json) {\n\t\t\tthis.#write([\n\t\t\t\t...entries,\n\t\t\t\t...failures.map((failure) => fleetEntryOf(failure.name, undefined, true)),\n\t\t\t])\n\t\t} else {\n\t\t\tthis.#reporter.line(fleetTotals(drifted, failedCount))\n\t\t}\n\t\tprocess.exitCode = drifted > 0 || failedCount > 0 ? 1 : 0\n\t}\n\n\t/** `scaffold catalog` — regenerate the fleet package catalog table embedded in `.claude/agents/orkestrel.md`. */\n\tasync #catalog(values: CLIValues, json: boolean): Promise<void> {\n\t\tconst target = this.#contain(values.target ?? '.', json)\n\n\t\tconst explicitRoots = values.from\n\t\tlet entries: readonly CatalogEntry[]\n\t\tlet published = 0\n\t\tlet localOnly = 0\n\t\tconst notes = new Map<string, string>()\n\n\t\tif (values.offline) {\n\t\t\tconst roots = explicitRoots ?? [process.cwd()]\n\t\t\ttry {\n\t\t\t\tentries = catalogPackages(roots)\n\t\t\t} catch (error) {\n\t\t\t\tthis.#error(error, json)\n\t\t\t}\n\t\t} else {\n\t\t\tconst sync = createSync(this.#sync)\n\t\t\tsync.emitter.on('package', (name, note) => {\n\t\t\t\tif (note !== '') notes.set(name, note)\n\t\t\t})\n\t\t\tlet registryEntries: readonly CatalogEntry[]\n\t\t\ttry {\n\t\t\t\tregistryEntries = await sync.catalog()\n\t\t\t} catch (error) {\n\t\t\t\tthis.#error(error, json)\n\t\t\t} finally {\n\t\t\t\tsync.destroy()\n\t\t\t}\n\t\t\tpublished = registryEntries.length\n\n\t\t\tlet localEntries: readonly CatalogEntry[] = []\n\t\t\tif (explicitRoots !== undefined) {\n\t\t\t\ttry {\n\t\t\t\t\tlocalEntries = catalogPackages(explicitRoots)\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthis.#error(error, json)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst merged = new Map<string, CatalogEntry>()\n\t\t\tfor (const entry of registryEntries) merged.set(entry.name, entry)\n\t\t\tfor (const local of localEntries) {\n\t\t\t\tconst existing = merged.get(local.name)\n\t\t\t\tif (existing === undefined) {\n\t\t\t\t\tmerged.set(local.name, local)\n\t\t\t\t\tlocalOnly += 1\n\t\t\t\t} else if (local.description.length > 0) {\n\t\t\t\t\tmerged.set(local.name, { ...existing, description: local.description })\n\t\t\t\t}\n\t\t\t}\n\t\t\tentries = [...merged.values()].sort((a, b) =>\n\t\t\t\ta.name < b.name ? -1 : a.name > b.name ? 1 : 0,\n\t\t\t)\n\t\t}\n\n\t\tconst block = catalogToBlock(entries)\n\t\t// Re-confine the exact leaf because a linked segment beneath an otherwise\n\t\t// contained target could redirect this write outside the working directory.\n\t\tconst agentPath = this.#contain(join(target, CATALOG_AGENT_PATH), json)\n\t\tlet current: string\n\t\tlet baseline: string\n\t\ttry {\n\t\t\tcurrent = readFileText(target, CATALOG_AGENT_PATH, 'TARGET', 'target')\n\t\t\tbaseline = digestText(current)\n\t\t} catch (error) {\n\t\t\tthis.#error(\n\t\t\t\tnew ScaffoldError('TARGET', `Failed to read ${agentPath}`, { path: agentPath, error }),\n\t\t\t\tjson,\n\t\t\t)\n\t\t}\n\n\t\tconst startIndex = current.indexOf(CATALOG_START_MARKER)\n\t\tconst endIndex = current.indexOf(CATALOG_END_MARKER)\n\t\tconst startParts = current.split(CATALOG_START_MARKER)\n\t\tconst endParts = current.split(CATALOG_END_MARKER)\n\t\tif (\n\t\t\tstartIndex === -1 ||\n\t\t\tendIndex === -1 ||\n\t\t\tendIndex < startIndex ||\n\t\t\tstartParts.length !== 2 ||\n\t\t\tendParts.length !== 2\n\t\t) {\n\t\t\tthis.#error(\n\t\t\t\tnew ScaffoldError(\n\t\t\t\t\t'TARGET',\n\t\t\t\t\t`Expected exactly one ordered \"${CATALOG_START_MARKER}\" / \"${CATALOG_END_MARKER}\" pair in ${agentPath}`,\n\t\t\t\t\t{ path: agentPath },\n\t\t\t\t),\n\t\t\t\tjson,\n\t\t\t)\n\t\t}\n\n\t\tconst before = current.slice(0, startIndex + CATALOG_START_MARKER.length)\n\t\tconst after = current.slice(endIndex)\n\t\tconst updated = `${before}\\n\\n${block}\\n${after}`\n\n\t\tconst oldBlock = current.slice(startIndex + CATALOG_START_MARKER.length, endIndex)\n\t\tconst oldRows = catalogNames(oldBlock).length\n\t\tconst shrink = entries.length < oldRows ? oldRows - entries.length : undefined\n\n\t\tif (updated === current) {\n\t\t\tif (json) this.#write(catalogResultOf(entries, false))\n\t\t\telse this.#reporter.line(catalogVerdict(true))\n\t\t\tprocess.exitCode = 0\n\t\t\treturn\n\t\t}\n\n\t\tif (!json) {\n\t\t\tthis.#reporter.table(catalogTable(entries))\n\t\t\tconst warning = catalogShrinkWarning(oldRows, entries.length)\n\t\t\tif (warning !== undefined) this.#reporter.line(warning)\n\t\t\tif (values.offline) {\n\t\t\t\tconst missingDescription = entries\n\t\t\t\t\t.filter((entry) => entry.description.length === 0)\n\t\t\t\t\t.map((entry) => entry.name)\n\t\t\t\tif (missingDescription.length > 0) {\n\t\t\t\t\tthis.#reporter.line(\n\t\t\t\t\t\t`${missingDescription.length} without guide description: ${missingDescription.join(', ')}`,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.#reporter.line(catalogCounts(published, localOnly))\n\t\t\t\tfor (const [name, note] of notes) this.#reporter.line(` ${name}: ${note}`)\n\t\t\t}\n\t\t}\n\n\t\tconst terminal = createTerminal()\n\t\tconst proceed = await this.#apply(terminal, applyConfirmMessage(1), values, json)\n\n\t\tif (!proceed) {\n\t\t\tif (json) this.#write(catalogResultOf(entries, true, shrink))\n\t\t\telse this.#reporter.line(catalogVerdict(false))\n\t\t\tprocess.exitCode = 1\n\t\t\treturn\n\t\t}\n\n\t\tif (Buffer.byteLength(updated, 'utf8') > MAX_ARTIFACT_BYTES) {\n\t\t\tthis.#error(\n\t\t\t\tnew ScaffoldError('WRITE', `Catalog exceeds the artifact limit at ${agentPath}`, {\n\t\t\t\t\tpath: agentPath,\n\t\t\t\t\tlimit: MAX_ARTIFACT_BYTES,\n\t\t\t\t}),\n\t\t\t\tjson,\n\t\t\t)\n\t\t}\n\t\tconst transaction = WriteTransaction.create(\n\t\t\ttarget,\n\t\t\t[CATALOG_AGENT_PATH],\n\t\t\t[{ path: CATALOG_AGENT_PATH, shape: 'file', digest: baseline }],\n\t\t)\n\t\tconst staged = attempt(() => {\n\t\t\tvalidateWriteDirectories(transaction)\n\t\t\tconst destination = resolvePhysicalPath(\n\t\t\t\ttransaction.stage,\n\t\t\t\tCATALOG_AGENT_PATH,\n\t\t\t\t'WRITE',\n\t\t\t\t'staging',\n\t\t\t)\n\t\t\tmkdirSync(dirname(destination), { recursive: true })\n\t\t\tvalidateWriteDirectories(transaction)\n\t\t\tconst contained = resolvePhysicalPath(\n\t\t\t\ttransaction.stage,\n\t\t\t\tCATALOG_AGENT_PATH,\n\t\t\t\t'WRITE',\n\t\t\t\t'staging',\n\t\t\t)\n\t\t\twriteFileSync(contained, updated, { encoding: 'utf8', flag: 'wx' })\n\t\t\tif (digestFile(contained) !== digestText(updated)) {\n\t\t\t\tthrow new ScaffoldError('WRITE', `Staged catalog changed at ${agentPath}`, {\n\t\t\t\t\tpath: agentPath,\n\t\t\t\t})\n\t\t\t}\n\t\t\tvalidateWriteDirectories(transaction)\n\t\t})\n\t\tif (!staged.success) {\n\t\t\tconst cleanup = attempt(() => discardWriteTransaction(transaction))\n\t\t\tthis.#error(\n\t\t\t\tnew ScaffoldError('WRITE', `Failed to stage ${agentPath}`, {\n\t\t\t\t\tpath: agentPath,\n\t\t\t\t\terror: staged.error,\n\t\t\t\t\tcleanup: cleanup.success ? undefined : cleanup.error,\n\t\t\t\t}),\n\t\t\t\tjson,\n\t\t\t)\n\t\t}\n\t\tconst committed = attempt(() => commitWriteTransaction(transaction, [CATALOG_AGENT_PATH]))\n\t\tif (!committed.success) this.#error(committed.error, json)\n\t\tif (json) this.#write(catalogResultOf(entries, true, shrink))\n\t\telse this.#reporter.status('success', catalogApplySuccess(agentPath))\n\t\tprocess.exitCode = 0\n\t}\n\n\t/**\n\t * The whole command dispatch — a single top-level driver (no nested function\n\t * declarations, AGENTS §4). Every verb sets `process.exitCode` (never\n\t * `process.exit`) and returns, or `halt()`s through a `finally` that\n\t * tears its entities down first; the caller at the bottom of this file\n\t * catches exactly one sentinel (`CliExit`) and stops.\n\t */\n\tasync #dispatch(argv: readonly string[]): Promise<void> {\n\t\tlet parsed: CLIArguments\n\t\ttry {\n\t\t\tparsed = parseArguments(argv)\n\t\t} catch (error) {\n\t\t\tprocess.stderr.write(\n\t\t\t\t`${error instanceof Error ? error.message : INVALID_ARGUMENTS_MESSAGE}\\n`,\n\t\t\t)\n\t\t\tprocess.exitCode = 2\n\t\t\treturn\n\t\t}\n\n\t\tconst { values, positionals } = parsed\n\t\tconst [command, argument] = positionals\n\t\tconst json = values.json === true\n\t\tthis.#json = json\n\n\t\tif (command === undefined) {\n\t\t\tprocess.stdout.write(`${values.help ? fullHelp() : shortUsage()}\\n`)\n\t\t\tprocess.exitCode = 0\n\t\t\treturn\n\t\t}\n\n\t\tif (!isVerb(command)) {\n\t\t\tthis.#usage(didYouMean(command), json)\n\t\t}\n\n\t\tif (command !== 'catalog' && values.from !== undefined && values.from.length > 1) {\n\t\t\tthis.#usage(`--from may be provided only once for '${command}'`, json)\n\t\t}\n\t\tif (command === 'mirror' && values.deps !== undefined) {\n\t\t\tthis.#usage(\"--deps is not supported for 'mirror'; use 'pull --deps'\", json)\n\t\t}\n\t\tif (command === 'fleet' && values.target !== undefined) {\n\t\t\tthis.#usage(\"--target is not supported for 'fleet'; change into the fleet root\", json)\n\t\t}\n\n\t\tif (values.help) {\n\t\t\tprocess.stdout.write(`${verbHelp(command)}\\n`)\n\t\t\tprocess.exitCode = 0\n\t\t\treturn\n\t\t}\n\n\t\tif (command === 'new') return this.#new(values, argument, json)\n\t\tif (command === 'pull') return this.#pull(values, json)\n\t\tif (command === 'mirror') return this.#mirror(values, json)\n\t\tif (command === 'audit') return this.#audit(values, json)\n\t\tif (command === 'repair') return this.#repair(values, json)\n\t\tif (command === 'fleet') return this.#fleet(values, json)\n\t\treturn this.#catalog(values, json)\n\t}\n}\n","// The `#!/usr/bin/env node` shebang is re-emitted by the build's `output.banner`, not source.\nimport { CLI } from './CLI.js'\n\nawait new CLI().run(process.argv.slice(2))\n"],"mappings":";;;;;;;;;;;;;;AAKA,IAAa,cAA+B,OAAO,OAAO;CACzD;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;;AAGD,IAAa,eAAiD,OAAO,OAAO;CAC3E,MAAM;CACN,UAAU;CACV,UAAU;AACX,CAAC;;AAGD,IAAa,cAA+C,OAAO,OAAO;CACzE,SAAS;CACT,OAAO;CACP,SAAS;CACT,SAAS;AACV,CAAC;;AAGD,IAAa,kBAAoD,OAAO,OAAO;CAC9E,SAAS;CACT,QAAQ;CACR,SAAS;CACT,QAAQ;AACT,CAAC;;AAGD,IAAa,eAAiD,OAAO,OAAO;CAC3E,SAAS;CACT,QAAQ;CACR,SAAS;CACT,SAAS;AACV,CAAC;;AAGD,IAAa,eACZ;;AAGD,IAAa,yBACZ;;AAGD,IAAa,mBAAmB;;AAGhC,IAAa,4BAA4B;;AAGzC,IAAa,oBAAoB;;AAGjC,IAAa,sBAAiD,OAAO,OAAO;CAC3E;EAAE,MAAM;EAAQ,OAAO;EAAQ,aAAa;CAAkB;CAC9D;EAAE,MAAM;EAAW,OAAO;EAAW,aAAa;CAAyB;CAC3E;EAAE,MAAM;EAAU,OAAO;EAAU,aAAa;CAA0B;AAC3E,CAAC;;AAGD,IAAa,gBAAgB;CAC5B;CACA;CACA;CACA;AACD,CAAC,CAAC,KAAK,IAAI;;AAGX,IAAa,aAAqD,OAAO,OAAO;CAC/E,CAAC,KAAK,iBAAiB;CACvB,CAAC,KAAK,kBAAkB;CACxB,CAAC,KAAK,aAAa;AACpB,CAAC;;AAGD,IAAa,eAA+C,OAAO,OAAO;CACzE,KAAK;CACL,MAAM;CACN,QA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