/** * doc-derived-counts.ts — the one place that re-derives the counts our docs assert. * * WHY THIS IS A MODULE AND NOT INLINE IN ONE TEST * * CLAUDE.md rotted once (it claimed 202 skills against a real 229) and grew the * guard in `claude-md.test.ts`. README.md then rotted the SAME number in the same * direction and nobody noticed for weeks, because the guard was scoped to a single * hard-coded path: `202+` sat in README while the guarded table two files away read * 85. One document was fixed and its neighbour was left asserting the old figure. * * A guard that covers one of the two places a number is written is not a guard on * the number; it is a guard on a file. So the derivation and the table parser live * here, and every document that asserts these counts is checked by the same code. * Adding a third document is a two-line test, which is the point — the cheap path * has to be the correct one or the next document will hand-copy the numbers again. */ /** * The heading every guarded table sits under. Fixed rather than per-document so a * document cannot opt out of the guard by renaming its own section. */ export declare const TABLE_HEADING = "### Derived counts"; /** * Parse the `### Derived counts` table in `docPath` into {label -> value}. * * Scoped to the section rather than the whole file so an unrelated markdown table * elsewhere in the document cannot inject rows. Throws rather than returning empty * when the section is missing: an empty map would make every assertion pass or fail * for the wrong reason. * * The three tolerances below are not incidental — each one is a way this guard * could have failed for a reason that has nothing to do with doc drift, and a doc * test that cries wolf is a doc test that gets deleted: * * - Up to three leading spaces before `|`. GFM permits them, so an editor that * indents the table would otherwise yield zero rows and a diff that looks like * catastrophic drift. * - A delimiter row of ANY dash count, with or without alignment colons. `|-|-|-|` * is legal GFM; an earlier `-{2,}` test let it through as a data row named "-". * - The header is dropped BY POSITION (first row), not by matching the literal * "Count". Renaming that cell to "Metric" must not break the guard. */ export declare function readDocumentedCounts(docPath: string): Record; export declare function deriveCounts(): Promise>; /** * Narrow the derived set to the rows a given document actually publishes. * * README and CLAUDE.md have different audiences and deliberately carry different * subsets — forcing every document to restate all seven rows would mean every skill * PR edits every document, which is the tax that gets a guard deleted. * * Throws on a key the derivation does not produce. Without that, a typo in a * document's expected-key list would silently shrink the comparison to the rows that * happened to match, and the guard would pass while checking less than it claims. */ export declare function selectCounts(derived: Record, keys: readonly string[]): Record;