@stll/oxlint-config 1.0.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +97 -4
  2. package/dist/cloud-setup-cli.cjs +62 -21
  3. package/dist/cloud-setup-cli.cjs.map +1 -1
  4. package/dist/cloud-setup-cli.mjs +63 -22
  5. package/dist/cloud-setup-cli.mjs.map +1 -1
  6. package/dist/consumer-compat-cli.cjs +7 -6
  7. package/dist/consumer-compat-cli.cjs.map +1 -1
  8. package/dist/consumer-compat-cli.mjs +7 -6
  9. package/dist/consumer-compat-cli.mjs.map +1 -1
  10. package/dist/git-tracked-output.cjs.map +1 -1
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/publish-build-target-vite-dts-helper.mjs +1 -2
  13. package/dist/publish-build-target-vite-dts-helper2.cjs +5 -5
  14. package/dist/publish-build-target-vite-dts-helper2.cjs.map +1 -1
  15. package/dist/publish-contract-cli.cjs +17 -16
  16. package/dist/publish-contract-cli.cjs.map +1 -1
  17. package/dist/publish-contract-cli.mjs +6 -5
  18. package/dist/publish-contract-cli.mjs.map +1 -1
  19. package/dist/publish-contract.cjs +1 -1
  20. package/dist/publish-contract.cjs.map +1 -1
  21. package/dist/publish-contract.mjs +1 -1
  22. package/dist/rolldown-runtime.cjs +1 -1
  23. package/dist/toolchain-changed.cjs +25 -15
  24. package/dist/toolchain-changed.cjs.map +1 -1
  25. package/dist/toolchain-changed.mjs +27 -17
  26. package/dist/toolchain-changed.mjs.map +1 -1
  27. package/dist/toolchain-check-cli.cjs.map +1 -1
  28. package/dist/toolchain-check-cli.mjs.map +1 -1
  29. package/dist/toolchain-guard.cjs +72 -48
  30. package/dist/toolchain-guard.cjs.map +1 -1
  31. package/dist/toolchain-guard.mjs +79 -55
  32. package/dist/toolchain-guard.mjs.map +1 -1
  33. package/dist/toolchain-inputs.cjs +803 -40
  34. package/dist/toolchain-inputs.cjs.map +1 -1
  35. package/dist/toolchain-inputs.mjs +768 -41
  36. package/dist/toolchain-inputs.mjs.map +1 -1
  37. package/dist/toolchain-schema.cjs +1 -1
  38. package/dist/toolchain-schema.cjs.map +1 -1
  39. package/dist/toolchain-schema.mjs +2 -2
  40. package/dist/typecheck-parity-cli.cjs.map +1 -1
  41. package/dist/typecheck-parity-cli.mjs.map +1 -1
  42. package/dist/typecheck-parity.cjs +8 -7
  43. package/dist/typecheck-parity.cjs.map +1 -1
  44. package/dist/typecheck-parity.mjs +6 -5
  45. package/dist/typecheck-parity.mjs.map +1 -1
  46. package/dist/typecheck-probe-cli.cjs +1 -1
  47. package/dist/typecheck-probe-cli.cjs.map +1 -1
  48. package/dist/typecheck-probe-cli.mjs +1 -1
  49. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"toolchain-guard.mjs","names":["packageMetadata.version","record","record","unexpected","parseToml","record","record","record","record","record","parseToml"],"sources":["../package.json","../src/toolchain-consumer-checks.ts","../src/toolchain-images.ts","../src/toolchain-dependabot.ts","../src/toolchain-dynamic-selectors.ts","../src/toolchain-engine-floors.ts","../src/toolchain-packages.ts","../src/toolchain-rust.ts","../src/toolchain-runtime.ts","../src/toolchain-guard.ts"],"sourcesContent":["","import path from \"node:path\";\nimport { parseDocument } from \"yaml\";\n\nimport packageMetadata from \"../package.json\";\nimport {\n assertConsumerFixtureSelection,\n assertConsumerFixtureKind,\n consumerPackageClosure,\n parseConsumerFixtures,\n discoverConsumerPackages,\n} from \"./consumer-compat-config\";\nimport { assertConsumerNodeSupport } from \"./consumer-node-support\";\nimport { githubAutomationFileKind } from \"./toolchain-inputs\";\n\nexport const consumerRunnerVersion = packageMetadata.version;\n\nexport const consumerCheckWorkflow =\n \"stella/.github/.github/workflows/package-consumer-compat.yml\";\n\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst repositoryDirectory = (value: unknown): value is string =>\n typeof value === \"string\" &&\n value !== \"\" &&\n !value.includes(\"\\\\\") &&\n !value.includes(\"${{\") &&\n !value.split(\"\").some((character) => {\n const code = character.charCodeAt(0);\n return code < 32 || code === 127;\n }) &&\n !/^[A-Za-z]:/.test(value) &&\n !path.posix.isAbsolute(value) &&\n (value === \".\" ||\n value\n .split(\"/\")\n .every((part) => part !== \"\" && part !== \".\" && part !== \"..\"));\n\nconst packageDirectories = (value: unknown): value is string[] =>\n Array.isArray(value) &&\n value.length > 0 &&\n value.every(repositoryDirectory) &&\n new Set(value).size === value.length;\n\ntype CronField = {\n minimum: number;\n maximum: number;\n names?: Record<string, number>;\n};\nconst cronFields = [\n { minimum: 0, maximum: 59 },\n { minimum: 0, maximum: 23 },\n { minimum: 1, maximum: 31 },\n {\n minimum: 1,\n maximum: 12,\n names: Object.fromEntries(\n [\n \"JAN\",\n \"FEB\",\n \"MAR\",\n \"APR\",\n \"MAY\",\n \"JUN\",\n \"JUL\",\n \"AUG\",\n \"SEP\",\n \"OCT\",\n \"NOV\",\n \"DEC\",\n ].map((name, index) => [name, index + 1]),\n ),\n },\n {\n minimum: 0,\n maximum: 6,\n names: Object.fromEntries(\n [\"SUN\", \"MON\", \"TUE\", \"WED\", \"THU\", \"FRI\", \"SAT\"].map((name, index) => [\n name,\n index,\n ]),\n ),\n },\n] as const;\nconst cronFieldValues = (text: string, field: CronField) => {\n const value = (token: string) => {\n const number = /^\\d+$/.test(token)\n ? Number(token)\n : field.names?.[token.toUpperCase()];\n return number !== undefined &&\n Number.isSafeInteger(number) &&\n number >= field.minimum &&\n number <= field.maximum\n ? number\n : undefined;\n };\n const values = new Set<number>();\n for (const part of text.split(\",\")) {\n const split = part.split(\"/\");\n if (split.length > 2) return undefined;\n const [base, stepText] = split;\n const step = stepText === undefined ? 1 : Number(stepText);\n if (stepText !== undefined && !/^\\d+$/.test(stepText)) return undefined;\n if (!Number.isSafeInteger(step) || step <= 0 || base === undefined)\n return undefined;\n const bounds = base.split(\"-\");\n if (bounds.length > 2) return undefined;\n const lower = bounds.at(0);\n if (lower === undefined) return undefined;\n const start = base === \"*\" ? field.minimum : value(lower);\n const upper = bounds.at(1);\n let end = start;\n if (base === \"*\" || (bounds.length === 1 && stepText !== undefined))\n end = field.maximum;\n else if (upper !== undefined) end = value(upper);\n if (start === undefined || end === undefined || start > end)\n return undefined;\n for (let selected = start; selected <= end; selected += step)\n values.add(selected);\n }\n return values;\n};\n\nconst validConsumerCron = (text: string) => {\n const fields = text.trim().split(/\\s+/);\n return (\n fields.length === cronFields.length &&\n cronFields.every((field, index) => {\n const fieldText = fields.at(index);\n return (\n fieldText !== undefined &&\n cronFieldValues(fieldText, field) !== undefined\n );\n })\n );\n};\n\nconst nightlySchedule = (value: unknown) => {\n if (!record(value)) return false;\n const schedule = value[\"schedule\"];\n if (!Array.isArray(schedule) || schedule.length === 0) return false;\n const coveredDays = new Set<number>();\n for (const entry of schedule) {\n if (\n !record(entry) ||\n typeof entry[\"cron\"] !== \"string\" ||\n !validConsumerCron(entry[\"cron\"])\n )\n return false;\n const fields = entry[\"cron\"].trim().split(/\\s+/);\n const selections = cronFields.map((field, index) => {\n const text = fields.at(index);\n return text === undefined ? undefined : cronFieldValues(text, field);\n });\n // Month and date restrictions cannot certify a daily schedule.\n if (selections.at(2)?.size !== 31 || selections.at(3)?.size !== 12)\n continue;\n for (const day of selections.at(4) ?? []) coveredDays.add(day);\n }\n return coveredDays.size === 7;\n};\n\nexport type ConsumerCheck = {\n workflow: string;\n job: string;\n packages: string[];\n toolingVersion: string;\n fixturePath: string;\n};\n\nexport const parseConsumerChecks = (input: unknown): ConsumerCheck[] => {\n if (input === undefined) return [];\n if (!Array.isArray(input)) throw new Error(\"consumerChecks must be an array\");\n const targets = new Set<string>();\n return input.map((entry: unknown) => {\n if (\n !record(entry) ||\n Object.keys(entry).some(\n (key) =>\n ![\n \"workflow\",\n \"job\",\n \"packages\",\n \"toolingVersion\",\n \"fixturePath\",\n ].includes(key),\n ) ||\n typeof entry[\"workflow\"] !== \"string\" ||\n githubAutomationFileKind(entry[\"workflow\"]) !== \"workflow\" ||\n !/^\\.github\\/workflows\\/[^/]+\\.ya?ml$/.test(entry[\"workflow\"]) ||\n typeof entry[\"job\"] !== \"string\" ||\n !/^[A-Za-z_][A-Za-z0-9_-]*$/.test(entry[\"job\"]) ||\n !packageDirectories(entry[\"packages\"]) ||\n typeof entry[\"toolingVersion\"] !== \"string\" ||\n !/^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$/.test(\n entry[\"toolingVersion\"],\n ) ||\n !repositoryDirectory(entry[\"fixturePath\"])\n )\n throw new Error(\n \"consumerChecks requires canonical workflow, job, unique package directories, exact toolingVersion and repository-relative fixturePath\",\n );\n const target = `${entry[\"workflow\"]}:${entry[\"job\"]}`;\n if (targets.has(target))\n throw new Error(\"consumerChecks targets must be unique\");\n targets.add(target);\n return {\n workflow: entry[\"workflow\"],\n job: entry[\"job\"],\n packages: entry[\"packages\"],\n toolingVersion: entry[\"toolingVersion\"],\n fixturePath: entry[\"fixturePath\"],\n };\n });\n};\n\ntype CheckConsumerChecksOptions = {\n declarations: readonly ConsumerCheck[];\n files: Record<string, string>;\n policy: {\n consumerNode: string;\n actions: Record<string, { sha: string; version: string }>;\n };\n};\n\n/** Consumer checks are scoped declarations, never general runtime exceptions. */\nexport const checkConsumerChecks = ({\n declarations,\n files,\n policy,\n}: CheckConsumerChecksOptions) => {\n const diagnostics: {\n rule: \"configuration\";\n path: string;\n line: number;\n message: string;\n }[] = [];\n const exercised = new Set<ConsumerCheck>();\n const add = (message: string) =>\n diagnostics.push({\n rule: \"configuration\",\n path: \"stll-toolchain.json\",\n line: 1,\n message,\n });\n for (const [workflow, text] of Object.entries(files)) {\n if (githubAutomationFileKind(workflow) !== \"workflow\") continue;\n try {\n const document = parseDocument(text, { uniqueKeys: true, merge: true });\n if (document.errors.length > 0) throw new Error(\"invalid workflow YAML\");\n const source: unknown = document.toJS({ maxAliasCount: 100 });\n if (!record(source) || !record(source[\"jobs\"])) continue;\n for (const [jobName, job] of Object.entries(source[\"jobs\"])) {\n if (!record(job) || typeof job[\"uses\"] !== \"string\") continue;\n const [workflowPath, ref] = job[\"uses\"].split(\"@\");\n if (workflowPath?.toLowerCase() !== consumerCheckWorkflow) continue;\n const declaration = declarations.find(\n (entry) => entry.workflow === workflow && entry.job === jobName,\n );\n if (declaration === undefined) {\n add(`${workflow}:${jobName} requires a consumerChecks declaration`);\n continue;\n }\n if (!nightlySchedule(source[\"on\"]))\n throw new Error(\n `${workflow} consumer checks require a nonempty valid on.schedule covering every day`,\n );\n if (\"if\" in job || \"needs\" in job || \"strategy\" in job)\n throw new Error(\n `${workflow}:${jobName} consumer checks require a stand-alone unconditional reusable job without if or needs or strategy`,\n );\n exercised.add(declaration);\n const approved = Object.entries(policy.actions).find(\n ([name]) => name.toLowerCase() === consumerCheckWorkflow,\n )?.[1];\n if (\n job[\"uses\"].split(\"@\").length !== 2 ||\n ref === undefined ||\n !/^[a-f0-9]{40}$/.test(ref) ||\n approved === undefined ||\n ref !== approved.sha ||\n \"steps\" in job ||\n \"runs-on\" in job\n )\n throw new Error(\n `${workflow}:${jobName} must invoke the approved immutable consumer workflow as a reusable job`,\n );\n const inputs = job[\"with\"];\n if (!record(inputs))\n throw new Error(`${workflow}:${jobName} requires consumer inputs`);\n const names = new Set<string>();\n for (const key of Object.keys(inputs)) {\n const normalized = key.toLowerCase();\n if (\n names.has(normalized) ||\n ![\n \"packages\",\n \"consumer-node\",\n \"tooling-version\",\n \"fixture-path\",\n ].includes(normalized) ||\n normalized !== key\n )\n throw new Error(\n `${workflow}:${jobName} requires unique canonical consumer input names`,\n );\n names.add(normalized);\n }\n if (inputs[\"consumer-node\"] !== policy.consumerNode)\n throw new Error(\n `${workflow}:${jobName} consumer-node must be ${policy.consumerNode}`,\n );\n if (declaration.toolingVersion !== consumerRunnerVersion)\n throw new Error(\n `${workflow}:${jobName} toolingVersion must match installed @stll/oxlint-config ${consumerRunnerVersion}`,\n );\n if (inputs[\"tooling-version\"] !== declaration.toolingVersion)\n throw new Error(\n `${workflow}:${jobName} tooling-version must match consumerChecks.toolingVersion`,\n );\n if (inputs[\"fixture-path\"] !== declaration.fixturePath)\n throw new Error(\n `${workflow}:${jobName} fixture-path must match consumerChecks.fixturePath`,\n );\n const fixtureManifest = path.posix.join(\n declaration.fixturePath,\n \"consumer-compat.json\",\n );\n const fixtureSource = files[fixtureManifest];\n if (fixtureSource === undefined)\n throw new Error(\n `consumerChecks fixture configuration must be tracked: ${fixtureManifest}`,\n );\n const fixtureConfiguration: unknown = JSON.parse(fixtureSource);\n const fixtures = parseConsumerFixtures(fixtureConfiguration);\n assertConsumerFixtureSelection({\n selected: declaration.packages,\n fixtures,\n });\n const rawPackages = inputs[\"packages\"];\n if (typeof rawPackages !== \"string\")\n throw new Error(\n `${workflow}:${jobName} packages must be a static JSON array`,\n );\n const selected: unknown = JSON.parse(rawPackages);\n if (\n !packageDirectories(selected) ||\n selected.length !== declaration.packages.length ||\n !selected.every((directory) =>\n declaration.packages.includes(directory),\n )\n )\n throw new Error(\n `${workflow}:${jobName} packages must exactly match consumerChecks`,\n );\n const workspacePackages = discoverConsumerPackages(files);\n const packagesByDirectory = new Map(\n [...workspacePackages.values()].map((entry) => [\n entry.directory,\n entry,\n ]),\n );\n for (const directory of declaration.packages) {\n const manifestPath = path.posix.join(directory, \"package.json\");\n const manifestText = files[manifestPath];\n if (manifestText === undefined)\n throw new Error(\n `consumerChecks package manifest must be tracked: ${manifestPath}`,\n );\n const selectedPackage = packagesByDirectory.get(directory);\n if (selectedPackage === undefined)\n throw new Error(\n `consumerChecks package must be a discovered workspace member: ${manifestPath}`,\n );\n const fixture = fixtures.find(\n (candidate) => candidate.package === directory,\n );\n if (fixture === undefined)\n throw new Error(`missing declared consumer fixture: ${directory}`);\n assertConsumerFixtureKind({ fixture, pkg: selectedPackage });\n const manifest = selectedPackage.manifest;\n if (\n manifest[\"private\"] === true ||\n typeof manifest[\"name\"] !== \"string\" ||\n manifest[\"name\"].trim() === \"\"\n )\n throw new Error(\n `consumerChecks requires a named published package: ${manifestPath}`,\n );\n const closure = consumerPackageClosure({\n selected: selectedPackage,\n packages: workspacePackages,\n files,\n });\n for (const member of closure.values())\n assertConsumerNodeSupport({\n manifest: member.manifest,\n node: policy.consumerNode,\n label: path.posix.join(member.directory, \"package.json\"),\n });\n }\n }\n } catch (error) {\n if (\n declarations.some((entry) => entry.workflow === workflow) ||\n text.toLowerCase().includes(consumerCheckWorkflow)\n )\n add(error instanceof Error ? error.message : String(error));\n }\n }\n for (const declaration of declarations)\n if (!exercised.has(declaration))\n add(\n `${declaration.workflow}:${declaration.job} consumerChecks declaration has no matching reusable invocation`,\n );\n return diagnostics;\n};\n","/** Docker Hub spellings accepted by the shared runtime policy. */\nexport const dockerHubRegistries = [\n \"docker.io\",\n \"index.docker.io\",\n \"registry-1.docker.io\",\n] as const;\n\n/** Expand the full accepted repository alias class without parsing Dockerfile instructions. */\nexport const ownedDockerImageAliases = (images: readonly string[]) => {\n const aliases = new Set<string>();\n for (const image of images) {\n for (const repository of [image, `library/${image}`]) {\n aliases.add(repository);\n for (const registry of dockerHubRegistries)\n aliases.add(`${registry}/${repository}`);\n }\n }\n return [...aliases].sort();\n};\n\n/** Preserve tag/digest spelling while normalizing registry and namespace aliases. */\nexport const canonicalDockerRuntime = (image: string) => {\n const registry = dockerHubRegistries.find((entry) =>\n image.toLowerCase().startsWith(`${entry}/`),\n );\n const repository =\n registry === undefined ? image : image.slice(registry.length + 1);\n return repository.replace(/^library\\//i, \"\");\n};\n\n/** Preserve Rust release identity across official Debian slim and Alpine variants. */\nexport const rustImageVersion = (tag: string) =>\n tag.replace(\n /-(?:alpine(?:\\d+(?:\\.\\d+)*)?|(?:bookworm|bullseye|trixie|buster)(?:-slim)?|slim(?:-(?:bookworm|bullseye|trixie|buster))?)$/,\n \"\",\n );\n","import path from \"node:path\";\nimport picomatch from \"picomatch\";\nimport { parse as parseToml } from \"smol-toml\";\nimport {\n isNode,\n LineCounter,\n parseAllDocuments,\n parseDocument,\n Scalar,\n stringify,\n} from \"yaml\";\n\nimport {\n containerDocumentImages,\n isComposeDefinitionPath,\n isKubernetesDefinitionPath,\n} from \"./toolchain-container-inputs\";\nimport { ownedDockerImageAliases } from \"./toolchain-images\";\nimport {\n isDependabotGithubActionsPath,\n isDockerDefinitionPath,\n pythonDependencyManifestKind,\n isPythonDependencyManifest,\n javascriptDependencyLockfiles,\n} from \"./toolchain-inputs\";\nimport { workspaceContains } from \"./toolchain-workspaces\";\n\nexport const dependabotRules = [\"dependabot-policy\"] as const;\n\ntype DependabotPolicy = {\n schedule: { interval: string; day: string; time: string; timezone: string };\n cooldown: { defaultDays: number };\n groups: Record<\n string,\n { patterns: readonly string[]; updateTypes: readonly string[] }\n >;\n ignoredPackages: readonly string[];\n ignoredActions: readonly string[];\n ignoredImages: readonly string[];\n};\n\ntype Diagnostic = {\n rule: (typeof dependabotRules)[number];\n path: string;\n line: number;\n message: string;\n};\n\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst strings = (value: unknown): value is string[] =>\n Array.isArray(value) &&\n value.every((entry: unknown) => typeof entry === \"string\");\n\nconst sameStrings = (value: unknown, expected: readonly string[]) => {\n if (!strings(value) || value.length !== expected.length) return false;\n const sortedExpected = [...expected].sort();\n return [...value]\n .sort()\n .every((entry, index) => entry === sortedExpected[index]);\n};\n\nconst pinnedVersionUpdateTypes = [\n \"version-update:semver-major\",\n \"version-update:semver-minor\",\n \"version-update:semver-patch\",\n];\n\nconst versionOnlyIgnore = (entry: unknown) =>\n record(entry) &&\n Object.keys(entry).length === 2 &&\n typeof entry[\"dependency-name\"] === \"string\" &&\n sameStrings(entry[\"update-types\"], pinnedVersionUpdateTypes);\n\nconst directoryOf = (file: string) => {\n const directory = path.posix.dirname(file);\n return directory === \".\" ? \"/\" : `/${directory}`;\n};\n\nconst workspaceManifests = {\n npm: \"package.json\",\n cargo: \"Cargo.toml\",\n uv: \"pyproject.toml\",\n} as const;\n\nconst workspaceTable = (\n parsed: Record<string, unknown>,\n ecosystem: keyof typeof workspaceManifests,\n) => {\n switch (ecosystem) {\n case \"npm\":\n return parsed[\"workspaces\"];\n case \"cargo\":\n return parsed[\"workspace\"];\n case \"uv\": {\n const tool = parsed[\"tool\"];\n const uv = record(tool) ? tool[\"uv\"] : undefined;\n return record(uv) ? uv[\"workspace\"] : undefined;\n }\n default: {\n const unexpected: never = ecosystem;\n throw new Error(\"unknown workspace ecosystem\", { cause: unexpected });\n }\n }\n};\n\n/** Installable workspace members share their update root; own-lock projects stay discoverable. */\nconst workspaceRoots = (\n files: Record<string, string>,\n ecosystem: keyof typeof workspaceManifests,\n) => {\n const manifests = Object.keys(files).filter(\n (file) =>\n path.posix.basename(file) === workspaceManifests[ecosystem] ||\n (ecosystem === \"npm\" &&\n path.posix.basename(file) === \"pnpm-workspace.yaml\"),\n );\n const workspaces = new Map<string, string[]>();\n const npmWorkspaceErrors = new Map<string, Error>();\n for (const file of manifests) {\n if (ecosystem === \"npm\") {\n const directory = path.posix.dirname(file);\n const workspaceFile = path.posix.join(directory, \"pnpm-workspace.yaml\");\n const text = files[workspaceFile];\n if (text !== undefined) {\n try {\n const document = parseDocument(text);\n if (document.errors.length > 0)\n throw new Error(`${workspaceFile}:1: invalid pnpm workspace YAML`);\n const parsed: unknown = document.toJS({ maxAliasCount: 100 });\n if (!record(parsed))\n throw new Error(\n `${workspaceFile}:1: pnpm workspace must contain an object`,\n );\n const patterns = parsed[\"packages\"] ?? [];\n if (!strings(patterns))\n throw new Error(\n `${workspaceFile}:1: pnpm packages must be a string array`,\n );\n workspaces.set(\n directory,\n patterns.map((pattern) =>\n pattern.startsWith(\"!\")\n ? `!${path.posix.normalize(pattern.slice(1))}`\n : path.posix.normalize(pattern),\n ),\n );\n } catch (error) {\n npmWorkspaceErrors.set(\n directory,\n error instanceof Error ? error : new Error(String(error)),\n );\n }\n continue;\n }\n }\n try {\n const parsed: unknown =\n ecosystem === \"npm\"\n ? JSON.parse(files[file] ?? \"\")\n : parseToml(files[file] ?? \"\");\n if (!record(parsed)) continue;\n if (\n ecosystem === \"npm\" &&\n typeof parsed[\"packageManager\"] === \"string\" &&\n parsed[\"packageManager\"].startsWith(\"pnpm@\")\n )\n continue;\n const value = workspaceTable(parsed, ecosystem);\n const patterns = record(value)\n ? value[ecosystem === \"npm\" ? \"packages\" : \"members\"]\n : value;\n const members =\n ecosystem === \"cargo\" && record(value) && patterns === undefined\n ? []\n : patterns;\n if (strings(members)) {\n const excluded =\n ecosystem !== \"npm\" && record(value) && strings(value[\"exclude\"])\n ? value[\"exclude\"].map((pattern) => `!${pattern}`)\n : [];\n workspaces.set(path.posix.dirname(file), [...members, ...excluded]);\n }\n } catch {\n // Other toolchain rules validate manifests; retain the update root here.\n }\n }\n const implicitCargoMembers = new Map<string, Set<string>>();\n const declaredMember = (\n root: string,\n patterns: string[],\n directory: string,\n ) => {\n const relative = path.posix.relative(root, directory);\n if (relative === \"\" || relative === \"..\" || relative.startsWith(\"../\"))\n return false;\n return workspaceContains({\n directory: root,\n file: path.posix.join(directory, \"package.json\"),\n patterns,\n rootMembership: \"patterns\",\n });\n };\n const installable = new Set([\".\"]);\n if (ecosystem === \"npm\") {\n for (const file of manifests) {\n const directory = path.posix.dirname(file);\n if (\n javascriptDependencyLockfiles.some(\n (name) => files[path.posix.join(directory, name)] !== undefined,\n )\n )\n installable.add(directory);\n }\n let changed = true;\n while (changed) {\n changed = false;\n for (const [root, patterns] of workspaces) {\n if (!installable.has(root)) continue;\n for (const file of manifests) {\n const directory = path.posix.dirname(file);\n if (\n installable.has(directory) ||\n !declaredMember(root, patterns, directory)\n )\n continue;\n installable.add(directory);\n changed = true;\n }\n }\n }\n }\n if (ecosystem === \"npm\") {\n for (const [directory, error] of npmWorkspaceErrors)\n if (installable.has(directory)) throw error;\n }\n if (ecosystem === \"cargo\") {\n for (const [root, patterns] of workspaces) {\n const includes = patterns.filter((pattern) => !pattern.startsWith(\"!\"));\n const excludes = patterns.filter((pattern) => pattern.startsWith(\"!\"));\n const memberDirectories = new Set([root]);\n for (const file of manifests) {\n const directory = path.posix.dirname(file);\n const relative = path.posix.relative(root, directory);\n if (\n includes.some((pattern) => picomatch.isMatch(relative, pattern)) &&\n !excludes.some((pattern) =>\n picomatch.isMatch(relative, pattern.slice(1)),\n )\n )\n memberDirectories.add(directory);\n }\n for (const directory of memberDirectories) {\n try {\n const parsed = parseToml(\n files[path.posix.join(directory, \"Cargo.toml\")] ?? \"\",\n );\n const rootParsed = parseToml(\n files[path.posix.join(root, \"Cargo.toml\")] ?? \"\",\n );\n const workspace = rootParsed[\"workspace\"];\n const inherited = record(workspace)\n ? workspace[\"dependencies\"]\n : undefined;\n const dependencyOwners = [parsed];\n const targets = parsed[\"target\"];\n if (record(targets)) {\n for (const target of Object.values(targets))\n if (record(target)) dependencyOwners.push(target);\n }\n for (const owner of dependencyOwners) {\n for (const key of [\n \"dependencies\",\n \"dev-dependencies\",\n \"build-dependencies\",\n ]) {\n const dependencies = owner[key];\n if (!record(dependencies)) continue;\n for (const [name, dependency] of Object.entries(dependencies)) {\n if (!record(dependency)) continue;\n const isInherited = dependency[\"workspace\"] === true;\n const resolved =\n isInherited && record(inherited)\n ? inherited[name]\n : dependency;\n if (!record(resolved) || typeof resolved[\"path\"] !== \"string\")\n continue;\n if (\n path.posix.isAbsolute(resolved[\"path\"]) ||\n /\\\\|\\$|^[A-Za-z]:/.test(resolved[\"path\"])\n )\n continue;\n const target = path.posix.normalize(\n path.posix.join(\n isInherited ? root : directory,\n resolved[\"path\"],\n ),\n );\n const relative = path.posix.relative(root, target);\n if (\n relative.startsWith(\"../\") ||\n relative === \"..\" ||\n files[path.posix.join(target, \"Cargo.toml\")] === undefined ||\n excludes.some((pattern) =>\n picomatch.isMatch(relative, pattern.slice(1)),\n )\n )\n continue;\n memberDirectories.add(target);\n }\n }\n }\n } catch {\n // Manifest validation diagnoses malformed TOML independently.\n }\n }\n implicitCargoMembers.set(root, memberDirectories);\n }\n }\n return manifests\n .filter(\n (file) =>\n ecosystem !== \"npm\" || installable.has(path.posix.dirname(file)),\n )\n .filter((file) => {\n const directory = path.posix.dirname(file);\n return ![...workspaces].some(([root, patterns]) => {\n if (ecosystem === \"npm\" && !installable.has(root)) return false;\n const relative = path.posix.relative(root, directory);\n if (relative === \"\" || relative.startsWith(\"../\")) return false;\n const includes = patterns.filter((pattern) => !pattern.startsWith(\"!\"));\n const excludes = patterns.filter((pattern) => pattern.startsWith(\"!\"));\n return (\n (implicitCargoMembers.get(root)?.has(directory) === true ||\n (ecosystem === \"npm\"\n ? declaredMember(root, patterns, directory)\n : includes.some((pattern) =>\n picomatch.isMatch(relative, pattern),\n ))) &&\n !excludes.some((pattern) =>\n picomatch.isMatch(relative, pattern.slice(1)),\n )\n );\n });\n })\n .map(directoryOf)\n .filter((directory, index, values) => values.indexOf(directory) === index);\n};\n\ntype CheckDependabotOptions = {\n files: Record<string, string>;\n policy: DependabotPolicy;\n};\n\nconst javascriptEcosystem = (\n directory: string,\n files: Record<string, string>,\n) => {\n const root = directory === \"/\" ? \".\" : directory.slice(1);\n if (files[path.posix.join(root, \"bun.lock\")] !== undefined) return \"bun\";\n try {\n const manifest: unknown = JSON.parse(\n files[path.posix.join(root, \"package.json\")] ?? \"{}\",\n );\n if (\n record(manifest) &&\n typeof manifest[\"packageManager\"] === \"string\" &&\n manifest[\"packageManager\"].startsWith(\"bun@\")\n )\n return \"bun\";\n } catch {\n // Package rules diagnose malformed JSON; the root still needs update coverage.\n }\n return \"npm\";\n};\n\nconst pythonEcosystem = (file: string, files: Record<string, string>) => {\n const manifestKind = pythonDependencyManifestKind(file);\n if (\n manifestKind === \"pipfile\" ||\n manifestKind === \"pipfile-lock\" ||\n manifestKind === \"setup\"\n )\n return \"pip\";\n const root = path.posix.dirname(file);\n if (\n files[path.posix.join(root, \"uv.lock\")] !== undefined ||\n files[path.posix.join(root, \"uv.toml\")] !== undefined\n )\n return \"uv\";\n const pyproject = files[path.posix.join(root, \"pyproject.toml\")];\n if (pyproject !== undefined) {\n try {\n const parsed = parseToml(pyproject);\n const tool = parsed[\"tool\"];\n if (record(tool) && record(tool[\"uv\"])) return \"uv\";\n } catch {\n // Runtime rules diagnose malformed TOML; retain its update coverage.\n }\n }\n return \"pip\";\n};\n\nconst ecosystemRoots = (files: Record<string, string>) => {\n const roots = new Map<string, Set<string>>();\n const requireRoot = (ecosystem: string, directory: string) => {\n const directories = roots.get(ecosystem) ?? new Set<string>();\n directories.add(directory);\n roots.set(ecosystem, directories);\n };\n for (const directory of workspaceRoots(files, \"npm\"))\n requireRoot(javascriptEcosystem(directory, files), directory);\n for (const directory of workspaceRoots(files, \"cargo\"))\n requireRoot(\"cargo\", directory);\n for (const directory of workspaceRoots(files, \"uv\")) {\n const root = directory === \"/\" ? \".\" : directory.slice(1);\n requireRoot(\n pythonEcosystem(path.posix.join(root, \"pyproject.toml\"), files),\n directory,\n );\n }\n for (const file of Object.keys(files)) {\n if (isDependabotGithubActionsPath(file)) requireRoot(\"github-actions\", \"/\");\n const name = path.posix.basename(file);\n if (isDockerDefinitionPath(file)) requireRoot(\"docker\", directoryOf(file));\n if (isComposeDefinitionPath(file) || isKubernetesDefinitionPath(file)) {\n for (const document of parseAllDocuments(files[file] ?? \"\", {\n merge: true,\n })) {\n if (document.errors.length > 0) continue;\n try {\n const classified = containerDocumentImages(\n document.toJS({ maxAliasCount: 100 }),\n file,\n );\n if (classified !== undefined)\n requireRoot(classified.ecosystem, directoryOf(file));\n } catch {\n // Runtime validation reports malformed or excessive YAML aliases.\n }\n }\n }\n if (\n name === \"uv.lock\" ||\n name === \"uv.toml\" ||\n (name !== \"pyproject.toml\" && isPythonDependencyManifest(file))\n )\n requireRoot(pythonEcosystem(file, files), directoryOf(file));\n }\n return roots;\n};\n\nconst ignoredFor = (ecosystem: string, policy: DependabotPolicy) => {\n if (ecosystem === \"npm\" || ecosystem === \"bun\") return policy.ignoredPackages;\n if (ecosystem === \"github-actions\") return policy.ignoredActions;\n if (ecosystem === \"docker\" || ecosystem === \"docker-compose\")\n return ownedDockerImageAliases(policy.ignoredImages);\n return [];\n};\n\n/** Generate canonical YAML from the same ecosystem enumeration used by the guard. */\nexport const generateDependabotConfig = ({\n files,\n policy,\n}: CheckDependabotOptions) => {\n const updates = [...ecosystemRoots(files)]\n .sort(([left], [right]) => left.localeCompare(right))\n .map(([ecosystem, roots]) => {\n const directories = [...roots].sort();\n const ignored = ignoredFor(ecosystem, policy);\n const time = new Scalar(policy.schedule.time);\n time.type = Scalar.QUOTE_DOUBLE;\n return {\n \"package-ecosystem\": ecosystem,\n directory: directories.length === 1 ? directories.at(0) : undefined,\n directories: directories.length > 1 ? directories : undefined,\n schedule: {\n interval: policy.schedule.interval,\n day: policy.schedule.day,\n time,\n timezone: policy.schedule.timezone,\n },\n cooldown: { \"default-days\": policy.cooldown.defaultDays },\n groups: Object.fromEntries(\n Object.entries(policy.groups).map(([name, group]) => [\n name,\n { patterns: group.patterns, \"update-types\": group.updateTypes },\n ]),\n ),\n ignore:\n ignored.length > 0\n ? ignored.map((name) => ({\n \"dependency-name\": name,\n \"update-types\": pinnedVersionUpdateTypes,\n }))\n : undefined,\n };\n });\n return stringify({ version: 2, updates }, { aliasDuplicateObjects: false });\n};\n\n/** Validate the shared update policy against a hermetic tracked-file snapshot. */\nexport const checkDependabot = ({\n files,\n policy,\n}: CheckDependabotOptions): Diagnostic[] => {\n const roots = ecosystemRoots(files);\n const paths = [\".github/dependabot.yml\", \".github/dependabot.yaml\"].filter(\n (file) => files[file] !== undefined,\n );\n if (roots.size === 0 && paths.length === 0) return [];\n const file = paths.at(0) ?? \".github/dependabot.yml\";\n const diagnostics: Diagnostic[] = [];\n const add = (message: string, line = 1) => {\n diagnostics.push({ rule: \"dependabot-policy\", path: file, line, message });\n };\n if (paths.length === 0) {\n add(\n \"add a Dependabot configuration for the repository's package ecosystems\",\n );\n return diagnostics;\n }\n if (paths.length > 1) add(\"keep one Dependabot configuration file\");\n const lineCounter = new LineCounter();\n const document = parseDocument(files[file] ?? \"\", {\n lineCounter,\n });\n if (document.errors.length > 0) {\n for (const error of document.errors)\n add(\n `invalid Dependabot YAML: ${error.message}`,\n lineCounter.linePos(error.pos[0]).line,\n );\n return diagnostics;\n }\n let parsed: unknown;\n try {\n parsed = document.toJS({ maxAliasCount: 100 });\n } catch {\n add(\"cannot resolve Dependabot YAML aliases\");\n return diagnostics;\n }\n if (\n !record(parsed) ||\n parsed[\"version\"] !== 2 ||\n !Array.isArray(parsed[\"updates\"])\n ) {\n add(\"Dependabot must declare version: 2 and an updates array\");\n return diagnostics;\n }\n const covered = new Map<string, Set<string>>();\n let legacy: unknown;\n try {\n const legacyDocument = parseDocument(files[file] ?? \"\", {\n version: \"1.1\",\n schema: \"yaml-1.1\",\n });\n if (legacyDocument.errors.length === 0)\n legacy = legacyDocument.toJS({ maxAliasCount: 100 });\n } catch {\n // The canonical parser reports invalid aliases; incompatible times fail below.\n }\n const legacyUpdates =\n record(legacy) && Array.isArray(legacy[\"updates\"]) ? legacy[\"updates\"] : [];\n const rootClaims = new Map<string, Map<string, number>>();\n const directoryClaims = new Map<string, Map<string, number>>();\n for (const [index, update] of parsed[\"updates\"].entries()) {\n const lineOf = (key: string) => {\n const node: unknown = document.getIn([\"updates\", index, key], true);\n const offset = isNode(node) ? node.range?.[0] : undefined;\n return offset === undefined ? 1 : lineCounter.linePos(offset).line;\n };\n const report = (key: string, message: string) => add(message, lineOf(key));\n if (!record(update) || typeof update[\"package-ecosystem\"] !== \"string\") {\n report(\n \"package-ecosystem\",\n \"each Dependabot update must declare a package ecosystem\",\n );\n continue;\n }\n const ecosystem = update[\"package-ecosystem\"];\n if (update[\"target-branch\"] !== undefined)\n report(\n \"target-branch\",\n `${ecosystem}: shared updates must target the default branch`,\n );\n if (update[\"open-pull-requests-limit\"] === 0)\n report(\n \"open-pull-requests-limit\",\n `${ecosystem}: version updates must remain enabled`,\n );\n const single = update[\"directory\"];\n const multiple = update[\"directories\"];\n let directories: string[] = [];\n if (typeof single === \"string\" && multiple === undefined)\n directories = [single];\n else if (single === undefined && strings(multiple)) directories = multiple;\n const validDirectories = directories.filter(\n (directory) =>\n directory.startsWith(\"/\") && !directory.split(\"/\").includes(\"..\"),\n );\n if (\n directories.length === 0 ||\n validDirectories.length !== directories.length\n ) {\n report(\n \"directory\",\n `${ecosystem}: declare directory or nonempty directories with absolute repository paths`,\n );\n }\n const normalizedDirectories = Array.from(\n new Set(\n validDirectories.map(\n (value) => path.posix.normalize(value).replace(/\\/+$/, \"\") || \"/\",\n ),\n ),\n );\n const matches = covered.get(ecosystem) ?? new Set<string>();\n const claimedDirectories =\n directoryClaims.get(ecosystem) ?? new Map<string, number>();\n for (const directory of normalizedDirectories) {\n const previous = claimedDirectories.get(directory);\n if (previous !== undefined)\n report(\n multiple === undefined ? \"directory\" : \"directories\",\n `${ecosystem}: directory ${directory} overlaps update entry ${previous + 1}`,\n );\n else claimedDirectories.set(directory, index);\n }\n directoryClaims.set(ecosystem, claimedDirectories);\n const claimedRoots = rootClaims.get(ecosystem) ?? new Map<string, number>();\n for (const root of roots.get(ecosystem) ?? []) {\n if (\n normalizedDirectories.some(\n (directory) =>\n directory === root ||\n (multiple !== undefined && picomatch.isMatch(root, directory)),\n )\n ) {\n const previous = claimedRoots.get(root);\n if (previous !== undefined)\n report(\n multiple === undefined ? \"directory\" : \"directories\",\n `${ecosystem}: update root ${root} overlaps update entry ${previous + 1}`,\n );\n else claimedRoots.set(root, index);\n matches.add(root);\n }\n }\n rootClaims.set(ecosystem, claimedRoots);\n covered.set(ecosystem, matches);\n const schedule = update[\"schedule\"];\n const legacyUpdate: unknown = legacyUpdates.at(index);\n const legacySchedule = record(legacyUpdate)\n ? legacyUpdate[\"schedule\"]\n : undefined;\n if (\n record(schedule) &&\n schedule[\"time\"] === policy.schedule.time &&\n (!record(legacySchedule) ||\n legacySchedule[\"time\"] !== policy.schedule.time)\n )\n report(\n \"schedule\",\n `${ecosystem}: quote schedule time to preserve its string value in YAML 1.1`,\n );\n if (\n !record(schedule) ||\n Object.keys(schedule).length !== Object.keys(policy.schedule).length ||\n Object.entries(policy.schedule).some(\n ([key, value]) => schedule[key] !== value,\n )\n )\n report(\"schedule\", `${ecosystem}: schedule must match the shared policy`);\n const cooldown = update[\"cooldown\"];\n if (\n !record(cooldown) ||\n Object.keys(cooldown).length !== 1 ||\n cooldown[\"default-days\"] !== policy.cooldown.defaultDays\n )\n report(\n \"cooldown\",\n `${ecosystem}: cooldown must contain only default-days: ${policy.cooldown.defaultDays}`,\n );\n const groups = update[\"groups\"];\n if (\n !record(groups) ||\n Object.keys(groups).length !== Object.keys(policy.groups).length ||\n Object.entries(policy.groups).some(([name, expected]) => {\n const group = groups[name];\n return (\n !record(group) ||\n Object.keys(group).length !== 2 ||\n !sameStrings(group[\"patterns\"], expected.patterns) ||\n !sameStrings(group[\"update-types\"], expected.updateTypes)\n );\n })\n )\n report(\"groups\", `${ecosystem}: groups must match the shared policy`);\n const ignored = ignoredFor(ecosystem, policy);\n const ignore = update[\"ignore\"];\n if (ignore !== undefined && (!Array.isArray(ignore) || ignore.length === 0))\n report(\"ignore\", `${ecosystem}: omit ignore or provide a nonempty array`);\n if (\n Array.isArray(ignore) &&\n ignore.some(\n (entry: unknown) =>\n !record(entry) ||\n typeof entry[\"dependency-name\"] !== \"string\" ||\n !ignored.includes(entry[\"dependency-name\"]),\n )\n )\n report(\n \"ignore\",\n `${ecosystem}: ignore only packages owned by the shared policy`,\n );\n if (\n Array.isArray(ignore) &&\n ignore.some((entry: unknown) => !versionOnlyIgnore(entry))\n )\n report(\n \"ignore\",\n `${ecosystem}: each shared-pin ignore must contain only dependency-name and update-types for semver-major, semver-minor, and semver-patch version updates; security updates must remain enabled`,\n );\n for (const name of ignored) {\n if (\n !Array.isArray(ignore) ||\n !ignore.some(\n (entry: unknown) =>\n record(entry) &&\n entry[\"dependency-name\"] === name &&\n versionOnlyIgnore(entry),\n )\n )\n report(\n \"ignore\",\n `${ecosystem}: ignore all version updates for shared pin ${name}`,\n );\n }\n }\n for (const [ecosystem, directories] of roots) {\n for (const directory of directories) {\n if (!covered.get(ecosystem)?.has(directory))\n add(`add a ${ecosystem} update entry covering ${directory}`);\n }\n }\n return diagnostics;\n};\n","const locatorValidators = {\n image:\n /^(?:jobs\\.[\\w-]+\\.(?:container|services\\.[\\w-]+)|services\\.[\\w.-]+\\.image)$/,\n \"bun-source\": /^(?:jobs\\.[\\w-]+|runs)\\.steps\\.[\\w-]+$/,\n} as const;\n\ntype SelectorKind = keyof typeof locatorValidators;\nconst knownKind = (value: unknown): value is SelectorKind =>\n typeof value === \"string\" && Object.hasOwn(locatorValidators, value);\n\nexport type DynamicSelector = {\n path: string;\n kind: SelectorKind;\n reason: string;\n} & ({ at: string; line?: never } | { line: number; at?: never });\n\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\n/** One reviewed declaration identifies one unresolved selector, never a rule. */\nexport const parseDynamicSelectors = (input: unknown): DynamicSelector[] => {\n if (input === undefined) return [];\n if (!Array.isArray(input))\n throw new Error(\"dynamicSelectors must be an array\");\n const result: DynamicSelector[] = [];\n const keys = new Set<string>();\n for (const entry of input) {\n if (\n !record(entry) ||\n Object.keys(entry).some(\n (key) => ![\"path\", \"kind\", \"reason\", \"at\", \"line\"].includes(key),\n ) ||\n typeof entry[\"path\"] !== \"string\" ||\n entry[\"path\"] === \"\" ||\n /[\\\\:$*?]|[^\\S ]/.test(entry[\"path\"]) ||\n entry[\"path\"]\n .split(\"/\")\n .some((part) => part === \"\" || part === \".\" || part === \"..\") ||\n typeof entry[\"reason\"] !== \"string\" ||\n entry[\"reason\"].trim() === \"\"\n )\n throw new Error(\n \"each dynamic selector requires an exact repository path, known kind and nonempty reason\",\n );\n const kind = entry[\"kind\"];\n if (!knownKind(kind)) throw new Error(\"unknown dynamic selector kind\");\n let selector: DynamicSelector;\n if (\n Object.hasOwn(entry, \"line\") &&\n !Object.hasOwn(entry, \"at\") &&\n typeof entry[\"line\"] === \"number\" &&\n Number.isSafeInteger(entry[\"line\"]) &&\n entry[\"line\"] > 0\n ) {\n selector = {\n path: entry[\"path\"],\n kind,\n reason: entry[\"reason\"],\n line: entry[\"line\"],\n };\n } else if (\n !Object.hasOwn(entry, \"line\") &&\n typeof entry[\"at\"] === \"string\" &&\n locatorValidators[kind].test(entry[\"at\"])\n ) {\n selector = {\n path: entry[\"path\"],\n kind,\n reason: entry[\"reason\"],\n at: entry[\"at\"],\n };\n } else\n throw new Error(\n \"dynamic selector requires one positive line or a kind-specific job/service/step ID locator\",\n );\n const key = JSON.stringify([\n selector.path,\n selector.kind,\n selector.at ?? selector.line,\n ]);\n if (keys.has(key))\n throw new Error(\"dynamic selector locations must be unique\");\n keys.add(key);\n result.push(selector);\n }\n return result;\n};\n","import path from \"node:path\";\nimport { minVersion, satisfies, valid, validRange } from \"semver\";\nimport { parseDocument } from \"yaml\";\n\nexport type EngineFloor = { package: string; workflow: string; job: string };\nexport type ResolvedEngineFloor = EngineFloor & {\n range: string;\n major: number;\n};\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\nconst repositoryPath = (value: unknown): value is string =>\n typeof value === \"string\" &&\n value !== \"\" &&\n !/^[A-Za-z]:/.test(value) &&\n !/[\\\\\\s]/.test(value) &&\n !Array.from(value).some((character) => character.charCodeAt(0) < 32) &&\n value\n .split(\"/\")\n .every((part) => part !== \"\" && part !== \".\" && part !== \"..\");\n\nexport const parseEngineFloors = (input: unknown): EngineFloor[] => {\n if (input === undefined) return [];\n if (!Array.isArray(input)) throw new Error(\"engineFloors must be an array\");\n const result: EngineFloor[] = [];\n const jobs = new Set<string>();\n for (const entry of input) {\n if (\n !record(entry) ||\n Object.keys(entry).some(\n (key) => ![\"package\", \"workflow\", \"job\"].includes(key),\n ) ||\n (entry[\"package\"] !== \".\" && !repositoryPath(entry[\"package\"])) ||\n !repositoryPath(entry[\"workflow\"]) ||\n !/^\\.github\\/workflows\\/[^/]+\\.ya?ml$/.test(entry[\"workflow\"]) ||\n typeof entry[\"job\"] !== \"string\" ||\n entry[\"job\"].trim() === \"\"\n )\n throw new Error(\n \"each engine floor requires a repository package directory, workflow path and job\",\n );\n const key = `${entry[\"workflow\"]}:${entry[\"job\"]}`;\n if (jobs.has(key))\n throw new Error(\"engine floor workflow jobs must be unique\");\n jobs.add(key);\n result.push({\n package: entry[\"package\"],\n workflow: entry[\"workflow\"],\n job: entry[\"job\"],\n });\n }\n return result;\n};\n\nexport const resolveEngineFloor = (\n entry: EngineFloor,\n files: Record<string, string>,\n): ResolvedEngineFloor => {\n const manifestText = files[path.posix.join(entry.package, \"package.json\")];\n const workflowText = files[entry.workflow];\n if (manifestText === undefined || workflowText === undefined)\n throw new Error(\"engine floor package and workflow must be tracked\");\n const manifest: unknown = JSON.parse(manifestText);\n if (\n !record(manifest) ||\n manifest[\"private\"] === true ||\n typeof manifest[\"name\"] !== \"string\" ||\n manifest[\"name\"].trim() === \"\" ||\n !record(manifest[\"engines\"]) ||\n typeof manifest[\"engines\"][\"node\"] !== \"string\"\n )\n throw new Error(\n \"engine floor package must be published and declare engines.node\",\n );\n const range = manifest[\"engines\"][\"node\"];\n const minimum = validRange(range) === null ? null : minVersion(range);\n if (minimum === null || minimum.prerelease.length !== 0)\n throw new Error(\"engine floor engines.node must declare a stable minimum\");\n const document = parseDocument(workflowText, { merge: true });\n if (document.errors.length !== 0)\n throw new Error(\"engine floor workflow must be valid YAML\");\n const workflow: unknown = document.toJS({ maxAliasCount: 100 });\n if (!record(workflow) || !record(workflow[\"jobs\"]))\n throw new Error(\"engine floor job must exist in its tracked workflow\");\n const job = workflow[\"jobs\"][entry.job];\n if (!record(job))\n throw new Error(\"engine floor job must exist in its tracked workflow\");\n if (!Array.isArray(job[\"steps\"]) || Object.hasOwn(job, \"uses\"))\n throw new Error(\n \"engine floor job must declare steps and cannot reuse a workflow\",\n );\n return { ...entry, range, major: minimum.major };\n};\n\nexport const engineFloorSelectorMatches = (\n value: unknown,\n floor: ResolvedEngineFloor,\n) => {\n if (\n typeof value !== \"string\" ||\n !/^\\d+\\.\\d+\\.\\d+$/.test(value) ||\n valid(value) !== value\n )\n return false;\n return (\n Number(value.split(\".\").at(0)) === floor.major &&\n satisfies(value, floor.range)\n );\n};\n","import path from \"node:path\";\nimport picomatch from \"picomatch\";\nimport { satisfies, valid, validRange } from \"semver\";\nimport { isNode, LineCounter, parseDocument } from \"yaml\";\n\nimport { nodeSupportRangeMatches } from \"./toolchain-node\";\nimport { workspaceContains } from \"./toolchain-workspaces\";\n\nexport const packageRules = [\n \"bun-pins\",\n \"package-pins\",\n \"typescript-layout\",\n \"node-engine\",\n] as const;\n\ntype Layout =\n | {\n type: \"direct\";\n compilerPackage: string;\n compilerSpecifier: string;\n typecheckCommand: string;\n }\n | {\n type: \"split-compatibility\";\n compilerPackage: string;\n compilerSpecifier: string;\n compatibilityPackage: string;\n compatibilitySpecifier: string;\n typecheckCommand: string;\n };\n\ntype PackagePolicy = {\n bun: string;\n packages: Record<string, string>;\n typescriptInstallLayouts: readonly Layout[];\n typescript6Compatibility: { version: string; packageAlias: string };\n node: string;\n};\n\ntype Diagnostic = {\n rule: (typeof packageRules)[number];\n path: string;\n line: number;\n message: string;\n};\n\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\n// Inspect explicit substitution bodies without evaluating shell expressions.\nconst shellSubstitutions = (command: string) => {\n type Frame = {\n kind: \"root\" | \"parentheses\" | \"backticks\";\n start: number;\n depth: number;\n quote: \"'\" | '\"' | undefined;\n };\n const frames: Frame[] = [\n { kind: \"root\", start: 0, depth: 0, quote: undefined },\n ];\n const bodies: string[] = [];\n for (let index = 0; index < command.length; index += 1) {\n const frame = frames.at(-1);\n if (frame === undefined) break;\n const character = command.at(index);\n if (character === \"\\\\\" && frame.quote !== \"'\") {\n index += 1;\n continue;\n }\n if (character === \"`\" && frame.kind === \"backticks\") {\n bodies.push(command.slice(frame.start, index));\n frames.pop();\n continue;\n }\n if (character === frame.quote) {\n frame.quote = undefined;\n continue;\n }\n if (frame.quote === \"'\") continue;\n if (character === \"$\" && command.at(index + 1) === \"(\") {\n frames.push({\n kind: \"parentheses\",\n start: index + 2,\n depth: 1,\n quote: undefined,\n });\n index += 1;\n continue;\n }\n if (character === \"`\") {\n frames.push({\n kind: \"backticks\",\n start: index + 1,\n depth: 0,\n quote: undefined,\n });\n continue;\n }\n if (frame.quote !== undefined) continue;\n if (character === \"'\" || character === '\"') {\n frame.quote = character;\n continue;\n }\n if (frame.kind !== \"parentheses\") continue;\n if (character === \"(\") frame.depth += 1;\n if (character === \")\" && --frame.depth === 0) {\n bodies.push(command.slice(frame.start, index));\n frames.pop();\n }\n }\n for (const frame of frames.slice(1)) bodies.push(command.slice(frame.start));\n return bodies;\n};\n\nconst shellValueOptions = new Set([\n \"--rcfile\",\n \"--init-file\",\n \"-o\",\n \"+o\",\n \"-O\",\n \"+O\",\n]);\nconst shellExecutable = /^(?:\\/(?:[^/]+\\/)*)?(?:bash|dash|ksh|zsh|sh)$/;\n\ntype ShellToken = {\n kind: \"word\" | \"boundary\" | \"redirect\" | \"comment\";\n value: string;\n index: number;\n};\n\n// Keep expansion bodies in their word: substitutions are inspected separately as executable sources.\nconst shellTokens = (source: string) => {\n const tokens: ShellToken[] = [];\n for (let index = 0; index < source.length;) {\n const character = source.at(index);\n if (character === undefined) break;\n if (character === \"\\n\") {\n tokens.push({ kind: \"boundary\", value: character, index: index++ });\n continue;\n }\n if (/\\s/.test(character)) {\n index++;\n continue;\n }\n if (character === \"#\") {\n const end = source.indexOf(\"\\n\", index);\n const stop = end < 0 ? source.length : end;\n tokens.push({ kind: \"comment\", value: source.slice(index, stop), index });\n index = stop;\n continue;\n }\n const redirect = /^(?:\\d*)(?:&>>|&>|<<<|<<-|<<|>>|>\\||>&|<&|<>|>|<)/.exec(\n source.slice(index),\n );\n if (redirect !== null) {\n tokens.push({ kind: \"redirect\", value: redirect[0], index });\n index += redirect[0].length;\n continue;\n }\n const boundary = /^(?:&&|\\|\\||[();&|])/.exec(source.slice(index));\n if (boundary !== null) {\n tokens.push({ kind: \"boundary\", value: boundary[0], index });\n index += boundary[0].length;\n continue;\n }\n const start = index;\n type Frame = {\n kind: \"word\" | \"parentheses\" | \"backticks\";\n quote: \"'\" | '\"' | undefined;\n depth: number;\n };\n const frames: Frame[] = [{ kind: \"word\", quote: undefined, depth: 0 }];\n while (index < source.length) {\n const frame = frames.at(-1);\n const current = source.at(index);\n if (frame === undefined || current === undefined) break;\n if (current === \"\\\\\" && frame.quote !== \"'\") {\n index += 2;\n continue;\n }\n if (current === \"`\" && frame.kind === \"backticks\") {\n frames.pop();\n index++;\n continue;\n }\n if (current === frame.quote) {\n frame.quote = undefined;\n index++;\n continue;\n }\n if (frame.quote === \"'\") {\n index++;\n continue;\n }\n if (current === \"$\" && source.at(index + 1) === \"(\") {\n frames.push({ kind: \"parentheses\", quote: undefined, depth: 1 });\n index += 2;\n continue;\n }\n if (current === \"`\") {\n frames.push({ kind: \"backticks\", quote: undefined, depth: 0 });\n index++;\n continue;\n }\n if (frame.quote !== undefined) {\n index++;\n continue;\n }\n if (current === \"'\" || current === '\"') {\n frame.quote = current;\n index++;\n continue;\n }\n if (frame.kind === \"parentheses\") {\n if (current === \"(\") frame.depth++;\n if (current === \")\" && --frame.depth === 0) frames.pop();\n index++;\n continue;\n }\n if (frame.kind === \"word\" && /[\\s<>;&|()]/.test(current)) break;\n index++;\n }\n const value = source.slice(start, index);\n tokens.push({\n kind: \"word\",\n value,\n index: start,\n });\n }\n // Braces are reserved words only where a command or function body can begin.\n let groupDepth = 0;\n let redirectTarget = false;\n const commandWords: string[] = [];\n for (const token of tokens) {\n if (token.kind === \"comment\") continue;\n if (token.kind === \"redirect\") {\n redirectTarget = true;\n continue;\n }\n if (redirectTarget) {\n redirectTarget = false;\n if (token.kind === \"word\") continue;\n }\n if (token.kind === \"boundary\") {\n commandWords.length = 0;\n continue;\n }\n const functionBody =\n commandWords.length === 2 && commandWords.at(0) === \"function\";\n const opensGroup =\n token.value === \"{\" && (commandWords.length === 0 || functionBody);\n const closesGroup =\n token.value === \"}\" && groupDepth > 0 && commandWords.length === 0;\n if (opensGroup || closesGroup) {\n token.kind = \"boundary\";\n groupDepth += opensGroup ? 1 : -1;\n commandWords.length = 0;\n continue;\n }\n if (\n commandWords.length === 0 &&\n [\"if\", \"then\", \"elif\", \"else\", \"do\", \"!\", \"time\"].includes(token.value)\n )\n continue;\n commandWords.push(token.value);\n }\n return tokens;\n};\n\nconst shellArgumentTokens = (tokens: readonly ShellToken[]) => {\n const arguments_: ShellToken[] = [];\n let redirectTarget = false;\n for (const token of tokens) {\n if (token.kind === \"comment\") continue;\n if (token.kind === \"redirect\") {\n redirectTarget = true;\n continue;\n }\n if (redirectTarget) {\n redirectTarget = false;\n if (token.kind === \"word\") continue;\n }\n arguments_.push(token);\n }\n return arguments_;\n};\n\nconst shellReadsProgramStdin = (tokens: readonly ShellToken[]) => {\n const words = executableShellWords(\n shellArgumentTokens(tokens).map(({ value }) => value),\n ).map(decodeShellWord);\n if (!shellExecutable.test(words.at(0) ?? \"\")) return false;\n let stdin = false;\n let script = false;\n for (let index = 1; index < words.length; index++) {\n const option = words.at(index) ?? \"\";\n if (option === \"--\" || option === \"-\") {\n script = index + 1 < words.length;\n break;\n }\n if (!/^[+-]/.test(option)) {\n script = true;\n break;\n }\n if (shellValueOptions.has(option)) {\n index++;\n continue;\n }\n if (/^-[^-]*c/.test(option)) return false;\n if (/^-[^-]*s/.test(option)) stdin = true;\n }\n return stdin || !script;\n};\n\n// Descriptor copies retain their source; later redirections replace only their destination.\nconst shellStdinHeredoc = (tokens: readonly ShellToken[]) => {\n const descriptors = new Map<string, ShellToken>();\n for (let index = 0; index < tokens.length; index++) {\n const token = tokens.at(index);\n if (token?.kind !== \"redirect\") continue;\n const declaration = /^(\\d*)(.+)$/.exec(token.value);\n const operator = declaration?.[2];\n if (operator === undefined) continue;\n const descriptor = String(\n Number(declaration?.[1] || (operator.startsWith(\"<\") ? \"0\" : \"1\")),\n );\n const target = tokens.at(++index);\n if (operator === \"<<\" || operator === \"<<-\") {\n descriptors.set(descriptor, token);\n continue;\n }\n if (operator === \"<&\" || operator === \">&\") {\n const copy = /^(\\d+)(-?)$/.exec(decodeShellWord(target?.value ?? \"\"));\n const sourceDescriptor =\n copy?.[1] === undefined ? undefined : String(Number(copy[1]));\n const source =\n sourceDescriptor === undefined\n ? undefined\n : descriptors.get(sourceDescriptor);\n if (source === undefined) descriptors.delete(descriptor);\n else descriptors.set(descriptor, source);\n if (copy?.[2] === \"-\" && sourceDescriptor !== undefined)\n descriptors.delete(sourceDescriptor);\n continue;\n }\n descriptors.delete(descriptor);\n if (operator === \"&>\" || operator === \"&>>\") descriptors.delete(\"2\");\n }\n return descriptors.get(\"0\");\n};\n\n// Literal heredoc bodies are data, not direct shell command invocations.\nconst shellExecutableSource = (command: string) => {\n const pending: {\n delimiter: string;\n stripTabs: boolean;\n literal: boolean;\n execute: boolean;\n }[] = [];\n return command\n .split(/\\r?\\n/)\n .map((line) => {\n const here = pending.at(0);\n if (here !== undefined) {\n if (\n (here.stripTabs ? line.replace(/^\\t+/, \"\") : line) === here.delimiter\n ) {\n pending.shift();\n return \"\";\n }\n if (here.execute) return line;\n if (here.literal) return \"\";\n return shellSubstitutions(line).join(\"\\n\");\n }\n const words = shellTokens(line);\n let commandStart = 0;\n for (let index = 0; index < words.length; index++) {\n const match = words.at(index);\n const word = match?.value;\n if (word === undefined) continue;\n if (match?.kind === \"comment\") return line.slice(0, match.index);\n if (match?.kind === \"boundary\") {\n commandStart = index + 1;\n continue;\n }\n const declaration =\n match?.kind === \"redirect\" ? /^(?:\\d*)<<(-?)(.*)$/.exec(word) : null;\n let delimiter = declaration?.[2];\n if (delimiter === \"\") delimiter = words.at(++index)?.value;\n if (\n declaration !== null &&\n delimiter !== undefined &&\n !delimiter.startsWith(\"<\")\n ) {\n const commandEnd = words.findIndex(\n (entry, position) =>\n position > index &&\n (entry.kind === \"boundary\" || entry.kind === \"comment\"),\n );\n const invocation = words.slice(\n commandStart,\n commandEnd < 0 ? undefined : commandEnd,\n );\n pending.push({\n delimiter: decodeShellWord(delimiter),\n stripTabs: declaration[1] === \"-\",\n literal: /['\"\\\\]/.test(delimiter),\n execute:\n shellReadsProgramStdin(invocation) &&\n shellStdinHeredoc(invocation) === match,\n });\n }\n }\n return line;\n })\n .join(\"\\n\");\n};\n\nconst executableShellWords = (words: readonly string[]) => {\n let start = 0;\n const skipAssignments = () => {\n while (\n /^[A-Za-z_][A-Za-z\\d_]*=/.test(decodeShellWord(words.at(start) ?? \"\"))\n )\n start += 1;\n };\n skipAssignments();\n while (\n /^(?:\\/usr\\/bin\\/|\\/bin\\/)?env$/.test(\n decodeShellWord(words.at(start) ?? \"\"),\n )\n ) {\n start += 1;\n while (start < words.length) {\n const option = decodeShellWord(words.at(start) ?? \"\");\n if (option === \"--\") {\n start += 1;\n break;\n }\n if ([\"-u\", \"--unset\", \"-C\", \"--chdir\"].includes(option)) {\n start += 2;\n continue;\n }\n if (\n option === \"-S\" ||\n option === \"--split-string\" ||\n option.startsWith(\"--split-string=\") ||\n (option.startsWith(\"-S\") && option.length > 2)\n ) {\n let source: string;\n if (option === \"-S\" || option === \"--split-string\") {\n source = decodeShellWord(words.at(start + 1) ?? \"\");\n start += 2;\n } else {\n source = option.startsWith(\"-S\")\n ? option.slice(2)\n : option.slice(\"--split-string=\".length);\n start++;\n }\n return executableShellWords([\n \"env\",\n ...shellTokens(source).map(({ value }) => value),\n ...words.slice(start),\n ]);\n }\n if (\n option === \"-\" ||\n option === \"-i\" ||\n option === \"--ignore-environment\" ||\n /^--(?:unset|chdir)=.+|^-[uC].+/.test(option)\n ) {\n start += 1;\n continue;\n }\n break;\n }\n skipAssignments();\n }\n return words.slice(start);\n};\n\n// A quoted argument is executable only when the command itself is a shell with -c.\nconst shellCommandBody = (rawWords: readonly string[]) => {\n const words = executableShellWords(\n rawWords.filter((word) => word !== \"(\" && word !== \")\"),\n ).map(decodeShellWord);\n if (!shellExecutable.test(words.at(0) ?? \"\")) return undefined;\n for (let index = 1; index < words.length; index++) {\n const option = words.at(index);\n if (option === undefined || option === \"--\" || !/^[+-]/.test(option))\n return undefined;\n if (shellValueOptions.has(option)) {\n index++;\n continue;\n }\n if (/^-[^-]*c/.test(option)) return words.at(index + 1);\n }\n return undefined;\n};\n\n/** Shared executable shell words preserve assignments for runtime selectors. */\nexport const shellCommandSegments = (\n command: string,\n grouping: \"boundaries\" | \"tokens\" = \"boundaries\",\n) => {\n const segments: string[][] = [[]];\n const executableSource = shellExecutableSource(command);\n const sources = new Set([\n executableSource,\n ...shellSubstitutions(executableSource),\n ]);\n for (const source of sources) {\n const firstSegment = segments.length;\n segments.push([]);\n for (const { kind, value: word } of shellArgumentTokens(\n shellTokens(source),\n )) {\n if (kind === \"boundary\") {\n if ([\"(\", \")\", \"{\", \"}\"].includes(word) && grouping === \"tokens\")\n segments.at(-1)?.push(word);\n else segments.push([]);\n } else segments.at(-1)?.push(word);\n }\n for (const words of segments.slice(firstSegment)) {\n const body = shellCommandBody(words);\n if (body === undefined) continue;\n const executableBody = shellExecutableSource(body);\n sources.add(executableBody);\n for (const substitution of shellSubstitutions(executableBody))\n sources.add(substitution);\n }\n }\n return segments;\n};\n\n// Inspect direct compiler commands after removing environment launcher assignments.\nexport const compilerCommandSegments = (command: string) =>\n // Compiler policy compares raw invocations; retaining grouping prevents widening its allowlist.\n shellCommandSegments(command, \"tokens\").map(executableShellWords);\n\nconst launcherValueOptions = new Map(\n Object.entries({\n npx: [\n \"-p\",\n \"--package\",\n \"-c\",\n \"--call\",\n \"--cache\",\n \"--registry\",\n \"--userconfig\",\n ],\n bunx: [\"-p\", \"--package\"],\n pnpm: [\"--filter\", \"-F\", \"--dir\", \"-C\", \"--package\"],\n yarn: [\n \"--cwd\",\n \"--cache-folder\",\n \"--mutex\",\n \"--use-yarnrc\",\n \"--modules-folder\",\n \"--registry\",\n ],\n bun: [\n \"--cwd\",\n \"--filter\",\n \"-F\",\n \"--config\",\n \"-c\",\n \"--env-file\",\n \"-e\",\n \"--eval\",\n \"-p\",\n \"--print\",\n ],\n node: [\n \"-e\",\n \"--eval\",\n \"-p\",\n \"--print\",\n \"--conditions\",\n \"-C\",\n \"--inspect-port\",\n \"--max-old-space-size\",\n \"--stack-size\",\n \"--title\",\n \"--icu-data-dir\",\n \"--openssl-config\",\n \"--input-type\",\n ],\n }).map(([launcher, options]) => [launcher, new Set(options)]),\n);\n\nexport const decodeShellWord = (word: string) => {\n let result = \"\";\n let quote: \"'\" | '\"' | undefined;\n for (let index = 0; index < word.length; index += 1) {\n const character = word.at(index);\n if (character === quote) {\n quote = undefined;\n continue;\n }\n if (quote === undefined && (character === \"'\" || character === '\"')) {\n quote = character;\n continue;\n }\n const next = word.at(index + 1);\n if (\n character === \"\\\\\" &&\n next !== undefined &&\n quote !== \"'\" &&\n (quote === undefined || /[$`\"\\\\\\n]/.test(next))\n ) {\n if (next !== \"\\n\") result += next;\n index += 1;\n } else result += character;\n }\n return result;\n};\n\n// Classification sees launcher arguments; acceptance still uses the declared command.\nconst invokesCompiler = (words: string[]) => {\n const tokens = words.map(decodeShellWord);\n const compiler = (word: string) =>\n /(?:^|\\/)(?:tsc|tsgo)(?:\\.js)?$/.test(word);\n let start = 0;\n const skipOptions = (index: number, launcher: string) => {\n while (tokens.at(index)?.startsWith(\"-\")) {\n const option = tokens.at(index);\n index += 1;\n if (option === \"--\") break;\n if (\n option !== undefined &&\n launcherValueOptions.get(launcher)?.has(option)\n )\n index += 1;\n }\n return index;\n };\n while (start < tokens.length) {\n const launcher = tokens.at(start);\n if (launcher === undefined || !launcherValueOptions.has(launcher)) break;\n start = skipOptions(start + 1, launcher);\n if (launcher === \"bun\" && tokens.at(start) === \"check\") return true;\n const subcommand = tokens.at(start);\n if (\n (launcher === \"bun\" && (subcommand === \"x\" || subcommand === \"run\")) ||\n (launcher === \"pnpm\" &&\n (subcommand === \"exec\" || subcommand === \"dlx\")) ||\n (launcher === \"yarn\" &&\n (subcommand === \"exec\" || subcommand === \"dlx\" || subcommand === \"run\"))\n ) {\n start = skipOptions(start + 1, launcher);\n }\n }\n // Explicit compiler tokens behind unsupported launchers fail closed.\n const remaining = tokens.slice(start);\n return remaining.some(\n (word, index) =>\n compiler(word) ||\n (word === \"bun\" &&\n tokens.at(skipOptions(start + index + 1, \"bun\")) === \"check\"),\n );\n};\n\ntype CheckPackageFilesOptions = {\n files: Record<string, string>;\n policy: PackagePolicy;\n};\n\ntype AddDiagnosticOptions = {\n file: string;\n rule: Diagnostic[\"rule\"];\n key: string;\n value?: unknown;\n message: string;\n};\n\n/** Validate manifests and catalog resolutions from a tracked-file snapshot. */\nexport const checkPackageFiles = ({\n files,\n policy,\n}: CheckPackageFilesOptions) => {\n const sources = new Map(Object.entries(files));\n const diagnostics: Diagnostic[] = [];\n const pins = new Map(\n Object.entries({ ...policy.packages, \"bun-types\": policy.bun }),\n );\n const manifests = new Map<string, Record<string, unknown>>();\n const yamlLocations = new Map<string, number[]>();\n const reportedLines = new Map<string, number>();\n const add = ({ file, rule, key, value, message }: AddDiagnosticOptions) => {\n const source = sources.get(file);\n if (source === undefined)\n throw new Error(`Missing package diagnostic source: ${file}`);\n const serialized = value === undefined ? undefined : JSON.stringify(value);\n const locationKey = `${file}:${key}:${serialized ?? \"\"}`;\n const previous = reportedLines.get(locationKey) ?? -1;\n const yamlLine = yamlLocations.get(locationKey)?.shift();\n const index = source\n .split(/\\r?\\n/)\n .findIndex(\n (line, lineIndex) =>\n lineIndex > previous &&\n line.includes(JSON.stringify(key)) &&\n (serialized === undefined || line.includes(serialized)),\n );\n if (index >= 0) reportedLines.set(locationKey, index);\n diagnostics.push({\n rule,\n path: file,\n line: yamlLine ?? Math.max(1, index + 1),\n message,\n });\n };\n for (const [file, text] of sources) {\n const pnpm = path.posix.basename(file) === \"pnpm-workspace.yaml\";\n if (!pnpm && path.posix.basename(file) !== \"package.json\") continue;\n try {\n const lineCounter = new LineCounter();\n const document = pnpm ? parseDocument(text, { lineCounter }) : undefined;\n if (document !== undefined && document.errors.length > 0)\n throw new Error(\"invalid YAML\");\n const json: unknown =\n document === undefined ? JSON.parse(text) : document.toJS();\n if (!record(json)) throw new Error(\"manifest must be an object\");\n if (pnpm) {\n if (json[\"catalog\"] !== undefined && !record(json[\"catalog\"]))\n throw new Error(\"catalog must be a mapping\");\n if (\n json[\"catalogs\"] !== undefined &&\n (!record(json[\"catalogs\"]) ||\n Object.values(json[\"catalogs\"]).some((catalog) => !record(catalog)))\n )\n throw new Error(\"named catalogs must be mappings\");\n if (\n json[\"packages\"] !== undefined &&\n (!Array.isArray(json[\"packages\"]) ||\n !json[\"packages\"].every(\n (pattern: unknown) => typeof pattern === \"string\",\n ))\n )\n throw new Error(\"workspace packages must be patterns\");\n }\n manifests.set(file, json);\n if (document === undefined) continue;\n const catalogEntries = [\n { catalog: json[\"catalog\"], prefix: [\"catalog\"] },\n { catalog: json[\"overrides\"], prefix: [\"overrides\"] },\n ...(record(json[\"catalogs\"])\n ? Object.entries(json[\"catalogs\"]).map(([name, catalog]) => ({\n catalog,\n prefix: [\"catalogs\", name],\n }))\n : []),\n ];\n for (const { catalog, prefix } of catalogEntries) {\n if (!record(catalog)) continue;\n for (const [name, value] of Object.entries(catalog)) {\n const node = document.getIn([...prefix, name], true);\n if (!isNode(node) || node.range === undefined || node.range === null)\n continue;\n const key = `${file}:${name}:${JSON.stringify(value)}`;\n const lines = yamlLocations.get(key) ?? [];\n lines.push(lineCounter.linePos(node.range[0]).line);\n yamlLocations.set(key, lines);\n }\n }\n } catch {\n add({\n file,\n rule: \"package-pins\",\n key: \"\",\n message: pnpm\n ? \"invalid pnpm-workspace.yaml object\"\n : \"invalid package.json object\",\n });\n }\n }\n const catalogSources = (json: Record<string, unknown>) => [\n json,\n ...(record(json[\"workspaces\"]) ? [json[\"workspaces\"]] : []),\n ];\n const pnpmWorkspaceFor = (file: string) => {\n let directory = path.posix.dirname(file);\n while (true) {\n const workspace = manifests.get(\n path.posix.join(directory, \"pnpm-workspace.yaml\"),\n );\n if (workspace !== undefined) return { directory, workspace };\n if (directory === \".\") return undefined;\n directory = path.posix.dirname(directory);\n }\n };\n const catalogFor = (file: string, name: string): unknown => {\n const owner = pnpmWorkspaceFor(file);\n if (owner !== undefined) {\n const { directory, workspace } = owner;\n if (\n path.posix.basename(file) === \"package.json\" &&\n !workspaceContains({\n directory,\n file,\n patterns: workspace[\"packages\"],\n rootMembership: \"implicit\",\n })\n )\n return undefined;\n if (name === \"\" || name === \"default\")\n return (\n workspace[\"catalog\"] ??\n (record(workspace[\"catalogs\"])\n ? workspace[\"catalogs\"][\"default\"]\n : undefined)\n );\n return record(workspace[\"catalogs\"])\n ? workspace[\"catalogs\"][name]\n : undefined;\n }\n let directory = path.posix.dirname(file);\n while (true) {\n const manifest = manifests.get(\n path.posix.join(directory, \"package.json\"),\n );\n if (manifest !== undefined) {\n for (const source of catalogSources(manifest)) {\n if (name === \"\" && source[\"catalog\"] !== undefined)\n return source[\"catalog\"];\n if (\n record(source[\"catalogs\"]) &&\n source[\"catalogs\"][name] !== undefined\n )\n return source[\"catalogs\"][name];\n }\n // A workspace owns catalog resolution even when the requested catalog is absent.\n if (manifest[\"workspaces\"] !== undefined) return undefined;\n }\n if (directory === \".\") return undefined;\n directory = path.posix.dirname(directory);\n }\n };\n const resolve = (file: string, name: string, value: unknown): unknown => {\n const visited = new Set<string>();\n while (typeof value === \"string\" && value.startsWith(\"catalog:\")) {\n if (visited.has(value)) return undefined;\n visited.add(value);\n const catalog = catalogFor(file, value.slice(\"catalog:\".length));\n value = record(catalog) ? catalog[name] : undefined;\n }\n return value;\n };\n const workspaceOwnerFor = (file: string) => {\n const pnpm = pnpmWorkspaceFor(file);\n if (pnpm !== undefined)\n return {\n directory: pnpm.directory,\n patterns: pnpm.workspace[\"packages\"],\n source: \"pnpm\" as const,\n };\n let directory = path.posix.dirname(file);\n while (true) {\n const root = manifests.get(path.posix.join(directory, \"package.json\"));\n const workspaces = root?.[\"workspaces\"];\n if (workspaces !== undefined)\n return {\n directory,\n patterns: record(workspaces) ? workspaces[\"packages\"] : workspaces,\n source: \"json\" as const,\n };\n if (directory === \".\") return undefined;\n directory = path.posix.dirname(directory);\n }\n };\n type WorkspaceResolution = \"matched\" | \"nonmember\" | \"mismatch\";\n const workspaceResolution = ({\n file,\n name,\n pin,\n }: {\n file: string;\n name: string;\n pin: string;\n }): WorkspaceResolution => {\n const owner = workspaceOwnerFor(file);\n if (owner === undefined) return \"nonmember\";\n const { directory, patterns, source } = owner;\n if (source === \"json\" && !Array.isArray(patterns)) return \"mismatch\";\n if (\n !workspaceContains({\n directory,\n file,\n patterns,\n rootMembership: \"implicit\",\n })\n )\n return \"nonmember\";\n const candidates = [...manifests.entries()].filter(\n ([candidate, json]) =>\n path.posix.basename(candidate) === \"package.json\" &&\n json[\"name\"] === name &&\n workspaceContains({\n directory,\n file: candidate,\n patterns,\n rootMembership: source === \"json\" ? \"patterns\" : \"implicit\",\n }),\n );\n return candidates.length === 1 &&\n candidates.every(([, json]) => json[\"version\"] === pin)\n ? \"matched\"\n : \"mismatch\";\n };\n const tsSpecifiers = new Map<string, Set<string>>();\n for (const layout of policy.typescriptInstallLayouts) {\n const values =\n tsSpecifiers.get(layout.compilerPackage) ?? new Set<string>();\n values.add(layout.compilerSpecifier);\n tsSpecifiers.set(layout.compilerPackage, values);\n if (layout.type !== \"split-compatibility\") continue;\n const compatibility =\n tsSpecifiers.get(layout.compatibilityPackage) ?? new Set<string>();\n compatibility.add(layout.compatibilitySpecifier);\n tsSpecifiers.set(layout.compatibilityPackage, compatibility);\n }\n tsSpecifiers.set(\n policy.typescript6Compatibility.packageAlias,\n new Set([`npm:typescript@${policy.typescript6Compatibility.version}`]),\n );\n const layoutFor = (specifiers: Map<string, Set<unknown>>) =>\n policy.typescriptInstallLayouts.find((layout) => {\n const compiler = specifiers.get(layout.compilerPackage);\n if (compiler?.size !== 1 || !compiler.has(layout.compilerSpecifier))\n return false;\n if (layout.type === \"split-compatibility\") {\n const compatibility = specifiers.get(layout.compatibilityPackage);\n return (\n compatibility?.size === 1 &&\n compatibility.has(layout.compatibilitySpecifier)\n );\n }\n return policy.typescriptInstallLayouts.every(\n (other) =>\n other.compilerPackage === layout.compilerPackage ||\n !specifiers.has(other.compilerPackage),\n );\n });\n const peerRange = (value: unknown): value is string =>\n typeof value === \"string\" &&\n valid(value) === null &&\n validRange(value) !== null;\n const toolchainEntries = (file: string, json: Record<string, unknown>) => {\n const entries: { section: string; name: string; value: unknown }[] = [];\n for (const section of [\n \"dependencies\",\n \"devDependencies\",\n \"optionalDependencies\",\n \"peerDependencies\",\n ]) {\n const dependencies = json[section];\n if (!record(dependencies)) continue;\n for (const [name, value] of Object.entries(dependencies)) {\n if (!tsSpecifiers.has(name)) continue;\n const resolved = resolve(file, name, value);\n if (section === \"peerDependencies\" && peerRange(resolved)) continue;\n entries.push({ section, name, value: resolved });\n }\n }\n return entries;\n };\n const specifierMap = (entries: { name: string; value: unknown }[]) => {\n const specifiers = new Map<string, Set<unknown>>();\n for (const { name, value } of entries) {\n const values = specifiers.get(name) ?? new Set<unknown>();\n values.add(value);\n specifiers.set(name, values);\n }\n return specifiers;\n };\n const workspaceLayouts = new Map<\n string,\n { layout: Layout | undefined; directory: string }\n >();\n const workspaceLayoutFor = (file: string) => {\n const owner = workspaceOwnerFor(file);\n if (\n owner === undefined ||\n !workspaceContains({ ...owner, file, rootMembership: \"implicit\" })\n )\n return undefined;\n const key = `${owner.source}:${owner.directory}`;\n const cached = workspaceLayouts.get(key);\n if (cached !== undefined) return cached;\n const entries: { name: string; value: unknown }[] = [];\n for (const [candidate, member] of manifests) {\n if (path.posix.basename(candidate) !== \"package.json\") continue;\n const memberOwner = workspaceOwnerFor(candidate);\n if (\n memberOwner?.directory !== owner.directory ||\n memberOwner.source !== owner.source ||\n !workspaceContains({\n ...owner,\n file: candidate,\n rootMembership: \"implicit\",\n })\n )\n continue;\n entries.push(\n ...toolchainEntries(candidate, member).filter(\n ({ section }) => section === \"devDependencies\",\n ),\n );\n }\n const result = {\n layout: layoutFor(specifierMap(entries)),\n directory: owner.directory,\n };\n workspaceLayouts.set(key, result);\n return result;\n };\n for (const [file, json] of manifests) {\n const manager = json[\"packageManager\"];\n if (manager !== undefined && manager !== `bun@${policy.bun}`)\n add({\n file,\n rule: \"bun-pins\",\n key: \"packageManager\",\n value: manager,\n message: `packageManager Bun version must be ${policy.bun}, found ${JSON.stringify(manager)}`,\n });\n const checkEntries = (\n entries: unknown,\n location?: { key: string; value: unknown },\n ) => {\n if (!record(entries)) return;\n for (const [name, raw] of Object.entries(entries)) {\n const value = resolve(file, name, raw);\n const tsAllowed = tsSpecifiers.get(name);\n if (tsAllowed !== undefined) {\n if (typeof value !== \"string\" || !tsAllowed.has(value))\n add({\n file,\n rule: \"typescript-layout\",\n key: location?.key ?? name,\n value: location === undefined ? raw : location.value,\n message: `${name} must use a declared TypeScript specifier, found ${String(value)}`,\n });\n continue;\n }\n const pin = pins.get(name);\n if (pin === undefined) continue;\n if (value === pin) continue;\n const workspace =\n value === \"workspace:*\"\n ? workspaceResolution({ file, name, pin })\n : undefined;\n if (workspace === \"matched\") continue;\n add({\n file,\n rule: name === \"bun-types\" ? \"bun-pins\" : \"package-pins\",\n key: location?.key ?? name,\n value: location === undefined ? raw : location.value,\n message:\n workspace === \"nonmember\"\n ? `${name} workspace:* consumer is not a member of its nearest workspace`\n : `${name} must be ${pin}, found ${String(value)}`,\n });\n }\n };\n for (const key of [\n \"dependencies\",\n \"devDependencies\",\n \"optionalDependencies\",\n ])\n checkEntries(json[key]);\n if (record(json[\"peerDependencies\"]))\n for (const [name, value] of Object.entries(json[\"peerDependencies\"])) {\n if (tsSpecifiers.has(name) && !peerRange(resolve(file, name, value)))\n checkEntries({ [name]: value });\n }\n for (const source of catalogSources(json)) {\n checkEntries(source[\"catalog\"]);\n if (!record(source[\"catalogs\"])) continue;\n for (const catalog of Object.values(source[\"catalogs\"]))\n checkEntries(catalog);\n }\n const ownedNames = new Set([...pins.keys(), ...tsSpecifiers.keys()]);\n const resolutionDependencies: Record<string, unknown> = {};\n const resolutionRoot = manifests.get(\n path.posix.join(path.posix.dirname(file), \"package.json\"),\n );\n if (resolutionRoot !== undefined)\n for (const section of [\n \"dependencies\",\n \"devDependencies\",\n \"optionalDependencies\",\n ]) {\n const entries = resolutionRoot[section];\n if (!record(entries)) continue;\n for (const [name, value] of Object.entries(entries))\n resolutionDependencies[name] = resolve(file, name, value);\n }\n const affectedSpecifiers = new Map<string, Set<unknown>>();\n const owner = workspaceOwnerFor(file);\n for (const [candidate, member] of manifests) {\n if (path.posix.basename(candidate) !== \"package.json\") continue;\n const memberOwner = workspaceOwnerFor(candidate);\n const ownManifest =\n candidate === path.posix.join(path.posix.dirname(file), \"package.json\");\n if (\n !ownManifest &&\n !(\n owner !== undefined &&\n owner.directory === path.posix.dirname(file) &&\n memberOwner?.directory === owner.directory &&\n memberOwner.source === owner.source &&\n workspaceContains({\n directory: owner.directory,\n file: candidate,\n patterns: owner.patterns,\n rootMembership: \"implicit\",\n })\n )\n )\n continue;\n for (const section of [\n \"dependencies\",\n \"devDependencies\",\n \"optionalDependencies\",\n ]) {\n const entries = member[section];\n if (!record(entries)) continue;\n for (const [name, value] of Object.entries(entries)) {\n if (!tsSpecifiers.has(name)) continue;\n const values = affectedSpecifiers.get(name) ?? new Set<unknown>();\n values.add(resolve(candidate, name, value));\n affectedSpecifiers.set(name, values);\n }\n }\n }\n const checkResolutionMap = (entries: unknown, parent?: string) => {\n if (!record(entries)) return;\n for (const [selector, replacement] of Object.entries(entries)) {\n // npm's nested '.' replaces the enclosing package; Yarn and pnpm\n // qualify a target with a dependency path or a parent selector.\n const target = selector === \".\" ? parent : selector;\n if (target === undefined) continue;\n let pattern =\n target\n .split(/>\\s*(?=[@A-Za-z_*]|$)/)\n .at(-1)\n ?.trim() ?? \"\";\n const version = pattern.lastIndexOf(\"@\");\n let qualifier: string | undefined;\n if (version > pattern.lastIndexOf(\"/\")) {\n qualifier = pattern.slice(version + 1).replace(/^npm:/, \"\");\n pattern = pattern.slice(0, version);\n }\n const parts = pattern.split(\"/\");\n pattern = parts.at(-2)?.startsWith(\"@\")\n ? parts.slice(-2).join(\"/\")\n : (parts.at(-1) ?? \"\");\n if (pattern === \"\") {\n add({\n file,\n rule: \"package-pins\",\n key: selector,\n value: replacement,\n message: \"resolution selector must name a package\",\n });\n continue;\n }\n if (record(replacement)) {\n checkResolutionMap(replacement, target);\n continue;\n }\n for (const name of ownedNames) {\n if (!picomatch(pattern)(name)) continue;\n let value = replacement;\n if (typeof replacement === \"string\" && replacement.startsWith(\"$\")) {\n const reference = replacement.slice(1);\n value = resolutionDependencies[reference];\n }\n const resolved = resolve(file, name, value);\n checkEntries(\n { [name]: value },\n {\n key: selector,\n value: replacement,\n },\n );\n if (\n tsSpecifiers.has(name) &&\n [...(affectedSpecifiers.get(name) ?? [])].some((specifier) => {\n if (resolved === specifier) return false;\n if (qualifier === undefined || validRange(qualifier) === null)\n return true;\n if (typeof specifier !== \"string\") return false;\n const versionSpecifier = specifier.startsWith(\"npm:\")\n ? specifier.slice(specifier.lastIndexOf(\"@\") + 1)\n : specifier;\n const release = valid(versionSpecifier);\n return release !== null && satisfies(release, qualifier);\n }) &&\n typeof resolved === \"string\" &&\n tsSpecifiers.get(name)?.has(resolved)\n )\n add({\n file,\n rule: \"typescript-layout\",\n key: selector,\n value: replacement,\n message: `${name} resolution must preserve its declared TypeScript install specifier`,\n });\n }\n }\n };\n checkResolutionMap(json[\"overrides\"]);\n checkResolutionMap(json[\"resolutions\"]);\n if (record(json[\"pnpm\"])) checkResolutionMap(json[\"pnpm\"][\"overrides\"]);\n const localEntries = toolchainEntries(file, json);\n const usesCompiler = policy.typescriptInstallLayouts.some((layout) =>\n localEntries.some(({ name }) => name === layout.compilerPackage),\n );\n let selectedLayout = layoutFor(specifierMap(localEntries));\n if (usesCompiler) {\n if (\n layoutFor(\n specifierMap(\n localEntries.filter(\n ({ section }) => section !== \"peerDependencies\",\n ),\n ),\n ) === undefined\n )\n selectedLayout = undefined;\n if (selectedLayout === undefined) {\n const workspace = workspaceLayoutFor(file);\n const layout = workspace?.layout;\n if (workspace !== undefined && layout !== undefined) {\n const expected = new Map([\n [layout.compilerPackage, layout.compilerSpecifier],\n ]);\n if (layout.type === \"split-compatibility\")\n expected.set(\n layout.compatibilityPackage,\n layout.compatibilitySpecifier,\n );\n expected.set(\n policy.typescript6Compatibility.packageAlias,\n `npm:typescript@${policy.typescript6Compatibility.version}`,\n );\n const developmentOnly = localEntries.every(\n ({ section, name, value }) =>\n section === \"devDependencies\" && expected.get(name) === value,\n );\n const runtimeCompatibilityOnly =\n layout.type === \"split-compatibility\" &&\n path.posix.dirname(file) !== workspace.directory &&\n localEntries.every(\n ({ section, name, value }) =>\n (section === \"dependencies\" ||\n section === \"devDependencies\" ||\n section === \"peerDependencies\") &&\n name === layout.compatibilityPackage &&\n value === layout.compatibilitySpecifier,\n );\n if (developmentOnly || runtimeCompatibilityOnly)\n selectedLayout = layout;\n }\n }\n if (selectedLayout === undefined)\n add({\n file,\n rule: \"typescript-layout\",\n key: \"dependencies\",\n message:\n \"TypeScript compiler and compatibility packages must match one complete declared install layout\",\n });\n const command = record(json[\"scripts\"])\n ? json[\"scripts\"][\"typecheck\"]\n : undefined;\n if (selectedLayout !== undefined && typeof command === \"string\") {\n const normalizedExpected = selectedLayout.typecheckCommand\n .replace(/\\s+/g, \" \")\n .trim();\n for (const words of compilerCommandSegments(command)) {\n if (!invokesCompiler(words)) continue;\n const normalized = words.join(\" \");\n if (\n !words.some((word) => word === \"(\" || word === \")\") &&\n shellSubstitutions(normalized).length === 0 &&\n (normalized === normalizedExpected ||\n normalized.startsWith(`${normalizedExpected} `))\n )\n continue;\n add({\n file,\n rule: \"typescript-layout\",\n key: \"typecheck\",\n value: command,\n message: `typecheck compiler invocation must use ${selectedLayout.typecheckCommand}`,\n });\n break;\n }\n }\n }\n if (record(json[\"peerDependencies\"])) {\n const peerLayout = selectedLayout ?? workspaceLayoutFor(file)?.layout;\n for (const [name, raw] of Object.entries(json[\"peerDependencies\"])) {\n if (!tsSpecifiers.has(name)) continue;\n const range = resolve(file, name, raw);\n if (!peerRange(range)) continue;\n const releases = new Set<string>();\n for (const layout of policy.typescriptInstallLayouts) {\n if (\n layout.compilerPackage !== name &&\n !(\n layout.type === \"split-compatibility\" &&\n layout.compatibilityPackage === name\n )\n )\n continue;\n const specifier = layout.compilerSpecifier;\n releases.add(\n specifier.startsWith(\"npm:\")\n ? specifier.slice(specifier.lastIndexOf(\"@\") + 1)\n : specifier,\n );\n }\n if (name === policy.typescript6Compatibility.packageAlias)\n releases.add(policy.typescript6Compatibility.version);\n if (\n peerLayout?.type === \"split-compatibility\" &&\n name === peerLayout.compatibilityPackage\n )\n releases.add(peerLayout.compatibilitySpecifier);\n if ([...releases].every((release) => satisfies(release, range)))\n continue;\n add({\n file,\n rule: \"typescript-layout\",\n key: name,\n value: raw,\n message: `${name} peer support range must include ${[...releases].join(\" and \")}, found ${range}`,\n });\n }\n }\n if (\n record(json[\"engines\"]) &&\n json[\"engines\"][\"node\"] !== undefined &&\n (typeof json[\"engines\"][\"node\"] !== \"string\" ||\n !nodeSupportRangeMatches(policy.node, json[\"engines\"][\"node\"]))\n )\n add({\n file,\n rule: \"node-engine\",\n key: \"node\",\n value: json[\"engines\"][\"node\"],\n message: `engines.node must support ${policy.node}, found ${JSON.stringify(json[\"engines\"][\"node\"])}`,\n });\n }\n return diagnostics;\n};\n","import { parseDocument } from \"yaml\";\n\nimport { canonicalDockerRuntime, rustImageVersion } from \"./toolchain-images\";\nimport { githubAutomationFileKind, isShellScript } from \"./toolchain-inputs\";\nimport { decodeShellWord, shellCommandSegments } from \"./toolchain-packages\";\n\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nexport type RustException = {\n pin: string;\n reason: string;\n tracking: string;\n expires: string;\n};\n\n/** Exceptions authorize one immutable release, never a channel or an entire rule. */\nexport const parseRustExceptions = (\n input: unknown,\n today = new Date().toISOString().slice(0, 10),\n): RustException[] => {\n if (input === undefined) return [];\n if (!Array.isArray(input)) throw new Error(\"rustExceptions must be an array\");\n const pins = new Set<string>();\n return input.map((entry: unknown) => {\n if (\n !record(entry) ||\n Object.keys(entry).length !== 4 ||\n Object.keys(entry).some(\n (key) => ![\"pin\", \"reason\", \"tracking\", \"expires\"].includes(key),\n ) ||\n typeof entry[\"pin\"] !== \"string\" ||\n !/^(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)$/.test(entry[\"pin\"]) ||\n typeof entry[\"reason\"] !== \"string\" ||\n entry[\"reason\"].trim() === \"\" ||\n typeof entry[\"tracking\"] !== \"string\" ||\n !/^https:\\/\\/github\\.com\\/[^/\\s]+\\/[^/\\s]+\\/issues\\/[1-9]\\d*$/.test(\n entry[\"tracking\"],\n ) ||\n typeof entry[\"expires\"] !== \"string\" ||\n !/^\\d{4}-\\d{2}-\\d{2}$/.test(entry[\"expires\"]) ||\n !Number.isFinite(Date.parse(entry[\"expires\"])) ||\n new Date(entry[\"expires\"]).toISOString().slice(0, 10) !==\n entry[\"expires\"] ||\n entry[\"expires\"] <= today ||\n pins.has(entry[\"pin\"])\n )\n throw new Error(\n \"each Rust exception requires a unique exact stable pin, reason, GitHub issue and future valid expiry date\",\n );\n pins.add(entry[\"pin\"]);\n return {\n pin: entry[\"pin\"],\n reason: entry[\"reason\"],\n tracking: entry[\"tracking\"],\n expires: entry[\"expires\"],\n };\n });\n};\n\ntype RustReferenceOptions = {\n file: string;\n rust: string;\n exceptions: readonly RustException[];\n} & (\n | { type: \"file\"; text: string }\n | { type: \"command\"; source: string; line: number }\n | {\n type: \"environment\";\n assignments: readonly { key: string; value: string }[];\n line: number;\n }\n);\n\n/** Only executable fields are inspected: unrelated action inputs are not Rust selectors. */\nexport const checkRustReferences = (options: RustReferenceOptions) => {\n const { file, rust, exceptions } = options;\n const text = options.type === \"file\" ? options.text : \"\";\n const diagnostics: {\n rule: \"rust-version\";\n path: string;\n line: number;\n message: string;\n }[] = [];\n const select = (value: unknown, label: string, line = 1) => {\n if (value === rust || exceptions.some(({ pin }) => pin === value)) return;\n diagnostics.push({\n rule: \"rust-version\",\n path: file,\n line,\n message: `${label} must be Rust ${rust}, found ${String(value)}`,\n });\n };\n const shell = (source: string, firstLine = 1) => {\n const commands = shellCommandSegments(source).map((words) =>\n words.map((word) => ({ value: decodeShellWord(word), line: firstLine })),\n );\n for (const command of commands) {\n let position = 0;\n const prefixes = new Set([\n \"if\",\n \"then\",\n \"do\",\n \"elif\",\n \"!\",\n \"env\",\n \"sudo\",\n \"command\",\n \"exec\",\n \"time\",\n \"export\",\n \"readonly\",\n \"/usr/bin/env\",\n \"/bin/env\",\n ]);\n while (position < command.length) {\n const value = command.at(position)?.value;\n if (value?.startsWith(\"RUSTUP_TOOLCHAIN=\"))\n select(\n value.slice(\"RUSTUP_TOOLCHAIN=\".length),\n \"RUSTUP_TOOLCHAIN\",\n firstLine,\n );\n if (value === \"-u\" || value === \"--unset\") {\n position += 2;\n continue;\n }\n if (\n value?.startsWith(\"--unset=\") ||\n value === \"-i\" ||\n value === \"--ignore-environment\"\n ) {\n position++;\n continue;\n }\n if (\n value !== undefined &&\n (prefixes.has(value) || /^[A-Za-z_][A-Za-z_\\d]*=/.test(value))\n )\n position++;\n else break;\n }\n const executable = command.at(position)?.value;\n const arguments_ = command.slice(position + 1);\n if (executable === \"cargo\" && arguments_.at(0)?.value.startsWith(\"+\")) {\n const selector = arguments_.at(0);\n select(selector?.value.slice(1), \"cargo toolchain\", selector?.line);\n }\n if (executable !== \"rustup\") continue;\n let subcommandPosition = 0;\n while (subcommandPosition < arguments_.length) {\n const token = arguments_.at(subcommandPosition);\n if (token === undefined) break;\n if (token.value === \"--\") {\n subcommandPosition++;\n break;\n }\n if (token.value.startsWith(\"+\")) {\n select(token.value.slice(1), \"rustup toolchain\", token.line);\n } else if (!token.value.startsWith(\"-\")) break;\n subcommandPosition++;\n }\n const invocation = arguments_.slice(subcommandPosition);\n const subcommand = invocation.at(0)?.value;\n if (subcommand === \"target\" || subcommand === \"component\") {\n // These commands name targets/components positionally; only this option selects Rust.\n for (let index = 1; index < invocation.length; index++) {\n const token = invocation.at(index);\n if (token?.value === \"--toolchain\") {\n select(\n invocation.at(++index)?.value,\n \"rustup --toolchain\",\n token.line,\n );\n } else if (token?.value.startsWith(\"--toolchain=\")) {\n select(\n token.value.slice(\"--toolchain=\".length),\n \"rustup --toolchain\",\n token.line,\n );\n }\n }\n continue;\n }\n let selectors: typeof invocation;\n let requiresSelector = true;\n let firstSelectorOnly = false;\n if (\n subcommand === \"default\" ||\n subcommand === \"install\" ||\n subcommand === \"add\" ||\n subcommand === \"update\"\n ) {\n selectors = invocation.slice(1);\n requiresSelector = subcommand !== \"update\";\n } else if (\n subcommand === \"toolchain\" &&\n [\"install\", \"add\", \"update\"].includes(invocation.at(1)?.value ?? \"\")\n ) {\n selectors = invocation.slice(2);\n requiresSelector = invocation.at(1)?.value !== \"update\";\n } else if (subcommand === \"run\") {\n selectors = invocation.slice(1);\n firstSelectorOnly = true;\n } else if (\n subcommand === \"override\" &&\n invocation.at(1)?.value === \"set\"\n ) {\n selectors = invocation.slice(2);\n firstSelectorOnly = true;\n } else continue;\n let selected = 0;\n const optionArguments = new Set([\n \"--path\",\n \"--profile\",\n \"--component\",\n \"-c\",\n \"--target\",\n \"-t\",\n ]);\n for (let index = 0; index < selectors.length; index++) {\n const token = selectors.at(index);\n if (token === undefined) continue;\n if (optionArguments.has(token.value)) {\n index++;\n continue;\n }\n if (token.value.startsWith(\"-\")) continue;\n selected++;\n select(token.value, \"rustup toolchain\", token.line);\n if (firstSelectorOnly) break;\n }\n if (selected === 0 && requiresSelector)\n select(undefined, \"rustup toolchain\", firstLine);\n }\n };\n if (options.type === \"environment\") {\n for (const { key, value } of options.assignments) {\n if (key === \"RUSTUP_TOOLCHAIN\") select(value, key, options.line);\n }\n return diagnostics;\n }\n if (options.type === \"command\") {\n shell(options.source, options.line);\n return diagnostics;\n }\n const lineOf = (token: string) => {\n const index = text.split(/\\r?\\n/).findIndex((line) => line.includes(token));\n return index < 0 ? 1 : index + 1;\n };\n if (isShellScript(file, text)) shell(text);\n if (/(?:^|\\/)package\\.json$/.test(file)) {\n try {\n const object: unknown = JSON.parse(text);\n if (record(object) && record(object[\"scripts\"]))\n for (const [name, script] of Object.entries(object[\"scripts\"]))\n if (typeof script === \"string\") shell(script, lineOf(`\"${name}\"`));\n } catch {\n /* The package owner reports invalid JSON. */\n }\n }\n if (/(?:^|\\/)ci-service-images\\.json$/.test(file)) {\n const images = (value: unknown) => {\n if (\n typeof value === \"string\" &&\n /^rust(?=:|@|$)/.test(canonicalDockerRuntime(value))\n ) {\n const tag = canonicalDockerRuntime(value)\n .replace(/^rust:?/, \"\")\n .split(\"@\")\n .at(0);\n const version = tag === undefined ? undefined : rustImageVersion(tag);\n select(version, \"Rust service image\", lineOf(value));\n } else if (Array.isArray(value)) value.forEach(images);\n else if (record(value)) Object.values(value).forEach(images);\n };\n try {\n images(JSON.parse(text));\n } catch {\n diagnostics.push({\n rule: \"rust-version\",\n path: file,\n line: 1,\n message: \"invalid service image JSON\",\n });\n }\n }\n if (githubAutomationFileKind(file) === undefined) return diagnostics;\n const document = parseDocument(text);\n if (document.errors.length > 0) return diagnostics;\n try {\n const visit = (value: unknown) => {\n if (Array.isArray(value)) {\n value.forEach(visit);\n return;\n }\n if (!record(value)) return;\n if (\n record(value[\"env\"]) &&\n value[\"env\"][\"RUSTUP_TOOLCHAIN\"] !== undefined\n )\n select(\n value[\"env\"][\"RUSTUP_TOOLCHAIN\"],\n \"RUSTUP_TOOLCHAIN\",\n lineOf(\"RUSTUP_TOOLCHAIN\"),\n );\n if (typeof value[\"run\"] === \"string\") shell(value[\"run\"], lineOf(\"run:\"));\n const uses = value[\"uses\"];\n if (typeof uses === \"string\") {\n const action = uses.split(\"@\").at(0)?.toLowerCase();\n const inputs = record(value[\"with\"]) ? value[\"with\"] : {};\n if (\n action === \"dtolnay/rust-toolchain\" ||\n action === \"actions-rust-lang/setup-rust-toolchain\"\n ) {\n const entries = Object.entries(inputs).filter(\n ([key]) => key.toLowerCase() === \"toolchain\",\n );\n if (entries.length !== 1)\n select(\n undefined,\n `${action} requires an explicit exact toolchain input`,\n lineOf(uses),\n );\n else {\n const selected = entries.at(0)?.at(1);\n // setup-rust-toolchain installs every comma-separated release.\n const selectors =\n action === \"actions-rust-lang/setup-rust-toolchain\" &&\n typeof selected === \"string\"\n ? selected.split(\",\").map((pin) => pin.trim())\n : [selected];\n for (const selector of selectors)\n select(selector, `${action} toolchain`, lineOf(\"toolchain:\"));\n }\n } else if (\n /(?:^|\\/)\\.github\\/workflows\\/[^@]+\\.ya?ml(?:@|$)/.test(uses)\n ) {\n for (const [key, selected] of Object.entries(inputs))\n if ([\"toolchain\", \"rust-toolchain\"].includes(key.toLowerCase()))\n select(selected, `reusable workflow ${key}`, lineOf(`${key}:`));\n }\n }\n for (const [key, child] of Object.entries(value)) {\n if (key === \"workflow_call\" && record(child) && record(child[\"inputs\"]))\n for (const [input, declaration] of Object.entries(child[\"inputs\"]))\n if (\n [\"toolchain\", \"rust-toolchain\"].includes(input) &&\n record(declaration) &&\n declaration[\"default\"] !== undefined\n )\n select(\n declaration[\"default\"],\n `reusable workflow default ${input}`,\n lineOf(\"default:\"),\n );\n visit(child);\n }\n };\n visit(document.toJS({ maxAliasCount: 100 }));\n } catch {\n /* The workflow owner reports alias resolution failures. */\n }\n return diagnostics;\n};\n","import path from \"node:path\";\nimport { parse as parseToml } from \"smol-toml\";\nimport {\n isAlias,\n isMap,\n isScalar,\n isSeq,\n LineCounter,\n parseAllDocuments,\n parseDocument,\n} from \"yaml\";\n\nimport {\n containerDocumentImages,\n isComposeDefinitionPath,\n isKubernetesDefinitionPath,\n} from \"./toolchain-container-inputs\";\nimport type { DynamicSelector } from \"./toolchain-dynamic-selectors\";\nimport {\n engineFloorSelectorMatches,\n type ResolvedEngineFloor,\n} from \"./toolchain-engine-floors\";\nimport { canonicalDockerRuntime, rustImageVersion } from \"./toolchain-images\";\nimport {\n githubAutomationFileKind,\n isMiseConfigPath,\n isDockerDefinitionPath,\n} from \"./toolchain-inputs\";\nimport { nodeSelectorMatches } from \"./toolchain-node\";\nimport { checkRustReferences, type RustException } from \"./toolchain-rust\";\n\nexport const runtimeRules = [\n \"bun-pins\",\n \"node-version\",\n \"python-version\",\n \"rust-version\",\n \"runtime-manager\",\n \"runtime-docker\",\n \"runtime-workflow\",\n \"action-pins\",\n] as const;\n\ntype RuntimeRule = (typeof runtimeRules)[number];\n\ntype RuntimePolicy = {\n node: string;\n python: string;\n rust: string;\n bun: string;\n packages: Record<string, string>;\n actions: Record<string, { sha: string; version: string }>;\n};\n\ntype RuntimeDiagnostic = {\n rule: RuntimeRule;\n path: string;\n line: number;\n message: string;\n};\n\nexport type RuntimeDelegation = {\n path: string;\n line: number;\n tool: \"node\" | \"python\" | \"bun\";\n selector: string;\n checkoutPath: string;\n ref: string;\n};\n\ntype CheckRuntimeFileOptions = {\n file: string;\n text: string;\n policy: RuntimePolicy;\n trackedFiles: ReadonlySet<string>;\n readFile: (file: string) => string | undefined;\n repository?: string | undefined;\n onDelegated?: ((report: RuntimeDelegation) => void) | undefined;\n dynamicSelectors?: readonly DynamicSelector[] | undefined;\n onDynamicSelector?: ((entry: DynamicSelector) => void) | undefined;\n rustExceptions?: readonly RustException[] | undefined;\n engineFloors?: readonly ResolvedEngineFloor[] | undefined;\n onEngineFloor?:\n | ((floor: ResolvedEngineFloor, status: \"matched\" | \"mismatch\") => void)\n | undefined;\n};\n\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\ntype DockerEnvironmentOptions = { source: string; escape: string };\n\n// ENV uses whitespace-delimited assignments, not shell operators or command substitution.\nconst dockerEnvironmentAssignments = ({\n source,\n escape,\n}: DockerEnvironmentOptions) => {\n const words: string[] = [];\n let word = \"\";\n let quote: \"'\" | '\"' | undefined;\n for (let index = 0; index < source.length; index++) {\n const character = source.at(index) ?? \"\";\n if (character === escape && quote !== \"'\") {\n word += character + (source.at(++index) ?? \"\");\n continue;\n }\n if (character === quote) quote = undefined;\n else if (quote === undefined && (character === \"'\" || character === '\"'))\n quote = character;\n else if (quote === undefined && /\\s/.test(character)) {\n if (word !== \"\") words.push(word);\n word = \"\";\n continue;\n }\n word += character;\n }\n if (quote !== undefined) return undefined;\n if (word !== \"\") words.push(word);\n const decode = (raw: string) => {\n let value = \"\";\n let quoted: \"'\" | '\"' | undefined;\n for (let index = 0; index < raw.length; index++) {\n const character = raw.at(index) ?? \"\";\n if (character === quoted) {\n quoted = undefined;\n continue;\n }\n if (quoted === undefined && (character === \"'\" || character === '\"')) {\n quoted = character;\n continue;\n }\n const next = raw.at(index + 1);\n if (\n character === escape &&\n quoted !== \"'\" &&\n next !== undefined &&\n (quoted === undefined ||\n next === '\"' ||\n next === \"$\" ||\n next === escape)\n ) {\n value += next;\n index++;\n } else value += character;\n }\n return value;\n };\n const first = words.at(0);\n if (first === undefined) return undefined;\n if (!first.includes(\"=\")) {\n const legacy = /^(\\S+)\\s+([\\s\\S]*)$/.exec(source);\n if (legacy === null) return undefined;\n return [{ key: decode(legacy[1] ?? \"\"), value: decode(legacy[2] ?? \"\") }];\n }\n const assignments: { key: string; value: string }[] = [];\n for (const raw of words) {\n const separator = raw.indexOf(\"=\");\n if (separator < 1) return undefined;\n assignments.push({\n key: decode(raw.slice(0, separator)),\n value: decode(raw.slice(separator + 1)),\n });\n }\n return assignments;\n};\n\nconst pythonSelectorMatches = (value: unknown, expected: string) =>\n value === expected ||\n (typeof value === \"string\" &&\n /^\\d+\\.\\d+$/.test(expected) &&\n value.startsWith(`${expected}.`) &&\n /^\\d+\\.\\d+\\.\\d+$/.test(value));\n\nconst compareRelease = (left: readonly number[], right: readonly number[]) => {\n for (let index = 0; index < Math.max(left.length, right.length); index++) {\n const difference = (left.at(index) ?? 0) - (right.at(index) ?? 0);\n if (difference !== 0) return Math.sign(difference);\n }\n return 0;\n};\n\n/** A minor policy covers every nonnegative patch in that release series. */\ntype PythonSeriesRequirementOptions = {\n current: readonly number[];\n operator: string;\n target: readonly number[];\n wildcard: boolean;\n};\nconst pythonSeriesRequirementMatches = ({\n current,\n operator,\n target,\n wildcard,\n}: PythonSeriesRequirementOptions) => {\n const prefixCovers = (prefix: readonly number[]) =>\n prefix.length <= 2 &&\n prefix.every((part, index) => current.at(index) === part);\n const prefixOverlaps =\n target.slice(0, 2).every((part, index) => current.at(index) === part) &&\n target.slice(3).every((part) => part === 0);\n if (wildcard) {\n if (operator === \"==\") return prefixCovers(target);\n if (operator === \"!=\") return !prefixOverlaps;\n return false;\n }\n const minimumComparison = compareRelease(current, target);\n const seriesComparison = compareRelease(\n current.slice(0, 2),\n target.slice(0, 2),\n );\n switch (operator) {\n case \"==\":\n return false;\n case \"!=\":\n return !(\n seriesComparison === 0 && target.slice(3).every((part) => part === 0)\n );\n case \">=\":\n return minimumComparison >= 0;\n case \">\":\n return minimumComparison > 0;\n case \"<=\":\n case \"<\":\n return seriesComparison < 0;\n case \"~=\":\n return (\n target.length >= 2 &&\n minimumComparison >= 0 &&\n prefixCovers(target.slice(0, -1))\n );\n default:\n return false;\n }\n};\n\n/** Evaluate final-release Python constraints against the complete selected version set. */\nconst pythonRequirementMatches = (requirement: unknown, version: string) => {\n if (typeof requirement !== \"string\" || requirement.trim() === \"\")\n return false;\n const current = version.split(\".\").map(Number);\n return requirement.split(\",\").every((clause) => {\n const match = /^(~=|==|!=|<=|>=|<|>)\\s*(\\d+(?:\\.\\d+)*)(\\.\\*)?$/.exec(\n clause.trim(),\n );\n if (match === null) return false;\n const operator = match[1];\n const release = match[2];\n if (release === undefined || operator === undefined) return false;\n const target = release.split(\".\").map(Number);\n if (current.length === 2)\n return pythonSeriesRequirementMatches({\n current,\n operator,\n target,\n wildcard: match[3] !== undefined,\n });\n const comparison = compareRelease(current, target);\n if (match[3] !== undefined) {\n if (operator !== \"==\" && operator !== \"!=\") return false;\n const prefix = target.every(\n (part, index) => (current.at(index) ?? 0) === part,\n );\n return operator === \"==\" ? prefix : !prefix;\n }\n switch (operator) {\n case \"==\":\n return comparison === 0;\n case \"!=\":\n return comparison !== 0;\n case \"<=\":\n return comparison <= 0;\n case \">=\":\n return comparison >= 0;\n case \"<\":\n return comparison < 0;\n case \">\":\n return comparison > 0;\n case \"~=\": {\n if (target.length < 2) return false;\n const prefix = target.slice(0, -1);\n return (\n comparison >= 0 &&\n prefix.every((part, index) => (current.at(index) ?? 0) === part)\n );\n }\n default:\n return false;\n }\n });\n};\n\n/** Check runtime declarations only in the files that declare or configure them. */\nexport const checkRuntimeFile = ({\n file,\n text,\n policy,\n trackedFiles,\n readFile,\n repository,\n onDelegated,\n dynamicSelectors = [],\n onDynamicSelector,\n rustExceptions = [],\n engineFloors = [],\n onEngineFloor,\n}: CheckRuntimeFileOptions): RuntimeDiagnostic[] => {\n const diagnostics: RuntimeDiagnostic[] = checkRustReferences({\n type: \"file\",\n file,\n text,\n rust: policy.rust,\n exceptions: rustExceptions,\n });\n const name = path.posix.basename(file);\n const lines = text.split(/\\r?\\n/);\n type RuntimeDiagnosticOptions = Pick<\n RuntimeDiagnostic,\n \"rule\" | \"line\" | \"message\"\n >;\n const add = ({ rule, line, message }: RuntimeDiagnosticOptions) => {\n diagnostics.push({ rule, path: file, line, message });\n };\n let currentLocation: string | undefined;\n const dynamic = (value: unknown) =>\n typeof value === \"string\" && value.includes(\"$\");\n const authorizeDynamic = (\n kind: DynamicSelector[\"kind\"],\n line: number,\n at = currentLocation,\n ) => {\n const matches = dynamicSelectors.filter(\n (entry) =>\n entry.path === file &&\n entry.kind === kind &&\n (entry.at !== undefined ? entry.at === at : entry.line === line),\n );\n if (matches.length !== 1) return false;\n const entry = matches.at(0);\n if (entry === undefined) return false;\n onDynamicSelector?.(entry);\n return true;\n };\n const lineOf = (key: string) =>\n Math.max(1, lines.findIndex((line) => line.includes(key)) + 1);\n type RuntimePinOptions = {\n rule: RuntimeRule;\n value: unknown;\n expected: string;\n label: string;\n line?: number;\n selector?: \"node\" | undefined;\n };\n const pin = ({\n rule,\n value,\n expected,\n label,\n line = 1,\n selector,\n }: RuntimePinOptions) => {\n let matches =\n value === expected ||\n (rule === \"rust-version\" &&\n rustExceptions.some((entry) => entry.pin === value));\n if (selector === \"node\") matches = nodeSelectorMatches(value, expected);\n else if (label.includes(\"python\"))\n matches = pythonSelectorMatches(value, expected);\n if (!matches)\n add({\n rule,\n line,\n message: `${label} must be ${expected}, found ${String(value)}`,\n });\n };\n const toml = (rule: RuntimeRule) => {\n try {\n return parseToml(text);\n } catch {\n add({\n rule,\n line: 1,\n message: \"invalid TOML\",\n });\n return undefined;\n }\n };\n const versions = {\n ...policy.packages,\n ...Object.fromEntries(\n Object.entries(policy.packages).map(([tool, version]) => [\n `npm:${tool}`,\n version,\n ]),\n ),\n bun: policy.bun,\n node: policy.node,\n nodejs: policy.node,\n python: policy.python,\n rust: policy.rust,\n \"core:node\": policy.node,\n \"core:python\": policy.python,\n \"core:rust\": policy.rust,\n \"core:bun\": policy.bun,\n };\n const nodeTools = new Set([\"node\", \"nodejs\", \"core:node\"]);\n if (name === \".bun-version\")\n pin({\n rule: \"bun-pins\",\n value: text.trim(),\n expected: policy.bun,\n label: name,\n });\n if (name === \".node-version\" || name === \".nvmrc\")\n pin({\n rule: \"node-version\",\n selector: \"node\",\n value: text.trim(),\n expected: policy.node,\n label: name,\n });\n if (name === \".python-version\")\n pin({\n rule: \"python-version\",\n value: text.trim(),\n expected: policy.python,\n label: name,\n });\n const firstContent = lines.find(\n (line) => line.trim() !== \"\" && !line.trimStart().startsWith(\"#\"),\n );\n const rustToml =\n name === \"rust-toolchain.toml\" ||\n (name === \"rust-toolchain\" && firstContent?.trimStart().startsWith(\"[\"));\n if (name === \"rust-toolchain\" && !rustToml)\n pin({\n rule: \"rust-version\",\n value: text.trim(),\n expected: policy.rust,\n label: name,\n });\n if (rustToml) {\n const parsed = toml(\"rust-version\");\n if (parsed !== undefined) {\n const toolchain = parsed[\"toolchain\"];\n pin({\n rule: \"rust-version\",\n value: record(toolchain) ? toolchain[\"channel\"] : undefined,\n expected: policy.rust,\n label: \"Rust channel\",\n line: lineOf(\"channel\"),\n });\n }\n }\n if (name === \"Cargo.toml\") {\n const parsed = toml(\"rust-version\");\n const rustFloor = (value: unknown) => {\n const parts =\n typeof value === \"string\" &&\n /^(?:0|[1-9]\\d*)(?:\\.(?:0|[1-9]\\d*)){0,2}$/.test(value)\n ? value.split(\".\").map(Number)\n : undefined;\n if (\n parts === undefined ||\n !parts.every(Number.isSafeInteger) ||\n compareRelease(parts, policy.rust.split(\".\").map(Number)) > 0\n )\n add({\n rule: \"rust-version\",\n line: lineOf(\"rust-version\"),\n message: `Cargo rust-version must be a bare support floor at or below Rust ${policy.rust}`,\n });\n };\n const readManifest = (candidate: string) => {\n if (candidate === file) return parsed;\n if (!trackedFiles.has(candidate)) return undefined;\n try {\n return parseToml(readFile(candidate) ?? \"\");\n } catch {\n return undefined;\n }\n };\n if (parsed !== undefined) {\n const workspace = parsed[\"workspace\"];\n const defaults = record(workspace) ? workspace[\"package\"] : undefined;\n if (record(defaults) && defaults[\"rust-version\"] !== undefined)\n rustFloor(defaults[\"rust-version\"]);\n const pkg = parsed[\"package\"];\n const version = record(pkg) ? pkg[\"rust-version\"] : undefined;\n if (version !== undefined) {\n if (!record(version)) rustFloor(version);\n else {\n let inherited: unknown;\n if (version[\"workspace\"] === true && record(pkg)) {\n const explicit = pkg[\"workspace\"];\n let directory = path.posix.dirname(file);\n const explicitPath =\n typeof explicit === \"string\" &&\n !explicit.includes(\"\\\\\") &&\n !explicit.includes(\":\") &&\n !explicit.includes(\"${{\") &&\n !path.posix.isAbsolute(explicit)\n ? path.posix.normalize(path.posix.join(directory, explicit))\n : undefined;\n if (\n explicit === undefined ||\n (explicitPath !== undefined &&\n explicitPath !== \"..\" &&\n !explicitPath.startsWith(\"../\"))\n ) {\n if (explicitPath !== undefined) directory = explicitPath;\n while (true) {\n const owner = readManifest(\n path.posix.join(directory, \"Cargo.toml\"),\n );\n const table = owner?.[\"workspace\"];\n if (record(table)) {\n const fields = table[\"package\"];\n inherited = record(fields)\n ? fields[\"rust-version\"]\n : undefined;\n break;\n }\n if (explicit !== undefined || directory === \".\") break;\n directory = path.posix.dirname(directory);\n }\n }\n }\n rustFloor(inherited);\n }\n }\n }\n }\n if (name === \"Pipfile\") {\n const parsed = toml(\"python-version\");\n const requires = parsed?.[\"requires\"];\n if (record(requires)) {\n const minor = requires[\"python_version\"];\n if (\n minor !== undefined &&\n minor !== policy.python.split(\".\").slice(0, 2).join(\".\")\n )\n add({\n rule: \"python-version\",\n line: lineOf(\"python_version\"),\n message: `Pipfile python_version must select Python ${policy.python}`,\n });\n const full = requires[\"python_full_version\"];\n if (\n full !== undefined &&\n !(\n typeof full === \"string\" &&\n /^\\d+\\.\\d+\\.\\d+$/.test(full) &&\n pythonSelectorMatches(full, policy.python)\n )\n )\n add({\n rule: \"python-version\",\n line: lineOf(\"python_full_version\"),\n message: `Pipfile python_full_version must select Python ${policy.python}`,\n });\n }\n }\n if (name === \"pyproject.toml\" || name === \"uv.toml\") {\n const parsed = toml(\"python-version\");\n if (parsed !== undefined) {\n const project = parsed[\"project\"];\n if (record(project) && project[\"requires-python\"] !== undefined)\n if (\n !pythonRequirementMatches(project[\"requires-python\"], policy.python)\n )\n add({\n rule: \"python-version\",\n line: lineOf(\"requires-python\"),\n message: `requires-python must include Python ${policy.python}; unsupported constraints must use final-release version specifiers`,\n });\n const tool = parsed[\"tool\"];\n const configuredUv = record(tool) ? tool[\"uv\"] : undefined;\n const uv = name === \"uv.toml\" ? parsed : configuredUv;\n if (record(uv) && uv[\"python\"] !== undefined)\n pin({\n rule: \"python-version\",\n value: uv[\"python\"],\n expected: policy.python,\n label: \"uv python\",\n line: lineOf(\"python\"),\n });\n }\n }\n if (isMiseConfigPath(file)) {\n const parsed = toml(\"runtime-manager\");\n const tools = parsed?.[\"tools\"];\n if (record(tools)) {\n for (const [tool, expected] of Object.entries(versions)) {\n const configured = tools[tool];\n if (configured !== undefined)\n pin({\n rule:\n tool === \"rust\" || tool === \"core:rust\"\n ? \"rust-version\"\n : \"runtime-manager\",\n value: record(configured) ? configured[\"version\"] : configured,\n expected,\n selector: nodeTools.has(tool) ? \"node\" : undefined,\n label: `mise ${tool}`,\n line: lineOf(tool),\n });\n }\n }\n }\n if (name === \".tool-versions\") {\n lines.forEach((line, index) => {\n const fields = line.replace(/#.*$/, \"\").trim().split(/\\s+/);\n const tool = fields.at(0);\n if (tool === undefined || !(tool in versions)) return;\n const expected = Object.entries(versions).find(\n ([key]) => key === tool,\n )?.[1];\n if (expected !== undefined)\n pin({\n rule:\n tool === \"rust\" || tool === \"core:rust\"\n ? \"rust-version\"\n : \"runtime-manager\",\n value: fields.slice(1).join(\" \"),\n expected,\n selector: nodeTools.has(tool) ? \"node\" : undefined,\n label: `.tool-versions ${tool}`,\n line: index + 1,\n });\n });\n }\n type RuntimeImageOptions = {\n image: unknown;\n line: number;\n label: string;\n at?: string | undefined;\n };\n const checkRuntimeImage = ({\n image,\n line,\n label,\n at,\n }: RuntimeImageOptions) => {\n const unknownRuntime = () => {\n const rustImage =\n typeof image === \"string\" &&\n /^rust(?=:|@|$)/i.test(canonicalDockerRuntime(image));\n if (!rustImage && dynamic(image) && authorizeDynamic(\"image\", line, at))\n return;\n add({\n rule: rustImage ? \"rust-version\" : \"runtime-docker\",\n line,\n message: rustImage\n ? `cannot determine ${label} Rust release; use a static exact pin`\n : `cannot determine ${label} runtime; use a static image or a scoped dynamicSelectors declaration`,\n });\n };\n if (typeof image !== \"string\") {\n unknownRuntime();\n return;\n }\n const canonical = canonicalDockerRuntime(image);\n // Variable defaults may contain reference delimiters; preserve offsets while classifying.\n const structuralImage = canonical.replace(\n /\\$\\{[^}]*\\}|\\$[A-Za-z_][A-Za-z_\\d]*/g,\n (variable) => \"x\".repeat(variable.length),\n );\n const digestSeparator = structuralImage.indexOf(\"@\");\n const reference =\n digestSeparator < 0 ? canonical : canonical.slice(0, digestSeparator);\n const structuralReference =\n digestSeparator < 0\n ? structuralImage\n : structuralImage.slice(0, digestSeparator);\n const managedFamily = /^(node|python|rust|oven\\/bun)(?=:|$)/i.exec(\n structuralReference,\n )?.[1];\n const tagSeparator =\n managedFamily === undefined\n ? structuralReference.lastIndexOf(\":\")\n : structuralReference.indexOf(\":\", managedFamily.length);\n const hasTag =\n managedFamily === undefined\n ? tagSeparator > structuralReference.lastIndexOf(\"/\")\n : tagSeparator !== -1;\n const imageRepository = hasTag\n ? reference.slice(0, tagSeparator)\n : reference;\n if (imageRepository.length === 0 || imageRepository.includes(\"$\")) {\n unknownRuntime();\n return;\n }\n if (!/^(node|python|rust|oven\\/bun)$/i.test(imageRepository)) return;\n const tool = imageRepository.toLowerCase();\n let imageRule: RuntimeRule = \"runtime-docker\";\n if (tool === \"rust\") imageRule = \"rust-version\";\n else if (tool === \"oven/bun\") imageRule = \"bun-pins\";\n if (image.includes(\"$\")) {\n unknownRuntime();\n return;\n }\n const digest =\n digestSeparator < 0 ? undefined : canonical.slice(digestSeparator + 1);\n if (digest !== undefined && !/^sha256:[a-fA-F\\d]{64}$/.test(digest)) {\n add({\n rule: imageRule,\n line,\n message: `${label} ${tool} digest must be sha256 followed by 64 hexadecimal characters`,\n });\n return;\n }\n const tag = hasTag ? reference.slice(tagSeparator + 1) : undefined;\n const variantSuffix =\n tool === \"oven/bun\"\n ? /-(?:alpine|slim|debian)$/\n : /-(?:alpine(?:\\d+(?:\\.\\d+)*)?|(?:bookworm|bullseye|trixie|buster)(?:-slim)?|slim)$/;\n // Strip only supported image variants; prerelease qualifiers remain invalid pins.\n const version =\n tool === \"rust\" && tag !== undefined\n ? rustImageVersion(tag)\n : tag?.replace(variantSuffix, \"\");\n let expected = policy.bun;\n if (tool === \"node\") expected = policy.node;\n else if (tool === \"python\") expected = policy.python;\n else if (tool === \"rust\") expected = policy.rust;\n if (digest !== undefined) {\n if (\n version === undefined ||\n !/^(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)$/.test(version)\n ) {\n add({\n rule: imageRule,\n line,\n message: `${label} ${tool} digest requires an exact stable patch tag matching ${expected}`,\n });\n return;\n }\n if (tool === \"node\" && trackedFiles.has(\".node-version\")) {\n const trackedNode = readFile(\".node-version\")?.trim();\n if (trackedNode !== version) {\n add({\n rule: \"runtime-docker\",\n line,\n message: `${label} node digest tag must match tracked .node-version, found ${version}`,\n });\n return;\n }\n }\n }\n pin({\n rule: imageRule,\n value: version,\n expected,\n selector: tool === \"node\" ? \"node\" : undefined,\n label: `${label} ${tool}`,\n line,\n });\n };\n if (isDockerDefinitionPath(file)) {\n const variables = new Map<string, string>();\n const escape = /^\\s*#\\s*escape\\s*=\\s*([\\\\`])\\s*$/m.exec(text)?.[1] ?? \"\\\\\";\n const continuation = new RegExp(`${escape === \"`\" ? \"`\" : \"\\\\\\\\\"}\\\\s*$`);\n const stages = new Set<string>();\n let argumentScope: \"global\" | \"stage\" = \"global\";\n const heredocs: { delimiter: string; stripTabs: boolean; line: number }[] =\n [];\n let instruction = \"\";\n let startLine = 1;\n let pendingRustRun: { source: string; line: number } | undefined;\n const checkRustCommand = (source: string, line: number) => {\n diagnostics.push(\n ...checkRustReferences({\n type: \"command\",\n file,\n source,\n line,\n rust: policy.rust,\n exceptions: rustExceptions,\n }),\n );\n };\n const expand = (value: string) => {\n for (let count = 0; count <= variables.size; count++) {\n const next = value.replace(\n /\\$(?:\\{([A-Za-z_][A-Za-z_\\d]*)\\}|([A-Za-z_][A-Za-z_\\d]*))/g,\n (reference, braced: string | undefined, plain: string | undefined) =>\n variables.get(braced ?? plain ?? \"\") ?? reference,\n );\n if (next === value) return next;\n value = next;\n }\n return value;\n };\n const collectHeredocs = (content: string, line: number) => {\n let quote: \"'\" | '\"' | undefined;\n for (let index = 0; index < content.length; index++) {\n const character = content.at(index);\n if (quote !== undefined) {\n if (character === quote) quote = undefined;\n else if (quote === '\"' && character === \"\\\\\") index++;\n continue;\n }\n if (character === \"\\\\\") {\n index++;\n continue;\n }\n if (character === \"'\" || character === '\"') {\n quote = character;\n continue;\n }\n if (\n character === \"#\" &&\n (index === 0 || /[\\s;&|()]/.test(content.at(index - 1) ?? \"\"))\n )\n break;\n if (character !== \"<\" || content.at(index + 1) !== \"<\") continue;\n if (content.at(index + 2) === \"<\") {\n index += 2;\n continue;\n }\n index += 2;\n const stripTabs = content.at(index) === \"-\";\n if (stripTabs) index++;\n while (/\\s/.test(content.at(index) ?? \"\")) index++;\n if (content.at(index) === \"#\") {\n add({\n rule: \"runtime-docker\",\n line,\n message: \"invalid Docker heredoc delimiter\",\n });\n break;\n }\n let delimiter = \"\";\n let delimiterQuote: \"'\" | '\"' | undefined;\n for (; index < content.length; index++) {\n const part = content.at(index);\n if (delimiterQuote !== undefined) {\n if (part === delimiterQuote) delimiterQuote = undefined;\n else if (\n delimiterQuote === '\"' &&\n part === \"\\\\\" &&\n /[$\"\\\\]/.test(content.at(index + 1) ?? \"\")\n )\n delimiter += content.at(++index);\n else delimiter += part;\n continue;\n }\n if (part === \"'\" || part === '\"') {\n delimiterQuote = part;\n continue;\n }\n if (part === \"\\\\\" && content.at(index + 1) !== undefined) {\n delimiter += content.at(++index);\n continue;\n }\n if (/[\\s;&|<>()]/.test(part ?? \"\")) break;\n delimiter += part;\n }\n if (delimiter !== \"\" && delimiterQuote === undefined)\n heredocs.push({ delimiter, stripTabs, line });\n else\n add({\n rule: \"runtime-docker\",\n line,\n message: \"invalid Docker heredoc delimiter\",\n });\n index--;\n }\n };\n const checkInstruction = (content: string, line: number) => {\n const argument = /^\\s*ARG\\s+([A-Za-z_][A-Za-z_\\d]*)(?:=(.*))?$/i.exec(\n content,\n );\n if (argument !== null) {\n if (argumentScope === \"stage\") return;\n const key = argument[1];\n const value = argument[2];\n if (key !== undefined && value !== undefined)\n variables.set(key, expand(value.replace(/^([\"'])(.*)\\1$/, \"$2\")));\n return;\n }\n const run = /^\\s*RUN\\s+(.+)$/i.exec(content);\n if (run !== null) {\n let source = run[1] ?? \"\";\n source = source.replace(/^(?:--\\S+\\s+)*/, \"\");\n if (source.startsWith(\"[\")) {\n try {\n const words: unknown = JSON.parse(source);\n if (\n Array.isArray(words) &&\n words.every((word: unknown) => typeof word === \"string\")\n ) {\n // Exec-form arguments are literal; only an explicit shell -c evaluates their contents.\n source = words\n .map((word) => `'${word.replaceAll(\"'\", \"'\\\\''\")}'`)\n .join(\" \");\n }\n } catch {\n // A leading bracket also starts a shell test; preserve shell form unless JSON proves exec form.\n }\n }\n const implicit = /^(<<-?(?:'[^']+'|\"[^\"]+\"|\\S+))(?:\\s+(.+))?$/.exec(\n source,\n );\n if (implicit !== null && implicit[2] === undefined)\n source = `sh ${source}`;\n collectHeredocs(content, line);\n if (heredocs.length > 0) pendingRustRun = { source, line };\n else checkRustCommand(source, line);\n return;\n }\n const environment = /^\\s*ENV\\s+(.+)$/i.exec(content);\n if (environment !== null) {\n const assignments = dockerEnvironmentAssignments({\n source: environment[1] ?? \"\",\n escape,\n });\n if (assignments === undefined) {\n add({\n rule: \"runtime-docker\",\n line,\n message: \"invalid Docker ENV assignments\",\n });\n return;\n }\n diagnostics.push(\n ...checkRustReferences({\n type: \"environment\",\n file,\n assignments,\n line,\n rust: policy.rust,\n exceptions: rustExceptions,\n }),\n );\n return;\n }\n if (/^\\s*COPY\\s+/i.test(content)) {\n collectHeredocs(content, line);\n return;\n }\n const from =\n /^\\s*FROM\\s+(?:--platform=\\S+\\s+)?(\\S+)(?:\\s+AS\\s+(\\S+))?/i.exec(\n content,\n );\n if (from === null || from[1] === undefined) return;\n argumentScope = \"stage\";\n const image = expand(from[1]);\n const stage = from[2]?.toLowerCase();\n const previousStage = stages.has(image.toLowerCase());\n if (stage !== undefined) stages.add(stage);\n if (previousStage) return;\n checkRuntimeImage({ image, line, label: \"FROM\" });\n };\n lines.forEach((line, index) => {\n const heredoc = heredocs.at(0);\n if (heredoc !== undefined) {\n if (pendingRustRun !== undefined) pendingRustRun.source += `\\n${line}`;\n if (\n (heredoc.stripTabs ? line.replace(/^\\t+/, \"\") : line) ===\n heredoc.delimiter\n )\n heredocs.shift();\n if (heredocs.length === 0 && pendingRustRun !== undefined) {\n checkRustCommand(pendingRustRun.source, pendingRustRun.line);\n pendingRustRun = undefined;\n }\n return;\n }\n if (line.trimStart().startsWith(\"#\")) return;\n if (instruction === \"\") startLine = index + 1;\n instruction += line.replace(continuation, \" \");\n if (continuation.test(line)) return;\n checkInstruction(instruction, startLine);\n instruction = \"\";\n });\n if (instruction !== \"\") checkInstruction(instruction, startLine);\n for (const heredoc of heredocs)\n add({\n rule: \"runtime-docker\",\n line: heredoc.line,\n message: `unterminated Docker heredoc ${heredoc.delimiter}`,\n });\n }\n if (isComposeDefinitionPath(file) || isKubernetesDefinitionPath(file)) {\n const lineCounter = new LineCounter();\n for (const containerDocument of parseAllDocuments(text, {\n lineCounter,\n merge: true,\n uniqueKeys: true,\n })) {\n const contents = containerDocument.contents;\n const declaredResource =\n isMap(contents) &&\n isScalar(contents.get(\"apiVersion\", true)) &&\n isScalar(contents.get(\"kind\", true));\n const recognizedContainer =\n isComposeDefinitionPath(file) || declaredResource;\n if (containerDocument.errors.length > 0) {\n if (recognizedContainer)\n add({\n rule: \"runtime-docker\",\n line: 1,\n message: \"invalid container YAML\",\n });\n continue;\n }\n try {\n const classified = containerDocumentImages(\n containerDocument.toJS({ maxAliasCount: 100 }),\n file,\n );\n for (const entry of classified?.images ?? []) {\n const node = containerDocument.getIn(entry.path, true);\n const line =\n (isMap(node) || isScalar(node) || isSeq(node) || isAlias(node)) &&\n node.range !== undefined &&\n node.range !== null\n ? lineCounter.linePos(node.range[0]).line\n : 1;\n checkRuntimeImage({\n image: entry.image,\n line,\n at: entry.path.join(\".\"),\n label:\n classified?.ecosystem === \"docker-compose\"\n ? \"Compose image\"\n : \"Kubernetes image\",\n });\n }\n } catch {\n if (recognizedContainer)\n add({\n rule: \"runtime-docker\",\n line: 1,\n message: \"invalid container YAML aliases\",\n });\n }\n }\n }\n const automationKind = githubAutomationFileKind(file);\n if (automationKind === undefined) return diagnostics;\n const document = parseDocument(text, { uniqueKeys: true, merge: true });\n if (document.errors.length > 0) {\n add({\n rule: \"runtime-workflow\",\n line: 1,\n message: \"invalid workflow YAML\",\n });\n return diagnostics;\n }\n const nodeLine = (node: unknown) => {\n if (!record(node) || !Array.isArray(node[\"range\"])) return 1;\n const offset: unknown = node[\"range\"].at(0);\n return typeof offset === \"number\"\n ? text.slice(0, offset).split(\"\\n\").length\n : 1;\n };\n type SparseCheckout =\n | { mode: \"all\" }\n | { mode: \"files\"; paths: ReadonlySet<string> }\n | { mode: \"invalid\" }\n | { mode: \"dynamic\" }\n | { mode: \"mixed\"; paths: ReadonlySet<string> };\n type CheckoutBinding = {\n path: string;\n sparse: SparseCheckout;\n dynamicSource: boolean;\n } & (\n | { source: \"tracked\" }\n | { source: \"untrusted\"; reason: string; line: number }\n | { source: \"delegated\"; ref: string }\n );\n let checkoutBindings: CheckoutBinding[] = [];\n let checkoutDestinations = new Map<string, number>();\n let unknownCheckoutDestination = false;\n let unreviewableCheckoutSource = false;\n const staticRepositoryPath = (value: unknown): value is string =>\n typeof value === \"string\" &&\n value !== \"\" &&\n !value.includes(\"${{\") &&\n !value.includes(\"\\\\\") &&\n !value.includes(\":\") &&\n !path.posix.isAbsolute(value) &&\n !value.split(\"/\").includes(\"..\");\n const normalizeCheckoutPath = (prefix: string) =>\n path.posix.normalize(prefix).replace(/\\/$/, \"\") || \".\";\n type RuntimeReferenceOptions = {\n value: unknown;\n tool: \"node\" | \"python\" | \"bun\";\n line: number;\n };\n const checkoutProvidersFor = (selector: string | undefined) => {\n if (selector === undefined) return checkoutBindings;\n let deepest: CheckoutBinding | undefined;\n for (const entry of checkoutBindings) {\n if (\n entry.path !== \".\" &&\n selector !== entry.path &&\n !selector.startsWith(`${entry.path}/`)\n )\n continue;\n if (\n deepest === undefined ||\n (entry.path !== \".\" &&\n (deepest.path === \".\" || entry.path.length > deepest.path.length))\n )\n deepest = entry;\n }\n return checkoutBindings.filter((entry) => entry.path === deepest?.path);\n };\n const hasAmbiguousCheckoutWriters = (\n selector: string | undefined,\n providers: readonly CheckoutBinding[],\n ) => {\n if (providers.length > 0)\n return providers.some(\n (entry) => (checkoutDestinations.get(entry.path) ?? 0) > 1,\n );\n // A selector before checkout cannot borrow a tracked shadow of an ambiguous destination.\n return [...checkoutDestinations].some(\n ([prefix, count]) =>\n count > 1 &&\n (selector === undefined ||\n prefix === \".\" ||\n selector === prefix ||\n selector.startsWith(`${prefix}/`)),\n );\n };\n const checkReference = ({ value, tool, line }: RuntimeReferenceOptions) => {\n const selectors = {\n node: [\".node-version\", \".nvmrc\"],\n python: [\".python-version\"],\n bun: [\"package.json\"],\n };\n const allowed = selectors[tool];\n const rule = tool === \"bun\" ? \"bun-pins\" : \"runtime-workflow\";\n const selector = staticRepositoryPath(value)\n ? path.posix.normalize(value)\n : undefined;\n const providers = checkoutProvidersFor(selector);\n const binding = selector === undefined ? undefined : providers.at(-1);\n const dynamicSource = providers.some((entry) => entry.dynamicSource);\n const sparseFailure = providers.find((entry) => {\n if (entry.sparse.mode === \"invalid\") return true;\n if (entry.sparse.mode !== \"files\" && entry.sparse.mode !== \"mixed\")\n return false;\n if (selector === undefined) return true;\n const selectedFile =\n entry.path === \".\"\n ? selector\n : path.posix.relative(entry.path, selector);\n return !entry.sparse.paths.has(selectedFile);\n });\n if (sparseFailure !== undefined) {\n let missingFile = \"the selected version file\";\n if (selector !== undefined)\n missingFile =\n sparseFailure.path === \".\"\n ? selector\n : path.posix.relative(sparseFailure.path, selector);\n add({\n rule,\n line,\n message: `checkout sparse-checkout must explicitly list ${missingFile} without invalid literal patterns`,\n });\n return;\n }\n if (selector === undefined) {\n if (\n tool === \"bun\" &&\n dynamic(value) &&\n !unreviewableCheckoutSource &&\n authorizeDynamic(\"bun-source\", line)\n )\n return;\n add({\n rule,\n line,\n message: `setup-${tool} must reference a tracked ${allowed.join(\" or \")}`,\n });\n return;\n }\n if (\n unknownCheckoutDestination ||\n hasAmbiguousCheckoutWriters(selector, providers)\n ) {\n if (\n tool === \"bun\" &&\n dynamicSource &&\n !unreviewableCheckoutSource &&\n authorizeDynamic(\"bun-source\", line)\n )\n return;\n add({\n rule,\n line,\n message: `setup-${tool} version-file selector has untrusted checkout provenance: checkout destinations must be static and have exactly one writer`,\n });\n return;\n }\n if (binding?.source === \"untrusted\") {\n if (\n tool === \"bun\" &&\n dynamicSource &&\n !unreviewableCheckoutSource &&\n authorizeDynamic(\"bun-source\", line)\n )\n return;\n add({\n rule,\n line: binding.line,\n message: `setup-${tool} version-file selector cannot use this checkout: ${binding.reason}`,\n });\n return;\n }\n const target =\n binding === undefined || binding.path === \".\"\n ? selector\n : path.posix.relative(binding.path, selector);\n if (\n !allowed.includes(path.posix.basename(target)) ||\n (binding?.source !== \"delegated\" && !trackedFiles.has(target))\n ) {\n add({\n rule,\n line,\n message: `setup-${tool} must reference a tracked ${allowed.join(\" or \")}`,\n });\n return;\n }\n if (\n binding !== undefined &&\n (binding.sparse.mode === \"dynamic\" || binding.sparse.mode === \"mixed\")\n ) {\n if (\n tool !== \"bun\" ||\n unreviewableCheckoutSource ||\n !authorizeDynamic(\"bun-source\", line)\n ) {\n add({\n rule,\n line,\n message: `checkout sparse-checkout must explicitly list ${target} without dynamic, glob, or negation patterns`,\n });\n return;\n }\n }\n if (binding?.source === \"delegated\") {\n onDelegated?.({\n path: file,\n line,\n tool,\n selector,\n checkoutPath: binding.path,\n ref: binding.ref,\n });\n return;\n }\n const content = readFile(target);\n if (tool === \"bun\") {\n try {\n const manifest: unknown = JSON.parse(content ?? \"\");\n pin({\n rule,\n value: record(manifest) ? manifest[\"packageManager\"] : undefined,\n expected: `bun@${policy.bun}`,\n label: \"setup-bun version file packageManager\",\n line,\n });\n } catch {\n add({\n rule,\n line,\n message:\n \"bun-version-file must reference a readable package.json object\",\n });\n }\n return;\n }\n pin({\n rule,\n value: content?.trim(),\n expected: policy[tool],\n selector: tool === \"node\" ? \"node\" : undefined,\n label: `setup-${tool} version file`,\n line,\n });\n };\n const resolveNode = (node: unknown) => {\n const visited = new Set<unknown>();\n while (isAlias(node)) {\n if (visited.has(node)) throw new Error(\"cyclic YAML alias\");\n visited.add(node);\n node = node.resolve(document);\n }\n return node;\n };\n const approvedActions = new Map(\n Object.entries(policy.actions).map(([action, approved]) => [\n action.toLowerCase(),\n approved,\n ]),\n );\n const mergedMaps = (node: unknown) => {\n node = resolveNode(node);\n if (!isMap(node)) return [];\n const maps: unknown[] = [];\n for (const pair of node.items) {\n if (\n !isScalar(pair.key) ||\n typeof pair.key.value !== \"symbol\" ||\n pair.key.source !== \"<<\"\n )\n continue;\n const merge = resolveNode(pair.value);\n maps.push(...(isSeq(merge) ? merge.items : [merge]));\n }\n return maps;\n };\n const keysOf = (node: unknown, visited = new Set<unknown>()): Set<string> => {\n node = resolveNode(node);\n if (!isMap(node)) return new Set();\n if (visited.has(node)) throw new Error(\"cyclic YAML merge\");\n const next = new Set(visited);\n next.add(node);\n const keys = new Set(\n node.items.flatMap((pair) =>\n isScalar(pair.key) && typeof pair.key.value === \"string\"\n ? [pair.key.value]\n : [],\n ),\n );\n for (const merged of mergedMaps(node))\n for (const key of keysOf(merged, next)) keys.add(key);\n return keys;\n };\n type SourceMapOptions = {\n node: unknown;\n key: string;\n visited?: ReadonlySet<unknown>;\n };\n const sourceMap = ({\n node,\n key,\n visited = new Set(),\n }: SourceMapOptions): unknown => {\n node = resolveNode(node);\n if (!isMap(node)) return undefined;\n if (node.has(key)) return node;\n if (visited.has(node)) throw new Error(\"cyclic YAML merge\");\n const next = new Set(visited);\n next.add(node);\n for (const merged of mergedMaps(node)) {\n const source = sourceMap({ node: merged, key, visited: next });\n if (source !== undefined) return source;\n }\n return undefined;\n };\n const getNode = (node: unknown, key: string) => {\n const source = sourceMap({ node, key });\n return isMap(source) ? resolveNode(source.get(key, true)) : undefined;\n };\n const actionInputs = new Map<unknown, Map<string, unknown>>();\n const inputsOf = (node: unknown) => {\n node = resolveNode(node);\n const cached = actionInputs.get(node);\n if (cached !== undefined) return cached;\n const options = getNode(node, \"with\");\n const inputs = new Map<string, unknown>();\n for (const key of keysOf(options)) {\n const folded = key.toUpperCase();\n const value = getNode(options, key);\n if (inputs.has(folded))\n add({\n rule: \"action-pins\",\n line: nodeLine(value),\n message: `action input ${key} collides after case-folding`,\n });\n if (\n /(?:^|-)VERSION(?:-FILE)?$/.test(folded) &&\n key !== folded.toLowerCase()\n )\n add({\n rule: \"action-pins\",\n line: nodeLine(value),\n message: `selector input ${key} must use canonical lowercase casing`,\n });\n inputs.set(folded, value);\n }\n actionInputs.set(node, inputs);\n return inputs;\n };\n const getInput = (node: unknown, key: string) =>\n inputsOf(node).get(key.toUpperCase());\n const expressionAt = (value: string, start: number) => {\n if (!value.startsWith(\"${{\", start)) return undefined;\n let quote: \"'\" | '\"' | undefined;\n for (let index = start + 3; index < value.length; index++) {\n const character = value.at(index);\n if (quote !== undefined) {\n if (character === quote) {\n if (quote === \"'\" && value.at(index + 1) === \"'\") index++;\n else quote = undefined;\n } else if (quote === '\"' && character === \"\\\\\") index++;\n continue;\n }\n if (character === \"'\" || character === '\"') quote = character;\n else if (value.startsWith(\"${{\", index)) return undefined;\n else if (character === \"}\" && value.at(index + 1) === \"}\")\n return { body: value.slice(start + 3, index).trim(), end: index + 2 };\n }\n return undefined;\n };\n const dynamicRefBody = (value: unknown) => {\n if (typeof value !== \"string\") return undefined;\n const expression = expressionAt(value, 0);\n return expression?.end === value.length ? expression.body : undefined;\n };\n const sparseEntryIsValid = (entry: string) => {\n let literalPath = \"\";\n let position = 0;\n while (position < entry.length) {\n const start = entry.indexOf(\"${{\", position);\n const literal = entry.slice(position, start < 0 ? entry.length : start);\n if (/[!$*?[\\]\\\\:]/.test(literal) || literal.split(\"/\").includes(\"..\"))\n return false;\n literalPath += literal;\n if (start < 0) break;\n const expression = expressionAt(entry, start);\n if (expression === undefined || expression.body === \"\") return false;\n literalPath += \"expression\";\n position = expression.end;\n }\n return staticRepositoryPath(literalPath);\n };\n const checkoutPrefixOf = (node: unknown) => {\n const destination = getInput(node, \"path\");\n if (destination === undefined) return \".\";\n return isScalar(destination) ? destination.value : undefined;\n };\n const sparseCheckoutOf = (node: unknown): SparseCheckout => {\n const sparseKeys = [...inputsOf(node).keys()].filter((key) =>\n key.startsWith(\"SPARSE-CHECKOUT\"),\n );\n if (sparseKeys.length === 0) return { mode: \"all\" };\n if (\n sparseKeys.some(\n (key) =>\n key !== \"SPARSE-CHECKOUT\" && key !== \"SPARSE-CHECKOUT-CONE-MODE\",\n )\n )\n return { mode: \"invalid\" };\n const value = getInput(node, \"sparse-checkout\");\n const cone = getInput(node, \"sparse-checkout-cone-mode\");\n if (\n !isScalar(value) ||\n typeof value.value !== \"string\" ||\n (cone !== undefined &&\n (!isScalar(cone) ||\n (cone.value !== true &&\n cone.value !== false &&\n cone.value !== \"true\" &&\n cone.value !== \"false\")))\n )\n return { mode: \"invalid\" };\n const paths = value.value\n .split(/\\r?\\n/)\n .map((entry) => entry.trim().replace(/^\\//, \"\"))\n .filter((entry) => entry !== \"\");\n if (paths.length === 0 || paths.some((entry) => !sparseEntryIsValid(entry)))\n return { mode: \"invalid\" };\n const literalPaths = new Set(paths.filter((entry) => !dynamic(entry)));\n if (paths.some(dynamic)) {\n if (literalPaths.size === 0) return { mode: \"dynamic\" };\n return { mode: \"mixed\", paths: literalPaths };\n }\n return { mode: \"files\", paths: literalPaths };\n };\n let currentEngineFloor: ResolvedEngineFloor | undefined;\n const checkAction = (node: unknown) => {\n node = resolveNode(node);\n if (!isMap(node)) return;\n inputsOf(node);\n const uses = getNode(node, \"uses\");\n if (uses === undefined) return;\n const line = nodeLine(uses);\n if (!isScalar(uses) || typeof uses.value !== \"string\") {\n add({\n rule: \"action-pins\",\n line,\n message: \"action uses must be a string containing a full commit SHA\",\n });\n return;\n }\n const value = uses.value;\n if (value.startsWith(\"$/\")) {\n if (\n value.length === 2 ||\n /\\s/.test(value) ||\n value.includes(\"@\") ||\n value.includes(\"${{\") ||\n value.includes(\"\\\\\") ||\n value.split(\"/\").includes(\"..\")\n )\n add({\n rule: \"action-pins\",\n line,\n message:\n \"self-repository actions must use a static repository path without a ref suffix\",\n });\n return;\n }\n if (value.startsWith(\"./\")) {\n const selector = staticRepositoryPath(value)\n ? path.posix.normalize(value)\n : undefined;\n const providers = checkoutProvidersFor(selector);\n const binding = selector === undefined ? undefined : providers.at(-1);\n if (\n selector === undefined ||\n unknownCheckoutDestination ||\n (binding !== undefined && binding.source !== \"tracked\") ||\n hasAmbiguousCheckoutWriters(selector, providers)\n )\n add({\n rule: \"action-pins\",\n line,\n message:\n \"local actions require an unambiguous checkout of the current source snapshot\",\n });\n return;\n }\n if (value.startsWith(\"docker://\")) {\n add({\n rule: \"action-pins\",\n line,\n message: \"Docker image actions require a reasoned action-pins opt-out\",\n });\n checkRuntimeImage({\n image: value.slice(\"docker://\".length),\n line,\n label: \"Docker action image\",\n });\n return;\n }\n const remote = /^([^./][^\\s@]*\\/[^\\s@]+)@([^\\s]+)$/.exec(value);\n if (remote === null) {\n add({\n rule: \"action-pins\",\n line,\n message: \"remote actions must use a full commit SHA\",\n });\n return;\n }\n const action = remote[1]?.toLowerCase();\n const ref = remote[2];\n const approved =\n action === undefined\n ? undefined\n : (approvedActions.get(action) ??\n approvedActions.get(action.split(\"/\").slice(0, 2).join(\"/\")));\n if (ref === undefined || !/^[a-f0-9]{40}$/.test(ref))\n add({\n rule: \"action-pins\",\n line,\n message: \"remote actions must use a full commit SHA\",\n });\n else if (approved !== undefined && ref !== approved.sha)\n add({\n rule: \"action-pins\",\n line,\n message: `${action} must use ${approved.sha}`,\n });\n const declaration = sourceMap({ node, key: \"uses\" });\n const comment =\n uses.comment ??\n (isMap(declaration) ? declaration.comment : undefined) ??\n \"\";\n if (\n approved !== undefined &&\n !comment.trim().split(/\\s+/).includes(approved.version)\n )\n add({\n rule: \"action-pins\",\n line,\n message: `${action} requires a # ${approved.version} version comment`,\n });\n if (action === \"actions/checkout\") {\n const checkoutRepository = getInput(node, \"repository\");\n const checkoutRef = getInput(node, \"ref\");\n const prefix = checkoutPrefixOf(node);\n const clean = getInput(node, \"clean\");\n const cleanIsResolved =\n clean === undefined || (isScalar(clean) && !dynamic(clean.value));\n let repo: unknown;\n if (checkoutRepository !== undefined)\n repo = isScalar(checkoutRepository) ? checkoutRepository.value : null;\n const self =\n repo === undefined ||\n repo === \"${{ github.repository }}\" ||\n (typeof repo === \"string\" &&\n repository !== undefined &&\n repo.toLowerCase() === repository.toLowerCase());\n const workflowSource =\n repo === \"${{ job.workflow_repository }}\" &&\n isScalar(checkoutRef) &&\n checkoutRef.value === \"${{ job.workflow_sha }}\";\n const triggers = getNode(document.contents, \"on\");\n const events = (() => {\n if (isMap(triggers)) return [...keysOf(triggers)];\n if (isSeq(triggers))\n return triggers.items.map((event) =>\n isScalar(event) ? event.value : undefined,\n );\n if (isScalar(triggers)) return [triggers.value];\n return [];\n })();\n const callerContext = events.includes(\"workflow_call\");\n let refValue = isScalar(checkoutRef) ? checkoutRef.value : undefined;\n if (\n callerContext &&\n (repo === undefined || repo === \"${{ github.repository }}\") &&\n checkoutRef === undefined\n )\n refValue = \"${{ github.sha }}\";\n const currentRef = dynamicRefBody(refValue);\n const currentSource =\n self &&\n !callerContext &&\n (checkoutRef === undefined || currentRef === \"github.sha\");\n\n const dynamicRef = dynamicRefBody(refValue);\n const delegatedSource =\n !currentSource &&\n (self || repo === \"${{ job.workflow_repository }}\") &&\n dynamicRef !== undefined &&\n dynamicRef !== \"\" &&\n !/^(?:'(?:[^']|'')*'|\"(?:[^\"\\\\]|\\\\.)*\"|(?:true|false|null)|-?(?:0x[\\da-f]+|(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?))$/i.test(\n dynamicRef,\n ) &&\n (!/^(?:github\\s*(?:\\.\\s*sha|\\[\\s*['\"]sha['\"]\\s*\\])|job\\s*(?:\\.\\s*workflow_sha|\\[\\s*['\"]workflow_sha['\"]\\s*\\]))$/i.test(\n dynamicRef,\n ) ||\n (callerContext && currentRef === \"github.sha\"));\n\n const validSource =\n cleanIsResolved &&\n ref === approved?.sha &&\n sourceMap({ node, key: \"if\" }) === undefined &&\n sourceMap({ node, key: \"continue-on-error\" }) === undefined &&\n (currentSource || workflowSource || delegatedSource);\n if (!validSource) unreviewableCheckoutSource = true;\n if (!staticRepositoryPath(prefix)) {\n // Unknown checkout destinations may shadow any tracked selector.\n checkoutBindings.push({\n path: \".\",\n dynamicSource: validSource && dynamic(prefix),\n source: \"untrusted\",\n reason: \"checkout destination must be a static repository path\",\n line,\n sparse: sparseCheckoutOf(node),\n });\n } else {\n const destination = normalizeCheckoutPath(prefix);\n checkoutBindings = checkoutBindings.map((entry) => {\n if (\n entry.path === destination ||\n (destination !== \".\" && !entry.path.startsWith(`${destination}/`))\n )\n return entry;\n // Ancestor checkout may clear an uninitialized destination even with clean: false.\n return {\n path: entry.path,\n sparse: { mode: \"all\" },\n dynamicSource: false,\n source: \"untrusted\",\n reason:\n \"a later ancestor checkout invalidates this descendant destination\",\n line,\n };\n });\n const trustedWriter =\n cleanIsResolved &&\n ref === approved?.sha &&\n sourceMap({ node, key: \"if\" }) === undefined &&\n sourceMap({ node, key: \"continue-on-error\" }) === undefined &&\n checkoutDestinations.get(destination) === 1 &&\n !unknownCheckoutDestination;\n if (trustedWriter && delegatedSource && typeof refValue === \"string\")\n checkoutBindings.push({\n path: destination,\n dynamicSource: validSource && delegatedSource,\n sparse: sparseCheckoutOf(node),\n source: \"delegated\",\n ref: refValue,\n });\n else if (trustedWriter && (workflowSource || currentSource))\n checkoutBindings.push({\n path: destination,\n dynamicSource: validSource && delegatedSource,\n sparse: sparseCheckoutOf(node),\n source: \"tracked\",\n });\n else {\n let reason =\n \"checkout does not select a trusted repository source snapshot\";\n if (!cleanIsResolved)\n reason = \"checkout clean must be statically resolved\";\n else if (ref !== approved?.sha)\n reason = \"actions/checkout must use the approved action SHA\";\n else if (\n sourceMap({ node, key: \"if\" }) !== undefined ||\n sourceMap({ node, key: \"continue-on-error\" }) !== undefined\n )\n reason =\n \"checkout must be unconditional and omit continue-on-error\";\n else if (\n checkoutDestinations.get(destination) !== 1 ||\n unknownCheckoutDestination\n )\n reason = \"checkout destination must have exactly one static writer\";\n checkoutBindings.push({\n path: destination,\n dynamicSource: validSource && delegatedSource,\n sparse: sparseCheckoutOf(node),\n source: \"untrusted\",\n reason,\n line,\n });\n }\n }\n }\n let tool: RuntimeDelegation[\"tool\"];\n switch (action) {\n case \"actions/setup-node\":\n tool = \"node\";\n break;\n case \"actions/setup-python\":\n tool = \"python\";\n break;\n case \"oven-sh/setup-bun\":\n tool = \"bun\";\n break;\n default:\n return;\n }\n const literal = getInput(node, `${tool}-version`);\n if (tool === \"node\" && currentEngineFloor !== undefined) {\n const reference = getInput(node, \"node-version-file\");\n if (\n reference === undefined &&\n isScalar(literal) &&\n engineFloorSelectorMatches(literal.value, currentEngineFloor)\n ) {\n onEngineFloor?.(currentEngineFloor, \"matched\");\n return;\n }\n onEngineFloor?.(currentEngineFloor, \"mismatch\");\n add({\n rule: \"runtime-workflow\",\n line: nodeLine(literal ?? reference ?? uses),\n message: `engine floor job must select an exact Node patch satisfying ${currentEngineFloor.range} with minimum major ${currentEngineFloor.major}`,\n });\n return;\n }\n if (literal !== undefined)\n add({\n rule: tool === \"bun\" ? \"bun-pins\" : \"runtime-workflow\",\n line: nodeLine(literal),\n message: `setup-${tool} must use ${tool}-version-file`,\n });\n const reference = getInput(node, `${tool}-version-file`);\n checkReference({\n value: isScalar(reference) ? reference.value : undefined,\n tool,\n line: reference === undefined ? line : nodeLine(reference),\n });\n };\n const checkContainer = (node: unknown, at: string) => {\n node = resolveNode(node);\n if (node === undefined) return;\n const image = isMap(node) ? getNode(node, \"image\") : node;\n checkRuntimeImage({\n image: isScalar(image) ? image.value : undefined,\n line: nodeLine(image ?? node),\n label: \"container image\",\n at,\n });\n };\n const checkSteps = (\n node: unknown,\n locationPrefix: string,\n floor?: ResolvedEngineFloor,\n ) => {\n currentEngineFloor = undefined;\n checkoutBindings = [];\n checkoutDestinations = new Map();\n unknownCheckoutDestination = false;\n unreviewableCheckoutSource = false;\n node = resolveNode(node);\n if (!isSeq(node)) return;\n for (const step of node.items) {\n const uses = getNode(step, \"uses\");\n if (\n !isScalar(uses) ||\n typeof uses.value !== \"string\" ||\n !uses.value.toLowerCase().startsWith(\"actions/checkout@\")\n )\n continue;\n const prefix = checkoutPrefixOf(step);\n if (!staticRepositoryPath(prefix)) {\n unknownCheckoutDestination = true;\n continue;\n }\n const destination = normalizeCheckoutPath(prefix);\n checkoutDestinations.set(\n destination,\n (checkoutDestinations.get(destination) ?? 0) + 1,\n );\n }\n currentEngineFloor = floor;\n try {\n for (const step of node.items) {\n const id = getNode(step, \"id\");\n currentLocation =\n isScalar(id) && typeof id.value === \"string\"\n ? `${locationPrefix}.steps.${id.value}`\n : undefined;\n checkAction(step);\n }\n } finally {\n currentEngineFloor = undefined;\n currentLocation = undefined;\n }\n };\n try {\n // Resolve aliases first with an expansion bound before visiting executable fields.\n document.toJS({ maxAliasCount: 100 });\n if (automationKind === \"workflow\") {\n const jobs = getNode(document.contents, \"jobs\");\n if (isMap(jobs))\n for (const key of keysOf(jobs)) {\n checkoutBindings = [];\n checkoutDestinations = new Map();\n unknownCheckoutDestination = false;\n currentEngineFloor = undefined;\n const job = getNode(jobs, key);\n checkAction(job);\n checkContainer(getNode(job, \"container\"), `jobs.${key}.container`);\n const services = getNode(job, \"services\");\n if (isMap(services))\n for (const service of keysOf(services))\n checkContainer(\n getNode(services, service),\n `jobs.${key}.services.${service}`,\n );\n checkSteps(\n getNode(job, \"steps\"),\n `jobs.${key}`,\n engineFloors.find((entry) => entry.job === key),\n );\n }\n } else {\n const runs = getNode(document.contents, \"runs\");\n const using = getNode(runs, \"using\");\n if (isScalar(using) && using.value === \"composite\")\n checkSteps(getNode(runs, \"steps\"), \"runs\");\n if (isScalar(using) && using.value === \"docker\") {\n const image = getNode(runs, \"image\");\n const value = isScalar(image) ? image.value : undefined;\n if (typeof value === \"string\" && value.startsWith(\"docker://\")) {\n add({\n rule: \"action-pins\",\n line: nodeLine(image),\n message:\n \"Docker image actions require a reasoned action-pins opt-out\",\n });\n checkRuntimeImage({\n image: value.slice(\"docker://\".length),\n line: nodeLine(image),\n label: \"Docker action image\",\n });\n } else if (\n typeof value !== \"string\" ||\n value.includes(\"${{\") ||\n value.includes(\"\\\\\") ||\n value.includes(\":\") ||\n path.posix.isAbsolute(value) ||\n path.posix\n .normalize(path.posix.join(path.posix.dirname(file), value))\n .split(\"/\")\n .at(0) === \"..\" ||\n path.posix.basename(value) !== \"Dockerfile\"\n ) {\n add({\n rule: \"action-pins\",\n line: nodeLine(image),\n message:\n \"Docker actions must reference a local Dockerfile or declare a reasoned action-pins opt-out for an external image\",\n });\n }\n }\n }\n } catch {\n add({\n rule: \"runtime-workflow\",\n line: 1,\n message: \"cannot resolve workflow YAML aliases\",\n });\n }\n return diagnostics;\n};\n","import { execFileSync } from \"node:child_process\";\nimport {\n closeSync,\n lstatSync,\n openSync,\n readSync,\n readFileSync,\n realpathSync,\n} from \"node:fs\";\nimport path from \"node:path\";\n\nimport { cloudSetupPath, generateCloudSetup } from \"./cloud-setup\";\nimport { parseCloudSetup } from \"./cloud-setup-schema\";\nimport { readGitTrackedOutput } from \"./git-tracked-output\";\nimport {\n checkConsumerChecks,\n parseConsumerChecks,\n} from \"./toolchain-consumer-checks\";\nimport { checkDependabot, dependabotRules } from \"./toolchain-dependabot\";\nimport {\n parseDynamicSelectors,\n type DynamicSelector,\n} from \"./toolchain-dynamic-selectors\";\nimport {\n parseEngineFloors,\n resolveEngineFloor,\n type ResolvedEngineFloor,\n} from \"./toolchain-engine-floors\";\nimport { toolchainInputKind } from \"./toolchain-inputs\";\nimport { checkPackageFiles, packageRules } from \"./toolchain-packages\";\nimport {\n checkRuntimeFile,\n runtimeRules,\n type RuntimeDelegation,\n} from \"./toolchain-runtime\";\nimport { parseRustExceptions } from \"./toolchain-rust\";\nimport { parseToolchainPolicy } from \"./toolchain-schema\";\n\nexport const toolchainRules = [\n ...new Set([\n ...packageRules,\n ...runtimeRules,\n ...dependabotRules,\n \"cloud-setup-drift\",\n ] as const),\n] as const;\nexport type ToolchainRule = (typeof toolchainRules)[number];\nexport type SharedToolchainDiagnostic = {\n rule: ToolchainRule | \"configuration\";\n path: string;\n line: number;\n message: string;\n};\n\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst array = (value: unknown): value is readonly unknown[] =>\n Array.isArray(value);\n\n/** Repository-owned declarations are explicit; malformed decisions fail closed. */\nexport const parseToolchainConfiguration = (input: unknown) => {\n if (\n !record(input) ||\n Object.keys(input).some(\n (key) =>\n key !== \"optOuts\" &&\n key !== \"cloud\" &&\n key !== \"engineFloors\" &&\n key !== \"dynamicSelectors\" &&\n key !== \"consumerChecks\" &&\n key !== \"rustExceptions\",\n ) ||\n (input[\"optOuts\"] !== undefined && !array(input[\"optOuts\"]))\n )\n throw new Error(\n \"stll-toolchain.json accepts only optOuts, cloud, engineFloors, dynamicSelectors consumerChecks and rustExceptions declarations\",\n );\n const disabled = new Set<string>();\n const optOuts = input[\"optOuts\"] ?? [];\n if (!array(optOuts)) throw new Error(\"optOuts must be an array\");\n for (const entry of optOuts) {\n if (\n !record(entry) ||\n Object.keys(entry).some((key) => key !== \"rule\" && key !== \"reason\") ||\n typeof entry[\"rule\"] !== \"string\" ||\n !toolchainRules.some((rule) => rule === entry[\"rule\"]) ||\n typeof entry[\"reason\"] !== \"string\" ||\n entry[\"reason\"].trim() === \"\" ||\n disabled.has(entry[\"rule\"])\n )\n throw new Error(\n \"each opt-out requires a unique known rule and a nonempty reason\",\n );\n if (entry[\"rule\"] === \"rust-version\")\n throw new Error(\n \"rust-version requires expiring exact-pin rustExceptions, not an opt-out\",\n );\n if (entry[\"rule\"] === \"node-engine\")\n throw new Error(\n \"node-engine cannot be opted out; engines.node must support the shared Node series\",\n );\n if (entry[\"rule\"] === \"cloud-setup-drift\")\n throw new Error(\n \"cloud-setup-drift cannot be opted out; generated setup must match shared policy\",\n );\n disabled.add(entry[\"rule\"]);\n }\n return {\n disabled,\n rustExceptions: parseRustExceptions(input[\"rustExceptions\"]),\n cloud: parseCloudSetup(input[\"cloud\"]),\n engineFloors: parseEngineFloors(input[\"engineFloors\"]),\n dynamicSelectors: parseDynamicSelectors(input[\"dynamicSelectors\"]),\n consumerChecks: parseConsumerChecks(input[\"consumerChecks\"]),\n };\n};\n\n/** Read one tracked configuration snapshot for guards and policy generation. */\nexport const readToolchainInputs = (root: string) => {\n const diagnostics: SharedToolchainDiagnostic[] = [];\n const tracked = readGitTrackedOutput(root, \"staged\")\n .split(\"\\0\")\n // Gitlinks identify submodule directories, never executable script files.\n .filter((entry) => entry !== \"\" && !entry.startsWith(\"160000 \"))\n .map((entry) => entry.slice(entry.indexOf(\"\\t\") + 1));\n const files: Record<string, string> = {};\n const trackedFiles = new Set(tracked);\n const resolvedRoot = realpathSync(root);\n for (const file of tracked) {\n // Only configuration inputs are read; source files can contain arbitrary examples.\n const kind = toolchainInputKind(file);\n const shebangCandidate =\n kind === undefined &&\n path.posix.extname(file) === \"\" &&\n !file\n .split(\"/\")\n .some((part) => part === \"vendor\" || part === \"node_modules\");\n if (kind === undefined && !shebangCandidate) continue;\n if (kind === \"presence\") {\n files[file] = \"\";\n continue;\n }\n try {\n const inputPath = path.join(resolvedRoot, file);\n if (shebangCandidate) {\n const input = lstatSync(inputPath);\n if (!input.isFile() && !input.isSymbolicLink()) continue;\n }\n const resolvedFile = realpathSync(inputPath);\n const relative = path.relative(resolvedRoot, resolvedFile);\n if (\n path.isAbsolute(relative) ||\n relative.split(path.sep).at(0) === \"..\" ||\n !trackedFiles.has(relative.split(path.sep).join(\"/\"))\n )\n throw new Error(\"Configuration target is outside the tracked tree\");\n if (shebangCandidate) {\n if (!lstatSync(resolvedFile).isFile()) continue;\n // Bound discovery reads: extensionless files may be large binary artifacts.\n const descriptor = openSync(resolvedFile, \"r\");\n const prefix = Buffer.alloc(512);\n let count: number;\n try {\n count = readSync(descriptor, prefix, 0, prefix.length, 0);\n } finally {\n closeSync(descriptor);\n }\n if (\n toolchainInputKind(file, prefix.toString(\"utf8\", 0, count)) ===\n undefined\n )\n continue;\n }\n files[file] = readFileSync(resolvedFile, \"utf8\");\n } catch {\n if (shebangCandidate) continue;\n diagnostics.push({\n rule: \"configuration\",\n path: file,\n line: 1,\n message: \"cannot read tracked configuration file\",\n });\n }\n }\n return { files, trackedFiles, diagnostics };\n};\n\ntype CheckSharedToolchainOptions = {\n root: string;\n policy: ReturnType<typeof parseToolchainPolicy>;\n onDelegated?: ((report: RuntimeDelegation) => void) | undefined;\n};\n\nexport const checkToolchain = ({\n root,\n policy,\n onDelegated,\n}: CheckSharedToolchainOptions) => {\n const { files, trackedFiles, diagnostics } = readToolchainInputs(root);\n let repository: string | undefined;\n try {\n const origin = execFileSync(\"git\", [\"remote\", \"get-url\", \"origin\"], {\n cwd: root,\n encoding: \"utf8\",\n stdio: [\"ignore\", \"pipe\", \"ignore\"],\n }).trim();\n repository =\n /^(?:https?:\\/\\/github\\.com\\/|git@github\\.com:|ssh:\\/\\/git@github\\.com\\/)([^/]+\\/[^/]+?)(?:\\.git)?\\/?$/.exec(\n origin,\n )?.[1];\n } catch {\n // Repositories without a GitHub origin can still use github.repository.\n }\n\n let configuration = parseToolchainConfiguration({});\n const engineFloors: ResolvedEngineFloor[] = [];\n let dynamicSelectors: DynamicSelector[] = [];\n if (files[\"stll-toolchain.json\"] !== undefined) {\n try {\n configuration = parseToolchainConfiguration(\n JSON.parse(files[\"stll-toolchain.json\"]),\n );\n dynamicSelectors = configuration.dynamicSelectors;\n for (const entry of configuration.engineFloors)\n engineFloors.push(resolveEngineFloor(entry, files));\n } catch (error) {\n diagnostics.push({\n rule: \"configuration\",\n path: \"stll-toolchain.json\",\n line: 1,\n message: error instanceof Error ? error.message : String(error),\n });\n }\n }\n const cloud = configuration.cloud;\n const script = files[cloudSetupPath];\n if (cloud === undefined && trackedFiles.has(cloudSetupPath))\n diagnostics.push({\n rule: \"cloud-setup-drift\",\n path: cloudSetupPath,\n line: 1,\n message:\n \"cloud setup script requires an explicit cloud declaration in stll-toolchain.json\",\n });\n if (cloud !== undefined) {\n try {\n const nodeVersion = files[\".node-version\"];\n if (nodeVersion === undefined)\n throw new Error(\n \"cloud setup requires a tracked root .node-version with an exact stable release\",\n );\n const expected = generateCloudSetup({\n policy,\n cloud,\n nodeVersion: nodeVersion.trim(),\n });\n if (script !== expected)\n diagnostics.push({\n rule: \"cloud-setup-drift\",\n path: cloudSetupPath,\n line: 1,\n message:\n \"cloud setup script is missing or differs from shared policy; run stll-cloud-setup\",\n });\n } catch (error) {\n diagnostics.push({\n rule: \"cloud-setup-drift\",\n path: cloudSetupPath,\n line: 1,\n message: error instanceof Error ? error.message : String(error),\n });\n }\n }\n const exercisedFloors = new Set<ResolvedEngineFloor>();\n const mismatchedFloors = new Set<ResolvedEngineFloor>();\n\n const selectorMatches = new Map<DynamicSelector, number>();\n diagnostics.push(\n ...checkConsumerChecks({\n declarations: configuration.consumerChecks,\n files,\n policy,\n }),\n );\n diagnostics.push(...checkPackageFiles({ files, policy }));\n for (const [file, text] of Object.entries(files))\n diagnostics.push(\n ...checkRuntimeFile({\n file,\n text,\n policy: {\n ...policy,\n packages: { ...policy.packages, typescript: policy.typescript },\n },\n trackedFiles,\n rustExceptions: configuration.rustExceptions,\n dynamicSelectors: dynamicSelectors.filter(\n (entry) => entry.path === file,\n ),\n onDynamicSelector: (entry) =>\n selectorMatches.set(entry, (selectorMatches.get(entry) ?? 0) + 1),\n repository,\n onDelegated,\n engineFloors: engineFloors.filter((entry) => entry.workflow === file),\n onEngineFloor: (entry, status) => {\n if (status === \"mismatch\") mismatchedFloors.add(entry);\n else exercisedFloors.add(entry);\n },\n readFile: (target) => files[target],\n }),\n );\n for (const entry of engineFloors)\n if (!exercisedFloors.has(entry) || mismatchedFloors.has(entry))\n diagnostics.push({\n rule: \"configuration\",\n path: \"stll-toolchain.json\",\n line: 1,\n message: `engine floor ${entry.workflow}:${entry.job} requires a setup-node exact patch satisfying ${entry.package} engines.node minimum major ${entry.major}`,\n });\n for (const entry of dynamicSelectors)\n if (selectorMatches.get(entry) !== 1)\n diagnostics.push({\n rule: \"configuration\",\n path: \"stll-toolchain.json\",\n line: 1,\n message: `dynamic selector ${entry.path}:${entry.at ?? entry.line} must match exactly one unresolved ${entry.kind} selector`,\n });\n diagnostics.push(...checkDependabot({ files, policy: policy.dependabot }));\n return diagnostics.filter(\n (diagnostic) => !configuration.disabled.has(diagnostic.rule),\n );\n};\n"],"mappings":";;;;;;;;;;;;ACcA,MAAa,wBAAwBA;AAErC,MAAa,wBACX;AAEF,MAAMC,YAAU,UACd,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAErE,MAAM,uBAAuB,UAC3B,OAAO,UAAU,YACjB,UAAU,MACV,CAAC,MAAM,SAAS,IAAI,KACpB,CAAC,MAAM,SAAS,KAAK,KACrB,CAAC,MAAM,MAAM,EAAE,CAAC,CAAC,MAAM,cAAc;CACnC,MAAM,OAAO,UAAU,WAAW,CAAC;CACnC,OAAO,OAAO,MAAM,SAAS;AAC/B,CAAC,KACD,CAAC,aAAa,KAAK,KAAK,KACxB,CAAC,KAAK,MAAM,WAAW,KAAK,MAC3B,UAAU,OACT,MACG,MAAM,GAAG,CAAC,CACV,OAAO,SAAS,SAAS,MAAM,SAAS,OAAO,SAAS,IAAI;AAEnE,MAAM,sBAAsB,UAC1B,MAAM,QAAQ,KAAK,KACnB,MAAM,SAAS,KACf,MAAM,MAAM,mBAAm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BAAoB,MAAM,KAAK,GAAG,MAAM,MAAM,MAAM,KAAK,qCAAqC,MAAM,KAAK;CACpH,CAAC;CACL,YAAY,KAAK,GAAG,gBAAgB;EAAE;EAAO,QAAQ,OAAO;CAAW,CAAC,CAAC;CACzE,OAAO,YAAY,QAChB,eAAe,CAAC,cAAc,SAAS,IAAI,WAAW,IAAI,CAC7D;AACF"}
1
+ {"version":3,"file":"toolchain-guard.mjs","names":["packageMetadata.version","record","record","unexpected","parseToml","record","record","record","record","record","parseToml"],"sources":["../package.json","../src/toolchain-consumer-checks.ts","../src/toolchain-images.ts","../src/toolchain-dependabot.ts","../src/toolchain-dynamic-selectors.ts","../src/toolchain-engine-floors.ts","../src/toolchain-packages.ts","../src/toolchain-rust.ts","../src/toolchain-runtime.ts","../src/toolchain-guard.ts"],"sourcesContent":["","import path from \"node:path\";\nimport { parseDocument } from \"yaml\";\n\nimport packageMetadata from \"../package.json\";\nimport {\n assertConsumerFixtureSelection,\n assertConsumerFixtureKind,\n consumerPackageClosure,\n parseConsumerFixtures,\n discoverConsumerPackages,\n} from \"./consumer-compat-config\";\nimport { assertConsumerNodeSupport } from \"./consumer-node-support\";\nimport { githubAutomationFileKind } from \"./toolchain-inputs\";\n\nexport const consumerRunnerVersion = packageMetadata.version;\n\nexport const consumerCheckWorkflow =\n \"stella/.github/.github/workflows/package-consumer-compat.yml\";\n\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst repositoryDirectory = (value: unknown): value is string =>\n typeof value === \"string\" &&\n value !== \"\" &&\n !value.includes(\"\\\\\") &&\n !value.includes(\"${{\") &&\n !value.split(\"\").some((character) => {\n const code = character.charCodeAt(0);\n return code < 32 || code === 127;\n }) &&\n !/^[A-Za-z]:/.test(value) &&\n !path.posix.isAbsolute(value) &&\n (value === \".\" ||\n value\n .split(\"/\")\n .every((part) => part !== \"\" && part !== \".\" && part !== \"..\"));\n\nconst packageDirectories = (value: unknown): value is string[] =>\n Array.isArray(value) &&\n value.length > 0 &&\n value.every(repositoryDirectory) &&\n new Set(value).size === value.length;\n\ntype CronField = {\n minimum: number;\n maximum: number;\n names?: Record<string, number>;\n};\nconst cronFields = [\n { minimum: 0, maximum: 59 },\n { minimum: 0, maximum: 23 },\n { minimum: 1, maximum: 31 },\n {\n minimum: 1,\n maximum: 12,\n names: Object.fromEntries(\n [\n \"JAN\",\n \"FEB\",\n \"MAR\",\n \"APR\",\n \"MAY\",\n \"JUN\",\n \"JUL\",\n \"AUG\",\n \"SEP\",\n \"OCT\",\n \"NOV\",\n \"DEC\",\n ].map((name, index) => [name, index + 1]),\n ),\n },\n {\n minimum: 0,\n maximum: 6,\n names: Object.fromEntries(\n [\"SUN\", \"MON\", \"TUE\", \"WED\", \"THU\", \"FRI\", \"SAT\"].map((name, index) => [\n name,\n index,\n ]),\n ),\n },\n] as const;\nconst cronFieldValues = (text: string, field: CronField) => {\n const value = (token: string) => {\n const number = /^\\d+$/.test(token)\n ? Number(token)\n : field.names?.[token.toUpperCase()];\n return number !== undefined &&\n Number.isSafeInteger(number) &&\n number >= field.minimum &&\n number <= field.maximum\n ? number\n : undefined;\n };\n const values = new Set<number>();\n for (const part of text.split(\",\")) {\n const split = part.split(\"/\");\n if (split.length > 2) return undefined;\n const [base, stepText] = split;\n const step = stepText === undefined ? 1 : Number(stepText);\n if (stepText !== undefined && !/^\\d+$/.test(stepText)) return undefined;\n if (!Number.isSafeInteger(step) || step <= 0 || base === undefined)\n return undefined;\n const bounds = base.split(\"-\");\n if (bounds.length > 2) return undefined;\n const lower = bounds.at(0);\n if (lower === undefined) return undefined;\n const start = base === \"*\" ? field.minimum : value(lower);\n const upper = bounds.at(1);\n let end = start;\n if (base === \"*\" || (bounds.length === 1 && stepText !== undefined))\n end = field.maximum;\n else if (upper !== undefined) end = value(upper);\n if (start === undefined || end === undefined || start > end)\n return undefined;\n for (let selected = start; selected <= end; selected += step)\n values.add(selected);\n }\n return values;\n};\n\nconst validConsumerCron = (text: string) => {\n const fields = text.trim().split(/\\s+/);\n return (\n fields.length === cronFields.length &&\n cronFields.every((field, index) => {\n const fieldText = fields.at(index);\n return (\n fieldText !== undefined &&\n cronFieldValues(fieldText, field) !== undefined\n );\n })\n );\n};\n\nconst nightlySchedule = (value: unknown) => {\n if (!record(value)) return false;\n const schedule = value[\"schedule\"];\n if (!Array.isArray(schedule) || schedule.length === 0) return false;\n const coveredDays = new Set<number>();\n for (const entry of schedule) {\n if (\n !record(entry) ||\n typeof entry[\"cron\"] !== \"string\" ||\n !validConsumerCron(entry[\"cron\"])\n )\n return false;\n const fields = entry[\"cron\"].trim().split(/\\s+/);\n const selections = cronFields.map((field, index) => {\n const text = fields.at(index);\n return text === undefined ? undefined : cronFieldValues(text, field);\n });\n // Month and date restrictions cannot certify a daily schedule.\n if (selections.at(2)?.size !== 31 || selections.at(3)?.size !== 12)\n continue;\n for (const day of selections.at(4) ?? []) coveredDays.add(day);\n }\n return coveredDays.size === 7;\n};\n\nexport type ConsumerCheck = {\n workflow: string;\n job: string;\n packages: string[];\n toolingVersion: string;\n fixturePath: string;\n};\n\nexport const parseConsumerChecks = (input: unknown): ConsumerCheck[] => {\n if (input === undefined) return [];\n if (!Array.isArray(input)) throw new Error(\"consumerChecks must be an array\");\n const targets = new Set<string>();\n return input.map((entry: unknown) => {\n if (\n !record(entry) ||\n Object.keys(entry).some(\n (key) =>\n ![\n \"workflow\",\n \"job\",\n \"packages\",\n \"toolingVersion\",\n \"fixturePath\",\n ].includes(key),\n ) ||\n typeof entry[\"workflow\"] !== \"string\" ||\n githubAutomationFileKind(entry[\"workflow\"]) !== \"workflow\" ||\n !/^\\.github\\/workflows\\/[^/]+\\.ya?ml$/.test(entry[\"workflow\"]) ||\n typeof entry[\"job\"] !== \"string\" ||\n !/^[A-Za-z_][A-Za-z0-9_-]*$/.test(entry[\"job\"]) ||\n !packageDirectories(entry[\"packages\"]) ||\n typeof entry[\"toolingVersion\"] !== \"string\" ||\n !/^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$/.test(\n entry[\"toolingVersion\"],\n ) ||\n !repositoryDirectory(entry[\"fixturePath\"])\n )\n throw new Error(\n \"consumerChecks requires canonical workflow, job, unique package directories, exact toolingVersion and repository-relative fixturePath\",\n );\n const target = `${entry[\"workflow\"]}:${entry[\"job\"]}`;\n if (targets.has(target))\n throw new Error(\"consumerChecks targets must be unique\");\n targets.add(target);\n return {\n workflow: entry[\"workflow\"],\n job: entry[\"job\"],\n packages: entry[\"packages\"],\n toolingVersion: entry[\"toolingVersion\"],\n fixturePath: entry[\"fixturePath\"],\n };\n });\n};\n\ntype CheckConsumerChecksOptions = {\n declarations: readonly ConsumerCheck[];\n files: Record<string, string>;\n policy: {\n consumerNode: string;\n actions: Record<string, { sha: string; version: string }>;\n };\n};\n\n/** Consumer checks are scoped declarations, never general runtime exceptions. */\nexport const checkConsumerChecks = ({\n declarations,\n files,\n policy,\n}: CheckConsumerChecksOptions) => {\n const diagnostics: {\n rule: \"configuration\";\n path: string;\n line: number;\n message: string;\n }[] = [];\n const exercised = new Set<ConsumerCheck>();\n const add = (message: string) =>\n diagnostics.push({\n rule: \"configuration\",\n path: \"stll-toolchain.json\",\n line: 1,\n message,\n });\n for (const [workflow, text] of Object.entries(files)) {\n if (githubAutomationFileKind(workflow) !== \"workflow\") continue;\n try {\n const document = parseDocument(text, { uniqueKeys: true, merge: true });\n if (document.errors.length > 0) throw new Error(\"invalid workflow YAML\");\n const source: unknown = document.toJS({ maxAliasCount: 100 });\n if (!record(source) || !record(source[\"jobs\"])) continue;\n for (const [jobName, job] of Object.entries(source[\"jobs\"])) {\n if (!record(job) || typeof job[\"uses\"] !== \"string\") continue;\n const [workflowPath, ref] = job[\"uses\"].split(\"@\");\n if (workflowPath?.toLowerCase() !== consumerCheckWorkflow) continue;\n const declaration = declarations.find(\n (entry) => entry.workflow === workflow && entry.job === jobName,\n );\n if (declaration === undefined) {\n add(`${workflow}:${jobName} requires a consumerChecks declaration`);\n continue;\n }\n if (!nightlySchedule(source[\"on\"]))\n throw new Error(\n `${workflow} consumer checks require a nonempty valid on.schedule covering every day`,\n );\n if (\"if\" in job || \"needs\" in job || \"strategy\" in job)\n throw new Error(\n `${workflow}:${jobName} consumer checks require a stand-alone unconditional reusable job without if or needs or strategy`,\n );\n exercised.add(declaration);\n const approved = Object.entries(policy.actions).find(\n ([name]) => name.toLowerCase() === consumerCheckWorkflow,\n )?.[1];\n if (\n job[\"uses\"].split(\"@\").length !== 2 ||\n ref === undefined ||\n !/^[a-f0-9]{40}$/.test(ref) ||\n approved === undefined ||\n ref !== approved.sha ||\n \"steps\" in job ||\n \"runs-on\" in job\n )\n throw new Error(\n `${workflow}:${jobName} must invoke the approved immutable consumer workflow as a reusable job`,\n );\n const inputs = job[\"with\"];\n if (!record(inputs))\n throw new Error(`${workflow}:${jobName} requires consumer inputs`);\n const names = new Set<string>();\n for (const key of Object.keys(inputs)) {\n const normalized = key.toLowerCase();\n if (\n names.has(normalized) ||\n ![\n \"packages\",\n \"consumer-node\",\n \"tooling-version\",\n \"fixture-path\",\n ].includes(normalized) ||\n normalized !== key\n )\n throw new Error(\n `${workflow}:${jobName} requires unique canonical consumer input names`,\n );\n names.add(normalized);\n }\n if (inputs[\"consumer-node\"] !== policy.consumerNode)\n throw new Error(\n `${workflow}:${jobName} consumer-node must be ${policy.consumerNode}`,\n );\n if (declaration.toolingVersion !== consumerRunnerVersion)\n throw new Error(\n `${workflow}:${jobName} toolingVersion must match installed @stll/oxlint-config ${consumerRunnerVersion}`,\n );\n if (inputs[\"tooling-version\"] !== declaration.toolingVersion)\n throw new Error(\n `${workflow}:${jobName} tooling-version must match consumerChecks.toolingVersion`,\n );\n if (inputs[\"fixture-path\"] !== declaration.fixturePath)\n throw new Error(\n `${workflow}:${jobName} fixture-path must match consumerChecks.fixturePath`,\n );\n const fixtureManifest = path.posix.join(\n declaration.fixturePath,\n \"consumer-compat.json\",\n );\n const fixtureSource = files[fixtureManifest];\n if (fixtureSource === undefined)\n throw new Error(\n `consumerChecks fixture configuration must be tracked: ${fixtureManifest}`,\n );\n const fixtureConfiguration: unknown = JSON.parse(fixtureSource);\n const fixtures = parseConsumerFixtures(fixtureConfiguration);\n assertConsumerFixtureSelection({\n selected: declaration.packages,\n fixtures,\n });\n const rawPackages = inputs[\"packages\"];\n if (typeof rawPackages !== \"string\")\n throw new Error(\n `${workflow}:${jobName} packages must be a static JSON array`,\n );\n const selected: unknown = JSON.parse(rawPackages);\n if (\n !packageDirectories(selected) ||\n selected.length !== declaration.packages.length ||\n !selected.every((directory) =>\n declaration.packages.includes(directory),\n )\n )\n throw new Error(\n `${workflow}:${jobName} packages must exactly match consumerChecks`,\n );\n const workspacePackages = discoverConsumerPackages(files);\n const packagesByDirectory = new Map(\n [...workspacePackages.values()].map((entry) => [\n entry.directory,\n entry,\n ]),\n );\n for (const directory of declaration.packages) {\n const manifestPath = path.posix.join(directory, \"package.json\");\n const manifestText = files[manifestPath];\n if (manifestText === undefined)\n throw new Error(\n `consumerChecks package manifest must be tracked: ${manifestPath}`,\n );\n const selectedPackage = packagesByDirectory.get(directory);\n if (selectedPackage === undefined)\n throw new Error(\n `consumerChecks package must be a discovered workspace member: ${manifestPath}`,\n );\n const fixture = fixtures.find(\n (candidate) => candidate.package === directory,\n );\n if (fixture === undefined)\n throw new Error(`missing declared consumer fixture: ${directory}`);\n assertConsumerFixtureKind({ fixture, pkg: selectedPackage });\n const manifest = selectedPackage.manifest;\n if (\n manifest[\"private\"] === true ||\n typeof manifest[\"name\"] !== \"string\" ||\n manifest[\"name\"].trim() === \"\"\n )\n throw new Error(\n `consumerChecks requires a named published package: ${manifestPath}`,\n );\n const closure = consumerPackageClosure({\n selected: selectedPackage,\n packages: workspacePackages,\n files,\n });\n for (const member of closure.values())\n assertConsumerNodeSupport({\n manifest: member.manifest,\n node: policy.consumerNode,\n label: path.posix.join(member.directory, \"package.json\"),\n });\n }\n }\n } catch (error) {\n if (\n declarations.some((entry) => entry.workflow === workflow) ||\n text.toLowerCase().includes(consumerCheckWorkflow)\n )\n add(error instanceof Error ? error.message : String(error));\n }\n }\n for (const declaration of declarations)\n if (!exercised.has(declaration))\n add(\n `${declaration.workflow}:${declaration.job} consumerChecks declaration has no matching reusable invocation`,\n );\n return diagnostics;\n};\n","/** Docker Hub spellings accepted by the shared runtime policy. */\nexport const dockerHubRegistries = [\n \"docker.io\",\n \"index.docker.io\",\n \"registry-1.docker.io\",\n] as const;\n\n/** Expand the full accepted repository alias class without parsing Dockerfile instructions. */\nexport const ownedDockerImageAliases = (images: readonly string[]) => {\n const aliases = new Set<string>();\n for (const image of images) {\n for (const repository of [image, `library/${image}`]) {\n aliases.add(repository);\n for (const registry of dockerHubRegistries)\n aliases.add(`${registry}/${repository}`);\n }\n }\n return [...aliases].sort();\n};\n\n/** Preserve tag/digest spelling while normalizing registry and namespace aliases. */\nexport const canonicalDockerRuntime = (image: string) => {\n const registry = dockerHubRegistries.find((entry) =>\n image.toLowerCase().startsWith(`${entry}/`),\n );\n const repository =\n registry === undefined ? image : image.slice(registry.length + 1);\n return repository.replace(/^library\\//i, \"\");\n};\n\n/** Preserve Rust release identity across official Debian slim and Alpine variants. */\nexport const rustImageVersion = (tag: string) =>\n tag.replace(\n /-(?:alpine(?:\\d+(?:\\.\\d+)*)?|(?:bookworm|bullseye|trixie|buster)(?:-slim)?|slim(?:-(?:bookworm|bullseye|trixie|buster))?)$/,\n \"\",\n );\n","import path from \"node:path\";\nimport picomatch from \"picomatch\";\nimport { parse as parseToml } from \"smol-toml\";\nimport {\n isNode,\n LineCounter,\n parseAllDocuments,\n parseDocument,\n Scalar,\n stringify,\n} from \"yaml\";\n\nimport {\n containerDocumentImages,\n isComposeDefinitionPath,\n isKubernetesDefinitionPath,\n} from \"./toolchain-container-inputs\";\nimport { ownedDockerImageAliases } from \"./toolchain-images\";\nimport {\n isDependabotGithubActionsPath,\n isDockerDefinitionPath,\n pythonDependencyManifestKind,\n isPythonDependencyManifest,\n javascriptDependencyLockfiles,\n} from \"./toolchain-inputs\";\nimport { workspaceContains } from \"./toolchain-workspaces\";\n\nexport const dependabotRules = [\"dependabot-policy\"] as const;\n\ntype DependabotPolicy = {\n schedule: { interval: string; day: string; time: string; timezone: string };\n cooldown: { defaultDays: number };\n groups: Record<\n string,\n { patterns: readonly string[]; updateTypes: readonly string[] }\n >;\n ignoredPackages: readonly string[];\n ignoredActions: readonly string[];\n ignoredImages: readonly string[];\n};\n\ntype Diagnostic = {\n rule: (typeof dependabotRules)[number];\n path: string;\n line: number;\n message: string;\n};\n\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst strings = (value: unknown): value is string[] =>\n Array.isArray(value) &&\n value.every((entry: unknown) => typeof entry === \"string\");\n\nconst sameStrings = (value: unknown, expected: readonly string[]) => {\n if (!strings(value) || value.length !== expected.length) return false;\n const sortedExpected = [...expected].sort();\n return [...value]\n .sort()\n .every((entry, index) => entry === sortedExpected[index]);\n};\n\nconst pinnedVersionUpdateTypes = [\n \"version-update:semver-major\",\n \"version-update:semver-minor\",\n \"version-update:semver-patch\",\n];\n\nconst versionOnlyIgnore = (entry: unknown) =>\n record(entry) &&\n Object.keys(entry).length === 2 &&\n typeof entry[\"dependency-name\"] === \"string\" &&\n sameStrings(entry[\"update-types\"], pinnedVersionUpdateTypes);\n\nconst directoryOf = (file: string) => {\n const directory = path.posix.dirname(file);\n return directory === \".\" ? \"/\" : `/${directory}`;\n};\n\nconst workspaceManifests = {\n npm: \"package.json\",\n cargo: \"Cargo.toml\",\n uv: \"pyproject.toml\",\n} as const;\n\nconst workspaceTable = (\n parsed: Record<string, unknown>,\n ecosystem: keyof typeof workspaceManifests,\n) => {\n switch (ecosystem) {\n case \"npm\":\n return parsed[\"workspaces\"];\n case \"cargo\":\n return parsed[\"workspace\"];\n case \"uv\": {\n const tool = parsed[\"tool\"];\n const uv = record(tool) ? tool[\"uv\"] : undefined;\n return record(uv) ? uv[\"workspace\"] : undefined;\n }\n default: {\n const unexpected: never = ecosystem;\n throw new Error(\"unknown workspace ecosystem\", { cause: unexpected });\n }\n }\n};\n\n/** Installable workspace members share their update root; own-lock projects stay discoverable. */\nconst workspaceRoots = (\n files: Record<string, string>,\n ecosystem: keyof typeof workspaceManifests,\n) => {\n const manifests = Object.keys(files).filter(\n (file) =>\n path.posix.basename(file) === workspaceManifests[ecosystem] ||\n (ecosystem === \"npm\" &&\n path.posix.basename(file) === \"pnpm-workspace.yaml\"),\n );\n const workspaces = new Map<string, string[]>();\n const npmWorkspaceErrors = new Map<string, Error>();\n for (const file of manifests) {\n if (ecosystem === \"npm\") {\n const directory = path.posix.dirname(file);\n const workspaceFile = path.posix.join(directory, \"pnpm-workspace.yaml\");\n const text = files[workspaceFile];\n if (text !== undefined) {\n try {\n const document = parseDocument(text);\n if (document.errors.length > 0)\n throw new Error(`${workspaceFile}:1: invalid pnpm workspace YAML`);\n const parsed: unknown = document.toJS({ maxAliasCount: 100 });\n if (!record(parsed))\n throw new Error(\n `${workspaceFile}:1: pnpm workspace must contain an object`,\n );\n const patterns = parsed[\"packages\"] ?? [];\n if (!strings(patterns))\n throw new Error(\n `${workspaceFile}:1: pnpm packages must be a string array`,\n );\n workspaces.set(\n directory,\n patterns.map((pattern) =>\n pattern.startsWith(\"!\")\n ? `!${path.posix.normalize(pattern.slice(1))}`\n : path.posix.normalize(pattern),\n ),\n );\n } catch (error) {\n npmWorkspaceErrors.set(\n directory,\n error instanceof Error ? error : new Error(String(error)),\n );\n }\n continue;\n }\n }\n try {\n const parsed: unknown =\n ecosystem === \"npm\"\n ? JSON.parse(files[file] ?? \"\")\n : parseToml(files[file] ?? \"\");\n if (!record(parsed)) continue;\n if (\n ecosystem === \"npm\" &&\n typeof parsed[\"packageManager\"] === \"string\" &&\n parsed[\"packageManager\"].startsWith(\"pnpm@\")\n )\n continue;\n const value = workspaceTable(parsed, ecosystem);\n const patterns = record(value)\n ? value[ecosystem === \"npm\" ? \"packages\" : \"members\"]\n : value;\n const members =\n ecosystem === \"cargo\" && record(value) && patterns === undefined\n ? []\n : patterns;\n if (strings(members)) {\n const excluded =\n ecosystem !== \"npm\" && record(value) && strings(value[\"exclude\"])\n ? value[\"exclude\"].map((pattern) => `!${pattern}`)\n : [];\n workspaces.set(path.posix.dirname(file), [...members, ...excluded]);\n }\n } catch {\n // Other toolchain rules validate manifests; retain the update root here.\n }\n }\n const implicitCargoMembers = new Map<string, Set<string>>();\n const declaredMember = (\n root: string,\n patterns: string[],\n directory: string,\n ) => {\n const relative = path.posix.relative(root, directory);\n if (relative === \"\" || relative === \"..\" || relative.startsWith(\"../\"))\n return false;\n return workspaceContains({\n directory: root,\n file: path.posix.join(directory, \"package.json\"),\n patterns,\n rootMembership: \"patterns\",\n });\n };\n const installable = new Set([\".\"]);\n if (ecosystem === \"npm\") {\n for (const file of manifests) {\n const directory = path.posix.dirname(file);\n if (\n javascriptDependencyLockfiles.some(\n (name) => files[path.posix.join(directory, name)] !== undefined,\n )\n )\n installable.add(directory);\n }\n let changed = true;\n while (changed) {\n changed = false;\n for (const [root, patterns] of workspaces) {\n if (!installable.has(root)) continue;\n for (const file of manifests) {\n const directory = path.posix.dirname(file);\n if (\n installable.has(directory) ||\n !declaredMember(root, patterns, directory)\n )\n continue;\n installable.add(directory);\n changed = true;\n }\n }\n }\n }\n if (ecosystem === \"npm\") {\n for (const [directory, error] of npmWorkspaceErrors)\n if (installable.has(directory)) throw error;\n }\n if (ecosystem === \"cargo\") {\n for (const [root, patterns] of workspaces) {\n const includes = patterns.filter((pattern) => !pattern.startsWith(\"!\"));\n const excludes = patterns.filter((pattern) => pattern.startsWith(\"!\"));\n const memberDirectories = new Set([root]);\n for (const file of manifests) {\n const directory = path.posix.dirname(file);\n const relative = path.posix.relative(root, directory);\n if (\n includes.some((pattern) => picomatch.isMatch(relative, pattern)) &&\n !excludes.some((pattern) =>\n picomatch.isMatch(relative, pattern.slice(1)),\n )\n )\n memberDirectories.add(directory);\n }\n for (const directory of memberDirectories) {\n try {\n const parsed = parseToml(\n files[path.posix.join(directory, \"Cargo.toml\")] ?? \"\",\n );\n const rootParsed = parseToml(\n files[path.posix.join(root, \"Cargo.toml\")] ?? \"\",\n );\n const workspace = rootParsed[\"workspace\"];\n const inherited = record(workspace)\n ? workspace[\"dependencies\"]\n : undefined;\n const dependencyOwners = [parsed];\n const targets = parsed[\"target\"];\n if (record(targets)) {\n for (const target of Object.values(targets))\n if (record(target)) dependencyOwners.push(target);\n }\n for (const owner of dependencyOwners) {\n for (const key of [\n \"dependencies\",\n \"dev-dependencies\",\n \"build-dependencies\",\n ]) {\n const dependencies = owner[key];\n if (!record(dependencies)) continue;\n for (const [name, dependency] of Object.entries(dependencies)) {\n if (!record(dependency)) continue;\n const isInherited = dependency[\"workspace\"] === true;\n const resolved =\n isInherited && record(inherited)\n ? inherited[name]\n : dependency;\n if (!record(resolved) || typeof resolved[\"path\"] !== \"string\")\n continue;\n if (\n path.posix.isAbsolute(resolved[\"path\"]) ||\n /\\\\|\\$|^[A-Za-z]:/.test(resolved[\"path\"])\n )\n continue;\n const target = path.posix.normalize(\n path.posix.join(\n isInherited ? root : directory,\n resolved[\"path\"],\n ),\n );\n const relative = path.posix.relative(root, target);\n if (\n relative.startsWith(\"../\") ||\n relative === \"..\" ||\n files[path.posix.join(target, \"Cargo.toml\")] === undefined ||\n excludes.some((pattern) =>\n picomatch.isMatch(relative, pattern.slice(1)),\n )\n )\n continue;\n memberDirectories.add(target);\n }\n }\n }\n } catch {\n // Manifest validation diagnoses malformed TOML independently.\n }\n }\n implicitCargoMembers.set(root, memberDirectories);\n }\n }\n return manifests\n .filter(\n (file) =>\n ecosystem !== \"npm\" || installable.has(path.posix.dirname(file)),\n )\n .filter((file) => {\n const directory = path.posix.dirname(file);\n return ![...workspaces].some(([root, patterns]) => {\n if (ecosystem === \"npm\" && !installable.has(root)) return false;\n const relative = path.posix.relative(root, directory);\n if (relative === \"\" || relative.startsWith(\"../\")) return false;\n const includes = patterns.filter((pattern) => !pattern.startsWith(\"!\"));\n const excludes = patterns.filter((pattern) => pattern.startsWith(\"!\"));\n return (\n (implicitCargoMembers.get(root)?.has(directory) === true ||\n (ecosystem === \"npm\"\n ? declaredMember(root, patterns, directory)\n : includes.some((pattern) =>\n picomatch.isMatch(relative, pattern),\n ))) &&\n !excludes.some((pattern) =>\n picomatch.isMatch(relative, pattern.slice(1)),\n )\n );\n });\n })\n .map(directoryOf)\n .filter((directory, index, values) => values.indexOf(directory) === index);\n};\n\ntype CheckDependabotOptions = {\n files: Record<string, string>;\n policy: DependabotPolicy;\n};\n\nconst javascriptEcosystem = (\n directory: string,\n files: Record<string, string>,\n) => {\n const root = directory === \"/\" ? \".\" : directory.slice(1);\n if (files[path.posix.join(root, \"bun.lock\")] !== undefined) return \"bun\";\n try {\n const manifest: unknown = JSON.parse(\n files[path.posix.join(root, \"package.json\")] ?? \"{}\",\n );\n if (\n record(manifest) &&\n typeof manifest[\"packageManager\"] === \"string\" &&\n manifest[\"packageManager\"].startsWith(\"bun@\")\n )\n return \"bun\";\n } catch {\n // Package rules diagnose malformed JSON; the root still needs update coverage.\n }\n return \"npm\";\n};\n\nconst pythonEcosystem = (file: string, files: Record<string, string>) => {\n const manifestKind = pythonDependencyManifestKind(file);\n if (\n manifestKind === \"pipfile\" ||\n manifestKind === \"pipfile-lock\" ||\n manifestKind === \"setup\"\n )\n return \"pip\";\n const root = path.posix.dirname(file);\n if (\n files[path.posix.join(root, \"uv.lock\")] !== undefined ||\n files[path.posix.join(root, \"uv.toml\")] !== undefined\n )\n return \"uv\";\n const pyproject = files[path.posix.join(root, \"pyproject.toml\")];\n if (pyproject !== undefined) {\n try {\n const parsed = parseToml(pyproject);\n const tool = parsed[\"tool\"];\n if (record(tool) && record(tool[\"uv\"])) return \"uv\";\n } catch {\n // Runtime rules diagnose malformed TOML; retain its update coverage.\n }\n }\n return \"pip\";\n};\n\nconst ecosystemRoots = (files: Record<string, string>) => {\n const roots = new Map<string, Set<string>>();\n const requireRoot = (ecosystem: string, directory: string) => {\n const directories = roots.get(ecosystem) ?? new Set<string>();\n directories.add(directory);\n roots.set(ecosystem, directories);\n };\n for (const directory of workspaceRoots(files, \"npm\"))\n requireRoot(javascriptEcosystem(directory, files), directory);\n for (const directory of workspaceRoots(files, \"cargo\"))\n requireRoot(\"cargo\", directory);\n for (const directory of workspaceRoots(files, \"uv\")) {\n const root = directory === \"/\" ? \".\" : directory.slice(1);\n requireRoot(\n pythonEcosystem(path.posix.join(root, \"pyproject.toml\"), files),\n directory,\n );\n }\n for (const file of Object.keys(files)) {\n if (isDependabotGithubActionsPath(file)) requireRoot(\"github-actions\", \"/\");\n const name = path.posix.basename(file);\n if (isDockerDefinitionPath(file)) requireRoot(\"docker\", directoryOf(file));\n if (isComposeDefinitionPath(file) || isKubernetesDefinitionPath(file)) {\n for (const document of parseAllDocuments(files[file] ?? \"\", {\n merge: true,\n })) {\n if (document.errors.length > 0) continue;\n try {\n const classified = containerDocumentImages(\n document.toJS({ maxAliasCount: 100 }),\n file,\n );\n if (classified !== undefined)\n requireRoot(classified.ecosystem, directoryOf(file));\n } catch {\n // Runtime validation reports malformed or excessive YAML aliases.\n }\n }\n }\n if (\n name === \"uv.lock\" ||\n name === \"uv.toml\" ||\n (name !== \"pyproject.toml\" && isPythonDependencyManifest(file))\n )\n requireRoot(pythonEcosystem(file, files), directoryOf(file));\n }\n return roots;\n};\n\nconst ignoredFor = (ecosystem: string, policy: DependabotPolicy) => {\n if (ecosystem === \"npm\" || ecosystem === \"bun\") return policy.ignoredPackages;\n if (ecosystem === \"github-actions\") return policy.ignoredActions;\n if (ecosystem === \"docker\" || ecosystem === \"docker-compose\")\n return ownedDockerImageAliases(policy.ignoredImages);\n return [];\n};\n\n/** Generate canonical YAML from the same ecosystem enumeration used by the guard. */\nexport const generateDependabotConfig = ({\n files,\n policy,\n}: CheckDependabotOptions) => {\n const updates = [...ecosystemRoots(files)]\n .sort(([left], [right]) => left.localeCompare(right))\n .map(([ecosystem, roots]) => {\n const directories = [...roots].sort();\n const ignored = ignoredFor(ecosystem, policy);\n const time = new Scalar(policy.schedule.time);\n time.type = Scalar.QUOTE_DOUBLE;\n return {\n \"package-ecosystem\": ecosystem,\n directory: directories.length === 1 ? directories.at(0) : undefined,\n directories: directories.length > 1 ? directories : undefined,\n schedule: {\n interval: policy.schedule.interval,\n day: policy.schedule.day,\n time,\n timezone: policy.schedule.timezone,\n },\n cooldown: { \"default-days\": policy.cooldown.defaultDays },\n groups: Object.fromEntries(\n Object.entries(policy.groups).map(([name, group]) => [\n name,\n { patterns: group.patterns, \"update-types\": group.updateTypes },\n ]),\n ),\n ignore:\n ignored.length > 0\n ? ignored.map((name) => ({\n \"dependency-name\": name,\n \"update-types\": pinnedVersionUpdateTypes,\n }))\n : undefined,\n };\n });\n return stringify({ version: 2, updates }, { aliasDuplicateObjects: false });\n};\n\n/** Validate the shared update policy against a hermetic tracked-file snapshot. */\nexport const checkDependabot = ({\n files,\n policy,\n}: CheckDependabotOptions): Diagnostic[] => {\n const roots = ecosystemRoots(files);\n const paths = [\".github/dependabot.yml\", \".github/dependabot.yaml\"].filter(\n (file) => files[file] !== undefined,\n );\n if (roots.size === 0 && paths.length === 0) return [];\n const file = paths.at(0) ?? \".github/dependabot.yml\";\n const diagnostics: Diagnostic[] = [];\n const add = (message: string, line = 1) => {\n diagnostics.push({ rule: \"dependabot-policy\", path: file, line, message });\n };\n if (paths.length === 0) {\n add(\n \"add a Dependabot configuration for the repository's package ecosystems\",\n );\n return diagnostics;\n }\n if (paths.length > 1) add(\"keep one Dependabot configuration file\");\n const lineCounter = new LineCounter();\n const document = parseDocument(files[file] ?? \"\", {\n lineCounter,\n });\n if (document.errors.length > 0) {\n for (const error of document.errors)\n add(\n `invalid Dependabot YAML: ${error.message}`,\n lineCounter.linePos(error.pos[0]).line,\n );\n return diagnostics;\n }\n let parsed: unknown;\n try {\n parsed = document.toJS({ maxAliasCount: 100 });\n } catch {\n add(\"cannot resolve Dependabot YAML aliases\");\n return diagnostics;\n }\n if (\n !record(parsed) ||\n parsed[\"version\"] !== 2 ||\n !Array.isArray(parsed[\"updates\"])\n ) {\n add(\"Dependabot must declare version: 2 and an updates array\");\n return diagnostics;\n }\n const covered = new Map<string, Set<string>>();\n let legacy: unknown;\n try {\n const legacyDocument = parseDocument(files[file] ?? \"\", {\n version: \"1.1\",\n schema: \"yaml-1.1\",\n });\n if (legacyDocument.errors.length === 0)\n legacy = legacyDocument.toJS({ maxAliasCount: 100 });\n } catch {\n // The canonical parser reports invalid aliases; incompatible times fail below.\n }\n const legacyUpdates =\n record(legacy) && Array.isArray(legacy[\"updates\"]) ? legacy[\"updates\"] : [];\n const rootClaims = new Map<string, Map<string, number>>();\n const directoryClaims = new Map<string, Map<string, number>>();\n for (const [index, update] of parsed[\"updates\"].entries()) {\n const lineOf = (key: string) => {\n const node: unknown = document.getIn([\"updates\", index, key], true);\n const offset = isNode(node) ? node.range?.[0] : undefined;\n return offset === undefined ? 1 : lineCounter.linePos(offset).line;\n };\n const report = (key: string, message: string) => add(message, lineOf(key));\n if (!record(update) || typeof update[\"package-ecosystem\"] !== \"string\") {\n report(\n \"package-ecosystem\",\n \"each Dependabot update must declare a package ecosystem\",\n );\n continue;\n }\n const ecosystem = update[\"package-ecosystem\"];\n if (update[\"target-branch\"] !== undefined)\n report(\n \"target-branch\",\n `${ecosystem}: shared updates must target the default branch`,\n );\n if (update[\"open-pull-requests-limit\"] === 0)\n report(\n \"open-pull-requests-limit\",\n `${ecosystem}: version updates must remain enabled`,\n );\n const single = update[\"directory\"];\n const multiple = update[\"directories\"];\n let directories: string[] = [];\n if (typeof single === \"string\" && multiple === undefined)\n directories = [single];\n else if (single === undefined && strings(multiple)) directories = multiple;\n const validDirectories = directories.filter(\n (directory) =>\n directory.startsWith(\"/\") && !directory.split(\"/\").includes(\"..\"),\n );\n if (\n directories.length === 0 ||\n validDirectories.length !== directories.length\n ) {\n report(\n \"directory\",\n `${ecosystem}: declare directory or nonempty directories with absolute repository paths`,\n );\n }\n const normalizedDirectories = Array.from(\n new Set(\n validDirectories.map(\n (value) => path.posix.normalize(value).replace(/\\/+$/, \"\") || \"/\",\n ),\n ),\n );\n const matches = covered.get(ecosystem) ?? new Set<string>();\n const claimedDirectories =\n directoryClaims.get(ecosystem) ?? new Map<string, number>();\n for (const directory of normalizedDirectories) {\n const previous = claimedDirectories.get(directory);\n if (previous !== undefined)\n report(\n multiple === undefined ? \"directory\" : \"directories\",\n `${ecosystem}: directory ${directory} overlaps update entry ${previous + 1}`,\n );\n else claimedDirectories.set(directory, index);\n }\n directoryClaims.set(ecosystem, claimedDirectories);\n const claimedRoots = rootClaims.get(ecosystem) ?? new Map<string, number>();\n for (const root of roots.get(ecosystem) ?? []) {\n if (\n normalizedDirectories.some(\n (directory) =>\n directory === root ||\n (multiple !== undefined && picomatch.isMatch(root, directory)),\n )\n ) {\n const previous = claimedRoots.get(root);\n if (previous !== undefined)\n report(\n multiple === undefined ? \"directory\" : \"directories\",\n `${ecosystem}: update root ${root} overlaps update entry ${previous + 1}`,\n );\n else claimedRoots.set(root, index);\n matches.add(root);\n }\n }\n rootClaims.set(ecosystem, claimedRoots);\n covered.set(ecosystem, matches);\n const schedule = update[\"schedule\"];\n const legacyUpdate: unknown = legacyUpdates.at(index);\n const legacySchedule = record(legacyUpdate)\n ? legacyUpdate[\"schedule\"]\n : undefined;\n if (\n record(schedule) &&\n schedule[\"time\"] === policy.schedule.time &&\n (!record(legacySchedule) ||\n legacySchedule[\"time\"] !== policy.schedule.time)\n )\n report(\n \"schedule\",\n `${ecosystem}: quote schedule time to preserve its string value in YAML 1.1`,\n );\n if (\n !record(schedule) ||\n Object.keys(schedule).length !== Object.keys(policy.schedule).length ||\n Object.entries(policy.schedule).some(\n ([key, value]) => schedule[key] !== value,\n )\n )\n report(\"schedule\", `${ecosystem}: schedule must match the shared policy`);\n const cooldown = update[\"cooldown\"];\n if (\n !record(cooldown) ||\n Object.keys(cooldown).length !== 1 ||\n cooldown[\"default-days\"] !== policy.cooldown.defaultDays\n )\n report(\n \"cooldown\",\n `${ecosystem}: cooldown must contain only default-days: ${policy.cooldown.defaultDays}`,\n );\n const groups = update[\"groups\"];\n if (\n !record(groups) ||\n Object.keys(groups).length !== Object.keys(policy.groups).length ||\n Object.entries(policy.groups).some(([name, expected]) => {\n const group = groups[name];\n return (\n !record(group) ||\n Object.keys(group).length !== 2 ||\n !sameStrings(group[\"patterns\"], expected.patterns) ||\n !sameStrings(group[\"update-types\"], expected.updateTypes)\n );\n })\n )\n report(\"groups\", `${ecosystem}: groups must match the shared policy`);\n const ignored = ignoredFor(ecosystem, policy);\n const ignore = update[\"ignore\"];\n if (ignore !== undefined && (!Array.isArray(ignore) || ignore.length === 0))\n report(\"ignore\", `${ecosystem}: omit ignore or provide a nonempty array`);\n if (\n Array.isArray(ignore) &&\n ignore.some(\n (entry: unknown) =>\n !record(entry) ||\n typeof entry[\"dependency-name\"] !== \"string\" ||\n !ignored.includes(entry[\"dependency-name\"]),\n )\n )\n report(\n \"ignore\",\n `${ecosystem}: ignore only packages owned by the shared policy`,\n );\n if (\n Array.isArray(ignore) &&\n ignore.some((entry: unknown) => !versionOnlyIgnore(entry))\n )\n report(\n \"ignore\",\n `${ecosystem}: each shared-pin ignore must contain only dependency-name and update-types for semver-major, semver-minor, and semver-patch version updates; security updates must remain enabled`,\n );\n for (const name of ignored) {\n if (\n !Array.isArray(ignore) ||\n !ignore.some(\n (entry: unknown) =>\n record(entry) &&\n entry[\"dependency-name\"] === name &&\n versionOnlyIgnore(entry),\n )\n )\n report(\n \"ignore\",\n `${ecosystem}: ignore all version updates for shared pin ${name}`,\n );\n }\n }\n for (const [ecosystem, directories] of roots) {\n for (const directory of directories) {\n if (!covered.get(ecosystem)?.has(directory))\n add(`add a ${ecosystem} update entry covering ${directory}`);\n }\n }\n return diagnostics;\n};\n","const locatorValidators = {\n image:\n /^(?:jobs\\.[\\w-]+\\.(?:container|services\\.[\\w-]+)|services\\.[\\w.-]+\\.image)$/,\n \"bun-source\": /^(?:jobs\\.[\\w-]+|runs)\\.steps\\.[\\w-]+$/,\n} as const;\n\ntype SelectorKind = keyof typeof locatorValidators;\nconst knownKind = (value: unknown): value is SelectorKind =>\n typeof value === \"string\" && Object.hasOwn(locatorValidators, value);\n\nexport type DynamicSelector = {\n path: string;\n kind: SelectorKind;\n reason: string;\n} & ({ at: string; line?: never } | { line: number; at?: never });\n\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\n/** One reviewed declaration identifies one unresolved selector, never a rule. */\nexport const parseDynamicSelectors = (input: unknown): DynamicSelector[] => {\n if (input === undefined) return [];\n if (!Array.isArray(input))\n throw new Error(\"dynamicSelectors must be an array\");\n const result: DynamicSelector[] = [];\n const keys = new Set<string>();\n for (const entry of input) {\n if (\n !record(entry) ||\n Object.keys(entry).some(\n (key) => ![\"path\", \"kind\", \"reason\", \"at\", \"line\"].includes(key),\n ) ||\n typeof entry[\"path\"] !== \"string\" ||\n entry[\"path\"] === \"\" ||\n /[\\\\:$*?]|[^\\S ]/.test(entry[\"path\"]) ||\n entry[\"path\"]\n .split(\"/\")\n .some((part) => part === \"\" || part === \".\" || part === \"..\") ||\n typeof entry[\"reason\"] !== \"string\" ||\n entry[\"reason\"].trim() === \"\"\n )\n throw new Error(\n \"each dynamic selector requires an exact repository path, known kind and nonempty reason\",\n );\n const kind = entry[\"kind\"];\n if (!knownKind(kind)) throw new Error(\"unknown dynamic selector kind\");\n let selector: DynamicSelector;\n if (\n Object.hasOwn(entry, \"line\") &&\n !Object.hasOwn(entry, \"at\") &&\n typeof entry[\"line\"] === \"number\" &&\n Number.isSafeInteger(entry[\"line\"]) &&\n entry[\"line\"] > 0\n ) {\n selector = {\n path: entry[\"path\"],\n kind,\n reason: entry[\"reason\"],\n line: entry[\"line\"],\n };\n } else if (\n !Object.hasOwn(entry, \"line\") &&\n typeof entry[\"at\"] === \"string\" &&\n locatorValidators[kind].test(entry[\"at\"])\n ) {\n selector = {\n path: entry[\"path\"],\n kind,\n reason: entry[\"reason\"],\n at: entry[\"at\"],\n };\n } else\n throw new Error(\n \"dynamic selector requires one positive line or a kind-specific job/service/step ID locator\",\n );\n const key = JSON.stringify([\n selector.path,\n selector.kind,\n selector.at ?? selector.line,\n ]);\n if (keys.has(key))\n throw new Error(\"dynamic selector locations must be unique\");\n keys.add(key);\n result.push(selector);\n }\n return result;\n};\n","import path from \"node:path\";\nimport { minVersion, satisfies, valid, validRange } from \"semver\";\nimport { parseDocument } from \"yaml\";\n\nexport type EngineFloor = { package: string; workflow: string; job: string };\nexport type ResolvedEngineFloor = EngineFloor & {\n range: string;\n major: number;\n};\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\nconst repositoryPath = (value: unknown): value is string =>\n typeof value === \"string\" &&\n value !== \"\" &&\n !/^[A-Za-z]:/.test(value) &&\n !/[\\\\\\s]/.test(value) &&\n !Array.from(value).some((character) => character.charCodeAt(0) < 32) &&\n value\n .split(\"/\")\n .every((part) => part !== \"\" && part !== \".\" && part !== \"..\");\n\nexport const parseEngineFloors = (input: unknown): EngineFloor[] => {\n if (input === undefined) return [];\n if (!Array.isArray(input)) throw new Error(\"engineFloors must be an array\");\n const result: EngineFloor[] = [];\n const jobs = new Set<string>();\n for (const entry of input) {\n if (\n !record(entry) ||\n Object.keys(entry).some(\n (key) => ![\"package\", \"workflow\", \"job\"].includes(key),\n ) ||\n (entry[\"package\"] !== \".\" && !repositoryPath(entry[\"package\"])) ||\n !repositoryPath(entry[\"workflow\"]) ||\n !/^\\.github\\/workflows\\/[^/]+\\.ya?ml$/.test(entry[\"workflow\"]) ||\n typeof entry[\"job\"] !== \"string\" ||\n entry[\"job\"].trim() === \"\"\n )\n throw new Error(\n \"each engine floor requires a repository package directory, workflow path and job\",\n );\n const key = `${entry[\"workflow\"]}:${entry[\"job\"]}`;\n if (jobs.has(key))\n throw new Error(\"engine floor workflow jobs must be unique\");\n jobs.add(key);\n result.push({\n package: entry[\"package\"],\n workflow: entry[\"workflow\"],\n job: entry[\"job\"],\n });\n }\n return result;\n};\n\nexport const resolveEngineFloor = (\n entry: EngineFloor,\n files: Record<string, string>,\n): ResolvedEngineFloor => {\n const manifestText = files[path.posix.join(entry.package, \"package.json\")];\n const workflowText = files[entry.workflow];\n if (manifestText === undefined || workflowText === undefined)\n throw new Error(\"engine floor package and workflow must be tracked\");\n const manifest: unknown = JSON.parse(manifestText);\n if (\n !record(manifest) ||\n manifest[\"private\"] === true ||\n typeof manifest[\"name\"] !== \"string\" ||\n manifest[\"name\"].trim() === \"\" ||\n !record(manifest[\"engines\"]) ||\n typeof manifest[\"engines\"][\"node\"] !== \"string\"\n )\n throw new Error(\n \"engine floor package must be published and declare engines.node\",\n );\n const range = manifest[\"engines\"][\"node\"];\n const minimum = validRange(range) === null ? null : minVersion(range);\n if (minimum === null || minimum.prerelease.length !== 0)\n throw new Error(\"engine floor engines.node must declare a stable minimum\");\n const document = parseDocument(workflowText, { merge: true });\n if (document.errors.length !== 0)\n throw new Error(\"engine floor workflow must be valid YAML\");\n const workflow: unknown = document.toJS({ maxAliasCount: 100 });\n if (!record(workflow) || !record(workflow[\"jobs\"]))\n throw new Error(\"engine floor job must exist in its tracked workflow\");\n const job = workflow[\"jobs\"][entry.job];\n if (!record(job))\n throw new Error(\"engine floor job must exist in its tracked workflow\");\n if (!Array.isArray(job[\"steps\"]) || Object.hasOwn(job, \"uses\"))\n throw new Error(\n \"engine floor job must declare steps and cannot reuse a workflow\",\n );\n return { ...entry, range, major: minimum.major };\n};\n\nexport const engineFloorSelectorMatches = (\n value: unknown,\n floor: ResolvedEngineFloor,\n) => {\n if (\n typeof value !== \"string\" ||\n !/^\\d+\\.\\d+\\.\\d+$/.test(value) ||\n valid(value) !== value\n )\n return false;\n return (\n Number(value.split(\".\").at(0)) === floor.major &&\n satisfies(value, floor.range)\n );\n};\n","import path from \"node:path\";\nimport picomatch from \"picomatch\";\nimport { satisfies, valid, validRange } from \"semver\";\nimport { isNode, LineCounter, parseDocument } from \"yaml\";\n\nimport { nodeSupportRangeMatches } from \"./toolchain-node\";\nimport { workspaceContains } from \"./toolchain-workspaces\";\n\nexport const packageRules = [\n \"bun-pins\",\n \"package-pins\",\n \"typescript-layout\",\n \"node-engine\",\n] as const;\n\ntype Layout =\n | {\n type: \"direct\";\n compilerPackage: string;\n compilerSpecifier: string;\n typecheckCommand: string;\n }\n | {\n type: \"split-compatibility\";\n compilerPackage: string;\n compilerSpecifier: string;\n compatibilityPackage: string;\n compatibilitySpecifier: string;\n typecheckCommand: string;\n };\n\ntype PackagePolicy = {\n bun: string;\n packages: Record<string, string>;\n typescriptInstallLayouts: readonly Layout[];\n typescript6Compatibility: { version: string; packageAlias: string };\n node: string;\n};\n\ntype Diagnostic = {\n rule: (typeof packageRules)[number];\n path: string;\n line: number;\n message: string;\n};\n\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\n// Inspect explicit substitution bodies without evaluating shell expressions.\nconst shellSubstitutions = (command: string) => {\n type Frame = {\n kind: \"root\" | \"parentheses\" | \"backticks\";\n start: number;\n depth: number;\n quote: \"'\" | '\"' | undefined;\n };\n const frames: Frame[] = [\n { kind: \"root\", start: 0, depth: 0, quote: undefined },\n ];\n const bodies: string[] = [];\n for (let index = 0; index < command.length; index += 1) {\n const frame = frames.at(-1);\n if (frame === undefined) break;\n const character = command.at(index);\n if (character === \"\\\\\" && frame.quote !== \"'\") {\n index += 1;\n continue;\n }\n if (character === \"`\" && frame.kind === \"backticks\") {\n bodies.push(command.slice(frame.start, index));\n frames.pop();\n continue;\n }\n if (character === frame.quote) {\n frame.quote = undefined;\n continue;\n }\n if (frame.quote === \"'\") continue;\n if (character === \"$\" && command.at(index + 1) === \"(\") {\n frames.push({\n kind: \"parentheses\",\n start: index + 2,\n depth: 1,\n quote: undefined,\n });\n index += 1;\n continue;\n }\n if (character === \"`\") {\n frames.push({\n kind: \"backticks\",\n start: index + 1,\n depth: 0,\n quote: undefined,\n });\n continue;\n }\n if (frame.quote !== undefined) continue;\n if (character === \"'\" || character === '\"') {\n frame.quote = character;\n continue;\n }\n if (frame.kind !== \"parentheses\") continue;\n if (character === \"(\") frame.depth += 1;\n if (character === \")\" && --frame.depth === 0) {\n bodies.push(command.slice(frame.start, index));\n frames.pop();\n }\n }\n for (const frame of frames.slice(1)) bodies.push(command.slice(frame.start));\n return bodies;\n};\n\nconst shellValueOptions = new Set([\n \"--rcfile\",\n \"--init-file\",\n \"-o\",\n \"+o\",\n \"-O\",\n \"+O\",\n]);\nconst shellExecutable = /^(?:\\/(?:[^/]+\\/)*)?(?:bash|dash|ksh|zsh|sh)$/;\n\ntype ShellToken = {\n kind: \"word\" | \"boundary\" | \"redirect\" | \"comment\";\n value: string;\n index: number;\n};\n\n// Keep expansion bodies in their word: substitutions are inspected separately as executable sources.\nconst shellTokens = (source: string) => {\n const tokens: ShellToken[] = [];\n for (let index = 0; index < source.length;) {\n const character = source.at(index);\n if (character === undefined) break;\n if (character === \"\\n\") {\n tokens.push({ kind: \"boundary\", value: character, index: index++ });\n continue;\n }\n if (/\\s/.test(character)) {\n index++;\n continue;\n }\n if (character === \"#\") {\n const end = source.indexOf(\"\\n\", index);\n const stop = end < 0 ? source.length : end;\n tokens.push({ kind: \"comment\", value: source.slice(index, stop), index });\n index = stop;\n continue;\n }\n const redirect = /^(?:\\d*)(?:&>>|&>|<<<|<<-|<<|>>|>\\||>&|<&|<>|>|<)/.exec(\n source.slice(index),\n );\n if (redirect !== null) {\n tokens.push({ kind: \"redirect\", value: redirect[0], index });\n index += redirect[0].length;\n continue;\n }\n const boundary = /^(?:&&|\\|\\||[();&|])/.exec(source.slice(index));\n if (boundary !== null) {\n tokens.push({ kind: \"boundary\", value: boundary[0], index });\n index += boundary[0].length;\n continue;\n }\n const start = index;\n type Frame = {\n kind: \"word\" | \"parentheses\" | \"backticks\";\n quote: \"'\" | '\"' | undefined;\n depth: number;\n };\n const frames: Frame[] = [{ kind: \"word\", quote: undefined, depth: 0 }];\n while (index < source.length) {\n const frame = frames.at(-1);\n const current = source.at(index);\n if (frame === undefined || current === undefined) break;\n if (current === \"\\\\\" && frame.quote !== \"'\") {\n index += 2;\n continue;\n }\n if (current === \"`\" && frame.kind === \"backticks\") {\n frames.pop();\n index++;\n continue;\n }\n if (current === frame.quote) {\n frame.quote = undefined;\n index++;\n continue;\n }\n if (frame.quote === \"'\") {\n index++;\n continue;\n }\n if (current === \"$\" && source.at(index + 1) === \"(\") {\n frames.push({ kind: \"parentheses\", quote: undefined, depth: 1 });\n index += 2;\n continue;\n }\n if (current === \"`\") {\n frames.push({ kind: \"backticks\", quote: undefined, depth: 0 });\n index++;\n continue;\n }\n if (frame.quote !== undefined) {\n index++;\n continue;\n }\n if (current === \"'\" || current === '\"') {\n frame.quote = current;\n index++;\n continue;\n }\n if (frame.kind === \"parentheses\") {\n if (current === \"(\") frame.depth++;\n if (current === \")\" && --frame.depth === 0) frames.pop();\n index++;\n continue;\n }\n if (frame.kind === \"word\" && /[\\s<>;&|()]/.test(current)) break;\n index++;\n }\n const value = source.slice(start, index);\n tokens.push({\n kind: \"word\",\n value,\n index: start,\n });\n }\n // Braces are reserved words only where a command or function body can begin.\n let groupDepth = 0;\n let redirectTarget = false;\n const commandWords: string[] = [];\n for (const token of tokens) {\n if (token.kind === \"comment\") continue;\n if (token.kind === \"redirect\") {\n redirectTarget = true;\n continue;\n }\n if (redirectTarget) {\n redirectTarget = false;\n if (token.kind === \"word\") continue;\n }\n if (token.kind === \"boundary\") {\n commandWords.length = 0;\n continue;\n }\n const functionBody =\n commandWords.length === 2 && commandWords.at(0) === \"function\";\n const opensGroup =\n token.value === \"{\" && (commandWords.length === 0 || functionBody);\n const closesGroup =\n token.value === \"}\" && groupDepth > 0 && commandWords.length === 0;\n if (opensGroup || closesGroup) {\n token.kind = \"boundary\";\n groupDepth += opensGroup ? 1 : -1;\n commandWords.length = 0;\n continue;\n }\n if (\n commandWords.length === 0 &&\n [\"if\", \"then\", \"elif\", \"else\", \"do\", \"!\", \"time\"].includes(token.value)\n )\n continue;\n commandWords.push(token.value);\n }\n return tokens;\n};\n\nconst shellArgumentTokens = (tokens: readonly ShellToken[]) => {\n const arguments_: ShellToken[] = [];\n let redirectTarget = false;\n for (const token of tokens) {\n if (token.kind === \"comment\") continue;\n if (token.kind === \"redirect\") {\n redirectTarget = true;\n continue;\n }\n if (redirectTarget) {\n redirectTarget = false;\n if (token.kind === \"word\") continue;\n }\n arguments_.push(token);\n }\n return arguments_;\n};\n\nconst shellReadsProgramStdin = (tokens: readonly ShellToken[]) => {\n const words = executableShellWords(\n shellArgumentTokens(tokens).map(({ value }) => value),\n ).map(decodeShellWord);\n if (!shellExecutable.test(words.at(0) ?? \"\")) return false;\n let stdin = false;\n let script = false;\n for (let index = 1; index < words.length; index++) {\n const option = words.at(index) ?? \"\";\n if (option === \"--\" || option === \"-\") {\n script = index + 1 < words.length;\n break;\n }\n if (!/^[+-]/.test(option)) {\n script = true;\n break;\n }\n if (shellValueOptions.has(option)) {\n index++;\n continue;\n }\n if (/^-[^-]*c/.test(option)) return false;\n if (/^-[^-]*s/.test(option)) stdin = true;\n }\n return stdin || !script;\n};\n\n// Descriptor copies retain their source; later redirections replace only their destination.\nconst shellStdinHeredoc = (tokens: readonly ShellToken[]) => {\n const descriptors = new Map<string, ShellToken>();\n for (let index = 0; index < tokens.length; index++) {\n const token = tokens.at(index);\n if (token?.kind !== \"redirect\") continue;\n const declaration = /^(\\d*)(.+)$/.exec(token.value);\n const operator = declaration?.[2];\n if (operator === undefined) continue;\n const descriptor = String(\n Number(declaration?.[1] || (operator.startsWith(\"<\") ? \"0\" : \"1\")),\n );\n const target = tokens.at(++index);\n if (operator === \"<<\" || operator === \"<<-\") {\n descriptors.set(descriptor, token);\n continue;\n }\n if (operator === \"<&\" || operator === \">&\") {\n const copy = /^(\\d+)(-?)$/.exec(decodeShellWord(target?.value ?? \"\"));\n const sourceDescriptor =\n copy?.[1] === undefined ? undefined : String(Number(copy[1]));\n const source =\n sourceDescriptor === undefined\n ? undefined\n : descriptors.get(sourceDescriptor);\n if (source === undefined) descriptors.delete(descriptor);\n else descriptors.set(descriptor, source);\n if (copy?.[2] === \"-\" && sourceDescriptor !== undefined)\n descriptors.delete(sourceDescriptor);\n continue;\n }\n descriptors.delete(descriptor);\n if (operator === \"&>\" || operator === \"&>>\") descriptors.delete(\"2\");\n }\n return descriptors.get(\"0\");\n};\n\n// Literal heredoc bodies are data, not direct shell command invocations.\nconst shellExecutableSource = (command: string) => {\n const pending: {\n delimiter: string;\n stripTabs: boolean;\n literal: boolean;\n execute: boolean;\n }[] = [];\n return command\n .split(/\\r?\\n/)\n .map((line) => {\n const here = pending.at(0);\n if (here !== undefined) {\n if (\n (here.stripTabs ? line.replace(/^\\t+/, \"\") : line) === here.delimiter\n ) {\n pending.shift();\n return \"\";\n }\n if (here.execute) return line;\n if (here.literal) return \"\";\n return shellSubstitutions(line).join(\"\\n\");\n }\n const words = shellTokens(line);\n let commandStart = 0;\n for (let index = 0; index < words.length; index++) {\n const match = words.at(index);\n const word = match?.value;\n if (word === undefined) continue;\n if (match?.kind === \"comment\") return line.slice(0, match.index);\n if (match?.kind === \"boundary\") {\n commandStart = index + 1;\n continue;\n }\n const declaration =\n match?.kind === \"redirect\" ? /^(?:\\d*)<<(-?)(.*)$/.exec(word) : null;\n let delimiter = declaration?.[2];\n if (delimiter === \"\") delimiter = words.at(++index)?.value;\n if (\n declaration !== null &&\n delimiter !== undefined &&\n !delimiter.startsWith(\"<\")\n ) {\n const commandEnd = words.findIndex(\n (entry, position) =>\n position > index &&\n (entry.kind === \"boundary\" || entry.kind === \"comment\"),\n );\n const invocation = words.slice(\n commandStart,\n commandEnd < 0 ? undefined : commandEnd,\n );\n pending.push({\n delimiter: decodeShellWord(delimiter),\n stripTabs: declaration[1] === \"-\",\n literal: /['\"\\\\]/.test(delimiter),\n execute:\n shellReadsProgramStdin(invocation) &&\n shellStdinHeredoc(invocation) === match,\n });\n }\n }\n return line;\n })\n .join(\"\\n\");\n};\n\nconst executableShellWords = (words: readonly string[]) => {\n let start = 0;\n const skipAssignments = () => {\n while (\n /^[A-Za-z_][A-Za-z\\d_]*=/.test(decodeShellWord(words.at(start) ?? \"\"))\n )\n start += 1;\n };\n skipAssignments();\n while (\n /^(?:\\/usr\\/bin\\/|\\/bin\\/)?env$/.test(\n decodeShellWord(words.at(start) ?? \"\"),\n )\n ) {\n start += 1;\n while (start < words.length) {\n const option = decodeShellWord(words.at(start) ?? \"\");\n if (option === \"--\") {\n start += 1;\n break;\n }\n if ([\"-u\", \"--unset\", \"-C\", \"--chdir\"].includes(option)) {\n start += 2;\n continue;\n }\n if (\n option === \"-S\" ||\n option === \"--split-string\" ||\n option.startsWith(\"--split-string=\") ||\n (option.startsWith(\"-S\") && option.length > 2)\n ) {\n let source: string;\n if (option === \"-S\" || option === \"--split-string\") {\n source = decodeShellWord(words.at(start + 1) ?? \"\");\n start += 2;\n } else {\n source = option.startsWith(\"-S\")\n ? option.slice(2)\n : option.slice(\"--split-string=\".length);\n start++;\n }\n return executableShellWords([\n \"env\",\n ...shellTokens(source).map(({ value }) => value),\n ...words.slice(start),\n ]);\n }\n if (\n option === \"-\" ||\n option === \"-i\" ||\n option === \"--ignore-environment\" ||\n /^--(?:unset|chdir)=.+|^-[uC].+/.test(option)\n ) {\n start += 1;\n continue;\n }\n break;\n }\n skipAssignments();\n }\n return words.slice(start);\n};\n\n// A quoted argument is executable only when the command itself is a shell with -c.\nconst shellCommandBody = (rawWords: readonly string[]) => {\n const words = executableShellWords(\n rawWords.filter((word) => word !== \"(\" && word !== \")\"),\n ).map(decodeShellWord);\n if (!shellExecutable.test(words.at(0) ?? \"\")) return undefined;\n for (let index = 1; index < words.length; index++) {\n const option = words.at(index);\n if (option === undefined || option === \"--\" || !/^[+-]/.test(option))\n return undefined;\n if (shellValueOptions.has(option)) {\n index++;\n continue;\n }\n if (/^-[^-]*c/.test(option)) return words.at(index + 1);\n }\n return undefined;\n};\n\n/** Shared executable shell words preserve assignments for runtime selectors. */\nexport const shellCommandSegments = (\n command: string,\n grouping: \"boundaries\" | \"tokens\" = \"boundaries\",\n) => {\n const segments: string[][] = [[]];\n const executableSource = shellExecutableSource(command);\n const sources = new Set([\n executableSource,\n ...shellSubstitutions(executableSource),\n ]);\n for (const source of sources) {\n const firstSegment = segments.length;\n segments.push([]);\n for (const { kind, value: word } of shellArgumentTokens(\n shellTokens(source),\n )) {\n if (kind === \"boundary\") {\n if ([\"(\", \")\", \"{\", \"}\"].includes(word) && grouping === \"tokens\")\n segments.at(-1)?.push(word);\n else segments.push([]);\n } else segments.at(-1)?.push(word);\n }\n for (const words of segments.slice(firstSegment)) {\n const body = shellCommandBody(words);\n if (body === undefined) continue;\n const executableBody = shellExecutableSource(body);\n sources.add(executableBody);\n for (const substitution of shellSubstitutions(executableBody))\n sources.add(substitution);\n }\n }\n return segments;\n};\n\n// Inspect direct compiler commands after removing environment launcher assignments.\nexport const compilerCommandSegments = (command: string) =>\n // Compiler policy compares raw invocations; retaining grouping prevents widening its allowlist.\n shellCommandSegments(command, \"tokens\").map(executableShellWords);\n\nconst launcherValueOptions = new Map(\n Object.entries({\n npx: [\n \"-p\",\n \"--package\",\n \"-c\",\n \"--call\",\n \"--cache\",\n \"--registry\",\n \"--userconfig\",\n ],\n bunx: [\"-p\", \"--package\"],\n pnpm: [\"--filter\", \"-F\", \"--dir\", \"-C\", \"--package\"],\n yarn: [\n \"--cwd\",\n \"--cache-folder\",\n \"--mutex\",\n \"--use-yarnrc\",\n \"--modules-folder\",\n \"--registry\",\n ],\n bun: [\n \"--cwd\",\n \"--filter\",\n \"-F\",\n \"--config\",\n \"-c\",\n \"--env-file\",\n \"-e\",\n \"--eval\",\n \"-p\",\n \"--print\",\n ],\n node: [\n \"-e\",\n \"--eval\",\n \"-p\",\n \"--print\",\n \"--conditions\",\n \"-C\",\n \"--inspect-port\",\n \"--max-old-space-size\",\n \"--stack-size\",\n \"--title\",\n \"--icu-data-dir\",\n \"--openssl-config\",\n \"--input-type\",\n ],\n }).map(([launcher, options]) => [launcher, new Set(options)]),\n);\n\nexport const decodeShellWord = (word: string) => {\n let result = \"\";\n let quote: \"'\" | '\"' | undefined;\n for (let index = 0; index < word.length; index += 1) {\n const character = word.at(index);\n if (character === quote) {\n quote = undefined;\n continue;\n }\n if (quote === undefined && (character === \"'\" || character === '\"')) {\n quote = character;\n continue;\n }\n const next = word.at(index + 1);\n if (\n character === \"\\\\\" &&\n next !== undefined &&\n quote !== \"'\" &&\n (quote === undefined || /[$`\"\\\\\\n]/.test(next))\n ) {\n if (next !== \"\\n\") result += next;\n index += 1;\n } else result += character;\n }\n return result;\n};\n\n// Classification sees launcher arguments; acceptance still uses the declared command.\nconst invokesCompiler = (words: string[]) => {\n const tokens = words.map(decodeShellWord);\n const compiler = (word: string) =>\n /(?:^|\\/)(?:tsc|tsgo)(?:\\.js)?$/.test(word);\n let start = 0;\n const skipOptions = (index: number, launcher: string) => {\n while (tokens.at(index)?.startsWith(\"-\")) {\n const option = tokens.at(index);\n index += 1;\n if (option === \"--\") break;\n if (\n option !== undefined &&\n launcherValueOptions.get(launcher)?.has(option)\n )\n index += 1;\n }\n return index;\n };\n while (start < tokens.length) {\n const launcher = tokens.at(start);\n if (launcher === undefined || !launcherValueOptions.has(launcher)) break;\n start = skipOptions(start + 1, launcher);\n if (launcher === \"bun\" && tokens.at(start) === \"check\") return true;\n const subcommand = tokens.at(start);\n if (\n (launcher === \"bun\" && (subcommand === \"x\" || subcommand === \"run\")) ||\n (launcher === \"pnpm\" &&\n (subcommand === \"exec\" || subcommand === \"dlx\")) ||\n (launcher === \"yarn\" &&\n (subcommand === \"exec\" || subcommand === \"dlx\" || subcommand === \"run\"))\n ) {\n start = skipOptions(start + 1, launcher);\n }\n }\n // Explicit compiler tokens behind unsupported launchers fail closed.\n const remaining = tokens.slice(start);\n return remaining.some(\n (word, index) =>\n compiler(word) ||\n (word === \"bun\" &&\n tokens.at(skipOptions(start + index + 1, \"bun\")) === \"check\"),\n );\n};\n\ntype CheckPackageFilesOptions = {\n files: Record<string, string>;\n policy: PackagePolicy;\n};\n\ntype AddDiagnosticOptions = {\n file: string;\n rule: Diagnostic[\"rule\"];\n key: string;\n value?: unknown;\n message: string;\n};\n\n/** Validate manifests and catalog resolutions from a tracked-file snapshot. */\nexport const checkPackageFiles = ({\n files,\n policy,\n}: CheckPackageFilesOptions) => {\n const sources = new Map(Object.entries(files));\n const diagnostics: Diagnostic[] = [];\n const pins = new Map(\n Object.entries({ ...policy.packages, \"bun-types\": policy.bun }),\n );\n const manifests = new Map<string, Record<string, unknown>>();\n const yamlLocations = new Map<string, number[]>();\n const reportedLines = new Map<string, number>();\n const add = ({ file, rule, key, value, message }: AddDiagnosticOptions) => {\n const source = sources.get(file);\n if (source === undefined)\n throw new Error(`Missing package diagnostic source: ${file}`);\n const serialized = value === undefined ? undefined : JSON.stringify(value);\n const locationKey = `${file}:${key}:${serialized ?? \"\"}`;\n const previous = reportedLines.get(locationKey) ?? -1;\n const yamlLine = yamlLocations.get(locationKey)?.shift();\n const index = source\n .split(/\\r?\\n/)\n .findIndex(\n (line, lineIndex) =>\n lineIndex > previous &&\n line.includes(JSON.stringify(key)) &&\n (serialized === undefined || line.includes(serialized)),\n );\n if (index >= 0) reportedLines.set(locationKey, index);\n diagnostics.push({\n rule,\n path: file,\n line: yamlLine ?? Math.max(1, index + 1),\n message,\n });\n };\n for (const [file, text] of sources) {\n const pnpm = path.posix.basename(file) === \"pnpm-workspace.yaml\";\n if (!pnpm && path.posix.basename(file) !== \"package.json\") continue;\n try {\n const lineCounter = new LineCounter();\n const document = pnpm ? parseDocument(text, { lineCounter }) : undefined;\n if (document !== undefined && document.errors.length > 0)\n throw new Error(\"invalid YAML\");\n const json: unknown =\n document === undefined ? JSON.parse(text) : document.toJS();\n if (!record(json)) throw new Error(\"manifest must be an object\");\n if (pnpm) {\n if (json[\"catalog\"] !== undefined && !record(json[\"catalog\"]))\n throw new Error(\"catalog must be a mapping\");\n if (\n json[\"catalogs\"] !== undefined &&\n (!record(json[\"catalogs\"]) ||\n Object.values(json[\"catalogs\"]).some((catalog) => !record(catalog)))\n )\n throw new Error(\"named catalogs must be mappings\");\n if (\n json[\"packages\"] !== undefined &&\n (!Array.isArray(json[\"packages\"]) ||\n !json[\"packages\"].every(\n (pattern: unknown) => typeof pattern === \"string\",\n ))\n )\n throw new Error(\"workspace packages must be patterns\");\n }\n manifests.set(file, json);\n if (document === undefined) continue;\n const catalogEntries = [\n { catalog: json[\"catalog\"], prefix: [\"catalog\"] },\n { catalog: json[\"overrides\"], prefix: [\"overrides\"] },\n ...(record(json[\"catalogs\"])\n ? Object.entries(json[\"catalogs\"]).map(([name, catalog]) => ({\n catalog,\n prefix: [\"catalogs\", name],\n }))\n : []),\n ];\n for (const { catalog, prefix } of catalogEntries) {\n if (!record(catalog)) continue;\n for (const [name, value] of Object.entries(catalog)) {\n const node = document.getIn([...prefix, name], true);\n if (!isNode(node) || node.range === undefined || node.range === null)\n continue;\n const key = `${file}:${name}:${JSON.stringify(value)}`;\n const lines = yamlLocations.get(key) ?? [];\n lines.push(lineCounter.linePos(node.range[0]).line);\n yamlLocations.set(key, lines);\n }\n }\n } catch {\n add({\n file,\n rule: \"package-pins\",\n key: \"\",\n message: pnpm\n ? \"invalid pnpm-workspace.yaml object\"\n : \"invalid package.json object\",\n });\n }\n }\n const catalogSources = (json: Record<string, unknown>) => [\n json,\n ...(record(json[\"workspaces\"]) ? [json[\"workspaces\"]] : []),\n ];\n const pnpmWorkspaceFor = (file: string) => {\n let directory = path.posix.dirname(file);\n while (true) {\n const workspace = manifests.get(\n path.posix.join(directory, \"pnpm-workspace.yaml\"),\n );\n if (workspace !== undefined) return { directory, workspace };\n if (directory === \".\") return undefined;\n directory = path.posix.dirname(directory);\n }\n };\n const catalogFor = (file: string, name: string): unknown => {\n const owner = pnpmWorkspaceFor(file);\n if (owner !== undefined) {\n const { directory, workspace } = owner;\n if (\n path.posix.basename(file) === \"package.json\" &&\n !workspaceContains({\n directory,\n file,\n patterns: workspace[\"packages\"],\n rootMembership: \"implicit\",\n })\n )\n return undefined;\n if (name === \"\" || name === \"default\")\n return (\n workspace[\"catalog\"] ??\n (record(workspace[\"catalogs\"])\n ? workspace[\"catalogs\"][\"default\"]\n : undefined)\n );\n return record(workspace[\"catalogs\"])\n ? workspace[\"catalogs\"][name]\n : undefined;\n }\n let directory = path.posix.dirname(file);\n while (true) {\n const manifest = manifests.get(\n path.posix.join(directory, \"package.json\"),\n );\n if (manifest !== undefined) {\n for (const source of catalogSources(manifest)) {\n if (name === \"\" && source[\"catalog\"] !== undefined)\n return source[\"catalog\"];\n if (\n record(source[\"catalogs\"]) &&\n source[\"catalogs\"][name] !== undefined\n )\n return source[\"catalogs\"][name];\n }\n // A workspace owns catalog resolution even when the requested catalog is absent.\n if (manifest[\"workspaces\"] !== undefined) return undefined;\n }\n if (directory === \".\") return undefined;\n directory = path.posix.dirname(directory);\n }\n };\n const resolve = (file: string, name: string, value: unknown): unknown => {\n const visited = new Set<string>();\n while (typeof value === \"string\" && value.startsWith(\"catalog:\")) {\n if (visited.has(value)) return undefined;\n visited.add(value);\n const catalog = catalogFor(file, value.slice(\"catalog:\".length));\n value = record(catalog) ? catalog[name] : undefined;\n }\n return value;\n };\n const workspaceOwnerFor = (file: string) => {\n const pnpm = pnpmWorkspaceFor(file);\n if (pnpm !== undefined)\n return {\n directory: pnpm.directory,\n patterns: pnpm.workspace[\"packages\"],\n source: \"pnpm\" as const,\n };\n let directory = path.posix.dirname(file);\n while (true) {\n const root = manifests.get(path.posix.join(directory, \"package.json\"));\n const workspaces = root?.[\"workspaces\"];\n if (workspaces !== undefined)\n return {\n directory,\n patterns: record(workspaces) ? workspaces[\"packages\"] : workspaces,\n source: \"json\" as const,\n };\n if (directory === \".\") return undefined;\n directory = path.posix.dirname(directory);\n }\n };\n type WorkspaceResolution = \"matched\" | \"nonmember\" | \"mismatch\";\n const workspaceResolution = ({\n file,\n name,\n pin,\n }: {\n file: string;\n name: string;\n pin: string;\n }): WorkspaceResolution => {\n const owner = workspaceOwnerFor(file);\n if (owner === undefined) return \"nonmember\";\n const { directory, patterns, source } = owner;\n if (source === \"json\" && !Array.isArray(patterns)) return \"mismatch\";\n if (\n !workspaceContains({\n directory,\n file,\n patterns,\n rootMembership: \"implicit\",\n })\n )\n return \"nonmember\";\n const candidates = [...manifests.entries()].filter(\n ([candidate, json]) =>\n path.posix.basename(candidate) === \"package.json\" &&\n json[\"name\"] === name &&\n workspaceContains({\n directory,\n file: candidate,\n patterns,\n rootMembership: source === \"json\" ? \"patterns\" : \"implicit\",\n }),\n );\n return candidates.length === 1 &&\n candidates.every(([, json]) => json[\"version\"] === pin)\n ? \"matched\"\n : \"mismatch\";\n };\n const tsSpecifiers = new Map<string, Set<string>>();\n for (const layout of policy.typescriptInstallLayouts) {\n const values =\n tsSpecifiers.get(layout.compilerPackage) ?? new Set<string>();\n values.add(layout.compilerSpecifier);\n tsSpecifiers.set(layout.compilerPackage, values);\n if (layout.type !== \"split-compatibility\") continue;\n const compatibility =\n tsSpecifiers.get(layout.compatibilityPackage) ?? new Set<string>();\n compatibility.add(layout.compatibilitySpecifier);\n tsSpecifiers.set(layout.compatibilityPackage, compatibility);\n }\n tsSpecifiers.set(\n policy.typescript6Compatibility.packageAlias,\n new Set([`npm:typescript@${policy.typescript6Compatibility.version}`]),\n );\n const layoutFor = (specifiers: Map<string, Set<unknown>>) =>\n policy.typescriptInstallLayouts.find((layout) => {\n const compiler = specifiers.get(layout.compilerPackage);\n if (compiler?.size !== 1 || !compiler.has(layout.compilerSpecifier))\n return false;\n if (layout.type === \"split-compatibility\") {\n const compatibility = specifiers.get(layout.compatibilityPackage);\n return (\n compatibility?.size === 1 &&\n compatibility.has(layout.compatibilitySpecifier)\n );\n }\n return policy.typescriptInstallLayouts.every(\n (other) =>\n other.compilerPackage === layout.compilerPackage ||\n !specifiers.has(other.compilerPackage),\n );\n });\n const peerRange = (value: unknown): value is string =>\n typeof value === \"string\" &&\n valid(value) === null &&\n validRange(value) !== null;\n const toolchainEntries = (file: string, json: Record<string, unknown>) => {\n const entries: { section: string; name: string; value: unknown }[] = [];\n for (const section of [\n \"dependencies\",\n \"devDependencies\",\n \"optionalDependencies\",\n \"peerDependencies\",\n ]) {\n const dependencies = json[section];\n if (!record(dependencies)) continue;\n for (const [name, value] of Object.entries(dependencies)) {\n if (!tsSpecifiers.has(name)) continue;\n const resolved = resolve(file, name, value);\n if (section === \"peerDependencies\" && peerRange(resolved)) continue;\n entries.push({ section, name, value: resolved });\n }\n }\n return entries;\n };\n const specifierMap = (entries: { name: string; value: unknown }[]) => {\n const specifiers = new Map<string, Set<unknown>>();\n for (const { name, value } of entries) {\n const values = specifiers.get(name) ?? new Set<unknown>();\n values.add(value);\n specifiers.set(name, values);\n }\n return specifiers;\n };\n const workspaceLayouts = new Map<\n string,\n { layout: Layout | undefined; directory: string }\n >();\n const workspaceLayoutFor = (file: string) => {\n const owner = workspaceOwnerFor(file);\n if (\n owner === undefined ||\n !workspaceContains({ ...owner, file, rootMembership: \"implicit\" })\n )\n return undefined;\n const key = `${owner.source}:${owner.directory}`;\n const cached = workspaceLayouts.get(key);\n if (cached !== undefined) return cached;\n const entries: { name: string; value: unknown }[] = [];\n for (const [candidate, member] of manifests) {\n if (path.posix.basename(candidate) !== \"package.json\") continue;\n const memberOwner = workspaceOwnerFor(candidate);\n if (\n memberOwner?.directory !== owner.directory ||\n memberOwner.source !== owner.source ||\n !workspaceContains({\n ...owner,\n file: candidate,\n rootMembership: \"implicit\",\n })\n )\n continue;\n entries.push(\n ...toolchainEntries(candidate, member).filter(\n ({ section }) => section === \"devDependencies\",\n ),\n );\n }\n const result = {\n layout: layoutFor(specifierMap(entries)),\n directory: owner.directory,\n };\n workspaceLayouts.set(key, result);\n return result;\n };\n for (const [file, json] of manifests) {\n const manager = json[\"packageManager\"];\n if (manager !== undefined && manager !== `bun@${policy.bun}`)\n add({\n file,\n rule: \"bun-pins\",\n key: \"packageManager\",\n value: manager,\n message: `packageManager Bun version must be ${policy.bun}, found ${JSON.stringify(manager)}`,\n });\n const checkEntries = (\n entries: unknown,\n location?: { key: string; value: unknown },\n ) => {\n if (!record(entries)) return;\n for (const [name, raw] of Object.entries(entries)) {\n const value = resolve(file, name, raw);\n const tsAllowed = tsSpecifiers.get(name);\n if (tsAllowed !== undefined) {\n if (typeof value !== \"string\" || !tsAllowed.has(value))\n add({\n file,\n rule: \"typescript-layout\",\n key: location?.key ?? name,\n value: location === undefined ? raw : location.value,\n message: `${name} must use a declared TypeScript specifier, found ${String(value)}`,\n });\n continue;\n }\n const pin = pins.get(name);\n if (pin === undefined) continue;\n if (value === pin) continue;\n const workspace =\n value === \"workspace:*\"\n ? workspaceResolution({ file, name, pin })\n : undefined;\n if (workspace === \"matched\") continue;\n add({\n file,\n rule: name === \"bun-types\" ? \"bun-pins\" : \"package-pins\",\n key: location?.key ?? name,\n value: location === undefined ? raw : location.value,\n message:\n workspace === \"nonmember\"\n ? `${name} workspace:* consumer is not a member of its nearest workspace`\n : `${name} must be ${pin}, found ${String(value)}`,\n });\n }\n };\n for (const key of [\n \"dependencies\",\n \"devDependencies\",\n \"optionalDependencies\",\n ])\n checkEntries(json[key]);\n if (record(json[\"peerDependencies\"]))\n for (const [name, value] of Object.entries(json[\"peerDependencies\"])) {\n if (tsSpecifiers.has(name) && !peerRange(resolve(file, name, value)))\n checkEntries({ [name]: value });\n }\n for (const source of catalogSources(json)) {\n checkEntries(source[\"catalog\"]);\n if (!record(source[\"catalogs\"])) continue;\n for (const catalog of Object.values(source[\"catalogs\"]))\n checkEntries(catalog);\n }\n const ownedNames = new Set([...pins.keys(), ...tsSpecifiers.keys()]);\n const resolutionDependencies: Record<string, unknown> = {};\n const resolutionRoot = manifests.get(\n path.posix.join(path.posix.dirname(file), \"package.json\"),\n );\n if (resolutionRoot !== undefined)\n for (const section of [\n \"dependencies\",\n \"devDependencies\",\n \"optionalDependencies\",\n ]) {\n const entries = resolutionRoot[section];\n if (!record(entries)) continue;\n for (const [name, value] of Object.entries(entries))\n resolutionDependencies[name] = resolve(file, name, value);\n }\n const affectedSpecifiers = new Map<string, Set<unknown>>();\n const owner = workspaceOwnerFor(file);\n for (const [candidate, member] of manifests) {\n if (path.posix.basename(candidate) !== \"package.json\") continue;\n const memberOwner = workspaceOwnerFor(candidate);\n const ownManifest =\n candidate === path.posix.join(path.posix.dirname(file), \"package.json\");\n if (\n !ownManifest &&\n !(\n owner !== undefined &&\n owner.directory === path.posix.dirname(file) &&\n memberOwner?.directory === owner.directory &&\n memberOwner.source === owner.source &&\n workspaceContains({\n directory: owner.directory,\n file: candidate,\n patterns: owner.patterns,\n rootMembership: \"implicit\",\n })\n )\n )\n continue;\n for (const section of [\n \"dependencies\",\n \"devDependencies\",\n \"optionalDependencies\",\n ]) {\n const entries = member[section];\n if (!record(entries)) continue;\n for (const [name, value] of Object.entries(entries)) {\n if (!tsSpecifiers.has(name)) continue;\n const values = affectedSpecifiers.get(name) ?? new Set<unknown>();\n values.add(resolve(candidate, name, value));\n affectedSpecifiers.set(name, values);\n }\n }\n }\n const checkResolutionMap = (entries: unknown, parent?: string) => {\n if (!record(entries)) return;\n for (const [selector, replacement] of Object.entries(entries)) {\n // npm's nested '.' replaces the enclosing package; Yarn and pnpm\n // qualify a target with a dependency path or a parent selector.\n const target = selector === \".\" ? parent : selector;\n if (target === undefined) continue;\n let pattern =\n target\n .split(/>\\s*(?=[@A-Za-z_*]|$)/)\n .at(-1)\n ?.trim() ?? \"\";\n const version = pattern.lastIndexOf(\"@\");\n let qualifier: string | undefined;\n if (version > pattern.lastIndexOf(\"/\")) {\n qualifier = pattern.slice(version + 1).replace(/^npm:/, \"\");\n pattern = pattern.slice(0, version);\n }\n const parts = pattern.split(\"/\");\n pattern = parts.at(-2)?.startsWith(\"@\")\n ? parts.slice(-2).join(\"/\")\n : (parts.at(-1) ?? \"\");\n if (pattern === \"\") {\n add({\n file,\n rule: \"package-pins\",\n key: selector,\n value: replacement,\n message: \"resolution selector must name a package\",\n });\n continue;\n }\n if (record(replacement)) {\n checkResolutionMap(replacement, target);\n continue;\n }\n for (const name of ownedNames) {\n if (!picomatch(pattern)(name)) continue;\n let value = replacement;\n if (typeof replacement === \"string\" && replacement.startsWith(\"$\")) {\n const reference = replacement.slice(1);\n value = resolutionDependencies[reference];\n }\n const resolved = resolve(file, name, value);\n checkEntries(\n { [name]: value },\n {\n key: selector,\n value: replacement,\n },\n );\n if (\n tsSpecifiers.has(name) &&\n [...(affectedSpecifiers.get(name) ?? [])].some((specifier) => {\n if (resolved === specifier) return false;\n if (qualifier === undefined || validRange(qualifier) === null)\n return true;\n if (typeof specifier !== \"string\") return false;\n const versionSpecifier = specifier.startsWith(\"npm:\")\n ? specifier.slice(specifier.lastIndexOf(\"@\") + 1)\n : specifier;\n const release = valid(versionSpecifier);\n return release !== null && satisfies(release, qualifier);\n }) &&\n typeof resolved === \"string\" &&\n tsSpecifiers.get(name)?.has(resolved)\n )\n add({\n file,\n rule: \"typescript-layout\",\n key: selector,\n value: replacement,\n message: `${name} resolution must preserve its declared TypeScript install specifier`,\n });\n }\n }\n };\n checkResolutionMap(json[\"overrides\"]);\n checkResolutionMap(json[\"resolutions\"]);\n if (record(json[\"pnpm\"])) checkResolutionMap(json[\"pnpm\"][\"overrides\"]);\n const localEntries = toolchainEntries(file, json);\n const usesCompiler = policy.typescriptInstallLayouts.some((layout) =>\n localEntries.some(({ name }) => name === layout.compilerPackage),\n );\n let selectedLayout = layoutFor(specifierMap(localEntries));\n if (usesCompiler) {\n if (\n layoutFor(\n specifierMap(\n localEntries.filter(\n ({ section }) => section !== \"peerDependencies\",\n ),\n ),\n ) === undefined\n )\n selectedLayout = undefined;\n if (selectedLayout === undefined) {\n const workspace = workspaceLayoutFor(file);\n const layout = workspace?.layout;\n if (workspace !== undefined && layout !== undefined) {\n const expected = new Map([\n [layout.compilerPackage, layout.compilerSpecifier],\n ]);\n if (layout.type === \"split-compatibility\")\n expected.set(\n layout.compatibilityPackage,\n layout.compatibilitySpecifier,\n );\n expected.set(\n policy.typescript6Compatibility.packageAlias,\n `npm:typescript@${policy.typescript6Compatibility.version}`,\n );\n const developmentOnly = localEntries.every(\n ({ section, name, value }) =>\n section === \"devDependencies\" && expected.get(name) === value,\n );\n const runtimeCompatibilityOnly =\n layout.type === \"split-compatibility\" &&\n path.posix.dirname(file) !== workspace.directory &&\n localEntries.every(\n ({ section, name, value }) =>\n (section === \"dependencies\" ||\n section === \"devDependencies\" ||\n section === \"peerDependencies\") &&\n name === layout.compatibilityPackage &&\n value === layout.compatibilitySpecifier,\n );\n if (developmentOnly || runtimeCompatibilityOnly)\n selectedLayout = layout;\n }\n }\n if (selectedLayout === undefined)\n add({\n file,\n rule: \"typescript-layout\",\n key: \"dependencies\",\n message:\n \"TypeScript compiler and compatibility packages must match one complete declared install layout\",\n });\n const command = record(json[\"scripts\"])\n ? json[\"scripts\"][\"typecheck\"]\n : undefined;\n if (selectedLayout !== undefined && typeof command === \"string\") {\n const normalizedExpected = selectedLayout.typecheckCommand\n .replace(/\\s+/g, \" \")\n .trim();\n for (const words of compilerCommandSegments(command)) {\n if (!invokesCompiler(words)) continue;\n const normalized = words.join(\" \");\n if (\n !words.some((word) => word === \"(\" || word === \")\") &&\n shellSubstitutions(normalized).length === 0 &&\n (normalized === normalizedExpected ||\n normalized.startsWith(`${normalizedExpected} `))\n )\n continue;\n add({\n file,\n rule: \"typescript-layout\",\n key: \"typecheck\",\n value: command,\n message: `typecheck compiler invocation must use ${selectedLayout.typecheckCommand}`,\n });\n break;\n }\n }\n }\n if (record(json[\"peerDependencies\"])) {\n const peerLayout = selectedLayout ?? workspaceLayoutFor(file)?.layout;\n for (const [name, raw] of Object.entries(json[\"peerDependencies\"])) {\n if (!tsSpecifiers.has(name)) continue;\n const range = resolve(file, name, raw);\n if (!peerRange(range)) continue;\n const releases = new Set<string>();\n for (const layout of policy.typescriptInstallLayouts) {\n if (\n layout.compilerPackage !== name &&\n !(\n layout.type === \"split-compatibility\" &&\n layout.compatibilityPackage === name\n )\n )\n continue;\n const specifier = layout.compilerSpecifier;\n releases.add(\n specifier.startsWith(\"npm:\")\n ? specifier.slice(specifier.lastIndexOf(\"@\") + 1)\n : specifier,\n );\n }\n if (name === policy.typescript6Compatibility.packageAlias)\n releases.add(policy.typescript6Compatibility.version);\n if (\n peerLayout?.type === \"split-compatibility\" &&\n name === peerLayout.compatibilityPackage\n )\n releases.add(peerLayout.compatibilitySpecifier);\n if ([...releases].every((release) => satisfies(release, range)))\n continue;\n add({\n file,\n rule: \"typescript-layout\",\n key: name,\n value: raw,\n message: `${name} peer support range must include ${[...releases].join(\" and \")}, found ${range}`,\n });\n }\n }\n if (\n record(json[\"engines\"]) &&\n json[\"engines\"][\"node\"] !== undefined &&\n (typeof json[\"engines\"][\"node\"] !== \"string\" ||\n !nodeSupportRangeMatches(policy.node, json[\"engines\"][\"node\"]))\n )\n add({\n file,\n rule: \"node-engine\",\n key: \"node\",\n value: json[\"engines\"][\"node\"],\n message: `engines.node must support ${policy.node}, found ${JSON.stringify(json[\"engines\"][\"node\"])}`,\n });\n }\n return diagnostics;\n};\n","import { parseDocument } from \"yaml\";\n\nimport { canonicalDockerRuntime, rustImageVersion } from \"./toolchain-images\";\nimport { githubAutomationFileKind, isShellScript } from \"./toolchain-inputs\";\nimport { decodeShellWord, shellCommandSegments } from \"./toolchain-packages\";\n\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nexport type RustException = {\n pin: string;\n reason: string;\n tracking: string;\n expires: string;\n};\n\n/** Exceptions authorize one immutable release, never a channel or an entire rule. */\nexport const parseRustExceptions = (\n input: unknown,\n today = new Date().toISOString().slice(0, 10),\n): RustException[] => {\n if (input === undefined) return [];\n if (!Array.isArray(input)) throw new Error(\"rustExceptions must be an array\");\n const pins = new Set<string>();\n return input.map((entry: unknown) => {\n if (\n !record(entry) ||\n Object.keys(entry).length !== 4 ||\n Object.keys(entry).some(\n (key) => ![\"pin\", \"reason\", \"tracking\", \"expires\"].includes(key),\n ) ||\n typeof entry[\"pin\"] !== \"string\" ||\n !/^(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)$/.test(entry[\"pin\"]) ||\n typeof entry[\"reason\"] !== \"string\" ||\n entry[\"reason\"].trim() === \"\" ||\n typeof entry[\"tracking\"] !== \"string\" ||\n !/^https:\\/\\/github\\.com\\/[^/\\s]+\\/[^/\\s]+\\/issues\\/[1-9]\\d*$/.test(\n entry[\"tracking\"],\n ) ||\n typeof entry[\"expires\"] !== \"string\" ||\n !/^\\d{4}-\\d{2}-\\d{2}$/.test(entry[\"expires\"]) ||\n !Number.isFinite(Date.parse(entry[\"expires\"])) ||\n new Date(entry[\"expires\"]).toISOString().slice(0, 10) !==\n entry[\"expires\"] ||\n entry[\"expires\"] <= today ||\n pins.has(entry[\"pin\"])\n )\n throw new Error(\n \"each Rust exception requires a unique exact stable pin, reason, GitHub issue and future valid expiry date\",\n );\n pins.add(entry[\"pin\"]);\n return {\n pin: entry[\"pin\"],\n reason: entry[\"reason\"],\n tracking: entry[\"tracking\"],\n expires: entry[\"expires\"],\n };\n });\n};\n\ntype RustReferenceOptions = {\n file: string;\n rust: string;\n exceptions: readonly RustException[];\n} & (\n | { type: \"file\"; text: string }\n | { type: \"command\"; source: string; line: number }\n | {\n type: \"environment\";\n assignments: readonly { key: string; value: string }[];\n line: number;\n }\n);\n\n/** Only executable fields are inspected: unrelated action inputs are not Rust selectors. */\nexport const checkRustReferences = (options: RustReferenceOptions) => {\n const { file, rust, exceptions } = options;\n const text = options.type === \"file\" ? options.text : \"\";\n const diagnostics: {\n rule: \"rust-version\";\n path: string;\n line: number;\n message: string;\n }[] = [];\n const select = (value: unknown, label: string, line = 1) => {\n if (value === rust || exceptions.some(({ pin }) => pin === value)) return;\n diagnostics.push({\n rule: \"rust-version\",\n path: file,\n line,\n message: `${label} must be Rust ${rust}, found ${String(value)}`,\n });\n };\n const shell = (source: string, firstLine = 1) => {\n const commands = shellCommandSegments(source).map((words) =>\n words.map((word) => ({ value: decodeShellWord(word), line: firstLine })),\n );\n for (const command of commands) {\n let position = 0;\n const prefixes = new Set([\n \"if\",\n \"then\",\n \"do\",\n \"elif\",\n \"!\",\n \"env\",\n \"sudo\",\n \"command\",\n \"exec\",\n \"time\",\n \"export\",\n \"readonly\",\n \"/usr/bin/env\",\n \"/bin/env\",\n ]);\n while (position < command.length) {\n const value = command.at(position)?.value;\n if (value?.startsWith(\"RUSTUP_TOOLCHAIN=\"))\n select(\n value.slice(\"RUSTUP_TOOLCHAIN=\".length),\n \"RUSTUP_TOOLCHAIN\",\n firstLine,\n );\n if (value === \"-u\" || value === \"--unset\") {\n position += 2;\n continue;\n }\n if (\n value?.startsWith(\"--unset=\") ||\n value === \"-i\" ||\n value === \"--ignore-environment\"\n ) {\n position++;\n continue;\n }\n if (\n value !== undefined &&\n (prefixes.has(value) || /^[A-Za-z_][A-Za-z_\\d]*=/.test(value))\n )\n position++;\n else break;\n }\n const executable = command.at(position)?.value;\n const arguments_ = command.slice(position + 1);\n if (executable === \"cargo\" && arguments_.at(0)?.value.startsWith(\"+\")) {\n const selector = arguments_.at(0);\n select(selector?.value.slice(1), \"cargo toolchain\", selector?.line);\n }\n if (executable !== \"rustup\") continue;\n let subcommandPosition = 0;\n while (subcommandPosition < arguments_.length) {\n const token = arguments_.at(subcommandPosition);\n if (token === undefined) break;\n if (token.value === \"--\") {\n subcommandPosition++;\n break;\n }\n if (token.value.startsWith(\"+\")) {\n select(token.value.slice(1), \"rustup toolchain\", token.line);\n } else if (!token.value.startsWith(\"-\")) break;\n subcommandPosition++;\n }\n const invocation = arguments_.slice(subcommandPosition);\n const subcommand = invocation.at(0)?.value;\n if (subcommand === \"target\" || subcommand === \"component\") {\n // These commands name targets/components positionally; only this option selects Rust.\n for (let index = 1; index < invocation.length; index++) {\n const token = invocation.at(index);\n if (token?.value === \"--toolchain\") {\n select(\n invocation.at(++index)?.value,\n \"rustup --toolchain\",\n token.line,\n );\n } else if (token?.value.startsWith(\"--toolchain=\")) {\n select(\n token.value.slice(\"--toolchain=\".length),\n \"rustup --toolchain\",\n token.line,\n );\n }\n }\n continue;\n }\n let selectors: typeof invocation;\n let requiresSelector = true;\n let firstSelectorOnly = false;\n if (\n subcommand === \"default\" ||\n subcommand === \"install\" ||\n subcommand === \"add\" ||\n subcommand === \"update\"\n ) {\n selectors = invocation.slice(1);\n requiresSelector = subcommand !== \"update\";\n } else if (\n subcommand === \"toolchain\" &&\n [\"install\", \"add\", \"update\"].includes(invocation.at(1)?.value ?? \"\")\n ) {\n selectors = invocation.slice(2);\n requiresSelector = invocation.at(1)?.value !== \"update\";\n } else if (subcommand === \"run\") {\n selectors = invocation.slice(1);\n firstSelectorOnly = true;\n } else if (\n subcommand === \"override\" &&\n invocation.at(1)?.value === \"set\"\n ) {\n selectors = invocation.slice(2);\n firstSelectorOnly = true;\n } else continue;\n let selected = 0;\n const optionArguments = new Set([\n \"--path\",\n \"--profile\",\n \"--component\",\n \"-c\",\n \"--target\",\n \"-t\",\n ]);\n for (let index = 0; index < selectors.length; index++) {\n const token = selectors.at(index);\n if (token === undefined) continue;\n if (optionArguments.has(token.value)) {\n index++;\n continue;\n }\n if (token.value.startsWith(\"-\")) continue;\n selected++;\n select(token.value, \"rustup toolchain\", token.line);\n if (firstSelectorOnly) break;\n }\n if (selected === 0 && requiresSelector)\n select(undefined, \"rustup toolchain\", firstLine);\n }\n };\n if (options.type === \"environment\") {\n for (const { key, value } of options.assignments) {\n if (key === \"RUSTUP_TOOLCHAIN\") select(value, key, options.line);\n }\n return diagnostics;\n }\n if (options.type === \"command\") {\n shell(options.source, options.line);\n return diagnostics;\n }\n const lineOf = (token: string) => {\n const index = text.split(/\\r?\\n/).findIndex((line) => line.includes(token));\n return index < 0 ? 1 : index + 1;\n };\n if (isShellScript(file, text)) shell(text);\n if (/(?:^|\\/)package\\.json$/.test(file)) {\n try {\n const object: unknown = JSON.parse(text);\n if (record(object) && record(object[\"scripts\"]))\n for (const [name, script] of Object.entries(object[\"scripts\"]))\n if (typeof script === \"string\") shell(script, lineOf(`\"${name}\"`));\n } catch {\n /* The package owner reports invalid JSON. */\n }\n }\n if (/(?:^|\\/)ci-service-images\\.json$/.test(file)) {\n const images = (value: unknown) => {\n if (\n typeof value === \"string\" &&\n /^rust(?=:|@|$)/.test(canonicalDockerRuntime(value))\n ) {\n const tag = canonicalDockerRuntime(value)\n .replace(/^rust:?/, \"\")\n .split(\"@\")\n .at(0);\n const version = tag === undefined ? undefined : rustImageVersion(tag);\n select(version, \"Rust service image\", lineOf(value));\n } else if (Array.isArray(value)) value.forEach(images);\n else if (record(value))\n for (const [key, entry] of Object.entries(value)) {\n if (key !== \"name\") images(entry);\n }\n };\n try {\n images(JSON.parse(text));\n } catch {\n diagnostics.push({\n rule: \"rust-version\",\n path: file,\n line: 1,\n message: \"invalid service image JSON\",\n });\n }\n }\n if (githubAutomationFileKind(file) === undefined) return diagnostics;\n const document = parseDocument(text);\n if (document.errors.length > 0) return diagnostics;\n try {\n const visit = (value: unknown) => {\n if (Array.isArray(value)) {\n value.forEach(visit);\n return;\n }\n if (!record(value)) return;\n if (\n record(value[\"env\"]) &&\n value[\"env\"][\"RUSTUP_TOOLCHAIN\"] !== undefined\n )\n select(\n value[\"env\"][\"RUSTUP_TOOLCHAIN\"],\n \"RUSTUP_TOOLCHAIN\",\n lineOf(\"RUSTUP_TOOLCHAIN\"),\n );\n if (typeof value[\"run\"] === \"string\") shell(value[\"run\"], lineOf(\"run:\"));\n const uses = value[\"uses\"];\n if (typeof uses === \"string\") {\n const action = uses.split(\"@\").at(0)?.toLowerCase();\n const inputs = record(value[\"with\"]) ? value[\"with\"] : {};\n if (\n action === \"dtolnay/rust-toolchain\" ||\n action === \"actions-rust-lang/setup-rust-toolchain\"\n ) {\n const entries = Object.entries(inputs).filter(\n ([key]) => key.toLowerCase() === \"toolchain\",\n );\n if (entries.length !== 1)\n select(\n undefined,\n `${action} requires an explicit exact toolchain input`,\n lineOf(uses),\n );\n else {\n const selected = entries.at(0)?.at(1);\n // setup-rust-toolchain installs every comma-separated release.\n const selectors =\n action === \"actions-rust-lang/setup-rust-toolchain\" &&\n typeof selected === \"string\"\n ? selected.split(\",\").map((pin) => pin.trim())\n : [selected];\n for (const selector of selectors)\n select(selector, `${action} toolchain`, lineOf(\"toolchain:\"));\n }\n } else if (\n /(?:^|\\/)\\.github\\/workflows\\/[^@]+\\.ya?ml(?:@|$)/.test(uses)\n ) {\n for (const [key, selected] of Object.entries(inputs))\n if ([\"toolchain\", \"rust-toolchain\"].includes(key.toLowerCase()))\n select(selected, `reusable workflow ${key}`, lineOf(`${key}:`));\n }\n }\n for (const [key, child] of Object.entries(value)) {\n if (key === \"workflow_call\" && record(child) && record(child[\"inputs\"]))\n for (const [input, declaration] of Object.entries(child[\"inputs\"]))\n if (\n [\"toolchain\", \"rust-toolchain\"].includes(input) &&\n record(declaration) &&\n declaration[\"default\"] !== undefined\n )\n select(\n declaration[\"default\"],\n `reusable workflow default ${input}`,\n lineOf(\"default:\"),\n );\n visit(child);\n }\n };\n visit(document.toJS({ maxAliasCount: 100 }));\n } catch {\n /* The workflow owner reports alias resolution failures. */\n }\n return diagnostics;\n};\n","import path from \"node:path\";\nimport { parse as parseToml } from \"smol-toml\";\nimport {\n isAlias,\n isMap,\n isScalar,\n isSeq,\n LineCounter,\n parseAllDocuments,\n parseDocument,\n} from \"yaml\";\n\nimport {\n containerDocumentImages,\n isComposeDefinitionPath,\n isKubernetesDefinitionPath,\n} from \"./toolchain-container-inputs\";\nimport type { DynamicSelector } from \"./toolchain-dynamic-selectors\";\nimport {\n engineFloorSelectorMatches,\n type ResolvedEngineFloor,\n} from \"./toolchain-engine-floors\";\nimport { canonicalDockerRuntime, rustImageVersion } from \"./toolchain-images\";\nimport {\n githubAutomationFileKind,\n isMiseConfigPath,\n isDockerDefinitionPath,\n} from \"./toolchain-inputs\";\nimport { nodeSelectorMatches } from \"./toolchain-node\";\nimport { checkRustReferences, type RustException } from \"./toolchain-rust\";\n\nexport const runtimeRules = [\n \"bun-pins\",\n \"node-version\",\n \"python-version\",\n \"rust-version\",\n \"runtime-manager\",\n \"runtime-docker\",\n \"runtime-workflow\",\n \"action-pins\",\n] as const;\n\ntype RuntimeRule = (typeof runtimeRules)[number];\n\ntype RuntimePolicy = {\n node: string;\n python: string;\n rust: string;\n bun: string;\n packages: Record<string, string>;\n actions: Record<string, { sha: string; version: string }>;\n};\n\ntype RuntimeDiagnostic = {\n rule: RuntimeRule;\n path: string;\n line: number;\n message: string;\n};\n\nexport type RuntimeDelegation = {\n path: string;\n line: number;\n tool: \"node\" | \"python\" | \"bun\";\n selector: string;\n checkoutPath: string;\n ref: string;\n};\n\ntype CheckRuntimeFileOptions = {\n file: string;\n text: string;\n policy: RuntimePolicy;\n trackedFiles: ReadonlySet<string>;\n readFile: (file: string) => string | undefined;\n repository?: string | undefined;\n onDelegated?: ((report: RuntimeDelegation) => void) | undefined;\n dynamicSelectors?: readonly DynamicSelector[] | undefined;\n onDynamicSelector?: ((entry: DynamicSelector) => void) | undefined;\n rustExceptions?: readonly RustException[] | undefined;\n engineFloors?: readonly ResolvedEngineFloor[] | undefined;\n onEngineFloor?:\n | ((floor: ResolvedEngineFloor, status: \"matched\" | \"mismatch\") => void)\n | undefined;\n};\n\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\ntype DockerEnvironmentOptions = { source: string; escape: string };\n\n// ENV uses whitespace-delimited assignments, not shell operators or command substitution.\nconst dockerEnvironmentAssignments = ({\n source,\n escape,\n}: DockerEnvironmentOptions) => {\n const words: string[] = [];\n let word = \"\";\n let quote: \"'\" | '\"' | undefined;\n for (let index = 0; index < source.length; index++) {\n const character = source.at(index) ?? \"\";\n if (character === escape && quote !== \"'\") {\n word += character + (source.at(++index) ?? \"\");\n continue;\n }\n if (character === quote) quote = undefined;\n else if (quote === undefined && (character === \"'\" || character === '\"'))\n quote = character;\n else if (quote === undefined && /\\s/.test(character)) {\n if (word !== \"\") words.push(word);\n word = \"\";\n continue;\n }\n word += character;\n }\n if (quote !== undefined) return undefined;\n if (word !== \"\") words.push(word);\n const decode = (raw: string) => {\n let value = \"\";\n let quoted: \"'\" | '\"' | undefined;\n for (let index = 0; index < raw.length; index++) {\n const character = raw.at(index) ?? \"\";\n if (character === quoted) {\n quoted = undefined;\n continue;\n }\n if (quoted === undefined && (character === \"'\" || character === '\"')) {\n quoted = character;\n continue;\n }\n const next = raw.at(index + 1);\n if (\n character === escape &&\n quoted !== \"'\" &&\n next !== undefined &&\n (quoted === undefined ||\n next === '\"' ||\n next === \"$\" ||\n next === escape)\n ) {\n value += next;\n index++;\n } else value += character;\n }\n return value;\n };\n const first = words.at(0);\n if (first === undefined) return undefined;\n if (!first.includes(\"=\")) {\n const legacy = /^(\\S+)\\s+([\\s\\S]*)$/.exec(source);\n if (legacy === null) return undefined;\n return [{ key: decode(legacy[1] ?? \"\"), value: decode(legacy[2] ?? \"\") }];\n }\n const assignments: { key: string; value: string }[] = [];\n for (const raw of words) {\n const separator = raw.indexOf(\"=\");\n if (separator < 1) return undefined;\n assignments.push({\n key: decode(raw.slice(0, separator)),\n value: decode(raw.slice(separator + 1)),\n });\n }\n return assignments;\n};\n\nconst pythonSelectorMatches = (value: unknown, expected: string) =>\n value === expected ||\n (typeof value === \"string\" &&\n /^\\d+\\.\\d+$/.test(expected) &&\n value.startsWith(`${expected}.`) &&\n /^\\d+\\.\\d+\\.\\d+$/.test(value));\n\nconst compareRelease = (left: readonly number[], right: readonly number[]) => {\n for (let index = 0; index < Math.max(left.length, right.length); index++) {\n const difference = (left.at(index) ?? 0) - (right.at(index) ?? 0);\n if (difference !== 0) return Math.sign(difference);\n }\n return 0;\n};\n\n/** A minor policy covers every nonnegative patch in that release series. */\ntype PythonSeriesRequirementOptions = {\n current: readonly number[];\n operator: string;\n target: readonly number[];\n wildcard: boolean;\n};\nconst pythonSeriesRequirementMatches = ({\n current,\n operator,\n target,\n wildcard,\n}: PythonSeriesRequirementOptions) => {\n const prefixCovers = (prefix: readonly number[]) =>\n prefix.length <= 2 &&\n prefix.every((part, index) => current.at(index) === part);\n const prefixOverlaps =\n target.slice(0, 2).every((part, index) => current.at(index) === part) &&\n target.slice(3).every((part) => part === 0);\n if (wildcard) {\n if (operator === \"==\") return prefixCovers(target);\n if (operator === \"!=\") return !prefixOverlaps;\n return false;\n }\n const minimumComparison = compareRelease(current, target);\n const seriesComparison = compareRelease(\n current.slice(0, 2),\n target.slice(0, 2),\n );\n switch (operator) {\n case \"==\":\n return false;\n case \"!=\":\n return !(\n seriesComparison === 0 && target.slice(3).every((part) => part === 0)\n );\n case \">=\":\n return minimumComparison >= 0;\n case \">\":\n return minimumComparison > 0;\n case \"<=\":\n case \"<\":\n return seriesComparison < 0;\n case \"~=\":\n return (\n target.length >= 2 &&\n minimumComparison >= 0 &&\n prefixCovers(target.slice(0, -1))\n );\n default:\n return false;\n }\n};\n\n/** Evaluate final-release Python constraints against the complete selected version set. */\nconst pythonRequirementMatches = (requirement: unknown, version: string) => {\n if (typeof requirement !== \"string\" || requirement.trim() === \"\")\n return false;\n const current = version.split(\".\").map(Number);\n return requirement.split(\",\").every((clause) => {\n const match = /^(~=|==|!=|<=|>=|<|>)\\s*(\\d+(?:\\.\\d+)*)(\\.\\*)?$/.exec(\n clause.trim(),\n );\n if (match === null) return false;\n const operator = match[1];\n const release = match[2];\n if (release === undefined || operator === undefined) return false;\n const target = release.split(\".\").map(Number);\n if (current.length === 2)\n return pythonSeriesRequirementMatches({\n current,\n operator,\n target,\n wildcard: match[3] !== undefined,\n });\n const comparison = compareRelease(current, target);\n if (match[3] !== undefined) {\n if (operator !== \"==\" && operator !== \"!=\") return false;\n const prefix = target.every(\n (part, index) => (current.at(index) ?? 0) === part,\n );\n return operator === \"==\" ? prefix : !prefix;\n }\n switch (operator) {\n case \"==\":\n return comparison === 0;\n case \"!=\":\n return comparison !== 0;\n case \"<=\":\n return comparison <= 0;\n case \">=\":\n return comparison >= 0;\n case \"<\":\n return comparison < 0;\n case \">\":\n return comparison > 0;\n case \"~=\": {\n if (target.length < 2) return false;\n const prefix = target.slice(0, -1);\n return (\n comparison >= 0 &&\n prefix.every((part, index) => (current.at(index) ?? 0) === part)\n );\n }\n default:\n return false;\n }\n });\n};\n\n/** Check runtime declarations only in the files that declare or configure them. */\nexport const checkRuntimeFile = ({\n file,\n text,\n policy,\n trackedFiles,\n readFile,\n repository,\n onDelegated,\n dynamicSelectors = [],\n onDynamicSelector,\n rustExceptions = [],\n engineFloors = [],\n onEngineFloor,\n}: CheckRuntimeFileOptions): RuntimeDiagnostic[] => {\n const diagnostics: RuntimeDiagnostic[] = checkRustReferences({\n type: \"file\",\n file,\n text,\n rust: policy.rust,\n exceptions: rustExceptions,\n });\n const name = path.posix.basename(file);\n const lines = text.split(/\\r?\\n/);\n type RuntimeDiagnosticOptions = Pick<\n RuntimeDiagnostic,\n \"rule\" | \"line\" | \"message\"\n >;\n const add = ({ rule, line, message }: RuntimeDiagnosticOptions) => {\n diagnostics.push({ rule, path: file, line, message });\n };\n let currentLocation: string | undefined;\n const dynamic = (value: unknown) =>\n typeof value === \"string\" && value.includes(\"$\");\n const authorizeDynamic = (\n kind: DynamicSelector[\"kind\"],\n line: number,\n at = currentLocation,\n ) => {\n const matches = dynamicSelectors.filter(\n (entry) =>\n entry.path === file &&\n entry.kind === kind &&\n (entry.at !== undefined ? entry.at === at : entry.line === line),\n );\n if (matches.length !== 1) return false;\n const entry = matches.at(0);\n if (entry === undefined) return false;\n onDynamicSelector?.(entry);\n return true;\n };\n const lineOf = (key: string) =>\n Math.max(1, lines.findIndex((line) => line.includes(key)) + 1);\n type RuntimePinOptions = {\n rule: RuntimeRule;\n value: unknown;\n expected: string;\n label: string;\n line?: number;\n selector?: \"node\" | undefined;\n };\n const pin = ({\n rule,\n value,\n expected,\n label,\n line = 1,\n selector,\n }: RuntimePinOptions) => {\n let matches =\n value === expected ||\n (rule === \"rust-version\" &&\n rustExceptions.some((entry) => entry.pin === value));\n if (selector === \"node\") matches = nodeSelectorMatches(value, expected);\n else if (label.includes(\"python\"))\n matches = pythonSelectorMatches(value, expected);\n if (!matches)\n add({\n rule,\n line,\n message: `${label} must be ${expected}, found ${String(value)}`,\n });\n };\n const toml = (rule: RuntimeRule) => {\n try {\n return parseToml(text);\n } catch {\n add({\n rule,\n line: 1,\n message: \"invalid TOML\",\n });\n return undefined;\n }\n };\n const versions = {\n ...policy.packages,\n ...Object.fromEntries(\n Object.entries(policy.packages).map(([tool, version]) => [\n `npm:${tool}`,\n version,\n ]),\n ),\n bun: policy.bun,\n node: policy.node,\n nodejs: policy.node,\n python: policy.python,\n rust: policy.rust,\n \"core:node\": policy.node,\n \"core:python\": policy.python,\n \"core:rust\": policy.rust,\n \"core:bun\": policy.bun,\n };\n const nodeTools = new Set([\"node\", \"nodejs\", \"core:node\"]);\n if (name === \".bun-version\")\n pin({\n rule: \"bun-pins\",\n value: text.trim(),\n expected: policy.bun,\n label: name,\n });\n if (name === \".node-version\" || name === \".nvmrc\")\n pin({\n rule: \"node-version\",\n selector: \"node\",\n value: text.trim(),\n expected: policy.node,\n label: name,\n });\n if (name === \".python-version\")\n pin({\n rule: \"python-version\",\n value: text.trim(),\n expected: policy.python,\n label: name,\n });\n const firstContent = lines.find(\n (line) => line.trim() !== \"\" && !line.trimStart().startsWith(\"#\"),\n );\n const rustToml =\n name === \"rust-toolchain.toml\" ||\n (name === \"rust-toolchain\" && firstContent?.trimStart().startsWith(\"[\"));\n if (name === \"rust-toolchain\" && !rustToml)\n pin({\n rule: \"rust-version\",\n value: text.trim(),\n expected: policy.rust,\n label: name,\n });\n if (rustToml) {\n const parsed = toml(\"rust-version\");\n if (parsed !== undefined) {\n const toolchain = parsed[\"toolchain\"];\n pin({\n rule: \"rust-version\",\n value: record(toolchain) ? toolchain[\"channel\"] : undefined,\n expected: policy.rust,\n label: \"Rust channel\",\n line: lineOf(\"channel\"),\n });\n }\n }\n if (name === \"Cargo.toml\") {\n const parsed = toml(\"rust-version\");\n const rustFloor = (value: unknown) => {\n const parts =\n typeof value === \"string\" &&\n /^(?:0|[1-9]\\d*)(?:\\.(?:0|[1-9]\\d*)){0,2}$/.test(value)\n ? value.split(\".\").map(Number)\n : undefined;\n if (\n parts === undefined ||\n !parts.every(Number.isSafeInteger) ||\n compareRelease(parts, policy.rust.split(\".\").map(Number)) > 0\n )\n add({\n rule: \"rust-version\",\n line: lineOf(\"rust-version\"),\n message: `Cargo rust-version must be a bare support floor at or below Rust ${policy.rust}`,\n });\n };\n const readManifest = (candidate: string) => {\n if (candidate === file) return parsed;\n if (!trackedFiles.has(candidate)) return undefined;\n try {\n return parseToml(readFile(candidate) ?? \"\");\n } catch {\n return undefined;\n }\n };\n if (parsed !== undefined) {\n const workspace = parsed[\"workspace\"];\n const defaults = record(workspace) ? workspace[\"package\"] : undefined;\n if (record(defaults) && defaults[\"rust-version\"] !== undefined)\n rustFloor(defaults[\"rust-version\"]);\n const pkg = parsed[\"package\"];\n const version = record(pkg) ? pkg[\"rust-version\"] : undefined;\n if (version !== undefined) {\n if (!record(version)) rustFloor(version);\n else {\n let inherited: unknown;\n if (version[\"workspace\"] === true && record(pkg)) {\n const explicit = pkg[\"workspace\"];\n let directory = path.posix.dirname(file);\n const explicitPath =\n typeof explicit === \"string\" &&\n !explicit.includes(\"\\\\\") &&\n !explicit.includes(\":\") &&\n !explicit.includes(\"${{\") &&\n !path.posix.isAbsolute(explicit)\n ? path.posix.normalize(path.posix.join(directory, explicit))\n : undefined;\n if (\n explicit === undefined ||\n (explicitPath !== undefined &&\n explicitPath !== \"..\" &&\n !explicitPath.startsWith(\"../\"))\n ) {\n if (explicitPath !== undefined) directory = explicitPath;\n while (true) {\n const owner = readManifest(\n path.posix.join(directory, \"Cargo.toml\"),\n );\n const table = owner?.[\"workspace\"];\n if (record(table)) {\n const fields = table[\"package\"];\n inherited = record(fields)\n ? fields[\"rust-version\"]\n : undefined;\n break;\n }\n if (explicit !== undefined || directory === \".\") break;\n directory = path.posix.dirname(directory);\n }\n }\n }\n rustFloor(inherited);\n }\n }\n }\n }\n if (name === \"Pipfile\") {\n const parsed = toml(\"python-version\");\n const requires = parsed?.[\"requires\"];\n if (record(requires)) {\n const minor = requires[\"python_version\"];\n if (\n minor !== undefined &&\n minor !== policy.python.split(\".\").slice(0, 2).join(\".\")\n )\n add({\n rule: \"python-version\",\n line: lineOf(\"python_version\"),\n message: `Pipfile python_version must select Python ${policy.python}`,\n });\n const full = requires[\"python_full_version\"];\n if (\n full !== undefined &&\n !(\n typeof full === \"string\" &&\n /^\\d+\\.\\d+\\.\\d+$/.test(full) &&\n pythonSelectorMatches(full, policy.python)\n )\n )\n add({\n rule: \"python-version\",\n line: lineOf(\"python_full_version\"),\n message: `Pipfile python_full_version must select Python ${policy.python}`,\n });\n }\n }\n if (name === \"pyproject.toml\" || name === \"uv.toml\") {\n const parsed = toml(\"python-version\");\n if (parsed !== undefined) {\n const project = parsed[\"project\"];\n if (record(project) && project[\"requires-python\"] !== undefined)\n if (\n !pythonRequirementMatches(project[\"requires-python\"], policy.python)\n )\n add({\n rule: \"python-version\",\n line: lineOf(\"requires-python\"),\n message: `requires-python must include Python ${policy.python}; unsupported constraints must use final-release version specifiers`,\n });\n const tool = parsed[\"tool\"];\n const configuredUv = record(tool) ? tool[\"uv\"] : undefined;\n const uv = name === \"uv.toml\" ? parsed : configuredUv;\n if (record(uv) && uv[\"python\"] !== undefined)\n pin({\n rule: \"python-version\",\n value: uv[\"python\"],\n expected: policy.python,\n label: \"uv python\",\n line: lineOf(\"python\"),\n });\n }\n }\n if (isMiseConfigPath(file)) {\n const parsed = toml(\"runtime-manager\");\n const tools = parsed?.[\"tools\"];\n if (record(tools)) {\n for (const [tool, expected] of Object.entries(versions)) {\n const configured = tools[tool];\n if (configured !== undefined)\n pin({\n rule:\n tool === \"rust\" || tool === \"core:rust\"\n ? \"rust-version\"\n : \"runtime-manager\",\n value: record(configured) ? configured[\"version\"] : configured,\n expected,\n selector: nodeTools.has(tool) ? \"node\" : undefined,\n label: `mise ${tool}`,\n line: lineOf(tool),\n });\n }\n }\n }\n if (name === \".tool-versions\") {\n lines.forEach((line, index) => {\n const fields = line.replace(/#.*$/, \"\").trim().split(/\\s+/);\n const tool = fields.at(0);\n if (tool === undefined || !(tool in versions)) return;\n const expected = Object.entries(versions).find(\n ([key]) => key === tool,\n )?.[1];\n if (expected !== undefined)\n pin({\n rule:\n tool === \"rust\" || tool === \"core:rust\"\n ? \"rust-version\"\n : \"runtime-manager\",\n value: fields.slice(1).join(\" \"),\n expected,\n selector: nodeTools.has(tool) ? \"node\" : undefined,\n label: `.tool-versions ${tool}`,\n line: index + 1,\n });\n });\n }\n type RuntimeImageOptions = {\n image: unknown;\n line: number;\n label: string;\n at?: string | undefined;\n };\n const checkRuntimeImage = ({\n image,\n line,\n label,\n at,\n }: RuntimeImageOptions) => {\n const unknownRuntime = () => {\n const rustImage =\n typeof image === \"string\" &&\n /^rust(?=:|@|$)/i.test(canonicalDockerRuntime(image));\n if (!rustImage && dynamic(image) && authorizeDynamic(\"image\", line, at))\n return;\n add({\n rule: rustImage ? \"rust-version\" : \"runtime-docker\",\n line,\n message: rustImage\n ? `cannot determine ${label} Rust release; use a static exact pin`\n : `cannot determine ${label} runtime; use a static image or a scoped dynamicSelectors declaration`,\n });\n };\n if (typeof image !== \"string\") {\n unknownRuntime();\n return;\n }\n const canonical = canonicalDockerRuntime(image);\n // Variable defaults may contain reference delimiters; preserve offsets while classifying.\n const structuralImage = canonical.replace(\n /\\$\\{[^}]*\\}|\\$[A-Za-z_][A-Za-z_\\d]*/g,\n (variable) => \"x\".repeat(variable.length),\n );\n const digestSeparator = structuralImage.indexOf(\"@\");\n const reference =\n digestSeparator < 0 ? canonical : canonical.slice(0, digestSeparator);\n const structuralReference =\n digestSeparator < 0\n ? structuralImage\n : structuralImage.slice(0, digestSeparator);\n const managedFamily = /^(node|python|rust|oven\\/bun)(?=:|$)/i.exec(\n structuralReference,\n )?.[1];\n const tagSeparator =\n managedFamily === undefined\n ? structuralReference.lastIndexOf(\":\")\n : structuralReference.indexOf(\":\", managedFamily.length);\n const hasTag =\n managedFamily === undefined\n ? tagSeparator > structuralReference.lastIndexOf(\"/\")\n : tagSeparator !== -1;\n const imageRepository = hasTag\n ? reference.slice(0, tagSeparator)\n : reference;\n if (imageRepository.length === 0 || imageRepository.includes(\"$\")) {\n unknownRuntime();\n return;\n }\n if (!/^(node|python|rust|oven\\/bun)$/i.test(imageRepository)) return;\n const tool = imageRepository.toLowerCase();\n let imageRule: RuntimeRule = \"runtime-docker\";\n if (tool === \"rust\") imageRule = \"rust-version\";\n else if (tool === \"oven/bun\") imageRule = \"bun-pins\";\n if (image.includes(\"$\")) {\n unknownRuntime();\n return;\n }\n const digest =\n digestSeparator < 0 ? undefined : canonical.slice(digestSeparator + 1);\n if (digest !== undefined && !/^sha256:[a-fA-F\\d]{64}$/.test(digest)) {\n add({\n rule: imageRule,\n line,\n message: `${label} ${tool} digest must be sha256 followed by 64 hexadecimal characters`,\n });\n return;\n }\n const tag = hasTag ? reference.slice(tagSeparator + 1) : undefined;\n const variantSuffix =\n tool === \"oven/bun\"\n ? /-(?:alpine|slim|debian)$/\n : /-(?:alpine(?:\\d+(?:\\.\\d+)*)?|(?:bookworm|bullseye|trixie|buster)(?:-slim)?|slim)$/;\n // Strip only supported image variants; prerelease qualifiers remain invalid pins.\n const version =\n tool === \"rust\" && tag !== undefined\n ? rustImageVersion(tag)\n : tag?.replace(variantSuffix, \"\");\n let expected = policy.bun;\n if (tool === \"node\") expected = policy.node;\n else if (tool === \"python\") expected = policy.python;\n else if (tool === \"rust\") expected = policy.rust;\n if (digest !== undefined) {\n if (\n version === undefined ||\n !/^(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)$/.test(version)\n ) {\n add({\n rule: imageRule,\n line,\n message: `${label} ${tool} digest requires an exact stable patch tag matching ${expected}`,\n });\n return;\n }\n if (tool === \"node\" && trackedFiles.has(\".node-version\")) {\n const trackedNode = readFile(\".node-version\")?.trim();\n if (trackedNode !== version) {\n add({\n rule: \"runtime-docker\",\n line,\n message: `${label} node digest tag must match tracked .node-version, found ${version}`,\n });\n return;\n }\n }\n }\n pin({\n rule: imageRule,\n value: version,\n expected,\n selector: tool === \"node\" ? \"node\" : undefined,\n label: `${label} ${tool}`,\n line,\n });\n };\n if (isDockerDefinitionPath(file)) {\n const variables = new Map<string, string>();\n const escape = /^\\s*#\\s*escape\\s*=\\s*([\\\\`])\\s*$/m.exec(text)?.[1] ?? \"\\\\\";\n const continuation = new RegExp(`${escape === \"`\" ? \"`\" : \"\\\\\\\\\"}\\\\s*$`);\n const stages = new Set<string>();\n let argumentScope: \"global\" | \"stage\" = \"global\";\n const heredocs: { delimiter: string; stripTabs: boolean; line: number }[] =\n [];\n let instruction = \"\";\n let startLine = 1;\n let pendingRustRun: { source: string; line: number } | undefined;\n const checkRustCommand = (source: string, line: number) => {\n diagnostics.push(\n ...checkRustReferences({\n type: \"command\",\n file,\n source,\n line,\n rust: policy.rust,\n exceptions: rustExceptions,\n }),\n );\n };\n const expand = (value: string) => {\n for (let count = 0; count <= variables.size; count++) {\n const next = value.replace(\n /\\$(?:\\{([A-Za-z_][A-Za-z_\\d]*)\\}|([A-Za-z_][A-Za-z_\\d]*))/g,\n (reference, braced: string | undefined, plain: string | undefined) =>\n variables.get(braced ?? plain ?? \"\") ?? reference,\n );\n if (next === value) return next;\n value = next;\n }\n return value;\n };\n const collectHeredocs = (content: string, line: number) => {\n let quote: \"'\" | '\"' | undefined;\n for (let index = 0; index < content.length; index++) {\n const character = content.at(index);\n if (quote !== undefined) {\n if (character === quote) quote = undefined;\n else if (quote === '\"' && character === \"\\\\\") index++;\n continue;\n }\n if (character === \"\\\\\") {\n index++;\n continue;\n }\n if (character === \"'\" || character === '\"') {\n quote = character;\n continue;\n }\n if (\n character === \"#\" &&\n (index === 0 || /[\\s;&|()]/.test(content.at(index - 1) ?? \"\"))\n )\n break;\n if (character !== \"<\" || content.at(index + 1) !== \"<\") continue;\n if (content.at(index + 2) === \"<\") {\n index += 2;\n continue;\n }\n index += 2;\n const stripTabs = content.at(index) === \"-\";\n if (stripTabs) index++;\n while (/\\s/.test(content.at(index) ?? \"\")) index++;\n if (content.at(index) === \"#\") {\n add({\n rule: \"runtime-docker\",\n line,\n message: \"invalid Docker heredoc delimiter\",\n });\n break;\n }\n let delimiter = \"\";\n let delimiterQuote: \"'\" | '\"' | undefined;\n for (; index < content.length; index++) {\n const part = content.at(index);\n if (delimiterQuote !== undefined) {\n if (part === delimiterQuote) delimiterQuote = undefined;\n else if (\n delimiterQuote === '\"' &&\n part === \"\\\\\" &&\n /[$\"\\\\]/.test(content.at(index + 1) ?? \"\")\n )\n delimiter += content.at(++index);\n else delimiter += part;\n continue;\n }\n if (part === \"'\" || part === '\"') {\n delimiterQuote = part;\n continue;\n }\n if (part === \"\\\\\" && content.at(index + 1) !== undefined) {\n delimiter += content.at(++index);\n continue;\n }\n if (/[\\s;&|<>()]/.test(part ?? \"\")) break;\n delimiter += part;\n }\n if (delimiter !== \"\" && delimiterQuote === undefined)\n heredocs.push({ delimiter, stripTabs, line });\n else\n add({\n rule: \"runtime-docker\",\n line,\n message: \"invalid Docker heredoc delimiter\",\n });\n index--;\n }\n };\n const checkInstruction = (content: string, line: number) => {\n const argument = /^\\s*ARG\\s+([A-Za-z_][A-Za-z_\\d]*)(?:=(.*))?$/i.exec(\n content,\n );\n if (argument !== null) {\n if (argumentScope === \"stage\") return;\n const key = argument[1];\n const value = argument[2];\n if (key !== undefined && value !== undefined)\n variables.set(key, expand(value.replace(/^([\"'])(.*)\\1$/, \"$2\")));\n return;\n }\n const run = /^\\s*RUN\\s+(.+)$/i.exec(content);\n if (run !== null) {\n let source = run[1] ?? \"\";\n source = source.replace(/^(?:--\\S+\\s+)*/, \"\");\n if (source.startsWith(\"[\")) {\n try {\n const words: unknown = JSON.parse(source);\n if (\n Array.isArray(words) &&\n words.every((word: unknown) => typeof word === \"string\")\n ) {\n // Exec-form arguments are literal; only an explicit shell -c evaluates their contents.\n source = words\n .map((word) => `'${word.replaceAll(\"'\", \"'\\\\''\")}'`)\n .join(\" \");\n }\n } catch {\n // A leading bracket also starts a shell test; preserve shell form unless JSON proves exec form.\n }\n }\n const implicit = /^(<<-?(?:'[^']+'|\"[^\"]+\"|\\S+))(?:\\s+(.+))?$/.exec(\n source,\n );\n if (implicit !== null && implicit[2] === undefined)\n source = `sh ${source}`;\n collectHeredocs(content, line);\n if (heredocs.length > 0) pendingRustRun = { source, line };\n else checkRustCommand(source, line);\n return;\n }\n const environment = /^\\s*ENV\\s+(.+)$/i.exec(content);\n if (environment !== null) {\n const assignments = dockerEnvironmentAssignments({\n source: environment[1] ?? \"\",\n escape,\n });\n if (assignments === undefined) {\n add({\n rule: \"runtime-docker\",\n line,\n message: \"invalid Docker ENV assignments\",\n });\n return;\n }\n diagnostics.push(\n ...checkRustReferences({\n type: \"environment\",\n file,\n assignments,\n line,\n rust: policy.rust,\n exceptions: rustExceptions,\n }),\n );\n return;\n }\n if (/^\\s*COPY\\s+/i.test(content)) {\n collectHeredocs(content, line);\n return;\n }\n const from =\n /^\\s*FROM\\s+(?:--platform=\\S+\\s+)?(\\S+)(?:\\s+AS\\s+(\\S+))?/i.exec(\n content,\n );\n if (from === null || from[1] === undefined) return;\n argumentScope = \"stage\";\n const image = expand(from[1]);\n const stage = from[2]?.toLowerCase();\n const previousStage = stages.has(image.toLowerCase());\n if (stage !== undefined) stages.add(stage);\n if (previousStage) return;\n checkRuntimeImage({ image, line, label: \"FROM\" });\n };\n lines.forEach((line, index) => {\n const heredoc = heredocs.at(0);\n if (heredoc !== undefined) {\n if (pendingRustRun !== undefined) pendingRustRun.source += `\\n${line}`;\n if (\n (heredoc.stripTabs ? line.replace(/^\\t+/, \"\") : line) ===\n heredoc.delimiter\n )\n heredocs.shift();\n if (heredocs.length === 0 && pendingRustRun !== undefined) {\n checkRustCommand(pendingRustRun.source, pendingRustRun.line);\n pendingRustRun = undefined;\n }\n return;\n }\n if (line.trimStart().startsWith(\"#\")) return;\n if (instruction === \"\") startLine = index + 1;\n instruction += line.replace(continuation, \" \");\n if (continuation.test(line)) return;\n checkInstruction(instruction, startLine);\n instruction = \"\";\n });\n if (instruction !== \"\") checkInstruction(instruction, startLine);\n for (const heredoc of heredocs)\n add({\n rule: \"runtime-docker\",\n line: heredoc.line,\n message: `unterminated Docker heredoc ${heredoc.delimiter}`,\n });\n }\n if (isComposeDefinitionPath(file) || isKubernetesDefinitionPath(file)) {\n const lineCounter = new LineCounter();\n for (const containerDocument of parseAllDocuments(text, {\n lineCounter,\n merge: true,\n uniqueKeys: true,\n })) {\n const contents = containerDocument.contents;\n const declaredResource =\n isMap(contents) &&\n isScalar(contents.get(\"apiVersion\", true)) &&\n isScalar(contents.get(\"kind\", true));\n const recognizedContainer =\n isComposeDefinitionPath(file) || declaredResource;\n if (containerDocument.errors.length > 0) {\n if (recognizedContainer)\n add({\n rule: \"runtime-docker\",\n line: 1,\n message: \"invalid container YAML\",\n });\n continue;\n }\n try {\n const classified = containerDocumentImages(\n containerDocument.toJS({ maxAliasCount: 100 }),\n file,\n );\n for (const entry of classified?.images ?? []) {\n const node = containerDocument.getIn(entry.path, true);\n const line =\n (isMap(node) || isScalar(node) || isSeq(node) || isAlias(node)) &&\n node.range !== undefined &&\n node.range !== null\n ? lineCounter.linePos(node.range[0]).line\n : 1;\n checkRuntimeImage({\n image: entry.image,\n line,\n at: entry.path.join(\".\"),\n label:\n classified?.ecosystem === \"docker-compose\"\n ? \"Compose image\"\n : \"Kubernetes image\",\n });\n }\n } catch {\n if (recognizedContainer)\n add({\n rule: \"runtime-docker\",\n line: 1,\n message: \"invalid container YAML aliases\",\n });\n }\n }\n }\n const automationKind = githubAutomationFileKind(file);\n if (automationKind === undefined) return diagnostics;\n const document = parseDocument(text, { uniqueKeys: true, merge: true });\n if (document.errors.length > 0) {\n add({\n rule: \"runtime-workflow\",\n line: 1,\n message: \"invalid workflow YAML\",\n });\n return diagnostics;\n }\n const nodeLine = (node: unknown) => {\n if (!record(node) || !Array.isArray(node[\"range\"])) return 1;\n const offset: unknown = node[\"range\"].at(0);\n return typeof offset === \"number\"\n ? text.slice(0, offset).split(\"\\n\").length\n : 1;\n };\n type SparseCheckout =\n | { mode: \"all\" }\n | { mode: \"files\"; paths: ReadonlySet<string> }\n | { mode: \"invalid\" }\n | { mode: \"dynamic\" }\n | { mode: \"mixed\"; paths: ReadonlySet<string> };\n type CheckoutBinding = {\n path: string;\n sparse: SparseCheckout;\n dynamicSource: boolean;\n } & (\n | { source: \"tracked\" }\n | { source: \"untrusted\"; reason: string; line: number }\n | { source: \"delegated\"; ref: string }\n );\n let checkoutBindings: CheckoutBinding[] = [];\n let checkoutDestinations = new Map<string, number>();\n let unknownCheckoutDestination = false;\n let unreviewableCheckoutSource = false;\n const staticRepositoryPath = (value: unknown): value is string =>\n typeof value === \"string\" &&\n value !== \"\" &&\n !value.includes(\"${{\") &&\n !value.includes(\"\\\\\") &&\n !value.includes(\":\") &&\n !path.posix.isAbsolute(value) &&\n !value.split(\"/\").includes(\"..\");\n const normalizeCheckoutPath = (prefix: string) =>\n path.posix.normalize(prefix).replace(/\\/$/, \"\") || \".\";\n type RuntimeReferenceOptions = {\n value: unknown;\n tool: \"node\" | \"python\" | \"bun\";\n line: number;\n };\n const checkoutProvidersFor = (selector: string | undefined) => {\n if (selector === undefined) return checkoutBindings;\n let deepest: CheckoutBinding | undefined;\n for (const entry of checkoutBindings) {\n if (\n entry.path !== \".\" &&\n selector !== entry.path &&\n !selector.startsWith(`${entry.path}/`)\n )\n continue;\n if (\n deepest === undefined ||\n (entry.path !== \".\" &&\n (deepest.path === \".\" || entry.path.length > deepest.path.length))\n )\n deepest = entry;\n }\n return checkoutBindings.filter((entry) => entry.path === deepest?.path);\n };\n const hasAmbiguousCheckoutWriters = (\n selector: string | undefined,\n providers: readonly CheckoutBinding[],\n ) => {\n if (providers.length > 0)\n return providers.some(\n (entry) => (checkoutDestinations.get(entry.path) ?? 0) > 1,\n );\n // A selector before checkout cannot borrow a tracked shadow of an ambiguous destination.\n return [...checkoutDestinations].some(\n ([prefix, count]) =>\n count > 1 &&\n (selector === undefined ||\n prefix === \".\" ||\n selector === prefix ||\n selector.startsWith(`${prefix}/`)),\n );\n };\n const checkReference = ({ value, tool, line }: RuntimeReferenceOptions) => {\n const selectors = {\n node: [\".node-version\", \".nvmrc\"],\n python: [\".python-version\"],\n bun: [\"package.json\"],\n };\n const allowed = selectors[tool];\n const rule = tool === \"bun\" ? \"bun-pins\" : \"runtime-workflow\";\n const selector = staticRepositoryPath(value)\n ? path.posix.normalize(value)\n : undefined;\n const providers = checkoutProvidersFor(selector);\n const binding = selector === undefined ? undefined : providers.at(-1);\n const dynamicSource = providers.some((entry) => entry.dynamicSource);\n const sparseFailure = providers.find((entry) => {\n if (entry.sparse.mode === \"invalid\") return true;\n if (entry.sparse.mode !== \"files\" && entry.sparse.mode !== \"mixed\")\n return false;\n if (selector === undefined) return true;\n const selectedFile =\n entry.path === \".\"\n ? selector\n : path.posix.relative(entry.path, selector);\n return !entry.sparse.paths.has(selectedFile);\n });\n if (sparseFailure !== undefined) {\n let missingFile = \"the selected version file\";\n if (selector !== undefined)\n missingFile =\n sparseFailure.path === \".\"\n ? selector\n : path.posix.relative(sparseFailure.path, selector);\n add({\n rule,\n line,\n message: `checkout sparse-checkout must explicitly list ${missingFile} without invalid literal patterns`,\n });\n return;\n }\n if (selector === undefined) {\n if (\n tool === \"bun\" &&\n dynamic(value) &&\n !unreviewableCheckoutSource &&\n authorizeDynamic(\"bun-source\", line)\n )\n return;\n add({\n rule,\n line,\n message: `setup-${tool} must reference a tracked ${allowed.join(\" or \")}`,\n });\n return;\n }\n if (\n unknownCheckoutDestination ||\n hasAmbiguousCheckoutWriters(selector, providers)\n ) {\n if (\n tool === \"bun\" &&\n dynamicSource &&\n !unreviewableCheckoutSource &&\n authorizeDynamic(\"bun-source\", line)\n )\n return;\n add({\n rule,\n line,\n message: `setup-${tool} version-file selector has untrusted checkout provenance: checkout destinations must be static and have exactly one writer`,\n });\n return;\n }\n if (binding?.source === \"untrusted\") {\n if (\n tool === \"bun\" &&\n dynamicSource &&\n !unreviewableCheckoutSource &&\n authorizeDynamic(\"bun-source\", line)\n )\n return;\n add({\n rule,\n line: binding.line,\n message: `setup-${tool} version-file selector cannot use this checkout: ${binding.reason}`,\n });\n return;\n }\n const target =\n binding === undefined || binding.path === \".\"\n ? selector\n : path.posix.relative(binding.path, selector);\n if (\n !allowed.includes(path.posix.basename(target)) ||\n (binding?.source !== \"delegated\" && !trackedFiles.has(target))\n ) {\n add({\n rule,\n line,\n message: `setup-${tool} must reference a tracked ${allowed.join(\" or \")}`,\n });\n return;\n }\n if (\n binding !== undefined &&\n (binding.sparse.mode === \"dynamic\" || binding.sparse.mode === \"mixed\")\n ) {\n if (\n tool !== \"bun\" ||\n unreviewableCheckoutSource ||\n !authorizeDynamic(\"bun-source\", line)\n ) {\n add({\n rule,\n line,\n message: `checkout sparse-checkout must explicitly list ${target} without dynamic, glob, or negation patterns`,\n });\n return;\n }\n }\n if (binding?.source === \"delegated\") {\n onDelegated?.({\n path: file,\n line,\n tool,\n selector,\n checkoutPath: binding.path,\n ref: binding.ref,\n });\n return;\n }\n const content = readFile(target);\n if (tool === \"bun\") {\n try {\n const manifest: unknown = JSON.parse(content ?? \"\");\n pin({\n rule,\n value: record(manifest) ? manifest[\"packageManager\"] : undefined,\n expected: `bun@${policy.bun}`,\n label: \"setup-bun version file packageManager\",\n line,\n });\n } catch {\n add({\n rule,\n line,\n message:\n \"bun-version-file must reference a readable package.json object\",\n });\n }\n return;\n }\n pin({\n rule,\n value: content?.trim(),\n expected: policy[tool],\n selector: tool === \"node\" ? \"node\" : undefined,\n label: `setup-${tool} version file`,\n line,\n });\n };\n const resolveNode = (node: unknown) => {\n const visited = new Set<unknown>();\n while (isAlias(node)) {\n if (visited.has(node)) throw new Error(\"cyclic YAML alias\");\n visited.add(node);\n node = node.resolve(document);\n }\n return node;\n };\n const approvedActions = new Map(\n Object.entries(policy.actions).map(([action, approved]) => [\n action.toLowerCase(),\n approved,\n ]),\n );\n const mergedMaps = (node: unknown) => {\n node = resolveNode(node);\n if (!isMap(node)) return [];\n const maps: unknown[] = [];\n for (const pair of node.items) {\n if (\n !isScalar(pair.key) ||\n typeof pair.key.value !== \"symbol\" ||\n pair.key.source !== \"<<\"\n )\n continue;\n const merge = resolveNode(pair.value);\n maps.push(...(isSeq(merge) ? merge.items : [merge]));\n }\n return maps;\n };\n const keysOf = (node: unknown, visited = new Set<unknown>()): Set<string> => {\n node = resolveNode(node);\n if (!isMap(node)) return new Set();\n if (visited.has(node)) throw new Error(\"cyclic YAML merge\");\n const next = new Set(visited);\n next.add(node);\n const keys = new Set(\n node.items.flatMap((pair) =>\n isScalar(pair.key) && typeof pair.key.value === \"string\"\n ? [pair.key.value]\n : [],\n ),\n );\n for (const merged of mergedMaps(node))\n for (const key of keysOf(merged, next)) keys.add(key);\n return keys;\n };\n type SourceMapOptions = {\n node: unknown;\n key: string;\n visited?: ReadonlySet<unknown>;\n };\n const sourceMap = ({\n node,\n key,\n visited = new Set(),\n }: SourceMapOptions): unknown => {\n node = resolveNode(node);\n if (!isMap(node)) return undefined;\n if (node.has(key)) return node;\n if (visited.has(node)) throw new Error(\"cyclic YAML merge\");\n const next = new Set(visited);\n next.add(node);\n for (const merged of mergedMaps(node)) {\n const source = sourceMap({ node: merged, key, visited: next });\n if (source !== undefined) return source;\n }\n return undefined;\n };\n const getNode = (node: unknown, key: string) => {\n const source = sourceMap({ node, key });\n return isMap(source) ? resolveNode(source.get(key, true)) : undefined;\n };\n const actionInputs = new Map<unknown, Map<string, unknown>>();\n const inputsOf = (node: unknown) => {\n node = resolveNode(node);\n const cached = actionInputs.get(node);\n if (cached !== undefined) return cached;\n const options = getNode(node, \"with\");\n const inputs = new Map<string, unknown>();\n for (const key of keysOf(options)) {\n const folded = key.toUpperCase();\n const value = getNode(options, key);\n if (inputs.has(folded))\n add({\n rule: \"action-pins\",\n line: nodeLine(value),\n message: `action input ${key} collides after case-folding`,\n });\n if (\n /(?:^|-)VERSION(?:-FILE)?$/.test(folded) &&\n key !== folded.toLowerCase()\n )\n add({\n rule: \"action-pins\",\n line: nodeLine(value),\n message: `selector input ${key} must use canonical lowercase casing`,\n });\n inputs.set(folded, value);\n }\n actionInputs.set(node, inputs);\n return inputs;\n };\n const getInput = (node: unknown, key: string) =>\n inputsOf(node).get(key.toUpperCase());\n const expressionAt = (value: string, start: number) => {\n if (!value.startsWith(\"${{\", start)) return undefined;\n let quote: \"'\" | '\"' | undefined;\n for (let index = start + 3; index < value.length; index++) {\n const character = value.at(index);\n if (quote !== undefined) {\n if (character === quote) {\n if (quote === \"'\" && value.at(index + 1) === \"'\") index++;\n else quote = undefined;\n } else if (quote === '\"' && character === \"\\\\\") index++;\n continue;\n }\n if (character === \"'\" || character === '\"') quote = character;\n else if (value.startsWith(\"${{\", index)) return undefined;\n else if (character === \"}\" && value.at(index + 1) === \"}\")\n return { body: value.slice(start + 3, index).trim(), end: index + 2 };\n }\n return undefined;\n };\n const dynamicRefBody = (value: unknown) => {\n if (typeof value !== \"string\") return undefined;\n const expression = expressionAt(value, 0);\n return expression?.end === value.length ? expression.body : undefined;\n };\n const sparseEntryIsValid = (entry: string) => {\n let literalPath = \"\";\n let position = 0;\n while (position < entry.length) {\n const start = entry.indexOf(\"${{\", position);\n const literal = entry.slice(position, start < 0 ? entry.length : start);\n if (/[!$*?[\\]\\\\:]/.test(literal) || literal.split(\"/\").includes(\"..\"))\n return false;\n literalPath += literal;\n if (start < 0) break;\n const expression = expressionAt(entry, start);\n if (expression === undefined || expression.body === \"\") return false;\n literalPath += \"expression\";\n position = expression.end;\n }\n return staticRepositoryPath(literalPath);\n };\n const checkoutPrefixOf = (node: unknown) => {\n const destination = getInput(node, \"path\");\n if (destination === undefined) return \".\";\n return isScalar(destination) ? destination.value : undefined;\n };\n const sparseCheckoutOf = (node: unknown): SparseCheckout => {\n const sparseKeys = [...inputsOf(node).keys()].filter((key) =>\n key.startsWith(\"SPARSE-CHECKOUT\"),\n );\n if (sparseKeys.length === 0) return { mode: \"all\" };\n if (\n sparseKeys.some(\n (key) =>\n key !== \"SPARSE-CHECKOUT\" && key !== \"SPARSE-CHECKOUT-CONE-MODE\",\n )\n )\n return { mode: \"invalid\" };\n const value = getInput(node, \"sparse-checkout\");\n const cone = getInput(node, \"sparse-checkout-cone-mode\");\n if (\n !isScalar(value) ||\n typeof value.value !== \"string\" ||\n (cone !== undefined &&\n (!isScalar(cone) ||\n (cone.value !== true &&\n cone.value !== false &&\n cone.value !== \"true\" &&\n cone.value !== \"false\")))\n )\n return { mode: \"invalid\" };\n const paths = value.value\n .split(/\\r?\\n/)\n .map((entry) => entry.trim().replace(/^\\//, \"\"))\n .filter((entry) => entry !== \"\");\n if (paths.length === 0 || paths.some((entry) => !sparseEntryIsValid(entry)))\n return { mode: \"invalid\" };\n const literalPaths = new Set(paths.filter((entry) => !dynamic(entry)));\n if (paths.some(dynamic)) {\n if (literalPaths.size === 0) return { mode: \"dynamic\" };\n return { mode: \"mixed\", paths: literalPaths };\n }\n return { mode: \"files\", paths: literalPaths };\n };\n let currentEngineFloor: ResolvedEngineFloor | undefined;\n const checkAction = (node: unknown) => {\n node = resolveNode(node);\n if (!isMap(node)) return;\n inputsOf(node);\n const uses = getNode(node, \"uses\");\n if (uses === undefined) return;\n const line = nodeLine(uses);\n if (!isScalar(uses) || typeof uses.value !== \"string\") {\n add({\n rule: \"action-pins\",\n line,\n message: \"action uses must be a string containing a full commit SHA\",\n });\n return;\n }\n const value = uses.value;\n if (value.startsWith(\"$/\")) {\n if (\n value.length === 2 ||\n /\\s/.test(value) ||\n value.includes(\"@\") ||\n value.includes(\"${{\") ||\n value.includes(\"\\\\\") ||\n value.split(\"/\").includes(\"..\")\n )\n add({\n rule: \"action-pins\",\n line,\n message:\n \"self-repository actions must use a static repository path without a ref suffix\",\n });\n return;\n }\n if (value.startsWith(\"./\")) {\n const selector = staticRepositoryPath(value)\n ? path.posix.normalize(value)\n : undefined;\n const providers = checkoutProvidersFor(selector);\n const binding = selector === undefined ? undefined : providers.at(-1);\n if (\n selector === undefined ||\n unknownCheckoutDestination ||\n (binding !== undefined && binding.source !== \"tracked\") ||\n hasAmbiguousCheckoutWriters(selector, providers)\n )\n add({\n rule: \"action-pins\",\n line,\n message:\n \"local actions require an unambiguous checkout of the current source snapshot\",\n });\n return;\n }\n if (value.startsWith(\"docker://\")) {\n add({\n rule: \"action-pins\",\n line,\n message: \"Docker image actions require a reasoned action-pins opt-out\",\n });\n checkRuntimeImage({\n image: value.slice(\"docker://\".length),\n line,\n label: \"Docker action image\",\n });\n return;\n }\n const remote = /^([^./][^\\s@]*\\/[^\\s@]+)@([^\\s]+)$/.exec(value);\n if (remote === null) {\n add({\n rule: \"action-pins\",\n line,\n message: \"remote actions must use a full commit SHA\",\n });\n return;\n }\n const action = remote[1]?.toLowerCase();\n const ref = remote[2];\n const approved =\n action === undefined\n ? undefined\n : (approvedActions.get(action) ??\n approvedActions.get(action.split(\"/\").slice(0, 2).join(\"/\")));\n if (ref === undefined || !/^[a-f0-9]{40}$/.test(ref))\n add({\n rule: \"action-pins\",\n line,\n message: \"remote actions must use a full commit SHA\",\n });\n else if (approved !== undefined && ref !== approved.sha)\n add({\n rule: \"action-pins\",\n line,\n message: `${action} must use ${approved.sha}`,\n });\n const declaration = sourceMap({ node, key: \"uses\" });\n const comment =\n uses.comment ??\n (isMap(declaration) ? declaration.comment : undefined) ??\n \"\";\n if (\n approved !== undefined &&\n !comment.trim().split(/\\s+/).includes(approved.version)\n )\n add({\n rule: \"action-pins\",\n line,\n message: `${action} requires a # ${approved.version} version comment`,\n });\n if (action === \"actions/checkout\") {\n const checkoutRepository = getInput(node, \"repository\");\n const checkoutRef = getInput(node, \"ref\");\n const prefix = checkoutPrefixOf(node);\n const clean = getInput(node, \"clean\");\n const cleanIsResolved =\n clean === undefined || (isScalar(clean) && !dynamic(clean.value));\n let repo: unknown;\n if (checkoutRepository !== undefined)\n repo = isScalar(checkoutRepository) ? checkoutRepository.value : null;\n const self =\n repo === undefined ||\n repo === \"${{ github.repository }}\" ||\n (typeof repo === \"string\" &&\n repository !== undefined &&\n repo.toLowerCase() === repository.toLowerCase());\n const workflowSource =\n repo === \"${{ job.workflow_repository }}\" &&\n isScalar(checkoutRef) &&\n checkoutRef.value === \"${{ job.workflow_sha }}\";\n const triggers = getNode(document.contents, \"on\");\n const events = (() => {\n if (isMap(triggers)) return [...keysOf(triggers)];\n if (isSeq(triggers))\n return triggers.items.map((event) =>\n isScalar(event) ? event.value : undefined,\n );\n if (isScalar(triggers)) return [triggers.value];\n return [];\n })();\n const callerContext = events.includes(\"workflow_call\");\n let refValue = isScalar(checkoutRef) ? checkoutRef.value : undefined;\n if (\n callerContext &&\n (repo === undefined || repo === \"${{ github.repository }}\") &&\n checkoutRef === undefined\n )\n refValue = \"${{ github.sha }}\";\n const currentRef = dynamicRefBody(refValue);\n const currentSource =\n self &&\n !callerContext &&\n (checkoutRef === undefined || currentRef === \"github.sha\");\n\n const dynamicRef = dynamicRefBody(refValue);\n const delegatedSource =\n !currentSource &&\n (self || repo === \"${{ job.workflow_repository }}\") &&\n dynamicRef !== undefined &&\n dynamicRef !== \"\" &&\n !/^(?:'(?:[^']|'')*'|\"(?:[^\"\\\\]|\\\\.)*\"|(?:true|false|null)|-?(?:0x[\\da-f]+|(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?))$/i.test(\n dynamicRef,\n ) &&\n (!/^(?:github\\s*(?:\\.\\s*sha|\\[\\s*['\"]sha['\"]\\s*\\])|job\\s*(?:\\.\\s*workflow_sha|\\[\\s*['\"]workflow_sha['\"]\\s*\\]))$/i.test(\n dynamicRef,\n ) ||\n (callerContext && currentRef === \"github.sha\"));\n\n const validSource =\n cleanIsResolved &&\n ref === approved?.sha &&\n sourceMap({ node, key: \"if\" }) === undefined &&\n sourceMap({ node, key: \"continue-on-error\" }) === undefined &&\n (currentSource || workflowSource || delegatedSource);\n if (!validSource) unreviewableCheckoutSource = true;\n if (!staticRepositoryPath(prefix)) {\n // Unknown checkout destinations may shadow any tracked selector.\n checkoutBindings.push({\n path: \".\",\n dynamicSource: validSource && dynamic(prefix),\n source: \"untrusted\",\n reason: \"checkout destination must be a static repository path\",\n line,\n sparse: sparseCheckoutOf(node),\n });\n } else {\n const destination = normalizeCheckoutPath(prefix);\n checkoutBindings = checkoutBindings.map((entry) => {\n if (\n entry.path === destination ||\n (destination !== \".\" && !entry.path.startsWith(`${destination}/`))\n )\n return entry;\n // Ancestor checkout may clear an uninitialized destination even with clean: false.\n return {\n path: entry.path,\n sparse: { mode: \"all\" },\n dynamicSource: false,\n source: \"untrusted\",\n reason:\n \"a later ancestor checkout invalidates this descendant destination\",\n line,\n };\n });\n const trustedWriter =\n cleanIsResolved &&\n ref === approved?.sha &&\n sourceMap({ node, key: \"if\" }) === undefined &&\n sourceMap({ node, key: \"continue-on-error\" }) === undefined &&\n checkoutDestinations.get(destination) === 1 &&\n !unknownCheckoutDestination;\n if (trustedWriter && delegatedSource && typeof refValue === \"string\")\n checkoutBindings.push({\n path: destination,\n dynamicSource: validSource && delegatedSource,\n sparse: sparseCheckoutOf(node),\n source: \"delegated\",\n ref: refValue,\n });\n else if (trustedWriter && (workflowSource || currentSource))\n checkoutBindings.push({\n path: destination,\n dynamicSource: validSource && delegatedSource,\n sparse: sparseCheckoutOf(node),\n source: \"tracked\",\n });\n else {\n let reason =\n \"checkout does not select a trusted repository source snapshot\";\n if (!cleanIsResolved)\n reason = \"checkout clean must be statically resolved\";\n else if (ref !== approved?.sha)\n reason = \"actions/checkout must use the approved action SHA\";\n else if (\n sourceMap({ node, key: \"if\" }) !== undefined ||\n sourceMap({ node, key: \"continue-on-error\" }) !== undefined\n )\n reason =\n \"checkout must be unconditional and omit continue-on-error\";\n else if (\n checkoutDestinations.get(destination) !== 1 ||\n unknownCheckoutDestination\n )\n reason = \"checkout destination must have exactly one static writer\";\n checkoutBindings.push({\n path: destination,\n dynamicSource: validSource && delegatedSource,\n sparse: sparseCheckoutOf(node),\n source: \"untrusted\",\n reason,\n line,\n });\n }\n }\n }\n let tool: RuntimeDelegation[\"tool\"];\n switch (action) {\n case \"actions/setup-node\":\n tool = \"node\";\n break;\n case \"actions/setup-python\":\n tool = \"python\";\n break;\n case \"oven-sh/setup-bun\":\n tool = \"bun\";\n break;\n default:\n return;\n }\n const literal = getInput(node, `${tool}-version`);\n if (tool === \"node\" && currentEngineFloor !== undefined) {\n const reference = getInput(node, \"node-version-file\");\n if (\n reference === undefined &&\n isScalar(literal) &&\n engineFloorSelectorMatches(literal.value, currentEngineFloor)\n ) {\n onEngineFloor?.(currentEngineFloor, \"matched\");\n return;\n }\n onEngineFloor?.(currentEngineFloor, \"mismatch\");\n add({\n rule: \"runtime-workflow\",\n line: nodeLine(literal ?? reference ?? uses),\n message: `engine floor job must select an exact Node patch satisfying ${currentEngineFloor.range} with minimum major ${currentEngineFloor.major}`,\n });\n return;\n }\n if (literal !== undefined)\n add({\n rule: tool === \"bun\" ? \"bun-pins\" : \"runtime-workflow\",\n line: nodeLine(literal),\n message: `setup-${tool} must use ${tool}-version-file`,\n });\n const reference = getInput(node, `${tool}-version-file`);\n checkReference({\n value: isScalar(reference) ? reference.value : undefined,\n tool,\n line: reference === undefined ? line : nodeLine(reference),\n });\n };\n const checkContainer = (node: unknown, at: string) => {\n node = resolveNode(node);\n if (node === undefined) return;\n const image = isMap(node) ? getNode(node, \"image\") : node;\n checkRuntimeImage({\n image: isScalar(image) ? image.value : undefined,\n line: nodeLine(image ?? node),\n label: \"container image\",\n at,\n });\n };\n const checkSteps = (\n node: unknown,\n locationPrefix: string,\n floor?: ResolvedEngineFloor,\n ) => {\n currentEngineFloor = undefined;\n checkoutBindings = [];\n checkoutDestinations = new Map();\n unknownCheckoutDestination = false;\n unreviewableCheckoutSource = false;\n node = resolveNode(node);\n if (!isSeq(node)) return;\n for (const step of node.items) {\n const uses = getNode(step, \"uses\");\n if (\n !isScalar(uses) ||\n typeof uses.value !== \"string\" ||\n !uses.value.toLowerCase().startsWith(\"actions/checkout@\")\n )\n continue;\n const prefix = checkoutPrefixOf(step);\n if (!staticRepositoryPath(prefix)) {\n unknownCheckoutDestination = true;\n continue;\n }\n const destination = normalizeCheckoutPath(prefix);\n checkoutDestinations.set(\n destination,\n (checkoutDestinations.get(destination) ?? 0) + 1,\n );\n }\n currentEngineFloor = floor;\n try {\n for (const step of node.items) {\n const id = getNode(step, \"id\");\n currentLocation =\n isScalar(id) && typeof id.value === \"string\"\n ? `${locationPrefix}.steps.${id.value}`\n : undefined;\n checkAction(step);\n }\n } finally {\n currentEngineFloor = undefined;\n currentLocation = undefined;\n }\n };\n try {\n // Resolve aliases first with an expansion bound before visiting executable fields.\n document.toJS({ maxAliasCount: 100 });\n if (automationKind === \"workflow\") {\n const jobs = getNode(document.contents, \"jobs\");\n if (isMap(jobs))\n for (const key of keysOf(jobs)) {\n checkoutBindings = [];\n checkoutDestinations = new Map();\n unknownCheckoutDestination = false;\n currentEngineFloor = undefined;\n const job = getNode(jobs, key);\n checkAction(job);\n checkContainer(getNode(job, \"container\"), `jobs.${key}.container`);\n const services = getNode(job, \"services\");\n if (isMap(services))\n for (const service of keysOf(services))\n checkContainer(\n getNode(services, service),\n `jobs.${key}.services.${service}`,\n );\n checkSteps(\n getNode(job, \"steps\"),\n `jobs.${key}`,\n engineFloors.find((entry) => entry.job === key),\n );\n }\n } else {\n const runs = getNode(document.contents, \"runs\");\n const using = getNode(runs, \"using\");\n if (isScalar(using) && using.value === \"composite\")\n checkSteps(getNode(runs, \"steps\"), \"runs\");\n if (isScalar(using) && using.value === \"docker\") {\n const image = getNode(runs, \"image\");\n const value = isScalar(image) ? image.value : undefined;\n if (typeof value === \"string\" && value.startsWith(\"docker://\")) {\n add({\n rule: \"action-pins\",\n line: nodeLine(image),\n message:\n \"Docker image actions require a reasoned action-pins opt-out\",\n });\n checkRuntimeImage({\n image: value.slice(\"docker://\".length),\n line: nodeLine(image),\n label: \"Docker action image\",\n });\n } else if (\n typeof value !== \"string\" ||\n value.includes(\"${{\") ||\n value.includes(\"\\\\\") ||\n value.includes(\":\") ||\n path.posix.isAbsolute(value) ||\n path.posix\n .normalize(path.posix.join(path.posix.dirname(file), value))\n .split(\"/\")\n .at(0) === \"..\" ||\n path.posix.basename(value) !== \"Dockerfile\"\n ) {\n add({\n rule: \"action-pins\",\n line: nodeLine(image),\n message:\n \"Docker actions must reference a local Dockerfile or declare a reasoned action-pins opt-out for an external image\",\n });\n }\n }\n }\n } catch {\n add({\n rule: \"runtime-workflow\",\n line: 1,\n message: \"cannot resolve workflow YAML aliases\",\n });\n }\n return diagnostics;\n};\n","import { execFileSync } from \"node:child_process\";\nimport {\n closeSync,\n lstatSync,\n openSync,\n readSync,\n readFileSync,\n realpathSync,\n} from \"node:fs\";\nimport path from \"node:path\";\n\nimport { cloudSetupPath, generateCloudSetup } from \"./cloud-setup\";\nimport {\n cloudAttributionFix,\n cloudClaudeSettingsPath,\n cloudSessionStartFix,\n hasCloudAttribution,\n hasCloudSessionStartHook,\n} from \"./cloud-setup-claude\";\nimport { parseCloudSetup } from \"./cloud-setup-schema\";\nimport { readGitTrackedOutput } from \"./git-tracked-output\";\nimport {\n checkConsumerChecks,\n parseConsumerChecks,\n} from \"./toolchain-consumer-checks\";\nimport { checkDependabot, dependabotRules } from \"./toolchain-dependabot\";\nimport {\n parseDynamicSelectors,\n type DynamicSelector,\n} from \"./toolchain-dynamic-selectors\";\nimport {\n parseEngineFloors,\n resolveEngineFloor,\n type ResolvedEngineFloor,\n} from \"./toolchain-engine-floors\";\nimport { toolchainInputKind } from \"./toolchain-inputs\";\nimport { checkPackageFiles, packageRules } from \"./toolchain-packages\";\nimport {\n checkRuntimeFile,\n runtimeRules,\n type RuntimeDelegation,\n} from \"./toolchain-runtime\";\nimport { parseRustExceptions } from \"./toolchain-rust\";\nimport { parseToolchainPolicy } from \"./toolchain-schema\";\n\nexport const toolchainRules = [\n ...new Set([\n ...packageRules,\n ...runtimeRules,\n ...dependabotRules,\n \"cloud-setup-drift\",\n ] as const),\n] as const;\nexport type ToolchainRule = (typeof toolchainRules)[number];\nexport type SharedToolchainDiagnostic = {\n rule: ToolchainRule | \"configuration\";\n path: string;\n line: number;\n message: string;\n};\n\nconst record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst array = (value: unknown): value is readonly unknown[] =>\n Array.isArray(value);\n\n/** Repository-owned declarations are explicit; malformed decisions fail closed. */\nexport const parseToolchainConfiguration = (input: unknown) => {\n if (\n !record(input) ||\n Object.keys(input).some(\n (key) =>\n key !== \"optOuts\" &&\n key !== \"cloud\" &&\n key !== \"engineFloors\" &&\n key !== \"dynamicSelectors\" &&\n key !== \"consumerChecks\" &&\n key !== \"rustExceptions\",\n ) ||\n (input[\"optOuts\"] !== undefined && !array(input[\"optOuts\"]))\n )\n throw new Error(\n \"stll-toolchain.json accepts only optOuts, cloud, engineFloors, dynamicSelectors consumerChecks and rustExceptions declarations\",\n );\n const disabled = new Set<string>();\n const optOuts = input[\"optOuts\"] ?? [];\n if (!array(optOuts)) throw new Error(\"optOuts must be an array\");\n for (const entry of optOuts) {\n if (\n !record(entry) ||\n Object.keys(entry).some((key) => key !== \"rule\" && key !== \"reason\") ||\n typeof entry[\"rule\"] !== \"string\" ||\n !toolchainRules.some((rule) => rule === entry[\"rule\"]) ||\n typeof entry[\"reason\"] !== \"string\" ||\n entry[\"reason\"].trim() === \"\" ||\n disabled.has(entry[\"rule\"])\n )\n throw new Error(\n \"each opt-out requires a unique known rule and a nonempty reason\",\n );\n if (entry[\"rule\"] === \"rust-version\")\n throw new Error(\n \"rust-version requires expiring exact-pin rustExceptions, not an opt-out\",\n );\n if (entry[\"rule\"] === \"node-engine\")\n throw new Error(\n \"node-engine cannot be opted out; engines.node must support the shared Node series\",\n );\n if (entry[\"rule\"] === \"cloud-setup-drift\")\n throw new Error(\n \"cloud-setup-drift cannot be opted out; generated setup must match shared policy\",\n );\n disabled.add(entry[\"rule\"]);\n }\n return {\n disabled,\n rustExceptions: parseRustExceptions(input[\"rustExceptions\"]),\n cloud: parseCloudSetup(input[\"cloud\"]),\n engineFloors: parseEngineFloors(input[\"engineFloors\"]),\n dynamicSelectors: parseDynamicSelectors(input[\"dynamicSelectors\"]),\n consumerChecks: parseConsumerChecks(input[\"consumerChecks\"]),\n };\n};\n\n/** Read one tracked configuration snapshot for guards and policy generation. */\nexport const readToolchainInputs = (root: string) => {\n const diagnostics: SharedToolchainDiagnostic[] = [];\n const tracked = readGitTrackedOutput(root, \"staged\")\n .split(\"\\0\")\n // Gitlinks identify submodule directories, never executable script files.\n .filter((entry) => entry !== \"\" && !entry.startsWith(\"160000 \"))\n .map((entry) => entry.slice(entry.indexOf(\"\\t\") + 1));\n const files: Record<string, string> = {};\n const trackedFiles = new Set(tracked);\n const resolvedRoot = realpathSync(root);\n for (const file of tracked) {\n // Only configuration inputs are read; source files can contain arbitrary examples.\n const kind = toolchainInputKind(file);\n const shebangCandidate =\n kind === undefined &&\n path.posix.extname(file) === \"\" &&\n !file\n .split(\"/\")\n .some((part) => part === \"vendor\" || part === \"node_modules\");\n if (kind === undefined && !shebangCandidate) continue;\n if (kind === \"presence\") {\n files[file] = \"\";\n continue;\n }\n try {\n const inputPath = path.join(resolvedRoot, file);\n if (shebangCandidate) {\n const input = lstatSync(inputPath);\n if (!input.isFile() && !input.isSymbolicLink()) continue;\n }\n const resolvedFile = realpathSync(inputPath);\n const relative = path.relative(resolvedRoot, resolvedFile);\n if (\n path.isAbsolute(relative) ||\n relative.split(path.sep).at(0) === \"..\" ||\n !trackedFiles.has(relative.split(path.sep).join(\"/\"))\n )\n throw new Error(\"Configuration target is outside the tracked tree\");\n if (shebangCandidate) {\n if (!lstatSync(resolvedFile).isFile()) continue;\n // Bound discovery reads: extensionless files may be large binary artifacts.\n const descriptor = openSync(resolvedFile, \"r\");\n const prefix = Buffer.alloc(512);\n let count: number;\n try {\n count = readSync(descriptor, prefix, 0, prefix.length, 0);\n } finally {\n closeSync(descriptor);\n }\n if (\n toolchainInputKind(file, prefix.toString(\"utf8\", 0, count)) ===\n undefined\n )\n continue;\n }\n files[file] = readFileSync(resolvedFile, \"utf8\");\n } catch {\n if (shebangCandidate) continue;\n diagnostics.push({\n rule: \"configuration\",\n path: file,\n line: 1,\n message: \"cannot read tracked configuration file\",\n });\n }\n }\n return { files, trackedFiles, diagnostics };\n};\n\ntype CheckSharedToolchainOptions = {\n root: string;\n policy: ReturnType<typeof parseToolchainPolicy>;\n onDelegated?: ((report: RuntimeDelegation) => void) | undefined;\n};\n\nexport const checkToolchain = ({\n root,\n policy,\n onDelegated,\n}: CheckSharedToolchainOptions) => {\n const { files, trackedFiles, diagnostics } = readToolchainInputs(root);\n let repository: string | undefined;\n try {\n const origin = execFileSync(\"git\", [\"remote\", \"get-url\", \"origin\"], {\n cwd: root,\n encoding: \"utf8\",\n stdio: [\"ignore\", \"pipe\", \"ignore\"],\n }).trim();\n repository =\n /^(?:https?:\\/\\/github\\.com\\/|git@github\\.com:|ssh:\\/\\/git@github\\.com\\/)([^/]+\\/[^/]+?)(?:\\.git)?\\/?$/.exec(\n origin,\n )?.[1];\n } catch {\n // Repositories without a GitHub origin can still use github.repository.\n }\n\n let configuration = parseToolchainConfiguration({});\n const engineFloors: ResolvedEngineFloor[] = [];\n let dynamicSelectors: DynamicSelector[] = [];\n if (files[\"stll-toolchain.json\"] !== undefined) {\n try {\n configuration = parseToolchainConfiguration(\n JSON.parse(files[\"stll-toolchain.json\"]),\n );\n dynamicSelectors = configuration.dynamicSelectors;\n for (const entry of configuration.engineFloors)\n engineFloors.push(resolveEngineFloor(entry, files));\n } catch (error) {\n diagnostics.push({\n rule: \"configuration\",\n path: \"stll-toolchain.json\",\n line: 1,\n message: error instanceof Error ? error.message : String(error),\n });\n }\n }\n const cloud = configuration.cloud;\n const script = files[cloudSetupPath];\n if (cloud === undefined && trackedFiles.has(cloudSetupPath))\n diagnostics.push({\n rule: \"cloud-setup-drift\",\n path: cloudSetupPath,\n line: 1,\n message:\n \"cloud setup script requires an explicit cloud declaration in stll-toolchain.json\",\n });\n if (cloud !== undefined) {\n if (!hasCloudSessionStartHook(files[cloudClaudeSettingsPath]))\n diagnostics.push({\n rule: \"cloud-setup-drift\",\n path: cloudClaudeSettingsPath,\n line: 1,\n message: `tracked Claude cloud SessionStart hook is missing, disabled or differs from shared policy; run stll-cloud-setup; if automatic merge is unsafe, ${cloudSessionStartFix}`,\n });\n if (!hasCloudAttribution(files[cloudClaudeSettingsPath]))\n diagnostics.push({\n rule: \"cloud-setup-drift\",\n path: cloudClaudeSettingsPath,\n line: 1,\n message: `tracked Claude attribution is missing or differs from shared policy; run stll-cloud-setup; if automatic merge is unsafe, ${cloudAttributionFix}`,\n });\n try {\n const nodeVersion = files[\".node-version\"];\n if (nodeVersion === undefined)\n throw new Error(\n \"cloud setup requires a tracked root .node-version with an exact stable release\",\n );\n const expected = generateCloudSetup({\n policy,\n cloud,\n nodeVersion: nodeVersion.trim(),\n files,\n rustExceptions: configuration.rustExceptions,\n });\n if (script !== expected)\n diagnostics.push({\n rule: \"cloud-setup-drift\",\n path: cloudSetupPath,\n line: 1,\n message:\n \"cloud setup script is missing or differs from shared policy; run stll-cloud-setup\",\n });\n } catch (error) {\n diagnostics.push({\n rule: \"cloud-setup-drift\",\n path: cloudSetupPath,\n line: 1,\n message: error instanceof Error ? error.message : String(error),\n });\n }\n }\n const exercisedFloors = new Set<ResolvedEngineFloor>();\n const mismatchedFloors = new Set<ResolvedEngineFloor>();\n\n const selectorMatches = new Map<DynamicSelector, number>();\n diagnostics.push(\n ...checkConsumerChecks({\n declarations: configuration.consumerChecks,\n files,\n policy,\n }),\n );\n diagnostics.push(...checkPackageFiles({ files, policy }));\n for (const [file, text] of Object.entries(files))\n diagnostics.push(\n ...checkRuntimeFile({\n file,\n text,\n policy: {\n ...policy,\n packages: { ...policy.packages, typescript: policy.typescript },\n },\n trackedFiles,\n rustExceptions: configuration.rustExceptions,\n dynamicSelectors: dynamicSelectors.filter(\n (entry) => entry.path === file,\n ),\n onDynamicSelector: (entry) =>\n selectorMatches.set(entry, (selectorMatches.get(entry) ?? 0) + 1),\n repository,\n onDelegated,\n engineFloors: engineFloors.filter((entry) => entry.workflow === file),\n onEngineFloor: (entry, status) => {\n if (status === \"mismatch\") mismatchedFloors.add(entry);\n else exercisedFloors.add(entry);\n },\n readFile: (target) => files[target],\n }),\n );\n for (const entry of engineFloors)\n if (!exercisedFloors.has(entry) || mismatchedFloors.has(entry))\n diagnostics.push({\n rule: \"configuration\",\n path: \"stll-toolchain.json\",\n line: 1,\n message: `engine floor ${entry.workflow}:${entry.job} requires a setup-node exact patch satisfying ${entry.package} engines.node minimum major ${entry.major}`,\n });\n for (const entry of dynamicSelectors)\n if (selectorMatches.get(entry) !== 1)\n diagnostics.push({\n rule: \"configuration\",\n path: \"stll-toolchain.json\",\n line: 1,\n message: `dynamic selector ${entry.path}:${entry.at ?? entry.line} must match exactly one unresolved ${entry.kind} selector`,\n });\n diagnostics.push(...checkDependabot({ files, policy: policy.dependabot }));\n return diagnostics.filter(\n (diagnostic) => !configuration.disabled.has(diagnostic.rule),\n );\n};\n"],"mappings":";;;;;;;;;;;;ACcA,MAAa,wBAAwBA;AAErC,MAAa,wBACX;AAEF,MAAMC,YAAU,UACd,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAErE,MAAM,uBAAuB,UAC3B,OAAO,UAAU,YACjB,UAAU,MACV,CAAC,MAAM,SAAS,IAAI,KACpB,CAAC,MAAM,SAAS,KAAK,KACrB,CAAC,MAAM,MAAM,EAAE,CAAC,CAAC,MAAM,cAAc;CACnC,MAAM,OAAO,U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