@simpleapps-com/augur-config 2026.11.1 → 2026.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -2
- package/dist/augur-doctor.js +45 -10
- package/dist/augur-doctor.js.map +1 -1
- package/dist/{chunk-ZV56KMH3.js → chunk-3L322IID.js} +116 -1
- package/dist/chunk-3L322IID.js.map +1 -0
- package/dist/doctor/checks.d.ts +2 -0
- package/dist/doctor/checks.d.ts.map +1 -1
- package/dist/doctor/node-reader.d.ts.map +1 -1
- package/dist/doctor/rules.d.ts +70 -0
- package/dist/doctor/rules.d.ts.map +1 -1
- package/dist/lighthouse-rules.d.ts +28 -0
- package/dist/lighthouse-rules.d.ts.map +1 -0
- package/dist/lighthouse.d.ts.map +1 -1
- package/dist/lighthouse.js +35 -20
- package/dist/lighthouse.js.map +1 -1
- package/package.json +4 -3
- package/dist/chunk-ZV56KMH3.js.map +0 -1
package/README.md
CHANGED
|
@@ -29,6 +29,21 @@ pnpm add -D @simpleapps-com/augur-config
|
|
|
29
29
|
| `@simpleapps-com/augur-config/tsconfig/next` | tsconfig preset |
|
|
30
30
|
| `@simpleapps-com/augur-config/lighthouse` | `lighthousePreset()` for Lighthouse CI |
|
|
31
31
|
|
|
32
|
+
## Lighthouse CI and `pnpm audit`
|
|
33
|
+
|
|
34
|
+
`lighthousePreset()` only builds a config object; a site that runs Lighthouse CI installs
|
|
35
|
+
`@lhci/cli` itself, at the optional peer range `^0.16.0` (Lighthouse 13, Node 22; atlas#86).
|
|
36
|
+
|
|
37
|
+
Known advisories on that tree (dev-only, nothing reaches a site's bundle), each with the condition
|
|
38
|
+
that removes it:
|
|
39
|
+
|
|
40
|
+
- `basic-ftp` ≤ 6.2.0 (GHSA-c475-qrg2-pj4r, high): `@lhci/cli` → `proxy-agent` →
|
|
41
|
+
`pac-proxy-agent` → `get-uri` → `basic-ftp`. Goes when `get-uri` takes `basic-ftp` ≥ 6.2.1
|
|
42
|
+
(its current release takes `^5.3.1`). Site rules forbid `overrides`, so it stays until then.
|
|
43
|
+
|
|
44
|
+
`braces` 3.0.3 through `@next/eslint-plugin-next` is not one: its advisory (GHSA-vfj7-8cjw-p6xm)
|
|
45
|
+
was withdrawn on 2026-10-23 as not practically exploitable, and `pnpm audit` no longer reports it.
|
|
46
|
+
|
|
32
47
|
## augur-doctor
|
|
33
48
|
|
|
34
49
|
```bash
|
|
@@ -39,13 +54,21 @@ npx augur-doctor ./sites/shop
|
|
|
39
54
|
Scores a site against the platform standard (site files, config presets, next.config, tests,
|
|
40
55
|
proxy adoption, package versions) and exits 1 when any check fails. Each installed
|
|
41
56
|
`@simpleapps-com/augur-*` package is checked against its own latest published version.
|
|
57
|
+
`query-gc-time` reads the provider and proxy files and every `.ts`/`.tsx` under `hooks/` and
|
|
58
|
+
`app/` (or `src/…`): a finite `gcTime` fails on any version, a `...CACHE_CONFIG.` spread only
|
|
59
|
+
while the site's augur-utils range allows a version before 2026.11.3 (#94). The check list is in
|
|
60
|
+
the [guide](https://augur.build/docs/packages/augur-config).
|
|
42
61
|
|
|
43
62
|
## Development
|
|
44
63
|
|
|
45
64
|
TypeScript in `src/`, built to `dist/` (ESM) by tsup; the tsconfig presets ship as JSON from
|
|
46
65
|
`src/tsconfig/`. The doctor's decisions are proved (`src/doctor/rules.ts`, model
|
|
47
|
-
`models/AugurConfig.dfy`, link `models/links/augur-config-doctor-rules.dfy`)
|
|
48
|
-
(`src/
|
|
66
|
+
`models/AugurConfig.dfy`, link `models/links/augur-config-doctor-rules.dfy`), and so are the
|
|
67
|
+
Lighthouse preset's (`src/lighthouse-rules.ts`, link `models/links/augur-config-lighthouse-rules.dfy`:
|
|
68
|
+
the URL list, the start-server condition, the collect defaults); the file reads
|
|
69
|
+
(`src/doctor/checks.ts`, `node-reader.ts`), the scorecard (`report.ts`) and the preset's object
|
|
70
|
+
building (`lighthouse.ts`, which lsc can't translate: `Record<string, unknown>` and spreads) are
|
|
71
|
+
tested at 100%.
|
|
49
72
|
|
|
50
73
|
```bash
|
|
51
74
|
pnpm -C repo/packages/augur-config test
|
package/dist/augur-doctor.js
CHANGED
|
@@ -8,10 +8,12 @@ import {
|
|
|
8
8
|
deprecatedStatus,
|
|
9
9
|
exitCodeOf,
|
|
10
10
|
fileUses,
|
|
11
|
+
gcTimeOffenderIn,
|
|
11
12
|
headersStatus,
|
|
12
13
|
iconsStatus,
|
|
13
14
|
imageLoaderStatus,
|
|
14
15
|
ioredisStatus,
|
|
16
|
+
isQuerySourceName,
|
|
15
17
|
knipStatus,
|
|
16
18
|
latestStatus,
|
|
17
19
|
localHooksStatus,
|
|
@@ -28,13 +30,27 @@ import {
|
|
|
28
30
|
siteHooksStatus,
|
|
29
31
|
strictStatus,
|
|
30
32
|
tailwindStatus,
|
|
31
|
-
tsconfigStatus
|
|
32
|
-
|
|
33
|
+
tsconfigStatus,
|
|
34
|
+
utilsRangeBeforeFix,
|
|
35
|
+
walksDir
|
|
36
|
+
} from "./chunk-3L322IID.js";
|
|
33
37
|
|
|
34
38
|
// src/doctor/cli.ts
|
|
35
39
|
import { existsSync as existsSync2 } from "fs";
|
|
36
40
|
import { basename, resolve as resolve2 } from "path";
|
|
37
41
|
|
|
42
|
+
// ../utils/src/lists.ts
|
|
43
|
+
function hasItemBelow(xs, x, k) {
|
|
44
|
+
if (k === 0) return false;
|
|
45
|
+
if (xs[k - 1] === x) return true;
|
|
46
|
+
return hasItemBelow(xs, x, k - 1);
|
|
47
|
+
}
|
|
48
|
+
function firstsFrom(xs, i) {
|
|
49
|
+
if (i >= xs.length) return [];
|
|
50
|
+
const rest = firstsFrom(xs, i + 1);
|
|
51
|
+
return hasItemBelow(xs, xs[i], i) ? rest : [xs[i], ...rest];
|
|
52
|
+
}
|
|
53
|
+
|
|
38
54
|
// src/doctor/checks.ts
|
|
39
55
|
var PROXY_FILES = [
|
|
40
56
|
"lib/augur-query.ts",
|
|
@@ -50,7 +66,7 @@ var PROXY_FILES = [
|
|
|
50
66
|
];
|
|
51
67
|
var PROXY_PATTERN = /createServerQueryProxy|queryAction|createAugurOptions|registerQueryAction/;
|
|
52
68
|
var MODULE_SCOPE_CLIENT = /^(?:export\s+)?(?:const|let|var)\s+\w+\s*=\s*new QueryClient\(/m;
|
|
53
|
-
var
|
|
69
|
+
var QUERY_SOURCE_DIRS = ["hooks", "app", "src/hooks", "src/app"];
|
|
54
70
|
var AUGUR_PACKAGES = [
|
|
55
71
|
"@simpleapps-com/augur-config",
|
|
56
72
|
"@simpleapps-com/augur-core",
|
|
@@ -96,6 +112,14 @@ var Site = class {
|
|
|
96
112
|
proxyFilesMatching(pattern) {
|
|
97
113
|
return PROXY_FILES.filter((f) => this.contains(f, pattern));
|
|
98
114
|
}
|
|
115
|
+
/** The proxy files, then the query source folders' files, each once, in that order. */
|
|
116
|
+
queryFiles() {
|
|
117
|
+
const paths = firstsFrom([...PROXY_FILES, ...this.reader.sourceFiles(QUERY_SOURCE_DIRS)], 0);
|
|
118
|
+
return paths.flatMap((path) => {
|
|
119
|
+
const text = this.reader.read(path);
|
|
120
|
+
return text === null ? [] : [{ path, text }];
|
|
121
|
+
});
|
|
122
|
+
}
|
|
99
123
|
};
|
|
100
124
|
function siteConfig(site) {
|
|
101
125
|
const file = site.find(
|
|
@@ -513,13 +537,15 @@ function queryClientScope(site) {
|
|
|
513
537
|
]
|
|
514
538
|
});
|
|
515
539
|
}
|
|
516
|
-
function queryGcTime(site) {
|
|
517
|
-
const
|
|
540
|
+
function queryGcTime(site, pkg) {
|
|
541
|
+
const range = pkg === null ? "" : allDeps(pkg)["@simpleapps-com/augur-utils"] || "";
|
|
542
|
+
const oldUtils = utilsRangeBeforeFix(range);
|
|
543
|
+
const files = site.queryFiles().filter((f) => gcTimeOffenderIn(f.text, oldUtils)).map((f) => f.path);
|
|
518
544
|
return result("query-gc-time", noOffenderStatus(files.length), {
|
|
519
545
|
PASS: ["No finite gcTime in provider/query setup", ""],
|
|
520
546
|
FAIL: [
|
|
521
547
|
"Finite gcTime in provider/query setup (leaks memory during SSR)",
|
|
522
|
-
`${files.join(", ")}: remove it, or wrap with resolveGcTime() from augur-
|
|
548
|
+
`${files.join(", ")}: remove it, or wrap with resolveGcTime() from augur-utils; a ...CACHE_CONFIG spread needs @simpleapps-com/augur-utils >= 2026.11.3`
|
|
523
549
|
]
|
|
524
550
|
});
|
|
525
551
|
}
|
|
@@ -599,7 +625,7 @@ function runChecks(reader) {
|
|
|
599
625
|
proxyLocalHooks(site),
|
|
600
626
|
proxyServerQuery(site),
|
|
601
627
|
queryClientScope(site),
|
|
602
|
-
queryGcTime(site),
|
|
628
|
+
queryGcTime(site, pkg),
|
|
603
629
|
...pkg ? [apiVersion(pkg)] : [],
|
|
604
630
|
augurVersionLatest(reader, pkg)
|
|
605
631
|
];
|
|
@@ -607,8 +633,16 @@ function runChecks(reader) {
|
|
|
607
633
|
|
|
608
634
|
// src/doctor/node-reader.ts
|
|
609
635
|
import { execFileSync } from "child_process";
|
|
610
|
-
import { existsSync, readFileSync } from "fs";
|
|
611
|
-
import { dirname, resolve } from "path";
|
|
636
|
+
import { existsSync, readdirSync, readFileSync } from "fs";
|
|
637
|
+
import { dirname, join, resolve } from "path";
|
|
638
|
+
function sourceFilesUnder(siteDir, rel) {
|
|
639
|
+
if (!existsSync(resolve(siteDir, rel))) return [];
|
|
640
|
+
return readdirSync(resolve(siteDir, rel), { withFileTypes: true }).flatMap((entry) => {
|
|
641
|
+
const path = join(rel, entry.name);
|
|
642
|
+
if (entry.isDirectory()) return walksDir(entry.name) ? sourceFilesUnder(siteDir, path) : [];
|
|
643
|
+
return isQuerySourceName(entry.name) ? [path] : [];
|
|
644
|
+
});
|
|
645
|
+
}
|
|
612
646
|
function findUpward(start, names) {
|
|
613
647
|
let dir = start;
|
|
614
648
|
const root = resolve("/");
|
|
@@ -639,7 +673,8 @@ function nodeReader(siteDir, latestVersion = npmLatest) {
|
|
|
639
673
|
const path = findUpward(siteDir, names);
|
|
640
674
|
return path === null ? null : { path, content: readFileSync(path, "utf-8") };
|
|
641
675
|
},
|
|
642
|
-
latestVersion
|
|
676
|
+
latestVersion,
|
|
677
|
+
sourceFiles: (dirs) => dirs.flatMap((dir) => sourceFilesUnder(siteDir, dir))
|
|
643
678
|
};
|
|
644
679
|
}
|
|
645
680
|
|
package/dist/augur-doctor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/doctor/cli.ts","../src/doctor/checks.ts","../src/doctor/node-reader.ts","../src/doctor/report.ts","../src/augur-doctor.ts"],"sourcesContent":["/** augur-doctor's command line: `augur-doctor [site]` (the current directory by default). */\n\nimport { existsSync } from \"node:fs\";\nimport { basename, resolve } from \"node:path\";\nimport { runChecks, type SiteReader } from \"./checks\";\nimport { nodeReader } from \"./node-reader\";\nimport { reportLines } from \"./report\";\nimport { exitCodeOf } from \"./rules\";\n\n/** Where the CLI writes, and how it reads a site (the real file system by default). */\nexport interface CliIo {\n log: (line: string) => void;\n error: (line: string) => void;\n reader?: (siteDir: string) => SiteReader;\n}\n\nconst USAGE = [\n \"\",\n \"Usage: augur-doctor [/path/to/site]\",\n \"\",\n \"Run from a site directory, or pass the path as an argument.\",\n \"Examples:\",\n \" npx augur-doctor\",\n \" npx augur-doctor ./sites/example-site\",\n];\n\n/** Runs the doctor and returns its exit code: 1 for a missing site or any failing check. */\nexport function runDoctor(args: string[], io: CliIo): number {\n const siteDir = resolve(args[0] || \".\");\n if (!existsSync(siteDir)) {\n io.error(`Site directory not found: ${siteDir}`);\n return 1;\n }\n if (!existsSync(resolve(siteDir, \"package.json\"))) {\n io.error(`No package.json found in: ${siteDir}`);\n USAGE.forEach((line) => io.error(line));\n return 1;\n }\n const results = runChecks((io.reader ?? nodeReader)(siteDir));\n reportLines(basename(siteDir), siteDir, results).forEach((line) => io.log(line));\n return exitCodeOf(results.map((r) => r.status));\n}\n","/**\n * augur-doctor's checks: each reads facts from the site through a {@link SiteReader} and takes\n * its outcome from the proved rules (rules.ts). Labels and details are the original\n * bin/augur-doctor.mjs text, except the version checks (no lockstep, owner 2026-11-05).\n */\n\nimport {\n actionsStatus,\n apiVersionStatus,\n authStatus,\n contractTestsStatus,\n deprecatedStatus,\n fileUses,\n headersStatus,\n iconsStatus,\n imageLoaderStatus,\n ioredisStatus,\n knipStatus,\n latestStatus,\n localHooksStatus,\n nextExternalStatus,\n noOffenderStatus,\n noWrapperStatus,\n optimizeStatus,\n packageStateOf,\n preCommitStatus,\n presetStatus,\n qualityStatus,\n serverQueryStatus,\n siteHooksStatus,\n strictStatus,\n tailwindStatus,\n tsconfigStatus,\n type NextFacts,\n type PackageState,\n type Status,\n} from \"./rules\";\n\n/** What the checks may ask of a site. Paths are relative to the site directory. */\nexport interface SiteReader {\n /** Whether the path exists. */\n exists(relPath: string): boolean;\n /** The file's text, or null when it is missing. */\n read(relPath: string): string | null;\n /** The first of these names found walking up from the site to its git root: its path and text. */\n readUpward(names: string[]): { path: string; content: string } | null;\n /** The package's latest published version, or \"\" when npm cannot say. */\n latestVersion(packageName: string): string;\n}\n\n/** One line of the scorecard. */\nexport interface CheckResult {\n status: Status;\n id: string;\n label: string;\n detail: string;\n}\n\ntype Deps = Record<string, string | undefined>;\n\n/** The parts of a site's package.json the checks read. */\ninterface PackageJson {\n dependencies?: Deps;\n devDependencies?: Deps;\n scripts?: Record<string, string | undefined>;\n prettier?: unknown;\n \"lint-staged\"?: unknown;\n}\n\n/** Files where proxy pattern wiring commonly lives across different site layouts. */\nconst PROXY_FILES = [\n \"lib/augur-query.ts\",\n \"src/lib/augur-query.ts\",\n \"lib/augur.ts\",\n \"src/lib/augur.ts\",\n \"lib/augur-options.ts\",\n \"src/lib/augur-options.ts\",\n \"app/providers.tsx\",\n \"src/app/providers.tsx\",\n \"app/context/ReactQueryProvider.tsx\",\n \"src/app/context/ReactQueryProvider.tsx\",\n];\n\nconst PROXY_PATTERN = /createServerQueryProxy|queryAction|createAugurOptions|registerQueryAction/;\nconst MODULE_SCOPE_CLIENT = /^(?:export\\s+)?(?:const|let|var)\\s+\\w+\\s*=\\s*new QueryClient\\(/m;\n// Allowed: Infinity, resolveGcTime(...), 0 (fires next tick). Anything else is finite.\nconst FINITE_GC_TIME = /gcTime\\s*:\\s*(?!Infinity\\b|resolveGcTime\\(|0\\b)\\S/;\n\n/** The augur packages a site may install; each is checked against its own latest. */\nexport const AUGUR_PACKAGES = [\n \"@simpleapps-com/augur-config\",\n \"@simpleapps-com/augur-core\",\n \"@simpleapps-com/augur-hooks\",\n \"@simpleapps-com/augur-mobile\",\n \"@simpleapps-com/augur-server\",\n \"@simpleapps-com/augur-tailwind\",\n \"@simpleapps-com/augur-utils\",\n \"@simpleapps-com/augur-web\",\n];\n\n/** The migration runbook on augur.build, which the scorecard and the checks' details link to. */\nexport const RUNBOOK = \"https://augur.build/docs/packages/migration-runbook\";\nconst GETTING_STARTED = \"https://augur.build/docs/packages/getting-started\";\n\n/**\n * A check's result for a status, with a label (and detail) per status. Each check lists every\n * status its rule can return (rules.ts and its ensures), so the lookup always finds one.\n */\nfunction result(\n id: string,\n status: Status,\n labels: Partial<Record<Status, [string, string]>>,\n): CheckResult {\n const [label, detail] = labels[status]!;\n return { status, id, label, detail };\n}\n\n/** The reads every check shares. */\nclass Site {\n constructor(private readonly reader: SiteReader) {}\n\n find(...candidates: string[]): string | null {\n return candidates.find((c) => this.reader.exists(c)) ?? null;\n }\n\n read(relPath: string): string | null {\n return this.reader.read(relPath);\n }\n\n contains(relPath: string | null, pattern: string | RegExp): boolean {\n const content = relPath === null ? null : this.reader.read(relPath);\n if (!content) return false;\n return typeof pattern === \"string\" ? content.includes(pattern) : pattern.test(content);\n }\n\n json<T>(relPath: string): T | null {\n const content = this.reader.read(relPath);\n if (!content) return null;\n try {\n return JSON.parse(content) as T;\n } catch {\n return null;\n }\n }\n\n /** The proxy files that exist and match the pattern. */\n proxyFilesMatching(pattern: RegExp): string[] {\n return PROXY_FILES.filter((f) => this.contains(f, pattern));\n }\n}\n\nfunction siteConfig(site: Site): CheckResult {\n const file = site.find(\n \"lib/augur-config.ts\",\n \"src/lib/augur-config.ts\",\n \"config/augur-config.ts\",\n );\n return result(\"site-config\", fileUses(file !== null, site.contains(file, \"defineSite\")), {\n PASS: [\"augur-config.ts with defineSite()\", file ?? \"\"],\n WARN: [\"augur-config.ts exists but does not use defineSite()\", file ?? \"\"],\n FAIL: [\"augur-config.ts with defineSite()\", \"Expected lib/augur-config.ts\"],\n });\n}\n\nfunction serverSite(site: Site): CheckResult {\n const file = site.find(\"lib/augur-site.ts\", \"src/lib/augur-site.ts\", \"config/augur-site.ts\");\n return result(\"server-site\", fileUses(file !== null, site.contains(file, \"createServerSite\")), {\n PASS: [\"augur-site.ts using createServerSite()\", file ?? \"\"],\n WARN: [\"augur-site.ts exists but does not use createServerSite()\", file ?? \"\"],\n FAIL: [\"augur-site.ts using createServerSite()\", \"Expected lib/augur-site.ts\"],\n });\n}\n\nfunction actions(site: Site): CheckResult {\n const file = site.find(\"lib/augur-actions.ts\", \"src/lib/augur-actions.ts\", \"lib/actions.ts\");\n const reExports = site.contains(file, /site\\.actions|actions\\./);\n const usesProxy = site.proxyFilesMatching(PROXY_PATTERN).length > 0;\n const status = actionsStatus(file !== null, reExports, usesProxy);\n return result(\"actions\", status, {\n PASS: file\n ? [\"augur-actions.ts re-exporting site.actions\", file]\n : [\"Using proxy pattern (augur-actions.ts not needed)\", \"\"],\n WARN: [\"augur-actions.ts exists but may not re-export site.actions\", file ?? \"\"],\n FAIL: [\n \"augur-actions.ts re-exporting site.actions.*\",\n \"Expected lib/augur-actions.ts or createServerQueryProxy usage\",\n ],\n });\n}\n\nfunction siteHooks(site: Site): CheckResult {\n const file = site.find(\n \"lib/augur.ts\",\n \"src/lib/augur.ts\",\n \"lib/augur-hooks.ts\",\n \"src/lib/augur-hooks.ts\",\n );\n const createSiteHooks = site.contains(file, \"createSiteHooks\");\n const status = siteHooksStatus(\n file !== null,\n createSiteHooks,\n site.contains(file, /AugurHooksProvider|augur-hooks/),\n );\n return result(\"site-hooks\", status, {\n PASS: [\n createSiteHooks ? \"augur.ts with createSiteHooks()\" : \"augur.ts with hooks setup\",\n file ?? \"\",\n ],\n WARN: [\"augur.ts exists but does not use createSiteHooks()\", file ?? \"\"],\n FAIL: [\"augur.ts with createSiteHooks()\", \"Expected lib/augur.ts\"],\n });\n}\n\nfunction ssrOptions(site: Site): CheckResult {\n const file = site.find(\"lib/augur-options.ts\", \"src/lib/augur-options.ts\");\n return result(\"ssr-options\", fileUses(file !== null, site.contains(file, /Options/)), {\n PASS: [\"augur-options.ts for SSR prefetching\", file ?? \"\"],\n WARN: [\"augur-options.ts exists but may not export options\", file ?? \"\"],\n FAIL: [\"augur-options.ts for SSR prefetching\", \"Expected lib/augur-options.ts\"],\n });\n}\n\nfunction tsconfig(site: Site): CheckResult {\n const config = site.json<{ extends?: string }>(\"tsconfig.json\");\n const extendsVal = config?.extends || \"\";\n const status = tsconfigStatus(\n config !== null,\n extendsVal.includes(\"augur-config/tsconfig/next\"),\n extendsVal.includes(\"augur-config\"),\n );\n return result(\"tsconfig\", status, {\n PASS: [\"tsconfig.json extends augur-config/tsconfig/next\", \"\"],\n WARN: [\"tsconfig.json extends augur-config but not /tsconfig/next\", `extends: ${extendsVal}`],\n FAIL: config\n ? [\n \"tsconfig.json extends augur-config/tsconfig/next\",\n extendsVal ? `extends: ${extendsVal}` : \"No extends field\",\n ]\n : [\"tsconfig.json exists\", \"File not found\"],\n });\n}\n\nfunction eslintFailDetail(site: Site, file: string | null): [string, string] {\n if (file) {\n return [\n \"eslint.config.mjs uses augur-config/eslint/next\",\n \"Config exists but does not import augur-config/eslint\",\n ];\n }\n if (site.find(\".eslintrc.json\", \".eslintrc.js\", \".eslintrc\", \".eslintrc.cjs\")) {\n return [\n \"eslint.config.mjs uses augur-config/eslint/next\",\n \"Site uses legacy .eslintrc format -- migrate to eslint.config.mjs\",\n ];\n }\n return [\"eslint.config.mjs exists\", \"No ESLint config found\"];\n}\n\nfunction eslint(site: Site, file: string | null): CheckResult {\n return result(\"eslint\", presetStatus(file !== null, site.contains(file, \"augur-config/eslint\")), {\n PASS: [\"eslint.config.mjs uses augur-config/eslint/next\", file ?? \"\"],\n FAIL: eslintFailDetail(site, file),\n });\n}\n\nfunction eslintDeprecated(site: Site, file: string | null): CheckResult {\n const status = deprecatedStatus(\n file !== null,\n site.contains(file, /no-deprecated[\"']?\\s*:\\s*[\"'](error|warn)[\"']/),\n site.contains(file, \"no-deprecated\"),\n );\n return result(\"eslint-deprecated\", status, {\n SKIP: [\"ESLint: no-deprecated rule\", \"No ESLint config found\"],\n PASS: [\"ESLint: no-deprecated rule enabled\", \"\"],\n WARN: [\n \"ESLint: no-deprecated found but may not be warn/error\",\n \"Set @typescript-eslint/no-deprecated to warn or error\",\n ],\n FAIL: [\n \"ESLint: @typescript-eslint/no-deprecated rule\",\n 'Add \"@typescript-eslint/no-deprecated\": \"warn\" to eslint.config.mjs rules',\n ],\n });\n}\n\nfunction prettierFailDetail(\n site: Site,\n file: string | null,\n pkg: PackageJson | null,\n): [string, string] {\n const label = \"Prettier uses augur-config/prettier preset\";\n if (file) return [label, \"Config exists but does not import augur-config/prettier\"];\n if (pkg?.prettier) {\n return [label, \"Prettier config is inline in package.json -- move to prettier.config.mjs\"];\n }\n if (site.find(\".prettierrc\", \".prettierrc.json\", \".prettierrc.yaml\")) {\n return [\n label,\n \"Site uses static prettier config -- migrate to prettier.config.mjs with augur-config/prettier\",\n ];\n }\n return [\"Prettier config exists\", \"No Prettier config found\"];\n}\n\nfunction prettier(site: Site, pkg: PackageJson | null): CheckResult {\n const file = site.find(\n \"prettier.config.mjs\",\n \"prettier.config.js\",\n \".prettierrc.mjs\",\n \".prettierrc.js\",\n );\n return result(\n \"prettier\",\n presetStatus(file !== null, site.contains(file, \"augur-config/prettier\")),\n {\n PASS: [\"Prettier uses augur-config/prettier preset\", file ?? \"\"],\n FAIL: prettierFailDetail(site, file, pkg),\n },\n );\n}\n\nfunction knip(site: Site, pkg: PackageJson | null): CheckResult {\n const config = site.find(\n \"knip.json\",\n \"knip.jsonc\",\n \"knip.ts\",\n \"knip.config.ts\",\n \"knip.config.js\",\n );\n return result(\"knip\", knipStatus(config !== null, hasDep(pkg, \"knip\")), {\n PASS: [\"Knip configured for dead code detection\", config ?? \"\"],\n WARN: [\n \"Knip installed but no config file found\",\n \"Add knip.json or knip.ts -- see https://knip.dev/overview/configuration\",\n ],\n FAIL: config\n ? [\n \"Knip for dead code detection\",\n \"Config exists but knip not in devDependencies -- run pnpm add -D knip\",\n ]\n : [\n \"Knip for dead code detection\",\n \"Add knip to devDependencies and create knip.json -- see https://knip.dev\",\n ],\n });\n}\n\n/** Whether package.json lists the package in its dependencies or devDependencies. */\nfunction hasDep(pkg: PackageJson | null, name: string): boolean {\n return !!(pkg?.dependencies?.[name] || pkg?.devDependencies?.[name]);\n}\n\n/** The text holds every one of the strings. */\nfunction includesAll(text: string, parts: string[]): boolean {\n return parts.every((part) => text.includes(part));\n}\n\n/** What next.config (and package.json's ioredis) tell the Next.js checks. */\nfunction nextFacts(site: Site, pkg: PackageJson | null): NextFacts {\n const file = site.find(\"next.config.ts\", \"next.config.mjs\", \"next.config.js\");\n const text = (file === null ? null : site.read(file)) ?? \"\";\n return {\n hasConfig: file !== null,\n hasExternal: text.includes(\"serverExternalPackages\"),\n externalHasServer: text.includes(\"augur-server\"),\n usesIoredis: hasDep(pkg, \"ioredis\"),\n externalHasIoredis: text.includes(\"ioredis\"),\n hasAllHeaders: includesAll(text, [\n \"Strict-Transport-Security\",\n \"X-Content-Type-Options\",\n \"Permissions-Policy\",\n ]),\n hasHeaders: text.includes(\"headers\"),\n hasOptimize: text.includes(\"optimizePackageImports\"),\n hasStrict: text.includes(\"reactStrictMode\"),\n hasAgrMedia: /agr\\.media|agrMedia/.test(text),\n hasImages: text.includes(\"images\"),\n };\n}\n\nfunction nextExternal(n: NextFacts): CheckResult {\n return result(\"next-external\", nextExternalStatus(n), {\n PASS: [\"next.config: serverExternalPackages correct\", \"\"],\n WARN: [\n \"next.config: no serverExternalPackages found\",\n \"Add serverExternalPackages for native Node modules\",\n ],\n FAIL: n.hasConfig\n ? [\n \"next.config: augur-server NOT in serverExternalPackages\",\n \"augur-server must be bundled, not externalized\",\n ]\n : [\"next.config exists\", \"No next.config found\"],\n });\n}\n\nfunction ioredisSkipDetail(n: NextFacts): string {\n if (!n.hasConfig) return \"No next.config\";\n if (!n.hasExternal) return \"No serverExternalPackages\";\n return \"Site does not use ioredis\";\n}\n\nfunction nextIoredis(n: NextFacts): CheckResult {\n return result(\"next-ioredis\", ioredisStatus(n), {\n SKIP: [\"next.config: ioredis check\", ioredisSkipDetail(n)],\n PASS: [\"next.config: ioredis in serverExternalPackages\", \"\"],\n WARN: [\n \"next.config: ioredis should be in serverExternalPackages\",\n \"Site uses ioredis but it is not externalized\",\n ],\n });\n}\n\nfunction nextHeaders(n: NextFacts): CheckResult {\n return result(\"next-headers\", headersStatus(n), {\n PASS: [\"next.config: security headers\", \"\"],\n WARN: [\n \"next.config: security headers incomplete\",\n \"Missing HSTS, X-Content-Type-Options, or Permissions-Policy\",\n ],\n FAIL: [\n \"next.config: security headers\",\n n.hasConfig ? \"No headers() function found\" : \"No next.config\",\n ],\n });\n}\n\nfunction nextOptimize(n: NextFacts): CheckResult {\n return result(\"next-optimize\", optimizeStatus(n), {\n PASS: [\"next.config: optimizePackageImports\", \"\"],\n FAIL: [\n \"next.config: optimizePackageImports\",\n n.hasConfig ? \"Add experimental.optimizePackageImports for augur packages\" : \"No next.config\",\n ],\n });\n}\n\nfunction nextStrict(n: NextFacts): CheckResult {\n return result(\"next-strict\", strictStatus(n), {\n SKIP: [\"next.config: reactStrictMode\", \"No next.config\"],\n PASS: [\"next.config: reactStrictMode\", \"\"],\n WARN: [\"next.config: reactStrictMode not set\", \"Recommended for development error detection\"],\n });\n}\n\nfunction imageLoader(n: NextFacts): CheckResult {\n return result(\"image-loader\", imageLoaderStatus(n), {\n SKIP: [\"Image loader check\", \"No next.config\"],\n PASS: [\"Image loader for agr.media CDN\", \"\"],\n WARN: n.hasImages\n ? [\n \"next.config has images config but no agr.media\",\n \"Add agr.media to remotePatterns if site has product images\",\n ]\n : [\"No image configuration found\", \"Add agr.media CDN to next.config images.remotePatterns\"],\n });\n}\n\nfunction contractTests(site: Site): CheckResult {\n const present =\n site.find(\n \"__tests__/sdk-contracts\",\n \"src/__tests__/sdk-contracts\",\n \"__tests__/sdk-contract.test.ts\",\n \"src/__tests__/sdk-contract.test.ts\",\n ) !== null;\n return result(\"contract-tests\", contractTestsStatus(present), {\n PASS: [\"SDK contract tests present\", \"\"],\n FAIL: [\"SDK contract tests in __tests__/sdk-contracts/\", \"No contract tests found\"],\n });\n}\n\nfunction noWrapper(site: Site): CheckResult {\n const file = site.find(\n \"lib/augur-client.ts\",\n \"src/lib/augur-client.ts\",\n \"lib/augurClient.ts\",\n \"src/lib/augurClient.ts\",\n );\n const wraps = site.contains(file, \"class AugurClient\") || site.contains(file, \"extends AugurAPI\");\n const hasLib = site.find(\"lib\", \"src/lib\") !== null;\n return result(\"no-wrapper\", noWrapperStatus(hasLib, wraps), {\n SKIP: [\"No custom AugurClient wrapper\", \"No lib/ directory\"],\n PASS: [\"No custom AugurClient wrapper\", file ? \"Uses augur-api directly\" : \"\"],\n FAIL: [\"No custom AugurClient wrapper\", `${file} wraps AugurAPI -- use augur-api directly`],\n });\n}\n\nfunction auth(site: Site): CheckResult {\n const file = site.find(\"auth.ts\", \"lib/auth.ts\", \"src/lib/auth.ts\", \"src/auth.ts\");\n const usesFactory =\n site.contains(file, \"site.auth\") ||\n site.contains(file, \"createAuthConfig\") ||\n site.contains(file, \"createServerSite\");\n const status = authStatus(file !== null, usesFactory, site.contains(file, \"NextAuth\"));\n return result(\"auth\", status, {\n PASS: [\"Auth uses createAuthConfig or site.auth\", file ?? \"\"],\n FAIL: [\n \"Auth uses createAuthConfig or site.auth\",\n `${file} uses raw NextAuth -- migrate to createAuthConfig()`,\n ],\n WARN: file\n ? [\"Auth pattern unclear\", file]\n : [\"No auth.ts found\", \"Expected auth.ts or lib/auth.ts\"],\n });\n}\n\nfunction qualityScript(pkg: PackageJson | null): CheckResult {\n const quality = pkg?.scripts?.[\"quality\"];\n const complete =\n !!quality &&\n quality.includes(\"typecheck\") &&\n quality.includes(\"lint\") &&\n quality.includes(\"test\");\n return result(\"quality-script\", qualityStatus(!!quality, complete), {\n PASS: [\"quality script: typecheck + lint + test\", \"\"],\n WARN: [\"quality script exists but may be incomplete\", `\"quality\": \"${quality}\"`],\n FAIL: [\n \"quality script in package.json\",\n 'Add \"quality\": \"pnpm typecheck && pnpm lint && pnpm test\"',\n ],\n });\n}\n\nfunction allDeps(pkg: PackageJson): Deps {\n return { ...pkg.dependencies, ...pkg.devDependencies };\n}\n\nfunction icons(pkg: PackageJson): CheckResult {\n const deps = allDeps(pkg);\n const heroicons = !!deps[\"@heroicons/react\"];\n const status = iconsStatus(!!deps[\"react-icons\"], heroicons, !!deps[\"lucide-react\"]);\n return result(\"icons\", status, {\n PASS: [\"Uses react-icons (platform standard)\", \"\"],\n FAIL: [\n \"Uses react-icons (platform standard)\",\n heroicons\n ? \"Site uses @heroicons/react -- migrate to react-icons/lu\"\n : \"Site uses lucide-react -- migrate to react-icons/lu\",\n ],\n WARN: [\"No icon library found\", \"Expected react-icons\"],\n });\n}\n\nfunction tailwind(pkg: PackageJson): CheckResult {\n const range = allDeps(pkg)[\"tailwindcss\"] || \"\";\n return result(\"tailwind\", tailwindStatus(range), {\n PASS: [\"Tailwind v4 (platform standard)\", \"\"],\n FAIL: [\"Tailwind v4\", `Found tailwindcss: ${range} -- upgrade to ^4.0.0`],\n WARN: range\n ? [\"Tailwind version unclear\", `tailwindcss: ${range}`]\n : [\"No tailwindcss dependency found\", \"\"],\n });\n}\n\nfunction preCommitSuggestion(\n site: Site,\n lefthookFile: string | null,\n hasPreCommit: boolean,\n hasLefthook: boolean,\n): [string, string] {\n const see = `See ${RUNBOOK}#pre-commit-hooks`;\n if (hasPreCommit) return [\"Pre-commit hooks: lefthook found but no lint-staged config\", see];\n if (lefthookFile) return [\"Pre-commit hooks: lefthook found but no pre-commit section\", see];\n if (hasLefthook) {\n return [\n \"Pre-commit hooks: lefthook in devDependencies but no config file\",\n `Add lefthook.yml -- see ${RUNBOOK}#pre-commit-hooks`,\n ];\n }\n if (site.find(\".husky/pre-commit\", \".husky/_/pre-commit\")) {\n return [\"Pre-commit hooks: husky found -- consider switching to lefthook\", see];\n }\n return [\"No pre-commit hooks found -- recommended for code quality\", see];\n}\n\n/** The site's own lefthook config, else one in a parent folder (monorepo layouts). */\nfunction lefthookConfig(\n site: Site,\n reader: SiteReader,\n): { file: string | null; hasPreCommit: boolean } {\n const local = site.find(\"lefthook.yml\", \".lefthook.yml\");\n if (local) return { file: local, hasPreCommit: site.contains(local, \"pre-commit\") };\n const upward = reader.readUpward([\"lefthook.yml\", \".lefthook.yml\"]);\n if (upward === null) return { file: null, hasPreCommit: false };\n return { file: upward.path, hasPreCommit: upward.content.includes(\"pre-commit\") };\n}\n\nfunction hasLintStaged(site: Site, pkg: PackageJson | null): boolean {\n const files = [\n \".lintstagedrc\",\n \".lintstagedrc.json\",\n \"lint-staged.config.js\",\n \"lint-staged.config.mjs\",\n ];\n return !!pkg?.[\"lint-staged\"] || site.find(...files) !== null;\n}\n\nfunction preCommit(site: Site, reader: SiteReader, pkg: PackageJson | null): CheckResult {\n const { file: lefthookFile, hasPreCommit } = lefthookConfig(site, reader);\n const hasLefthook = lefthookFile !== null || hasDep(pkg, \"lefthook\");\n return result(\"pre-commit\", preCommitStatus(hasPreCommit, hasLintStaged(site, pkg)), {\n PASS: [\"Pre-commit hooks: lefthook + lint-staged\", lefthookFile ?? \"package.json\"],\n SUGGEST: preCommitSuggestion(site, lefthookFile, hasPreCommit, hasLefthook),\n });\n}\n\nfunction proxyLocalHooks(site: Site): CheckResult {\n const file = site.find(\"lib/augur.ts\", \"src/lib/augur.ts\", \"hooks/augur.ts\");\n const hasUseQuery = site.contains(file, /useQuery|useInfiniteQuery/);\n const wrapsActions = site.contains(file, /unwrap\\(|serverAction|augur-server\\/actions/);\n return result(\"proxy-local-hooks\", localHooksStatus(hasUseQuery), {\n PASS: [\"No local hook wrappers detected\", \"\"],\n SUGGEST: wrapsActions\n ? [\n \"Local hooks wrapping server actions -- replace with createServerQueryProxy\",\n `${file} -- see ${RUNBOOK}#proxy-migration`,\n ]\n : [\"Local hooks found -- check if createServerQueryProxy can replace them\", file ?? \"\"],\n });\n}\n\nfunction proxyServerQuery(site: Site): CheckResult {\n const serverProxy =\n site.proxyFilesMatching(/createServerQueryProxy|createAugurOptions/).length > 0;\n const augurOptions = site.proxyFilesMatching(/useAugurOptions|registerQueryAction/).length > 0;\n return result(\"proxy-server-query\", serverQueryStatus(serverProxy, augurOptions), {\n PASS: serverProxy\n ? [\"Uses createServerQueryProxy for data fetching\", \"\"]\n : [\"Uses useAugurOptions for data fetching\", \"\"],\n SUGGEST: [\n \"No proxy-based data fetching detected\",\n \"Consider createServerQueryProxy (augur-server/hooks) or useAugurOptions (augur-hooks)\",\n ],\n });\n}\n\nfunction queryClientScope(site: Site): CheckResult {\n const files = site.proxyFilesMatching(MODULE_SCOPE_CLIENT);\n return result(\"query-client-scope\", noOffenderStatus(files.length), {\n PASS: [\"No module-scope QueryClient\", \"\"],\n FAIL: [\n \"QueryClient created at module scope (shared across server requests)\",\n `${files.join(\", \")}: create it per request (see ${GETTING_STARTED}#provider-setup)`,\n ],\n });\n}\n\nfunction queryGcTime(site: Site): CheckResult {\n const files = site.proxyFilesMatching(FINITE_GC_TIME);\n return result(\"query-gc-time\", noOffenderStatus(files.length), {\n PASS: [\"No finite gcTime in provider/query setup\", \"\"],\n FAIL: [\n \"Finite gcTime in provider/query setup (leaks memory during SSR)\",\n `${files.join(\", \")}: remove it, or wrap with resolveGcTime() from augur-core`,\n ],\n });\n}\n\nfunction apiVersion(pkg: PackageJson): CheckResult {\n const range = allDeps(pkg)[\"@simpleapps-com/augur-api\"] || \"\";\n const match = /(\\d{4})\\.(\\d+)\\.(\\d+)/.exec(range);\n const status = apiVersionStatus(\n match !== null,\n Number(match?.[1]),\n Number(match?.[2]),\n Number(match?.[3]),\n );\n return result(\"api-version\", status, {\n PASS: [\"augur-api SDK version supports typed proxies\", range],\n WARN: match\n ? [\n \"augur-api SDK may lack typed proxy support\",\n `${range} -- upgrade to >= 2026.3.7 for typed responses`,\n ]\n : range\n ? [\"augur-api version format not recognized\", range]\n : [\"No augur-api dependency found\", \"\"],\n });\n}\n\n/** The short name of an augur package (`augur-core`). */\nfunction shortName(name: string): string {\n return name.replace(\"@simpleapps-com/\", \"\");\n}\n\n/** augur-version-latest: each installed augur package against its own latest (no lockstep). */\nfunction augurVersionLatest(reader: SiteReader, pkg: PackageJson | null): CheckResult {\n const deps = pkg ? allDeps(pkg) : {};\n const installed = AUGUR_PACKAGES.filter((name) => deps[name]);\n const latest = installed.map((name) => reader.latestVersion(name));\n const states: PackageState[] = installed.map((name, k) =>\n packageStateOf(deps[name] as string, latest[k] as string),\n );\n const behind = installed.filter((_, k) => states[k] === \"behind\");\n return result(\"augur-version-latest\", latestStatus(states), {\n SKIP: installed.length\n ? [\n \"Augur latest version check\",\n \"Could not fetch latest version from npm (offline or not published)\",\n ]\n : [\"Augur latest version check\", pkg ? \"No augur packages found\" : \"No package.json\"],\n PASS: [\n \"Augur packages on their latest versions\",\n installed.map((name, k) => `${shortName(name)}: ${latest[k]}`).join(\", \"),\n ],\n FAIL: [\n \"Augur packages should be on their latest versions\",\n `${behind\n .map(\n (name) =>\n `${shortName(name)}: installed ${deps[name]}, latest ${latest[installed.indexOf(name)]}`,\n )\n .join(\", \")} -- set the latest in package.json, then run pnpm install (not pnpm update)`,\n ],\n });\n}\n\n/** Every check, in the original order; the package.json checks only when there is one. */\nexport function runChecks(reader: SiteReader): CheckResult[] {\n const site = new Site(reader);\n const pkg = site.json<PackageJson>(\"package.json\");\n const eslintFile = site.find(\"eslint.config.mjs\", \"eslint.config.js\");\n const next = nextFacts(site, pkg);\n return [\n siteConfig(site),\n serverSite(site),\n actions(site),\n siteHooks(site),\n ssrOptions(site),\n tsconfig(site),\n eslint(site, eslintFile),\n eslintDeprecated(site, eslintFile),\n prettier(site, pkg),\n knip(site, pkg),\n nextExternal(next),\n nextIoredis(next),\n nextHeaders(next),\n nextOptimize(next),\n nextStrict(next),\n contractTests(site),\n noWrapper(site),\n auth(site),\n imageLoader(next),\n qualityScript(pkg),\n ...(pkg ? [icons(pkg), tailwind(pkg)] : []),\n preCommit(site, reader, pkg),\n proxyLocalHooks(site),\n proxyServerQuery(site),\n queryClientScope(site),\n queryGcTime(site),\n ...(pkg ? [apiVersion(pkg)] : []),\n augurVersionLatest(reader, pkg),\n ];\n}\n","/** The {@link SiteReader} over the real file system and npm. */\n\nimport { execFileSync } from \"node:child_process\";\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { dirname, resolve } from \"node:path\";\nimport type { SiteReader } from \"./checks\";\n\n/** The first of `names` found walking up from `start`, stopping at a git repo root. */\nfunction findUpward(start: string, names: string[]): string | null {\n let dir = start;\n const root = resolve(\"/\");\n while (dir !== root) {\n const hit = names.map((name) => resolve(dir, name)).find((path) => existsSync(path));\n if (hit) return hit;\n if (existsSync(resolve(dir, \".git\"))) break;\n dir = dirname(dir);\n }\n return null;\n}\n\n/** A package's latest published version from `npm view`, or \"\" when npm cannot say. */\nfunction npmLatest(packageName: string): string {\n try {\n return execFileSync(\"npm\", [\"view\", packageName, \"version\"], {\n encoding: \"utf-8\",\n stdio: [\"ignore\", \"pipe\", \"ignore\"],\n }).trim();\n } catch {\n return \"\";\n }\n}\n\nexport function nodeReader(siteDir: string, latestVersion = npmLatest): SiteReader {\n const read = (path: string) => (existsSync(path) ? readFileSync(path, \"utf-8\") : null);\n return {\n exists: (relPath) => existsSync(resolve(siteDir, relPath)),\n read: (relPath) => read(resolve(siteDir, relPath)),\n readUpward: (names) => {\n const path = findUpward(siteDir, names);\n return path === null ? null : { path, content: readFileSync(path, \"utf-8\") };\n },\n latestVersion,\n };\n}\n","/** augur-doctor's scorecard: the check results as terminal lines, grouped as before. */\n\nimport { RUNBOOK, type CheckResult } from \"./checks\";\nimport { countStatusFrom, scoredTotal, type Status } from \"./rules\";\n\nconst ICONS: Record<Status, string> = {\n PASS: \"\\x1b[32m[PASS]\\x1b[0m\",\n FAIL: \"\\x1b[31m[FAIL]\\x1b[0m\",\n WARN: \"\\x1b[33m[WARN]\\x1b[0m\",\n SUGGEST: \"\\x1b[36m[SUGGEST]\\x1b[0m\",\n SKIP: \"\\x1b[90m[SKIP]\\x1b[0m\",\n};\n\n/** The scorecard's groups, in order (no lockstep: the one-version check is gone). */\nconst GROUPS: [string, string[]][] = [\n [\"Site Architecture\", [\"site-config\", \"server-site\", \"actions\", \"site-hooks\", \"ssr-options\"]],\n [\n \"Config Alignment\",\n [\"tsconfig\", \"eslint\", \"eslint-deprecated\", \"prettier\", \"knip\", \"tailwind\", \"icons\"],\n ],\n [\n \"Next.js Config\",\n [\"next-external\", \"next-ioredis\", \"next-headers\", \"next-optimize\", \"next-strict\"],\n ],\n [\"Testing & Quality\", [\"contract-tests\", \"quality-script\", \"pre-commit\"]],\n [\n \"Proxy Adoption\",\n [\n \"proxy-local-hooks\",\n \"proxy-server-query\",\n \"query-client-scope\",\n \"query-gc-time\",\n \"api-version\",\n ],\n ],\n [\"Package Versions\", [\"augur-version-latest\"]],\n [\"Patterns\", [\"no-wrapper\", \"auth\", \"image-loader\"]],\n];\n\n/** A group's lines: its heading, each of its results, a blank line. */\nfunction groupLines(name: string, ids: string[], results: CheckResult[]): string[] {\n const lines = ids.flatMap((id) => {\n const r = results.find((x) => x.id === id);\n if (!r) return [];\n const detail = r.detail ? ` \\x1b[90m${r.detail}\\x1b[0m` : \"\";\n return [` ${ICONS[r.status]} ${r.label}${detail}`];\n });\n return [`\\x1b[1m${name}\\x1b[0m`, ...lines, \"\"];\n}\n\n/** The score line: passing out of the scored total, then the failing, warning, suggestion counts. */\nfunction scoreLine(statuses: Status[]): string {\n const count = (s: Status) => countStatusFrom(statuses, s, 0);\n const failing = count(\"FAIL\");\n const warnings = count(\"WARN\");\n const suggestions = count(\"SUGGEST\");\n return (\n `\\x1b[1mScore: ${count(\"PASS\")}/${scoredTotal(statuses)}\\x1b[0m` +\n (failing > 0 ? ` \\x1b[31m(${failing} failing)\\x1b[0m` : \"\") +\n (warnings > 0 ? ` \\x1b[33m(${warnings} warnings)\\x1b[0m` : \"\") +\n (suggestions > 0 ? ` \\x1b[36m(${suggestions} suggestions)\\x1b[0m` : \"\")\n );\n}\n\n/** The whole scorecard for a site. */\nexport function reportLines(siteName: string, siteDir: string, results: CheckResult[]): string[] {\n const statuses = results.map((r) => r.status);\n const runbook =\n countStatusFrom(statuses, \"FAIL\", 0) > 0\n ? [\"See the migration runbook for fixes:\", RUNBOOK, \"\"]\n : [];\n return [\n \"\",\n `\\x1b[1mAugur Doctor: ${siteName}\\x1b[0m`,\n `Path: ${siteDir}`,\n \"\",\n ...GROUPS.flatMap(([name, ids]) => groupLines(name, ids, results)),\n scoreLine(statuses),\n \"\",\n ...runbook,\n ];\n}\n","#!/usr/bin/env node\n/**\n * augur-doctor -- Site health check against the Augur platform standard.\n *\n * Usage:\n * npx augur-doctor (runs against current directory)\n * npx augur-doctor /path/to/site\n *\n * Checks a consumer site for alignment with the reference implementation and prints a\n * pass/fail/warn scorecard.\n */\n\nimport { runDoctor } from \"./doctor/cli\";\n\nprocess.exit(\n runDoctor(process.argv.slice(2), {\n log: (line) => console.log(line),\n error: (line) => console.error(line),\n }),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,SAAS,cAAAA,mBAAkB;AAC3B,SAAS,UAAU,WAAAC,gBAAe;;;ACmElC,IAAM,cAAc;AAAA,EAClB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,IAAM,gBAAgB;AAC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AI,CAACA,YAAWD,SAAQ,SAAS,cAAc,CAAC,GAAG;AACjD,OAAG,MAAM,6BAA6B,OAAO,EAAE;AAC/C,UAAM,QAAQ,CAAC,SAAS,GAAG,MAAM,IAAI,CAAC;AACtC,WAAO;AAAA,EACT;AACA,QAAM,UAAU,WAAW,GAAG,UAAU,YAAY,OAAO,CAAC;AAC5D,cAAY,SAAS,OAAO,GAAG,SAAS,OAAO,EAAE,QAAQ,CAAC,SAAS,GAAG,IAAI,IAAI,CAAC;AAC/E,SAAO,WAAW,QAAQ,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;AAChD;;;AI3BA,QAAQ;AAAA,EACN,UAAU,QAAQ,KAAK,MAAM,CAAC,GAAG;AAAA,IAC/B,KAAK,CAAC,SAAS,QAAQ,IAAI,IAAI;AAAA,IAC/B,OAAO,CAAC,SAAS,QAAQ,MAAM,IAAI;AAAA,EACrC,CAAC;AACH;","names":["existsSync","resolve","resolve","existsSync"]}
|
|
1
|
+
{"version":3,"sources":["../src/doctor/cli.ts","../../utils/src/lists.ts","../src/doctor/checks.ts","../src/doctor/node-reader.ts","../src/doctor/report.ts","../src/augur-doctor.ts"],"sourcesContent":["/** augur-doctor's command line: `augur-doctor [site]` (the current directory by default). */\n\nimport { existsSync } from \"node:fs\";\nimport { basename, resolve } from \"node:path\";\nimport { runChecks, type SiteReader } from \"./checks\";\nimport { nodeReader } from \"./node-reader\";\nimport { reportLines } from \"./report\";\nimport { exitCodeOf } from \"./rules\";\n\n/** Where the CLI writes, and how it reads a site (the real file system by default). */\nexport interface CliIo {\n log: (line: string) => void;\n error: (line: string) => void;\n reader?: (siteDir: string) => SiteReader;\n}\n\nconst USAGE = [\n \"\",\n \"Usage: augur-doctor [/path/to/site]\",\n \"\",\n \"Run from a site directory, or pass the path as an argument.\",\n \"Examples:\",\n \" npx augur-doctor\",\n \" npx augur-doctor ./sites/example-site\",\n];\n\n/** Runs the doctor and returns its exit code: 1 for a missing site or any failing check. */\nexport function runDoctor(args: string[], io: CliIo): number {\n const siteDir = resolve(args[0] || \".\");\n if (!existsSync(siteDir)) {\n io.error(`Site directory not found: ${siteDir}`);\n return 1;\n }\n if (!existsSync(resolve(siteDir, \"package.json\"))) {\n io.error(`No package.json found in: ${siteDir}`);\n USAGE.forEach((line) => io.error(line));\n return 1;\n }\n const results = runChecks((io.reader ?? nodeReader)(siteDir));\n reportLines(basename(siteDir), siteDir, results).forEach((line) => io.log(line));\n return exitCodeOf(results.map((r) => r.status));\n}\n","//@ backend dafny\nimport { includesFrom } from \"./includes\";\nimport { compareFrom, endsWith } from \"./strings\";\n\n/* Pure list helpers, verified with LemmaScript → Dafny (model: models/Utils.dfy; link:\n models/links/utils-lists.dfy). */\n\n/**\n * The items from index `i` joined by `sep` (JS `xs.join(sep)` at i = 0).\n *\n * @ensures exactly the model's JoinFrom\n */\nexport function joinFrom(xs: string[], sep: string, i: number): string {\n //@ verify\n //@ type i nat\n //@ requires i >= 0\n //@ decreases xs.length - i\n //@ ensures i >= xs.length ==> \\result === \"\"\n //@ ensures i + 1 === xs.length ==> \\result === xs[i]\n //@ ensures i + 1 < xs.length ==> (\\result.length >= xs[i].length + sep.length && \\result.slice(0, xs[i].length + sep.length) === xs[i] + sep)\n if (i >= xs.length) return \"\";\n return joinRange(xs, sep, i, xs.length);\n}\n\n/**\n * The items from `lo` up to `hi` (at least one) joined by `sep`, by halves: a list of n items\n * recurses log n deep, so a generated file of many thousand lines fits the stack.\n *\n * @ensures = the model's JoinFrom(xs[..hi], sep, lo) (links/utils-lists.dfy, by JoinFromSplits)\n */\nfunction joinRange(xs: string[], sep: string, lo: number, hi: number): string {\n //@ verify\n //@ type lo nat\n //@ type hi nat\n //@ requires lo < hi && hi <= xs.length\n //@ decreases hi - lo\n //@ ensures hi === lo + 1 ==> \\result === xs[lo]\n if (hi - lo === 1) return xs[lo] as string;\n const mid = lo + Math.floor((hi - lo) / 2);\n return joinRange(xs, sep, lo, mid) + sep + joinRange(xs, sep, mid, hi);\n}\n\n/**\n * The first index ≥ `i` holding `x`, or -1 (JS `xs.indexOf(x, i)`): how a table of parallel\n * lists is read.\n *\n * @ensures result = -1 ∨ (i ≤ result < |xs| ∧ xs[result] = x) — and the first such index: the\n * model's ItemIndexFrom (links/utils-lists.dfy)\n */\nexport function itemIndexFrom(xs: string[], x: string, i: number): number {\n //@ verify\n //@ type i nat\n //@ requires i >= 0\n //@ decreases xs.length - i\n //@ ensures \\result === -1 || (i <= \\result && \\result < xs.length && xs[\\result] === x)\n //@ ensures \\result === -1 ==> forall(k: nat, (i <= k && k < xs.length) ==> xs[k] !== x)\n //@ ensures \\result >= 0 ==> forall(k: nat, (i <= k && k < \\result) ==> xs[k] !== x)\n if (i >= xs.length) return -1;\n return (xs[i] as string) === x ? i : itemIndexFrom(xs, x, i + 1);\n}\n\n/**\n * The sum of `xs[i..]`, 0 past the end (JS `xs.slice(i).reduce((a, b) => a + b, 0)`).\n *\n * @ensures result = Σ xs[i..] — exactly the model's SumFrom\n */\nexport function sumFrom(xs: number[], i: number): number {\n //@ verify\n //@ type i nat\n //@ requires i >= 0\n //@ decreases xs.length - i\n //@ ensures \\result === (i >= xs.length ? 0 : xs[i] + sumFrom(xs, i + 1))\n if (i >= xs.length) return 0;\n return (xs[i] as number) + sumFrom(xs, i + 1);\n}\n\n/**\n * Whether `x` is one of `xs` from index `i` on (JS `xs.includes(x)` at i = 0).\n *\n * @ensures result ⟺ ∃ k. i ≤ k < |xs| ∧ xs[k] = x — exactly the model's HasItemFrom\n */\nexport function hasItemFrom(xs: string[], x: string, i: number): boolean {\n //@ verify\n //@ type i nat\n //@ requires i >= 0 && i <= xs.length\n //@ decreases xs.length - i\n //@ ensures \\result <==> exists(k: nat, i <= k && k < xs.length && xs[k] === x)\n // `===`, not `>=`: past the end xs[i] is undefined, never x, so `>=` vs `>` is equivalent\n if (i === xs.length) return false;\n if ((xs[i] as string) === x) return true;\n return hasItemFrom(xs, x, i + 1);\n}\n\n/**\n * Whether the number `x` is one of `xs` from index `i` on (JS `xs.includes(x)` at i = 0, for\n * numbers).\n *\n * @ensures result ⟺ ∃ k. i ≤ k < |xs| ∧ xs[k] = x — exactly the model's HasNumberFrom\n */\nexport function hasNumberFrom(xs: number[], x: number, i: number): boolean {\n //@ verify\n //@ type i nat\n //@ requires i >= 0 && i <= xs.length\n //@ decreases xs.length - i\n //@ ensures \\result <==> exists(k: nat, i <= k && k < xs.length && xs[k] === x)\n if (i === xs.length) return false;\n if ((xs[i] as number) === x) return true;\n return hasNumberFrom(xs, x, i + 1);\n}\n\n/**\n * Whether `s` ends with one of `xs` from index `i` on (a regex `(a|b|…)$` at i = 0).\n *\n * @ensures exactly the model's EndsWithAnyFrom\n */\nexport function endsWithAnyFrom(s: string, xs: string[], i: number): boolean {\n //@ verify\n //@ type i nat\n //@ requires i >= 0 && i <= xs.length\n //@ decreases xs.length - i\n //@ ensures \\result <==> exists(k: nat, i <= k && k < xs.length && endsWith(s, xs[k]))\n if (i === xs.length) return false;\n if (endsWith(s, xs[i] as string)) return true;\n return endsWithAnyFrom(s, xs, i + 1);\n}\n\n/**\n * Whether one of `xs` from index `i` on occurs in `s` (a regex `(a|b|…)` at i = 0).\n *\n * @ensures exactly the model's IncludesAnyFrom\n */\nexport function includesAnyFrom(s: string, xs: string[], i: number): boolean {\n //@ verify\n //@ type i nat\n //@ requires i >= 0 && i <= xs.length\n //@ decreases xs.length - i\n //@ ensures \\result <==> exists(k: nat, i <= k && k < xs.length && includesFrom(s, xs[k], 0))\n if (i === xs.length) return false;\n if (includesFrom(s, xs[i] as string, 0)) return true;\n return includesAnyFrom(s, xs, i + 1);\n}\n\n/**\n * The items of `xs` from index `i` that `allowed` doesn't hold, in order (JS\n * `xs.filter((x) => !allowed.includes(x))` at i = 0).\n *\n * @ensures exactly the model's NotInFrom (NotInFromIsTheUnknown: the unknown ones, all of them)\n */\nexport function notInFrom(xs: string[], allowed: string[], i: number): string[] {\n //@ verify\n //@ type i nat\n //@ requires i >= 0\n //@ decreases xs.length - i\n //@ ensures i >= xs.length ==> \\result.length === 0\n if (i >= xs.length) return [];\n const rest = notInFrom(xs, allowed, i + 1);\n return hasItemFrom(allowed, xs[i] as string, 0) ? rest : [xs[i] as string, ...rest];\n}\n\n/**\n * Whether `x` is one of the first `k` items of `xs` (JS `xs.slice(0, k).includes(x)`).\n *\n * @ensures result ⟺ ∃ j < k. xs[j] = x — exactly the model's HasItemBelow\n */\nexport function hasItemBelow(xs: string[], x: string, k: number): boolean {\n //@ verify\n //@ type k nat\n //@ requires k >= 0 && k <= xs.length\n //@ decreases k\n //@ ensures \\result <==> exists(j: nat, j < k && xs[j] === x)\n if (k === 0) return false;\n if ((xs[k - 1] as string) === x) return true;\n return hasItemBelow(xs, x, k - 1);\n}\n\n/**\n * The items of `xs` from index `i` that repeat an earlier item, in order (at i = 0, every\n * duplicate after its first; none ⟺ the items are unique).\n *\n * @ensures exactly the model's RepeatsFrom (RepeatsFromEmpty: none exactly when unique)\n */\nexport function repeatsFrom(xs: string[], i: number): string[] {\n //@ verify\n //@ type i nat\n //@ requires i >= 0\n //@ decreases xs.length - i\n //@ ensures i >= xs.length ==> \\result.length === 0\n if (i >= xs.length) return [];\n const rest = repeatsFrom(xs, i + 1);\n return hasItemBelow(xs, xs[i] as string, i) ? [xs[i] as string, ...rest] : rest;\n}\n\n/**\n * The items of `xs` from index `i` that no earlier item repeats, in order (at i = 0, JS\n * `[...new Set(xs)]`: each item once, first occurrence kept).\n *\n * @ensures exactly the model's FirstsFrom\n */\nexport function firstsFrom(xs: string[], i: number): string[] {\n //@ verify\n //@ type i nat\n //@ requires i >= 0\n //@ decreases xs.length - i\n //@ ensures i >= xs.length ==> \\result.length === 0\n //@ ensures forall(j: nat, forall(k: nat, (j < k && k < \\result.length) ==> \\result[j] !== \\result[k]))\n if (i >= xs.length) return [];\n const rest = firstsFrom(xs, i + 1);\n return hasItemBelow(xs, xs[i] as string, i) ? rest : [xs[i] as string, ...rest];\n}\n\n/**\n * At most the first `n` items (JS `xs.slice(0, n)` for n ≥ 0).\n *\n * @ensures exactly the model's TakeAtMost\n */\nexport function takeAtMost(xs: string[], n: number): string[] {\n //@ verify\n //@ type n nat\n //@ requires n >= 0\n //@ ensures \\result === (n < xs.length ? xs.slice(0, n) : xs)\n return n < xs.length ? xs.slice(0, n) : xs;\n}\n\n/**\n * Whether two number lists are equal from index `i` on (the whole lists at i = 0).\n *\n * @ensures result ⟺ |a| = |b| ∧ ∀ k ∈ [i, |a|). a[k] = b[k] — exactly the model's\n * SameNumbersFrom\n */\nexport function sameNumbersFrom(a: number[], b: number[], i: number): boolean {\n //@ verify\n //@ type i nat\n //@ requires i >= 0 && i <= a.length\n //@ decreases a.length - i\n //@ ensures \\result <==> (a.length === b.length && forall(k: nat, i <= k && k < a.length ==> a[k] === b[k]))\n if (a.length !== b.length) return false;\n if (i === a.length) return true;\n return (a[i] as number) === (b[i] as number) && sameNumbersFrom(a, b, i + 1);\n}\n\n/**\n * Whether two text lists are equal from index `i` on (the whole lists at i = 0, as their\n * `JSON.stringify` texts compare).\n *\n * @ensures result ⟺ |a| = |b| ∧ ∀ k ∈ [i, |a|). a[k] = b[k] — exactly the model's\n * SameTextsFrom\n */\nexport function sameTextsFrom(a: string[], b: string[], i: number): boolean {\n //@ verify\n //@ type i nat\n //@ requires i >= 0 && i <= a.length\n //@ decreases a.length - i\n //@ ensures \\result <==> (a.length === b.length && forall(k: nat, i <= k && k < a.length ==> a[k] === b[k]))\n if (a.length !== b.length) return false;\n if (i === a.length) return true;\n return (a[i] as string) === (b[i] as string) && sameTextsFrom(a, b, i + 1);\n}\n\n/**\n * The texts in code-unit order (JS's default `sort`, stable: of two equal texts the earlier\n * stays first).\n *\n * @ensures exactly the model's SortedTexts (in the link); the same length\n */\nexport function sortedTexts(xs: string[]): string[] {\n //@ verify\n //@ ensures \\result.length === xs.length\n if (xs.length === 0) return [];\n return insertText(xs[0] as string, sortedTexts(xs.slice(1)));\n}\n\n/**\n * `x` placed into sorted texts before the first it doesn't sort after.\n *\n * @ensures exactly the model's InsertText (in the link); one longer\n */\nexport function insertText(x: string, sorted: string[]): string[] {\n //@ verify\n //@ ensures \\result.length === sorted.length + 1\n if (sorted.length === 0) return [x];\n const first = sorted[0] as string;\n if (compareFrom(x, first, 0) <= 0) return [x, ...sorted];\n return [first, ...insertText(x, sorted.slice(1))];\n}\n","/**\n * augur-doctor's checks: each reads facts from the site through a {@link SiteReader} and takes\n * its outcome from the proved rules (rules.ts). Labels and details are the original\n * bin/augur-doctor.mjs text, except the version checks (no lockstep, owner 2026-11-05).\n */\n\nimport { firstsFrom } from \"@atlas/utils/lists\";\nimport {\n actionsStatus,\n apiVersionStatus,\n authStatus,\n contractTestsStatus,\n deprecatedStatus,\n fileUses,\n gcTimeOffenderIn,\n headersStatus,\n iconsStatus,\n imageLoaderStatus,\n ioredisStatus,\n knipStatus,\n latestStatus,\n localHooksStatus,\n nextExternalStatus,\n noOffenderStatus,\n noWrapperStatus,\n optimizeStatus,\n packageStateOf,\n preCommitStatus,\n presetStatus,\n qualityStatus,\n serverQueryStatus,\n siteHooksStatus,\n strictStatus,\n tailwindStatus,\n tsconfigStatus,\n utilsRangeBeforeFix,\n type NextFacts,\n type PackageState,\n type Status,\n} from \"./rules\";\n\n/** What the checks may ask of a site. Paths are relative to the site directory. */\nexport interface SiteReader {\n /** Whether the path exists. */\n exists(relPath: string): boolean;\n /** The file's text, or null when it is missing. */\n read(relPath: string): string | null;\n /** The first of these names found walking up from the site to its git root: its path and text. */\n readUpward(names: string[]): { path: string; content: string } | null;\n /** The package's latest published version, or \"\" when npm cannot say. */\n latestVersion(packageName: string): string;\n /** The `.ts`/`.tsx` files under these folders, recursively, `node_modules` skipped ([] for a missing one). */\n sourceFiles(dirs: string[]): string[];\n}\n\n/** One line of the scorecard. */\nexport interface CheckResult {\n status: Status;\n id: string;\n label: string;\n detail: string;\n}\n\ntype Deps = Record<string, string | undefined>;\n\n/** The parts of a site's package.json the checks read. */\ninterface PackageJson {\n dependencies?: Deps;\n devDependencies?: Deps;\n scripts?: Record<string, string | undefined>;\n prettier?: unknown;\n \"lint-staged\"?: unknown;\n}\n\n/** Files where proxy pattern wiring commonly lives across different site layouts. */\nconst PROXY_FILES = [\n \"lib/augur-query.ts\",\n \"src/lib/augur-query.ts\",\n \"lib/augur.ts\",\n \"src/lib/augur.ts\",\n \"lib/augur-options.ts\",\n \"src/lib/augur-options.ts\",\n \"app/providers.tsx\",\n \"src/app/providers.tsx\",\n \"app/context/ReactQueryProvider.tsx\",\n \"src/app/context/ReactQueryProvider.tsx\",\n];\n\nconst PROXY_PATTERN = /createServerQueryProxy|queryAction|createAugurOptions|registerQueryAction/;\nconst MODULE_SCOPE_CLIENT = /^(?:export\\s+)?(?:const|let|var)\\s+\\w+\\s*=\\s*new QueryClient\\(/m;\n// query-gc-time's scans (a finite gcTime, a CACHE_CONFIG spread, the range's version) are the\n// proved rules.ts `gcTimeOffenderIn` and `utilsRangeBeforeFix` (#94).\n/** Where query options are written besides the proxy files (#94). */\nconst QUERY_SOURCE_DIRS = [\"hooks\", \"app\", \"src/hooks\", \"src/app\"];\n\n/** The augur packages a site may install; each is checked against its own latest. */\nexport const AUGUR_PACKAGES = [\n \"@simpleapps-com/augur-config\",\n \"@simpleapps-com/augur-core\",\n \"@simpleapps-com/augur-hooks\",\n \"@simpleapps-com/augur-mobile\",\n \"@simpleapps-com/augur-server\",\n \"@simpleapps-com/augur-tailwind\",\n \"@simpleapps-com/augur-utils\",\n \"@simpleapps-com/augur-web\",\n];\n\n/** The migration runbook on augur.build, which the scorecard and the checks' details link to. */\nexport const RUNBOOK = \"https://augur.build/docs/packages/migration-runbook\";\nconst GETTING_STARTED = \"https://augur.build/docs/packages/getting-started\";\n\n/**\n * A check's result for a status, with a label (and detail) per status. Each check lists every\n * status its rule can return (rules.ts and its ensures), so the lookup always finds one.\n */\nfunction result(\n id: string,\n status: Status,\n labels: Partial<Record<Status, [string, string]>>,\n): CheckResult {\n const [label, detail] = labels[status]!;\n return { status, id, label, detail };\n}\n\n/** The reads every check shares. */\nclass Site {\n constructor(private readonly reader: SiteReader) {}\n\n find(...candidates: string[]): string | null {\n return candidates.find((c) => this.reader.exists(c)) ?? null;\n }\n\n read(relPath: string): string | null {\n return this.reader.read(relPath);\n }\n\n contains(relPath: string | null, pattern: string | RegExp): boolean {\n const content = relPath === null ? null : this.reader.read(relPath);\n if (!content) return false;\n return typeof pattern === \"string\" ? content.includes(pattern) : pattern.test(content);\n }\n\n json<T>(relPath: string): T | null {\n const content = this.reader.read(relPath);\n if (!content) return null;\n try {\n return JSON.parse(content) as T;\n } catch {\n return null;\n }\n }\n\n /** The proxy files that exist and match the pattern. */\n proxyFilesMatching(pattern: RegExp): string[] {\n return PROXY_FILES.filter((f) => this.contains(f, pattern));\n }\n\n /** The proxy files, then the query source folders' files, each once, in that order. */\n queryFiles(): { path: string; text: string }[] {\n const paths = firstsFrom([...PROXY_FILES, ...this.reader.sourceFiles(QUERY_SOURCE_DIRS)], 0);\n return paths.flatMap((path) => {\n const text = this.reader.read(path);\n return text === null ? [] : [{ path, text }];\n });\n }\n}\n\nfunction siteConfig(site: Site): CheckResult {\n const file = site.find(\n \"lib/augur-config.ts\",\n \"src/lib/augur-config.ts\",\n \"config/augur-config.ts\",\n );\n return result(\"site-config\", fileUses(file !== null, site.contains(file, \"defineSite\")), {\n PASS: [\"augur-config.ts with defineSite()\", file ?? \"\"],\n WARN: [\"augur-config.ts exists but does not use defineSite()\", file ?? \"\"],\n FAIL: [\"augur-config.ts with defineSite()\", \"Expected lib/augur-config.ts\"],\n });\n}\n\nfunction serverSite(site: Site): CheckResult {\n const file = site.find(\"lib/augur-site.ts\", \"src/lib/augur-site.ts\", \"config/augur-site.ts\");\n return result(\"server-site\", fileUses(file !== null, site.contains(file, \"createServerSite\")), {\n PASS: [\"augur-site.ts using createServerSite()\", file ?? \"\"],\n WARN: [\"augur-site.ts exists but does not use createServerSite()\", file ?? \"\"],\n FAIL: [\"augur-site.ts using createServerSite()\", \"Expected lib/augur-site.ts\"],\n });\n}\n\nfunction actions(site: Site): CheckResult {\n const file = site.find(\"lib/augur-actions.ts\", \"src/lib/augur-actions.ts\", \"lib/actions.ts\");\n const reExports = site.contains(file, /site\\.actions|actions\\./);\n const usesProxy = site.proxyFilesMatching(PROXY_PATTERN).length > 0;\n const status = actionsStatus(file !== null, reExports, usesProxy);\n return result(\"actions\", status, {\n PASS: file\n ? [\"augur-actions.ts re-exporting site.actions\", file]\n : [\"Using proxy pattern (augur-actions.ts not needed)\", \"\"],\n WARN: [\"augur-actions.ts exists but may not re-export site.actions\", file ?? \"\"],\n FAIL: [\n \"augur-actions.ts re-exporting site.actions.*\",\n \"Expected lib/augur-actions.ts or createServerQueryProxy usage\",\n ],\n });\n}\n\nfunction siteHooks(site: Site): CheckResult {\n const file = site.find(\n \"lib/augur.ts\",\n \"src/lib/augur.ts\",\n \"lib/augur-hooks.ts\",\n \"src/lib/augur-hooks.ts\",\n );\n const createSiteHooks = site.contains(file, \"createSiteHooks\");\n const status = siteHooksStatus(\n file !== null,\n createSiteHooks,\n site.contains(file, /AugurHooksProvider|augur-hooks/),\n );\n return result(\"site-hooks\", status, {\n PASS: [\n createSiteHooks ? \"augur.ts with createSiteHooks()\" : \"augur.ts with hooks setup\",\n file ?? \"\",\n ],\n WARN: [\"augur.ts exists but does not use createSiteHooks()\", file ?? \"\"],\n FAIL: [\"augur.ts with createSiteHooks()\", \"Expected lib/augur.ts\"],\n });\n}\n\nfunction ssrOptions(site: Site): CheckResult {\n const file = site.find(\"lib/augur-options.ts\", \"src/lib/augur-options.ts\");\n return result(\"ssr-options\", fileUses(file !== null, site.contains(file, /Options/)), {\n PASS: [\"augur-options.ts for SSR prefetching\", file ?? \"\"],\n WARN: [\"augur-options.ts exists but may not export options\", file ?? \"\"],\n FAIL: [\"augur-options.ts for SSR prefetching\", \"Expected lib/augur-options.ts\"],\n });\n}\n\nfunction tsconfig(site: Site): CheckResult {\n const config = site.json<{ extends?: string }>(\"tsconfig.json\");\n const extendsVal = config?.extends || \"\";\n const status = tsconfigStatus(\n config !== null,\n extendsVal.includes(\"augur-config/tsconfig/next\"),\n extendsVal.includes(\"augur-config\"),\n );\n return result(\"tsconfig\", status, {\n PASS: [\"tsconfig.json extends augur-config/tsconfig/next\", \"\"],\n WARN: [\"tsconfig.json extends augur-config but not /tsconfig/next\", `extends: ${extendsVal}`],\n FAIL: config\n ? [\n \"tsconfig.json extends augur-config/tsconfig/next\",\n extendsVal ? `extends: ${extendsVal}` : \"No extends field\",\n ]\n : [\"tsconfig.json exists\", \"File not found\"],\n });\n}\n\nfunction eslintFailDetail(site: Site, file: string | null): [string, string] {\n if (file) {\n return [\n \"eslint.config.mjs uses augur-config/eslint/next\",\n \"Config exists but does not import augur-config/eslint\",\n ];\n }\n if (site.find(\".eslintrc.json\", \".eslintrc.js\", \".eslintrc\", \".eslintrc.cjs\")) {\n return [\n \"eslint.config.mjs uses augur-config/eslint/next\",\n \"Site uses legacy .eslintrc format -- migrate to eslint.config.mjs\",\n ];\n }\n return [\"eslint.config.mjs exists\", \"No ESLint config found\"];\n}\n\nfunction eslint(site: Site, file: string | null): CheckResult {\n return result(\"eslint\", presetStatus(file !== null, site.contains(file, \"augur-config/eslint\")), {\n PASS: [\"eslint.config.mjs uses augur-config/eslint/next\", file ?? \"\"],\n FAIL: eslintFailDetail(site, file),\n });\n}\n\nfunction eslintDeprecated(site: Site, file: string | null): CheckResult {\n const status = deprecatedStatus(\n file !== null,\n site.contains(file, /no-deprecated[\"']?\\s*:\\s*[\"'](error|warn)[\"']/),\n site.contains(file, \"no-deprecated\"),\n );\n return result(\"eslint-deprecated\", status, {\n SKIP: [\"ESLint: no-deprecated rule\", \"No ESLint config found\"],\n PASS: [\"ESLint: no-deprecated rule enabled\", \"\"],\n WARN: [\n \"ESLint: no-deprecated found but may not be warn/error\",\n \"Set @typescript-eslint/no-deprecated to warn or error\",\n ],\n FAIL: [\n \"ESLint: @typescript-eslint/no-deprecated rule\",\n 'Add \"@typescript-eslint/no-deprecated\": \"warn\" to eslint.config.mjs rules',\n ],\n });\n}\n\nfunction prettierFailDetail(\n site: Site,\n file: string | null,\n pkg: PackageJson | null,\n): [string, string] {\n const label = \"Prettier uses augur-config/prettier preset\";\n if (file) return [label, \"Config exists but does not import augur-config/prettier\"];\n if (pkg?.prettier) {\n return [label, \"Prettier config is inline in package.json -- move to prettier.config.mjs\"];\n }\n if (site.find(\".prettierrc\", \".prettierrc.json\", \".prettierrc.yaml\")) {\n return [\n label,\n \"Site uses static prettier config -- migrate to prettier.config.mjs with augur-config/prettier\",\n ];\n }\n return [\"Prettier config exists\", \"No Prettier config found\"];\n}\n\nfunction prettier(site: Site, pkg: PackageJson | null): CheckResult {\n const file = site.find(\n \"prettier.config.mjs\",\n \"prettier.config.js\",\n \".prettierrc.mjs\",\n \".prettierrc.js\",\n );\n return result(\n \"prettier\",\n presetStatus(file !== null, site.contains(file, \"augur-config/prettier\")),\n {\n PASS: [\"Prettier uses augur-config/prettier preset\", file ?? \"\"],\n FAIL: prettierFailDetail(site, file, pkg),\n },\n );\n}\n\nfunction knip(site: Site, pkg: PackageJson | null): CheckResult {\n const config = site.find(\n \"knip.json\",\n \"knip.jsonc\",\n \"knip.ts\",\n \"knip.config.ts\",\n \"knip.config.js\",\n );\n return result(\"knip\", knipStatus(config !== null, hasDep(pkg, \"knip\")), {\n PASS: [\"Knip configured for dead code detection\", config ?? \"\"],\n WARN: [\n \"Knip installed but no config file found\",\n \"Add knip.json or knip.ts -- see https://knip.dev/overview/configuration\",\n ],\n FAIL: config\n ? [\n \"Knip for dead code detection\",\n \"Config exists but knip not in devDependencies -- run pnpm add -D knip\",\n ]\n : [\n \"Knip for dead code detection\",\n \"Add knip to devDependencies and create knip.json -- see https://knip.dev\",\n ],\n });\n}\n\n/** Whether package.json lists the package in its dependencies or devDependencies. */\nfunction hasDep(pkg: PackageJson | null, name: string): boolean {\n return !!(pkg?.dependencies?.[name] || pkg?.devDependencies?.[name]);\n}\n\n/** The text holds every one of the strings. */\nfunction includesAll(text: string, parts: string[]): boolean {\n return parts.every((part) => text.includes(part));\n}\n\n/** What next.config (and package.json's ioredis) tell the Next.js checks. */\nfunction nextFacts(site: Site, pkg: PackageJson | null): NextFacts {\n const file = site.find(\"next.config.ts\", \"next.config.mjs\", \"next.config.js\");\n const text = (file === null ? null : site.read(file)) ?? \"\";\n return {\n hasConfig: file !== null,\n hasExternal: text.includes(\"serverExternalPackages\"),\n externalHasServer: text.includes(\"augur-server\"),\n usesIoredis: hasDep(pkg, \"ioredis\"),\n externalHasIoredis: text.includes(\"ioredis\"),\n hasAllHeaders: includesAll(text, [\n \"Strict-Transport-Security\",\n \"X-Content-Type-Options\",\n \"Permissions-Policy\",\n ]),\n hasHeaders: text.includes(\"headers\"),\n hasOptimize: text.includes(\"optimizePackageImports\"),\n hasStrict: text.includes(\"reactStrictMode\"),\n hasAgrMedia: /agr\\.media|agrMedia/.test(text),\n hasImages: text.includes(\"images\"),\n };\n}\n\nfunction nextExternal(n: NextFacts): CheckResult {\n return result(\"next-external\", nextExternalStatus(n), {\n PASS: [\"next.config: serverExternalPackages correct\", \"\"],\n WARN: [\n \"next.config: no serverExternalPackages found\",\n \"Add serverExternalPackages for native Node modules\",\n ],\n FAIL: n.hasConfig\n ? [\n \"next.config: augur-server NOT in serverExternalPackages\",\n \"augur-server must be bundled, not externalized\",\n ]\n : [\"next.config exists\", \"No next.config found\"],\n });\n}\n\nfunction ioredisSkipDetail(n: NextFacts): string {\n if (!n.hasConfig) return \"No next.config\";\n if (!n.hasExternal) return \"No serverExternalPackages\";\n return \"Site does not use ioredis\";\n}\n\nfunction nextIoredis(n: NextFacts): CheckResult {\n return result(\"next-ioredis\", ioredisStatus(n), {\n SKIP: [\"next.config: ioredis check\", ioredisSkipDetail(n)],\n PASS: [\"next.config: ioredis in serverExternalPackages\", \"\"],\n WARN: [\n \"next.config: ioredis should be in serverExternalPackages\",\n \"Site uses ioredis but it is not externalized\",\n ],\n });\n}\n\nfunction nextHeaders(n: NextFacts): CheckResult {\n return result(\"next-headers\", headersStatus(n), {\n PASS: [\"next.config: security headers\", \"\"],\n WARN: [\n \"next.config: security headers incomplete\",\n \"Missing HSTS, X-Content-Type-Options, or Permissions-Policy\",\n ],\n FAIL: [\n \"next.config: security headers\",\n n.hasConfig ? \"No headers() function found\" : \"No next.config\",\n ],\n });\n}\n\nfunction nextOptimize(n: NextFacts): CheckResult {\n return result(\"next-optimize\", optimizeStatus(n), {\n PASS: [\"next.config: optimizePackageImports\", \"\"],\n FAIL: [\n \"next.config: optimizePackageImports\",\n n.hasConfig ? \"Add experimental.optimizePackageImports for augur packages\" : \"No next.config\",\n ],\n });\n}\n\nfunction nextStrict(n: NextFacts): CheckResult {\n return result(\"next-strict\", strictStatus(n), {\n SKIP: [\"next.config: reactStrictMode\", \"No next.config\"],\n PASS: [\"next.config: reactStrictMode\", \"\"],\n WARN: [\"next.config: reactStrictMode not set\", \"Recommended for development error detection\"],\n });\n}\n\nfunction imageLoader(n: NextFacts): CheckResult {\n return result(\"image-loader\", imageLoaderStatus(n), {\n SKIP: [\"Image loader check\", \"No next.config\"],\n PASS: [\"Image loader for agr.media CDN\", \"\"],\n WARN: n.hasImages\n ? [\n \"next.config has images config but no agr.media\",\n \"Add agr.media to remotePatterns if site has product images\",\n ]\n : [\"No image configuration found\", \"Add agr.media CDN to next.config images.remotePatterns\"],\n });\n}\n\nfunction contractTests(site: Site): CheckResult {\n const present =\n site.find(\n \"__tests__/sdk-contracts\",\n \"src/__tests__/sdk-contracts\",\n \"__tests__/sdk-contract.test.ts\",\n \"src/__tests__/sdk-contract.test.ts\",\n ) !== null;\n return result(\"contract-tests\", contractTestsStatus(present), {\n PASS: [\"SDK contract tests present\", \"\"],\n FAIL: [\"SDK contract tests in __tests__/sdk-contracts/\", \"No contract tests found\"],\n });\n}\n\nfunction noWrapper(site: Site): CheckResult {\n const file = site.find(\n \"lib/augur-client.ts\",\n \"src/lib/augur-client.ts\",\n \"lib/augurClient.ts\",\n \"src/lib/augurClient.ts\",\n );\n const wraps = site.contains(file, \"class AugurClient\") || site.contains(file, \"extends AugurAPI\");\n const hasLib = site.find(\"lib\", \"src/lib\") !== null;\n return result(\"no-wrapper\", noWrapperStatus(hasLib, wraps), {\n SKIP: [\"No custom AugurClient wrapper\", \"No lib/ directory\"],\n PASS: [\"No custom AugurClient wrapper\", file ? \"Uses augur-api directly\" : \"\"],\n FAIL: [\"No custom AugurClient wrapper\", `${file} wraps AugurAPI -- use augur-api directly`],\n });\n}\n\nfunction auth(site: Site): CheckResult {\n const file = site.find(\"auth.ts\", \"lib/auth.ts\", \"src/lib/auth.ts\", \"src/auth.ts\");\n const usesFactory =\n site.contains(file, \"site.auth\") ||\n site.contains(file, \"createAuthConfig\") ||\n site.contains(file, \"createServerSite\");\n const status = authStatus(file !== null, usesFactory, site.contains(file, \"NextAuth\"));\n return result(\"auth\", status, {\n PASS: [\"Auth uses createAuthConfig or site.auth\", file ?? \"\"],\n FAIL: [\n \"Auth uses createAuthConfig or site.auth\",\n `${file} uses raw NextAuth -- migrate to createAuthConfig()`,\n ],\n WARN: file\n ? [\"Auth pattern unclear\", file]\n : [\"No auth.ts found\", \"Expected auth.ts or lib/auth.ts\"],\n });\n}\n\nfunction qualityScript(pkg: PackageJson | null): CheckResult {\n const quality = pkg?.scripts?.[\"quality\"];\n const complete =\n !!quality &&\n quality.includes(\"typecheck\") &&\n quality.includes(\"lint\") &&\n quality.includes(\"test\");\n return result(\"quality-script\", qualityStatus(!!quality, complete), {\n PASS: [\"quality script: typecheck + lint + test\", \"\"],\n WARN: [\"quality script exists but may be incomplete\", `\"quality\": \"${quality}\"`],\n FAIL: [\n \"quality script in package.json\",\n 'Add \"quality\": \"pnpm typecheck && pnpm lint && pnpm test\"',\n ],\n });\n}\n\nfunction allDeps(pkg: PackageJson): Deps {\n return { ...pkg.dependencies, ...pkg.devDependencies };\n}\n\nfunction icons(pkg: PackageJson): CheckResult {\n const deps = allDeps(pkg);\n const heroicons = !!deps[\"@heroicons/react\"];\n const status = iconsStatus(!!deps[\"react-icons\"], heroicons, !!deps[\"lucide-react\"]);\n return result(\"icons\", status, {\n PASS: [\"Uses react-icons (platform standard)\", \"\"],\n FAIL: [\n \"Uses react-icons (platform standard)\",\n heroicons\n ? \"Site uses @heroicons/react -- migrate to react-icons/lu\"\n : \"Site uses lucide-react -- migrate to react-icons/lu\",\n ],\n WARN: [\"No icon library found\", \"Expected react-icons\"],\n });\n}\n\nfunction tailwind(pkg: PackageJson): CheckResult {\n const range = allDeps(pkg)[\"tailwindcss\"] || \"\";\n return result(\"tailwind\", tailwindStatus(range), {\n PASS: [\"Tailwind v4 (platform standard)\", \"\"],\n FAIL: [\"Tailwind v4\", `Found tailwindcss: ${range} -- upgrade to ^4.0.0`],\n WARN: range\n ? [\"Tailwind version unclear\", `tailwindcss: ${range}`]\n : [\"No tailwindcss dependency found\", \"\"],\n });\n}\n\nfunction preCommitSuggestion(\n site: Site,\n lefthookFile: string | null,\n hasPreCommit: boolean,\n hasLefthook: boolean,\n): [string, string] {\n const see = `See ${RUNBOOK}#pre-commit-hooks`;\n if (hasPreCommit) return [\"Pre-commit hooks: lefthook found but no lint-staged config\", see];\n if (lefthookFile) return [\"Pre-commit hooks: lefthook found but no pre-commit section\", see];\n if (hasLefthook) {\n return [\n \"Pre-commit hooks: lefthook in devDependencies but no config file\",\n `Add lefthook.yml -- see ${RUNBOOK}#pre-commit-hooks`,\n ];\n }\n if (site.find(\".husky/pre-commit\", \".husky/_/pre-commit\")) {\n return [\"Pre-commit hooks: husky found -- consider switching to lefthook\", see];\n }\n return [\"No pre-commit hooks found -- recommended for code quality\", see];\n}\n\n/** The site's own lefthook config, else one in a parent folder (monorepo layouts). */\nfunction lefthookConfig(\n site: Site,\n reader: SiteReader,\n): { file: string | null; hasPreCommit: boolean } {\n const local = site.find(\"lefthook.yml\", \".lefthook.yml\");\n if (local) return { file: local, hasPreCommit: site.contains(local, \"pre-commit\") };\n const upward = reader.readUpward([\"lefthook.yml\", \".lefthook.yml\"]);\n if (upward === null) return { file: null, hasPreCommit: false };\n return { file: upward.path, hasPreCommit: upward.content.includes(\"pre-commit\") };\n}\n\nfunction hasLintStaged(site: Site, pkg: PackageJson | null): boolean {\n const files = [\n \".lintstagedrc\",\n \".lintstagedrc.json\",\n \"lint-staged.config.js\",\n \"lint-staged.config.mjs\",\n ];\n return !!pkg?.[\"lint-staged\"] || site.find(...files) !== null;\n}\n\nfunction preCommit(site: Site, reader: SiteReader, pkg: PackageJson | null): CheckResult {\n const { file: lefthookFile, hasPreCommit } = lefthookConfig(site, reader);\n const hasLefthook = lefthookFile !== null || hasDep(pkg, \"lefthook\");\n return result(\"pre-commit\", preCommitStatus(hasPreCommit, hasLintStaged(site, pkg)), {\n PASS: [\"Pre-commit hooks: lefthook + lint-staged\", lefthookFile ?? \"package.json\"],\n SUGGEST: preCommitSuggestion(site, lefthookFile, hasPreCommit, hasLefthook),\n });\n}\n\nfunction proxyLocalHooks(site: Site): CheckResult {\n const file = site.find(\"lib/augur.ts\", \"src/lib/augur.ts\", \"hooks/augur.ts\");\n const hasUseQuery = site.contains(file, /useQuery|useInfiniteQuery/);\n const wrapsActions = site.contains(file, /unwrap\\(|serverAction|augur-server\\/actions/);\n return result(\"proxy-local-hooks\", localHooksStatus(hasUseQuery), {\n PASS: [\"No local hook wrappers detected\", \"\"],\n SUGGEST: wrapsActions\n ? [\n \"Local hooks wrapping server actions -- replace with createServerQueryProxy\",\n `${file} -- see ${RUNBOOK}#proxy-migration`,\n ]\n : [\"Local hooks found -- check if createServerQueryProxy can replace them\", file ?? \"\"],\n });\n}\n\nfunction proxyServerQuery(site: Site): CheckResult {\n const serverProxy =\n site.proxyFilesMatching(/createServerQueryProxy|createAugurOptions/).length > 0;\n const augurOptions = site.proxyFilesMatching(/useAugurOptions|registerQueryAction/).length > 0;\n return result(\"proxy-server-query\", serverQueryStatus(serverProxy, augurOptions), {\n PASS: serverProxy\n ? [\"Uses createServerQueryProxy for data fetching\", \"\"]\n : [\"Uses useAugurOptions for data fetching\", \"\"],\n SUGGEST: [\n \"No proxy-based data fetching detected\",\n \"Consider createServerQueryProxy (augur-server/hooks) or useAugurOptions (augur-hooks)\",\n ],\n });\n}\n\nfunction queryClientScope(site: Site): CheckResult {\n const files = site.proxyFilesMatching(MODULE_SCOPE_CLIENT);\n return result(\"query-client-scope\", noOffenderStatus(files.length), {\n PASS: [\"No module-scope QueryClient\", \"\"],\n FAIL: [\n \"QueryClient created at module scope (shared across server requests)\",\n `${files.join(\", \")}: create it per request (see ${GETTING_STARTED}#provider-setup)`,\n ],\n });\n}\n\n/**\n * A finite gcTime, or a CACHE_CONFIG tier spread while the site's augur-utils may predate the\n * server-safe tiers, in the proxy files or anywhere under hooks/ or app/ (#94).\n */\nfunction queryGcTime(site: Site, pkg: PackageJson | null): CheckResult {\n const range = pkg === null ? \"\" : allDeps(pkg)[\"@simpleapps-com/augur-utils\"] || \"\";\n // Both decisions are proved scans (rules.ts), each the regex it replaced\n const oldUtils = utilsRangeBeforeFix(range);\n const files = site\n .queryFiles()\n .filter((f) => gcTimeOffenderIn(f.text, oldUtils))\n .map((f) => f.path);\n return result(\"query-gc-time\", noOffenderStatus(files.length), {\n PASS: [\"No finite gcTime in provider/query setup\", \"\"],\n FAIL: [\n \"Finite gcTime in provider/query setup (leaks memory during SSR)\",\n `${files.join(\", \")}: remove it, or wrap with resolveGcTime() from augur-utils; a ...CACHE_CONFIG spread needs @simpleapps-com/augur-utils >= 2026.11.3`,\n ],\n });\n}\n\nfunction apiVersion(pkg: PackageJson): CheckResult {\n const range = allDeps(pkg)[\"@simpleapps-com/augur-api\"] || \"\";\n const match = /(\\d{4})\\.(\\d+)\\.(\\d+)/.exec(range);\n const status = apiVersionStatus(\n match !== null,\n Number(match?.[1]),\n Number(match?.[2]),\n Number(match?.[3]),\n );\n return result(\"api-version\", status, {\n PASS: [\"augur-api SDK version supports typed proxies\", range],\n WARN: match\n ? [\n \"augur-api SDK may lack typed proxy support\",\n `${range} -- upgrade to >= 2026.3.7 for typed responses`,\n ]\n : range\n ? [\"augur-api version format not recognized\", range]\n : [\"No augur-api dependency found\", \"\"],\n });\n}\n\n/** The short name of an augur package (`augur-core`). */\nfunction shortName(name: string): string {\n return name.replace(\"@simpleapps-com/\", \"\");\n}\n\n/** augur-version-latest: each installed augur package against its own latest (no lockstep). */\nfunction augurVersionLatest(reader: SiteReader, pkg: PackageJson | null): CheckResult {\n const deps = pkg ? allDeps(pkg) : {};\n const installed = AUGUR_PACKAGES.filter((name) => deps[name]);\n const latest = installed.map((name) => reader.latestVersion(name));\n const states: PackageState[] = installed.map((name, k) =>\n packageStateOf(deps[name] as string, latest[k] as string),\n );\n const behind = installed.filter((_, k) => states[k] === \"behind\");\n return result(\"augur-version-latest\", latestStatus(states), {\n SKIP: installed.length\n ? [\n \"Augur latest version check\",\n \"Could not fetch latest version from npm (offline or not published)\",\n ]\n : [\"Augur latest version check\", pkg ? \"No augur packages found\" : \"No package.json\"],\n PASS: [\n \"Augur packages on their latest versions\",\n installed.map((name, k) => `${shortName(name)}: ${latest[k]}`).join(\", \"),\n ],\n FAIL: [\n \"Augur packages should be on their latest versions\",\n `${behind\n .map(\n (name) =>\n `${shortName(name)}: installed ${deps[name]}, latest ${latest[installed.indexOf(name)]}`,\n )\n .join(\", \")} -- set the latest in package.json, then run pnpm install (not pnpm update)`,\n ],\n });\n}\n\n/** Every check, in the original order; the package.json checks only when there is one. */\nexport function runChecks(reader: SiteReader): CheckResult[] {\n const site = new Site(reader);\n const pkg = site.json<PackageJson>(\"package.json\");\n const eslintFile = site.find(\"eslint.config.mjs\", \"eslint.config.js\");\n const next = nextFacts(site, pkg);\n return [\n siteConfig(site),\n serverSite(site),\n actions(site),\n siteHooks(site),\n ssrOptions(site),\n tsconfig(site),\n eslint(site, eslintFile),\n eslintDeprecated(site, eslintFile),\n prettier(site, pkg),\n knip(site, pkg),\n nextExternal(next),\n nextIoredis(next),\n nextHeaders(next),\n nextOptimize(next),\n nextStrict(next),\n contractTests(site),\n noWrapper(site),\n auth(site),\n imageLoader(next),\n qualityScript(pkg),\n ...(pkg ? [icons(pkg), tailwind(pkg)] : []),\n preCommit(site, reader, pkg),\n proxyLocalHooks(site),\n proxyServerQuery(site),\n queryClientScope(site),\n queryGcTime(site, pkg),\n ...(pkg ? [apiVersion(pkg)] : []),\n augurVersionLatest(reader, pkg),\n ];\n}\n","/** The {@link SiteReader} over the real file system and npm. */\n\nimport { execFileSync } from \"node:child_process\";\nimport { existsSync, readdirSync, readFileSync } from \"node:fs\";\nimport { dirname, join, resolve } from \"node:path\";\nimport type { SiteReader } from \"./checks\";\nimport { isQuerySourceName, walksDir } from \"./rules\";\n\n/**\n * The `.ts`/`.tsx` files under `rel` (relative to `siteDir`), recursively, skipping node_modules\n * (which names and folders count: the proved `isQuerySourceName`, `walksDir`).\n */\nfunction sourceFilesUnder(siteDir: string, rel: string): string[] {\n if (!existsSync(resolve(siteDir, rel))) return [];\n return readdirSync(resolve(siteDir, rel), { withFileTypes: true }).flatMap((entry) => {\n const path = join(rel, entry.name);\n if (entry.isDirectory()) return walksDir(entry.name) ? sourceFilesUnder(siteDir, path) : [];\n return isQuerySourceName(entry.name) ? [path] : [];\n });\n}\n\n/** The first of `names` found walking up from `start`, stopping at a git repo root. */\nfunction findUpward(start: string, names: string[]): string | null {\n let dir = start;\n const root = resolve(\"/\");\n while (dir !== root) {\n const hit = names.map((name) => resolve(dir, name)).find((path) => existsSync(path));\n if (hit) return hit;\n if (existsSync(resolve(dir, \".git\"))) break;\n dir = dirname(dir);\n }\n return null;\n}\n\n/** A package's latest published version from `npm view`, or \"\" when npm cannot say. */\nfunction npmLatest(packageName: string): string {\n try {\n return execFileSync(\"npm\", [\"view\", packageName, \"version\"], {\n encoding: \"utf-8\",\n stdio: [\"ignore\", \"pipe\", \"ignore\"],\n }).trim();\n } catch {\n return \"\";\n }\n}\n\nexport function nodeReader(siteDir: string, latestVersion = npmLatest): SiteReader {\n const read = (path: string) => (existsSync(path) ? readFileSync(path, \"utf-8\") : null);\n return {\n exists: (relPath) => existsSync(resolve(siteDir, relPath)),\n read: (relPath) => read(resolve(siteDir, relPath)),\n readUpward: (names) => {\n const path = findUpward(siteDir, names);\n return path === null ? null : { path, content: readFileSync(path, \"utf-8\") };\n },\n latestVersion,\n sourceFiles: (dirs) => dirs.flatMap((dir) => sourceFilesUnder(siteDir, dir)),\n };\n}\n","/** augur-doctor's scorecard: the check results as terminal lines, grouped as before. */\n\nimport { RUNBOOK, type CheckResult } from \"./checks\";\nimport { countStatusFrom, scoredTotal, type Status } from \"./rules\";\n\nconst ICONS: Record<Status, string> = {\n PASS: \"\\x1b[32m[PASS]\\x1b[0m\",\n FAIL: \"\\x1b[31m[FAIL]\\x1b[0m\",\n WARN: \"\\x1b[33m[WARN]\\x1b[0m\",\n SUGGEST: \"\\x1b[36m[SUGGEST]\\x1b[0m\",\n SKIP: \"\\x1b[90m[SKIP]\\x1b[0m\",\n};\n\n/** The scorecard's groups, in order (no lockstep: the one-version check is gone). */\nconst GROUPS: [string, string[]][] = [\n [\"Site Architecture\", [\"site-config\", \"server-site\", \"actions\", \"site-hooks\", \"ssr-options\"]],\n [\n \"Config Alignment\",\n [\"tsconfig\", \"eslint\", \"eslint-deprecated\", \"prettier\", \"knip\", \"tailwind\", \"icons\"],\n ],\n [\n \"Next.js Config\",\n [\"next-external\", \"next-ioredis\", \"next-headers\", \"next-optimize\", \"next-strict\"],\n ],\n [\"Testing & Quality\", [\"contract-tests\", \"quality-script\", \"pre-commit\"]],\n [\n \"Proxy Adoption\",\n [\n \"proxy-local-hooks\",\n \"proxy-server-query\",\n \"query-client-scope\",\n \"query-gc-time\",\n \"api-version\",\n ],\n ],\n [\"Package Versions\", [\"augur-version-latest\"]],\n [\"Patterns\", [\"no-wrapper\", \"auth\", \"image-loader\"]],\n];\n\n/** A group's lines: its heading, each of its results, a blank line. */\nfunction groupLines(name: string, ids: string[], results: CheckResult[]): string[] {\n const lines = ids.flatMap((id) => {\n const r = results.find((x) => x.id === id);\n if (!r) return [];\n const detail = r.detail ? ` \\x1b[90m${r.detail}\\x1b[0m` : \"\";\n return [` ${ICONS[r.status]} ${r.label}${detail}`];\n });\n return [`\\x1b[1m${name}\\x1b[0m`, ...lines, \"\"];\n}\n\n/** The score line: passing out of the scored total, then the failing, warning, suggestion counts. */\nfunction scoreLine(statuses: Status[]): string {\n const count = (s: Status) => countStatusFrom(statuses, s, 0);\n const failing = count(\"FAIL\");\n const warnings = count(\"WARN\");\n const suggestions = count(\"SUGGEST\");\n return (\n `\\x1b[1mScore: ${count(\"PASS\")}/${scoredTotal(statuses)}\\x1b[0m` +\n (failing > 0 ? ` \\x1b[31m(${failing} failing)\\x1b[0m` : \"\") +\n (warnings > 0 ? ` \\x1b[33m(${warnings} warnings)\\x1b[0m` : \"\") +\n (suggestions > 0 ? ` \\x1b[36m(${suggestions} suggestions)\\x1b[0m` : \"\")\n );\n}\n\n/** The whole scorecard for a site. */\nexport function reportLines(siteName: string, siteDir: string, results: CheckResult[]): string[] {\n const statuses = results.map((r) => r.status);\n const runbook =\n countStatusFrom(statuses, \"FAIL\", 0) > 0\n ? [\"See the migration runbook for fixes:\", RUNBOOK, \"\"]\n : [];\n return [\n \"\",\n `\\x1b[1mAugur Doctor: ${siteName}\\x1b[0m`,\n `Path: ${siteDir}`,\n \"\",\n ...GROUPS.flatMap(([name, ids]) => groupLines(name, ids, results)),\n scoreLine(statuses),\n \"\",\n ...runbook,\n ];\n}\n","#!/usr/bin/env node\n/**\n * augur-doctor -- Site health check against the Augur platform standard.\n *\n * Usage:\n * npx augur-doctor (runs against current directory)\n * npx augur-doctor /path/to/site\n *\n * Checks a consumer site for alignment with the reference implementation and prints a\n * pass/fail/warn scorecard.\n */\n\nimport { runDoctor } from \"./doctor/cli\";\n\nprocess.exit(\n runDoctor(process.argv.slice(2), {\n log: (line) => console.log(line),\n error: (line) => console.error(line),\n }),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAQ,CAAC,CAAC,MAAM,GAAG,MAAM,WAAW,MAAM,KAAK,OAAO,CAAC;AAAA,IACjE,UAAU,QAAQ;AAAA,IAClB;AAAA,IACA,GAAG;AAAA,EACL;AACF;;;AJjEA,IAAM,QAAQ;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAGO,SAAS,UAAU,MAAgB,IAAmB;AAC3D,QAAM,UAAUC,SAAQ,KAAK,CAAC,KAAK,GAAG;AACtC,MAAI,CAACC,YAAW,OAAO,GAAG;AACxB,OAAG,MAAM,6BAA6B,OAAO,EAAE;AAC/C,WAAO;AAAA,EACT;AACA,MAAI,CAACA,YAAWD,SAAQ,SAAS,cAAc,CAAC,GAAG;AACjD,OAAG,MAAM,6BAA6B,OAAO,EAAE;AAC/C,UAAM,QAAQ,CAAC,SAAS,GAAG,MAAM,IAAI,CAAC;AACtC,WAAO;AAAA,EACT;AACA,QAAM,UAAU,WAAW,GAAG,UAAU,YAAY,OAAO,CAAC;AAC5D,cAAY,SAAS,OAAO,GAAG,SAAS,OAAO,EAAE,QAAQ,CAAC,SAAS,GAAG,IAAI,IAAI,CAAC;AAC/E,SAAO,WAAW,QAAQ,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;AAChD;;;AK3BA,QAAQ;AAAA,EACN,UAAU,QAAQ,KAAK,MAAM,CAAC,GAAG;AAAA,IAC/B,KAAK,CAAC,SAAS,QAAQ,IAAI,IAAI;AAAA,IAC/B,OAAO,CAAC,SAAS,QAAQ,MAAM,IAAI;AAAA,EACrC,CAAC;AACH;","names":["existsSync","resolve","resolve","existsSync"]}
|
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
// ../foundation/src/chars.ts
|
|
2
|
+
function isDigit(c) {
|
|
3
|
+
return c >= 48 && c <= 57;
|
|
4
|
+
}
|
|
5
|
+
function isJsSpace(c) {
|
|
6
|
+
return isAsciiSpace(c) || isGeneralPunctuationSpace(c) || isOtherSpace(c);
|
|
7
|
+
}
|
|
8
|
+
function isAsciiSpace(c) {
|
|
9
|
+
return c >= 9 && c <= 13 || c === 32;
|
|
10
|
+
}
|
|
11
|
+
function isGeneralPunctuationSpace(c) {
|
|
12
|
+
return c >= 8192 && c <= 8202 || c === 8232 || c === 8233 || c === 8239 || c === 8287;
|
|
13
|
+
}
|
|
14
|
+
function isOtherSpace(c) {
|
|
15
|
+
return c === 160 || c === 5760 || c === 12288 || c === 65279;
|
|
16
|
+
}
|
|
17
|
+
function isWordChar(c) {
|
|
18
|
+
return c >= 65 && c <= 90 || c >= 97 && c <= 122 || c >= 48 && c <= 57 || c === 95;
|
|
19
|
+
}
|
|
20
|
+
|
|
1
21
|
// ../utils/src/strings.ts
|
|
2
22
|
function codeAt(s, i) {
|
|
3
23
|
return i >= 0 && i < s.length ? s.charCodeAt(i) : -1;
|
|
@@ -6,6 +26,21 @@ function startsWithAt(s, x, pos) {
|
|
|
6
26
|
const at = Math.min(pos, s.length);
|
|
7
27
|
return s.slice(at, Math.min(at + x.length, s.length)) === x;
|
|
8
28
|
}
|
|
29
|
+
function endsWith(s, suffix) {
|
|
30
|
+
return s.slice(Math.max(s.length - suffix.length, 0)) === suffix;
|
|
31
|
+
}
|
|
32
|
+
function spaceRunEnd(s, i) {
|
|
33
|
+
if (!isJsSpace(codeAt(s, i))) return i;
|
|
34
|
+
return spaceRunEnd(s, i + 1);
|
|
35
|
+
}
|
|
36
|
+
function digitRunEnd(s, i) {
|
|
37
|
+
if (!isDigit(codeAt(s, i))) return i;
|
|
38
|
+
return digitRunEnd(s, i + 1);
|
|
39
|
+
}
|
|
40
|
+
function digitsValue(s) {
|
|
41
|
+
if (s.length === 0) return 0;
|
|
42
|
+
return digitsValue(s.slice(0, s.length - 1)) * 10 + (s.charCodeAt(s.length - 1) - 48);
|
|
43
|
+
}
|
|
9
44
|
|
|
10
45
|
// src/doctor/rules.ts
|
|
11
46
|
function fileUses(found, uses) {
|
|
@@ -97,6 +132,82 @@ function serverQueryStatus(usesServerProxy, usesAugurOptions) {
|
|
|
97
132
|
function noOffenderStatus(offenders) {
|
|
98
133
|
return offenders > 0 ? "FAIL" : "PASS";
|
|
99
134
|
}
|
|
135
|
+
function gcTimeOffender(finiteLiteral, spreadsTier, utilsBeforeFix) {
|
|
136
|
+
return finiteLiteral || spreadsTier && utilsBeforeFix;
|
|
137
|
+
}
|
|
138
|
+
function serverSafeTiersVersion(year, minor, patch) {
|
|
139
|
+
return year > 2026 || year === 2026 && minor > 11 || year === 2026 && minor === 11 && patch >= 3;
|
|
140
|
+
}
|
|
141
|
+
function utilsBeforeServerSafeTiers(parsed, year, minor, patch) {
|
|
142
|
+
return parsed && !serverSafeTiersVersion(year, minor, patch);
|
|
143
|
+
}
|
|
144
|
+
function wordAt(s, i) {
|
|
145
|
+
return isWordChar(codeAt(s, i));
|
|
146
|
+
}
|
|
147
|
+
function allowedGcValue(s, p) {
|
|
148
|
+
return startsWithAt(s, "Infinity", p) && !wordAt(s, p + 8) || startsWithAt(s, "resolveGcTime(", p) || startsWithAt(s, "0", p) && !wordAt(s, p + 1);
|
|
149
|
+
}
|
|
150
|
+
function finiteGcTimeAt(s, k) {
|
|
151
|
+
if (!startsWithAt(s, "gcTime", k)) return false;
|
|
152
|
+
const a = spaceRunEnd(s, k + 6);
|
|
153
|
+
if (codeAt(s, a) !== 58) return false;
|
|
154
|
+
const p = spaceRunEnd(s, a + 1);
|
|
155
|
+
return p < s.length && !allowedGcValue(s, p);
|
|
156
|
+
}
|
|
157
|
+
function hasFiniteGcTime(s) {
|
|
158
|
+
let k = 0;
|
|
159
|
+
while (k < s.length) {
|
|
160
|
+
if (finiteGcTimeAt(s, k)) return true;
|
|
161
|
+
k = k + 1;
|
|
162
|
+
}
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
function tierSpreadAt(s, k) {
|
|
166
|
+
return startsWithAt(s, "...", k) && startsWithAt(s, "CACHE_CONFIG.", spaceRunEnd(s, k + 3));
|
|
167
|
+
}
|
|
168
|
+
function hasTierSpread(s) {
|
|
169
|
+
let k = 0;
|
|
170
|
+
while (k < s.length) {
|
|
171
|
+
if (tierSpreadAt(s, k)) return true;
|
|
172
|
+
k = k + 1;
|
|
173
|
+
}
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
function noVersion() {
|
|
177
|
+
return { found: false, year: 0, minor: 0, patch: 0 };
|
|
178
|
+
}
|
|
179
|
+
function versionAt(s, k) {
|
|
180
|
+
const a = digitRunEnd(s, k);
|
|
181
|
+
if (a === k || codeAt(s, a) !== 46) return noVersion();
|
|
182
|
+
const b = digitRunEnd(s, a + 1);
|
|
183
|
+
if (b === a + 1 || codeAt(s, b) !== 46) return noVersion();
|
|
184
|
+
const c = digitRunEnd(s, b + 1);
|
|
185
|
+
if (c === b + 1) return noVersion();
|
|
186
|
+
return {
|
|
187
|
+
found: true,
|
|
188
|
+
year: digitsValue(s.slice(k, a)),
|
|
189
|
+
minor: digitsValue(s.slice(a + 1, b)),
|
|
190
|
+
patch: digitsValue(s.slice(b + 1, c))
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
function firstVersionFrom(s, k) {
|
|
194
|
+
if (k === s.length) return noVersion();
|
|
195
|
+
const v = versionAt(s, k);
|
|
196
|
+
return v.found ? v : firstVersionFrom(s, k + 1);
|
|
197
|
+
}
|
|
198
|
+
function gcTimeOffenderIn(text, utilsBeforeFix) {
|
|
199
|
+
return gcTimeOffender(hasFiniteGcTime(text), hasTierSpread(text), utilsBeforeFix);
|
|
200
|
+
}
|
|
201
|
+
function utilsRangeBeforeFix(range) {
|
|
202
|
+
const v = firstVersionFrom(range, 0);
|
|
203
|
+
return utilsBeforeServerSafeTiers(v.found, v.year, v.minor, v.patch);
|
|
204
|
+
}
|
|
205
|
+
function isQuerySourceName(name) {
|
|
206
|
+
return endsWith(name, ".ts") || endsWith(name, ".tsx");
|
|
207
|
+
}
|
|
208
|
+
function walksDir(name) {
|
|
209
|
+
return name !== "node_modules";
|
|
210
|
+
}
|
|
100
211
|
function typedProxyVersion(year, minor, patch) {
|
|
101
212
|
return year > 2026 || year === 2026 && minor > 3 || year === 2026 && minor === 3 && patch >= 7;
|
|
102
213
|
}
|
|
@@ -161,6 +272,10 @@ export {
|
|
|
161
272
|
localHooksStatus,
|
|
162
273
|
serverQueryStatus,
|
|
163
274
|
noOffenderStatus,
|
|
275
|
+
gcTimeOffenderIn,
|
|
276
|
+
utilsRangeBeforeFix,
|
|
277
|
+
isQuerySourceName,
|
|
278
|
+
walksDir,
|
|
164
279
|
apiVersionStatus,
|
|
165
280
|
packageStateOf,
|
|
166
281
|
latestStatus,
|
|
@@ -169,4 +284,4 @@ export {
|
|
|
169
284
|
exitCodeOf,
|
|
170
285
|
resolveUrl
|
|
171
286
|
};
|
|
172
|
-
//# sourceMappingURL=chunk-
|
|
287
|
+
//# sourceMappingURL=chunk-3L322IID.js.map
|