@simpleapps-com/augur-config 2.4.0 → 2026.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/EXPORTS.md +43 -44
  2. package/README.md +45 -29
  3. package/dist/augur-doctor.d.ts +13 -0
  4. package/dist/augur-doctor.d.ts.map +1 -0
  5. package/dist/augur-doctor.js +777 -0
  6. package/dist/augur-doctor.js.map +1 -0
  7. package/dist/chunk-3L322IID.js +287 -0
  8. package/dist/chunk-3L322IID.js.map +1 -0
  9. package/dist/chunk-RY3GDLDS.js +26 -0
  10. package/dist/chunk-RY3GDLDS.js.map +1 -0
  11. package/dist/doctor/checks.d.ts +36 -0
  12. package/dist/doctor/checks.d.ts.map +1 -0
  13. package/dist/doctor/cli.d.ts +11 -0
  14. package/dist/doctor/cli.d.ts.map +1 -0
  15. package/dist/doctor/node-reader.d.ts +7 -0
  16. package/dist/doctor/node-reader.d.ts.map +1 -0
  17. package/dist/doctor/report.d.ts +5 -0
  18. package/dist/doctor/report.d.ts.map +1 -0
  19. package/dist/doctor/rules.d.ts +297 -0
  20. package/dist/doctor/rules.d.ts.map +1 -0
  21. package/dist/eslint-next.d.ts +9 -0
  22. package/dist/eslint-next.d.ts.map +1 -0
  23. package/dist/eslint-next.js +35 -0
  24. package/dist/eslint-next.js.map +1 -0
  25. package/dist/eslint-shared.d.ts +36 -0
  26. package/dist/eslint-shared.d.ts.map +1 -0
  27. package/dist/eslint.d.ts +6 -0
  28. package/dist/eslint.d.ts.map +1 -0
  29. package/dist/eslint.js +30 -0
  30. package/dist/eslint.js.map +1 -0
  31. package/dist/lighthouse.d.ts +62 -0
  32. package/dist/lighthouse.d.ts.map +1 -0
  33. package/dist/lighthouse.js +68 -0
  34. package/dist/lighthouse.js.map +1 -0
  35. package/dist/prettier-next.d.ts +5 -0
  36. package/dist/prettier-next.d.ts.map +1 -0
  37. package/{src → dist}/prettier-next.js +9 -7
  38. package/dist/prettier-next.js.map +1 -0
  39. package/dist/prettier.d.ts +5 -0
  40. package/dist/prettier.d.ts.map +1 -0
  41. package/dist/prettier.js +17 -0
  42. package/dist/prettier.js.map +1 -0
  43. package/llms.txt +40 -20
  44. package/package.json +50 -12
  45. package/bin/augur-doctor.mjs +0 -1038
  46. package/src/eslint-next.js +0 -40
  47. package/src/eslint.js +0 -35
  48. package/src/lighthouse.js +0 -108
  49. package/src/prettier.js +0 -12
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../foundation/src/chars.ts","../../utils/src/strings.ts","../src/doctor/rules.ts"],"sourcesContent":["//@ backend dafny\n\n/* Character classes over UTF-16 code units (what charCodeAt returns), verified with\n LemmaScript → Dafny (model: models/Foundation.dfy; link: models/links/foundation-chars.dfy).\n Every contract is an iff, so an importer, which sees only the contract, knows each class\n exactly. */\n\n/**\n * A decimal digit: 0-9.\n *\n * @ensures result ⟺ c ∈ [48, 57]\n */\nexport function isDigit(c: number): boolean {\n //@ verify\n //@ ensures \\result <==> (c >= 48 && c <= 57)\n return c >= 48 && c <= 57;\n}\n\n/**\n * A JS line terminator (what regex `.` doesn't match): LF, CR, LS, PS.\n *\n * @ensures result ⟺ c ∈ {10, 13, 8232, 8233}\n */\nexport function isLineTerminator(c: number): boolean {\n //@ verify\n //@ ensures \\result <==> (c === 10 || c === 13 || c === 8232 || c === 8233)\n return c === 10 || c === 13 || c === 8232 || c === 8233;\n}\n\n/**\n * The code ASCII-lowered: A-Z to a-z, any other value (-1 from `codeAt` included) unchanged.\n *\n * @ensures exactly the model's LowerCode\n */\nexport function lowerCode(c: number): number {\n //@ verify\n //@ ensures \\result === (c >= 65 && c <= 90 ? c + 32 : c)\n return c >= 65 && c <= 90 ? c + 32 : c;\n}\n/**\n * A lowercase ASCII letter: a-z.\n *\n * @ensures result ⟺ c ∈ [97, 122]\n */\nexport function isLowerAlphaChar(c: number): boolean {\n //@ verify\n //@ ensures \\result <==> (c >= 97 && c <= 122)\n return c >= 97 && c <= 122;\n}\n\n/**\n * An ASCII letter or digit: A-Z a-z 0-9.\n *\n * @ensures result ⟺ c ∈ [A-Z] ∪ [a-z] ∪ [0-9]\n */\nexport function isAlnumChar(c: number): boolean {\n //@ verify\n //@ ensures \\result <==> ((c >= 65 && c <= 90) || (c >= 97 && c <= 122) || (c >= 48 && c <= 57))\n return (c >= 65 && c <= 90) || (c >= 97 && c <= 122) || (c >= 48 && c <= 57);\n}\n\n/**\n * A lowercase hex digit: 0-9 a-f.\n *\n * @ensures result ⟺ c ∈ [0-9] ∪ [a-f]\n */\nexport function isLowerHexChar(c: number): boolean {\n //@ verify\n //@ ensures \\result <==> ((c >= 48 && c <= 57) || (c >= 97 && c <= 102))\n return (c >= 48 && c <= 57) || (c >= 97 && c <= 102);\n}\n\n/**\n * A hex digit in either case: 0-9 a-f A-F.\n *\n * @ensures result ⟺ c ∈ [0-9] ∪ [a-f] ∪ [A-F]\n */\nexport function isHexChar(c: number): boolean {\n //@ verify\n //@ ensures \\result <==> ((c >= 48 && c <= 57) || (c >= 97 && c <= 102) || (c >= 65 && c <= 70))\n return (c >= 48 && c <= 57) || (c >= 97 && c <= 102) || (c >= 65 && c <= 70);\n}\n\n/**\n * A base64url character (RFC 4648 §5): A-Z a-z 0-9 - _.\n *\n * @ensures result ⟺ c ∈ [A-Z] ∪ [a-z] ∪ [0-9] ∪ {\"-\", \"_\"} — never \".\" or \"=\"\n */\nexport function isBase64UrlChar(c: number): boolean {\n //@ verify\n //@ ensures \\result <==> ((c >= 65 && c <= 90) || (c >= 97 && c <= 122) || (c >= 48 && c <= 57) || c === 45 || c === 95)\n return (\n (c >= 65 && c <= 90) || (c >= 97 && c <= 122) || (c >= 48 && c <= 57) || c === 45 || c === 95\n );\n}\n\n/**\n * JS whitespace, the regex `\\s` and what `trim()` strips: tab, LF, VT, FF, CR, space, NBSP,\n * U+1680, U+2000-U+200A, LS, PS, U+202F, U+205F, U+3000 and the BOM.\n *\n * @ensures result ⟺ c ∈ {9..13, 32, 160, 5760, 8192..8202, 8232, 8233, 8239, 8287, 12288, 65279}\n */\nexport function isJsSpace(c: number): boolean {\n //@ verify\n //@ ensures \\result <==> ((c >= 9 && c <= 13) || c === 32 || c === 160 || c === 5760 || (c >= 8192 && c <= 8202) || c === 8232 || c === 8233 || c === 8239 || c === 8287 || c === 12288 || c === 65279)\n return isAsciiSpace(c) || isGeneralPunctuationSpace(c) || isOtherSpace(c);\n}\n\n/**\n * ASCII whitespace: tab, LF, VT, FF, CR and space.\n *\n * @ensures result ⟺ c ∈ [9, 13] ∪ {32}\n */\nfunction isAsciiSpace(c: number): boolean {\n //@ verify\n //@ ensures \\result <==> ((c >= 9 && c <= 13) || c === 32)\n return (c >= 9 && c <= 13) || c === 32;\n}\n\n/**\n * The spaces in the General Punctuation block: U+2000-U+200A, LS, PS, U+202F, U+205F.\n *\n * @ensures result ⟺ c ∈ [8192, 8202] ∪ {8232, 8233, 8239, 8287}\n */\nfunction isGeneralPunctuationSpace(c: number): boolean {\n //@ verify\n //@ ensures \\result <==> ((c >= 8192 && c <= 8202) || c === 8232 || c === 8233 || c === 8239 || c === 8287)\n return (c >= 8192 && c <= 8202) || c === 8232 || c === 8233 || c === 8239 || c === 8287;\n}\n\n/**\n * The other spaces: NBSP, U+1680 (Ogham), U+3000 (ideographic) and the BOM.\n *\n * @ensures result ⟺ c ∈ {160, 5760, 12288, 65279}\n */\nfunction isOtherSpace(c: number): boolean {\n //@ verify\n //@ ensures \\result <==> (c === 160 || c === 5760 || c === 12288 || c === 65279)\n return c === 160 || c === 5760 || c === 12288 || c === 65279;\n}\n\n/**\n * A word character, the regex `\\w`: A-Z a-z 0-9 _.\n *\n * @ensures result ⟺ c ∈ [A-Z] ∪ [a-z] ∪ [0-9] ∪ {\"_\"}\n */\nexport function isWordChar(c: number): boolean {\n //@ verify\n //@ ensures \\result <==> ((c >= 65 && c <= 90) || (c >= 97 && c <= 122) || (c >= 48 && c <= 57) || c === 95)\n return (c >= 65 && c <= 90) || (c >= 97 && c <= 122) || (c >= 48 && c <= 57) || c === 95;\n}\n\n/**\n * A snake_case character: a-z 0-9 _.\n *\n * @ensures result ⟺ c ∈ [a-z] ∪ [0-9] ∪ {\"_\"}\n */\nexport function isSnakeChar(c: number): boolean {\n //@ verify\n //@ ensures \\result <==> ((c >= 97 && c <= 122) || (c >= 48 && c <= 57) || c === 95)\n return (c >= 97 && c <= 122) || (c >= 48 && c <= 57) || c === 95;\n}\n","//@ backend dafny\nimport {\n isAlnumChar,\n isBase64UrlChar,\n isDigit,\n isHexChar,\n isJsSpace,\n isLineTerminator,\n isLowerHexChar,\n isSnakeChar,\n isWordChar,\n lowerCode,\n} from \"@atlas/foundation/chars\";\n\n/* String scans and slices, verified with LemmaScript → Dafny (hand lemmas in strings.dfy;\n model: models/Utils.dfy; link: models/links/utils-strings.dfy). Recursive and\n expression-bodied so specs can use them, and each contract pins the result exactly, so\n an importer (which sees only the contract) knows what it returns. Two of them stand in\n for constructs lsc mistranslates: `prefix` for an unclamped `slice`, and the code-unit\n scans for \"\\r\" / \"\\n\" literals. */\n\n/**\n * The code unit at `i`, or -1 when `i` is outside `s`. JS `charCodeAt` gives NaN there,\n * which no code equals, so a scan's own bounds test would change no result and no test\n * could tell it from none (an equivalent mutant); with the bound here once, the boundary is\n * observable (tests pin -1) and the scans that use it carry no bound of their own. A code\n * unit is never negative, so -1 matches no `code` a caller passes (`requires code >= 0`).\n *\n * @ensures 0 ≤ i < |s| ⟹ result = s[i]; otherwise result = -1\n */\nexport function codeAt(s: string, i: number): number {\n //@ verify\n //@ ensures (i >= 0 && i < s.length) ==> \\result === s.charCodeAt(i)\n //@ ensures !(i >= 0 && i < s.length) ==> \\result === -1\n return i >= 0 && i < s.length ? s.charCodeAt(i) : -1;\n}\n\n/**\n * Every character of `s` from index `i` on is base64url.\n *\n * @ensures result ⟺ ∀ k ∈ [i, |s|). isBase64UrlChar(s[k])\n */\nexport function base64UrlFrom(s: string, i: number): boolean {\n //@ verify\n //@ type i nat\n //@ requires i >= 0\n //@ decreases s.length - i\n //@ ensures \\result <==> forall(k: nat, (i <= k && k < s.length) ==> isBase64UrlChar(s.charCodeAt(k)))\n return i >= s.length || (isBase64UrlChar(s.charCodeAt(i)) && base64UrlFrom(s, i + 1));\n}\n\n/**\n * The base64url digit for `v` (RFC 4648 §5): A-Z a-z 0-9 - _.\n *\n * @ensures exactly the model's Base64UrlDigit\n */\nexport function base64UrlDigit(v: number): string {\n //@ verify\n //@ type v nat\n //@ requires v >= 0 && v < 64\n //@ ensures \\result === \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_\".slice(v, v + 1)\n return \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_\".slice(v, v + 1);\n}\n\n/**\n * Bytes from `i` on as unpadded base64url: each three as four digits, a last one or two as two or\n * three (JS `btoa` with `+/` as `-_` and the `=` dropped). One frame per three bytes: a JWT part\n * is a few hundred.\n *\n * @ensures exactly the model's Base64UrlFrom (links/utils-strings.dfy)\n */\nexport function encodeBase64UrlFrom(b: number[], i: number): string {\n //@ verify\n //@ type i nat\n //@ requires i >= 0 && forall(k: nat, k < b.length ==> (b[k] >= 0 && b[k] < 256))\n //@ decreases b.length - i\n //@ ensures i >= b.length ==> \\result === \"\"\n if (i >= b.length) return \"\";\n const x = b[i] as number;\n const first = base64UrlDigit(Math.floor(x / 4));\n if (i + 1 === b.length) return first + base64UrlDigit((x % 4) * 16);\n const y = b[i + 1] as number;\n const second = base64UrlDigit((x % 4) * 16 + Math.floor(y / 16));\n if (i + 2 === b.length) return first + second + base64UrlDigit((y % 16) * 4);\n const z = b[i + 2] as number;\n return (\n first +\n second +\n base64UrlDigit((y % 16) * 4 + Math.floor(z / 64)) +\n base64UrlDigit(z % 64) +\n encodeBase64UrlFrom(b, i + 3)\n );\n}\n\n/**\n * Every character of `s` from index `i` on is lowercase hex.\n *\n * @ensures result ⟺ ∀ k ∈ [i, |s|). isLowerHexChar(s[k])\n */\nexport function lowerHexFrom(s: string, i: number): boolean {\n //@ verify\n //@ type i nat\n //@ requires i >= 0\n //@ decreases s.length - i\n //@ ensures \\result <==> forall(k: nat, (i <= k && k < s.length) ==> isLowerHexChar(s.charCodeAt(k)))\n return i >= s.length || (isLowerHexChar(s.charCodeAt(i)) && lowerHexFrom(s, i + 1));\n}\n\n/**\n * Every character of `s` from index `i` on is hex, either case.\n *\n * @ensures result ⟺ ∀ k ∈ [i, |s|). isHexChar(s[k])\n */\nexport function hexFrom(s: string, i: number): boolean {\n //@ verify\n //@ type i nat\n //@ requires i >= 0\n //@ decreases s.length - i\n //@ ensures \\result <==> forall(k: nat, (i <= k && k < s.length) ==> isHexChar(s.charCodeAt(k)))\n return i >= s.length || (isHexChar(s.charCodeAt(i)) && hexFrom(s, i + 1));\n}\n\n/**\n * Every character of `s` from index `i` on is an ASCII digit (`\\d` without the `u` flag).\n *\n * @ensures result ⟺ ∀ k ∈ [i, |s|). isDigit(s[k])\n */\nexport function digitsFrom(s: string, i: number): boolean {\n //@ verify\n //@ type i nat\n //@ requires i >= 0\n //@ decreases s.length - i\n //@ ensures \\result <==> forall(k: nat, (i <= k && k < s.length) ==> isDigit(s.charCodeAt(k)))\n return i >= s.length || (isDigit(s.charCodeAt(i)) && digitsFrom(s, i + 1));\n}\n\n/**\n * Every character of `s` from index `i` on is a word character (`\\w`: `[A-Za-z0-9_]`).\n *\n * @ensures result ⟺ ∀ k ∈ [i, |s|). isWordChar(s[k])\n */\nexport function wordCharsFrom(s: string, i: number): boolean {\n //@ verify\n //@ type i nat\n //@ requires i >= 0\n //@ decreases s.length - i\n //@ ensures \\result <==> forall(k: nat, (i <= k && k < s.length) ==> isWordChar(s.charCodeAt(k)))\n return i >= s.length || (isWordChar(s.charCodeAt(i)) && wordCharsFrom(s, i + 1));\n}\n\n/**\n * Every character of `s` from index `i` on is a snake_case character (`[a-z0-9_]`).\n *\n * @ensures result ⟺ ∀ k ∈ [i, |s|). isSnakeChar(s[k])\n */\nexport function snakeCharsFrom(s: string, i: number): boolean {\n //@ verify\n //@ type i nat\n //@ requires i >= 0\n //@ decreases s.length - i\n //@ ensures \\result <==> forall(k: nat, (i <= k && k < s.length) ==> isSnakeChar(s.charCodeAt(k)))\n return i >= s.length || (isSnakeChar(s.charCodeAt(i)) && snakeCharsFrom(s, i + 1));\n}\n\n/**\n * Every character of `s` from index `i` on is an ASCII letter or digit (`[A-Za-z0-9]`).\n *\n * @ensures result ⟺ ∀ k ∈ [i, |s|). isAlnumChar(s[k])\n */\nexport function alnumFrom(s: string, i: number): boolean {\n //@ verify\n //@ type i nat\n //@ requires i >= 0\n //@ decreases s.length - i\n //@ ensures \\result <==> forall(k: nat, (i <= k && k < s.length) ==> isAlnumChar(s.charCodeAt(k)))\n return i >= s.length || (isAlnumChar(s.charCodeAt(i)) && alnumFrom(s, i + 1));\n}\n\n/**\n * Every character of `s` from index `i` on is an ASCII letter, digit or `-` (`[A-Za-z0-9-]`):\n * a domain label's tail, a service name's tail.\n *\n * @ensures result ⟺ ∀ k ∈ [i, |s|). isAlnumChar(s[k]) ∨ s[k] = \"-\" — the model's AlnumDashFrom\n */\nexport function alnumDashFrom(s: string, i: number): boolean {\n //@ verify\n //@ type i nat\n //@ requires i >= 0\n //@ decreases s.length - i\n //@ ensures \\result <==> forall(k: nat, (i <= k && k < s.length) ==> (isAlnumChar(s.charCodeAt(k)) || s.charCodeAt(k) === 45))\n if (i >= s.length) return true;\n const c = s.charCodeAt(i);\n return (isAlnumChar(c) || c === 45) && alnumDashFrom(s, i + 1);\n}\n\n/**\n * The last index before `end` holding `code`, or -1 (JS `s.lastIndexOf(c)` at end = |s|).\n *\n * @ensures result = -1 ∨ (0 ≤ result < end ∧ s[result] = code ∧ no `code` in (result, end))\n */\nexport function lastIndexOfCode(s: string, code: number, end: number): number {\n //@ verify\n //@ type end nat\n //@ requires 0 <= end && end <= s.length\n //@ decreases end\n //@ ensures \\result === -1 || (0 <= \\result && \\result < end)\n //@ ensures \\result >= 0 ==> s.charCodeAt(\\result) === code\n //@ ensures \\result >= 0 ==> forall(k: nat, (\\result < k && k < end) ==> s.charCodeAt(k) !== code)\n //@ ensures \\result === -1 ==> forall(k: nat, k < end ==> s.charCodeAt(k) !== code)\n if (end === 0) return -1;\n if (s.charCodeAt(end - 1) === code) return end - 1;\n return lastIndexOfCode(s, code, end - 1);\n}\n\n/**\n * No character of `s` from index `i` on is `code`.\n *\n * @ensures result ⟺ ∀ k ∈ [i, |s|). s[k] ≠ code\n */\nexport function lacksCode(s: string, code: number, i: number): boolean {\n //@ verify\n //@ type i nat\n //@ requires 0 <= i && i <= s.length\n //@ decreases s.length - i\n //@ ensures \\result <==> forall(k: nat, (i <= k && k < s.length) ==> s.charCodeAt(k) !== code)\n // `===`, not `>=`: past the end a read is NaN !== code, so `>=` vs `>` would be equivalent\n return i === s.length || (s.charCodeAt(i) !== code && lacksCode(s, code, i + 1));\n}\n\n/**\n * The end of the run of `code` starting at `i`: the first index ≥ i that isn't `code`\n * (skip spaces: `codeRunEnd(header, 32, i)`).\n *\n * @requires i ≤ |s|\n * @ensures i ≤ result ≤ |s| ∧ ∀ k ∈ [i, result). s[k] = code ∧ (result < |s| ⟹ s[result] ≠ code)\n * — exactly the run's end\n */\nexport function codeRunEnd(s: string, code: number, i: number): number {\n //@ verify\n //@ type i nat\n //@ requires 0 <= i && i <= s.length\n //@ requires code >= 0\n //@ decreases s.length - i\n //@ ensures i <= \\result && \\result <= s.length\n //@ ensures forall(k: nat, (i <= k && k < \\result) ==> s.charCodeAt(k) === code)\n //@ ensures \\result < s.length ==> s.charCodeAt(\\result) !== code\n return codeAt(s, i) === code ? codeRunEnd(s, code, i + 1) : i;\n}\n\n/**\n * The first index ≥ `from` holding `code`, or -1 (`indexOf` for one code unit, so \"\\n\" is\n * passed as 10, never as a literal).\n *\n * @ensures result = -1 ∨ (from ≤ result < |s| ∧ s[result] = code), with no `code` in\n * [from, result) — the first one; result = -1 ⟹ none from `from` on\n */\nexport function indexOfCode(s: string, code: number, from: number): number {\n //@ verify\n //@ type from nat\n //@ requires code >= 0 && from >= 0\n //@ decreases s.length - from\n //@ ensures \\result === -1 || (from <= \\result && \\result < s.length)\n //@ ensures \\result >= 0 ==> s.charCodeAt(\\result) === code\n //@ ensures \\result >= 0 ==> forall(k: nat, (from <= k && k < \\result) ==> s.charCodeAt(k) !== code)\n //@ ensures \\result === -1 ==> forall(k: nat, (from <= k && k < s.length) ==> s.charCodeAt(k) !== code)\n const c = codeAt(s, from);\n if (c === code) return from;\n if (c === -1) return -1;\n return indexOfCode(s, code, from + 1);\n}\n\n/**\n * The first index ≥ `i` holding `a` or `b`, or |s| (a run either code ends: a path segment's\n * run to \"/\" or \"?\"). One scan: the lesser of two `indexOfCode` ends is the same index, but\n * its two sides are equal only when both are |s|, a boundary no test can observe.\n *\n * @requires i ≤ |s|\n * @ensures i ≤ result ≤ |s| ∧ ∀ k ∈ [i, result). s[k] ∉ {a, b} ∧ (result < |s| ⟹ s[result] ∈ {a, b})\n * — exactly the first such index\n */\nexport function eitherCodeEnd(s: string, a: number, b: number, i: number): number {\n //@ verify\n //@ type i nat\n //@ requires 0 <= i && i <= s.length\n //@ requires a >= 0 && b >= 0\n //@ decreases s.length - i\n //@ ensures i <= \\result && \\result <= s.length\n //@ ensures forall(k: nat, (i <= k && k < \\result) ==> (s.charCodeAt(k) !== a && s.charCodeAt(k) !== b))\n //@ ensures \\result < s.length ==> (s.charCodeAt(\\result) === a || s.charCodeAt(\\result) === b)\n const c = codeAt(s, i);\n if (c === -1 || c === a || c === b) return i;\n return eitherCodeEnd(s, a, b, i + 1);\n}\n\n/**\n * `s` without one trailing `code` (\"\\r\" before a \"\\n\", say); unchanged otherwise.\n *\n * @ensures s ends with code ⟹ result = s[0, |s| − 1)\n * @ensures otherwise result = s\n */\nexport function dropLast(s: string, code: number): string {\n //@ verify\n //@ requires code >= 0\n //@ ensures (s.length > 0 && s.charCodeAt(s.length - 1) === code) ==> \\result === s.slice(0, s.length - 1)\n //@ ensures !(s.length > 0 && s.charCodeAt(s.length - 1) === code) ==> \\result === s\n return codeAt(s, s.length - 1) === code ? s.slice(0, s.length - 1) : s;\n}\n\n/**\n * `s` without its leading `code` units (every one of them).\n *\n * @ensures exactly the model's LStripCode\n */\nexport function lStripCode(s: string, code: number): string {\n //@ verify\n //@ requires code >= 0\n //@ decreases s.length\n //@ ensures \\result.length <= s.length\n if (codeAt(s, 0) === code) return lStripCode(s.slice(1), code);\n return s;\n}\n\n/**\n * `s` without its trailing `code` units (every one of them).\n *\n * @ensures exactly the model's RStripCode\n */\nexport function rStripCode(s: string, code: number): string {\n //@ verify\n //@ requires code >= 0\n //@ decreases s.length\n //@ ensures \\result.length <= s.length\n if (codeAt(s, s.length - 1) === code) {\n return rStripCode(s.slice(0, s.length - 1), code);\n }\n return s;\n}\n\n/**\n * `s` without its leading and trailing `code` units, the middle kept (`/a/b/` with `/` →\n * `a/b`).\n *\n * @ensures exactly the model's StripCode — neither end is `code` (StripCodeTrims)\n */\nexport function stripCode(s: string, code: number): string {\n //@ verify\n //@ requires code >= 0\n //@ ensures \\result === rStripCode(lStripCode(s, code), code)\n return rStripCode(lStripCode(s, code), code);\n}\n\n/**\n * JS `s.startsWith(x, pos)`, which lsc mistranslates (it drops `pos`). Like JS, a `pos`\n * past the end counts as the end, so the empty string matches anywhere.\n *\n * @ensures pos ≤ |s| ⟹ (result ⟺ pos + |x| ≤ |s| ∧ s[pos, pos + |x|) = x) — so a true\n * result also gives the bounds for slicing after the match\n * @ensures pos > |s| ⟹ (result ⟺ x = \"\")\n */\nexport function startsWithAt(s: string, x: string, pos: number): boolean {\n //@ verify\n //@ type pos nat\n //@ requires pos >= 0\n //@ ensures pos <= s.length ==> (\\result <==> (pos + x.length <= s.length && s.slice(pos, pos + x.length) === x))\n //@ ensures pos > s.length ==> (\\result <==> x.length === 0)\n // Math.min, not a ternary: at pos = |s| both branches agree, so `<` vs `<=` is equivalent\n const at = Math.min(pos, s.length);\n // The slice is clamped to the end, so a too-long x differs by length: no separate fit test\n // (JS slice clamps too, which made one unobservable)\n return s.slice(at, Math.min(at + x.length, s.length)) === x;\n}\n\n/**\n * `s` with A-Z lowercased and every other character kept: what lsc's proofs take\n * `toLowerCase()` to be. JS's `toLowerCase()` also maps non-ASCII letters, some onto ASCII\n * (the Kelvin sign K, U+212A, becomes \"k\") or onto two characters (İ, U+0130), so a proved\n * function that lowercases MUST use this, or the runtime does what the proof says it\n * doesn't.\n *\n * @ensures |result| = |s| ∧ ∀ k < |s|. result[k] = (s[k] ∈ A-Z ? s[k] + 32 : s[k]) — A-Z\n * lowered, every other code unit unchanged; true in JS (a contract `=== s.toLowerCase()` held\n * only in lsc's ASCII model of the built-in, Fable review 2026-11-06). Helper-free, since an\n * importer is given only the helpers its own body calls; exactly the model's LowerAscii in\n * the link\n */\nexport function lowerAscii(s: string): string {\n //@ verify\n //@ decreases s.length\n //@ ensures \\result.length === s.length\n //@ ensures forall(k: nat, k < s.length ==> \\result.charCodeAt(k) === ((s.charCodeAt(k) >= 65 && s.charCodeAt(k) <= 90) ? s.charCodeAt(k) + 32 : s.charCodeAt(k)))\n if (s.length === 0) return \"\";\n const c = s.charCodeAt(0);\n const head =\n c >= 65 && c <= 90 ? \"abcdefghijklmnopqrstuvwxyz\".slice(c - 65, c - 64) : s.slice(0, 1);\n return head + lowerAscii(s.slice(1));\n}\n\n/**\n * `lowerAscii` as a loop: a constant stack depth (and linear time) on long text, where the\n * recursive spec takes a frame and a slice per character.\n *\n * @ensures result = lowerAscii(s)\n */\nexport function lowerAsciiText(s: string): string {\n //@ verify\n //@ ensures \\result === lowerAscii(s)\n let out = \"\";\n let i = 0;\n while (i !== s.length) {\n //@ invariant 0 <= i && i <= s.length\n //@ invariant out + lowerAscii(s.slice(i)) === lowerAscii(s)\n //@ decreases s.length - i\n const c = s.charCodeAt(i);\n out =\n out +\n (c >= 65 && c <= 90 ? \"abcdefghijklmnopqrstuvwxyz\".slice(c - 65, c - 64) : s.slice(i, i + 1));\n i = i + 1;\n }\n return out;\n}\n\n/**\n * Whether `x` from index `k` matches `s` from `pos + k`, code by code, ASCII-lowered. A code\n * past the end of `s` is -1 (`codeAt`), which no code of `x` is, so there is no bound to\n * check (a `pos + |x| ≤ |s|` guard before a slice never changed the answer at runtime, where\n * `slice` clamps: an equivalent mutant, 2026-11-02).\n *\n * @ensures exactly the model's CaselessFrom\n */\nexport function caselessFrom(s: string, x: string, pos: number, k: number): boolean {\n //@ verify\n //@ type pos nat\n //@ type k nat\n //@ requires pos >= 0 && k >= 0 && k <= x.length\n //@ decreases x.length - k\n //@ ensures k === x.length ==> \\result\n if (k === x.length) return true;\n return lowerCode(codeAt(s, pos + k)) === x.charCodeAt(k) && caselessFrom(s, x, pos, k + 1);\n}\n\n/**\n * Whether the text of `s` at `pos`, ASCII-lowered, is `x` (`x` given lowercase): a case-free\n * `startsWith`; callers carry no length guard of their own. Only `pos ≤ |s|` is checked: it\n * decides an empty `x` past the end, the one case the code-by-code test can't see.\n *\n * @ensures result ⟺ pos + |x| ≤ |s| ∧ ∀ j < |x|. lowered(s[pos + j]) = x[j] — the text at pos,\n * ASCII-lowered (A-Z + 32), is x; helper-free; exactly the model's StartsWithCaseless in the link\n */\nexport function startsWithCaseless(s: string, x: string, pos: number): boolean {\n //@ verify\n //@ type pos nat\n //@ requires pos >= 0\n //@ ensures \\result <==> (pos + x.length <= s.length && forall(j: nat, j < x.length ==> ((s.charCodeAt(pos + j) >= 65 && s.charCodeAt(pos + j) <= 90) ? s.charCodeAt(pos + j) + 32 : s.charCodeAt(pos + j)) === x.charCodeAt(j)))\n return pos <= s.length && caselessFrom(s, x, pos, 0);\n}\n\n/**\n * Whether `s` ends with `suffix` (JS one-argument `endsWith`, which lsc reads as its\n * two-argument form; moved from the augur-api generator 2026-11-01).\n *\n * @ensures result ⟺ |s| ≥ |suffix| ∧ s[|s| − |suffix|, |s|) = suffix — exactly the model's EndsWith\n */\nexport function endsWith(s: string, suffix: string): boolean {\n //@ verify\n //@ ensures \\result <==> (s.length >= suffix.length && s.slice(s.length - suffix.length) === suffix)\n // No length test: from max(|s| − |suffix|, 0), a too-long suffix compares unequal by length\n return s.slice(Math.max(s.length - suffix.length, 0)) === suffix;\n}\n\n/**\n * The order of `a` and `b` by UTF-16 code unit from index `i`, as a recursive spec: -1, 0\n * or 1 (JS `<` on strings; a proper prefix comes first). Locale-free, unlike `localeCompare`.\n *\n * @ensures result ∈ {-1, 0, 1} — exactly the model's CompareFrom\n */\nexport function compareFrom(a: string, b: string, i: number): number {\n //@ verify\n //@ type i nat\n //@ requires i >= 0\n //@ decreases a.length - i\n //@ ensures \\result === -1 || \\result === 0 || \\result === 1\n if (i >= a.length) return i >= b.length ? 0 : -1;\n if (i >= b.length) return 1;\n const x = a.charCodeAt(i);\n const y = b.charCodeAt(i);\n if (x < y) return -1;\n if (x > y) return 1;\n return compareFrom(a, b, i + 1);\n}\n\n/**\n * The order of two strings by UTF-16 code unit, for `sort` (what the default `sort` uses on\n * strings), so sorted output never depends on locale.\n *\n * @ensures result = compareFrom(a, b, 0)\n */\nexport function compareCodeUnits(a: string, b: string): number {\n //@ verify\n //@ ensures \\result === compareFrom(a, b, 0)\n return compareFrom(a, b, 0);\n}\n\n/**\n * JS `s.slice(0, n)`: at most `n` characters, clamped to the length. lsc reads a bare\n * `slice(0, n)` without JS's clamp, so use this instead.\n *\n * @ensures result = s[0, min(n, |s|))\n */\nexport function prefix(s: string, n: number): string {\n //@ verify\n //@ type n nat\n //@ requires n >= 0\n //@ ensures n < s.length ==> \\result === s.slice(0, n)\n //@ ensures n >= s.length ==> \\result === s\n // Math.min, not a ternary: JS slice already clamps, so a ternary's branch is unobservable\n return s.slice(0, Math.min(n, s.length));\n}\n\n/**\n * The end of the JS-whitespace (`\\s`) run starting at `i`: the first index ≥ i that is not\n * whitespace, or |s|.\n *\n * @ensures i ≤ result ≤ |s| ∧ s[i, result) all whitespace ∧ (result = |s| ∨ ¬space(s[result]))\n */\nexport function spaceRunEnd(s: string, i: number): number {\n //@ verify\n //@ type i nat\n //@ requires 0 <= i && i <= s.length\n //@ decreases s.length - i\n //@ ensures i <= \\result && \\result <= s.length\n //@ ensures forall(k: nat, (i <= k && k < \\result) ==> isJsSpace(s.charCodeAt(k)))\n //@ ensures \\result < s.length ==> !isJsSpace(s.charCodeAt(\\result))\n // codeAt is -1 at the end, which is no space: the bound needs no test of its own here\n if (!isJsSpace(codeAt(s, i))) return i;\n return spaceRunEnd(s, i + 1);\n}\n\n/**\n * The end of the ASCII-digit run starting at `i` (a regex's `\\d+`, from `i`): the first index\n * ≥ i that is not 0-9, or |s|.\n *\n * @ensures i ≤ result ≤ |s| ∧ s[i, result) all digits ∧ (result = |s| ∨ ¬digit(s[result])) —\n * exactly the model's DigitRunEnd\n */\nexport function digitRunEnd(s: string, i: number): number {\n //@ verify\n //@ type i nat\n //@ requires 0 <= i && i <= s.length\n //@ decreases s.length - i\n //@ ensures i <= \\result && \\result <= s.length\n //@ ensures forall(k: nat, (i <= k && k < \\result) ==> (s.charCodeAt(k) >= 48 && s.charCodeAt(k) <= 57))\n //@ ensures \\result < s.length ==> !(s.charCodeAt(\\result) >= 48 && s.charCodeAt(\\result) <= 57)\n // codeAt is -1 at the end, which is no digit\n if (!isDigit(codeAt(s, i))) return i;\n return digitRunEnd(s, i + 1);\n}\n\n/**\n * A natural number written canonically (`^(0|[1-9][0-9]*)$`): the keys JS objects move\n * first, ahead of their source order.\n *\n * @ensures exactly the model's CanonicalNat, stated over the codes themselves so an importer\n * can use it (a contract naming `digitsFrom` can't be resolved there, models/LSC-GAPS.md)\n */\nexport function isCanonicalNat(s: string): boolean {\n //@ verify\n //@ ensures \\result <==> (s === \"0\" || (s.length > 0 && s.charCodeAt(0) >= 49 && s.charCodeAt(0) <= 57 && forall(k: nat, (1 <= k && k < s.length) ==> (s.charCodeAt(k) >= 48 && s.charCodeAt(k) <= 57))))\n if (s === \"0\") return true;\n const first = codeAt(s, 0);\n return first >= 49 && first <= 57 && digitsFrom(s, 1);\n}\n\n/**\n * The value of a run of decimal digits, most significant first (\"\" is 0).\n *\n * @requires ∀ k ∈ [0, |s|). isDigit(s[k])\n * @ensures exactly the model's DigitsValue (proved in links/utils-strings.dfy)\n */\nexport function digitsValue(s: string): number {\n //@ verify\n //@ requires forall(k: nat, k < s.length ==> (s.charCodeAt(k) >= 48 && s.charCodeAt(k) <= 57))\n //@ decreases s.length\n //@ ensures \\result >= 0\n if (s.length === 0) return 0;\n return digitsValue(s.slice(0, s.length - 1)) * 10 + (s.charCodeAt(s.length - 1) - 48);\n}\n\n/**\n * What a number from the environment means (owner 2026-11-04: a bad one fails at start):\n * \"default\" when unset (\"\": the wrapper reads a missing variable as \"\"), \"value\" when it is\n * a canonical natural number at least `min` (its value is `digitsValue(raw)`), and \"bad\"\n * otherwise: a sign, a space, a fraction, an exponent, hex, text, or below `min`.\n *\n * @ensures exactly the model's EnvNumberOf (proved in links/utils-strings.dfy)\n */\nexport function envNumberKind(raw: string, min: number): string {\n //@ verify\n //@ type min nat\n //@ ensures raw === \"\" ==> \\result === \"default\"\n //@ ensures (raw !== \"\" && !isCanonicalNat(raw)) ==> \\result === \"bad\"\n if (raw === \"\") return \"default\";\n if (!isCanonicalNat(raw)) return \"bad\";\n return digitsValue(raw) < min ? \"bad\" : \"value\";\n}\n\n/**\n * A canonical natural number's value, 0 for any other text (a count written as JSON).\n *\n * @ensures exactly the model's CanonicalNatValue (in the link: `digitsValue` needs the digits\n * isCanonicalNat's contract gives, which a contract can't call for); 0 for other text\n */\nexport function canonicalNatValue(s: string): number {\n //@ verify\n //@ ensures \\result >= 0\n //@ ensures !isCanonicalNat(s) ==> \\result === 0\n if (!isCanonicalNat(s)) return 0;\n return digitsValue(s);\n}\n\n/**\n * The first index ≥ `i` holding a line terminator, or |s|: where a regex `.+` started at `i`\n * stops.\n *\n * @ensures i ≤ result ≤ |s| ∧ no terminator in s[i, result) ∧ (result = |s| ∨ terminator at result)\n */\nexport function lineEnd(s: string, i: number): number {\n //@ verify\n //@ type i nat\n //@ requires 0 <= i && i <= s.length\n //@ decreases s.length - i\n //@ ensures i <= \\result && \\result <= s.length\n //@ ensures forall(k: nat, (i <= k && k < \\result) ==> !isLineTerminator(s.charCodeAt(k)))\n //@ ensures \\result < s.length ==> isLineTerminator(s.charCodeAt(\\result))\n if (i === s.length || isLineTerminator(s.charCodeAt(i))) return i;\n return lineEnd(s, i + 1);\n}\n\n/**\n * The largest p with lo ≤ p < hi whose character is not a line terminator, or -1: where a\n * backtracking regex `.` can start.\n *\n * @ensures result = -1 ∨ (lo ≤ result < hi ∧ ¬terminator(s[result]) ∧ only terminators in (result, hi))\n */\nexport function lastLineCharBelow(s: string, hi: number, lo: number): number {\n //@ verify\n //@ type hi nat\n //@ type lo nat\n //@ requires 0 <= lo && 0 <= hi && hi <= s.length\n //@ decreases hi\n //@ ensures \\result === -1 || (lo <= \\result && \\result < hi)\n //@ ensures \\result >= 0 ==> !isLineTerminator(s.charCodeAt(\\result))\n //@ ensures \\result >= 0 ==> forall(k: nat, (\\result < k && k < hi) ==> isLineTerminator(s.charCodeAt(k)))\n //@ ensures \\result === -1 ==> forall(k: nat, (lo <= k && k < hi) ==> isLineTerminator(s.charCodeAt(k)))\n if (hi <= lo) return -1;\n if (!isLineTerminator(s.charCodeAt(hi - 1))) return hi - 1;\n return lastLineCharBelow(s, hi - 1, lo);\n}\n\n/**\n * Nothing but JS whitespace (`s.trim() === \"\"`).\n *\n * @ensures exactly the model's Blank\n */\nexport function isBlank(s: string): boolean {\n //@ verify\n //@ ensures \\result <==> s.trim() === \"\"\n return s.trim() === \"\";\n}\n\n/**\n * The first index ≥ `i` where `x` occurs in `s`, or -1 (JS `s.indexOf(x, i)` for i ≤ |s|).\n *\n * @ensures result = -1 ∨ (i ≤ result ∧ s[result, result + |x|) = x) — and the first such\n * index: links/utils-strings.dfy proves it is exactly the model's IndexOfFrom (lsc can't\n * give the \"no earlier match\" quantifier a trigger)\n */\nexport function indexOfFrom(s: string, x: string, i: number): number {\n //@ verify\n //@ type i nat\n //@ requires i >= 0 && i <= s.length\n //@ decreases s.length - i\n //@ ensures \\result === -1 || (i <= \\result && \\result + x.length <= s.length)\n //@ ensures \\result >= 0 ==> s.slice(\\result, \\result + x.length) === x\n // A match here, else the end, else the next index: stopping at `i === |s|` (not \"x no\n // longer fits\") leaves no bound whose slip a later, harmless step would hide\n if (startsWithAt(s, x, i)) return i;\n if (i === s.length) return -1;\n return indexOfFrom(s, x, i + 1);\n}\n\n/**\n * `indexOfFrom` as a loop: the same answer at a constant stack depth, for text long enough that\n * one frame per character would overflow the stack (a rendered page, 50–60 KB with its inlined\n * stylesheet). Specs and links use `indexOfFrom`; runtime scans over long text use this.\n *\n * @ensures result = indexOfFrom(s, x, i)\n */\nexport function findFrom(s: string, x: string, i: number): number {\n //@ verify\n //@ type i nat\n //@ requires i >= 0 && i <= s.length\n //@ ensures \\result === indexOfFrom(s, x, i)\n let k = i;\n while (k !== s.length) {\n //@ invariant i <= k && k <= s.length\n //@ invariant indexOfFrom(s, x, k) === indexOfFrom(s, x, i)\n //@ decreases s.length - k\n if (startsWithAt(s, x, k)) return k;\n k = k + 1;\n }\n return startsWithAt(s, x, k) ? k : -1;\n}\n\n/**\n * `indexOfCode` as a loop: the same answer at a constant stack depth (see `findFrom`).\n *\n * @ensures result = indexOfCode(s, code, from)\n */\nexport function findCodeFrom(s: string, code: number, from: number): number {\n //@ verify\n //@ type from nat\n //@ requires code >= 0 && from >= 0\n //@ ensures \\result === indexOfCode(s, code, from)\n let k = from;\n while (k < s.length) {\n //@ invariant from <= k\n //@ invariant indexOfCode(s, code, k) === indexOfCode(s, code, from)\n //@ decreases s.length - k\n if (s.charCodeAt(k) === code) return k;\n k = k + 1;\n }\n return -1;\n}\n\n/**\n * How many times `x` occurs in `s` from `i` on, left to right without overlaps (repeated JS\n * `s.indexOf(x, at + x.length)`).\n *\n * @requires |x| > 0\n * @ensures result ≥ 0 — exactly the model's CountFrom (links/utils-strings.dfy)\n */\nexport function countFrom(s: string, x: string, i: number): number {\n //@ verify\n //@ type i nat\n //@ requires x.length > 0 && i >= 0 && i <= s.length\n //@ decreases s.length - i\n //@ ensures \\result >= 0\n const at = indexOfFrom(s, x, i);\n if (at === -1) return 0;\n return 1 + countFrom(s, x, at + x.length);\n}\n\n/**\n * `countFrom(s, x, 0)` as a loop: a constant stack depth on long text (see `findFrom`).\n *\n * @requires |x| > 0\n * @ensures result = countFrom(s, x, 0)\n */\nexport function countOf(s: string, x: string): number {\n //@ verify\n //@ requires x.length > 0\n //@ ensures \\result === countFrom(s, x, 0)\n let n = 0;\n let i = 0;\n let at = findFrom(s, x, 0);\n while (at !== -1) {\n //@ invariant 0 <= i && i <= s.length\n //@ invariant at === indexOfFrom(s, x, i)\n //@ invariant n + countFrom(s, x, i) === countFrom(s, x, 0)\n //@ decreases s.length - i\n n = n + 1;\n i = at + x.length;\n at = findFrom(s, x, i);\n }\n return n;\n}\n\n/**\n * The text before the first `code`, or all of it when there is none (JS `s.split(c)[0]`).\n *\n * @ensures result = s[0, first code) when s holds one, else s — the model's UntilCode\n */\nexport function untilCode(s: string, code: number): string {\n //@ verify\n //@ requires code >= 0\n //@ ensures \\result === (indexOfCode(s, code, 0) >= 0 && indexOfCode(s, code, 0) <= s.length ? s.slice(0, indexOfCode(s, code, 0)) : s)\n const k = indexOfCode(s, code, 0);\n return k >= 0 ? s.slice(0, k) : s;\n}\n\n/**\n * `s` from `i` on split at every `code` (JS `s.split(c)` at i = 0, for a one-character\n * separator): always at least one part.\n *\n * @ensures |result| ≥ 1 — exactly the model's SplitCodeFrom (links/utils-strings.dfy)\n */\nexport function splitCodeFrom(s: string, code: number, i: number): string[] {\n //@ verify\n //@ type i nat\n //@ requires code >= 0 && i >= 0 && i <= s.length\n //@ decreases s.length - i\n //@ ensures \\result.length > 0\n const k = indexOfCode(s, code, i);\n if (k === -1) return [s.slice(i)];\n return [s.slice(i, k), ...splitCodeFrom(s, code, k + 1)];\n}\n\n/**\n * Every run of JS whitespace in `s` from `i` on as one space (JS `s.replace(/\\s+/g, \" \")` at\n * i = 0).\n *\n * @ensures |result| ≤ |s| − i — exactly the model's CollapseSpacesFrom (links/utils-strings.dfy)\n */\nexport function collapseSpacesFrom(s: string, i: number): string {\n //@ verify\n //@ type i nat\n //@ requires 0 <= i && i <= s.length\n //@ decreases s.length - i\n //@ ensures \\result.length <= s.length - i\n if (i === s.length) return \"\";\n if (isJsSpace(s.charCodeAt(i))) return \" \" + collapseSpacesFrom(s, spaceRunEnd(s, i));\n return s.slice(i, i + 1) + collapseSpacesFrom(s, i + 1);\n}\n\n/**\n * `collapseSpacesFrom(s, 0)` at a constant stack depth (a page's text is tens of KB).\n *\n * @ensures result = collapseSpacesFrom(s, 0)\n */\nexport function collapseSpaces(s: string): string {\n //@ verify\n //@ ensures \\result === collapseSpacesFrom(s, 0)\n let out = \"\";\n let i = 0;\n while (i < s.length) {\n //@ invariant 0 <= i && i <= s.length\n //@ invariant out + collapseSpacesFrom(s, i) === collapseSpacesFrom(s, 0)\n //@ decreases s.length - i\n if (isJsSpace(s.charCodeAt(i))) {\n out = out + \" \";\n // the run's end as a loop too: spaceRunEnd takes a frame per space (Fable review 2026-11-06)\n let e = i + 1;\n while (e !== s.length && isJsSpace(s.charCodeAt(e))) {\n //@ invariant i < e && e <= s.length\n //@ invariant forall(k: nat, (i <= k && k < e) ==> isJsSpace(s.charCodeAt(k)))\n //@ decreases s.length - e\n e = e + 1;\n }\n i = e;\n } else {\n out = out + s.slice(i, i + 1);\n i = i + 1;\n }\n }\n return out;\n}\n\n/**\n * `n` spaces.\n *\n * @ensures result = \" \" repeated n times — the model's Spaces\n */\nexport function spaces(n: number): string {\n //@ verify\n //@ type n nat\n //@ requires n >= 0\n //@ decreases n\n //@ ensures \\result.length === n\n //@ ensures forall(k: nat, k < n ==> \\result.charCodeAt(k) === 32)\n // `<= 0`, not `=== 0`: the same for a nat, and a fraction a caller slips in (outside the\n // contract) ends instead of recursing forever (Fable review 2026-11-06: spaces(0.5))\n if (n <= 0) return \"\";\n return \" \" + spaces(n - 1);\n}\n\n/**\n * A line feed, `\"\\n\"`, for proved text that spans lines: lsc emits a `\"\\n\"` escape raw, which\n * Dafny cannot parse (models/LSC-GAPS.md), so the contract pins it by code unit and the body is\n * a template literal holding the line break itself.\n *\n * @ensures result = \"\\n\" — one code unit, 10\n */\nexport function lineFeed(): string {\n //@ verify\n //@ ensures \\result.length === 1 && \\result.charCodeAt(0) === 10\n return `\n`;\n}\n\n/**\n * `s` padded on the left with spaces to `width` (JS `s.padStart(width)`).\n *\n * @ensures result = Spaces(width − |s|) + s when width > |s|, else s\n */\nexport function padLeft(s: string, width: number): string {\n //@ verify\n //@ ensures width <= s.length ==> \\result === s\n // width > |s| ⟹ spaces(width − |s|) + s: a hand ensures in strings.dfy, so importers'\n // axioms name no helper (models/LSC-GAPS.md). Math.max, not a ternary: at width = |s|\n // both branches agree (spaces(0) is \"\"), so `>` vs `>=` would be equivalent.\n return spaces(Math.max(width - s.length, 0)) + s;\n}\n\n/**\n * `s` padded on the right with spaces to `width` (JS `s.padEnd(width)`).\n *\n * @ensures result = s + Spaces(width − |s|) when width > |s|, else s\n */\nexport function padRight(s: string, width: number): string {\n //@ verify\n //@ ensures width <= s.length ==> \\result === s\n // width > |s| ⟹ s + spaces(width − |s|): a hand ensures in strings.dfy, as padLeft's.\n return s + spaces(Math.max(width - s.length, 0));\n}\n\n/**\n * An optional part of a key: `tag` then `text`, or nothing when `text` is empty, so an absent\n * part never leaves a bare tag.\n *\n * @ensures result = \"\" when text = \"\", else tag + text — exactly the model's KeyPart\n */\nexport function keyPart(tag: string, text: string): string {\n //@ verify\n //@ ensures \\result === (text === \"\" ? \"\" : tag + text)\n return text === \"\" ? \"\" : tag + text;\n}\n\n/**\n * Two texts joined by one space: the one rule behind a loader key's `<column> <direction>`, a\n * sync line's `METHOD /path` and a field's description then note.\n *\n * @ensures result = a + \" \" + b — exactly the model's SpaceJoined\n */\nexport function spaceJoined(a: string, b: string): string {\n //@ verify\n //@ ensures \\result === a + \" \" + b\n return a + \" \" + b;\n}\n\n/**\n * The first code point of `w` as text: a surrogate pair whole, else the first code unit, or \"\"\n * (Fable review 2026-11-06: an astral initial was a lone surrogate).\n *\n * @ensures exactly the model's FirstChar\n */\nexport function firstCodePoint(w: string): string {\n //@ verify\n //@ ensures \\result === ((w.length >= 2 && w.charCodeAt(0) >= 55296 && w.charCodeAt(0) <= 56319 && w.charCodeAt(1) >= 56320 && w.charCodeAt(1) <= 57343) ? w.slice(0, 2) : (w.length > 0 ? w.slice(0, 1) : \"\"))\n if (w.length >= 2) {\n const hi = w.charCodeAt(0);\n const lo = w.charCodeAt(1);\n if (hi >= 55296 && hi <= 56319 && lo >= 56320 && lo <= 57343) return w.slice(0, 2);\n }\n return w.length > 0 ? w.slice(0, 1) : \"\";\n}\n\n/**\n * An ASCII letter (A-Z, a-z) somewhere in `w` from `i` on (moved from readability.ts\n * 2026-11-06, so `readableWords`' contract can name it and importers resolve it).\n *\n * @ensures result ⟺ ∃ k ∈ [i, |w|). w[k] ∈ A-Z ∪ a-z — at i = 0 exactly the model's HasAsciiLetter\n */\nexport function hasAsciiLetterFrom(w: string, i: number): boolean {\n //@ verify\n //@ type i nat\n //@ requires i >= 0\n //@ decreases w.length - i\n //@ ensures \\result <==> exists(k: nat, i <= k && k < w.length && ((w.charCodeAt(k) >= 65 && w.charCodeAt(k) <= 90) || (w.charCodeAt(k) >= 97 && w.charCodeAt(k) <= 122)))\n if (i >= w.length) return false;\n const c = w.charCodeAt(i);\n if ((c >= 65 && c <= 90) || (c >= 97 && c <= 122)) return true;\n return hasAsciiLetterFrom(w, i + 1);\n}\n\n/**\n * `s` with a-z uppercased and every other character kept, the mirror of `lowerAscii`: JS's\n * `toUpperCase()` also maps non-ASCII letters (ß becomes \"SS\").\n *\n * @ensures |result| = |s| ∧ ∀ k < |s|. result[k] = (s[k] ∈ a-z ? s[k] − 32 : s[k]) — a-z\n * raised, every other code unit unchanged; exactly the model's UpperAscii in the link\n */\nexport function upperAscii(s: string): string {\n //@ verify\n //@ decreases s.length\n //@ ensures \\result.length === s.length\n //@ ensures forall(k: nat, k < s.length ==> \\result.charCodeAt(k) === ((s.charCodeAt(k) >= 97 && s.charCodeAt(k) <= 122) ? s.charCodeAt(k) - 32 : s.charCodeAt(k)))\n if (s.length === 0) return \"\";\n const c = s.charCodeAt(0);\n const head =\n c >= 97 && c <= 122 ? \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\".slice(c - 97, c - 96) : s.slice(0, 1);\n return head + upperAscii(s.slice(1));\n}\n","//@ backend dafny\nimport { isWordChar } from \"@atlas/foundation/chars\";\nimport {\n codeAt,\n digitRunEnd,\n digitsValue,\n endsWith,\n spaceRunEnd,\n startsWithAt,\n} from \"@atlas/utils/strings\";\n\n/* augur-doctor's decisions, verified with LemmaScript → Dafny (model: models/AugurConfig.dfy;\n link: models/links/augur-config-doctor-rules.dfy). What a check reads from the site (a file\n exists, its text holds a string or matches a regex) is a fact handed in by facts.ts. */\n\n/** A check's outcome. */\nexport type Status = \"PASS\" | \"FAIL\" | \"WARN\" | \"SUGGEST\" | \"SKIP\";\n\n/**\n * A file that should use a factory: there and using it passes; there without it warns; missing\n * fails (site-config, server-site, ssr-options).\n *\n * @ensures exactly the model's FileUses\n */\nexport function fileUses(found: boolean, uses: boolean): Status {\n //@ verify\n //@ ensures found && uses ==> \\result === \"PASS\"\n //@ ensures found && !uses ==> \\result === \"WARN\"\n //@ ensures !found ==> \\result === \"FAIL\"\n if (found && uses) return \"PASS\";\n return found ? \"WARN\" : \"FAIL\";\n}\n\n/**\n * actions: re-exporting passes, there otherwise warns; missing passes with the proxy pattern.\n *\n * @ensures exactly the model's ActionsStatus\n */\nexport function actionsStatus(found: boolean, reExports: boolean, usesProxy: boolean): Status {\n //@ verify\n //@ ensures found && reExports ==> \\result === \"PASS\"\n //@ ensures found && !reExports ==> \\result === \"WARN\"\n //@ ensures !found && usesProxy ==> \\result === \"PASS\"\n //@ ensures !found && !usesProxy ==> \\result === \"FAIL\"\n if (found) return reExports ? \"PASS\" : \"WARN\";\n return usesProxy ? \"PASS\" : \"FAIL\";\n}\n\n/**\n * site-hooks: createSiteHooks or another hooks setup passes; a file without either warns.\n *\n * @ensures exactly the model's SiteHooksStatus\n */\nexport function siteHooksStatus(\n found: boolean,\n createSiteHooks: boolean,\n hooksSetup: boolean,\n): Status {\n //@ verify\n //@ ensures found && (createSiteHooks || hooksSetup) ==> \\result === \"PASS\"\n //@ ensures found && !(createSiteHooks || hooksSetup) ==> \\result === \"WARN\"\n //@ ensures !found ==> \\result === \"FAIL\"\n return fileUses(found, createSiteHooks || hooksSetup);\n}\n\n/**\n * tsconfig: extends augur-config/tsconfig/next passes; another augur-config preset warns; else\n * (or no tsconfig.json) fails.\n *\n * @ensures exactly the model's TsconfigStatus\n */\nexport function tsconfigStatus(\n found: boolean,\n extendsNext: boolean,\n extendsAugur: boolean,\n): Status {\n //@ verify\n //@ ensures !found ==> \\result === \"FAIL\"\n //@ ensures found && extendsNext ==> \\result === \"PASS\"\n //@ ensures found && !extendsNext && extendsAugur ==> \\result === \"WARN\"\n //@ ensures found && !extendsNext && !extendsAugur ==> \\result === \"FAIL\"\n if (!found) return \"FAIL\";\n if (extendsNext) return \"PASS\";\n return extendsAugur ? \"WARN\" : \"FAIL\";\n}\n\n/**\n * eslint and prettier: a config using the shared preset passes; every other case fails.\n *\n * @ensures exactly the model's PresetStatus\n */\nexport function presetStatus(found: boolean, usesPreset: boolean): Status {\n //@ verify\n //@ ensures \\result === (found && usesPreset ? \"PASS\" : \"FAIL\")\n return found && usesPreset ? \"PASS\" : \"FAIL\";\n}\n\n/**\n * eslint-deprecated: skipped without an ESLint config; on passes; named otherwise warns.\n *\n * @ensures exactly the model's DeprecatedStatus\n */\nexport function deprecatedStatus(hasEslint: boolean, ruleOn: boolean, named: boolean): Status {\n //@ verify\n //@ ensures !hasEslint ==> \\result === \"SKIP\"\n //@ ensures hasEslint && ruleOn ==> \\result === \"PASS\"\n //@ ensures hasEslint && !ruleOn && named ==> \\result === \"WARN\"\n //@ ensures hasEslint && !ruleOn && !named ==> \\result === \"FAIL\"\n if (!hasEslint) return \"SKIP\";\n if (ruleOn) return \"PASS\";\n return named ? \"WARN\" : \"FAIL\";\n}\n\n/**\n * knip: config and dependency pass; the dependency alone warns; else fails.\n *\n * @ensures exactly the model's KnipStatus\n */\nexport function knipStatus(hasConfig: boolean, hasDep: boolean): Status {\n //@ verify\n //@ ensures hasConfig && hasDep ==> \\result === \"PASS\"\n //@ ensures !hasConfig && hasDep ==> \\result === \"WARN\"\n //@ ensures !hasDep ==> \\result === \"FAIL\"\n if (!hasDep) return \"FAIL\";\n return hasConfig ? \"PASS\" : \"WARN\";\n}\n\n/**\n * icons: react-icons alone passes; heroicons or lucide fails; none warns.\n *\n * @ensures exactly the model's IconsStatus\n */\nexport function iconsStatus(reactIcons: boolean, heroicons: boolean, lucide: boolean): Status {\n //@ verify\n //@ ensures reactIcons && !heroicons && !lucide ==> \\result === \"PASS\"\n //@ ensures (heroicons || lucide) ==> \\result === \"FAIL\"\n //@ ensures !reactIcons && !heroicons && !lucide ==> \\result === \"WARN\"\n if (heroicons || lucide) return \"FAIL\";\n return reactIcons ? \"PASS\" : \"WARN\";\n}\n\n/**\n * tailwind: a range starting \"^4\" or \"4\" passes, \"^3\" or \"3\" fails, anything else warns.\n *\n * @ensures exactly the model's TailwindStatus\n */\nexport function tailwindStatus(range: string): Status {\n //@ verify\n //@ ensures (startsWithAt(range, \"^4\", 0) || startsWithAt(range, \"4\", 0)) ==> \\result === \"PASS\"\n //@ ensures !(startsWithAt(range, \"^4\", 0) || startsWithAt(range, \"4\", 0)) && (startsWithAt(range, \"^3\", 0) || startsWithAt(range, \"3\", 0)) ==> \\result === \"FAIL\"\n //@ ensures !(startsWithAt(range, \"^4\", 0) || startsWithAt(range, \"4\", 0)) && !(startsWithAt(range, \"^3\", 0) || startsWithAt(range, \"3\", 0)) ==> \\result === \"WARN\"\n if (startsWithAt(range, \"^4\", 0) || startsWithAt(range, \"4\", 0)) return \"PASS\";\n if (startsWithAt(range, \"^3\", 0) || startsWithAt(range, \"3\", 0)) return \"FAIL\";\n return \"WARN\";\n}\n\n/** What augur-doctor reads from next.config. */\nexport interface NextFacts {\n hasConfig: boolean;\n hasExternal: boolean;\n externalHasServer: boolean;\n usesIoredis: boolean;\n externalHasIoredis: boolean;\n hasAllHeaders: boolean;\n hasHeaders: boolean;\n hasOptimize: boolean;\n hasStrict: boolean;\n hasAgrMedia: boolean;\n hasImages: boolean;\n}\n\n/**\n * next-external: augur-server MUST NOT be externalized; no serverExternalPackages warns.\n *\n * @ensures exactly the model's NextExternalStatus\n */\nexport function nextExternalStatus(n: NextFacts): Status {\n //@ verify\n //@ ensures !n.hasConfig ==> \\result === \"FAIL\"\n //@ ensures n.hasConfig && n.hasExternal ==> \\result === (n.externalHasServer ? \"FAIL\" : \"PASS\")\n //@ ensures n.hasConfig && !n.hasExternal ==> \\result === \"WARN\"\n if (!n.hasConfig) return \"FAIL\";\n if (n.hasExternal) return n.externalHasServer ? \"FAIL\" : \"PASS\";\n return \"WARN\";\n}\n\n/**\n * next-ioredis: checked only when the site uses ioredis and has serverExternalPackages.\n *\n * @ensures exactly the model's IoredisStatus\n */\nexport function ioredisStatus(n: NextFacts): Status {\n //@ verify\n //@ ensures (!n.hasConfig || !n.hasExternal || !n.usesIoredis) ==> \\result === \"SKIP\"\n //@ ensures n.hasConfig && n.hasExternal && n.usesIoredis ==> \\result === (n.externalHasIoredis ? \"PASS\" : \"WARN\")\n if (!n.hasConfig || !n.hasExternal || !n.usesIoredis) return \"SKIP\";\n return n.externalHasIoredis ? \"PASS\" : \"WARN\";\n}\n\n/**\n * next-headers: HSTS, X-Content-Type-Options and Permissions-Policy all pass; some warns.\n *\n * @ensures exactly the model's HeadersStatus\n */\nexport function headersStatus(n: NextFacts): Status {\n //@ verify\n //@ ensures !n.hasConfig ==> \\result === \"FAIL\"\n //@ ensures n.hasConfig && n.hasAllHeaders ==> \\result === \"PASS\"\n //@ ensures n.hasConfig && !n.hasAllHeaders && n.hasHeaders ==> \\result === \"WARN\"\n //@ ensures n.hasConfig && !n.hasAllHeaders && !n.hasHeaders ==> \\result === \"FAIL\"\n if (!n.hasConfig) return \"FAIL\";\n if (n.hasAllHeaders) return \"PASS\";\n return n.hasHeaders ? \"WARN\" : \"FAIL\";\n}\n\n/**\n * next-optimize: optimizePackageImports set passes, else fails.\n *\n * @ensures exactly the model's OptimizeStatus\n */\nexport function optimizeStatus(n: NextFacts): Status {\n //@ verify\n //@ ensures \\result === (n.hasConfig && n.hasOptimize ? \"PASS\" : \"FAIL\")\n return n.hasConfig && n.hasOptimize ? \"PASS\" : \"FAIL\";\n}\n\n/**\n * next-strict: reactStrictMode set passes, else warns; skipped with no config.\n *\n * @ensures exactly the model's StrictStatus\n */\nexport function strictStatus(n: NextFacts): Status {\n //@ verify\n //@ ensures !n.hasConfig ==> \\result === \"SKIP\"\n //@ ensures n.hasConfig ==> \\result === (n.hasStrict ? \"PASS\" : \"WARN\")\n if (!n.hasConfig) return \"SKIP\";\n return n.hasStrict ? \"PASS\" : \"WARN\";\n}\n\n/**\n * image-loader: agr.media in next.config passes, else warns; skipped with no config.\n *\n * @ensures exactly the model's ImageLoaderStatus\n */\nexport function imageLoaderStatus(n: NextFacts): Status {\n //@ verify\n //@ ensures !n.hasConfig ==> \\result === \"SKIP\"\n //@ ensures n.hasConfig ==> \\result === (n.hasAgrMedia ? \"PASS\" : \"WARN\")\n if (!n.hasConfig) return \"SKIP\";\n return n.hasAgrMedia ? \"PASS\" : \"WARN\";\n}\n\n/**\n * contract-tests: present passes, else fails.\n *\n * @ensures exactly the model's ContractTestsStatus\n */\nexport function contractTestsStatus(present: boolean): Status {\n //@ verify\n //@ ensures \\result === (present ? \"PASS\" : \"FAIL\")\n return present ? \"PASS\" : \"FAIL\";\n}\n\n/**\n * no-wrapper: skipped without lib/; a client file that wraps AugurAPI fails.\n *\n * @ensures exactly the model's NoWrapperStatus\n */\nexport function noWrapperStatus(hasLib: boolean, wraps: boolean): Status {\n //@ verify\n //@ ensures !hasLib ==> \\result === \"SKIP\"\n //@ ensures hasLib ==> \\result === (wraps ? \"FAIL\" : \"PASS\")\n if (!hasLib) return \"SKIP\";\n return wraps ? \"FAIL\" : \"PASS\";\n}\n\n/**\n * auth: a factory passes; raw NextAuth fails; otherwise (or no auth file) warns.\n *\n * @ensures exactly the model's AuthStatus\n */\nexport function authStatus(found: boolean, usesFactory: boolean, rawNextAuth: boolean): Status {\n //@ verify\n //@ ensures found && usesFactory ==> \\result === \"PASS\"\n //@ ensures found && !usesFactory && rawNextAuth ==> \\result === \"FAIL\"\n //@ ensures !(found && usesFactory) && !(found && rawNextAuth) ==> \\result === \"WARN\"\n if (found && usesFactory) return \"PASS\";\n return found && rawNextAuth ? \"FAIL\" : \"WARN\";\n}\n\n/**\n * quality-script: typecheck, lint and test all named passes; incomplete warns; none fails.\n *\n * @ensures exactly the model's QualityStatus\n */\nexport function qualityStatus(hasScript: boolean, complete: boolean): Status {\n //@ verify\n //@ ensures !hasScript ==> \\result === \"FAIL\"\n //@ ensures hasScript ==> \\result === (complete ? \"PASS\" : \"WARN\")\n if (!hasScript) return \"FAIL\";\n return complete ? \"PASS\" : \"WARN\";\n}\n\n/**\n * pre-commit: lefthook's pre-commit section with lint-staged passes; else a suggestion.\n *\n * @ensures exactly the model's PreCommitStatus\n */\nexport function preCommitStatus(hasPreCommit: boolean, hasLintStaged: boolean): Status {\n //@ verify\n //@ ensures \\result === (hasPreCommit && hasLintStaged ? \"PASS\" : \"SUGGEST\")\n return hasPreCommit && hasLintStaged ? \"PASS\" : \"SUGGEST\";\n}\n\n/**\n * proxy-local-hooks: local useQuery hooks are a suggestion.\n *\n * @ensures exactly the model's LocalHooksStatus\n */\nexport function localHooksStatus(hasUseQuery: boolean): Status {\n //@ verify\n //@ ensures \\result === (hasUseQuery ? \"SUGGEST\" : \"PASS\")\n return hasUseQuery ? \"SUGGEST\" : \"PASS\";\n}\n\n/**\n * proxy-server-query: either proxy form passes, else a suggestion.\n *\n * @ensures exactly the model's ServerQueryStatus\n */\nexport function serverQueryStatus(usesServerProxy: boolean, usesAugurOptions: boolean): Status {\n //@ verify\n //@ ensures \\result === (usesServerProxy || usesAugurOptions ? \"PASS\" : \"SUGGEST\")\n return usesServerProxy || usesAugurOptions ? \"PASS\" : \"SUGGEST\";\n}\n\n/**\n * query-client-scope and query-gc-time: any offending file fails.\n *\n * @ensures exactly the model's NoOffenderStatus\n */\nexport function noOffenderStatus(offenders: number): Status {\n //@ verify\n //@ ensures \\result === (offenders > 0 ? \"FAIL\" : \"PASS\")\n return offenders > 0 ? \"FAIL\" : \"PASS\";\n}\n\n/**\n * query-gc-time's offender (#94): a file that sets a finite gcTime, or that spreads a\n * CACHE_CONFIG tier while the site's augur-utils may predate the server-safe tiers (a spread\n * on a fixed augur-utils is safe; owner 2026-11-07: \"only for older version before this fix\").\n *\n * @ensures exactly the model's GcTimeOffender\n */\nexport function gcTimeOffender(\n finiteLiteral: boolean,\n spreadsTier: boolean,\n utilsBeforeFix: boolean,\n): boolean {\n //@ verify\n //@ ensures \\result <==> (finiteLiteral || (spreadsTier && utilsBeforeFix))\n return finiteLiteral || (spreadsTier && utilsBeforeFix);\n}\n\n/**\n * The first augur-utils with server-safe CACHE_CONFIG tiers: 2026.11.3.\n *\n * @ensures exactly the model's ServerSafeTiersVersion\n */\nexport function serverSafeTiersVersion(year: number, minor: number, patch: number): boolean {\n //@ verify\n //@ ensures \\result === (year > 2026 || (year === 2026 && minor > 11) || (year === 2026 && minor === 11 && patch >= 3))\n return (\n year > 2026 || (year === 2026 && minor > 11) || (year === 2026 && minor === 11 && patch >= 3)\n );\n}\n\n/**\n * The site's augur-utils range may give a version before the fix: its lowest version (the\n * first x.y.z in the range, `parsed`) is older. No recognised version is not.\n *\n * @ensures exactly the model's UtilsBeforeServerSafeTiers\n */\nexport function utilsBeforeServerSafeTiers(\n parsed: boolean,\n year: number,\n minor: number,\n patch: number,\n): boolean {\n //@ verify\n //@ ensures \\result === (parsed && !serverSafeTiersVersion(year, minor, patch))\n return parsed && !serverSafeTiersVersion(year, minor, patch);\n}\n\n/* query-gc-time's text scans (#94): each is exactly the regex it replaced, which the tests keep\n as its oracle. A `…From` function is the spec (one call per character); the scan run over a\n whole file is its loop twin, proved equal, at a constant stack depth. */\n\n/** A word character (`\\w`) at `i`; none past the end. */\nfunction wordAt(s: string, i: number): boolean {\n //@ verify\n //@ type i nat\n //@ ensures \\result <==> (i < s.length && isWordChar(s.charCodeAt(i)))\n return isWordChar(codeAt(s, i));\n}\n\n/**\n * After `gcTime:`, an allowed value: `Infinity` or `0` as a whole word, or a `resolveGcTime(`\n * call (`(?!Infinity\\b|resolveGcTime\\(|0\\b)`).\n *\n * @ensures exactly the model's AllowedGcValue\n */\nfunction allowedGcValue(s: string, p: number): boolean {\n //@ verify\n //@ type p nat\n //@ ensures \\result <==> ((startsWithAt(s, \"Infinity\", p) && !wordAt(s, p + 8)) || startsWithAt(s, \"resolveGcTime(\", p) || (startsWithAt(s, \"0\", p) && !wordAt(s, p + 1)))\n return (\n (startsWithAt(s, \"Infinity\", p) && !wordAt(s, p + 8)) ||\n startsWithAt(s, \"resolveGcTime(\", p) ||\n (startsWithAt(s, \"0\", p) && !wordAt(s, p + 1))\n );\n}\n\n/**\n * `gcTime\\s*:\\s*(?!Infinity\\b|resolveGcTime\\(|0\\b)\\S` at `k`: \"gcTime\", spaces, \":\", spaces,\n * then a character that is no space and no allowed value.\n *\n * @ensures exactly the model's FiniteGcTimeAt\n */\nfunction finiteGcTimeAt(s: string, k: number): boolean {\n //@ verify\n //@ type k nat\n //@ requires k <= s.length\n //@ ensures !startsWithAt(s, \"gcTime\", k) ==> !\\result\n if (!startsWithAt(s, \"gcTime\", k)) return false;\n const a = spaceRunEnd(s, k + 6);\n if (codeAt(s, a) !== 58) return false;\n const p = spaceRunEnd(s, a + 1);\n return p < s.length && !allowedGcValue(s, p);\n}\n\n/**\n * The text sets a finite gcTime somewhere from `k` on (the spec; see `hasFiniteGcTime`).\n *\n * @ensures exactly the model's HasFiniteGcTimeFrom\n */\nexport function hasFiniteGcTimeFrom(s: string, k: number): boolean {\n //@ verify\n //@ type k nat\n //@ requires k <= s.length\n //@ decreases s.length - k\n //@ ensures k === s.length ==> !\\result\n return k < s.length && (finiteGcTimeAt(s, k) || hasFiniteGcTimeFrom(s, k + 1));\n}\n\n/**\n * The text sets a finite gcTime (`/gcTime\\s*:\\s*(?!Infinity\\b|resolveGcTime\\(|0\\b)\\S/.test`),\n * as a loop.\n *\n * @ensures result = hasFiniteGcTimeFrom(s, 0)\n */\nexport function hasFiniteGcTime(s: string): boolean {\n //@ verify\n //@ ensures \\result === hasFiniteGcTimeFrom(s, 0)\n let k = 0;\n while (k < s.length) {\n //@ invariant 0 <= k && k <= s.length\n //@ invariant hasFiniteGcTimeFrom(s, k) === hasFiniteGcTimeFrom(s, 0)\n //@ decreases s.length - k\n if (finiteGcTimeAt(s, k)) return true;\n k = k + 1;\n }\n return false;\n}\n\n/**\n * `\\.\\.\\.\\s*CACHE_CONFIG\\.` at `k`.\n *\n * @ensures exactly the model's TierSpreadAt\n */\nfunction tierSpreadAt(s: string, k: number): boolean {\n //@ verify\n //@ type k nat\n //@ requires k <= s.length\n //@ ensures !startsWithAt(s, \"...\", k) ==> !\\result\n return startsWithAt(s, \"...\", k) && startsWithAt(s, \"CACHE_CONFIG.\", spaceRunEnd(s, k + 3));\n}\n\n/**\n * A CACHE_CONFIG tier is spread somewhere from `k` on (the spec; see `hasTierSpread`).\n *\n * @ensures exactly the model's HasTierSpreadFrom\n */\nexport function hasTierSpreadFrom(s: string, k: number): boolean {\n //@ verify\n //@ type k nat\n //@ requires k <= s.length\n //@ decreases s.length - k\n //@ ensures k === s.length ==> !\\result\n return k < s.length && (tierSpreadAt(s, k) || hasTierSpreadFrom(s, k + 1));\n}\n\n/**\n * A CACHE_CONFIG tier is spread (`/\\.\\.\\.\\s*CACHE_CONFIG\\./.test`), as a loop.\n *\n * @ensures result = hasTierSpreadFrom(s, 0)\n */\nexport function hasTierSpread(s: string): boolean {\n //@ verify\n //@ ensures \\result === hasTierSpreadFrom(s, 0)\n let k = 0;\n while (k < s.length) {\n //@ invariant 0 <= k && k <= s.length\n //@ invariant hasTierSpreadFrom(s, k) === hasTierSpreadFrom(s, 0)\n //@ decreases s.length - k\n if (tierSpreadAt(s, k)) return true;\n k = k + 1;\n }\n return false;\n}\n\n/** An x.y.z version found in a range: whether there is one, and its three numbers. */\ninterface Version {\n found: boolean;\n year: number;\n minor: number;\n patch: number;\n}\n\nfunction noVersion(): Version {\n //@ verify\n //@ ensures !\\result.found && \\result.year === 0 && \\result.minor === 0 && \\result.patch === 0\n return { found: false, year: 0, minor: 0, patch: 0 };\n}\n\n/**\n * `(\\d+)\\.(\\d+)\\.(\\d+)` at `k`: three digit runs, the first two each ended by a \".\".\n *\n * @ensures exactly the model's VersionAt\n */\nfunction versionAt(s: string, k: number): Version {\n //@ verify\n //@ type k nat\n //@ requires k <= s.length\n //@ ensures \\result.found ==> \\result.year >= 0\n const a = digitRunEnd(s, k);\n if (a === k || codeAt(s, a) !== 46) return noVersion();\n const b = digitRunEnd(s, a + 1);\n if (b === a + 1 || codeAt(s, b) !== 46) return noVersion();\n const c = digitRunEnd(s, b + 1);\n if (c === b + 1) return noVersion();\n return {\n found: true,\n year: digitsValue(s.slice(k, a)),\n minor: digitsValue(s.slice(a + 1, b)),\n patch: digitsValue(s.slice(b + 1, c)),\n };\n}\n\n/**\n * The first x.y.z from `k` on, as `/(\\d+)\\.(\\d+)\\.(\\d+)/.exec` finds it (each start in turn).\n *\n * @ensures exactly the model's FirstVersionFrom\n */\nfunction firstVersionFrom(s: string, k: number): Version {\n //@ verify\n //@ type k nat\n //@ requires k <= s.length\n //@ decreases s.length - k\n //@ ensures k === s.length ==> !\\result.found\n if (k === s.length) return noVersion();\n const v = versionAt(s, k);\n return v.found ? v : firstVersionFrom(s, k + 1);\n}\n\n/**\n * A file offends query-gc-time: its text, and whether the site's augur-utils predates the fix.\n *\n * @ensures exactly the model's GcTimeOffenderIn\n */\nexport function gcTimeOffenderIn(text: string, utilsBeforeFix: boolean): boolean {\n //@ verify\n //@ ensures \\result === gcTimeOffender(hasFiniteGcTimeFrom(text, 0), hasTierSpreadFrom(text, 0), utilsBeforeFix)\n return gcTimeOffender(hasFiniteGcTime(text), hasTierSpread(text), utilsBeforeFix);\n}\n\n/**\n * The site's augur-utils range predates the fix: its first x.y.z is before 2026.11.3.\n *\n * @ensures exactly the model's UtilsRangeBeforeFix\n */\nexport function utilsRangeBeforeFix(range: string): boolean {\n //@ verify\n //@ ensures \\result === utilsBeforeServerSafeTiers(firstVersionFrom(range, 0).found, firstVersionFrom(range, 0).year, firstVersionFrom(range, 0).minor, firstVersionFrom(range, 0).patch)\n const v = firstVersionFrom(range, 0);\n return utilsBeforeServerSafeTiers(v.found, v.year, v.minor, v.patch);\n}\n\n/**\n * Which files the scan reads: a `.ts`/`.tsx` file name.\n *\n * @ensures exactly the model's QuerySourceName\n */\nexport function isQuerySourceName(name: string): boolean {\n //@ verify\n //@ ensures \\result <==> (endsWith(name, \".ts\") || endsWith(name, \".tsx\"))\n return endsWith(name, \".ts\") || endsWith(name, \".tsx\");\n}\n\n/**\n * Which folders the scan walks into: every one but node_modules.\n *\n * @ensures exactly the model's WalksDir\n */\nexport function walksDir(name: string): boolean {\n //@ verify\n //@ ensures \\result <==> name !== \"node_modules\"\n return name !== \"node_modules\";\n}\n\n/**\n * An augur-api CalVer at or after 2026.3.7 has typed proxies.\n *\n * @ensures exactly the model's TypedProxyVersion\n */\nexport function typedProxyVersion(year: number, minor: number, patch: number): boolean {\n //@ verify\n //@ ensures \\result === (year > 2026 || (year === 2026 && minor > 3) || (year === 2026 && minor === 3 && patch >= 7))\n return (\n year > 2026 || (year === 2026 && minor > 3) || (year === 2026 && minor === 3 && patch >= 7)\n );\n}\n\n/**\n * api-version: a recognised, typed CalVer passes; anything else warns.\n *\n * @ensures exactly the model's ApiVersionStatus\n */\nexport function apiVersionStatus(\n parsed: boolean,\n year: number,\n minor: number,\n patch: number,\n): Status {\n //@ verify\n //@ ensures \\result === (parsed && typedProxyVersion(year, minor, patch) ? \"PASS\" : \"WARN\")\n return parsed && typedProxyVersion(year, minor, patch) ? \"PASS\" : \"WARN\";\n}\n\n/**\n * A range mark: ^ ~ > = < or whitespace (space, tab, line feed, carriage return).\n *\n * @ensures exactly the model's RangeMark on the code unit\n */\nexport function rangeMark(c: number): boolean {\n //@ verify\n //@ ensures \\result === (c === 94 || c === 126 || c === 62 || c === 61 || c === 60 || c === 32 || c === 9 || c === 10 || c === 13)\n return (\n c === 94 ||\n c === 126 ||\n c === 62 ||\n c === 61 ||\n c === 60 ||\n c === 32 ||\n c === 9 ||\n c === 10 ||\n c === 13\n );\n}\n\n/**\n * A range's version: its leading range marks stripped.\n *\n * @ensures exactly the model's StripRange\n */\nexport function stripRange(s: string): string {\n //@ verify\n //@ decreases s.length\n //@ ensures !rangeMark(codeAt(s, 0)) ==> \\result === s\n if (!rangeMark(codeAt(s, 0))) return s;\n return stripRange(s.slice(1));\n}\n\n/** One installed augur package against its own latest. */\nexport type PackageState = \"current\" | \"behind\" | \"unknown\";\n\n/**\n * A package's state: unknown when npm could not say (\"\" here), current when its range's\n * version is the latest, else behind.\n *\n * @ensures exactly the model's PackageStateOf\n */\nexport function packageStateOf(range: string, latest: string): PackageState {\n //@ verify\n //@ ensures latest === \"\" ==> \\result === \"unknown\"\n //@ ensures latest !== \"\" && stripRange(range) === latest ==> \\result === \"current\"\n //@ ensures latest !== \"\" && stripRange(range) !== latest ==> \\result === \"behind\"\n if (latest === \"\") return \"unknown\";\n return stripRange(range) === latest ? \"current\" : \"behind\";\n}\n\n/**\n * How many of the states from index `i` are `s`.\n *\n * @ensures exactly the model's CountState\n */\nexport function countStateFrom(states: PackageState[], s: PackageState, i: number): number {\n //@ verify\n //@ type i nat\n //@ requires i >= 0\n //@ decreases states.length - i\n //@ ensures i >= states.length ==> \\result === 0\n //@ ensures i < states.length ==> \\result === (states[i] === s ? 1 : 0) + countStateFrom(states, s, i + 1)\n if (i >= states.length) return 0;\n return ((states[i] as PackageState) === s ? 1 : 0) + countStateFrom(states, s, i + 1);\n}\n\n/**\n * augur-version-latest: skipped with none installed; any package behind its own latest fails;\n * else any unknown skips; else passes.\n *\n * @ensures exactly the model's LatestStatus\n */\nexport function latestStatus(states: PackageState[]): Status {\n //@ verify\n //@ ensures states.length === 0 ==> \\result === \"SKIP\"\n //@ ensures states.length > 0 && countStateFrom(states, \"behind\", 0) > 0 ==> \\result === \"FAIL\"\n //@ ensures states.length > 0 && countStateFrom(states, \"behind\", 0) === 0 && countStateFrom(states, \"unknown\", 0) > 0 ==> \\result === \"SKIP\"\n //@ ensures states.length > 0 && countStateFrom(states, \"behind\", 0) === 0 && countStateFrom(states, \"unknown\", 0) === 0 ==> \\result === \"PASS\"\n if (states.length === 0) return \"SKIP\";\n if (countStateFrom(states, \"behind\", 0) > 0) return \"FAIL\";\n return countStateFrom(states, \"unknown\", 0) > 0 ? \"SKIP\" : \"PASS\";\n}\n\n/**\n * How many of the results from index `i` are `s`.\n *\n * @ensures exactly the model's CountStatus\n */\nexport function countStatusFrom(results: Status[], s: Status, i: number): number {\n //@ verify\n //@ type i nat\n //@ requires i >= 0\n //@ decreases results.length - i\n //@ ensures i >= results.length ==> \\result === 0\n //@ ensures i < results.length ==> \\result === (results[i] === s ? 1 : 0) + countStatusFrom(results, s, i + 1)\n if (i >= results.length) return 0;\n return ((results[i] as Status) === s ? 1 : 0) + countStatusFrom(results, s, i + 1);\n}\n\n/**\n * The scored total: skips and suggestions left out.\n *\n * @ensures exactly the model's ScoredTotal\n */\nexport function scoredTotal(results: Status[]): number {\n //@ verify\n //@ ensures \\result === results.length - countStatusFrom(results, \"SKIP\", 0) - countStatusFrom(results, \"SUGGEST\", 0)\n return (\n results.length - countStatusFrom(results, \"SKIP\", 0) - countStatusFrom(results, \"SUGGEST\", 0)\n );\n}\n\n/**\n * The exit code: 1 on any failure, else 0.\n *\n * @ensures exactly the model's ExitCode\n */\nexport function exitCodeOf(results: Status[]): number {\n //@ verify\n //@ ensures \\result === (countStatusFrom(results, \"FAIL\", 0) > 0 ? 1 : 0)\n return countStatusFrom(results, \"FAIL\", 0) > 0 ? 1 : 0;\n}\n\n/**\n * Lighthouse: a URL starting \"http\" is used as is; a path gets the base URL in front.\n *\n * @ensures exactly the model's ResolveUrl\n */\nexport function resolveUrl(u: string, baseUrl: string): string {\n //@ verify\n //@ ensures startsWithAt(u, \"http\", 0) ==> \\result === u\n //@ ensures !startsWithAt(u, \"http\", 0) ==> \\result === baseUrl + u\n return startsWithAt(u, \"http\", 0) ? u : baseUrl + u;\n}\n"],"mappings":";AAYO,SAAS,QAAQ,GAAoB;AAG1C,SAAO,KAAK,MAAM,KAAK;AACzB;AAsFO,SAAS,UAAU,GAAoB;AAG5C,SAAO,aAAa,CAAC,KAAK,0BAA0B,CAAC,KAAK,aAAa,CAAC;AAC1E;AAOA,SAAS,aAAa,GAAoB;AAGxC,SAAQ,KAAK,KAAK,KAAK,MAAO,MAAM;AACtC;AAOA,SAAS,0BAA0B,GAAoB;AAGrD,SAAQ,KAAK,QAAQ,KAAK,QAAS,MAAM,QAAQ,MAAM,QAAQ,MAAM,QAAQ,MAAM;AACrF;AAOA,SAAS,aAAa,GAAoB;AAGxC,SAAO,MAAM,OAAO,MAAM,QAAQ,MAAM,SAAS,MAAM;AACzD;AAOO,SAAS,WAAW,GAAoB;AAG7C,SAAQ,KAAK,MAAM,KAAK,MAAQ,KAAK,MAAM,KAAK,OAAS,KAAK,MAAM,KAAK,MAAO,MAAM;AACxF;;;ACxHO,SAAS,OAAO,GAAW,GAAmB;AAInD,SAAO,KAAK,KAAK,IAAI,EAAE,SAAS,EAAE,WAAW,CAAC,IAAI;AACpD;AAoUO,SAAS,aAAa,GAAW,GAAW,KAAsB;AAOvE,QAAM,KAAK,KAAK,IAA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;AAOO,SAAS,eAAe,QAAwB,GAAiB,GAAmB;AAOzF,MAAI,KAAK,OAAO,OAAQ,QAAO;AAC/B,UAAS,OAAO,CAAC,MAAuB,IAAI,IAAI,KAAK,eAAe,QAAQ,GAAG,IAAI,CAAC;AACtF;AAQO,SAAS,aAAa,QAAgC;AAM3D,MAAI,OAAO,WAAW,EAAG,QAAO;AAChC,MAAI,eAAe,QAAQ,UAAU,CAAC,IAAI,EAAG,QAAO;AACpD,SAAO,eAAe,QAAQ,WAAW,CAAC,IAAI,IAAI,SAAS;AAC7D;AAOO,SAAS,gBAAgB,SAAmB,GAAW,GAAmB;AAO/E,MAAI,KAAK,QAAQ,OAAQ,QAAO;AAChC,UAAS,QAAQ,CAAC,MAAiB,IAAI,IAAI,KAAK,gBAAgB,SAAS,GAAG,IAAI,CAAC;AACnF;AAOO,SAAS,YAAY,SAA2B;AAGrD,SACE,QAAQ,SAAS,gBAAgB,SAAS,QAAQ,CAAC,IAAI,gBAAgB,SAAS,WAAW,CAAC;AAEhG;AAOO,SAAS,WAAW,SAA2B;AAGpD,SAAO,gBAAgB,SAAS,QAAQ,CAAC,IAAI,IAAI,IAAI;AACvD;AAOO,SAAS,WAAW,GAAW,SAAyB;AAI7D,SAAO,aAAa,GAAG,QAAQ,CAAC,IAAI,IAAI,UAAU;AACpD;","names":[]}
@@ -0,0 +1,26 @@
1
+ // src/eslint-shared.ts
2
+ import tsParser from "@typescript-eslint/parser";
3
+ var languageOptions = {
4
+ parser: tsParser,
5
+ parserOptions: {
6
+ ecmaFeatures: { jsx: true }
7
+ }
8
+ };
9
+ var sharedRules = {
10
+ "@typescript-eslint/no-unused-vars": [
11
+ "error",
12
+ { argsIgnorePattern: "^_", varsIgnorePattern: "^_" }
13
+ ],
14
+ "@typescript-eslint/no-explicit-any": "warn",
15
+ complexity: ["warn", 15],
16
+ "max-depth": ["warn", 4],
17
+ "max-nested-callbacks": ["warn", 3]
18
+ };
19
+ var ignored = { ignores: ["dist/", "node_modules/", ".turbo/", ".next/"] };
20
+
21
+ export {
22
+ languageOptions,
23
+ sharedRules,
24
+ ignored
25
+ };
26
+ //# sourceMappingURL=chunk-RY3GDLDS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/eslint-shared.ts"],"sourcesContent":["import tsParser from \"@typescript-eslint/parser\";\n\n/**\n * A flat-config entry as these presets build it. Typed by its own shape, not ESLint's\n * `Linter.Config`: the presets serve the consumer's ESLint (peer `^9`), and the plugins'\n * declarations are written for that version, so the consumer's ESLint is what checks it.\n */\nexport interface PresetConfig {\n files?: string[];\n ignores?: string[];\n languageOptions?: Record<string, unknown>;\n plugins?: Record<string, unknown>;\n rules?: Record<string, unknown>;\n}\n\n/** The TypeScript parser with JSX, for both presets. */\nexport const languageOptions = {\n parser: tsParser,\n parserOptions: {\n ecmaFeatures: { jsx: true },\n },\n};\n\n/** The rules both presets set after the plugins' recommended ones. */\nexport const sharedRules = {\n \"@typescript-eslint/no-unused-vars\": [\n \"error\",\n { argsIgnorePattern: \"^_\", varsIgnorePattern: \"^_\" },\n ],\n \"@typescript-eslint/no-explicit-any\": \"warn\",\n complexity: [\"warn\", 15],\n \"max-depth\": [\"warn\", 4],\n \"max-nested-callbacks\": [\"warn\", 3],\n};\n\n/** The folders both presets leave alone. */\nexport const ignored: PresetConfig = { ignores: [\"dist/\", \"node_modules/\", \".turbo/\", \".next/\"] };\n"],"mappings":";AAAA,OAAO,cAAc;AAgBd,IAAM,kBAAkB;AAAA,EAC7B,QAAQ;AAAA,EACR,eAAe;AAAA,IACb,cAAc,EAAE,KAAK,KAAK;AAAA,EAC5B;AACF;AAGO,IAAM,cAAc;AAAA,EACzB,qCAAqC;AAAA,IACnC;AAAA,IACA,EAAE,mBAAmB,MAAM,mBAAmB,KAAK;AAAA,EACrD;AAAA,EACA,sCAAsC;AAAA,EACtC,YAAY,CAAC,QAAQ,EAAE;AAAA,EACvB,aAAa,CAAC,QAAQ,CAAC;AAAA,EACvB,wBAAwB,CAAC,QAAQ,CAAC;AACpC;AAGO,IAAM,UAAwB,EAAE,SAAS,CAAC,SAAS,iBAAiB,WAAW,QAAQ,EAAE;","names":[]}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * augur-doctor's checks: each reads facts from the site through a {@link SiteReader} and takes
3
+ * its outcome from the proved rules (rules.ts). Labels and details are the original
4
+ * bin/augur-doctor.mjs text, except the version checks (no lockstep, owner 2026-11-05).
5
+ */
6
+ import { type Status } from "./rules";
7
+ /** What the checks may ask of a site. Paths are relative to the site directory. */
8
+ export interface SiteReader {
9
+ /** Whether the path exists. */
10
+ exists(relPath: string): boolean;
11
+ /** The file's text, or null when it is missing. */
12
+ read(relPath: string): string | null;
13
+ /** The first of these names found walking up from the site to its git root: its path and text. */
14
+ readUpward(names: string[]): {
15
+ path: string;
16
+ content: string;
17
+ } | null;
18
+ /** The package's latest published version, or "" when npm cannot say. */
19
+ latestVersion(packageName: string): string;
20
+ /** The `.ts`/`.tsx` files under these folders, recursively, `node_modules` skipped ([] for a missing one). */
21
+ sourceFiles(dirs: string[]): string[];
22
+ }
23
+ /** One line of the scorecard. */
24
+ export interface CheckResult {
25
+ status: Status;
26
+ id: string;
27
+ label: string;
28
+ detail: string;
29
+ }
30
+ /** The augur packages a site may install; each is checked against its own latest. */
31
+ export declare const AUGUR_PACKAGES: string[];
32
+ /** The migration runbook on augur.build, which the scorecard and the checks' details link to. */
33
+ export declare const RUNBOOK = "https://augur.build/docs/packages/migration-runbook";
34
+ /** Every check, in the original order; the package.json checks only when there is one. */
35
+ export declare function runChecks(reader: SiteReader): CheckResult[];
36
+ //# sourceMappingURL=checks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checks.d.ts","sourceRoot":"","sources":["../../src/doctor/checks.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EA+BL,KAAK,MAAM,EACZ,MAAM,SAAS,CAAC;AAEjB,mFAAmF;AACnF,MAAM,WAAW,UAAU;IACzB,+BAA+B;IAC/B,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;IACjC,mDAAmD;IACnD,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACrC,kGAAkG;IAClG,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACtE,yEAAyE;IACzE,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3C,8GAA8G;IAC9G,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;CACvC;AAED,iCAAiC;AACjC,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAkCD,qFAAqF;AACrF,eAAO,MAAM,cAAc,UAS1B,CAAC;AAEF,iGAAiG;AACjG,eAAO,MAAM,OAAO,wDAAwD,CAAC;AA4nB7E,0FAA0F;AAC1F,wBAAgB,SAAS,CAAC,MAAM,EAAE,UAAU,GAAG,WAAW,EAAE,CAmC3D"}
@@ -0,0 +1,11 @@
1
+ /** augur-doctor's command line: `augur-doctor [site]` (the current directory by default). */
2
+ import { type SiteReader } from "./checks";
3
+ /** Where the CLI writes, and how it reads a site (the real file system by default). */
4
+ export interface CliIo {
5
+ log: (line: string) => void;
6
+ error: (line: string) => void;
7
+ reader?: (siteDir: string) => SiteReader;
8
+ }
9
+ /** Runs the doctor and returns its exit code: 1 for a missing site or any failing check. */
10
+ export declare function runDoctor(args: string[], io: CliIo): number;
11
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/doctor/cli.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAI7F,OAAO,EAAa,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAKtD,uFAAuF;AACvF,MAAM,WAAW,KAAK;IACpB,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5B,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9B,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,UAAU,CAAC;CAC1C;AAYD,4FAA4F;AAC5F,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,KAAK,GAAG,MAAM,CAc3D"}
@@ -0,0 +1,7 @@
1
+ /** The {@link SiteReader} over the real file system and npm. */
2
+ import type { SiteReader } from "./checks";
3
+ /** A package's latest published version from `npm view`, or "" when npm cannot say. */
4
+ declare function npmLatest(packageName: string): string;
5
+ export declare function nodeReader(siteDir: string, latestVersion?: typeof npmLatest): SiteReader;
6
+ export {};
7
+ //# sourceMappingURL=node-reader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-reader.d.ts","sourceRoot":"","sources":["../../src/doctor/node-reader.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAKhE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AA6B3C,uFAAuF;AACvF,iBAAS,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAS9C;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,mBAAY,GAAG,UAAU,CAYjF"}
@@ -0,0 +1,5 @@
1
+ /** augur-doctor's scorecard: the check results as terminal lines, grouped as before. */
2
+ import { type CheckResult } from "./checks";
3
+ /** The whole scorecard for a site. */
4
+ export declare function reportLines(siteName: string, siteDir: string, results: CheckResult[]): string[];
5
+ //# sourceMappingURL=report.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/doctor/report.ts"],"names":[],"mappings":"AAAA,wFAAwF;AAExF,OAAO,EAAW,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AA8DrD,sCAAsC;AACtC,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,MAAM,EAAE,CAgB/F"}
@@ -0,0 +1,297 @@
1
+ /** A check's outcome. */
2
+ export type Status = "PASS" | "FAIL" | "WARN" | "SUGGEST" | "SKIP";
3
+ /**
4
+ * A file that should use a factory: there and using it passes; there without it warns; missing
5
+ * fails (site-config, server-site, ssr-options).
6
+ *
7
+ * @ensures exactly the model's FileUses
8
+ */
9
+ export declare function fileUses(found: boolean, uses: boolean): Status;
10
+ /**
11
+ * actions: re-exporting passes, there otherwise warns; missing passes with the proxy pattern.
12
+ *
13
+ * @ensures exactly the model's ActionsStatus
14
+ */
15
+ export declare function actionsStatus(found: boolean, reExports: boolean, usesProxy: boolean): Status;
16
+ /**
17
+ * site-hooks: createSiteHooks or another hooks setup passes; a file without either warns.
18
+ *
19
+ * @ensures exactly the model's SiteHooksStatus
20
+ */
21
+ export declare function siteHooksStatus(found: boolean, createSiteHooks: boolean, hooksSetup: boolean): Status;
22
+ /**
23
+ * tsconfig: extends augur-config/tsconfig/next passes; another augur-config preset warns; else
24
+ * (or no tsconfig.json) fails.
25
+ *
26
+ * @ensures exactly the model's TsconfigStatus
27
+ */
28
+ export declare function tsconfigStatus(found: boolean, extendsNext: boolean, extendsAugur: boolean): Status;
29
+ /**
30
+ * eslint and prettier: a config using the shared preset passes; every other case fails.
31
+ *
32
+ * @ensures exactly the model's PresetStatus
33
+ */
34
+ export declare function presetStatus(found: boolean, usesPreset: boolean): Status;
35
+ /**
36
+ * eslint-deprecated: skipped without an ESLint config; on passes; named otherwise warns.
37
+ *
38
+ * @ensures exactly the model's DeprecatedStatus
39
+ */
40
+ export declare function deprecatedStatus(hasEslint: boolean, ruleOn: boolean, named: boolean): Status;
41
+ /**
42
+ * knip: config and dependency pass; the dependency alone warns; else fails.
43
+ *
44
+ * @ensures exactly the model's KnipStatus
45
+ */
46
+ export declare function knipStatus(hasConfig: boolean, hasDep: boolean): Status;
47
+ /**
48
+ * icons: react-icons alone passes; heroicons or lucide fails; none warns.
49
+ *
50
+ * @ensures exactly the model's IconsStatus
51
+ */
52
+ export declare function iconsStatus(reactIcons: boolean, heroicons: boolean, lucide: boolean): Status;
53
+ /**
54
+ * tailwind: a range starting "^4" or "4" passes, "^3" or "3" fails, anything else warns.
55
+ *
56
+ * @ensures exactly the model's TailwindStatus
57
+ */
58
+ export declare function tailwindStatus(range: string): Status;
59
+ /** What augur-doctor reads from next.config. */
60
+ export interface NextFacts {
61
+ hasConfig: boolean;
62
+ hasExternal: boolean;
63
+ externalHasServer: boolean;
64
+ usesIoredis: boolean;
65
+ externalHasIoredis: boolean;
66
+ hasAllHeaders: boolean;
67
+ hasHeaders: boolean;
68
+ hasOptimize: boolean;
69
+ hasStrict: boolean;
70
+ hasAgrMedia: boolean;
71
+ hasImages: boolean;
72
+ }
73
+ /**
74
+ * next-external: augur-server MUST NOT be externalized; no serverExternalPackages warns.
75
+ *
76
+ * @ensures exactly the model's NextExternalStatus
77
+ */
78
+ export declare function nextExternalStatus(n: NextFacts): Status;
79
+ /**
80
+ * next-ioredis: checked only when the site uses ioredis and has serverExternalPackages.
81
+ *
82
+ * @ensures exactly the model's IoredisStatus
83
+ */
84
+ export declare function ioredisStatus(n: NextFacts): Status;
85
+ /**
86
+ * next-headers: HSTS, X-Content-Type-Options and Permissions-Policy all pass; some warns.
87
+ *
88
+ * @ensures exactly the model's HeadersStatus
89
+ */
90
+ export declare function headersStatus(n: NextFacts): Status;
91
+ /**
92
+ * next-optimize: optimizePackageImports set passes, else fails.
93
+ *
94
+ * @ensures exactly the model's OptimizeStatus
95
+ */
96
+ export declare function optimizeStatus(n: NextFacts): Status;
97
+ /**
98
+ * next-strict: reactStrictMode set passes, else warns; skipped with no config.
99
+ *
100
+ * @ensures exactly the model's StrictStatus
101
+ */
102
+ export declare function strictStatus(n: NextFacts): Status;
103
+ /**
104
+ * image-loader: agr.media in next.config passes, else warns; skipped with no config.
105
+ *
106
+ * @ensures exactly the model's ImageLoaderStatus
107
+ */
108
+ export declare function imageLoaderStatus(n: NextFacts): Status;
109
+ /**
110
+ * contract-tests: present passes, else fails.
111
+ *
112
+ * @ensures exactly the model's ContractTestsStatus
113
+ */
114
+ export declare function contractTestsStatus(present: boolean): Status;
115
+ /**
116
+ * no-wrapper: skipped without lib/; a client file that wraps AugurAPI fails.
117
+ *
118
+ * @ensures exactly the model's NoWrapperStatus
119
+ */
120
+ export declare function noWrapperStatus(hasLib: boolean, wraps: boolean): Status;
121
+ /**
122
+ * auth: a factory passes; raw NextAuth fails; otherwise (or no auth file) warns.
123
+ *
124
+ * @ensures exactly the model's AuthStatus
125
+ */
126
+ export declare function authStatus(found: boolean, usesFactory: boolean, rawNextAuth: boolean): Status;
127
+ /**
128
+ * quality-script: typecheck, lint and test all named passes; incomplete warns; none fails.
129
+ *
130
+ * @ensures exactly the model's QualityStatus
131
+ */
132
+ export declare function qualityStatus(hasScript: boolean, complete: boolean): Status;
133
+ /**
134
+ * pre-commit: lefthook's pre-commit section with lint-staged passes; else a suggestion.
135
+ *
136
+ * @ensures exactly the model's PreCommitStatus
137
+ */
138
+ export declare function preCommitStatus(hasPreCommit: boolean, hasLintStaged: boolean): Status;
139
+ /**
140
+ * proxy-local-hooks: local useQuery hooks are a suggestion.
141
+ *
142
+ * @ensures exactly the model's LocalHooksStatus
143
+ */
144
+ export declare function localHooksStatus(hasUseQuery: boolean): Status;
145
+ /**
146
+ * proxy-server-query: either proxy form passes, else a suggestion.
147
+ *
148
+ * @ensures exactly the model's ServerQueryStatus
149
+ */
150
+ export declare function serverQueryStatus(usesServerProxy: boolean, usesAugurOptions: boolean): Status;
151
+ /**
152
+ * query-client-scope and query-gc-time: any offending file fails.
153
+ *
154
+ * @ensures exactly the model's NoOffenderStatus
155
+ */
156
+ export declare function noOffenderStatus(offenders: number): Status;
157
+ /**
158
+ * query-gc-time's offender (#94): a file that sets a finite gcTime, or that spreads a
159
+ * CACHE_CONFIG tier while the site's augur-utils may predate the server-safe tiers (a spread
160
+ * on a fixed augur-utils is safe; owner 2026-11-07: "only for older version before this fix").
161
+ *
162
+ * @ensures exactly the model's GcTimeOffender
163
+ */
164
+ export declare function gcTimeOffender(finiteLiteral: boolean, spreadsTier: boolean, utilsBeforeFix: boolean): boolean;
165
+ /**
166
+ * The first augur-utils with server-safe CACHE_CONFIG tiers: 2026.11.3.
167
+ *
168
+ * @ensures exactly the model's ServerSafeTiersVersion
169
+ */
170
+ export declare function serverSafeTiersVersion(year: number, minor: number, patch: number): boolean;
171
+ /**
172
+ * The site's augur-utils range may give a version before the fix: its lowest version (the
173
+ * first x.y.z in the range, `parsed`) is older. No recognised version is not.
174
+ *
175
+ * @ensures exactly the model's UtilsBeforeServerSafeTiers
176
+ */
177
+ export declare function utilsBeforeServerSafeTiers(parsed: boolean, year: number, minor: number, patch: number): boolean;
178
+ /**
179
+ * The text sets a finite gcTime somewhere from `k` on (the spec; see `hasFiniteGcTime`).
180
+ *
181
+ * @ensures exactly the model's HasFiniteGcTimeFrom
182
+ */
183
+ export declare function hasFiniteGcTimeFrom(s: string, k: number): boolean;
184
+ /**
185
+ * The text sets a finite gcTime (`/gcTime\s*:\s*(?!Infinity\b|resolveGcTime\(|0\b)\S/.test`),
186
+ * as a loop.
187
+ *
188
+ * @ensures result = hasFiniteGcTimeFrom(s, 0)
189
+ */
190
+ export declare function hasFiniteGcTime(s: string): boolean;
191
+ /**
192
+ * A CACHE_CONFIG tier is spread somewhere from `k` on (the spec; see `hasTierSpread`).
193
+ *
194
+ * @ensures exactly the model's HasTierSpreadFrom
195
+ */
196
+ export declare function hasTierSpreadFrom(s: string, k: number): boolean;
197
+ /**
198
+ * A CACHE_CONFIG tier is spread (`/\.\.\.\s*CACHE_CONFIG\./.test`), as a loop.
199
+ *
200
+ * @ensures result = hasTierSpreadFrom(s, 0)
201
+ */
202
+ export declare function hasTierSpread(s: string): boolean;
203
+ /**
204
+ * A file offends query-gc-time: its text, and whether the site's augur-utils predates the fix.
205
+ *
206
+ * @ensures exactly the model's GcTimeOffenderIn
207
+ */
208
+ export declare function gcTimeOffenderIn(text: string, utilsBeforeFix: boolean): boolean;
209
+ /**
210
+ * The site's augur-utils range predates the fix: its first x.y.z is before 2026.11.3.
211
+ *
212
+ * @ensures exactly the model's UtilsRangeBeforeFix
213
+ */
214
+ export declare function utilsRangeBeforeFix(range: string): boolean;
215
+ /**
216
+ * Which files the scan reads: a `.ts`/`.tsx` file name.
217
+ *
218
+ * @ensures exactly the model's QuerySourceName
219
+ */
220
+ export declare function isQuerySourceName(name: string): boolean;
221
+ /**
222
+ * Which folders the scan walks into: every one but node_modules.
223
+ *
224
+ * @ensures exactly the model's WalksDir
225
+ */
226
+ export declare function walksDir(name: string): boolean;
227
+ /**
228
+ * An augur-api CalVer at or after 2026.3.7 has typed proxies.
229
+ *
230
+ * @ensures exactly the model's TypedProxyVersion
231
+ */
232
+ export declare function typedProxyVersion(year: number, minor: number, patch: number): boolean;
233
+ /**
234
+ * api-version: a recognised, typed CalVer passes; anything else warns.
235
+ *
236
+ * @ensures exactly the model's ApiVersionStatus
237
+ */
238
+ export declare function apiVersionStatus(parsed: boolean, year: number, minor: number, patch: number): Status;
239
+ /**
240
+ * A range mark: ^ ~ > = < or whitespace (space, tab, line feed, carriage return).
241
+ *
242
+ * @ensures exactly the model's RangeMark on the code unit
243
+ */
244
+ export declare function rangeMark(c: number): boolean;
245
+ /**
246
+ * A range's version: its leading range marks stripped.
247
+ *
248
+ * @ensures exactly the model's StripRange
249
+ */
250
+ export declare function stripRange(s: string): string;
251
+ /** One installed augur package against its own latest. */
252
+ export type PackageState = "current" | "behind" | "unknown";
253
+ /**
254
+ * A package's state: unknown when npm could not say ("" here), current when its range's
255
+ * version is the latest, else behind.
256
+ *
257
+ * @ensures exactly the model's PackageStateOf
258
+ */
259
+ export declare function packageStateOf(range: string, latest: string): PackageState;
260
+ /**
261
+ * How many of the states from index `i` are `s`.
262
+ *
263
+ * @ensures exactly the model's CountState
264
+ */
265
+ export declare function countStateFrom(states: PackageState[], s: PackageState, i: number): number;
266
+ /**
267
+ * augur-version-latest: skipped with none installed; any package behind its own latest fails;
268
+ * else any unknown skips; else passes.
269
+ *
270
+ * @ensures exactly the model's LatestStatus
271
+ */
272
+ export declare function latestStatus(states: PackageState[]): Status;
273
+ /**
274
+ * How many of the results from index `i` are `s`.
275
+ *
276
+ * @ensures exactly the model's CountStatus
277
+ */
278
+ export declare function countStatusFrom(results: Status[], s: Status, i: number): number;
279
+ /**
280
+ * The scored total: skips and suggestions left out.
281
+ *
282
+ * @ensures exactly the model's ScoredTotal
283
+ */
284
+ export declare function scoredTotal(results: Status[]): number;
285
+ /**
286
+ * The exit code: 1 on any failure, else 0.
287
+ *
288
+ * @ensures exactly the model's ExitCode
289
+ */
290
+ export declare function exitCodeOf(results: Status[]): number;
291
+ /**
292
+ * Lighthouse: a URL starting "http" is used as is; a path gets the base URL in front.
293
+ *
294
+ * @ensures exactly the model's ResolveUrl
295
+ */
296
+ export declare function resolveUrl(u: string, baseUrl: string): string;
297
+ //# sourceMappingURL=rules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../src/doctor/rules.ts"],"names":[],"mappings":"AAeA,yBAAyB;AACzB,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;AAEnE;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,CAO9D;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,GAAG,MAAM,CAQ5F;AAED;;;;GAI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