@mark1russell7/conventions 0.9.0 → 0.10.1

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-c3bySjnK.js","names":["MAX_BYTES","WORKFLOW","indentOf","valueOf"],"sources":["../src/config.ts","../src/workspace.ts","../src/rule.ts","../src/rules/cue-preset.ts","../src/rules/main-check.ts","../src/rules/no-build-output.ts","../src/rules/no-local-paths.ts","../src/rules/pinned-git-deps.ts","../src/rules/release-files.ts","../src/rules/required-scripts.ts","../../site-pages/src/data/status.ts","../../site-pages/src/render/releases.ts","../../site-pages/src/render/status.ts","../src/rules/roadmap-parses.ts","../src/rules/runner-budget.ts","../src/rules/source-main.ts","../src/rules/tsconfig-test.ts","../src/rules/tests-required.ts","../src/rules/typed-files.ts","../src/rules/typed-scripts.ts","../src/rules/trust-policy.ts","../src/rules/workspace-protocol.ts","../src/rules/index.ts","../src/run.ts"],"sourcesContent":["/**\n * The configuration of the check: the field `conventions` of the root `package.json`. Each exception\n * needs a reason: a rule that is off, files that a rule ignores, and a changed option. Thus each\n * exception is visible.\n */\nimport type { OptionValue, Options, Rule } from \"./rule.ts\";\n\n/** The configuration of one rule, after the check of its fields. */\nexport interface RuleConfig {\n /** The reason why the rule is off. The rule is on when this field is missing. */\n readonly off?: string;\n /** The globs of files that the rule does not report. */\n readonly ignore: readonly string[];\n /** The reason of `ignore` or of the changed options. */\n readonly reason?: string;\n /** The options of the rule, with the defaults. */\n readonly options: Options;\n}\n\n/** The configuration of the check. */\nexport interface ConventionsConfig {\n /** The globs of the package folders. The default is the globs of the workspace. */\n readonly packages?: readonly string[];\n /** The configuration of each rule, by its id. */\n readonly rules: Readonly<Record<string, RuleConfig>>;\n}\n\n/** The fields of the configuration of a rule that are not options. */\nconst RULE_FIELDS = [\"off\", \"ignore\", \"reason\"];\n\nconst isObject = (value: unknown): value is Record<string, unknown> => typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst isStrings = (value: unknown): value is string[] => Array.isArray(value) && value.every((item) => typeof item === \"string\");\n\n/** This function gives the options of a rule with their defaults. */\nexport function defaultOptions(rule: Rule): Options {\n return Object.fromEntries(Object.entries(rule.options).map(([name, spec]) => [name, spec.default]));\n}\n\n/**\n * This function reads the field `conventions` of the root `package.json` (`value`), and gives the\n * configuration of each rule of `rules`.\n *\n * @throws Error when the field has a wrong shape, an unknown rule or option, or an exception or a changed option without a reason\n */\nexport function parseConfig(value: unknown, rules: readonly Rule[]): ConventionsConfig {\n const byId = new Map(rules.map((rule) => [rule.id, rule]));\n const result: Record<string, RuleConfig> = {};\n for (const rule of rules) result[rule.id] = { ignore: [], options: defaultOptions(rule) };\n if (value === undefined) return { rules: result };\n if (!isObject(value)) throw new Error(\"The field conventions of package.json must be an object.\");\n const unknown = Object.keys(value).filter((key) => key !== \"packages\" && key !== \"rules\" && key !== \"$comment\");\n if (unknown.length > 0) throw new Error(`conventions has unknown fields: ${unknown.join(\", \")}.`);\n const packages = value[\"packages\"];\n if (packages !== undefined && !isStrings(packages)) throw new Error(\"conventions.packages must be an array of globs.\");\n const rulesValue = value[\"rules\"] ?? {};\n if (!isObject(rulesValue)) throw new Error(\"conventions.rules must be an object, with a rule id for each key.\");\n for (const [id, entry] of Object.entries(rulesValue)) {\n const rule = byId.get(id);\n if (rule === undefined) throw new Error(`conventions.rules has an unknown rule: ${id}. The rules are: ${[...byId.keys()].join(\", \")}.`);\n const where = `conventions.rules[\"${id}\"]`;\n if (!isObject(entry)) throw new Error(`${where} must be an object, for example { \"off\": \"<reason>\" }.`);\n const off = entry[\"off\"];\n if (off !== undefined && (typeof off !== \"string\" || off.trim() === \"\")) throw new Error(`${where}.off must be the reason why the rule is off, as text.`);\n const ignore = entry[\"ignore\"] ?? [];\n if (!isStrings(ignore)) throw new Error(`${where}.ignore must be an array of globs.`);\n const reason = entry[\"reason\"];\n if (reason !== undefined && (typeof reason !== \"string\" || reason.trim() === \"\")) throw new Error(`${where}.reason must be text.`);\n if (ignore.length > 0 && reason === undefined) throw new Error(`${where}.ignore needs a reason: add \"reason\": \"<why these files are an exception>\".`);\n const options: Record<string, OptionValue> = { ...defaultOptions(rule) };\n const changed: string[] = [];\n for (const [name, option] of Object.entries(entry)) {\n if (RULE_FIELDS.includes(name)) continue;\n const spec = rule.options[name];\n if (spec === undefined) {\n const known = [...RULE_FIELDS, ...Object.keys(rule.options)].join(\", \");\n throw new Error(`${where} has an unknown field: ${name}. The fields are: ${known}.`);\n }\n const good = spec.type === \"strings\" ? isStrings(option) : typeof option === spec.type;\n if (!good) throw new Error(`${where}.${name} must be ${spec.type === \"strings\" ? \"an array of strings\" : `a ${spec.type}`}.`);\n options[name] = option as OptionValue;\n changed.push(name);\n }\n // A changed option can make a rule weaker, so it needs a reason, as `ignore` does\n if (changed.length > 0 && reason === undefined && off === undefined) {\n throw new Error(`${where} changes the option${changed.length > 1 ? \"s\" : \"\"} ${changed.join(\", \")}, and needs a reason: add \"reason\": \"<why this repository changes the default>\".`);\n }\n result[id] = {\n ...(off === undefined ? {} : { off }),\n ignore,\n ...(reason === undefined ? {} : { reason }),\n options,\n };\n }\n return { ...(packages === undefined ? {} : { packages }), rules: result };\n}\n","/**\n * The package folders of a repository: the folders that the globs of the workspace name, with a\n * `package.json` file. This file is a copy of `workspace.ts` of `@mark1russell7/api-report`, so that\n * each tool has no runtime dependency.\n */\nimport { existsSync, readdirSync, readFileSync } from \"node:fs\";\nimport { join, relative, sep } from \"node:path\";\n\n/** This function compares two strings by their code units, as the default sort does. */\nexport const byCode = (a: string, b: string): number => (a < b ? -1 : a > b ? 1 : 0);\n\n/** This function gives a path relative to `root`, with `/`. */\nexport const relativePath = (root: string, file: string): string => relative(root, file).split(sep).join(\"/\");\n\n/** The characters that have a meaning in a regular expression. */\nconst SPECIAL = new Set([...\"\\\\^$.|+()[]{}*?/\"]);\n\n/**\n * This function gives a regular expression for a glob of `/` paths. `*` matches a part of one path\n * segment, `?` matches one character, `**` matches zero or more segments, and `{a,b}` matches one of\n * its parts. The function escapes each other special character.\n */\nexport function globToRegExp(glob: string): RegExp {\n let source = \"\";\n let braces = 0;\n for (let index = 0; index < glob.length; index++) {\n const char = glob.charAt(index);\n if (char === \"/\" && glob.slice(index + 1) === \"**\") {\n // `a/**` matches `a` and each path under it\n source += \"(?:/.*)?\";\n break;\n }\n if (char === \"*\" && glob.charAt(index + 1) === \"*\") {\n const atStart = index === 0 || glob.charAt(index - 1) === \"/\";\n const after = glob.charAt(index + 2);\n if (atStart && after === \"/\") {\n // `**/` matches zero or more whole segments\n source += \"(?:[^/]+/)*\";\n index += 2;\n } else if (atStart && after === \"\") {\n source += \".*\";\n index += 1;\n } else {\n source += \"[^/]*\";\n index += 1;\n }\n } else if (char === \"*\") source += \"[^/]*\";\n else if (char === \"?\") source += \"[^/]\";\n else if (char === \"{\") {\n braces++;\n source += \"(?:\";\n } else if (char === \"}\" && braces > 0) {\n braces--;\n source += \")\";\n } else if (char === \",\" && braces > 0) source += \"|\";\n else if (SPECIAL.has(char)) source += `\\\\${char}`;\n else source += char;\n }\n if (braces > 0) throw new Error(`A glob with a \"{\" that has no \"}\": ${glob}`);\n return new RegExp(`^${source}$`);\n}\n\n/** The characters that make a path segment a pattern. */\nconst GLOB_CHARS = /[*?{]/;\n\n/** This function removes the `/` characters at the end of a path, with a loop in place of a regular expression. */\nfunction trimEndSlashes(path: string): string {\n let end = path.length;\n while (end > 0 && path.charAt(end - 1) === \"/\") end -= 1;\n return path.slice(0, end);\n}\n\n/**\n * This function gives the folders under `root` that a glob names, as `/` paths relative to `root`,\n * in the order of the code units. It does not go into `node_modules` or a folder that starts with `.`.\n */\nexport function globFolders(root: string, glob: string): string[] {\n const clean = trimEndSlashes(glob.startsWith(\"./\") ? glob.slice(2) : glob);\n const segments = clean.split(\"/\");\n const firstPattern = segments.findIndex((segment) => GLOB_CHARS.test(segment));\n if (firstPattern < 0) return existsSync(join(root, clean)) ? [clean] : [];\n const base = segments.slice(0, firstPattern).join(\"/\");\n const depth = clean.includes(\"**\") ? Number.POSITIVE_INFINITY : segments.length - firstPattern;\n const pattern = globToRegExp(clean);\n const start = join(root, base);\n if (!existsSync(start)) return [];\n const found: string[] = [];\n const walk = (folder: string, level: number): void => {\n for (const entry of readdirSync(folder, { withFileTypes: true })) {\n if (!entry.isDirectory() || entry.name === \"node_modules\" || entry.name.startsWith(\".\")) continue;\n const path = join(folder, entry.name);\n if (pattern.test(relativePath(root, path))) found.push(relativePath(root, path));\n if (level < depth) walk(path, level + 1);\n }\n };\n // `a/**` also names `a`\n if (base !== \"\" && pattern.test(base)) found.push(base);\n walk(start, 1);\n return found.sort(byCode);\n}\n\n/**\n * This function gives the globs of the workspace at `root`: the `packages` list of\n * `pnpm-workspace.yaml`, then the `workspaces` field of `package.json`. The result is undefined when\n * the repository has no workspace.\n */\nexport function workspaceGlobs(root: string): string[] | undefined {\n const yaml = join(root, \"pnpm-workspace.yaml\");\n if (existsSync(yaml)) {\n const lines = readFileSync(yaml, \"utf8\").split(/\\r?\\n/);\n const start = lines.findIndex((line) => /^packages\\s*:/.test(line));\n if (start >= 0) {\n const unquote = (text: string): string =>\n text\n .replace(/\\s+#.*$/, \"\")\n .trim()\n .replace(/^[\"']|[\"']$/g, \"\");\n const inline = /^packages\\s*:\\s*\\[(.*)\\]/.exec(lines[start] ?? \"\");\n if (inline) return (inline[1] ?? \"\").split(\",\").map(unquote).filter(Boolean);\n const globs: string[] = [];\n for (const line of lines.slice(start + 1)) {\n if (/^\\s*(#.*)?$/.test(line)) continue;\n const item = /^\\s+-\\s+(.+)$/.exec(line);\n if (!item) break;\n globs.push(unquote(item[1] ?? \"\"));\n }\n return globs;\n }\n }\n const manifestFile = join(root, \"package.json\");\n if (existsSync(manifestFile)) {\n const { workspaces } = JSON.parse(readFileSync(manifestFile, \"utf8\")) as { workspaces?: unknown };\n if (Array.isArray(workspaces)) return workspaces.filter((glob): glob is string => typeof glob === \"string\");\n if (typeof workspaces === \"object\" && workspaces !== null && \"packages\" in workspaces && Array.isArray(workspaces.packages)) {\n return workspaces.packages.filter((glob): glob is string => typeof glob === \"string\");\n }\n }\n return undefined;\n}\n\n/**\n * This function gives the package folders of the repository at `root`: the folders of the globs\n * that have a `package.json` file. A glob that starts with `!` removes folders. Without globs, the\n * function reads the globs of the workspace, and a repository with no workspace is one package.\n * The result has absolute paths, in the order of the code units.\n */\nexport function packageFolders(root: string, globs: readonly string[] | undefined = workspaceGlobs(root)): string[] {\n if (globs === undefined) return existsSync(join(root, \"package.json\")) ? [root] : [];\n const included = new Set<string>();\n // As in pnpm, a `!` glob removes its folders in each position of the list\n for (const glob of globs.filter((item) => !item.startsWith(\"!\"))) for (const folder of globFolders(root, glob)) included.add(folder);\n for (const glob of globs.filter((item) => item.startsWith(\"!\"))) for (const folder of globFolders(root, glob.slice(1))) included.delete(folder);\n return [...included]\n .filter((folder) => existsSync(join(root, folder, \"package.json\")))\n .sort(byCode)\n .map((folder) => join(root, folder));\n}\n","/**\n * The shape of a rule, the facts that a rule reads (the context), and small helpers for the rules.\n */\nimport { spawnSync } from \"node:child_process\";\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { globToRegExp } from \"./workspace.ts\";\n\n/** A row of the invariants audit that a rule comes from: the repository, the id of the rule in that audit, and the document line. */\nexport interface AuditSource {\n readonly repo: string;\n readonly rule: string;\n readonly doc: string;\n}\n\n/** A break of a rule: the file, the line when the rule knows it, and what is wrong. */\nexport interface Break {\n /** The file, relative to the root, with `/`. */\n readonly file: string;\n /** The line in the file, from 1. */\n readonly line?: number;\n readonly message: string;\n /** A fix for this break. The fix of the rule applies when this field is missing. */\n readonly fix?: string;\n /** The changes of files that fix this break, for `conventions fix`. A break with no edits needs a person. */\n readonly edits?: readonly Edit[];\n}\n\n/**\n * A change of one file that `conventions fix` writes. The file must still have the text `before`, else the edit does\n * not apply. An edit that an earlier edit made stale waits for the next check.\n */\nexport interface Edit {\n /** The file, relative to the root, with `/`. */\n readonly file: string;\n /** The whole text of the file before the change. An empty text makes a file that does not exist. */\n readonly before: string;\n /** The whole text of the file after the change. */\n readonly after: string;\n}\n\n/** This function gives `text` with the line `line` (from 1) replaced by `lines`, with the line ends of `text`. An empty `lines` removes the line. */\nexport function replaceLine(text: string, line: number, lines: readonly string[]): string {\n const eol = text.includes(\"\\r\\n\") ? \"\\r\\n\" : \"\\n\";\n const all = text.split(/\\r?\\n/);\n all.splice(line - 1, 1, ...lines);\n return all.join(eol);\n}\n\n/** A value of an option of a rule. */\nexport type OptionValue = string | number | boolean | readonly string[];\n\n/** The options of a rule, after the defaults. */\nexport type Options = Readonly<Record<string, OptionValue>>;\n\n/** The description of one option of a rule. */\nexport interface OptionSpec {\n readonly type: \"string\" | \"number\" | \"boolean\" | \"strings\";\n readonly default: OptionValue;\n readonly description: string;\n}\n\n/** A field of `package.json`, as the rules read it. */\nexport type Manifest = Readonly<Record<string, unknown>>;\n\n/** A `package.json` file of the repository. */\nexport interface PackageInfo {\n /** The folder, relative to the root, with `/`. The root is `\"\"`. */\n readonly folder: string;\n /** The absolute path of the folder. */\n readonly dir: string;\n /** The path of the `package.json` file, relative to the root, with `/`. */\n readonly file: string;\n /** The text of the `package.json` file. */\n readonly text: string;\n readonly manifest: Manifest;\n}\n\n/** The facts of the repository that a rule reads. */\nexport interface RuleContext {\n /** The absolute path of the root. */\n readonly root: string;\n /** The root `package.json`. */\n readonly rootPackage: PackageInfo;\n /** The packages of the workspace, without the root. A repository with no workspace has no packages here. */\n readonly packages: readonly PackageInfo[];\n /** The environment variables. */\n readonly env: Readonly<Record<string, string | undefined>>;\n /** The base commit that `--base` gives, if any. */\n readonly base?: string;\n /** This function gives the files that git tracks, relative to the root, or undefined when the root is not in a git repository. */\n gitFiles(): readonly string[] | undefined;\n /** This function starts git in the root, and gives its output, or undefined when git fails. */\n git(args: readonly string[]): string | undefined;\n}\n\n/** The result of a rule: a list of breaks (empty when the rule passes), or the reason why the rule did not start. */\nexport type RuleOutcome = readonly Break[] | { readonly skipped: string };\n\n/** One convention, as a machine check. */\nexport interface Rule {\n /** A short id in kebab case. The configuration names the rule with this id. */\n readonly id: string;\n /** The rule in one sentence. */\n readonly title: string;\n /** Why the rule exists. */\n readonly reason: string;\n /** How to correct a break. */\n readonly fix: string;\n /** The rows of the invariants audit that the rule comes from. */\n readonly sources: readonly AuditSource[];\n /** The options of the rule, with their defaults. */\n readonly options: Readonly<Record<string, OptionSpec>>;\n check(context: RuleContext, options: Options): RuleOutcome;\n}\n\n/** The fields of `package.json` that hold dependencies. */\nexport const DEPENDENCY_FIELDS = [\"dependencies\", \"devDependencies\", \"peerDependencies\", \"optionalDependencies\"] as const;\n\n/** This function gives each entry of a field of `package.json` that maps names to specifiers. */\nexport function specifiersOf(manifest: Manifest, field: string): [string, string][] {\n const value = manifest[field];\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) return [];\n return Object.entries(value as Record<string, unknown>).filter((entry): entry is [string, string] => typeof entry[1] === \"string\");\n}\n\n/** This function gives the line (from 1) of the first line of `text` that contains `needle`, from the line `from`. */\nexport function lineOf(text: string, needle: string, from = 1): number | undefined {\n const lines = text.split(/\\r?\\n/);\n for (let index = Math.max(0, from - 1); index < lines.length; index++) if ((lines[index] ?? \"\").includes(needle)) return index + 1;\n return undefined;\n}\n\n/** This function gives the line of the key `\"name\":` in `package.json`, after the line of the field `field`. */\nexport function keyLine(text: string, field: string, name: string): number | undefined {\n const start = lineOf(text, `\"${field}\"`) ?? 1;\n return lineOf(text, `${JSON.stringify(name)}:`, start) ?? lineOf(text, JSON.stringify(name), start);\n}\n\n/** This function joins a folder and a file name as a path relative to the root. */\nexport const inFolder = (folder: string, file: string): string => (folder === \"\" ? file : `${folder}/${file}`);\n\n/** This function removes `./` at the start of a path. */\nexport const cleanPath = (path: string): string => path.replace(/^\\.\\//, \"\");\n\n/** This function tells if a path matches one of the globs. */\nexport function matchesAny(path: string, globs: readonly string[]): boolean {\n return globs.some((glob) => globToRegExp(cleanPath(glob)).test(path));\n}\n\n/**\n * This function reads a JSON file with comments and commas at the end of a list (a `tsconfig.json`).\n *\n * @throws SyntaxError when the text is not JSON after the comments are removed\n */\nexport function parseJsonc(text: string): unknown {\n let out = \"\";\n let inString = false;\n for (let index = 0; index < text.length; index++) {\n const char = text.charAt(index);\n const next = text.charAt(index + 1);\n if (inString) {\n out += char;\n if (char === \"\\\\\") {\n out += next;\n index++;\n } else if (char === '\"') inString = false;\n } else if (char === '\"') {\n inString = true;\n out += char;\n } else if (char === \"/\" && next === \"/\") {\n while (index < text.length && text.charAt(index) !== \"\\n\") index++;\n out += \"\\n\";\n } else if (char === \"/\" && next === \"*\") {\n const end = text.indexOf(\"*/\", index + 2);\n index = end < 0 ? text.length : end + 1;\n } else out += char;\n }\n return JSON.parse(out.replace(/,(\\s*[}\\]])/g, \"$1\"));\n}\n\n/** This function reads a JSON file with comments, or gives undefined when the file does not exist or is not JSON. */\nexport function readJsonc(file: string): unknown {\n if (!existsSync(file)) return undefined;\n try {\n return parseJsonc(readFileSync(file, \"utf8\"));\n } catch {\n return undefined;\n }\n}\n\n/** This function starts git in `root` with `args`, and gives its output, or undefined when git fails. */\nexport function runGit(root: string, args: readonly string[]): string | undefined {\n const result = spawnSync(\"git\", [...args], { cwd: root, encoding: \"utf8\", maxBuffer: 256 * 1024 * 1024, windowsHide: true });\n if (result.error || result.status !== 0) return undefined;\n return result.stdout;\n}\n\n/** This function tells if `file` exists in the folder `dir`. */\nexport const hasFile = (dir: string, file: string): boolean => existsSync(join(dir, file));\n\n/**\n * This function gives the packages that hold code: the packages of the workspace, or the root\n * package when the repository has no workspace packages (a repository of one package).\n */\nexport function codePackages(context: Pick<RuleContext, \"rootPackage\" | \"packages\">): readonly PackageInfo[] {\n return context.packages.length > 0 ? context.packages : [context.rootPackage];\n}\n","/**\n * The rule `cue-preset`: the `tsconfig.json` of each package extends a preset of `@mark1russell7/cue`.\n * No config of a package turns off a strict option of its preset.\n */\nimport { readFileSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join, resolve } from \"node:path\";\nimport { codePackages, hasFile, inFolder, lineOf, readJsonc, type Break, type Rule } from \"../rule.ts\";\n\n/** The compiler options that make the type check strict. A package does not turn them off. */\nexport const STRICT_OPTIONS = [\n \"strict\",\n \"noImplicitAny\",\n \"strictNullChecks\",\n \"strictFunctionTypes\",\n \"strictBindCallApply\",\n \"strictPropertyInitialization\",\n \"strictBuiltinIteratorReturn\",\n \"noImplicitThis\",\n \"useUnknownInCatchVariables\",\n \"alwaysStrict\",\n \"noUncheckedIndexedAccess\",\n \"exactOptionalPropertyTypes\",\n \"noImplicitOverride\",\n \"noImplicitReturns\",\n \"noFallthroughCasesInSwitch\",\n \"noPropertyAccessFromIndexSignature\",\n] as const;\n\n/** The options that `strict` turns on when a config does not set them. */\nconst STRICT_FAMILY = new Set<string>([\n \"noImplicitAny\",\n \"strictNullChecks\",\n \"strictFunctionTypes\",\n \"strictBindCallApply\",\n \"strictPropertyInitialization\",\n \"strictBuiltinIteratorReturn\",\n \"noImplicitThis\",\n \"useUnknownInCatchVariables\",\n \"alwaysStrict\",\n]);\n\ntype Json = Readonly<Record<string, unknown>>;\n\nconst asObject = (value: unknown): Json => (typeof value === \"object\" && value !== null && !Array.isArray(value) ? (value as Json) : {});\n\n/** This function gives the `extends` list of a tsconfig. */\nconst extendsOf = (config: Json): string[] => {\n const value = config[\"extends\"];\n if (typeof value === \"string\") return [value];\n return Array.isArray(value) ? value.filter((item): item is string => typeof item === \"string\") : [];\n};\n\n/** The compiler options that a config gets from the configs that it extends. */\ninterface Inherited {\n readonly options: Json;\n /** False when the config extends a config that the rule cannot read. */\n readonly complete: boolean;\n}\n\n/**\n * This function gives the compiler options of the configs that `config` extends, with the options of\n * a later config over an earlier one.\n */\nfunction inheritedOptions(config: Json, dir: string, depth = 0): Inherited {\n if (depth > 10) return { options: {}, complete: false };\n let options: Json = {};\n let complete = true;\n for (const base of extendsOf(config)) {\n let file: string | undefined;\n if (base.startsWith(\".\")) file = resolve(dir, base.endsWith(\".json\") ? base : `${base}.json`);\n else {\n try {\n file = createRequire(join(dir, \"package.json\")).resolve(base);\n } catch {\n file = undefined;\n }\n }\n const parent = file === undefined ? undefined : readJsonc(file);\n if (parent === undefined || file === undefined) {\n complete = false;\n continue;\n }\n const above = inheritedOptions(asObject(parent), dirname(file), depth + 1);\n complete &&= above.complete;\n options = { ...options, ...above.options, ...asObject(asObject(parent)[\"compilerOptions\"]) };\n }\n return { options, complete };\n}\n\n/**\n * This function tells if a config that extends configs with the options `inherited` turns on the\n * option. When the rule cannot read each config, it gives true: the package turns off a strict option.\n */\nfunction inheritedOn(option: string, inherited: Inherited): boolean {\n if (!inherited.complete) return true;\n const value = inherited.options[option];\n if (typeof value === \"boolean\") return value;\n return STRICT_FAMILY.has(option) && inherited.options[\"strict\"] === true;\n}\n\nexport const cuePreset: Rule = {\n id: \"cue-preset\",\n title: \"The `tsconfig.json` of each package extends a preset of `@mark1russell7/cue`, and no config of a package turns off a strict option.\",\n reason:\n \"`pnpm package add` writes the configs from a preset, so each package checks its types with the same strict options. A config by hand or a strict option turned off lets the packages drift apart.\",\n fix: \"Make the package with `pnpm package add <name> --preset=<preset>`, or set `extends` to `@mark1russell7/cue/ts/config/<preset>.json`. Correct the code, not the strict option.\",\n sources: [\n { repo: \"client\", rule: \"cue-config\", doc: \"CLAUDE.md:64\" },\n { repo: \"client\", rule: \"no-manual-tsconfig\", doc: \"CLAUDE.md:64\" },\n { repo: \"Graph\", rule: \"cue-preset-strict\", doc: \"docs/architecture/ecosystem-and-structure.md:58\" },\n { repo: \"Graph\", rule: \"strict-preset\", doc: \"docs/architecture/ecosystem-and-structure.md:58\" },\n { repo: \"Graph\", rule: \"new-package-via-cli\", doc: \"CLAUDE.md:14\" },\n { repo: \"coeval\", rule: \"package-scaffold\", doc: \"CLAUDE.md:16\" },\n { repo: \"crawler\", rule: \"package-scaffold\", doc: \"CLAUDE.md:16\" },\n { repo: \"headroom\", rule: \"package-scaffold\", doc: \"CLAUDE.md:30\" },\n { repo: \"Vex\", rule: \"package-scaffold\", doc: \"CLAUDE.md:22\" },\n ],\n options: {\n prefix: { type: \"string\", default: \"@mark1russell7/cue/\", description: \"The start of the `extends` path of a preset.\" },\n extends: {\n type: \"boolean\",\n default: true,\n description: \"When false, the rule does not examine `extends`. It still reports each strict option that a config turns off. For a package that publishes its own presets.\",\n },\n },\n check(context, options) {\n const prefix = typeof options[\"prefix\"] === \"string\" ? options[\"prefix\"] : \"@mark1russell7/cue/\";\n const breaks: Break[] = [];\n for (const info of codePackages(context)) {\n if (!hasFile(info.dir, \"tsconfig.json\")) continue;\n for (const name of [\"tsconfig.json\", \"tsconfig.test.json\"]) {\n const path = join(info.dir, name);\n const file = inFolder(info.folder, name);\n const value = readJsonc(path);\n if (value === undefined) {\n if (hasFile(info.dir, name)) breaks.push({ file, message: `${name} is not JSON.`, fix: \"Correct the JSON.\" });\n continue;\n }\n const config = asObject(value);\n if (name === \"tsconfig.json\" && options[\"extends\"] !== false && !extendsOf(config).some((base) => base.startsWith(prefix))) {\n const line = lineOf(readFileSync(path, \"utf8\"), '\"extends\"');\n breaks.push({ file, ...(line === undefined ? {} : { line }), message: `tsconfig.json does not extend a preset of ${prefix.replace(/\\/$/, \"\")}.` });\n }\n const own = asObject(config[\"compilerOptions\"]);\n const inherited = inheritedOptions(config, info.dir);\n for (const option of STRICT_OPTIONS) {\n if (own[option] !== false || !inheritedOn(option, inherited)) continue;\n breaks.push({ file, message: `${name} turns off the strict option ${option}.`, fix: `Remove \"${option}\": false, and correct the code that it hides.` });\n }\n }\n }\n return breaks;\n },\n};\n","/**\n * The rule `main-check`: a script does not find out that it is the main module by a compare of `process.argv[1]` with\n * its own path. Through a link (a junction, a symbolic link, `~/git` to `D:/git`), the two paths differ. Then the\n * script does nothing, and it ends with exit code 0.\n */\nimport { readFileSync, statSync } from \"node:fs\";\nimport { extname, join } from \"node:path\";\nimport { codePackages, type Break, type Rule } from \"../rule.ts\";\n\n/** The extensions of the files that the rule reads. */\nconst SCRIPT = new Set([\".ts\", \".mts\", \".cts\", \".js\", \".mjs\"]);\n\n/** The largest file that the rule reads, in bytes. */\nconst MAX_BYTES = 1024 * 1024;\n\n/** The compare of two real paths. It is true through a link too, and it works on each Node version. */\nexport const REAL_COMPARE = \"process.argv[1] !== undefined && realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url))\";\n\n/** The imports that the compare of two real paths uses. */\nconst REAL_IMPORTS: readonly (readonly [string, string])[] = [\n [\"realpathSync\", \"node:fs\"],\n [\"fileURLToPath\", \"node:url\"],\n];\n\n/** The names of the imports that only a path compare uses. The fix removes the ones that become unused. */\nconst PATH_NAMES = [\"fileURLToPath\", \"pathToFileURL\", \"resolve\", \"realpathSync\"] as const;\n\n/** This function tells if a text compares `process.argv[1]` with the path of the module, without a real path of each side. */\nexport function isPathCompare(text: string): boolean {\n if (!text.includes(\"process.argv[1]\") || !/import\\.meta\\.(url|filename|dirname)\\b/.test(text)) return false;\n // A text with no compare only uses the two values, for example a record of them in a test\n if (!/[!=]=|\\.(?:endsWith|startsWith|includes)\\(/.test(text)) return false;\n // Two real paths are equal through a link too\n return (text.match(/realpathSync\\s*\\(/g) ?? []).length < 2;\n}\n\n/** The lowest version of a range of `engines.node` (for example `>=22.19` or `^24.2.0`). It is undefined when the range has no single lower bound. */\nexport function lowestNode(range: unknown): readonly [number, number] | undefined {\n if (typeof range !== \"string\" || range.includes(\"||\")) return undefined;\n // One \\s* only: two of them around the optional operator are slow on a long run of spaces\n const found = /^(?:>=|\\^|~)?\\s*v?(\\d+)(?:\\.(\\d+))?/.exec(range.trim());\n return found ? [Number(found[1]), Number(found[2] ?? 0)] : undefined;\n}\n\n/** This function tells if each Node version of the range has `import.meta.main`: 22.18 and later in 22, and 24.2 and later. Node 23 does not have it. */\nexport function hasImportMetaMain(range: unknown): boolean {\n const lowest = lowestNode(range);\n if (lowest === undefined) return false;\n const [major, minor] = lowest;\n // `^22.18` stays in 22. `>=22.18` lets Node 23 in, which does not have import.meta.main\n if (major === 22) return minor >= 18 && typeof range === \"string\" && /^[\\^~]/.test(range.trim());\n return major > 24 || (major === 24 && minor >= 2);\n}\n\n/** This function gives the line with `condition` in place of the condition of its `if (...)`. It gives undefined when no `if` has only the main check. */\nexport function fixLine(line: string, condition: string): string | undefined {\n const start = line.indexOf(\"if (\");\n if (start < 0) return undefined;\n let depth = 0;\n let end = -1;\n for (let index = start + 3; index < line.length; index++) {\n if (line[index] === \"(\") depth++;\n if (line[index] === \")\" && --depth === 0) {\n end = index;\n break;\n }\n }\n if (end < 0) return undefined;\n const old = line.slice(start + 4, end);\n // Each part of the condition is about argv[1], else the condition has more than the main check\n if (!old.split(\"&&\").every((part) => part.includes(\"process.argv[1]\")) || !isPathCompare(old)) return undefined;\n return `${line.slice(0, start)}if (${condition})${line.slice(end + 1)}`;\n}\n\n/** The import line of `module` with named imports, as `[index, prefix, names, suffix]`. */\nfunction namedImport(lines: readonly string[], module: string): [number, string, string[], string] | undefined {\n const pattern = new RegExp(`^(\\\\s*import\\\\s*\\\\{)([^}]*)(\\\\}\\\\s*from\\\\s*[\"']${module}[\"'];?\\\\s*)$`);\n for (let index = 0; index < lines.length; index++) {\n const found = pattern.exec(lines[index] ?? \"\");\n if (found) return [index, found[1] ?? \"\", (found[2] ?? \"\").split(\",\").map((part) => part.trim()).filter((part) => part !== \"\"), found[3] ?? \"\"];\n }\n return undefined;\n}\n\nconst importLine = (prefix: string, names: readonly string[], suffix: string): string => `${prefix.trimEnd()} ${names.join(\", \")} ${suffix.trimStart()}`;\n\n/** The local name of an import part, for example `type A`, `A as B` or `A`. */\nconst imported = (part: string): string => part.replace(/^type\\s+/, \"\").split(/\\s+as\\s+/)[0] ?? \"\";\n\n/** This function adds the imports in `needs` that the text does not have. Then it removes the named imports of PATH_NAMES that the text does not use. */\nexport function fixImports(text: string, needs: readonly (readonly [string, string])[]): string {\n const eol = text.includes(\"\\r\\n\") ? \"\\r\\n\" : \"\\n\";\n let lines = text.split(/\\r?\\n/);\n const isImport = (line: string): boolean => /^\\s*import\\b/.test(line);\n for (const [name, module] of needs) {\n const has = lines.some((line) => isImport(line) && new RegExp(`\\\\b${name}\\\\b`).test(line));\n if (has) continue;\n const found = namedImport(lines, module) ?? namedImport(lines, module.replace(/^node:/, \"\"));\n if (found) {\n lines = lines.map((line, index) => (index === found[0] ? importLine(found[1], [...found[2], name], found[3]) : line));\n continue;\n }\n // A new import after the last import line, or at the top (after a shebang)\n let last = -1;\n lines.forEach((line, index) => {\n if (isImport(line) && /from\\s*[\"'][^\"']+[\"'];?\\s*$/.test(line)) last = index;\n });\n const at = last >= 0 ? last + 1 : lines[0]?.startsWith(\"#!\") ? 1 : 0;\n // The quote and the semicolon of the other imports of the file\n const style = lines.find((line) => isImport(line) && /from\\s*[\"']/.test(line)) ?? \"\";\n const quote = /from\\s*'/.test(style) ? \"'\" : '\"';\n const semi = style === \"\" || /;\\s*$/.test(style) ? \";\" : \"\";\n lines = [...lines.slice(0, at), `import { ${name} } from ${quote}${module}${quote}${semi}`, ...lines.slice(at)];\n }\n for (const name of PATH_NAMES) {\n if (lines.some((line) => !isImport(line) && new RegExp(`\\\\b${name}\\\\b`).test(line))) continue;\n for (const module of [\"node:url\", \"node:path\", \"node:fs\", \"url\", \"path\", \"fs\"]) {\n const found = namedImport(lines, module);\n if (!found || !found[2].some((part) => imported(part) === name)) continue;\n const kept = found[2].filter((part) => imported(part) !== name);\n lines = kept.length === 0 ? lines.filter((_, index) => index !== found[0]) : lines.map((line, index) => (index === found[0] ? importLine(found[1], kept, found[3]) : line));\n }\n }\n return lines.join(eol);\n}\n\nexport const mainCheck: Rule = {\n id: \"main-check\",\n title: \"A script finds out that it is the main module with `import.meta.main`, or with a real path of each side, not by a compare of `process.argv[1]` with its path.\",\n reason:\n \"Through a link, `process.argv[1]` has the path of the link, and the module has the real path. The compare is false, so the script does nothing and ends with exit code 0: a check that looks done but did not start.\",\n fix: \"Write `if (import.meta.main)` when `engines.node` allows only versions that have it (`^22.18`, `>=24.2`). Else compare `realpathSync(process.argv[1])` with `realpathSync(fileURLToPath(import.meta.url))`. `conventions fix` writes the one that fits.\",\n sources: [{ repo: \"fleet\", rule: \"main-check\", doc: \"docs/STRATEGY.md (2026-11-02, the main check through a link)\" }],\n options: {},\n check(context) {\n const files = context.gitFiles();\n if (files === undefined) return { skipped: \"the root is not in a git repository\" };\n // The package of a file is the deepest package folder that holds it\n const packages = [...codePackages(context), context.rootPackage].sort((a, b) => b.folder.length - a.folder.length);\n const breaks: Break[] = [];\n for (const file of files) {\n if (!SCRIPT.has(extname(file).toLowerCase()) || /(^|\\/)(node_modules|dist)\\//.test(file)) continue;\n const path = join(context.root, file);\n let text: string;\n try {\n if (statSync(path).size > MAX_BYTES) continue;\n text = readFileSync(path, \"utf8\");\n } catch {\n continue;\n }\n if (!text.includes(\"process.argv[1]\")) continue;\n const owner = packages.find((p) => p.folder === \"\" || file.startsWith(`${p.folder}/`));\n const engines = (owner?.manifest as { engines?: { node?: unknown } } | undefined)?.engines?.node;\n const main = hasImportMetaMain(engines);\n const lines = text.split(/\\r?\\n/);\n for (let index = 0; index < lines.length; index++) {\n const line = lines[index] ?? \"\";\n const next = lines[index + 1] ?? \"\";\n // A compare on two lines: process.argv[1] on this line, and the path of the module on the next line\n const hit = isPathCompare(line) || (line.includes(\"process.argv[1]\") && !/import\\.meta/.test(line) && !isPathCompare(next) && isPathCompare(`${line} ${next}`));\n if (!hit) continue;\n const fixed = fixLine(line, main ? \"import.meta.main\" : REAL_COMPARE);\n const eol = text.includes(\"\\r\\n\") ? \"\\r\\n\" : \"\\n\";\n const after = fixed === undefined ? undefined : fixImports([...lines.slice(0, index), fixed, ...lines.slice(index + 1)].join(eol), main ? [] : REAL_IMPORTS);\n breaks.push({\n file,\n line: index + 1,\n message: \"The script compares process.argv[1] with its own path, which is false through a link.\",\n ...(after === undefined ? { fix: \"Change the condition by hand: it has more than the main check, or it is on more than one line.\" } : { edits: [{ file, before: text, after }] }),\n });\n }\n }\n return breaks;\n },\n};\n","/**\n * The rule `no-build-output`: git does not keep build output.\n */\nimport { byCode } from \"../workspace.ts\";\nimport type { Break, Rule } from \"../rule.ts\";\n\nexport const noBuildOutput: Rule = {\n id: \"no-build-output\",\n title: \"Git keeps no build output: no tracked file is in a folder named `dist` or `build`.\",\n reason:\n \"The release workflow builds each package from the source. Build output in git goes stale, makes noise in each diff, and a user can get old code from a git install.\",\n fix: \"Remove the folder from git with `git rm -r --cached <folder>`, and keep its name in `.gitignore`.\",\n sources: [\n { repo: \"client\", rule: \"no-build-output\", doc: \"CLAUDE.md:48\" },\n { repo: \"client\", rule: \"no-dist\", doc: \"CLAUDE.md:48\" },\n { repo: \"client\", rule: \"no-dist-commit\", doc: \"CLAUDE.md:48\" },\n ],\n options: {\n folders: { type: \"strings\", default: [\"dist\", \"build\"], description: \"The names of the folders of build output.\" },\n },\n check(context, options) {\n const files = context.gitFiles();\n if (files === undefined) return { skipped: \"the root is not in a git repository\" };\n const names = new Set(Array.isArray(options[\"folders\"]) ? options[\"folders\"] : [\"dist\", \"build\"]);\n const counts = new Map<string, number>();\n for (const file of files) {\n const segments = file.split(\"/\");\n const index = segments.slice(0, -1).findIndex((segment) => names.has(segment));\n if (index < 0) continue;\n const folder = segments.slice(0, index + 1).join(\"/\");\n counts.set(folder, (counts.get(folder) ?? 0) + 1);\n }\n return [...counts.keys()].sort(byCode).map(\n (folder): Break => ({\n file: `${folder}/`,\n message: `Git keeps ${counts.get(folder) ?? 0} file(s) in ${folder}/.`,\n fix: `Start \\`git rm -r --cached ${folder}\\`, and keep ${folder.split(\"/\").pop() ?? folder}/ in .gitignore.`,\n }),\n );\n },\n};\n","/**\n * The rule `no-local-paths`: no tracked file names the home folder of a user of a computer.\n */\nimport { readFileSync, statSync } from \"node:fs\";\nimport { extname, join } from \"node:path\";\nimport type { Break, Rule } from \"../rule.ts\";\n\n/** The extensions of files that are not text. The rule does not read them. */\nconst BINARY = new Set(\n \".png .jpg .jpeg .gif .webp .avif .ico .bmp .tiff .pdf .zip .gz .tgz .bz2 .xz .7z .tar .woff .woff2 .ttf .otf .eot .mp3 .mp4 .webm .mov .wav .ogg .wasm .node .exe .dll .so .dylib .bin .db .sqlite .duckdb\".split(\n \" \",\n ),\n);\n\n/** The largest file that the rule reads, in bytes. */\nconst MAX_BYTES = 2 * 1024 * 1024;\n\n/** The names in a home path that do not identify a person: CI users, container users and placeholders. */\nexport const DEFAULT_ALLOWED: readonly string[] = [\"runner\", \"runneradmin\", \"user\", \"username\", \"you\", \"me\", \"name\", \"yourname\", \"your-name\", \"example\", \"node\", \"ubuntu\", \"vscode\", \"codespace\", \"public\", \"default\", \"shared\", \"all users\"];\n\n/** The forms of a home folder: Windows, macOS and Linux. The group `user` is the name of the user. */\nexport const HOME_PATTERNS: readonly RegExp[] = [\n // A Windows path does not depend on case, so `c:/users/<name>` is the same folder\n /\\b[A-Za-z]:(?:\\\\{1,2}|\\/)[Uu][Ss][Ee][Rr][Ss](?:\\\\{1,2}|\\/)(?<user>[^\\\\/\\s\"'`<>|:*?%$(){}[\\],;]+)/g,\n /(?<![\\w.~-])\\/Users\\/(?<user>[^/\\s\"'`<>|:*?%$(){}[\\],;]+)/g,\n /(?<![\\w.~-])\\/home\\/(?<user>[^/\\s\"'`<>|:*?%$(){}[\\],;]+)/g,\n];\n\nexport const noLocalPaths: Rule = {\n id: \"no-local-paths\",\n title: \"No tracked file has the home folder of a user (`C:\\\\Users\\\\<name>`, `/Users/<name>`, `/home/<name>`).\",\n reason: \"A public file must not name a computer, a user or a path of a computer. A local path also works only on one computer.\",\n fix: \"Use a path relative to the repository, `~`, an environment variable, or a placeholder such as `<you>`.\",\n sources: [\n { repo: \"client\", rule: \"I12\", doc: \"packages/documentation/ARCHITECTURE.md:201\" },\n { repo: \"systems\", rule: \"no-identifying-names\", doc: \"CLAUDE.md:12\" },\n { repo: \"systems\", rule: \"no-private-identifiers\", doc: \"CLAUDE.md:12\" },\n { repo: \"systems\", rule: \"no-private-names\", doc: \"CLAUDE.md:12\" },\n { repo: \"coeval\", rule: \"no-private-names\", doc: \"CLAUDE.md:22\" },\n ],\n options: {\n allow: { type: \"strings\", default: [], description: \"More user names that do not identify a person.\" },\n patterns: {\n type: \"strings\",\n default: [],\n description: \"More regular expressions of text that no file has. The environment variable CONVENTIONS_PRIVATE_PATTERNS adds one on each line, so a private name stays out of package.json.\",\n },\n },\n check(context, options) {\n const files = context.gitFiles();\n if (files === undefined) return { skipped: \"the root is not in a git repository\" };\n const allowed = new Set([...DEFAULT_ALLOWED, ...(Array.isArray(options[\"allow\"]) ? options[\"allow\"] : [])].map((name) => name.toLowerCase()));\n // A repository keeps private names out of its public files with the environment variable, for example from a secret of CI\n const fromEnv = (context.env[\"CONVENTIONS_PRIVATE_PATTERNS\"] ?? \"\")\n .split(\"\\n\")\n .map((line) => line.trim())\n .filter((line) => line !== \"\");\n const sources = [...(Array.isArray(options[\"patterns\"]) ? options[\"patterns\"] : []), ...fromEnv];\n const extra = sources.map((source) => new RegExp(source, \"g\"));\n const rootFile = context.rootPackage.file;\n const breaks: Break[] = [];\n for (const file of files) {\n if (BINARY.has(extname(file).toLowerCase())) continue;\n const path = join(context.root, file);\n let text: string;\n try {\n if (statSync(path).size > MAX_BYTES) continue;\n text = readFileSync(path, \"utf8\");\n } catch {\n // A file of the index that is not in the working tree\n continue;\n }\n if (text.includes(\"\\0\")) continue;\n const lines = text.split(/\\r?\\n/);\n for (let index = 0; index < lines.length; index++) {\n const line = lines[index] ?? \"\";\n // The reason of an exception in the root package.json tells why a text is no home folder, so it can quote one. A private pattern still counts there\n const isReason = file === rootFile && /^\\s*\"(?:reason|off)\"\\s*:/.test(line);\n for (const pattern of isReason ? [] : HOME_PATTERNS) {\n for (const match of line.matchAll(pattern)) {\n const user = match.groups?.[\"user\"] ?? \"\";\n // A name of one character is a placeholder of a test, not a person\n if (user.length < 2 || allowed.has(user.toLowerCase())) continue;\n breaks.push({ file, line: index + 1, message: `The text \"${match[0]}\" is the home folder of a user.` });\n }\n }\n for (const pattern of extra) {\n // The option patterns of the root package.json names the pattern itself\n if (file === rootFile && line.trim().replace(/,$/, \"\") === JSON.stringify(pattern.source)) continue;\n for (const match of line.matchAll(pattern)) breaks.push({ file, line: index + 1, message: `The text \"${match[0]}\" matches the pattern ${pattern.source}.`, fix: \"Remove the text.\" });\n }\n }\n }\n return breaks;\n },\n};\n","/**\n * The rule `pinned-git-deps`: a dependency from git names a full commit.\n */\nimport { DEPENDENCY_FIELDS, keyLine, specifiersOf, type Break, type Manifest, type Rule } from \"../rule.ts\";\n\n/** The fields of the root `package.json` that replace the specifiers of dependencies. */\nconst OVERRIDE_FIELDS = [\"overrides\", \"resolutions\"] as const;\n\n/** This function tells if a specifier gets the package from git, not from a registry or the workspace. */\nexport function isGitSpecifier(spec: string): boolean {\n const value = spec.trim();\n if (/^(github|gitlab|bitbucket|gist):/i.test(value)) return true;\n if (/^git(\\+[a-z]+)?:/i.test(value) || /^git@/i.test(value)) return true;\n if (/^https?:\\/\\/(www\\.)?(github\\.com|gitlab\\.com|bitbucket\\.org|codeload\\.github\\.com)\\//i.test(value)) return true;\n // npm and pnpm read `owner/repo` and `owner/repo#ref` as a GitHub repository\n return /^[\\w-][\\w.-]*\\/[\\w.-]+(#.*)?$/.test(value) && !value.startsWith(\"@\");\n}\n\n/**\n * This function tells if a git specifier names a commit. A specifier names a commit when its ref\n * (after `#`) is a commit SHA, or when a tarball URL has the SHA in its path.\n */\nexport function isPinned(spec: string, fullSha: boolean): boolean {\n const sha = fullSha ? /^[0-9a-f]{40}$/i : /^[0-9a-f]{7,40}$/i;\n const hash = spec.indexOf(\"#\");\n if (hash >= 0) {\n // pnpm also knows `#commit=<sha>`, and `&` joins the parts of a ref\n const parts = spec.slice(hash + 1).split(\"&\");\n return parts.some((part) => sha.test(part.replace(/^commit=/, \"\")));\n }\n const path = /^https?:\\/\\/[^/]+\\/(.*)$/i.exec(spec.trim())?.[1];\n return path !== undefined && path.split(/[/.]/).some((part) => sha.test(part));\n}\n\n/** This function gives the specifiers of the fields of overrides, also the field `overrides` of `pnpm`. */\nfunction overridesOf(manifest: Manifest): [string, string, string][] {\n const out: [string, string, string][] = [];\n for (const field of OVERRIDE_FIELDS) for (const [name, spec] of specifiersOf(manifest, field)) out.push([field, name, spec]);\n const pnpm = manifest[\"pnpm\"];\n if (typeof pnpm === \"object\" && pnpm !== null) for (const [name, spec] of specifiersOf(pnpm as Manifest, \"overrides\")) out.push([\"pnpm\", name, spec]);\n return out;\n}\n\nexport const pinnedGitDeps: Rule = {\n id: \"pinned-git-deps\",\n title: \"A dependency from git (github:, git+https: or owner/repo) names a full commit SHA.\",\n reason:\n \"A git ref without a commit moves with the branch. Then an install today and an install tomorrow get different code, and the lockfile hides the change.\",\n fix: 'Use the npm version, `workspace:*` for a package of this repository, or `github:owner/repo#<full commit SHA>`.',\n sources: [\n { repo: \"coeval\", rule: \"pinned-deps\", doc: \"CLAUDE.md:41\" },\n { repo: \"coeval\", rule: \"unpublished-dep-pinned\", doc: \"CLAUDE.md:41\" },\n { repo: \"headroom\", rule: \"non-npm-deps-pinned\", doc: \"CLAUDE.md:38\" },\n { repo: \"headroom\", rule: \"pinned-github-specifier\", doc: \"CLAUDE.md:38\" },\n { repo: \"Graph\", rule: \"github-dep-full-sha\", doc: \"docs/decisions.md:1384\" },\n { repo: \"Graph\", rule: \"github-dep-pinned\", doc: \"docs/decisions.md:1384\" },\n { repo: \"client\", rule: \"general-npm-version\", doc: \"CLAUDE.md:54\" },\n ],\n options: {\n fullSha: { type: \"boolean\", default: true, description: \"When false, a short SHA of 7 or more characters is also a commit.\" },\n },\n check(context, options) {\n const fullSha = options[\"fullSha\"] !== false;\n const breaks: Break[] = [];\n for (const info of [context.rootPackage, ...context.packages]) {\n const found: [string, string, string][] = [];\n for (const field of DEPENDENCY_FIELDS) for (const [name, spec] of specifiersOf(info.manifest, field)) found.push([field, name, spec]);\n found.push(...overridesOf(info.manifest));\n for (const [field, name, spec] of found) {\n if (!isGitSpecifier(spec) || isPinned(spec, fullSha)) continue;\n const line = keyLine(info.text, field, name);\n breaks.push({\n file: info.file,\n ...(line === undefined ? {} : { line }),\n message: `${field} \"${name}\" is \"${spec}\": a git dependency without a ${fullSha ? \"full \" : \"\"}commit SHA.`,\n });\n }\n }\n return breaks;\n },\n};\n","/**\n * The rule `release-files`: a pull request changes a file of the release flow only with a reason\n * that everyone can see.\n */\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { matchesAny, type Break, type Rule, type RuleContext } from \"../rule.ts\";\n\n/** The range of commits that the rule examines. */\ninterface Range {\n /** The arguments of `git diff --name-only` that give the changed files. */\n readonly diff: readonly string[];\n /** The arguments of `git log` that give the commit messages. */\n readonly log: readonly string[];\n}\n\n/** This function gives the range of the change: the option `--base`, or the merge commit of a pull request. */\nfunction rangeOf(context: RuleContext): Range | { readonly skipped: string } {\n if (context.base !== undefined) {\n if (context.git([\"rev-parse\", \"--verify\", \"--quiet\", `${context.base}^{commit}`]) === undefined) return { skipped: `git does not know the base ${context.base}` };\n return { diff: [`${context.base}...HEAD`], log: [`${context.base}..HEAD`] };\n }\n const event = context.env[\"GITHUB_EVENT_NAME\"];\n if (event !== \"pull_request\" && event !== \"pull_request_target\") return { skipped: \"no base: the rule runs on a pull request, or with --base <ref>\" };\n // The checkout of a pull request is a merge commit: its first parent is the base, its second parent the head\n const parents = context.git([\"rev-list\", \"--parents\", \"-n\", \"1\", \"HEAD\"])?.trim().split(/\\s+/) ?? [];\n if (parents.length !== 3) return { skipped: \"HEAD is not the merge commit of the pull request\" };\n if (context.git([\"cat-file\", \"-e\", \"HEAD^1^{commit}\"]) === undefined) return { skipped: \"the checkout has no parent of HEAD: set fetch-depth to 2 or more\" };\n return { diff: [\"HEAD^1\", \"HEAD\"], log: [\"HEAD^1..HEAD\"] };\n}\n\n/** This function gives the body of the pull request from the event file of GitHub Actions, or an empty string. */\nfunction pullRequestBody(context: RuleContext): string {\n const file = context.env[\"GITHUB_EVENT_PATH\"];\n if (file === undefined || file === \"\" || !existsSync(file)) return \"\";\n try {\n const event = JSON.parse(readFileSync(file, \"utf8\")) as { pull_request?: { body?: unknown } };\n return typeof event.pull_request?.body === \"string\" ? event.pull_request.body : \"\";\n } catch {\n return \"\";\n }\n}\n\n/** This function escapes the special characters of a regular expression. */\nconst escape = (text: string): string => text.replace(/[\\\\^$.|?*+()[\\]{}]/g, \"\\\\$&\");\n\nexport const releaseFiles: Rule = {\n id: \"release-files\",\n title: \"A pull request changes `.github/workflows/release.yml` or `scripts/release/` only with a `Release-Edit: <reason>` line.\",\n reason:\n \"The release flow publishes to npm with trusted publishing. A change of its files by a session that does not own the release can stop or break each release.\",\n fix: \"Revert the change of the release files. When the owner asked for the change, add the line `Release-Edit: <reason>` to the last commit message or to the body of the pull request.\",\n sources: [\n { repo: \"coeval\", rule: \"no-release-edit\", doc: \"CLAUDE.md:40\" },\n { repo: \"coeval\", rule: \"no-release-edits\", doc: \"CLAUDE.md:40\" },\n { repo: \"crawler\", rule: \"no-release-edit\", doc: \"CLAUDE.md:80\" },\n { repo: \"crawler\", rule: \"no-release-edits\", doc: \"CLAUDE.md:80\" },\n { repo: \"headroom\", rule: \"no-release-edits\", doc: \"CLAUDE.md:37\" },\n { repo: \"headroom\", rule: \"release-files-frozen\", doc: \"CLAUDE.md:37\" },\n ],\n options: {\n paths: { type: \"strings\", default: [\".github/workflows/release.yml\", \"scripts/release/**\"], description: \"The globs of the files that the release flow owns.\" },\n trailer: { type: \"string\", default: \"Release-Edit\", description: \"The key of the line that gives the reason of a change.\" },\n authors: {\n type: \"strings\",\n default: [\"mark1russell7-release-train[bot]\"],\n description: \"The authors of the release flow. A change of the release files in commits of only these authors (the sync of the template) needs no reason.\",\n },\n },\n check(context, options) {\n const range = rangeOf(context);\n if (\"skipped\" in range) return range;\n const globs = Array.isArray(options[\"paths\"]) ? options[\"paths\"] : [];\n const changed = (context.git([\"diff\", \"--name-only\", ...range.diff]) ?? \"\")\n .split(/\\r?\\n/)\n .filter((file) => file !== \"\" && matchesAny(file, globs));\n if (changed.length === 0) return [];\n const trailer = typeof options[\"trailer\"] === \"string\" ? options[\"trailer\"] : \"Release-Edit\";\n const line = new RegExp(`^${escape(trailer)}:[ \\\\t]*\\\\S`, \"im\");\n const messages = context.git([\"log\", \"--no-merges\", \"--format=%B\", ...range.log]) ?? \"\";\n if (line.test(messages) || line.test(pullRequestBody(context))) return [];\n const authors = new Set(Array.isArray(options[\"authors\"]) ? options[\"authors\"] : []);\n const changers = (context.git([\"log\", \"--no-merges\", \"--format=%an\", ...range.log, \"--\", ...changed]) ?? \"\").split(/\\r?\\n/).filter((name) => name !== \"\");\n if (changers.length > 0 && changers.every((name) => authors.has(name))) return [];\n return changed.map((file): Break => ({ file, message: `The change edits ${file}, a file of the release flow, with no \"${trailer}: <reason>\" line.` }));\n },\n};\n","/**\n * The rule `required-scripts`: the root `package.json` keeps the scripts that the shared CI starts.\n */\nimport { DEPENDENCY_FIELDS, hasFile, lineOf, specifiersOf, type Break, type RuleContext, type Rule } from \"../rule.ts\";\n\n/** The package of the STE linter. */\nconst STE_LINT = \"@mark1russell7/ste-lint\";\n\n/** The configuration file of the STE linter. */\nconst STE_CONFIG = \"ste.config.json\";\n\n/** The examples of the scripts that the fix shows. */\nconst EXAMPLES: Readonly<Record<string, string>> = { \"lint:ste\": \"ste-lint\", typecheck: \"pnpm -r run typecheck\" };\n\n/**\n * This function tells if the repository uses the STE prose standard: the root `package.json` has a\n * dependency on `@mark1russell7/ste-lint`, or the root has a `ste.config.json`.\n */\nexport function usesSteLint(context: RuleContext): boolean {\n const manifest = context.rootPackage.manifest;\n if (DEPENDENCY_FIELDS.some((field) => specifiersOf(manifest, field).some(([name]) => name === STE_LINT))) return true;\n return hasFile(context.root, STE_CONFIG);\n}\n\nexport const requiredScripts: Rule = {\n id: \"required-scripts\",\n title: \"The root `package.json` has the script `typecheck`, and also `lint:ste` when the repository uses `ste-lint`.\",\n reason:\n \"The shared CI starts each script of its list that `package.json` has, and it skips the others. Thus a removed script turns its check off, and nothing shows it.\",\n fix: 'Add the script, for example `\"lint:ste\": \"ste-lint\"` or `\"typecheck\": \"pnpm -r run typecheck\"`.',\n sources: [\n { repo: \"client\", rule: \"ste-prose\", doc: \"CLAUDE.md:5\" },\n { repo: \"coeval\", rule: \"ste-prose\", doc: \"CLAUDE.md:5\" },\n { repo: \"crawler\", rule: \"ste-prose\", doc: \"CLAUDE.md:5\" },\n { repo: \"Graph\", rule: \"ste-prose\", doc: \"CLAUDE.md:5\" },\n { repo: \"headroom\", rule: \"ste-prose\", doc: \"CLAUDE.md:19\" },\n { repo: \"systems\", rule: \"lint-ste-in-ci\", doc: \"CLAUDE.md:24\" },\n { repo: \"Vex\", rule: \"ste-prose\", doc: \"CLAUDE.md:5\" },\n { repo: \"coeval\", rule: \"tsconfig-test\", doc: \"CLAUDE.md:18\" },\n { repo: \"crawler\", rule: \"tsconfig-test\", doc: \"CLAUDE.md:18\" },\n { repo: \"headroom\", rule: \"tsconfig-test\", doc: \"CLAUDE.md:32\" },\n { repo: \"Vex\", rule: \"tsconfig-test\", doc: \"CLAUDE.md:23\" },\n ],\n options: {\n scripts: { type: \"strings\", default: [\"typecheck\"], description: \"The scripts that the root `package.json` has.\" },\n steScripts: {\n type: \"strings\",\n default: [\"lint:ste\"],\n description: \"The scripts that the root `package.json` has when the repository uses `ste-lint` (a dependency on `@mark1russell7/ste-lint`, or a `ste.config.json` at the root).\",\n },\n },\n check(context, options) {\n const always = Array.isArray(options[\"scripts\"]) ? options[\"scripts\"] : [\"typecheck\"];\n const ste = Array.isArray(options[\"steScripts\"]) ? options[\"steScripts\"] : [\"lint:ste\"];\n const wanted = [...new Set([...always, ...(usesSteLint(context) ? ste : [])])];\n const value = context.rootPackage.manifest[\"scripts\"];\n const scripts = typeof value === \"object\" && value !== null ? (value as Record<string, unknown>) : {};\n const line = lineOf(context.rootPackage.text, '\"scripts\"');\n return wanted\n .filter((name) => typeof scripts[name] !== \"string\" || scripts[name] === \"\")\n .map((name): Break => {\n const example = EXAMPLES[name];\n const why = ste.includes(name) && !always.includes(name) ? \" The repository uses ste-lint.\" : \"\";\n return {\n file: context.rootPackage.file,\n ...(line === undefined ? {} : { line }),\n message: `The root package.json has no script \"${name}\".${why}`,\n fix: example === undefined ? `Add the script \"${name}\".` : `Add the script, for example \"${name}\": \"${example}\".`,\n };\n });\n },\n};\n","/**\n * The status data: the open work of a roadmap file, and the open pull requests and issues of a\n * GitHub repository. The build reads both, so the page shows the state at the time of the build.\n *\n * @remarks The roadmap parser reads two forms. The first form is each Markdown table with an `ID`\n * column and a `Status` column. The second form is each heading \"### `id`: Title\" under a \"##\" heading\n * that gives the status. The parser is strict: a row whose cells do not match the header stops the\n * build with the file and the line.\n */\n\nimport { readFileSync } from \"node:fs\";\nimport { join, posix } from \"node:path\";\nimport { githubOpenWork } from \"./github.ts\";\nimport type { BoardItem, GitHubOpenWork, Link, StatusBoardData, StatusClass } from \"./types.ts\";\n\n/** The classes of a status, in the sequence of the board. The open work comes first. */\nexport const STATUS_CLASSES: readonly StatusClass[] = [\"waiting\", \"blocked\", \"progress\", \"open\", \"later\", \"done\"];\n\n/** The open classes, in the sequence of the board. */\nexport const OPEN_CLASSES: readonly StatusClass[] = [\"waiting\", \"blocked\", \"progress\", \"open\", \"later\"];\n\n/** An error in the roadmap file, with the file and the line. */\nexport class RoadmapParseError extends Error {}\n\n// The keywords of each class. In a status text, the first keyword wins: \"done, needs a release\" is\n// done, and \"blocked, waits for X\" is blocked. A negation (\"not started\") comes first, so that the\n// word after it does not count.\nconst STATUS_KEYWORDS: ReadonlyArray<[StatusClass, RegExp]> = [\n [\"open\", /\\bnot\\s+(?:yet\\s+)?(?:started|done|fixed|merged|shipped|released)\\b|\\bto[ -]?do\\b/],\n // A closed item that did not ship (\"never\", \"dropped\") is not open work either\n [\"done\", /\\b(?:done|shipped|merged|fixed|released|complete|completed|closed|never|dropped|cancell?ed|wontfix)\\b|\\bwon't do\\b/],\n [\"progress\", /\\bin[ -]progress\\b|\\b(?:active|ongoing|started|wip)\\b/],\n [\"waiting\", /\\b(?:waiting|waits|awaiting|needs)\\b/],\n [\"blocked\", /\\bblocked\\b/],\n [\"later\", /\\b(?:later|deferred|postponed|someday)\\b/],\n];\n\n/**\n * This function gives the class of a free-text status: done, progress, waiting, blocked, later or\n * open. The first keyword of the text decides. A text without a keyword (\"next\", \"open\") is open.\n */\nexport function statusClassOf(text: string | null | undefined): StatusClass {\n const lower = String(text ?? \"\").toLowerCase();\n let best: { index: number; value: StatusClass } = { index: Infinity, value: \"open\" };\n for (const [value, pattern] of STATUS_KEYWORDS) {\n const match = pattern.exec(lower);\n if (match && match.index < best.index) best = { index: match.index, value };\n }\n return best.value;\n}\n\n/** This function gives the cells of a table row. A \"|\" in a code span or after \"\\\" is text. */\nexport function splitRow(line: string): string[] {\n const cells: string[] = [];\n let cell = \"\";\n let code = false;\n const text = line.trim().replace(/^\\|/, \"\").replace(/\\|$/, \"\");\n for (let index = 0; index < text.length; index++) {\n const char = text[index];\n if (char === \"\\\\\" && text[index + 1] === \"|\") {\n cell += \"|\";\n index++;\n } else if (char === \"`\") {\n code = !code;\n cell += char;\n } else if (char === \"|\" && !code) {\n cells.push(cell.trim());\n cell = \"\";\n } else {\n cell += char;\n }\n }\n cells.push(cell.trim());\n return cells;\n}\n\n/** A whitespace character, as `\\s` of a regular expression and `String.prototype.trim` read it. */\nconst SPACE = /\\s/;\n/** A character that `.` of a regular expression does not match. */\nconst LINE_TERMINATOR = /[\\n\\r\\u2028\\u2029]/;\n/** The first whitespace character at or after `lastIndex`. */\nconst NEXT_SPACE = /\\s/g;\n\n/**\n * This function replaces each Markdown link `[label](target)` of a text with the result of\n * `replace`. The label ends at the first `]`, and the target ends at the first `)`. In `strict`\n * mode, the label and the target are not empty, and the target has no whitespace.\n *\n * @remarks The function reads the text one time. A regular expression for these links can\n * backtrack (CodeQL `js/polynomial-redos`). For a long text with many `[` characters, its time\n * grows with the square of the length.\n */\nfunction replaceLinks(text: string, strict: boolean, replace: (label: string, target: string) => string): string {\n let result = \"\";\n let copied = 0;\n // The first \"]\" after the current \"[\", the first \")\" after its \"](\", and the first whitespace\n // after its \"](\". The values only increase, so each search starts where the last one stopped.\n let close = -1;\n let end = -1;\n let space = -1;\n for (let open = text.indexOf(\"[\"); open !== -1; open = text.indexOf(\"[\", open + 1)) {\n if (close <= open) close = text.indexOf(\"]\", open + 1);\n if (close === -1) break;\n if (text[close + 1] !== \"(\" || (strict && close === open + 1)) continue;\n const start = close + 2;\n if (end < start) end = text.indexOf(\")\", start);\n if (end === -1) break;\n if (strict) {\n if (space !== Infinity && space < start) {\n NEXT_SPACE.lastIndex = start;\n space = NEXT_SPACE.exec(text)?.index ?? Infinity;\n }\n if (end === start || space < end) continue;\n }\n result += text.slice(copied, open) + replace(text.slice(open + 1, close), text.slice(start, end));\n copied = end + 1;\n open = end;\n }\n return result + text.slice(copied);\n}\n\n/**\n * This function gives the text of an ATX heading without its closing sequence: the whitespace,\n * then the `#` characters, then the whitespace at the end. It gives null when the rest has a line\n * terminator, as the regular expression `(.*?)\\s*#*\\s*$` does.\n */\nfunction closeHeading(text: string): string | null {\n let end = text.length;\n while (end > 0 && SPACE.test(text[end - 1] ?? \"\")) end--;\n while (end > 0 && text[end - 1] === \"#\") end--;\n while (end > 0 && SPACE.test(text[end - 1] ?? \"\")) end--;\n const rest = text.slice(0, end);\n return LINE_TERMINATOR.test(rest) ? null : rest;\n}\n\n/** The start of an ATX heading. The text after the whitespace goes to `closeHeading`. */\nconst HEADING = /^(#{1,6})\\s+(\\S[\\s\\S]*)?$/;\n\n/** This function gives the level and the text of an ATX heading line, or null for another line. */\nfunction headingOf(line: string): { level: number; text: string } | null {\n const match = HEADING.exec(line);\n const text = match ? closeHeading(match[2] ?? \"\") : null;\n return match && text !== null ? { level: match[1]?.length ?? 0, text } : null;\n}\n\n/** This function gives the plain text of inline Markdown: no code marks, no emphasis, the text of each link. */\nexport function plainText(markdown: string | null | undefined): string {\n return replaceLinks(String(markdown ?? \"\"), false, (label) => label)\n .replace(/[`*_]/g, \"\")\n .replace(/\\s+/g, \" \")\n .trim();\n}\n\n/** A cell with no value: empty, or a dash. */\nfunction isEmpty(cell: string | undefined): boolean {\n return cell === undefined || /^(?:[-–—]|n\\/a)?$/i.test(cell.trim());\n}\n\n/** A table of a Markdown file. */\nexport interface MarkdownTable {\n /** The nearest heading above the table, as plain text. */\n section: string;\n /** The line of the header. */\n line: number;\n /** The header names, in lowercase plain text. */\n header: string[];\n rows: Array<{ line: number; cells: string[] }>;\n}\n\n/**\n * This function gives the tables of a Markdown file. Each table has its header names in lowercase\n * plain text, the nearest heading above it, the line of its header and its rows. Fenced code is not read.\n */\nexport function markdownTables(markdown: string): MarkdownTable[] {\n const lines = String(markdown).split(/\\r?\\n/);\n const tables: MarkdownTable[] = [];\n let section = \"\";\n let fence: string | null = null;\n for (let index = 0; index < lines.length; index++) {\n const line = lines[index] ?? \"\";\n const fenceMark = /^\\s*(`{3,}|~{3,})/.exec(line)?.[1];\n if (fenceMark !== undefined) {\n if (fence === null) fence = fenceMark[0] ?? null;\n else if (fenceMark[0] === fence) fence = null;\n continue;\n }\n if (fence !== null) continue;\n const heading = headingOf(line);\n if (heading) {\n section = plainText(heading.text);\n continue;\n }\n if (!line.trim().startsWith(\"|\")) continue;\n const separator = lines[index + 1] ?? \"\";\n if (!/^\\s*(?:\\|\\s*)?:?-{3,}/.test(separator)) continue;\n const header = splitRow(line).map((name) => plainText(name).toLowerCase());\n const rows: MarkdownTable[\"rows\"] = [];\n let next = index + 2;\n for (; next < lines.length && (lines[next] ?? \"\").trim().startsWith(\"|\"); next++) {\n rows.push({ line: next + 1, cells: splitRow(lines[next] ?? \"\") });\n }\n tables.push({ section, line: index + 1, header, rows });\n index = next - 1;\n }\n return tables;\n}\n\n/** The options of the link functions. */\nexport interface LinkOptions {\n /** The path of the roadmap file in the repository. */\n file?: string;\n /** \"owner/name\" of the repository. */\n repository?: string;\n /** The branch or the commit of the relative links. The default is \"HEAD\". */\n ref?: string;\n}\n\n/** The columns whose cells hold the links of an item. */\nconst LINK_COLUMNS = [\"where\", \"commit\", \"commits\", \"link\", \"links\", \"pr\", \"prs\"];\n/** Words before a reference that do not name a repository. */\nconst NOT_REPOSITORIES = new Set(\n \"a an and also at by commit commits done fixed for from in into issue issues merged of on or plus pr prs run see the then to via with\".split(\" \"),\n);\n\n/** The URL of a link target of the roadmap file: an absolute URL stays, and a relative one goes to GitHub. */\nfunction linkUrl(target: string, { file = \"\", repository = \"\", ref = \"HEAD\" }: LinkOptions): string | null {\n if (/^[a-z][a-z0-9+.-]*:/i.test(target)) return target;\n if (!repository) return null;\n const [path = \"\", anchor = \"\"] = target.split(\"#\", 2);\n const resolved = path === \"\" ? file : posix.normalize(posix.join(posix.dirname(file), path));\n if (resolved.startsWith(\"..\")) return null;\n return `https://github.com/${repository}/blob/${ref}/${resolved}${anchor ? `#${anchor}` : \"\"}`;\n}\n\n/**\n * This function gives the word right before the whitespace that ends `text.slice(0, end)`, as the\n * regular expression `([A-Za-z][\\w.-]*)\\s+$` does. The word starts with a letter. The function\n * reads only the characters of the word and of the whitespace.\n */\nfunction wordBefore(text: string, end: number): string | undefined {\n let stop = end;\n while (stop > 0 && SPACE.test(text[stop - 1] ?? \"\")) stop--;\n if (stop === end) return undefined;\n let start = stop;\n while (start > 0 && /[\\w.-]/.test(text[start - 1] ?? \"\")) start--;\n while (start < stop && !/[A-Za-z]/.test(text[start] ?? \"\")) start++;\n return start < stop ? text.slice(start, stop) : undefined;\n}\n\n/**\n * This function gives the links of a cell: each Markdown link, then each bare reference in the rest\n * of the text. A reference is a pull request (\"PR #12\", \"#12\") or a commit hash in a code span.\n *\n * @remarks A repository name right before a reference (\"systems PR #16\") applies to it and to the\n * next references of the cell. Without a name, a reference belongs to `repository`.\n */\nexport function linksOf(cell: string | null | undefined, options: LinkOptions = {}): Link[] {\n const { repository = \"\" } = options;\n const links: Link[] = [];\n const seen = new Set<string>();\n const add = (label: string, url: string | null): void => {\n if (!url || seen.has(url)) return;\n seen.add(url);\n links.push({ label, url });\n };\n const rest = replaceLinks(String(cell ?? \"\"), true, (label, target) => {\n add(plainText(label), linkUrl(target, options));\n return \" \";\n });\n if (!repository) return links;\n const [owner, defaultRepo] = repository.split(\"/\");\n let current = defaultRepo;\n // After \"PR\", the next numbers of the cell are pull requests too: \"PRs #28, #29 and #30\"\n let pulls = false;\n const reference = /\\bPRs?\\s*#(\\d+)|(?<![\\w/&])#(\\d+)\\b|`([0-9a-f]{7,40})`/g;\n for (let match = reference.exec(rest); match; match = reference.exec(rest)) {\n const word = wordBefore(rest, match.index);\n if (word && !NOT_REPOSITORIES.has(word.toLowerCase())) current = word;\n const prefix = current === defaultRepo ? \"\" : `${current} `;\n if (match[1] !== undefined) pulls = true;\n const number = match[1] ?? match[2];\n if (number !== undefined) add(`${prefix}#${number}`, `https://github.com/${owner}/${current}/${pulls ? \"pull\" : \"issues\"}/${number}`);\n else if (match[3] !== undefined) add(`${prefix}${match[3].slice(0, 7)}`, `https://github.com/${owner}/${current}/commit/${match[3]}`);\n }\n return links;\n}\n\n/**\n * The heading of an item: \"### `id`: Title\". A dash can take the place of the colon. The title goes\n * to `closeHeading`.\n */\nconst ITEM_HEADING = /^###\\s+`([^`]+)`\\s*[:–—-]\\s*(\\S[\\s\\S]*)?$/;\n/** The other heading of an item: \"### S1 · Title\". The ID is one word before the middle dot. */\nconst ITEM_HEADING_DOT = /^###\\s+([A-Za-z0-9][\\w.-]*)\\s+·\\s+(\\S[\\s\\S]*)?$/;\n\n/** This function gives the ID and the title of an item heading, or null for another line. */\nfunction itemHeadingOf(line: string): { id: string; title: string } | null {\n for (const pattern of [ITEM_HEADING, ITEM_HEADING_DOT]) {\n const match = pattern.exec(line);\n const title = match ? closeHeading(match[2] ?? \"\") : null;\n if (match && title !== null) return { id: match[1] ?? \"\", title };\n }\n return null;\n}\n\n/**\n * A field of an item heading: \"- Area: Docs\", \"- **Area:** Docs\" or \"- **Area**: Docs\". The label\n * matches without case.\n */\nconst ITEM_FIELD = /^\\s*[-*]\\s+(\\*\\*|__)?([A-Za-z][A-Za-z ]*?)(?::\\1|\\1:)\\s*(\\S.*)?$/;\n/** The fields of an item heading that give the optional fields of an item. */\nconst ITEM_FIELDS: Readonly<Record<string, \"area\" | \"owner\" | \"needs\">> = {\n area: \"area\",\n owner: \"owner\",\n \"waits for\": \"needs\",\n needs: \"needs\",\n \"depends on\": \"needs\",\n};\n\n/**\n * This function gives the items of the second form of a roadmap: each heading \"### `id`: Title\" or\n * \"### id · Title\". The list item \"Status:\" gives the status. Without it, the \"##\" heading above\n * the item gives the status, for example \"Waiting on Mark\", \"Later\" or \"Shipped\". A heading without\n * a status is not an item.\n *\n * The list items \"Area:\", \"Owner:\" and \"Waits for:\" give the optional fields. The list item\n * \"Links:\" and the other list items give the links. Fenced code is not read.\n */\nfunction headingItems(markdown: string, options: LinkOptions & { file: string }): BoardItem[] {\n const lines = String(markdown).split(/\\r?\\n/);\n const items: BoardItem[] = [];\n let section = \"\";\n let current: BoardItem | undefined;\n let fence: string | null = null;\n for (let index = 0; index < lines.length; index++) {\n const line = lines[index] ?? \"\";\n const fenceMark = /^\\s*(`{3,}|~{3,})/.exec(line)?.[1];\n if (fenceMark !== undefined) {\n if (fence === null) fence = fenceMark[0] ?? null;\n else if (fenceMark[0] === fence) fence = null;\n continue;\n }\n if (fence !== null) continue;\n const heading = headingOf(line);\n if (heading) {\n const { level } = heading;\n if (level > 3) continue;\n current = undefined;\n if (level === 2) section = plainText(heading.text);\n if (level === 1) section = \"\";\n if (level !== 3) continue;\n const item = itemHeadingOf(line);\n const id = plainText(item?.id);\n if (!item || isEmpty(id)) continue;\n current = { id, title: item.title, status: section, statusClass: statusClassOf(section), section, line: index + 1, links: [] };\n items.push(current);\n continue;\n }\n if (!current) continue;\n const field = ITEM_FIELD.exec(line);\n const label = (field?.[2] ?? \"\").trim().toLowerCase();\n const value = (field?.[3] ?? \"\").trim();\n const key = field ? ITEM_FIELDS[label] : undefined;\n if (field && label === \"status\") {\n // The field of the item wins over the section\n if (!isEmpty(value)) {\n current.status = value;\n current.statusClass = statusClassOf(plainText(value));\n }\n } else if (field && key !== undefined) {\n if (!isEmpty(value)) current[key] = value;\n } else if (/^\\s*[-*]\\s+/.test(line)) {\n const seen = new Set(current.links.map((link) => link.url));\n for (const link of linksOf(line, options)) if (!seen.has(link.url)) current.links.push(link);\n }\n }\n // A heading without a section and without a \"Status:\" field has no status: it is not an item\n return items.filter((item) => item.status !== \"\");\n}\n\n/**\n * This function gives the items of a roadmap file in the order of the file. It reads two forms:\n *\n * - Each row of each table with an `ID` column and a `Status` column. The header names match without\n * case. The title comes from `Item`, else from `Title`. `Owner`, `Area` and `Needs` are optional.\n * `Where`, `Commit` and `Links` give the links.\n * - Each heading \"### `id`: Title\" or \"### id · Title\". The list item \"Status:\", else the \"##\"\n * heading above it, gives the status. The list items \"Area:\", \"Owner:\" and \"Waits for:\" give the\n * optional fields, and \"Links:\" and the other list items give the links.\n *\n * @throws RoadmapParseError when the cells of a row do not match the header\n */\nexport function roadmapItems(markdown: string, options: LinkOptions = {}): BoardItem[] {\n const { file = \"ROADMAP.md\" } = options;\n const items: BoardItem[] = [];\n for (const table of markdownTables(markdown)) {\n const column = (...names: string[]): number => names.map((name) => table.header.indexOf(name)).find((index) => index >= 0) ?? -1;\n const id = column(\"id\");\n const status = column(\"status\");\n if (id < 0 || status < 0) continue;\n const title = column(\"item\", \"title\");\n const owner = column(\"owner\");\n const area = column(\"area\");\n const needs = column(\"needs\");\n const linkColumns = LINK_COLUMNS.map((name) => table.header.indexOf(name)).filter((index) => index >= 0);\n for (const row of table.rows) {\n if (row.cells.length !== table.header.length) {\n throw new RoadmapParseError(`${file}:${row.line}: the row has ${row.cells.length} cells, and the header has ${table.header.length}`);\n }\n const idText = plainText(row.cells[id]);\n if (isEmpty(idText)) continue;\n const statusText = row.cells[status] ?? \"\";\n const item: BoardItem = {\n id: idText,\n title: title >= 0 ? (row.cells[title] ?? \"\") : \"\",\n status: statusText,\n statusClass: statusClassOf(plainText(statusText)),\n section: table.section,\n line: row.line,\n links: linkColumns.flatMap((index) => linksOf(row.cells[index], { ...options, file })),\n };\n const optional = (index: number): string | undefined => (index >= 0 && !isEmpty(row.cells[index]) ? row.cells[index] : undefined);\n const ownerText = optional(owner);\n const areaText = optional(area);\n const needsText = optional(needs);\n if (ownerText !== undefined) item.owner = ownerText;\n if (areaText !== undefined) item.area = areaText;\n if (needsText !== undefined) item.needs = needsText;\n items.push(item);\n }\n }\n const headings = headingItems(markdown, { ...options, file });\n return headings.length === 0 ? items : [...items, ...headings].sort((a, b) => a.line - b.line);\n}\n\n// ---------------------------------------------------------------------------\n// The board\n// ---------------------------------------------------------------------------\n\n/** The input of `buildStatusBoard`. */\nexport interface StatusBoardInput {\n items: BoardItem[];\n /** The result of `githubOpenWork`. */\n github: GitHubOpenWork;\n /** The roadmap file in the repository, or null without a roadmap. */\n roadmap: string | null;\n /** \"owner/name\" of the repository. */\n repository: string;\n commit?: string | null;\n generatedAt?: string;\n}\n\n/**\n * This function gives the items of a roadmap file, as the Status page reads them. It fails when the file has no item.\n *\n * @throws RoadmapParseError when the cells of a row do not match the header\n * @throws RoadmapParseError when the roadmap has no item: no table with an ID and a Status column, and no item heading\n */\nexport function parseRoadmap(markdown: string, options: LinkOptions = {}): BoardItem[] {\n const { file = \"ROADMAP.md\" } = options;\n const items = roadmapItems(markdown, options);\n if (items.length === 0) throw new RoadmapParseError(`${file}: no table with an ID column and a Status column, and no heading \"### \\`id\\`: Title\"`);\n return items;\n}\n\n/** This function puts the roadmap items and the GitHub part into the shape of `status.json`. */\nexport function buildStatusBoard(input: StatusBoardInput): StatusBoardData {\n const { items, github, roadmap, repository, commit = null, generatedAt = new Date().toISOString() } = input;\n return {\n generatedAt,\n commit,\n source: { roadmap, github: repository },\n items,\n pullRequests: github.available ? github.pullRequests : [],\n issues: github.available ? github.issues : [],\n github: github.available ? { available: true, totals: github.totals } : { available: false, reason: github.reason },\n };\n}\n\n/** The options of `readStatusBoard`. */\nexport interface ReadStatusBoardOptions {\n repoDir: string;\n /** The path of the roadmap file from `repoDir`, with `/`. Without it, the board has only the GitHub part. */\n roadmap?: string | null | undefined;\n owner: string;\n repo: string;\n token: string | undefined;\n /** The commit of the build. The relative links of the roadmap go to it. */\n commit?: string | null | undefined;\n fetch?: typeof fetch | undefined;\n generatedAt?: string | undefined;\n}\n\n/**\n * This function reads the board of a repository on disk: the roadmap file, and the open work on GitHub.\n *\n * @throws RoadmapParseError when the roadmap has an incorrect row, or no item: no table with an ID\n * and a Status column, and no item heading\n */\nexport async function readStatusBoard(options: ReadStatusBoardOptions): Promise<StatusBoardData> {\n const { repoDir, roadmap = null, owner, repo, token, commit = null } = options;\n const repository = `${owner}/${repo}`;\n let items: BoardItem[] = [];\n if (roadmap) {\n const markdown = readFileSync(join(repoDir, ...roadmap.split(\"/\")), \"utf8\");\n items = parseRoadmap(markdown, { file: roadmap, repository, ref: commit ?? \"HEAD\" });\n }\n const github = await githubOpenWork({ owner, repo, token, ...(options.fetch ? { fetch: options.fetch } : {}) });\n return buildStatusBoard({\n items,\n github,\n roadmap: roadmap || null,\n repository,\n commit,\n ...(options.generatedAt ? { generatedAt: options.generatedAt } : {}),\n });\n}\n","/**\n * The standalone releases page: a lead line, a timeline of the versions and the changes of the\n * selected version. The build renders the HTML, and one small inline module adds the interactions.\n */\n\nimport type { Release, ReleaseChange, ReleaseKind } from \"../data/types.ts\";\nimport { longDate, shortDate } from \"./dates.ts\";\nimport { escapeHtml, inlineMarkdown, link, listText, plural } from \"./html.ts\";\nimport { pageShell, type PageOptions } from \"./theme.ts\";\nimport { laneCenter, oldestFirst, releaseSummary, timelineLayout, type TimelineLayout } from \"./timeline.ts\";\n\n/** The changes and the package chips that the page shows before \"Show all\". */\nconst FIRST_CHANGES = 8;\nconst FIRST_CHIPS = 4;\n/** The y of the mark below the center line of its lane. The label is above the line. */\nconst MARK_Y = 9;\n/** The widths of the two timelines: the narrow one for a phone or a tablet, the wide one for a desktop. */\nconst NARROW_WIDTH = 640;\nconst WIDE_WIDTH = 920;\n\nconst KIND_INFO: Record<ReleaseKind, { label: string; word: string; pill: string; legend: string }> = {\n first: { label: \"First release\", word: \"first release\", pill: \"sp-pill sp-good\", legend: \"The first release\" },\n major: { label: \"MAJOR\", word: \"major\", pill: \"sp-pill sp-strong\", legend: \"MAJOR: a change that breaks the API\" },\n minor: { label: \"MINOR\", word: \"minor\", pill: \"sp-pill sp-accent\", legend: \"MINOR: new features (before 1.0.0, also a change of the API)\" },\n patch: { label: \"PATCH\", word: \"patch\", pill: \"sp-pill\", legend: \"PATCH: fixes and small additions\" },\n};\n\n/** This function gives \"Oct 18, 2026\" for an ISO date. */\nfunction dayWithYear(date: string): string {\n return `${shortDate(date)}, ${new Date(date).getUTCFullYear()}`;\n}\n\n/**\n * This function gives the lead line of the releases page, for example \"23 versions from Oct 12 to\n * Oct 18, 2026. 7 MINOR releases and 15 PATCH releases came after the first release.\"\n */\nexport function releasesLead(releases: readonly Release[]): string {\n const summary = releaseSummary(releases);\n if (!summary.first || !summary.last) return \"The repository has no release yet.\";\n const sameYear = new Date(summary.first).getUTCFullYear() === new Date(summary.last).getUTCFullYear();\n const from = sameYear ? shortDate(summary.first) : dayWithYear(summary.first);\n const range = shortDate(summary.first) === shortDate(summary.last) && sameYear ? `on ${dayWithYear(summary.last)}` : `from ${from} to ${dayWithYear(summary.last)}`;\n if (summary.versions === 1) return `1 version, the first release, ${range}.`;\n const kinds = [\n summary.major > 0 ? plural(summary.major, \"MAJOR release\") : \"\",\n summary.minor > 0 ? plural(summary.minor, \"MINOR release\") : \"\",\n summary.patch > 0 ? plural(summary.patch, \"PATCH release\") : \"\",\n ].filter(Boolean);\n return `${plural(summary.versions, \"version\")} ${range}. ${listText(kinds)} came after the first release.`;\n}\n\n/** The shape of a mark. The first release is a diamond, a MAJOR is a large dot, a MINOR is a dot and a PATCH is a ring. */\nfunction markShape(kind: ReleaseKind, y: number): string {\n if (kind === \"first\") return `<rect class=\"sp-dot\" x=\"-5.5\" y=\"${y - 5.5}\" width=\"11\" height=\"11\" transform=\"rotate(45 0 ${y})\"/>`;\n if (kind === \"major\") return `<circle class=\"sp-dot\" cy=\"${y}\" r=\"8\"/>`;\n if (kind === \"minor\") return `<circle class=\"sp-dot\" cy=\"${y}\" r=\"6.5\"/>`;\n return `<circle class=\"sp-ring\" cy=\"${y}\" r=\"4.5\"/>`;\n}\n\nfunction legend(releases: readonly Release[]): string {\n const kinds = ([\"major\", \"minor\", \"patch\", \"first\"] as const).filter((kind) => releases.some((release) => release.kind === kind));\n const items = kinds.map(\n (kind) =>\n `<li><svg width=\"18\" height=\"18\" viewBox=\"-9 -9 18 18\" aria-hidden=\"true\"><g class=\"sp-kind-${kind}\">${markShape(kind, 0)}</g></svg>${escapeHtml(KIND_INFO[kind].legend)}</li>`,\n );\n return `<ul class=\"sp-legend\">${items.join(\"\")}</ul>`;\n}\n\nconst fixed = (value: number): string => value.toFixed(1).replace(/\\.0$/, \"\");\n\nfunction timelineSvg(releases: readonly Release[], width: number, selected: string): string {\n const layout: TimelineLayout<Release> = timelineLayout(releases, { width });\n const { plotTop, plotBottom } = layout;\n const parts: string[] = [];\n for (const band of layout.bands) {\n const middle = (band.x0 + band.x1) / 2;\n const room = band.x1 - band.x0;\n const count = band.empty ? \"no release\" : plural(band.count, \"release\");\n parts.push(`<g${band.empty ? ' class=\"sp-empty-band\"' : \"\"}>`);\n if (band.empty) parts.push(`<rect class=\"sp-gap\" x=\"${fixed(band.x0)}\" y=\"${plotTop}\" width=\"${fixed(room)}\" height=\"${plotBottom - plotTop}\"/>`);\n parts.push(`<line class=\"sp-grid\" x1=\"${fixed(band.x0)}\" x2=\"${fixed(band.x0)}\" y1=\"${plotTop}\" y2=\"${plotBottom + 6}\"/>`);\n if (room >= band.label.length * 7 + 6) {\n parts.push(`<text class=\"sp-day\" x=\"${fixed(middle)}\" y=\"${plotBottom + 21}\" text-anchor=\"middle\">${escapeHtml(band.label)}</text>`);\n }\n if (room >= count.length * 6 + 6) {\n parts.push(`<text class=\"sp-day-count\" x=\"${fixed(middle)}\" y=\"${plotBottom + 38}\" text-anchor=\"middle\">${escapeHtml(count)}</text>`);\n }\n parts.push(\"</g>\");\n }\n const lastBand = layout.bands[layout.bands.length - 1];\n if (lastBand) parts.push(`<line class=\"sp-grid\" x1=\"${fixed(lastBand.x1)}\" x2=\"${fixed(lastBand.x1)}\" y1=\"${plotTop}\" y2=\"${plotBottom + 6}\"/>`);\n parts.push(`<line class=\"sp-axis\" x1=\"${fixed(layout.bands[0]?.x0 ?? 0)}\" x2=\"${fixed(lastBand?.x1 ?? width)}\" y1=\"${plotBottom}\" y2=\"${plotBottom}\"/>`);\n const axis = `<g aria-hidden=\"true\">${parts.join(\"\")}</g>`;\n\n const marks = layout.marks.map((mark) => {\n const { release } = mark;\n const on = release.version === selected;\n const label = `${release.version}, ${KIND_INFO[release.kind].word}, ${shortDate(release.date)}, ${plural(release.changes.length, \"change\")}`;\n return (\n `<g class=\"sp-mark sp-kind-${release.kind}${on ? \" sp-selected\" : \"\"}\" data-sp-mark data-version=\"${escapeHtml(release.version)}\"` +\n ` data-x=\"${fixed(mark.x)}\" data-half=\"${fixed(mark.half)}\" transform=\"translate(${fixed(mark.x)} ${fixed(laneCenter(layout, mark.lane))})\"` +\n ` role=\"button\" tabindex=\"${on ? 0 : -1}\" aria-pressed=\"${on}\" aria-label=\"${escapeHtml(label)}\">` +\n `<rect class=\"sp-hit\" x=\"${fixed(-mark.half - 4)}\" y=\"${fixed(-layout.laneHeight / 2 + 1)}\" width=\"${fixed(mark.half * 2 + 8)}\" height=\"${layout.laneHeight - 2}\" rx=\"4\"/>` +\n `<circle class=\"sp-halo\" cy=\"${MARK_Y}\" r=\"11\"/>${markShape(release.kind, MARK_Y)}` +\n `<text class=\"sp-label\" y=\"-3\" text-anchor=\"middle\">${escapeHtml(release.version)}</text></g>`\n );\n });\n const name = `The release timeline, ${plural(layout.marks.length, \"version\")}. The arrow keys move between the versions.`;\n return (\n `<svg class=\"sp-timeline\" width=\"${layout.width}\" height=\"${layout.height}\" viewBox=\"0 0 ${layout.width} ${layout.height}\" role=\"group\" aria-label=\"${escapeHtml(name)}\">` +\n `${axis}${marks.join(\"\")}</svg>`\n );\n}\n\n/** The common scope of all the package names (\"@procedures/\"), or \"\" when the names have no common scope. */\nfunction commonScope(releases: readonly Release[]): string {\n const names = new Set(releases.flatMap((release) => release.changes.flatMap((change) => change.packages)));\n const scopes = new Set([...names].map((name) => /^(@[^/]+\\/)/.exec(name)?.[1] ?? \"\"));\n const [scope] = scopes;\n return scopes.size === 1 && scope ? scope : \"\";\n}\n\n/** The counter for the IDs of the lists that a button opens. */\ninterface Ids {\n next: number;\n}\n\nfunction toggleButton(ids: string, more: string, less: string, hidden = \"\"): string {\n return (\n `<button type=\"button\" class=\"sp-ghost\" data-sp-js data-sp-toggle aria-controls=\"${ids}\" aria-expanded=\"false\"` +\n ` data-more=\"${escapeHtml(more)}\" data-less=\"${escapeHtml(less)}\"><span data-sp-label>${escapeHtml(more)}</span>${hidden}</button>`\n );\n}\n\nfunction chips(packages: readonly string[], scope: string, ids: Ids): string {\n if (packages.length === 0) return \"\";\n const id = `k${ids.next++}`;\n const items = packages.map((name, index) => {\n const short = scope && name.startsWith(scope) ? name.slice(scope.length) : name;\n const extra = index >= FIRST_CHIPS;\n return `<span class=\"sp-pill${extra ? \" sp-extra\" : \"\"}\" title=\"${escapeHtml(name)}\"${extra ? \" hidden\" : \"\"}>${escapeHtml(short)}</span>`;\n });\n const more = packages.length - FIRST_CHIPS;\n const button = more > 0 ? toggleButton(id, `+${more} more`, \"Fewer\", '<span class=\"sp-visually-hidden\"> packages</span>') : \"\";\n return `<span class=\"sp-chips\" id=\"${id}\">${items.join(\"\")}${button}</span>`;\n}\n\nfunction changeItem(change: ReleaseChange, index: number, repository: string, scope: string, ids: Ids): string {\n const extra = index >= FIRST_CHANGES;\n const commit = change.commit\n ? link(`https://github.com/${repository}/commit/${change.commit}`, `<code>${escapeHtml(change.commit)}</code>`, `class=\"sp-commit\" title=\"${escapeHtml(`Commit ${change.commit} on GitHub`)}\"`)\n : \"\";\n const meta = commit || change.packages.length > 0 ? `<div class=\"sp-change-meta\">${commit}${chips(change.packages, scope, ids)}</div>` : \"\";\n return `<li class=\"sp-change${extra ? \" sp-extra\" : \"\"}\"${extra ? \" hidden\" : \"\"}><p>${inlineMarkdown(change.text)}</p>${meta}</li>`;\n}\n\nfunction details(release: Release, index: number, selected: boolean, repository: string, scope: string, ids: Ids): string {\n const info = KIND_INFO[release.kind];\n const links = release.links.map((each) => link(each.url, escapeHtml(each.label))).join(\"\");\n const head =\n `<div class=\"sp-release-head\"><h2 id=\"h${index}\">${escapeHtml(release.version)}</h2><span class=\"${info.pill}\">${escapeHtml(info.label)}</span>` +\n `<time class=\"sp-small sp-muted\" datetime=\"${escapeHtml(release.date)}\">${escapeHtml(longDate(release.date))}</time>` +\n (links ? `<span class=\"sp-release-links sp-small\">${links}</span>` : \"\") +\n \"</div>\";\n let body: string;\n if (release.changes.length === 0) {\n body = '<p class=\"sp-small sp-muted\">The sources have no change entry for this version.</p>';\n } else {\n const packages = new Set(release.changes.flatMap((change) => change.packages)).size;\n const count = packages > 0\n ? `${plural(release.changes.length, \"change\")} in ${plural(packages, \"package\")}. The changes with the most packages come first.`\n : `${plural(release.changes.length, \"change\")}.`;\n const listId = `c${index}`;\n const items = release.changes.map((change, position) => changeItem(change, position, repository, scope, ids));\n const all = release.changes.length > FIRST_CHANGES ? toggleButton(listId, `Show all ${release.changes.length} changes`, \"Show fewer changes\") : \"\";\n body = `<p class=\"sp-small sp-muted\">${escapeHtml(count)}</p><ul class=\"sp-changes\" id=\"${listId}\">${items.join(\"\")}</ul>${all}`;\n }\n return (\n `<section class=\"sp-panel sp-release\" id=\"v${escapeHtml(release.version)}\" data-sp-release data-version=\"${escapeHtml(release.version)}\"` +\n ` aria-labelledby=\"h${index}\"${selected ? \"\" : \" hidden\"}>${head}${body}</section>`\n );\n}\n\n/**\n * The inline module of the releases page. It selects a version on a click, with the arrow keys,\n * Home, End, Enter and Space. It also opens the long lists and keeps the version in the URL.\n */\nexport const RELEASES_SCRIPT: string = String.raw`\nconst boxes = Array.from(document.querySelectorAll(\"[data-sp-timeline]\"));\nconst panels = new Map(Array.from(document.querySelectorAll(\"[data-sp-release]\"), (panel) => [panel.dataset.version, panel]));\nconst reduced = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\nlet selected = (document.querySelector(\"[data-sp-release]:not([hidden])\") || {}).dataset?.version;\nconst markIn = (box, version) => Array.from(box.querySelectorAll(\"[data-sp-mark]\")).find((mark) => mark.dataset.version === version);\nfunction reveal(box, version, smooth) {\n const mark = markIn(box, version);\n if (!mark || box.scrollWidth <= box.clientWidth) return;\n const x = Number(mark.dataset.x);\n const margin = Number(mark.dataset.half) + 16;\n if (x - margin >= box.scrollLeft && x + margin <= box.scrollLeft + box.clientWidth) return;\n box.scrollTo({ left: x - box.clientWidth / 2, behavior: smooth && !reduced ? \"smooth\" : \"auto\" });\n}\nfunction select(version, box) {\n const panel = panels.get(version);\n if (!panel) return;\n selected = version;\n for (const each of boxes) {\n for (const mark of each.querySelectorAll(\"[data-sp-mark]\")) {\n const on = mark.dataset.version === version;\n mark.classList.toggle(\"sp-selected\", on);\n mark.setAttribute(\"aria-pressed\", String(on));\n mark.setAttribute(\"tabindex\", on ? \"0\" : \"-1\");\n }\n }\n for (const [key, each] of panels) each.hidden = key !== version;\n if (box) {\n const mark = markIn(box, version);\n if (mark) mark.focus({ preventScroll: true });\n reveal(box, version, true);\n }\n try {\n history.replaceState(null, \"\", \"#\" + encodeURIComponent(panel.id));\n } catch {}\n}\nfor (const box of boxes) {\n box.addEventListener(\"click\", (event) => {\n const mark = event.target.closest(\"[data-sp-mark]\");\n if (mark) select(mark.dataset.version, box);\n });\n box.addEventListener(\"keydown\", (event) => {\n const mark = event.target.closest(\"[data-sp-mark]\");\n if (!mark || event.altKey || event.ctrlKey || event.metaKey) return;\n const marks = Array.from(box.querySelectorAll(\"[data-sp-mark]\"));\n const position = marks.indexOf(mark);\n const targets = { ArrowLeft: position - 1, ArrowRight: position + 1, Home: 0, End: marks.length - 1, Enter: position, \" \": position };\n if (!(event.key in targets)) return;\n event.preventDefault();\n const next = marks[Math.max(0, Math.min(marks.length - 1, targets[event.key]))];\n if (next) select(next.dataset.version, box);\n });\n}\ndocument.addEventListener(\"click\", (event) => {\n const button = event.target.closest(\"[data-sp-toggle]\");\n const list = button && document.getElementById(button.getAttribute(\"aria-controls\"));\n if (!list) return;\n const open = button.getAttribute(\"aria-expanded\") !== \"true\";\n for (const extra of list.querySelectorAll(\":scope > .sp-extra\")) extra.hidden = !open;\n button.setAttribute(\"aria-expanded\", String(open));\n const label = button.querySelector(\"[data-sp-label]\");\n if (label) label.textContent = open ? button.dataset.less : button.dataset.more;\n});\n// A malformed hash, for example \"#100%\", must not stop the module\nlet hashed = \"\";\ntry {\n hashed = decodeURIComponent(location.hash.slice(1));\n} catch {}\nfor (const [version, panel] of panels) if (panel.id === hashed) select(version, null);\nconst revealAll = () => { for (const box of boxes) reveal(box, selected, false); };\nrevealAll();\nwindow.addEventListener(\"resize\", revealAll);\n`;\n\n/** This function renders the complete releases page from the data of `releases.json`. */\nexport function renderReleasesPage(releases: readonly Release[], options: PageOptions): string {\n const newest = releases[0];\n const ordered = oldestFirst(releases);\n const scope = commonScope(releases);\n const ids: Ids = { next: 0 };\n const lead = `<p class=\"sp-lead\">${escapeHtml(releasesLead(releases))}</p>`;\n let content = \"\";\n if (newest) {\n content =\n `<div class=\"sp-panel\"><p class=\"sp-small sp-muted\">Each mark is one version, on a time axis in UTC. Select a mark to show its changes.</p>` +\n legend(releases) +\n `<div class=\"sp-timeline-box sp-timeline-narrow\" data-sp-timeline>${timelineSvg(ordered, NARROW_WIDTH, newest.version)}</div>` +\n `<div class=\"sp-timeline-box sp-timeline-wide\" data-sp-timeline>${timelineSvg(ordered, WIDE_WIDTH, newest.version)}</div></div>` +\n releases.map((release, index) => details(release, index, index === 0, options.repository, scope, ids)).join(\"\");\n }\n const source =\n '<p class=\"sp-small sp-muted\">Source: the <code>CHANGELOG.md</code> files, the git tags, the GitHub releases and npm, read when the site was built.</p>';\n return pageShell(\n {\n title: \"Releases\",\n description: releasesLead(releases),\n current: \"releases\",\n main: `<h1>Releases</h1>${lead}${content}${source}`,\n script: RELEASES_SCRIPT,\n },\n options,\n );\n}\n","/**\n * The standalone status page: the open work of the roadmap file, the open pull requests and the\n * open issues. The build renders the HTML, and one small inline module adds the filters.\n */\n\nimport { OPEN_CLASSES } from \"../data/status.ts\";\nimport type { BoardItem, CheckState, StatusBoardData, StatusClass } from \"../data/types.ts\";\nimport { longDate } from \"./dates.ts\";\nimport { escapeHtml, inlineMarkdown, link, listText, plural } from \"./html.ts\";\nimport { pageShell, type PageOptions } from \"./theme.ts\";\n\n/** The label, the icon and the meaning of each class. The page always shows a color with an icon and a label. */\nconst CLASS_INFO: Record<StatusClass, { label: string; icon: string; meaning: string }> = {\n waiting: { label: \"Waiting\", icon: \"◷\", meaning: \"It waits for a person or a decision\" },\n blocked: { label: \"Blocked\", icon: \"⊘\", meaning: \"Other work must finish first\" },\n progress: { label: \"In progress\", icon: \"◐\", meaning: \"Work started\" },\n open: { label: \"Open\", icon: \"○\", meaning: \"Nobody started it\" },\n later: { label: \"Later\", icon: \"◌\", meaning: \"It is for later\" },\n done: { label: \"Done\", icon: \"✓\", meaning: \"It is finished\" },\n};\n\nconst CHECK_LABEL: Record<CheckState, string> = {\n success: \"Checks pass\",\n failure: \"Checks fail\",\n pending: \"Checks run\",\n none: \"No checks\",\n};\n\n/**\n * This function gives the lead line of the status page, for example \"12 open roadmap items, 9 open\n * pull requests and 0 open issues, read at Oct 19, 2026, 14:05 UTC from abc1234.\"\n */\nexport function statusLead(data: StatusBoardData): string {\n const parts: string[] = [];\n if (data.source.roadmap) parts.push(plural(data.items.filter((item) => item.statusClass !== \"done\").length, \"open roadmap item\"));\n if (data.github.available) {\n parts.push(plural(data.github.totals?.pullRequests ?? data.pullRequests.length, \"open pull request\"));\n parts.push(plural(data.github.totals?.issues ?? data.issues.length, \"open issue\"));\n }\n const commit = data.commit ? data.commit.slice(0, 7) : null;\n const read = `read at ${longDate(data.generatedAt)}${commit ? ` from ${commit}` : \"\"}`;\n const line = parts.length > 0 ? `${listText(parts)}, ${read}.` : `Read at ${read.slice(\"read at \".length)}.`;\n return data.github.available ? line : `${line} The build could not read GitHub.`;\n}\n\n/** This function gives the part of a URL for a text: \"The server stack (R37)\" gives \"the-server-stack-r37\". */\nexport function slugOf(text: string): string {\n return (\n text\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n // After the line above, no two hyphens are next to each other. \"-+$\" backtracks, and \"-$\" does not.\n .replace(/^-|-$/g, \"\") || \"other\"\n );\n}\n\n/** A section of the roadmap, with the count of its open items and of its done items. */\nexport interface BoardSection {\n slug: string;\n label: string;\n open: number;\n done: number;\n}\n\n/** This function gives the sections of the items, in the sequence of the file. */\nexport function sectionsOf(items: readonly BoardItem[]): BoardSection[] {\n const sections = new Map<string, BoardSection>();\n for (const item of items) {\n const slug = slugOf(item.section);\n const section = sections.get(slug) ?? { slug, label: item.section || \"Other\", open: 0, done: 0 };\n if (item.statusClass === \"done\") section.done++;\n else section.open++;\n sections.set(slug, section);\n }\n return [...sections.values()];\n}\n\n/** A group of items with one class. */\nexport interface ItemGroup {\n statusClass: StatusClass;\n items: BoardItem[];\n}\n\n/** This function gives the groups of the open items in the sequence of `OPEN_CLASSES`, without the empty groups. */\nexport function openGroups(items: readonly BoardItem[]): ItemGroup[] {\n return OPEN_CLASSES.map((statusClass) => ({ statusClass, items: items.filter((item) => item.statusClass === statusClass) })).filter(\n (group) => group.items.length > 0,\n );\n}\n\n/** This function counts the items of each class. */\nexport function classCounts(items: readonly BoardItem[]): Record<StatusClass, number> {\n const counts: Record<StatusClass, number> = { waiting: 0, blocked: 0, progress: 0, open: 0, later: 0, done: 0 };\n for (const item of items) counts[item.statusClass]++;\n return counts;\n}\n\nfunction roadmapUrl(data: StatusBoardData): string {\n return `https://github.com/${data.source.github}/blob/${data.commit ?? \"HEAD\"}/${data.source.roadmap ?? \"\"}`;\n}\n\nfunction meter(items: readonly BoardItem[]): string {\n const counts = classCounts(items);\n const order: StatusClass[] = [\"done\", ...OPEN_CLASSES];\n const present = order.filter((value) => counts[value] > 0);\n const total = Math.max(1, items.length);\n const summary = present.map((value) => `${counts[value]} ${CLASS_INFO[value].label.toLowerCase()}`).join(\", \");\n const parts = present.map((value) => `<span class=\"sp-c-${value}\" style=\"flex-grow:${(counts[value] / total).toFixed(4)}\"></span>`);\n const legend = present.map(\n (value) => `<li class=\"sp-c-${value}\"><span class=\"sp-swatch\"></span>${CLASS_INFO[value].label} <strong>${counts[value]}</strong></li>`,\n );\n return (\n `<div class=\"sp-meter\" role=\"img\" aria-label=\"${escapeHtml(`${plural(items.length, \"item\")} of the roadmap: ${summary}`)}\">${parts.join(\"\")}</div>` +\n `<ul class=\"sp-meter-legend\" aria-hidden=\"true\">${legend.join(\"\")}</ul>`\n );\n}\n\nfunction itemTable(items: readonly BoardItem[], data: StatusBoardData, columns: { owner: boolean; links: boolean }): string {\n const fileUrl = roadmapUrl(data);\n const none = '<span class=\"sp-muted\">—</span>';\n const rows = items.map((item) => {\n const meta = [escapeHtml(item.section), item.area ? inlineMarkdown(item.area) : \"\", item.needs ? `needs ${inlineMarkdown(item.needs)}` : \"\"]\n .filter(Boolean)\n .join(\" · \");\n const links = item.links.length > 0 ? `<span class=\"sp-links\">${item.links.map((each) => link(each.url, escapeHtml(each.label))).join(\"\")}</span>` : none;\n return (\n `<tr class=\"sp-c-${item.statusClass}\" data-section=\"${escapeHtml(slugOf(item.section))}\">` +\n `<th scope=\"row\">${link(`${fileUrl}?plain=1#L${item.line}`, escapeHtml(item.id), `title=\"${escapeHtml(`The row of ${item.id} in the roadmap file`)}\"`)}</th>` +\n `<td data-label=\"Item\" class=\"sp-item\"><span>${item.title ? inlineMarkdown(item.title) : '<span class=\"sp-muted\">No title</span>'}</span>` +\n `<span class=\"sp-item-meta sp-small sp-muted\">${meta}</span></td>` +\n // One element in each cell: on a phone, the cell is a grid of its label and its content\n (columns.owner ? `<td data-label=\"Owner\">${item.owner ? `<span>${inlineMarkdown(item.owner)}</span>` : none}</td>` : \"\") +\n `<td data-label=\"Status\"><span class=\"sp-status\"><span aria-hidden=\"true\">${CLASS_INFO[item.statusClass].icon}</span> ` +\n `${inlineMarkdown(item.status || CLASS_INFO[item.statusClass].label)}</span></td>` +\n (columns.links ? `<td data-label=\"Links\">${links}</td>` : \"\") +\n \"</tr>\"\n );\n });\n const head =\n '<thead><tr><th scope=\"col\">ID</th><th scope=\"col\">Item</th>' +\n (columns.owner ? '<th scope=\"col\">Owner</th>' : \"\") +\n '<th scope=\"col\">Status</th>' +\n (columns.links ? '<th scope=\"col\">Links</th>' : \"\") +\n \"</tr></thead>\";\n return `<div class=\"sp-table-box\"><table class=\"sp-table\">${head}<tbody>${rows.join(\"\")}</tbody></table></div>`;\n}\n\nfunction openWork(data: StatusBoardData): string {\n const items = data.items;\n const open = items.filter((item) => item.statusClass !== \"done\");\n const done = items.filter((item) => item.statusClass === \"done\");\n const counts = classCounts(items);\n const columns = { owner: items.some((item) => item.owner), links: items.some((item) => item.links.length > 0) };\n const file = (data.source.roadmap ?? \"\").split(\"/\").pop() ?? \"\";\n const classChips = OPEN_CLASSES.map(\n (value) =>\n `<button type=\"button\" class=\"sp-chip sp-c-${value}\" data-sp-class=\"${value}\" aria-pressed=\"false\" title=\"${escapeHtml(CLASS_INFO[value].meaning)}\">` +\n `<span aria-hidden=\"true\">${CLASS_INFO[value].icon}</span> ${CLASS_INFO[value].label} <span class=\"sp-count\">${counts[value]}</span></button>`,\n );\n const sectionChips = sectionsOf(items)\n .filter((section) => section.open > 0)\n .map(\n (section) =>\n `<button type=\"button\" class=\"sp-chip\" data-sp-section=\"${escapeHtml(section.slug)}\" aria-pressed=\"false\">` +\n `${escapeHtml(section.label)} <span class=\"sp-count\">${section.open}</span></button>`,\n );\n const filters =\n `<div class=\"sp-filters\" role=\"group\" aria-label=\"Filters of the open work\" data-sp-js>` +\n `<span role=\"group\" aria-label=\"Status of the items\">${classChips.join(\"\")}</span>` +\n (sectionChips.length > 1 ? `<span role=\"group\" aria-label=\"Section of the roadmap\">${sectionChips.join(\"\")}</span>` : \"\") +\n `<button type=\"button\" class=\"sp-ghost\" data-sp-clear hidden>Clear the filters</button></div>`;\n const label = plural(open.length, \"open item\");\n const groups = openGroups(items).map(\n (group) =>\n `<section class=\"sp-group sp-c-${group.statusClass}\" data-sp-group data-class=\"${group.statusClass}\" aria-labelledby=\"group-${group.statusClass}\">` +\n `<h3 id=\"group-${group.statusClass}\"><span aria-hidden=\"true\">${CLASS_INFO[group.statusClass].icon}</span> ${CLASS_INFO[group.statusClass].label} ` +\n `<span class=\"sp-group-count\" data-sp-group-count>${group.items.length}</span></h3>${itemTable(group.items, data, columns)}</section>`,\n );\n const list =\n open.length === 0\n ? '<p class=\"sp-callout\">The roadmap has no open item.</p>'\n : `<p class=\"sp-small sp-muted\" aria-live=\"polite\" data-sp-shown data-label=\"${escapeHtml(label)}\">${open.length} of ${escapeHtml(label)}</p>` +\n groups.join(\"\") +\n '<p class=\"sp-callout\" data-sp-empty hidden>No open item matches the filters.</p>';\n const doneText = done.length === 1 ? \"1 item is done.\" : `${done.length} items are done.`;\n const doneList =\n done.length === 0\n ? `<p class=\"sp-done sp-small\"><span aria-hidden=\"true\">✓</span> No item is done.</p>`\n : `<details class=\"sp-done sp-c-done\" data-sp-done><summary><span aria-hidden=\"true\">✓</span> ${doneText} ` +\n `<span data-sp-done-label>Show the done items</span></summary>` +\n `<section class=\"sp-group sp-c-done\" data-sp-group data-class=\"done\" aria-label=\"The done items\">${itemTable(done, data, columns)}` +\n '<p class=\"sp-callout\" data-sp-done-empty hidden>No done item matches the filters.</p></section></details>';\n return (\n `<section class=\"sp-section\" aria-labelledby=\"open-work\" data-sp-board><h2 id=\"open-work\">Open work</h2>` +\n `<p class=\"sp-small sp-muted\">Each row of a table of ${link(roadmapUrl(data), `<code>${escapeHtml(file)}</code>`)} with an ID and a status that is not done. ` +\n \"The build reads the file, so this list follows each commit.</p>\" +\n meter(items) +\n (open.length > 0 ? filters : \"\") +\n list +\n doneList +\n \"</section>\"\n );\n}\n\nfunction when(date: string): string {\n const text = escapeHtml(longDate(date));\n return `<time datetime=\"${escapeHtml(date)}\" title=\"${text}\" data-sp-rel>${text}</time>`;\n}\n\nfunction labels(names: readonly string[]): string {\n return names.length === 0 ? \"\" : `<span class=\"sp-labels\">${names.map((name) => `<span class=\"sp-pill\">${escapeHtml(name)}</span>`).join(\"\")}</span>`;\n}\n\nfunction githubMissing(data: StatusBoardData): string {\n const reason = data.github.reason ? ` (${escapeHtml(data.github.reason)})` : \"\";\n return `<p class=\"sp-callout\">The build could not read GitHub${reason}. Refer to ${link(`https://github.com/${data.source.github}`, escapeHtml(data.source.github))} on GitHub.</p>`;\n}\n\nfunction pullRequests(data: StatusBoardData): string {\n const total = data.github.totals?.pullRequests ?? data.pullRequests.length;\n let body: string;\n if (!data.github.available) body = githubMissing(data);\n else if (data.pullRequests.length === 0) {\n body = `<p class=\"sp-callout\">No pull request is open. Refer to ${link(`https://github.com/${data.source.github}/pulls?q=is%3Apr`, \"all the pull requests\")}.</p>`;\n } else {\n const count =\n total > data.pullRequests.length\n ? `The ${data.pullRequests.length} most recently updated of ${plural(total, \"open pull request\")}.`\n : `${plural(total, \"open pull request\")}, the most recently updated first.`;\n const cards = data.pullRequests.map(\n (pull) =>\n `<li class=\"sp-card\">${link(pull.url, `<span class=\"sp-number\">#${pull.number}</span> ${escapeHtml(pull.title)}`, 'class=\"sp-card-title\"')}` +\n `<span class=\"sp-card-meta\"><span class=\"sp-pill${pull.draft ? \"\" : \" sp-accent\"}\">${pull.draft ? \"Draft\" : \"Ready\"}</span>` +\n `<span class=\"sp-check sp-check-${pull.checks}\"><span class=\"sp-dot-state\" aria-hidden=\"true\"></span>${CHECK_LABEL[pull.checks]}</span>` +\n `<span>by ${escapeHtml(pull.author)}</span><code class=\"sp-branch\">${escapeHtml(pull.branch)}</code>` +\n `<span class=\"sp-muted\">updated ${when(pull.updatedAt)}</span>${labels(pull.labels)}</span></li>`,\n );\n body = `<p class=\"sp-small sp-muted\">${escapeHtml(count)}</p><ul class=\"sp-cards\">${cards.join(\"\")}</ul>`;\n }\n return `<section class=\"sp-section\" aria-labelledby=\"pull-requests\"><h2 id=\"pull-requests\">Pull requests</h2>${body}</section>`;\n}\n\nfunction issues(data: StatusBoardData): string {\n const total = data.github.totals?.issues ?? data.issues.length;\n let body: string;\n if (!data.github.available) body = githubMissing(data);\n else if (data.issues.length === 0) {\n body = `<p class=\"sp-callout\">No issue is open. To report a problem, ${link(`https://github.com/${data.source.github}/issues/new`, \"open an issue\")}.</p>`;\n } else {\n const count =\n total > data.issues.length\n ? `The ${data.issues.length} most recently updated of ${plural(total, \"open issue\")}.`\n : `${plural(total, \"open issue\")}, the most recently updated first.`;\n const cards = data.issues.map(\n (issue) =>\n `<li class=\"sp-card\">${link(issue.url, `<span class=\"sp-number\">#${issue.number}</span> ${escapeHtml(issue.title)}`, 'class=\"sp-card-title\"')}` +\n `<span class=\"sp-card-meta\"><span>by ${escapeHtml(issue.author)}</span>` +\n `<span class=\"sp-muted\">updated ${when(issue.updatedAt)}</span>${labels(issue.labels)}</span></li>`,\n );\n body = `<p class=\"sp-small sp-muted\">${escapeHtml(count)}</p><ul class=\"sp-cards\">${cards.join(\"\")}</ul>`;\n }\n return `<section class=\"sp-section\" aria-labelledby=\"issues\"><h2 id=\"issues\">Issues</h2>${body}</section>`;\n}\n\n/** The pure helpers of the inline module of the status page. A test reads them from this text. */\nexport const STATUS_SCRIPT_HELPERS: string = String.raw`\nfunction relativeTime(then, now) {\n const seconds = Math.round((now - then) / 1000);\n if (!Number.isFinite(seconds)) return \"at an unknown time\";\n if (seconds < 60) return \"just now\";\n const steps = [[60, \"minute\"], [3600, \"hour\"], [86400, \"day\"], [2592000, \"month\"], [31536000, \"year\"]];\n let unit = steps[0];\n for (const step of steps) if (seconds >= step[0]) unit = step;\n const count = Math.floor(seconds / unit[0]);\n return count + \" \" + unit[1] + (count === 1 ? \"\" : \"s\") + \" ago\";\n}\nfunction listOf(text) {\n return (text || \"\").split(\",\").filter((part) => part !== \"\");\n}\n`;\n\n/**\n * The inline module of the status page. It filters the open work by class and by section, keeps the\n * filters in the URL, and shows the age of each GitHub time.\n */\nexport const STATUS_SCRIPT: string =\n STATUS_SCRIPT_HELPERS +\n String.raw`\nconst now = Date.now();\nfor (const time of document.querySelectorAll(\"time[data-sp-rel]\")) {\n time.textContent = relativeTime(Date.parse(time.dateTime), now) + \" (\" + time.title + \")\";\n}\nconst board = document.querySelector(\"[data-sp-board]\");\nif (board) {\n const classChips = Array.from(board.querySelectorAll(\"[data-sp-class]\"));\n const sectionChips = Array.from(board.querySelectorAll(\"[data-sp-section]\"));\n const groups = Array.from(board.querySelectorAll(\"[data-sp-group]\"));\n const shown = board.querySelector(\"[data-sp-shown]\");\n const empty = board.querySelector(\"[data-sp-empty]\");\n const clear = board.querySelector(\"[data-sp-clear]\");\n const done = board.querySelector(\"[data-sp-done]\");\n const query = new URLSearchParams(location.search);\n const state = {\n classes: listOf(query.get(\"status\")).filter((value) => classChips.some((chip) => chip.dataset.spClass === value)),\n sections: listOf(query.get(\"section\")),\n };\n if (done && query.get(\"done\") === \"1\") done.open = true;\n const apply = (write) => {\n for (const chip of classChips) chip.setAttribute(\"aria-pressed\", String(state.classes.includes(chip.dataset.spClass)));\n for (const chip of sectionChips) chip.setAttribute(\"aria-pressed\", String(state.sections.includes(chip.dataset.spSection)));\n let count = 0;\n for (const group of groups) {\n const isDone = group.dataset.class === \"done\";\n const classOn = isDone || state.classes.length === 0 || state.classes.includes(group.dataset.class);\n let visible = 0;\n for (const row of group.querySelectorAll(\"tr[data-section]\")) {\n const on = classOn && (state.sections.length === 0 || state.sections.includes(row.dataset.section));\n row.hidden = !on;\n if (on) visible++;\n }\n if (isDone) {\n const none = group.querySelector(\"[data-sp-done-empty]\");\n if (none) none.hidden = visible > 0;\n } else {\n group.hidden = visible === 0;\n const badge = group.querySelector(\"[data-sp-group-count]\");\n if (badge) badge.textContent = String(visible);\n count += visible;\n }\n }\n if (shown) shown.textContent = count + \" of \" + shown.dataset.label;\n if (empty) empty.hidden = count > 0;\n if (clear) clear.hidden = state.classes.length === 0 && state.sections.length === 0;\n if (done) {\n const label = done.querySelector(\"[data-sp-done-label]\");\n if (label) label.textContent = done.open ? \"Hide the done items\" : \"Show the done items\";\n }\n if (!write) return;\n const next = new URLSearchParams(location.search);\n const put = (key, value) => (value ? next.set(key, value) : next.delete(key));\n put(\"status\", state.classes.join(\",\"));\n put(\"section\", state.sections.join(\",\"));\n put(\"done\", done && done.open ? \"1\" : \"\");\n const search = next.toString();\n try {\n history.replaceState(null, \"\", location.pathname + (search ? \"?\" + search : \"\") + location.hash);\n } catch {}\n };\n const toggle = (list, value) => (list.includes(value) ? list.filter((each) => each !== value) : list.concat(value));\n board.addEventListener(\"click\", (event) => {\n const chip = event.target.closest(\"button\");\n if (!chip) return;\n if (chip.dataset.spClass) state.classes = toggle(state.classes, chip.dataset.spClass);\n else if (chip.dataset.spSection) state.sections = toggle(state.sections, chip.dataset.spSection);\n else if (chip.hasAttribute(\"data-sp-clear\")) {\n state.classes = [];\n state.sections = [];\n } else return;\n apply(true);\n });\n if (done) done.addEventListener(\"toggle\", () => apply(true));\n apply(false);\n}\n`;\n\n/** This function renders the complete status page from the data of `status.json`. */\nexport function renderStatusPage(data: StatusBoardData, options: PageOptions): string {\n const lead = statusLead(data);\n const main =\n `<h1>Status</h1><p class=\"sp-lead\">${escapeHtml(lead)}</p>` +\n '<p class=\"sp-small sp-muted\">The build reads the roadmap file and GitHub again after each commit and on a schedule.</p>' +\n (data.source.roadmap ? openWork(data) : \"\") +\n pullRequests(data) +\n issues(data);\n return pageShell({ title: \"Status\", description: lead, current: \"status\", main, script: STATUS_SCRIPT }, options);\n}\n","/**\n * The rule `roadmap-parses`: each roadmap that a workflow gives to the Status page parses, on the pull request.\n */\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { parseRoadmap, RoadmapParseError } from \"@mark1russell7/site-pages\";\nimport { byCode } from \"../workspace.ts\";\nimport { cleanPath, type Break, type Rule } from \"../rule.ts\";\n\n/** A workflow file. */\nconst WORKFLOW = /^\\.github\\/workflows\\/[^/]+\\.ya?ml$/;\n\n/** A roadmap that a workflow names: the value of a `roadmap:` key, with its file and line. */\ninterface NamedRoadmap {\n readonly roadmap: string;\n readonly file: string;\n readonly line: number;\n}\n\n/** This function tells if a line calls the Pages workflow of the template (`uses: ...reusable-pages.yml`). */\nfunction callsPages(line: string): boolean {\n let text = line.trimStart();\n if (text.startsWith(\"- \")) text = text.slice(2).trimStart();\n if (!text.startsWith(\"uses:\")) return false;\n const value = text.slice(\"uses:\".length).trim();\n return /(?:^|\\/)reusable-pages\\.ya?ml(?:@|$|\\s)/.test(value);\n}\n\nconst indentOf = (line: string): number => line.length - line.trimStart().length;\n\n/** This function tells if a line is `site-pages: false`: the site has no Status page. */\nfunction noStatusPage(line: string): boolean {\n const text = line.trimStart();\n if (!text.startsWith(\"site-pages:\")) return false;\n let value = text.slice(\"site-pages:\".length);\n const comment = value.indexOf(\" #\");\n if (comment >= 0) value = value.slice(0, comment);\n return [\"false\", '\"false\"', \"'false'\"].includes(value.trim());\n}\n\n/**\n * This function gives the line numbers of each call of the Pages workflow that gives no `roadmap` key. The key is in the\n * job of the call: the lines around it with the same indent or more. A job with `site-pages: false` has no Status page.\n */\nfunction callsWithoutRoadmap(lines: readonly string[]): number[] {\n const found: number[] = [];\n lines.forEach((line, index) => {\n if (!callsPages(line)) return;\n const indent = indentOf(line);\n const inJob = (text: string): boolean => text.trim() === \"\" || indentOf(text) >= indent;\n let first = index;\n while (first > 0 && inJob(lines[first - 1] ?? \"\")) first -= 1;\n let last = index;\n while (last < lines.length - 1 && inJob(lines[last + 1] ?? \"\")) last += 1;\n const job = lines.slice(first, last + 1);\n if (!job.some((text) => text.trimStart().startsWith(\"roadmap:\") || noStatusPage(text))) found.push(index + 1);\n });\n return found;\n}\n\n/** This function gives the value of a `roadmap: <file>` line, or undefined for another line, an empty value or an expression. */\nexport function roadmapOfLine(line: string): string | undefined {\n const text = line.trimStart();\n if (!text.startsWith(\"roadmap:\")) return undefined;\n let value = text.slice(\"roadmap:\".length);\n const comment = value.indexOf(\" #\");\n if (comment >= 0) value = value.slice(0, comment);\n value = value.trim();\n const quote = value.charAt(0);\n if (value.length >= 2 && (quote === '\"' || quote === \"'\") && value.endsWith(quote)) value = value.slice(1, -1).trim();\n if (value === \"\" || value.includes(\"${{\")) return undefined;\n return cleanPath(value);\n}\n\nexport const roadmapParses: Rule = {\n id: \"roadmap-parses\",\n title: \"Each call of the Pages workflow gives a roadmap, and each roadmap that a workflow gives to the Status page (the input `roadmap`) parses as site-pages reads it.\",\n reason:\n \"Only the Pages job on main reads the roadmap. A pull request with a bad table row passes each check, and then the build of the site stops and the site stays stale. On 2026-10-30, one repository had 3 red Pages runs in a row because of one row with 2 cells under a header with 4. A site with no roadmap is the same fault with no error: its Status page shows no item of the plan, and each check is green. On 2026-10-30, 2 repositories had a site with no roadmap.\",\n fix: 'Give the roadmap file to the Pages workflow (`roadmap: docs/ROADMAP.md`). Correct the row or the heading that the message names. Each table row has one cell for each column of its header, and the file has a table with an ID column and a Status column, or a heading \"### `id`: Title\".',\n sources: [{ repo: \"fleet\", rule: \"fail-closed\", doc: \"docs/STRATEGY.md (2026-10-30, gates and probes fail closed)\" }],\n options: {\n roadmaps: { type: \"strings\", default: [], description: \"More roadmap files to check: a roadmap that no workflow names with a `roadmap:` key.\" },\n },\n check(context, options) {\n const files = context.gitFiles();\n if (files === undefined) return { skipped: \"the root is not in a git repository\" };\n const named: NamedRoadmap[] = [];\n const breaks: Break[] = [];\n for (const file of files.filter((path) => WORKFLOW.test(path)).sort(byCode)) {\n const lines = readFileSync(join(context.root, file), \"utf8\").split(/\\r?\\n/);\n lines.forEach((line, index) => {\n const roadmap = roadmapOfLine(line);\n if (roadmap !== undefined) named.push({ roadmap, file, line: index + 1 });\n });\n // A site with no roadmap has a Status page with only the open pull requests and issues: the plan is not on it.\n for (const line of callsWithoutRoadmap(lines)) {\n breaks.push({ file, line, message: `${file} builds the site with the Pages workflow and gives no roadmap, so the Status page shows no roadmap item.` });\n }\n }\n for (const roadmap of options[\"roadmaps\"] as readonly string[]) named.push({ roadmap: cleanPath(roadmap), file: \"the option roadmaps\", line: 0 });\n if (named.length === 0 && breaks.length === 0) return { skipped: \"no workflow builds a site with the Pages workflow, and no workflow names a roadmap\" };\n const seen = new Set<string>();\n for (const { roadmap, file, line } of named) {\n if (seen.has(roadmap)) continue;\n seen.add(roadmap);\n if (!existsSync(join(context.root, roadmap))) {\n breaks.push({ file: line > 0 ? file : roadmap, ...(line > 0 ? { line } : {}), message: `${file} names the roadmap ${roadmap}, and the file does not exist.` });\n continue;\n }\n try {\n parseRoadmap(readFileSync(join(context.root, roadmap), \"utf8\"), { file: roadmap });\n } catch (error) {\n if (!(error instanceof RoadmapParseError)) throw error;\n // The message starts with \"<file>:<line>: \" or \"<file>: \". The break has the file and the line in their own fields.\n const at = /^[^:]+:(\\d+): /.exec(error.message);\n const rest = at ? error.message.slice(at[0].length) : error.message.slice(error.message.indexOf(\": \") + 2);\n breaks.push({ file: roadmap, ...(at ? { line: Number(at[1]) } : {}), message: `${roadmap}: ${rest}` });\n }\n }\n return breaks;\n },\n};\n","/**\n * The rule `runner-budget`: the workflows share the runners of the account. Each matrix has a `max-parallel`, each\n * workflow has a concurrency group, and each schedule starts at the minute of its repository and file.\n */\nimport { readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { byCode } from \"../workspace.ts\";\nimport { replaceLine, type Break, type Edit, type Rule } from \"../rule.ts\";\n\n/** A workflow file. */\nconst WORKFLOW = /^\\.github\\/workflows\\/[^/]+\\.ya?ml$/;\n\nconst indentOf = (line: string): number => line.length - line.trimStart().length;\n\n/** This function removes a comment at the end of a value, and the quotes around it. */\nfunction valueOf(raw: string): string {\n const comment = raw.indexOf(\" #\");\n let value = (comment >= 0 ? raw.slice(0, comment) : raw).trim();\n const quote = value.charAt(0);\n if (value.length >= 2 && (quote === '\"' || quote === \"'\") && value.endsWith(quote)) value = value.slice(1, -1).trim();\n return value;\n}\n\n/** This function gives the value of the key `key` on a line, or undefined when the line has another key. */\nfunction keyValue(line: string, key: string): string | undefined {\n let text = line.trimStart();\n if (text.startsWith(\"- \")) text = text.slice(2).trimStart();\n if (!text.startsWith(`${key}:`)) return undefined;\n return valueOf(text.slice(key.length + 1));\n}\n\n/** This function gives the lines of the block under the line `index`: the next lines with a larger indent. */\nfunction blockEnd(lines: readonly string[], index: number): number {\n const indent = indentOf(lines[index] ?? \"\");\n let end = index + 1;\n while (end < lines.length) {\n const line = lines[end] ?? \"\";\n if (line.trim() !== \"\" && indentOf(line) <= indent) break;\n end += 1;\n }\n return end;\n}\n\n/** This function gives the indent of the first key of the block under the line `index`, or undefined for an empty block. */\nfunction childIndent(lines: readonly string[], index: number): number | undefined {\n const end = blockEnd(lines, index);\n for (let i = index + 1; i < end; i++) if ((lines[i] ?? \"\").trim() !== \"\") return indentOf(lines[i] ?? \"\");\n return undefined;\n}\n\n/**\n * This function gives the minute (1 to 59) of the schedules of a workflow: the FNV-1a hash of the repository and the\n * file. Two repositories with the same workflow thus start at different minutes, and no schedule starts at minute 0,\n * where GitHub has the most load.\n */\nexport function scheduleMinute(repository: string, file: string): number {\n let hash = 0x811c9dc5;\n for (const char of `${repository.toLowerCase()}/${file}`) {\n hash ^= char.codePointAt(0) ?? 0;\n hash = Math.imul(hash, 0x01000193) >>> 0;\n }\n return (hash % 59) + 1;\n}\n\n/** This function gives `owner/name` from a git remote URL, or undefined for a URL that is not of GitHub. */\nexport function repositoryOfRemote(url: string): string | undefined {\n const text = url.trim();\n for (const prefix of [\"git@github.com:\", \"ssh://git@github.com/\", \"https://github.com/\", \"http://github.com/\", \"git+https://github.com/\"]) {\n if (!text.startsWith(prefix)) continue;\n let rest = text.slice(prefix.length);\n if (rest.endsWith(\"/\")) rest = rest.slice(0, -1);\n if (rest.endsWith(\".git\")) rest = rest.slice(0, -4);\n const parts = rest.split(\"/\");\n return parts.length === 2 && parts.every((part) => part !== \"\") ? rest : undefined;\n }\n return undefined;\n}\n\n/** This function tells if a workflow is a shared workflow (`on: workflow_call`). Its caller gives the concurrency group. */\nfunction isShared(lines: readonly string[]): boolean {\n return lines.some((line) => {\n const text = line.trimStart();\n return text.startsWith(\"workflow_call:\") || text === \"workflow_call\" || text === \"- workflow_call\" || (text.startsWith(\"on:\") && text.includes(\"workflow_call\"));\n });\n}\n\n/** A job of a workflow: its name, its line (from 1), its keys with their values, and its concurrency group. */\ninterface Job {\n readonly name: string;\n readonly line: number;\n readonly grouped: boolean;\n /** The file name of the shared workflow that the job calls (`uses: .../.github/workflows/<name>`), if any. */\n readonly calls?: string;\n}\n\n/** This function gives the jobs of a workflow. */\nfunction jobsOf(lines: readonly string[]): Job[] {\n const jobs = lines.findIndex((line) => indentOf(line) === 0 && line.startsWith(\"jobs:\"));\n if (jobs < 0) return [];\n const jobIndent = childIndent(lines, jobs);\n const end = blockEnd(lines, jobs);\n const found: Job[] = [];\n for (let i = jobs + 1; i < end; i++) {\n const line = lines[i] ?? \"\";\n if (line.trim() === \"\" || indentOf(line) !== jobIndent) continue;\n const keyIndent = childIndent(lines, i);\n const keys = lines.slice(i + 1, blockEnd(lines, i)).filter((text) => indentOf(text) === keyIndent);\n const uses = keys.map((text) => keyValue(text, \"uses\")).find((value) => value !== undefined);\n const marker = \".github/workflows/\";\n const at = uses === undefined ? -1 : uses.indexOf(marker);\n const calls = uses === undefined || at < 0 ? undefined : (uses.slice(at + marker.length).split(\"@\")[0] ?? \"\");\n found.push({ name: line.trim().replace(/:$/, \"\"), line: i + 1, grouped: keys.some((text) => keyValue(text, \"concurrency\") !== undefined), ...(calls === undefined ? {} : { calls }) });\n }\n return found;\n}\n\nconst hasTopGroup = (lines: readonly string[]): boolean => lines.some((line) => indentOf(line) === 0 && line.startsWith(\"concurrency:\"));\n\n/**\n * This function gives the edit that adds a concurrency group at the top of a workflow, before `jobs:`. A new run of a pull\n * request stops the old run. A run of another event waits for the old run, so that no release or scheduled run stops.\n */\nfunction groupEdits(file: string, text: string, lines: readonly string[]): Edit[] {\n const jobs = lines.findIndex((line) => indentOf(line) === 0 && line.startsWith(\"jobs:\"));\n if (jobs < 0) return [];\n const pad = \" \".repeat(childIndent(lines, jobs) ?? 2);\n const original = text.split(/\\r?\\n/)[jobs] ?? \"jobs:\";\n const group = [\"concurrency:\", pad + \"group: ${{ github.workflow }}-${{ github.ref }}\", pad + \"cancel-in-progress: ${{ github.event_name == 'pull_request' }}\", \"\", original];\n return [{ file, before: text, after: replaceLine(text, jobs + 1, group) }];\n}\n\n/**\n * This function gives the breaks of the concurrency groups. A workflow with no group at the top needs one in each job.\n * A job that calls a shared workflow of `grouped` gets its group from the jobs of that workflow. A shared workflow gets\n * its group from its caller, but a shared workflow of `grouped` has a group in each job.\n */\nfunction concurrencyBreaks(file: string, text: string, lines: readonly string[], grouped: readonly string[]): Break[] {\n const name = file.slice(file.lastIndexOf(\"/\") + 1);\n const jobs = jobsOf(lines);\n if (isShared(lines)) {\n if (!grouped.includes(name)) return [];\n return jobs.filter((job) => !job.grouped).map((job) => ({ file, line: job.line, message: `${file}: the job ${job.name} has no concurrency group, and its callers rely on it (the option grouped).` }));\n }\n if (hasTopGroup(lines)) return [];\n const missing = jobs.filter((job) => !job.grouped && !(job.calls !== undefined && grouped.includes(job.calls)));\n const edits = missing.length === 0 ? [] : groupEdits(file, text, lines);\n return missing.map((job) => ({ file, line: job.line, message: `${file}: the job ${job.name} has no concurrency group, and the workflow has none.`, edits }));\n}\n\n/** This function gives the breaks of the matrices: each `strategy` with a `matrix` has a `max-parallel` of `limit` or less. */\nfunction matrixBreaks(file: string, text: string, lines: readonly string[], limit: number): Break[] {\n const breaks: Break[] = [];\n const originals = text.split(/\\r?\\n/);\n lines.forEach((line, index) => {\n if (keyValue(line, \"strategy\") === undefined) return;\n const keyIndent = childIndent(lines, index);\n if (keyIndent === undefined) return;\n const keys: number[] = [];\n for (let i = index + 1; i < blockEnd(lines, index); i++) if ((lines[i] ?? \"\").trim() !== \"\" && indentOf(lines[i] ?? \"\") === keyIndent) keys.push(i);\n if (!keys.some((i) => keyValue(lines[i] ?? \"\", \"matrix\") !== undefined)) return;\n const at = keys.find((i) => keyValue(lines[i] ?? \"\", \"max-parallel\") !== undefined);\n const raw = at === undefined ? undefined : keyValue(lines[at] ?? \"\", \"max-parallel\");\n const value = raw === undefined ? Number.NaN : Number(raw);\n const wanted = `${\" \".repeat(keyIndent)}max-parallel: ${String(limit)}`;\n if (at === undefined || raw === undefined) {\n const after = replaceLine(text, index + 1, [originals[index] ?? line, wanted]);\n breaks.push({ file, line: index + 1, message: `${file}: a matrix has no max-parallel.`, edits: [{ file, before: text, after }] });\n } else if (!Number.isInteger(value) || value < 1 || value > limit) {\n const after = replaceLine(text, at + 1, [wanted]);\n breaks.push({ file, line: index + 1, message: `${file}: a matrix has max-parallel ${raw}, and the most is ${String(limit)}.`, edits: [{ file, before: text, after }] });\n }\n });\n return breaks;\n}\n\n/**\n * This function gives the minute field of a schedule that starts `perHour` times in each hour, at equal steps. One start is at\n * `minute`: `\"18\"` for 1, `\"18,48\"` for 2. The list is in the order of the numbers.\n */\nexport function minuteField(minute: number, perHour: number): string {\n const step = 60 / perHour;\n return Array.from({ length: perHour }, (_, k) => (minute + k * step) % 60)\n .sort((a, b) => a - b)\n .join(\",\");\n}\n\n/** This function gives the number of starts in each hour of a minute field (`\"*\\/30\"` or `\"5,35\"` give 2), or 1 when it cannot tell. */\nfunction startsPerHour(field: string): number {\n const step = /^\\*\\/(\\d+)$/.exec(field);\n const count = step ? 60 / Number(step[1]) : field.split(\",\").length;\n // Only a number of starts that divides the hour gives equal steps.\n return Number.isInteger(count) && count >= 1 && 60 % count === 0 ? count : 1;\n}\n\n/**\n * This function gives the breaks of the schedules: the minute of each `cron` is the minute of the repository and the file. A\n * schedule that starts more than once in each hour starts at equal steps from that minute (`18,48` for each 30 minutes).\n */\nfunction cronBreaks(file: string, text: string, lines: readonly string[], minute: number): Break[] {\n const breaks: Break[] = [];\n const originals = text.split(/\\r?\\n/);\n lines.forEach((line, index) => {\n const value = keyValue(line, \"cron\");\n if (value === undefined) return;\n const fields = value.split(\" \").filter((field) => field !== \"\");\n const wanted = minuteField(minute, startsPerHour(fields[0] ?? \"\"));\n if (fields[0] === wanted) return;\n const expected = [wanted, ...fields.slice(1)].join(\" \");\n const original = originals[index] ?? line;\n const edits: Edit[] = original.includes(value) ? [{ file, before: text, after: replaceLine(text, index + 1, [original.replace(value, () => expected)]) }] : [];\n breaks.push({ file, line: index + 1, message: `${file}: the schedule \"${value}\" starts at minute ${fields[0] ?? \"?\"}, and the minute of this repository and file is ${String(minute)}.`, fix: `cron: \"${expected}\"`, edits });\n });\n return breaks;\n}\n\nexport const runnerBudget: Rule = {\n id: \"runner-budget\",\n title: \"Each matrix has a max-parallel of 3 or less, each workflow has a concurrency group, and each schedule starts at the minute that the repository and the file give.\",\n reason:\n \"All repositories of the account share 40 runners, and heavy work keeps at most 28 of them. On 2026-10-30, a matrix with no max-parallel and the sync pull requests of about 20 repositories filled 39 of the 40 runners, with 88 jobs in the queue. Each repository copied the weekly scan at `23 5 * * 1`, so all scans started at the same minute. A workflow with no concurrency group starts a new run on each push, and the old runs keep their runners.\",\n fix: 'Add `max-parallel: 3` (or less) under `strategy`. Add a concurrency group at the top of the workflow (`concurrency: { group: <name>-${{ github.ref }}, cancel-in-progress: true }`), or in each job. Change the minute of each `cron` to the minute that the message gives; the hour and the days stay.',\n sources: [{ repo: \"fleet\", rule: \"runner-slots\", doc: \"docs/STRATEGY.md (2026-10-30, the runner slots: a cap of 40, heavy work at most 28)\" }],\n options: {\n maxParallel: { type: \"number\", default: 3, description: \"The largest max-parallel of a matrix.\" },\n minute: { type: \"boolean\", default: true, description: \"When false, the rule does not examine the minute of the schedules.\" },\n grouped: {\n type: \"strings\",\n default: [\"reusable-ai-review.yml\", \"reusable-codex-review.yml\"],\n description: \"The shared workflows that give a concurrency group in each of their jobs. A job that calls one needs no group of its own.\",\n },\n },\n check(context, options) {\n const files = context.gitFiles();\n if (files === undefined) return { skipped: \"the root is not in a git repository\" };\n const workflows = files.filter((path) => WORKFLOW.test(path)).sort(byCode);\n if (workflows.length === 0) return { skipped: \"the repository has no workflow\" };\n const remote = context.git([\"remote\", \"get-url\", \"origin\"]);\n const repository = context.env[\"GITHUB_REPOSITORY\"] ?? (remote === undefined ? undefined : repositoryOfRemote(remote));\n const limit = Number(options[\"maxParallel\"]);\n const grouped = Array.isArray(options[\"grouped\"]) ? (options[\"grouped\"] as readonly string[]) : [];\n const breaks: Break[] = [];\n for (const file of workflows) {\n let text: string;\n try {\n text = readFileSync(join(context.root, file), \"utf8\");\n } catch {\n continue;\n }\n const lines = text.split(/\\r?\\n/).map((line) => (line.trimStart().startsWith(\"#\") ? \"\" : line));\n breaks.push(...matrixBreaks(file, text, lines, limit), ...concurrencyBreaks(file, text, lines, grouped));\n if (options[\"minute\"] !== false) {\n const schedules = lines.some((line) => keyValue(line, \"cron\") !== undefined);\n if (schedules && repository === undefined) breaks.push({ file, message: `${file} has a schedule, and the rule cannot find the repository (GITHUB_REPOSITORY, or a GitHub URL of the remote origin).` });\n else if (repository !== undefined) breaks.push(...cronBreaks(file, text, lines, scheduleMinute(repository, file)));\n }\n }\n return breaks;\n },\n};\n","/**\n * The rule `source-main`: a workspace package is a source package, and a public package moves its\n * entries to the build when it is published.\n */\nimport { cleanPath, codePackages, lineOf, type Break, type Manifest, type Rule } from \"../rule.ts\";\n\n/** The fields of `package.json` that name the entries of a package. */\nconst ENTRY_FIELDS = [\"main\", \"module\", \"types\", \"typings\", \"exports\", \"bin\"] as const;\n\n/** This function gives each path in the value of an entry field (a string, or the strings in an object). */\nexport function pathsOf(value: unknown): string[] {\n if (typeof value === \"string\") return [value];\n if (Array.isArray(value)) return value.flatMap(pathsOf);\n if (typeof value === \"object\" && value !== null) return Object.values(value).flatMap(pathsOf);\n return [];\n}\n\n/** This function tells if a path is a source file: a file in `src/`, or a TypeScript file that is not a declaration file. */\nexport function isSourcePath(path: string): boolean {\n const clean = cleanPath(path);\n return clean.startsWith(\"src/\") || (/\\.(c|m)?tsx?$/.test(clean) && !/\\.d\\.(c|m)?ts$/.test(clean));\n}\n\nexport const sourceMain: Rule = {\n id: \"source-main\",\n title: \"Each workspace package is a source package (`main` is `src/index.ts`), and a public package moves its entries to the build in `publishConfig`.\",\n reason:\n \"Other packages of the workspace import the source, so a change is visible at once with no build. A public package that publishes its source entries gives TypeScript files to npm users.\",\n fix: 'Set `\"main\": \"./src/index.ts\"`. In a public package, add `publishConfig` with main, types, exports and bin that point at the build, as `pnpm package add` does.',\n sources: [\n { repo: \"coeval\", rule: \"package-main-source\", doc: \"CLAUDE.md:17\" },\n { repo: \"coeval\", rule: \"source-package-main\", doc: \"CLAUDE.md:17\" },\n { repo: \"crawler\", rule: \"pkg-source-main\", doc: \"CLAUDE.md:17\" },\n { repo: \"crawler\", rule: \"source-package-main\", doc: \"CLAUDE.md:17\" },\n { repo: \"crawler\", rule: \"publish-config-build\", doc: \"CLAUDE.md:41\" },\n { repo: \"Graph\", rule: \"new-package-main-index\", doc: \"CLAUDE.md:15\" },\n { repo: \"Graph\", rule: \"source-package-main\", doc: \"CLAUDE.md:15\" },\n { repo: \"headroom\", rule: \"source-package-main\", doc: \"CLAUDE.md:31\" },\n ],\n options: {\n main: { type: \"string\", default: \"src/index.ts\", description: \"The path of `main` in each package.\" },\n publishConfig: { type: \"boolean\", default: true, description: \"When false, the rule does not examine `publishConfig`.\" },\n },\n check(context, options) {\n const main = cleanPath(typeof options[\"main\"] === \"string\" ? options[\"main\"] : \"src/index.ts\");\n const breaks: Break[] = [];\n for (const info of codePackages(context)) {\n // The root of a repository of one package has no workspace that imports its source, so only its publishConfig counts\n const single = info.folder === \"\";\n const manifest = info.manifest;\n const at = (field: string): { line?: number } => {\n const line = lineOf(info.text, `\"${field}\"`);\n return line === undefined ? {} : { line };\n };\n const value = manifest[\"main\"];\n if (single) {\n // The root of a repository of one package can point main at its build\n } else if (typeof value === \"string\") {\n if (cleanPath(value) !== main) breaks.push({ file: info.file, ...at(\"main\"), message: `\"main\" is \"${value}\", not \"./${main}\".` });\n } else if (ENTRY_FIELDS.some((field) => manifest[field] !== undefined) || manifest[\"private\"] !== true) {\n // A package with only a bin (a CLI) has no entry to import, and a private package with no entry is an app (a site)\n if (manifest[\"bin\"] === undefined) breaks.push({ file: info.file, ...at(\"name\"), message: `The package has no \"main\". A source package has \"main\": \"./${main}\".` });\n }\n if (options[\"publishConfig\"] === false || manifest[\"private\"] === true) continue;\n const published = (typeof manifest[\"publishConfig\"] === \"object\" && manifest[\"publishConfig\"] !== null ? manifest[\"publishConfig\"] : {}) as Manifest;\n for (const field of ENTRY_FIELDS) {\n const source = pathsOf(manifest[field]).filter(isSourcePath);\n if (source.length === 0) continue;\n if (published[field] === undefined) {\n breaks.push({\n file: info.file,\n ...at(field),\n message: `\"${field}\" points at the source (${source[0] ?? \"\"}), and publishConfig has no \"${field}\": npm users get the source.`,\n fix: `Add publishConfig.${field} that points at the build.`,\n });\n continue;\n }\n const still = pathsOf(published[field]).filter(isSourcePath);\n if (still.length > 0) {\n breaks.push({ file: info.file, ...at(\"publishConfig\"), message: `publishConfig.${field} points at the source (${still[0] ?? \"\"}).`, fix: `Point publishConfig.${field} at the build.` });\n }\n }\n }\n return breaks;\n },\n};\n","/**\n * The rule `tsconfig-test`: each TypeScript package has a `tsconfig.test.json`, and its typecheck\n * examines it.\n */\nimport { codePackages, hasFile, inFolder, lineOf, type Break, type Rule } from \"../rule.ts\";\n\n/** The ends of the name of a test file: `.test.` or `.spec.`, then an extension of JavaScript or TypeScript. */\nconst TEST_ENDS = [\"test\", \"spec\"].flatMap((kind) => [\"\", \"c\", \"m\"].flatMap((module) => [\"j\", \"t\"].flatMap((lang) => [\"\", \"x\"].map((jsx) => `.${kind}.${module}${lang}s${jsx}`))));\n\n/**\n * This function tells if a path is a test file: `*.test.*` or `*.spec.*` of JavaScript or TypeScript, or a file in a\n * folder `__tests__`. It uses string operations, with no regular expression, so a long path takes linear time.\n */\nexport function isTestFile(path: string): boolean {\n const segments = path.split(\"/\");\n const name = segments[segments.length - 1] ?? \"\";\n if (name !== \"\" && segments.slice(0, -1).includes(\"__tests__\")) return true;\n return TEST_ENDS.some((end) => name.length > end.length && name.endsWith(end));\n}\n\n/** This function tells if git tracks a test file in the package folder `folder` (`\"\"` is the root). */\nexport function hasTests(files: readonly string[], folder: string): boolean {\n const prefix = folder === \"\" ? \"\" : `${folder}/`;\n return files.some((path) => path.startsWith(prefix) && isTestFile(path.slice(prefix.length)));\n}\n\nexport const tsconfigTest: Rule = {\n id: \"tsconfig-test\",\n title: \"Each package with a `tsconfig.json` and test files has a `tsconfig.test.json`, and its `typecheck` script examines it.\",\n reason: \"The build config leaves out the tests. Without a second config, `pnpm typecheck` does not examine the tests, and a type error in a test hides until the test runs.\",\n fix: \"Add `tsconfig.test.json` (extends `./tsconfig.json`, includes the tests, `noEmit`), and set the script `typecheck` to `tsc -p tsconfig.json --noEmit && tsc -p tsconfig.test.json`. Keep `--noEmit` on the first call when the build config emits, so that a typecheck writes no build output.\",\n sources: [\n { repo: \"coeval\", rule: \"package-tsconfig-test\", doc: \"CLAUDE.md:18\" },\n { repo: \"coeval\", rule: \"tsconfig-test\", doc: \"CLAUDE.md:18\" },\n { repo: \"crawler\", rule: \"pkg-tsconfig-test\", doc: \"CLAUDE.md:18\" },\n { repo: \"crawler\", rule: \"tsconfig-test\", doc: \"CLAUDE.md:18\" },\n { repo: \"headroom\", rule: \"tsconfig-test\", doc: \"CLAUDE.md:32\" },\n { repo: \"headroom\", rule: \"tsconfig-test-per-package\", doc: \"CLAUDE.md:32\" },\n { repo: \"Vex\", rule: \"package-tsconfig-test\", doc: \"CLAUDE.md:23\" },\n { repo: \"Vex\", rule: \"tsconfig-test\", doc: \"CLAUDE.md:23\" },\n ],\n options: {\n file: { type: \"string\", default: \"tsconfig.test.json\", description: \"The name of the config of the tests.\" },\n },\n check(context, options) {\n const file = typeof options[\"file\"] === \"string\" ? options[\"file\"] : \"tsconfig.test.json\";\n const tracked = context.gitFiles();\n const breaks: Break[] = [];\n for (const info of codePackages(context)) {\n if (!hasFile(info.dir, \"tsconfig.json\")) continue;\n // A package with no test file has no test to examine. Outside git the rule cannot tell, so it examines the package\n if (tracked !== undefined && !hasTests(tracked, info.folder)) continue;\n if (!hasFile(info.dir, file)) {\n breaks.push({ file: inFolder(info.folder, file), message: `The package has a tsconfig.json and no ${file}.` });\n continue;\n }\n const scripts = info.manifest[\"scripts\"];\n const typecheck = typeof scripts === \"object\" && scripts !== null ? (scripts as Record<string, unknown>)[\"typecheck\"] : undefined;\n if (typeof typecheck === \"string\" && !typecheck.includes(file)) {\n const line = lineOf(info.text, '\"typecheck\"');\n breaks.push({\n file: info.file,\n ...(line === undefined ? {} : { line }),\n message: `The script typecheck (\"${typecheck}\") does not examine ${file}.`,\n fix: `Add \\`tsc -p ${file}\\` to the script typecheck.`,\n });\n }\n }\n return breaks;\n },\n};\n","/**\n * The rule `tests-required`: no test runner passes when it finds no test (`passWithNoTests`).\n */\nimport { readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { byCode } from \"../workspace.ts\";\nimport { replaceLine, type Break, type Edit, type Rule, type RuleContext } from \"../rule.ts\";\nimport { hasTests } from \"./tsconfig-test.ts\";\n\n/** The files that set the options of a test runner: its configs, and package.json for the scripts. */\nconst RUNNER_FILE = /(?:^|\\/)(?:(?:vitest|vite|jest|playwright)(?:\\.[\\w-]+)*\\.config\\.[cm]?[jt]s|vitest\\.workspace\\.[cm]?[jt]s|package\\.json)$/;\n/** The option in a config (`passWithNoTests: true`) or on a command line (`--passWithNoTests`, `--pass-with-no-tests`). */\nconst PASS_WITH_NO_TESTS = /passWithNoTests\\s*:\\s*true|--passWithNoTests(?!=false)|--pass-with-no-tests(?!=false)/;\n\n/** A line that holds only the option in a config. `conventions fix` removes such a line. */\nconst OPTION_LINE = /^\\s*passWithNoTests\\s*:\\s*true\\s*,?\\s*$/;\n/** The option in a line of a config with more keys. The first form has the comma after it, and the second form has the comma before it. */\nconst OPTION_IN_LINE = [/\\bpassWithNoTests\\s*:\\s*true\\s*,\\s*/, /,?\\s*\\bpassWithNoTests\\s*:\\s*true\\b/] as const;\n/** The option on a command line, with the space before it. */\nconst FLAG = / --(?:passWithNoTests|pass-with-no-tests)(?:=true)?(?=\\s|\"|$)/g;\n\n/** This function gives the folder of the package that holds `file`: the longest folder of a package that starts its path. */\nfunction packageOf(context: RuleContext, file: string): string {\n let best = \"\";\n for (const info of context.packages) if (info.folder !== \"\" && file.startsWith(`${info.folder}/`) && info.folder.length > best.length) best = info.folder;\n return best;\n}\n\n/**\n * This function gives the edit that removes the option from one line, or no edit. The edit exists only when the package has\n * test files: then the test step still finds tests. A package with no tests needs a person, who removes its test script.\n */\nfunction removeOption(context: RuleContext, files: readonly string[], file: string, text: string, index: number): Edit[] {\n if (!hasTests(files, packageOf(context, file))) return [];\n const line = text.split(/\\r?\\n/)[index] ?? \"\";\n if (OPTION_LINE.test(line)) return [{ file, before: text, after: replaceLine(text, index + 1, []) }];\n const form = OPTION_IN_LINE.find((pattern) => pattern.test(line));\n const without = file.endsWith(\"package.json\") ? line.replace(FLAG, \"\") : form === undefined ? line : line.replace(form, \"\");\n return without === line ? [] : [{ file, before: text, after: replaceLine(text, index + 1, [without]) }];\n}\n\nexport const testsRequired: Rule = {\n id: \"tests-required\",\n title: \"No test runner passes when it finds no test: no `passWithNoTests: true` in a config, and no `--passWithNoTests` in a script.\",\n reason:\n \"With the option, a test step that finds 0 tests passes. A broken include pattern, a moved folder or a renamed file then turns the gate green with no test run. In the fleet audit of 2026-10-30, vex had the option in all 9 vitest configs and client in 2 packages that have tests.\",\n fix: \"Remove the option. A package with no tests has no test script, so the shared CI skips it. A package whose tests a later change adds keeps no test script until then.\",\n sources: [{ repo: \"fleet\", rule: \"fail-closed\", doc: \"docs/STRATEGY.md (2026-10-30, gates and probes fail closed)\" }],\n options: {},\n check(context) {\n const files = context.gitFiles();\n if (files === undefined) return { skipped: \"the root is not in a git repository\" };\n const breaks: Break[] = [];\n for (const file of files.filter((path) => RUNNER_FILE.test(path)).sort(byCode)) {\n let text: string;\n try {\n text = readFileSync(join(context.root, file), \"utf8\");\n } catch {\n continue;\n }\n const lines = text.split(/\\r?\\n/);\n const index = lines.findIndex((line) => PASS_WITH_NO_TESTS.test(line));\n if (index >= 0) breaks.push({ file, line: index + 1, message: `${file} lets the tests pass when they find no test (passWithNoTests).`, edits: removeOption(context, files, file, text, index) });\n }\n return breaks;\n },\n};\n","/**\n * The rule `typed-files`: each TypeScript file that git keeps is in a tsconfig that a `typecheck`\n * script examines.\n */\nimport { spawnSync } from \"node:child_process\";\nimport { existsSync, readFileSync, statSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { basename, dirname, join, relative, resolve } from \"node:path\";\nimport { byCode } from \"../workspace.ts\";\nimport { codePackages, inFolder, lineOf, readJsonc, type Break, type Edit, type PackageInfo, type Rule } from \"../rule.ts\";\n\n/** A TypeScript source: `.ts`, `.tsx`, `.mts` or `.cts`, and not a declaration file. */\nconst TYPESCRIPT = /\\.(?:[cm]?ts|tsx)$/;\nconst DECLARATION = /\\.d\\.(?:[cm]?ts|tsx)$/;\n\n/** The compilers that read `-p <config>` (or `tsconfig.json` without it). */\nconst COMPILERS = new Set([\"tsc\", \"tsgo\", \"vue-tsc\"]);\n\n/** This function gives the commands of a script: its parts between `&&`, `||`, `;`, `|` and parentheses, each as words. */\nfunction commandsOf(script: string): string[][] {\n return script\n .split(/&&|\\|\\||[;|()]/)\n .map((part) => part.trim().split(/\\s+/).filter((word) => word !== \"\"))\n .filter((words) => words.length > 0);\n}\n\n/** The last part of a path of a command (`node_modules/.bin/tsc` gives `tsc`). */\nconst commandName = (word: string): string => word.slice(word.lastIndexOf(\"/\") + 1);\n\n/** This function gives the configs that one `tsc` command examines, from the words after the command. */\nfunction compilerConfigs(words: readonly string[]): string[] {\n const configs: string[] = [];\n let named = false;\n for (let index = 0; index < words.length; index++) {\n const word = words[index] as string;\n if (word === \"-p\" || word === \"--project\") {\n const next = words[index + 1];\n if (next !== undefined) configs.push(next);\n named = true;\n index++;\n } else if (word.startsWith(\"-p=\") || word.startsWith(\"--project=\")) {\n configs.push(word.slice(word.indexOf(\"=\") + 1));\n named = true;\n } else if (word === \"-b\" || word === \"--build\") {\n named = true;\n let more = 0;\n while (words[index + 1] !== undefined && !(words[index + 1] as string).startsWith(\"-\")) {\n configs.push(words[index + 1] as string);\n index++;\n more++;\n }\n if (more === 0) configs.push(\"tsconfig.json\");\n }\n }\n if (!named) configs.push(\"tsconfig.json\");\n return configs;\n}\n\n/** This function gives the configs that one `typecheck` script examines, relative to the folder of the package. */\nexport function configsOfScript(script: string): string[] {\n const configs: string[] = [];\n for (const words of commandsOf(script)) {\n const at = words.findIndex((word) => COMPILERS.has(commandName(word)) || commandName(word) === \"svelte-check\");\n if (at < 0) continue;\n const rest = words.slice(at + 1);\n if (commandName(words[at] as string) !== \"svelte-check\") {\n configs.push(...compilerConfigs(rest));\n continue;\n }\n for (let index = 0; index < rest.length; index++) {\n const word = rest[index] as string;\n if (word === \"--tsconfig\" && rest[index + 1] !== undefined) configs.push(rest[index + 1] as string);\n else if (word.startsWith(\"--tsconfig=\")) configs.push(word.slice(\"--tsconfig=\".length));\n }\n }\n return configs.map((config) => config.replace(/^[\"']|[\"']$/g, \"\"));\n}\n\n/** The package managers whose `run <script>` (or `<script>`) starts another script of the same package. */\nconst MANAGERS = new Set([\"pnpm\", \"npm\", \"yarn\", \"bun\"]);\n/** The options that start the script in other packages: the rule reads those packages on their own. */\nconst OTHER_PACKAGES = /^(?:-r|--recursive|-F|--filter(?:=.*)?|--workspaces?|-w|-ws)$/;\n\n/**\n * This function gives the text of the script `name` and of each script of the same package that it\n * starts (`pnpm run typecheck:scripts`), once each.\n */\nexport function scriptsOf(scripts: Readonly<Record<string, unknown>>, name: string, seen: Set<string> = new Set()): string[] {\n const text = scripts[name];\n if (typeof text !== \"string\" || seen.has(name)) return [];\n seen.add(name);\n const texts = [text];\n for (const part of text.split(/&&|\\|\\||[;|]/)) {\n const words = part.trim().split(/\\s+/);\n if (!MANAGERS.has(words[0] ?? \"\") || words.some((word) => OTHER_PACKAGES.test(word))) continue;\n const rest = words.slice(1).filter((word) => !word.startsWith(\"-\"));\n const next = rest[0] === \"run\" || rest[0] === \"run-script\" ? rest[1] : rest[0];\n if (next !== undefined) texts.push(...scriptsOf(scripts, next, seen));\n }\n return texts;\n}\n\n/** This function gives the path of `bin/tsc` of `typescript` of the repository, or of this package, or `undefined`. */\nfunction findTsc(root: string): string | undefined {\n for (const from of [join(root, \"package.json\"), import.meta.url]) {\n try {\n const tsc = join(dirname(createRequire(from).resolve(\"typescript/package.json\")), \"bin\", \"tsc\");\n if (existsSync(tsc)) return tsc;\n } catch {\n // Try the next place\n }\n }\n return undefined;\n}\n\n/** This function gives the files of the program of one config (`tsc --listFilesOnly`), or the error of tsc. */\nfunction listFiles(tsc: string, config: string): { readonly files: readonly string[] } | { readonly error: string } {\n const result = spawnSync(process.execPath, [tsc, \"-p\", config, \"--listFilesOnly\"], { encoding: \"utf8\", maxBuffer: 64 * 1024 * 1024 });\n const lines = (result.stdout ?? \"\").split(/\\r?\\n/).filter((line) => line.trim() !== \"\");\n if (result.status !== 0) return { error: (result.stderr || result.stdout || `exit ${String(result.status)}`).trim().split(/\\r?\\n/)[0] ?? \"\" };\n return { files: lines.map((line) => line.trim()) };\n}\n\n/** This function gives the paths of the `references` of a config, as absolute paths. */\nfunction referencesOf(config: string): string[] {\n const json = readJsonc(config);\n const references = typeof json === \"object\" && json !== null ? (json as { references?: unknown }).references : undefined;\n if (!Array.isArray(references)) return [];\n return references.flatMap((item: unknown) => (typeof item === \"object\" && item !== null && typeof (item as { path?: unknown }).path === \"string\" ? [resolve(dirname(config), (item as { path: string }).path)] : []));\n}\n\n/** A config file of a tool (`vitest.config.ts`), with its extension. */\nconst CONFIG_FILE = /\\.config(\\.[cm]?ts)$/;\n\n/** A `rootDir` that is the folder of the tsconfig, so that the config files at the root are in it. */\nconst ROOT_DIRS = new Set([\".\", \"./\", \"${configDir}\", \"${configDir}/\"]);\n\n/**\n * This function gives the edit that adds the config files at the root of a package to its `tsconfig.test.json`. It adds\n * the include `*.config.ts`. When the `rootDir` is a subfolder, it sets `rootDir: \".\"`. The edit changes only these\n * values and keeps the format of the file. It gives no edit for a tsconfig with comments, so that no comment goes. It\n * also gives no edit when the changed text does not parse as the intended config.\n */\nfunction configEdit(root: string, tsconfig: string, extension: string): Edit[] {\n const text = readFileSync(tsconfig, \"utf8\");\n let json: { include?: unknown; compilerOptions?: Record<string, unknown> };\n try {\n json = JSON.parse(text) as typeof json;\n } catch {\n return [];\n }\n const globs = json.include;\n if (!Array.isArray(globs)) return [];\n const prefix = globs.length > 0 && globs.every((glob) => typeof glob === \"string\" && glob.startsWith(\"${configDir}/\")) ? \"${configDir}/\" : \"\";\n const glob = `${prefix}*.config${extension}`;\n const eol = text.includes(\"\\r\\n\") ? \"\\r\\n\" : \"\\n\";\n let after = text;\n if (!globs.includes(glob)) {\n after = after.replace(/(\"include\"\\s*:\\s*\\[)([^\\]]*)\\]/, (_all, start: string, items: string) => {\n const kept = items.replace(/\\s+$/, \"\");\n const end = items.slice(kept.length);\n if (kept.trim() === \"\") return `${start}${JSON.stringify(glob)}]`;\n const indent = kept.includes(\"\\n\") ? (/\\n([ \\t]*)[^\\n]*$/.exec(kept)?.[1] ?? \"\") : undefined;\n return `${start}${kept},${indent === undefined ? \" \" : `${eol}${indent}`}${JSON.stringify(glob)}${end}]`;\n });\n }\n const rootDir = json.compilerOptions?.[\"rootDir\"];\n const moveRoot = typeof rootDir === \"string\" && !ROOT_DIRS.has(rootDir);\n if (moveRoot) after = after.replace(/(\"rootDir\"\\s*:\\s*)\"(?:[^\"\\\\]|\\\\.)*\"/, '$1\".\"');\n const intended = { ...json, ...(moveRoot ? { compilerOptions: { ...json.compilerOptions, rootDir: \".\" } } : {}), include: globs.includes(glob) ? globs : [...globs, glob] };\n let parsed: unknown;\n try {\n parsed = JSON.parse(after);\n } catch {\n return [];\n }\n if (JSON.stringify(parsed) !== JSON.stringify(intended)) return [];\n return after === text ? [] : [{ file: fromRoot(root, tsconfig), before: text, after }];\n}\n\n/** The path of `file` relative to `root`, with `/`. */\nconst fromRoot = (root: string, file: string): string => relative(root, file).split(\"\\\\\").join(\"/\");\n\nexport const typedFiles: Rule = {\n id: \"typed-files\",\n title: \"Each TypeScript file that git keeps is in a tsconfig that a `typecheck` script examines: the tests, the e2e specs, the scripts, the benches and the configs too.\",\n reason:\n \"A file that no tsconfig of a typecheck holds has no type check. Its type errors hide until it runs, and a broken test or script can pass a gate. A test runner such as vitest strips the types, so it does not examine them. In the fleet audit of 2026-10-30, every repository had such files (in one, 90 of 612 files, its e2e specs among them), and the new checks found real defects.\",\n fix: \"Add the file to the `include` of a tsconfig that the `typecheck` script names (for example `tsconfig.test.json`, with `*.config.ts`, `scripts/**`, `bench/**` and `e2e/**`). A config file at the root of a package needs `rootDir: \\\".\\\"` there. For the files at the root of the repository, add a `tsconfig.repo.json` and name it in the root `typecheck`. A file that cannot be in a typecheck (it imports a module that only a tool makes) goes in `ignore` with its reason.\",\n sources: [{ repo: \"fleet\", rule: \"fail-closed\", doc: \"docs/STRATEGY.md (2026-10-30, gates and probes fail closed)\" }],\n options: {\n configs: { type: \"strings\", default: [], description: \"More tsconfig files, relative to the root, that CI examines with another command (for example a script that the typecheck starts).\" },\n },\n check(context, options) {\n const tracked = context.gitFiles();\n if (tracked === undefined) return { skipped: \"the root is not in a git repository\" };\n const files = tracked.filter((file) => TYPESCRIPT.test(file) && !DECLARATION.test(file)).sort(byCode);\n if (files.length === 0) return [];\n const tsc = findTsc(context.root);\n if (tsc === undefined) return [{ file: \"package.json\", message: \"The rule cannot find typescript, so it cannot read the tsconfig files.\", fix: \"Add typescript to the devDependencies of the root package.\" }];\n const breaks: Break[] = [];\n // The configs that a typecheck examines, as absolute paths\n const queue: string[] = [];\n // The tsconfig.test.json of each package folder that its typecheck names, for the edits\n const testConfigs = new Map<string, string>();\n const packages: PackageInfo[] = [context.rootPackage, ...codePackages(context).filter((info) => info !== context.rootPackage)];\n for (const info of packages) {\n const scripts = info.manifest[\"scripts\"];\n const table = typeof scripts === \"object\" && scripts !== null ? (scripts as Record<string, unknown>) : {};\n const typecheck = table[\"typecheck\"];\n if (typeof typecheck !== \"string\") continue;\n for (const config of scriptsOf(table, \"typecheck\").flatMap(configsOfScript)) {\n const path = resolve(info.dir, config);\n if (!existsSync(path)) {\n const line = lineOf(info.text, '\"typecheck\"');\n breaks.push({ file: info.file, ...(line === undefined ? {} : { line }), message: `The script typecheck names ${inFolder(info.folder, config)}, and that file does not exist.` });\n continue;\n }\n queue.push(path);\n if (basename(path) === \"tsconfig.test.json\" && resolve(dirname(path)) === resolve(info.dir)) testConfigs.set(info.folder, path);\n }\n }\n const extra = Array.isArray(options[\"configs\"]) ? options[\"configs\"] : [];\n for (const config of extra) {\n const path = resolve(context.root, config);\n if (!existsSync(path)) breaks.push({ file: \"package.json\", message: `The option configs names ${config}, and that file does not exist.` });\n else queue.push(path);\n }\n // Read each config and its references, once\n const covered = new Set<string>();\n const seen = new Set<string>();\n while (queue.length > 0) {\n let path = queue.shift() as string;\n if (existsSync(path) && statSync(path).isDirectory()) path = join(path, \"tsconfig.json\");\n if (seen.has(path)) continue;\n seen.add(path);\n queue.push(...referencesOf(path));\n const listed = listFiles(tsc, path);\n if (\"error\" in listed) {\n breaks.push({ file: fromRoot(context.root, path), message: `tsc cannot list the files of ${fromRoot(context.root, path)}: ${listed.error}` });\n continue;\n }\n for (const name of listed.files) covered.add(fromRoot(context.root, resolve(name)));\n }\n if (seen.size === 0) {\n breaks.push({ file: \"package.json\", message: \"No typecheck script names a tsconfig, so no TypeScript file has a type check.\", fix: \"Add a script typecheck (`tsc -p tsconfig.json`) to each package.\" });\n }\n for (const file of files) {\n if (covered.has(file)) continue;\n const folder = file.includes(\"/\") ? file.slice(0, file.lastIndexOf(\"/\")) : \"\";\n const extension = CONFIG_FILE.exec(file)?.[1];\n const tsconfig = testConfigs.get(folder);\n const edits = extension === undefined || tsconfig === undefined ? [] : configEdit(context.root, tsconfig, extension);\n breaks.push({ file, message: `${file} is in no tsconfig that a typecheck script examines.`, edits });\n }\n return breaks;\n },\n};\n","/**\n * The rule `typed-scripts`: git keeps no JavaScript source and no shell script with logic. Each\n * script is TypeScript, which Node starts directly (type stripping), with types and tests like the code.\n */\nimport { readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { byCode } from \"../workspace.ts\";\nimport type { Break, Rule } from \"../rule.ts\";\n\n/** The interpreters of a `#!` line that make a file without an extension a script of a kind. */\nconst SHEBANG = /^#!\\s*(?:\\S*\\/)?(?:env\\s+(?:-\\S+\\s+)*)?(node|bash|sh|zsh|dash|ksh|pwsh)\\b/;\n\n/** This function gives the extension of a file with its dot, in lower case, or `\"\"`. */\nfunction extensionOf(file: string): string {\n const name = file.slice(file.lastIndexOf(\"/\") + 1);\n const dot = name.lastIndexOf(\".\");\n return dot <= 0 ? \"\" : name.slice(dot).toLowerCase();\n}\n\n/** This function gives the lines of a shell script that do work: not empty, not a comment, not the `#!` line. */\nexport function codeLines(text: string): number {\n return text.split(/\\r?\\n/).filter((line) => {\n const trimmed = line.trim();\n return trimmed !== \"\" && !trimmed.startsWith(\"#\");\n }).length;\n}\n\n/** This function reads the first line of a file, or `\"\"` when the file cannot be read. */\nfunction firstLine(path: string): string {\n try {\n const text = readFileSync(path, \"utf8\");\n const end = text.indexOf(\"\\n\");\n return end < 0 ? text : text.slice(0, end);\n } catch {\n return \"\";\n }\n}\n\nexport const typedScripts: Rule = {\n id: \"typed-scripts\",\n title: \"Git keeps no JavaScript source (`.js`, `.mjs`, `.cjs`, `.jsx`) and no shell script of more than one line of code: each script is TypeScript.\",\n reason:\n \"A script has bugs like the code, and types and tests find them. Node 22.18 and later runs a `.ts` file directly, so a script in JavaScript or in a shell language has no cost to save and no check. A shell file stays only as a launcher of one line.\",\n fix: \"Rename the file to `.ts`, add the types, and check it with `tsc --noEmit` and a test. Move the logic of a shell script into a `.ts` file, and keep the shell file as one line that starts it, or remove it. A file that must stay (generated output, vendored code, a configuration that a tool reads only as JavaScript) goes in `ignore` with its reason.\",\n sources: [{ repo: \"fleet\", rule: \"typed-everything\", doc: \"docs/STRATEGY.md:78\" }],\n options: {\n javascript: { type: \"strings\", default: [\".js\", \".mjs\", \".cjs\", \".jsx\"], description: \"The extensions of JavaScript source.\" },\n shell: { type: \"strings\", default: [\".sh\", \".bash\", \".zsh\", \".ps1\"], description: \"The extensions of shell scripts.\" },\n shellLines: { type: \"number\", default: 1, description: \"The most lines of code that a shell script can have: a launcher.\" },\n },\n check(context, options) {\n const files = context.gitFiles();\n if (files === undefined) return { skipped: \"the root is not in a git repository\" };\n const javascript = new Set(Array.isArray(options[\"javascript\"]) ? options[\"javascript\"] : []);\n const shell = new Set(Array.isArray(options[\"shell\"]) ? options[\"shell\"] : []);\n const limit = typeof options[\"shellLines\"] === \"number\" ? options[\"shellLines\"] : 1;\n const breaks: Break[] = [];\n for (const file of [...files].sort(byCode)) {\n let extension = extensionOf(file);\n if (extension === \"\") {\n const interpreter = SHEBANG.exec(firstLine(join(context.root, file)))?.[1];\n if (interpreter === undefined) continue;\n extension = interpreter === \"node\" ? \".js\" : \".sh\";\n if (!javascript.has(extension) && !shell.has(extension)) continue;\n }\n if (javascript.has(extension)) {\n breaks.push({ file, message: `${file} is JavaScript.`, fix: `Rename ${file} to .ts, add the types, and check it with tsc and a test.` });\n } else if (shell.has(extension)) {\n let lines = 0;\n try {\n lines = codeLines(readFileSync(join(context.root, file), \"utf8\"));\n } catch {\n continue;\n }\n if (lines > limit) {\n breaks.push({\n file,\n message: `${file} is a shell script with ${lines} lines of code (the most is ${limit}).`,\n fix: `Move the logic of ${file} into a .ts file, and keep ${file} as a launcher of ${limit} line(s), or remove it.`,\n });\n }\n }\n }\n return breaks;\n },\n};\n","/**\n * The rule `trust-policy`: a pnpm repository sets `trustPolicy: no-downgrade` in `pnpm-workspace.yaml`. It checks each\n * version for 7 days after its publish (`trustPolicyIgnoreAfter`). It excludes the scopes of the release train.\n */\nimport { readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { hasFile, type Break, type Edit, type Rule } from \"../rule.ts\";\n\nconst WORKSPACE = \"pnpm-workspace.yaml\";\n\n/** The scopes that the release train updates. The train checks the provenance of their versions itself. */\nexport const TRAIN_SCOPES = [\"@mark1russell7/*\", \"@procedures/*\"] as const;\n\n/** 7 days, in minutes. */\nexport const IGNORE_AFTER = 10_080;\n\nconst POLICY_COMMENT = [\n \"# An install fails when a new version has less trust evidence than an earlier version of the same package: for\",\n \"# example, a version with no provenance after versions from a trusted publisher. Such a version can be a stolen token.\",\n];\nconst IGNORE_COMMENT = [\n \"# The check examines the versions of the last 7 days. A stolen-token version is new, and the registry removes it in\",\n \"# hours. Older versions can have less evidence for other reasons: for example undici-types 6.21.0 under @types/node.\",\n];\nconst EXCLUDE_COMMENT = [\n \"# The release train updates our own scopes, and it checks the provenance of each version. pnpm cannot use them: it\",\n \"# ranks the first versions, which were staged by hand, above the versions from release.yml (pnpm/pnpm#16689).\",\n];\n\n/** A top-level key of the file: its line index, and its value without a comment or quotes. */\nfunction valueOf(lines: readonly string[], key: string): { index: number; value: string } | undefined {\n const index = lines.findIndex((line) => line.startsWith(`${key}:`));\n if (index < 0) return undefined;\n const value = (lines[index] ?? \"\").slice(key.length + 1).replace(/\\s+#.*$/, \"\").trim();\n return { index, value: value.replace(/^[\"']|[\"']$/g, \"\") };\n}\n\n/** This function gives the items of the block list under the line `start`, the index of its last item, and its indent. */\nfunction blockList(lines: readonly string[], start: number): { items: string[]; last: number; indent: string } {\n const items: string[] = [];\n let last = start;\n let indent = \" \";\n for (let index = start + 1; index < lines.length; index++) {\n const line = lines[index] ?? \"\";\n const text = line.trim();\n if (text === \"\" || text.startsWith(\"#\")) continue;\n if (!text.startsWith(\"- \") || line === line.trimStart()) break;\n indent = line.slice(0, line.length - line.trimStart().length);\n items.push(text.slice(2).replace(/\\s+#.*$/, \"\").trim().replace(/^[\"']|[\"']$/g, \"\"));\n last = index;\n }\n return { items, last, indent };\n}\n\n/** This function gives the text with the lines `added` after the line `after` (-1: at the end), with the line ends of the text. */\nfunction insert(text: string, after: number, added: readonly string[]): string {\n const eol = text.includes(\"\\r\\n\") ? \"\\r\\n\" : \"\\n\";\n const lines = text.split(/\\r?\\n/);\n if (after >= 0) {\n lines.splice(after + 1, 0, ...added);\n return lines.join(eol);\n }\n // At the end: one empty line before the block, and one line end after it\n while (lines.length > 0 && lines[lines.length - 1] === \"\") lines.pop();\n return [...lines, ...(lines.length > 0 ? [\"\"] : []), ...added, \"\"].join(eol);\n}\n\n/** This function gives the text with the value of the top-level key on the line `index` replaced. */\nfunction setValue(text: string, index: number, key: string, value: string): string {\n const eol = text.includes(\"\\r\\n\") ? \"\\r\\n\" : \"\\n\";\n const lines = text.split(/\\r?\\n/);\n lines[index] = `${key}: ${value}`;\n return lines.join(eol);\n}\n\nexport const trustPolicy: Rule = {\n id: \"trust-policy\",\n title: \"A pnpm repository sets `trustPolicy: no-downgrade` for the versions of the last 7 days, and excludes the scopes of the release train.\",\n reason:\n \"A stolen npm token can publish a version with no provenance, and the next install takes it. With `no-downgrade`, pnpm refuses a version with less trust evidence than an earlier version. The release age of pnpm keeps out the versions of the last day; this check covers the next days. The release train updates our own scopes at once and checks their provenance itself.\",\n fix: \"Add `trustPolicy: no-downgrade`, `trustPolicyIgnoreAfter: 10080` and a `trustPolicyExclude` with the scopes of the option `exclude` to `pnpm-workspace.yaml`. `conventions fix` writes them.\",\n sources: [{ repo: \"fleet\", rule: \"trust-policy\", doc: \"docs/STRATEGY.md (2026-11-01, release age and trust policy)\" }],\n options: {\n exclude: {\n type: \"strings\",\n default: [...TRAIN_SCOPES],\n description: \"The patterns that `trustPolicyExclude` must have: the scopes whose versions the release train checks.\",\n },\n ignoreAfter: {\n type: \"number\",\n default: IGNORE_AFTER,\n description: \"The smallest `trustPolicyIgnoreAfter`, in minutes. A larger value checks more versions.\",\n },\n },\n check(context, options) {\n if (!hasFile(context.root, \"pnpm-lock.yaml\")) return { skipped: \"the repository has no pnpm-lock.yaml\" };\n const exclude = Array.isArray(options[\"exclude\"]) ? (options[\"exclude\"] as readonly string[]) : TRAIN_SCOPES;\n const ignoreAfter = typeof options[\"ignoreAfter\"] === \"number\" ? options[\"ignoreAfter\"] : IGNORE_AFTER;\n const exists = hasFile(context.root, WORKSPACE);\n const text = exists ? readFileSync(join(context.root, WORKSPACE), \"utf8\") : \"\";\n const lines = text.split(/\\r?\\n/);\n const edit = (after: string): Edit[] => (after === text ? [] : [{ file: WORKSPACE, before: text, after }]);\n const at = (index: number | undefined) => (index === undefined ? {} : { line: index + 1 });\n const breaks: Break[] = [];\n\n const policy = valueOf(lines, \"trustPolicy\");\n if (policy?.value !== \"no-downgrade\") {\n breaks.push({\n file: WORKSPACE,\n ...at(policy?.index),\n message: policy === undefined ? `${exists ? WORKSPACE : \"The repository\"} does not set trustPolicy.` : `trustPolicy is \"${policy.value}\", not \"no-downgrade\".`,\n edits: edit(policy === undefined ? insert(text, -1, [...POLICY_COMMENT, \"trustPolicy: no-downgrade\"]) : setValue(text, policy.index, \"trustPolicy\", \"no-downgrade\")),\n });\n }\n\n const ignore = valueOf(lines, \"trustPolicyIgnoreAfter\");\n const minutes = ignore === undefined ? undefined : Number(ignore.value);\n if (minutes === undefined || !Number.isInteger(minutes) || minutes < ignoreAfter) {\n const after = ignore !== undefined ? setValue(text, ignore.index, \"trustPolicyIgnoreAfter\", String(ignoreAfter)) : policy !== undefined ? insert(text, policy.index, [...IGNORE_COMMENT, `trustPolicyIgnoreAfter: ${String(ignoreAfter)}`]) : text;\n breaks.push({\n file: WORKSPACE,\n ...at(ignore?.index),\n message:\n ignore === undefined\n ? `${WORKSPACE} does not set trustPolicyIgnoreAfter, so pnpm also refuses old versions that have less evidence for other reasons.`\n : `trustPolicyIgnoreAfter is ${ignore.value}, not a whole number of at least ${String(ignoreAfter)} minutes.`,\n // With no trustPolicy line, the edit waits for the next check, which places it under that line\n edits: edit(after),\n });\n }\n\n const start = lines.findIndex((line) => line.startsWith(\"trustPolicyExclude:\"));\n const inline = start >= 0 && (valueOf(lines, \"trustPolicyExclude\")?.value ?? \"\") !== \"\";\n const list = start >= 0 && !inline ? blockList(lines, start) : { items: [], last: start, indent: \" \" };\n const missing = exclude.filter((pattern) => !list.items.includes(pattern));\n if (missing.length > 0) {\n const items = missing.map((pattern) => `${list.indent}- ${JSON.stringify(pattern)}`);\n // The fix does not rewrite a list in the flow style ([a, b]): a person adds the patterns\n const after = inline ? text : start >= 0 ? insert(text, list.last, items) : policy === undefined ? text : insert(text, -1, [...EXCLUDE_COMMENT, \"trustPolicyExclude:\", ...items]);\n breaks.push({\n file: WORKSPACE,\n ...at(start >= 0 ? start : undefined),\n message: `trustPolicyExclude does not have ${missing.join(\", \")}.`,\n edits: edit(after),\n });\n }\n return breaks;\n },\n};\n","/**\n * The rule `workspace-protocol`: a package uses another package of the workspace through `workspace:`.\n */\nimport { keyLine, specifiersOf, type Break, type Rule } from \"../rule.ts\";\n\n/** The fields that the rule examines. A peer dependency often keeps a range for its users, so the rule does not examine it. */\nconst FIELDS = [\"dependencies\", \"devDependencies\", \"optionalDependencies\"] as const;\n\nexport const workspaceProtocol: Rule = {\n id: \"workspace-protocol\",\n title: \"A dependency on a package of this workspace uses the `workspace:` protocol.\",\n reason:\n \"A version range or a git ref of a package of the same repository gets an old copy from the registry or from git, not the source next to it. Then a change and its test do not meet.\",\n fix: 'Use `\"workspace:*\"`. pnpm writes the real version when it publishes the package.',\n sources: [\n { repo: \"client\", rule: \"workspace-protocol\", doc: \"CLAUDE.md:52\" },\n { repo: \"client\", rule: \"workspace-deps\", doc: \"CLAUDE.md:52\" },\n { repo: \"coeval\", rule: \"pinned-deps\", doc: \"CLAUDE.md:41\" },\n { repo: \"headroom\", rule: \"non-npm-deps-pinned\", doc: \"CLAUDE.md:38\" },\n { repo: \"crawler\", rule: \"mcp-workspace-dep\", doc: \"CLAUDE.md:55\" },\n ],\n options: {\n prefix: { type: \"string\", default: \"workspace:\", description: 'The start of each specifier, for example \"workspace:*\" to refuse \"workspace:^\".' },\n },\n check(context, options) {\n const prefix = typeof options[\"prefix\"] === \"string\" ? options[\"prefix\"] : \"workspace:\";\n const names = new Set(context.packages.map((info) => info.manifest[\"name\"]).filter((name): name is string => typeof name === \"string\"));\n const breaks: Break[] = [];\n for (const info of [context.rootPackage, ...context.packages]) {\n for (const field of FIELDS) {\n for (const [name, spec] of specifiersOf(info.manifest, field)) {\n if (!names.has(name) || name === info.manifest[\"name\"] || spec.startsWith(prefix)) continue;\n const line = keyLine(info.text, field, name);\n breaks.push({\n file: info.file,\n ...(line === undefined ? {} : { line }),\n message: `${field} \"${name}\" is \"${spec}\", but \"${name}\" is a package of this workspace.`,\n fix: `Use \"${prefix === \"workspace:\" ? \"workspace:*\" : prefix}\".`,\n });\n }\n }\n }\n return breaks;\n },\n};\n","/**\n * The list of the rules, in the order of the output.\n */\nimport type { Rule } from \"../rule.ts\";\nimport { cuePreset } from \"./cue-preset.ts\";\nimport { mainCheck } from \"./main-check.ts\";\nimport { noBuildOutput } from \"./no-build-output.ts\";\nimport { noLocalPaths } from \"./no-local-paths.ts\";\nimport { pinnedGitDeps } from \"./pinned-git-deps.ts\";\nimport { releaseFiles } from \"./release-files.ts\";\nimport { requiredScripts } from \"./required-scripts.ts\";\nimport { roadmapParses } from \"./roadmap-parses.ts\";\nimport { runnerBudget } from \"./runner-budget.ts\";\nimport { sourceMain } from \"./source-main.ts\";\nimport { testsRequired } from \"./tests-required.ts\";\nimport { tsconfigTest } from \"./tsconfig-test.ts\";\nimport { typedFiles } from \"./typed-files.ts\";\nimport { typedScripts } from \"./typed-scripts.ts\";\nimport { trustPolicy } from \"./trust-policy.ts\";\nimport { workspaceProtocol } from \"./workspace-protocol.ts\";\n\n/** Each rule of the check. */\nexport const RULES: readonly Rule[] = [\n pinnedGitDeps,\n workspaceProtocol,\n trustPolicy,\n sourceMain,\n tsconfigTest,\n cuePreset,\n requiredScripts,\n noBuildOutput,\n noLocalPaths,\n releaseFiles,\n typedScripts,\n typedFiles,\n mainCheck,\n testsRequired,\n roadmapParses,\n runnerBudget,\n];\n\nexport { cuePreset, mainCheck, noBuildOutput, noLocalPaths, pinnedGitDeps, releaseFiles, requiredScripts, roadmapParses, runnerBudget, sourceMain, testsRequired, trustPolicy, tsconfigTest, typedFiles, typedScripts, workspaceProtocol };\n","/**\n * The commands `check`, `fix` and `--list` of the bin `conventions`, as functions. `runChecks` starts the\n * rules, `runFix` writes the edits of the breaks, and `runCli` reads the arguments and writes the result.\n */\nimport { appendFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { dirname, join, resolve } from \"node:path\";\nimport { parseConfig, type ConventionsConfig } from \"./config.ts\";\nimport { matchesAny, runGit, type Break, type Manifest, type PackageInfo, type Rule, type RuleContext } from \"./rule.ts\";\nimport { RULES } from \"./rules/index.ts\";\nimport { packageFolders, relativePath } from \"./workspace.ts\";\n\n/** The result of one rule. */\nexport interface RuleResult {\n readonly id: string;\n readonly title: string;\n readonly fix: string;\n /** `pass`: no break. `break`: one or more breaks. `off`: the configuration turns the rule off. `skipped`: the rule did not start. `error`: the rule threw. */\n readonly status: \"pass\" | \"break\" | \"off\" | \"skipped\" | \"error\";\n readonly breaks: readonly Break[];\n /** The number of breaks in the files of `ignore`. */\n readonly ignored: number;\n /** The reason of `off`, of `ignore`, of `skipped`, or the message of `error`. */\n readonly note?: string;\n}\n\n/** The result of `runChecks`. */\nexport interface CheckResult {\n readonly rules: readonly RuleResult[];\n /** True when a rule has a break or an error. */\n readonly failed: boolean;\n}\n\n/** The options of `runChecks`. */\nexport interface CheckOptions {\n /** The root of the repository. */\n readonly root: string;\n /** Only these rules. The default is each rule. */\n readonly only?: readonly string[];\n /** The base commit of the change, for the rules that examine a change. */\n readonly base?: string;\n readonly env?: Readonly<Record<string, string | undefined>>;\n /** The rules. The default is `RULES`. */\n readonly rules?: readonly Rule[];\n}\n\n/** This function reads a `package.json` file. */\nfunction readPackage(root: string, dir: string): PackageInfo {\n const path = join(dir, \"package.json\");\n const text = readFileSync(path, \"utf8\");\n const parsed: unknown = JSON.parse(text);\n const manifest = (typeof parsed === \"object\" && parsed !== null ? parsed : {}) as Manifest;\n return { folder: relativePath(root, dir), dir, file: relativePath(root, path), text, manifest };\n}\n\n/** This function reads the configuration of the root `package.json` at `root`. */\nexport function readConfig(root: string, rules: readonly Rule[] = RULES): ConventionsConfig {\n const file = join(root, \"package.json\");\n if (!existsSync(file)) throw new Error(`No package.json in ${root}.`);\n return parseConfig((JSON.parse(readFileSync(file, \"utf8\")) as Manifest)[\"conventions\"], rules);\n}\n\n/** This function gives the facts of the repository at `root` that the rules read. */\nexport function createContext(root: string, config: ConventionsConfig, options: Pick<CheckOptions, \"base\" | \"env\"> = {}): RuleContext {\n const rootPackage = readPackage(root, root);\n const packages = packageFolders(root, config.packages ?? undefined)\n .filter((dir) => resolve(dir) !== resolve(root))\n .map((dir) => readPackage(root, dir));\n let files: readonly string[] | undefined | null = null;\n return {\n root,\n rootPackage,\n packages,\n env: options.env ?? {},\n ...(options.base === undefined ? {} : { base: options.base }),\n gitFiles() {\n if (files === null) {\n const out = runGit(root, [\"ls-files\", \"-z\", \"--cached\"]);\n files = out === undefined ? undefined : out.split(\"\\0\").filter((file) => file !== \"\");\n }\n return files;\n },\n git: (args) => runGit(root, args),\n };\n}\n\n/** This function starts each rule on the repository at `options.root`, and gives the result of each rule. */\nexport function runChecks(options: CheckOptions): CheckResult {\n const root = resolve(options.root);\n const rules = options.rules ?? RULES;\n const unknown = (options.only ?? []).filter((id) => !rules.some((rule) => rule.id === id));\n if (unknown.length > 0) throw new Error(`Unknown rule: ${unknown.join(\", \")}. The rules are: ${rules.map((rule) => rule.id).join(\", \")}.`);\n const config = readConfig(root, rules);\n const context = createContext(root, config, options);\n const results: RuleResult[] = [];\n for (const rule of rules) {\n if (options.only !== undefined && options.only.length > 0 && !options.only.includes(rule.id)) continue;\n const ruleConfig = config.rules[rule.id] ?? { ignore: [], options: {} };\n const base = { id: rule.id, title: rule.title, fix: rule.fix };\n if (ruleConfig.off !== undefined) {\n results.push({ ...base, status: \"off\", breaks: [], ignored: 0, note: ruleConfig.off });\n continue;\n }\n let outcome: ReturnType<Rule[\"check\"]>;\n try {\n outcome = rule.check(context, ruleConfig.options);\n } catch (error) {\n results.push({ ...base, status: \"error\", breaks: [], ignored: 0, note: error instanceof Error ? error.message : String(error) });\n continue;\n }\n if (\"skipped\" in outcome) {\n results.push({ ...base, status: \"skipped\", breaks: [], ignored: 0, note: outcome.skipped });\n continue;\n }\n const breaks = outcome.filter((item) => !matchesAny(item.file, ruleConfig.ignore));\n const ignored = outcome.length - breaks.length;\n const note = ruleConfig.reason === undefined ? {} : { note: ruleConfig.reason };\n results.push({ ...base, status: breaks.length > 0 ? \"break\" : \"pass\", breaks, ignored, ...note });\n }\n return { rules: results, failed: results.some((result) => result.status === \"break\" || result.status === \"error\") };\n}\n\n/** The result of `runFix`. */\nexport interface FixResult {\n /** The files that the edits changed, relative to the root, with `/`, in the order of the first change. */\n readonly changed: readonly string[];\n /** The number of checks. */\n readonly passes: number;\n /** The result of the last check, after the edits. */\n readonly result: CheckResult;\n}\n\n/** The most checks of `runFix`. Each check writes at most one edit of each file. */\nconst MAX_PASSES = 20;\n\n/**\n * This function writes the edits of the breaks, and checks again, until no edit applies. In each pass it writes the first\n * edit of each file whose `before` is the current text of the file. The other edits of that file wait for the next check,\n * which gives them again from the new text. Thus a fix does not write over a change that it did not see.\n */\nexport function runFix(options: CheckOptions): FixResult {\n const root = resolve(options.root);\n const changed: string[] = [];\n let result = runChecks(options);\n let passes = 1;\n while (passes < MAX_PASSES) {\n const written = new Set<string>();\n for (const rule of result.rules) {\n for (const edit of rule.breaks.flatMap((item) => item.edits ?? [])) {\n if (written.has(edit.file)) continue;\n const path = join(root, edit.file);\n // A file that does not exist has the text \"\": an edit with an empty `before` makes the file\n if ((existsSync(path) ? readFileSync(path, \"utf8\") : \"\") !== edit.before) continue;\n mkdirSync(dirname(path), { recursive: true });\n writeFileSync(path, edit.after);\n written.add(edit.file);\n if (!changed.includes(edit.file)) changed.push(edit.file);\n }\n }\n if (written.size === 0) break;\n result = runChecks(options);\n passes += 1;\n }\n return { changed, passes, result };\n}\n\n/** This function gives a result for JSON: each break without the texts of its edits, and with `fixable`. */\nfunction withoutEdits(result: CheckResult): object {\n return {\n ...result,\n rules: result.rules.map((rule) => ({ ...rule, breaks: rule.breaks.map(({ edits, ...item }) => ({ ...item, fixable: (edits ?? []).length > 0 })) })),\n };\n}\n\n/** The most breaks of one rule in the text output. The JSON output has each break. */\nconst MAX_SHOWN = 50;\n\n/** This function gives the place of a break as `file:line`. */\nconst placeOf = (item: Break): string => (item.line === undefined ? item.file : `${item.file}:${item.line}`);\n\n/** This function gives the text of a result for a terminal or a CI log. */\nexport function formatResult(result: CheckResult): string {\n const count = (status: RuleResult[\"status\"]): number => result.rules.filter((rule) => rule.status === status).length;\n const breaks = result.rules.reduce((sum, rule) => sum + rule.breaks.length, 0);\n const out: string[] = [\n `conventions: ${result.rules.length} rules: ${count(\"pass\")} pass, ${count(\"break\")} with ${breaks} break(s), ${count(\"off\")} off, ${count(\"skipped\")} skipped, ${count(\"error\")} error(s).`,\n \"\",\n ];\n const label: Record<RuleResult[\"status\"], string> = { pass: \"pass \", break: \"BREAK\", off: \"off \", skipped: \"skip \", error: \"ERROR\" };\n for (const rule of result.rules) {\n const extra = rule.ignored > 0 ? ` (${rule.ignored} ignored: ${rule.note ?? \"\"})` : rule.note !== undefined && rule.status !== \"pass\" ? ` (${rule.note})` : \"\";\n out.push(`${label[rule.status]} ${rule.id}${rule.breaks.length > 0 ? `: ${rule.breaks.length} break(s)` : \"\"}${extra}`);\n for (const item of rule.breaks.slice(0, MAX_SHOWN)) {\n out.push(` ${placeOf(item)} ${item.message}${(item.edits ?? []).length > 0 ? \" (conventions fix writes the fix)\" : \"\"}`);\n if (item.fix !== undefined) out.push(` fix: ${item.fix}`);\n }\n if (rule.breaks.length > MAX_SHOWN) out.push(` ... ${rule.breaks.length - MAX_SHOWN} more. Start \\`conventions check --json\\` for each break.`);\n if (rule.breaks.length > 0) out.push(` rule: ${rule.title}`, ` fix: ${rule.fix}`);\n }\n if (result.failed) out.push(\"\", \"To turn a rule off or to keep an exception, add a reason in the field conventions of package.json (`conventions --list`).\");\n return `${out.join(\"\\n\")}\\n`;\n}\n\n/** This function escapes the text of a cell of a Markdown table: first each backslash, then each `|`. */\nconst cell = (text: string): string => text.replace(/\\\\/g, \"\\\\\\\\\").replace(/\\|/g, \"\\\\|\").replace(/\\r?\\n/g, \" \");\n\n/** This function gives the result as Markdown for the summary of a GitHub Actions run. */\nexport function summaryMarkdown(result: CheckResult): string {\n const out = [\"### Conventions\", \"\", \"| Rule | Result | Note |\", \"|---|---|---|\"];\n for (const rule of result.rules) {\n const shown = rule.status === \"break\" ? `${rule.breaks.length} break(s)` : rule.status;\n const note = rule.ignored > 0 ? `${rule.ignored} ignored: ${rule.note ?? \"\"}` : (rule.note ?? \"\");\n out.push(`| \\`${rule.id}\\` | ${shown} | ${cell(note)} |`);\n }\n const broken = result.rules.filter((rule) => rule.breaks.length > 0);\n for (const rule of broken) {\n out.push(\"\", `<details open><summary><code>${rule.id}</code>: ${rule.breaks.length} break(s)</summary>`, \"\", `${rule.title} Fix: ${rule.fix}`, \"\");\n for (const item of rule.breaks.slice(0, MAX_SHOWN)) out.push(`- \\`${placeOf(item)}\\`: ${item.message}${item.fix === undefined ? \"\" : ` Fix: ${item.fix}`}`);\n if (rule.breaks.length > MAX_SHOWN) out.push(`- ... ${rule.breaks.length - MAX_SHOWN} more`);\n out.push(\"\", \"</details>\");\n }\n return `${out.join(\"\\n\")}\\n`;\n}\n\n/** This function escapes a value of a workflow command of GitHub Actions. */\nconst escapeData = (text: string): string => text.replace(/%/g, \"%25\").replace(/\\r/g, \"%0D\").replace(/\\n/g, \"%0A\");\nconst escapeProperty = (text: string): string => escapeData(text).replace(/:/g, \"%3A\").replace(/,/g, \"%2C\");\n\n/** This function gives an `::error` workflow command for each break, so that GitHub shows each break on its line in the pull request. */\nexport function annotations(result: CheckResult): string {\n const out: string[] = [];\n for (const rule of result.rules) {\n for (const item of rule.breaks) {\n const line = item.line === undefined ? \"\" : `,line=${item.line}`;\n out.push(`::error file=${escapeProperty(item.file)}${line},title=${escapeProperty(`conventions ${rule.id}`)}::${escapeData(`${item.message} Fix: ${item.fix ?? rule.fix}`)}`);\n }\n }\n return out.length === 0 ? \"\" : `${out.join(\"\\n\")}\\n`;\n}\n\n/** This function gives the text of `--list`: each rule, its reason, its fix, its options, its state and its audit sources. */\nexport function listRules(config: ConventionsConfig | undefined, rules: readonly Rule[] = RULES): string {\n const out: string[] = [];\n for (const rule of rules) {\n const ruleConfig = config?.rules[rule.id];\n const state = ruleConfig?.off !== undefined ? `off: ${ruleConfig.off}` : \"on\";\n out.push(`${rule.id} (${state})`, ` ${rule.title}`, ` why: ${rule.reason}`, ` fix: ${rule.fix}`);\n for (const [name, spec] of Object.entries(rule.options)) {\n const value = ruleConfig?.options[name] ?? spec.default;\n out.push(` option ${name} = ${JSON.stringify(value)}: ${spec.description}`);\n }\n if (ruleConfig !== undefined && ruleConfig.ignore.length > 0) out.push(` ignore ${ruleConfig.ignore.join(\", \")}: ${ruleConfig.reason ?? \"\"}`);\n else if (ruleConfig?.reason !== undefined) out.push(` reason: ${ruleConfig.reason}`);\n out.push(` from: ${rule.sources.map((source) => `${source.repo} ${source.rule} (${source.doc})`).join(\"; \")}`, \"\");\n }\n return `${out.join(\"\\n\")}`;\n}\n\n/** The input and output of `runCli`. */\nexport interface CliIo {\n readonly cwd: string;\n readonly env: Readonly<Record<string, string | undefined>>;\n readonly stdout: (text: string) => void;\n readonly stderr: (text: string) => void;\n}\n\n/** The help text of the bin. */\nexport const USAGE: string = `Usage: conventions check [options]\n conventions fix [options]\n conventions --list\n\n check Start each rule. Exit code 1 when a rule has a break.\n fix Write the fixes of the breaks that have one, and check again. Exit code 1 when a break stays.\n --list Show each rule: why, fix, options, state and the audit rows that it comes from.\n\n --root <folder> The root of the repository. The default is the current folder.\n --rule <id> Only this rule. Use it again for more rules.\n --base <ref> The base commit of the change, for the rule release-files. On a pull request, the rule finds it.\n --json Write the result as JSON.\n -h, --help Show this text.\n\nThe field \"conventions\" of the root package.json turns a rule off with a reason, keeps an exception\nwith a reason, and sets the options of a rule with a reason:\n\n \"conventions\": { \"rules\": { \"no-build-output\": { \"off\": \"<reason>\" },\n \"cue-preset\": { \"ignore\": [\"packages/web/**\"], \"reason\": \"<reason>\" },\n \"workspace-protocol\": { \"prefix\": \"workspace:*\", \"reason\": \"<reason>\" } } }\n`;\n\n/** An error of the arguments: exit code 2 and the help text. */\nclass UsageError extends Error {}\n\n/** This function starts the bin with the arguments `args`, and gives its exit code. */\nexport function runCli(args: readonly string[], io: CliIo): number {\n let check = false;\n let fix = false;\n let list = false;\n let json = false;\n let root = io.cwd;\n let base: string | undefined;\n const only: string[] = [];\n try {\n for (let index = 0; index < args.length; index++) {\n const arg = args[index] ?? \"\";\n const value = (): string => {\n const next = args[++index];\n if (next === undefined || next.startsWith(\"-\")) throw new UsageError(`The option ${arg} needs a value.`);\n return next;\n };\n if (arg === \"check\") check = true;\n else if (arg === \"fix\") fix = true;\n else if (arg === \"--list\" || arg === \"list\") list = true;\n else if (arg === \"--json\") json = true;\n else if (arg === \"--root\") root = resolve(io.cwd, value());\n else if (arg === \"--rule\") only.push(value());\n else if (arg === \"--base\") base = value();\n else if (arg === \"--help\" || arg === \"-h\") {\n io.stdout(USAGE);\n return 0;\n } else throw new UsageError(`An unknown argument: ${arg}`);\n }\n if (!check && !fix && !list) throw new UsageError(\"Give the command check or fix, or --list.\");\n } catch (error) {\n if (!(error instanceof UsageError)) throw error;\n io.stderr(`conventions: ${error.message}\\n\\n${USAGE}`);\n return 2;\n }\n if (list) {\n let config: ConventionsConfig | undefined;\n try {\n config = existsSync(join(root, \"package.json\")) ? readConfig(root) : undefined;\n } catch (error) {\n io.stderr(`conventions: ${error instanceof Error ? error.message : String(error)}\\n`);\n return 1;\n }\n io.stdout(listRules(config));\n return 0;\n }\n let result: CheckResult;\n let fixed: FixResult | undefined;\n try {\n const options = { root, only, env: io.env, ...(base === undefined ? {} : { base }) };\n if (fix) {\n fixed = runFix(options);\n result = fixed.result;\n } else result = runChecks(options);\n } catch (error) {\n io.stderr(`conventions: ${error instanceof Error ? error.message : String(error)}\\n`);\n return 1;\n }\n if (fixed !== undefined && !json) {\n const files = fixed.changed.map((file) => ` ${file}\\n`).join(\"\");\n io.stdout(fixed.changed.length === 0 ? \"conventions fix: no break has a fix that applies.\\n\" : `conventions fix: changed ${fixed.changed.length} file(s) in ${fixed.passes} check(s):\\n${files}\\n`);\n }\n const shown = fixed === undefined ? withoutEdits(result) : { changed: fixed.changed, passes: fixed.passes, ...withoutEdits(result) };\n if (json) io.stdout(`${JSON.stringify(shown, null, 2)}\\n`);\n else {\n if (io.env[\"GITHUB_ACTIONS\"] === \"true\") io.stdout(annotations(result));\n io.stdout(formatResult(result));\n }\n const summary = io.env[\"GITHUB_STEP_SUMMARY\"];\n if (summary) appendFileSync(summary, summaryMarkdown(result));\n return result.failed ? 1 : 0;\n}\n"],"mappings":";;;;;;AA4BA,MAAM,cAAc;CAAC;CAAO;CAAU;AAAQ;AAE9C,MAAM,YAAY,UAAqD,OAAO,UAAU,Y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