Doctor: the performance rules are errors (owner's decision for 1.18.0); lowered or silenced per rule in iapl-doctor.json; growth stays warnings; audit reports them as errors; legacy:site lists perf-* errors an old site meets; docs, skills, changelog; reference skills refreshed

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-12-01 16:10:23 +01:00
co-authored by Claude Opus 5.5
parent f0127ac1b8
commit 8cf5a58045
19 changed files with 136 additions and 69 deletions
+11 -2
View File
@@ -67,13 +67,22 @@ once there are more than 20.
> barrels are no longer one client boundary, the table of contents measures once per frame, Turnstile stops
> polling once drawn, the cookie banner honours reduced motion. Nothing to do.
>
> 9. **`iapl-doctor` can now fail on the performance rules** (`perf-*`: images config, fonts, render-blocking,
> embeds, animations, a budget test; `--url`: uncompressed HTML, blocking scripts, more than four font preloads, a
> lazy first image, HTML over 150 KB; `--deep`: stored images over 1.5 MB / 2560 px) — they are **errors**, so a
> plain run exits 1 on them and `--strict` too. None measures time: the same site gives the same answer every run.
> A site with Playwright and no budget test gets `perf-budgets` (copy the `iapl-performance` skill's template).
> Lower one with a reason: `iapl-doctor.json` → `"rules": { "perf-fonts": { "severity": "warning", "reason": "…" } }`;
> silence one: `{ "off": true, "reason": "…", "until": "2027-03-01" }` (docs/doctor.md). The `growth-*` rules stay
> warnings and infos.
>
> **New, off until a project turns it on:** `iapl({ unusedMedia: true })` — above the Media list, how many files no
> page, entry or setting uses, with a link to Payload's list filtered to them (deleting stays manual; **run
> `pnpm generate:importmap`** after turning it on); `forms: { submissionRetentionDays }`; `Media eager` (a logo
> above the fold, no high priority); `createNotFoundPage({ load, placeholder })` (the reference site keeps its 404
> height: CLS 0).
> **Doctor:** the `performance` and `growth` groups (warnings; `growth-versions-config` is a hint), thresholds in
> `iapl-doctor.json` → `growth`. **Agents:** the `iapl-performance` skill (`pnpm exec iapl-skills`) and the budget
> **Doctor:** the `performance` group (errors, point 9) and the `growth` group (warnings and infos;
> `growth-versions-config` is a hint), thresholds in `iapl-doctor.json` → `growth`. **Agents:** the `iapl-performance` skill (`pnpm exec iapl-skills`) and the budget
> gate template. **Recommended for projects:** `index: true` on `slugHistory.slug`; the heading font with
> `preload: false` (the starter's default now); a placeholder of the 404 content's height.
+1 -1
View File
@@ -1063,7 +1063,7 @@ Example `styles.css`: [section-code.md](./skills/iapl-block/resources/section-co
| budgets | `e2e/performance.spec.ts` from the `iapl-performance` skill (`perfBudgets()` from `/doctor`): fails when a page gets slower | "it felt fast on my machine" |
Target on the built site (mobile, Lighthouse/PageSpeed): LCP < 2.5 s, CLS < 0.1, INP < 200 ms — the plugin's default
budgets (`PERF_BUDGETS`). Checks: `iapl-doctor --only performance` (images config, fonts, render-blocking, embeds,
budgets (`PERF_BUDGETS`). Checks: `iapl-doctor --only performance` — **errors** since 1.18.0, an accepted exception lowered or silenced with a reason in `iapl-doctor.json` (images config, fonts, render-blocking, embeds,
animations, a budget test; `--url`: compression, blocking scripts, preloads, a lazy first image, HTML size; `--deep`:
stored images over the limits), `iapl-audit` (img/video outside Media, many `priority`, `h-screen`, fixed widths,
YouTube `<iframe>`) and `iapl-seo-check` (images without dimensions, LCP image without priority).
+1 -1
View File
@@ -43,7 +43,7 @@ next/font in `--font-body` with the preset (warning), and with `src/design/token
`iapl-tokens --check` — a stale `src/design/tokens.css` or a WCAG AA contrast failure is an error.
## Speed (AGENT.md §6.11b, docs/performance.md)
The full run (not `--quick`) lists the doctor's `performance` group as warnings: `next.config` without
The full run (not `--quick`) lists the doctor's `performance` group as errors (since 1.18.0; a rule the project lowered in `iapl-doctor.json` shows as a warning): `next.config` without
`buildImagesConfig()`, fonts from Google or with `display: 'block'`, more than two families, a blocking `<script src>`
or a remote stylesheet, an `<iframe>` that loads with the page, transitions of layout properties, `transition-all`,
`scroll` listeners, animations with nothing for reduced motion. The `iapl-performance` skill measures the built site and
@@ -362,12 +362,14 @@ if [ -n "$UI" ]; then
done
fi
# --- Speed (§6.11b, performance.md) — the doctor's performance group: images config, fonts, render-blocking,
# embeds, animations, a budget test. Full mode only: the doctor itself runs this audit with --quick.
# --- Speed (§6.11b, performance.md) — the doctor's performance group (errors since 1.18.0): images config, fonts,
# render-blocking, embeds, animations, a budget test. Full mode only: the doctor itself runs this audit with --quick.
if [ "$QUICK" -eq 0 ] && [ -x node_modules/.bin/iapl-doctor ]; then
# errors since 1.18.0; a rule the project lowered in iapl-doctor.json comes back as a warning, a silenced one not at all
PERF=$(node_modules/.bin/iapl-doctor --only performance --offline --json 2>/dev/null \
| node -e 'let s="";process.stdin.on("data",(d)=>(s+=d)).on("end",()=>{try{for(const f of JSON.parse(s).findings){if(!f.silenced&&f.severity!=="info"){console.log(`${f.file??"(site)"} [${f.rule}] ${f.message}`)}}}catch{}})')
report WARNING "speed (iapl-doctor --only performance)" "§6.11b / performance.md — each line names the rule; iapl-performance skill" "$PERF"
| node -e 'let s="";process.stdin.on("data",(d)=>(s+=d)).on("end",()=>{try{for(const f of JSON.parse(s).findings){if(!f.silenced&&f.severity!=="info"){console.log(`${f.severity==="error"?"E":"W"}|${f.file??"(site)"} [${f.rule}] ${f.message}`)}}}catch{}})')
report ERROR "speed (iapl-doctor --only performance)" "§6.11b / performance.md — each line names the rule; lower or silence one with a reason in iapl-doctor.json" "$(printf '%s\n' "$PERF" | sed -n 's/^E|//p')"
report WARNING "speed, lowered to a warning in iapl-doctor.json" "§6.11b / performance.md" "$(printf '%s\n' "$PERF" | sed -n 's/^W|//p')"
fi
# --- Compile & build ---
+6 -1
View File
@@ -1,6 +1,6 @@
---
name: iapl-doctor
description: Checks the whole site against the IAPL team standard with one command (`pnpm exec iapl-doctor`) — plugin, Next, sharp and Node versions, the AGENT.md §3 folder layout and naming, database names (<domain>_dev/_prod), env rules, security headers, X-Powered-By, CSP, 2FA, the cookie scanner, adminMeta/agency, AGENTS.md "Project decisions", current iapl-* skills, seeds (createSeeder, SEED_ONLY, no deletes), the block library, pnpm audit, hardcoded texts, and with --url / --deep the running site and the database. Use after setting up a site, after an IAPL upgrade, before a deploy, in CI of a new site, and when asked whether a site follows the team rules.
description: Checks the whole site against the IAPL team standard with one command (`pnpm exec iapl-doctor`) — plugin, Next, sharp and Node versions, the AGENT.md §3 folder layout and naming, database names (<domain>_dev/_prod), env rules, security headers, X-Powered-By, CSP, 2FA, the cookie scanner, adminMeta/agency, AGENTS.md "Project decisions", current iapl-* skills, seeds (createSeeder, SEED_ONLY, no deletes), the block library, pnpm audit, hardcoded texts, speed (the performance rules — errors) and what grows (sizes, versions, retention, unused media), and with --url / --deep the running site and the database. Use after setting up a site, after an IAPL upgrade, before a deploy, in CI of a new site, and when asked whether a site follows the team rules.
---
# iapl-doctor
@@ -25,11 +25,16 @@ Full reference: `node_modules/@intecion/ipal-kit/docs/doctor.md`.
with the Intecion mail service (IWSN in the panel): waiting for approval, stopped, refused, disconnected, a replaced sender name),
`mail-reply-address`, `mail-graph-deprecated`, `mail-relay-route` (trailing slashes, another API route, a redirect or a
block in front of `/api/iapl/mail-relay/confirm`) — fixes: `iapl-debug` "Consent / analytics / forms / email".
**Speed (`perf-*`) findings are errors since 1.18.0** (images config, fonts, render-blocking, embeds, animations,
a budget test; `--url`: compression, blocking scripts, font preloads, a lazy first image, HTML size; `--deep`:
oversized stored images) — the `iapl-performance` skill. The `growth-*` findings stay warnings and infos.
4. A deliberate exception (the owner's decision) goes into `iapl-doctor.json` **with a reason** — the same reason as in
AGENTS.md "Project decisions". Never silence a rule just to make the run pass:
```json
{ "rules": { "i18n-literals": { "off": true, "files": ["src/components/design/**"], "reason": "approved exception: styleguide labels" } } }
```
A speed rule the client accepts is lowered rather than silenced, so it stays in the report:
`"perf-fonts": { "severity": "warning", "reason": "the client's brand font, replaced in Q1" }`.
Keys: `off`, `severity`, `reason` (required), `until` (ISO date), `files` (globs). Top level: `domain`, `launched`,
`layout.allow`, `layout.frontend` (the pages' folder, e.g. `src/app/(site)` — found by structure otherwise; any route
group name works), `seen` (written by the doctor), `extraRules`.
+5 -2
View File
@@ -13,7 +13,10 @@ must do, how to measure, how to read the findings. This skill is the order of wo
pnpm exec iapl-doctor --only performance # images config, fonts, render-blocking, embeds, animations, budget test
bash .agents/skills/iapl-audit/scripts/audit.sh --quick # <img>/<video> outside Media, priority outside the hero, YouTube iframe, h-screen
```
Fix every warning — each names the file, the fix and the doc. The rules that matter most:
These are **errors** since 1.18.0 (`iapl-doctor` fails). Fix each — it names the file, the fix and the doc. When the
client accepts one (a brand font, a map that is the page's content), lower it with a reason in `iapl-doctor.json`
(`"perf-fonts": { "severity": "warning", "reason": "…" }`) or silence it (`"off": true`, optionally `until`), and record
it in AGENTS.md → Project decisions. The rules that matter most:
| Area | Do | Never |
|---|---|---|
@@ -64,6 +67,6 @@ pnpm exec iapl-doctor --deep --only growth # counts and sizes per collection,
- Thresholds of the findings: `iapl-doctor.json` → `growth`.
## 5. Before "done"
`iapl-doctor --only performance` without warnings (or each one silenced with a reason in `iapl-doctor.json`),
`iapl-doctor --only performance` without errors (each exception lowered or silenced with a reason in `iapl-doctor.json`),
the budget test green, and the numbers in `AGENTS.md` → "Project decisions" when the client accepted an exception
(a heavy font, a third-party widget).
+1 -1
View File
@@ -136,7 +136,7 @@ the proxy does no database work; the 434 KB cookie database is loaded only by a
| 5 | Consent Mode `basic` as default | **no** (stays `advanced`) | — |
| 6 | Card hover animates `box-shadow` | yes | an `::after` shadow layer fades with `opacity`; `CARD_INTERACTIVE_SHADOW_CLASS` = the 1.17 class |
| 7 | Metadata on uploads | yes, no stored variants | lossless strip of JPEG APP1/APP13/COM and PNG text/eXIf/tIME (pixels and ICC byte for byte), EXIF rotation applied once; `stripMetadata: false` |
| 8 | Doctor warnings → errors | **open** (warnings stay) | — |
| 8 | Doctor performance rules: warnings or errors | **errors** | every `perf-*` rule is an error (none measures time, so none fails at random); lowered or silenced per rule in `iapl-doctor.json`; `growth-*` stay warnings and infos. `legacy:site` lists `perf-*` errors an old site meets (its Playwright without a budget test: `perf-budgets`) instead of failing on them |
## Growth review (owner's addition, 2026-12-01): what swells the site and its database
Measured on the reference site (MongoDB 7) after the full reference suite as traffic: 15 collections, the largest
+23 -8
View File
@@ -144,14 +144,14 @@ Turn off: `iapl({ doctor: false })`. Adapt: `iapl({ doctor: { tokenVar: 'MY_TOKE
| | `blocks-duplicate` | warning | a project block whose `slug` (or `interfaceName`) matches a library block — also a slug renamed through the block's `slug` option — unless it is an override in `createBlockRegistry({ components })` |
| | `blocks-helper-copy` | warning | no local copy of a plugin field builder (`blockLibraryManifest.fieldBuilders`), `ctaHref`, `buildActionButtonsField` |
| | `blocks-tokens` | error / warning | from `iapl-audit`: hex colours, the token standard not wired, `iapl-tokens --check` |
| performance | `perf-images-config` | warning | `next.config` uses `buildImagesConfig()` (AVIF / WebP, R2, long cache) — [performance.md](./performance.md) |
| | `perf-fonts` | warning | no font from Google / Typekit hosts, no `font-display: block`, every `@font-face` has `font-display`, at most two `next/font` families |
| | `perf-render-blocking` | warning | no `<script src>` without `async` / `defer`, no stylesheet `<link>` or CSS `@import` from another host |
| | `perf-embeds` | warning | no `<iframe>` (map, widget) that loads with the page — a click-to-load facade, or `loading="lazy"`; YouTube is `iapl-audit`'s |
| | `perf-animations` | warning | no transition of a layout property or `transition-all`, no `scroll` listener, something honours `prefers-reduced-motion` when the site animates |
| | `perf-budgets` | info | a project that runs Playwright has a performance budget test in `e2e/` (the `iapl-performance` skill's template) |
| | `perf-live` | warning | (live) the home HTML is compressed, has no blocking `<script>` in `<head>`, preloads at most four fonts, its first image in `<main>` is not lazy, and is at most 150 KB |
| | `perf-images` | warning | (deep) no stored image over 1.5 MB or 2560 px wide (`IMAGE_RULES`) |
| performance | `perf-images-config` | error | `next.config` uses `buildImagesConfig()` (AVIF / WebP, R2, long cache) — [performance.md](./performance.md) |
| | `perf-fonts` | error | no font from Google / Typekit hosts, no `font-display: block`, every `@font-face` has `font-display`, at most two `next/font` families |
| | `perf-render-blocking` | error | no `<script src>` without `async` / `defer`, no stylesheet `<link>` or CSS `@import` from another host |
| | `perf-embeds` | error | no `<iframe>` (map, widget) that loads with the page — a click-to-load facade, or `loading="lazy"`; YouTube is `iapl-audit`'s |
| | `perf-animations` | error | no transition of a layout property or `transition-all`, no `scroll` listener, something honours `prefers-reduced-motion` when the site animates |
| | `perf-budgets` | error | a project that runs Playwright has a performance budget test in `e2e/` (the `iapl-performance` skill's template) |
| | `perf-live` | error | (live) the home HTML is compressed, has no blocking `<script>` in `<head>`, preloads at most four fonts, its first image in `<main>` is not lazy, and is at most 150 KB |
| | `perf-images` | error | (deep) no stored image over 1.5 MB or 2560 px wide (`IMAGE_RULES`) |
| growth | `growth-size` | warning | (deep) no collection over `growth.maxDocs` (200 000) documents or `growth.maxMB` (512, data + indexes, MongoDB) — [performance.md](./performance.md) §6 |
| | `growth-versions` | warning | (deep) no collection or global keeps versions without a limit (`maxPerDoc` / `max`: 0), none over `growth.maxVersions` (50 000) |
| | `growth-retention` | warning | (deep) a log with a retention (consent log, statistics, form submissions with `submissionRetentionDays`) holds no record older than it — its purge runs |
@@ -170,6 +170,21 @@ Turn off: `iapl({ doctor: false })`. Adapt: `iapl({ doctor: { tokenVar: 'MY_TOKE
The block rules read `blockLibraryManifest` (`@intecion/ipal-kit/blocks`), so a new library block needs no doctor
change.
### The performance rules are errors (1.18.0)
`iapl-doctor` (and `--strict`) fails on every `perf-*` finding. None of them measures time — each reads the
project's files, the home page's HTML or stored counts — so the same site gives the same answer every run. A project
that accepts one for a reason lowers or silences it in `iapl-doctor.json`, per rule:
```json
{ "rules": {
"perf-fonts": { "severity": "warning", "reason": "the client's brand font, replaced in Q1" },
"perf-embeds": { "off": true, "reason": "the map is the page's content (client decision)", "files": ["src/components/Map.tsx"] },
"perf-budgets": { "off": true, "reason": "no e2e on this site yet", "until": "2027-03-01" }
} }
```
The `growth` group stays warnings and infos.
## Adapt it — `iapl-doctor.json`
Every rule can be silenced, lowered or raised — **with a reason** — in `iapl-doctor.json` in the project root
+2 -2
View File
@@ -128,7 +128,7 @@ both bundlers) holds each page type to its own numbers and counts the database q
## 5. The doctor's findings
All in the `performance` group (`iapl-doctor --only performance`), warnings in 1.18.0 (`perf-budgets` is info):
All in the `performance` group (`iapl-doctor --only performance`), **errors** since 1.18.0: `iapl-doctor` fails on them. None measures time, so they do not fail at random. Lower one to a warning or silence it with a reason in `iapl-doctor.json` (`"rules": { "perf-fonts": { "severity": "warning", "reason": "…" } }`, [doctor.md](./doctor.md)):
| Rule | Source | It means | Fix |
|---|---|---|---|
@@ -141,7 +141,7 @@ All in the `performance` group (`iapl-doctor --only performance`), warnings in 1
| `perf-live` | `--url` | the HTML is not compressed; blocking scripts in `<head>`; more than four preloaded fonts; the first image in `<main>` is lazy; the home HTML over 150 KB | proxy compression; `async`; fewer font files; `priority`; less data to client components |
| `perf-images` | `--deep` | images stored over 1.5 MB or 2560 px wide | re-upload prepared, or tick "Optimise large image" |
Silence a finding with a reason in `iapl-doctor.json` like any other ([doctor.md](./doctor.md)).
Lower or silence a finding with a reason in `iapl-doctor.json` like any other ([doctor.md](./doctor.md)); the `growth` group (below) stays warnings and infos.
## 6. What grows — keeping the site and its database small over the years