ipal-doctor: one command that checks a site against the team rules

bin ipal-doctor + @intecion/ipal-kit/doctor: static rules (versions, Node 22, AGENT.md §3
layout and naming, database names, env rules, headers, X-Powered-By, CSP, 2FA, cookie
scanner, adminMeta, AGENTS.md, skills, seeds, block library via blockLibraryManifest,
ipal-audit --quick), registry rules (latest plugin, pnpm audit --prod), live rules (--url,
ipal-seo-check), deep rules (--deep via payload run; GET /api/ipal/doctor, off until
IPAL_DOCTOR_TOKEN). Human / JSON output, --strict, exit codes 0/1/2/3, --sites drift table,
ipal-doctor.json with reasons, until, files, seen.

Fixes found on the way: sitemap leaves out the System pages 404 page; ipal-audit finds
array labels after fields, any form seed, runs grep in UTF-8; ipal-seo-check counts
duplicate titles per language. Reference site at zero findings (static), CI steps on.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-10-29 16:03:00 +01:00
co-authored by Claude Opus 5.5
parent 0ab133fbd7
commit a4e8cfeae8
62 changed files with 2998 additions and 70 deletions
+17
View File
@@ -14,6 +14,17 @@ Database names follow one rule, and seeding a live site touches only the records
fifteen ready page sections and ten page templates.
### New
- **`ipal-doctor`** ([doctor.md](./doctor.md)): one command, run in a site, that checks it against the team rules and
lists every gap with a fix hint — plugin/Next/sharp/Node versions, the AGENT.md §3 layout and naming, database names,
env rules, security headers, X-Powered-By, CSP, 2FA, the cookie scanner, adminMeta, AGENTS.md "Project decisions",
current skills, seeds (`createSeeder`, no deletes, guard on), the block library (`blockLibraryManifest`), `pnpm audit
--prod`, hardcoded texts (it runs `ipal-audit --quick`). `--url` checks the running site (and runs `ipal-seo-check`),
`--deep` reads the database read-only through `payload run`. Human or `--json` output, `--strict`, exit codes 0/1/2/3,
`--sites '../*-web'` for a read-only drift table. `ipal-doctor.json` silences, lowers or raises a rule with a reason
(`until`, `files`). New bin `ipal-doctor`, new entry `@intecion/ipal-kit/doctor`, new skill **ipal-doctor**.
- **`GET /api/ipal/doctor`**: read-only counts for the doctor (users without TOTP, cookies waiting for approval,
versions). 404 until `IPAL_DOCTOR_TOKEN` (≥ 32 characters) is set; Bearer token, rate-limited. `ipalKit({ doctor: false })`
removes it.
- **Design-token standard** ([design-tokens.md](./design-tokens.md)): one set of `--ipal-*` names for every site,
only the values differ per brand. `@intecion/ipal-kit/tokens.css` (neutral defaults, light/dark on `data-theme`,
`[data-surface="inverse"]` scope, reduced motion), `@intecion/ipal-kit/tailwind.css` (Tailwind 4 preset: `bg-surface`,
@@ -50,6 +61,12 @@ fifteen ready page sections and ten page templates.
plugin repo (`reference/`, not shipped) and is built, seeded and smoke-tested in the plugin's CI.
### Changed
- **Sitemap:** the page assigned as the 404 in *Site settings → System pages* is left out whatever its slug (only
the slugs `404`, `500`, `error`, `not-found` were left out; a 404 page called `nie-znaleziono` was listed and answered 404).
- **ipal-seo-check:** duplicate titles are counted per language (the same word in two languages is not a duplicate).
- **ipal-audit:** array `labels` / `rowLabel` after the `fields` key are found (were reported missing); a form seeded
from any seed file (`src/seed/forms.ts`, `upsertBy('forms', …)`) counts as a form seed; the script runs grep in UTF-8
(in the C locale an en dash matched the Polish-letter check).
- **Cookie banner / button colours** read the single token names (`--ipal-surface`, `--ipal-text` …) instead of
`dark:` + `--ipal-*-dark`. With `tokens.css` they switch with the theme. Without it, the built-in fallback follows the
page's `color-scheme` (`light-dark()`): a site without a dark theme no longer gets a dark banner on a dark-mode