diff --git a/docs/dev/ipal-doctor-proposal.md b/docs/dev/ipal-doctor-proposal.md new file mode 100644 index 0000000..22e4f4d --- /dev/null +++ b/docs/dev/ipal-doctor-proposal.md @@ -0,0 +1,323 @@ +# ipal-doctor — proposal + +Status: **design, not built.** Waiting for the owner's go-ahead. +Date: 2026-10-29 · plugin version at the time: 1.14.6. + +## 1. What it is + +One command, run in a client site, that checks the site against the team's rules and lists every gap with a fix +hint: + +```bash +pnpm exec ipal-doctor # static checks of the project folder +pnpm exec ipal-doctor --url https://example.com # + live checks of the deployed site +pnpm exec ipal-doctor --json > doctor.json # for CI and for the drift table +``` + +The aim is **drift**. Seven sites today run seven different setups (§7). The doctor turns "is this site like the +others?" into one list, and the same list for every site. The starter must generate sites that pass it with zero +findings. + +### What it is not + +| Tool | Question it answers | When | +|---|---|---| +| `ipal-audit` (skill, `audit.sh`) | Is the **code** I just wrote built the ipal-kit way (blocks, links, hardcoding, panel clarity, the §0b feature set, tsc, build)? | inside the agent's edit loop, before "done" | +| `ipal-seo-check` | What do Googlebot and AI agents see on a running site? | after a build, after a deploy | +| `ipal-consent-check` | Does tracking really wait for consent (real browser)? | after analytics changes | +| `ipal-skills` | Copy or refresh the skills and the AGENTS.md pointer | after install and every upgrade | +| **`ipal-doctor`** | Is the **site** in line with the team standard: versions, runtime, layout, env, database names, security, admin, docs for agents, seeds, dependencies, and the live deployment? | anytime; CI on every push; a sweep across all sites | + +The doctor **calls** the others instead of copying their checks (§5). + +## 2. Rules + +Every rule has an id, a group, a default severity, a fix hint and a doc link. Severities: + +- **error** — breaks the team rules or is a security or data risk. CI fails. +- **warning** — drift that should be fixed, but the site works and is safe. +- **info** — worth knowing. Never fails anything. + +Source tags: **S** = static (files only, no network, no database), **R** = registry (one network read), +**L** = live (`--url`), **D** = deep (reads the database, read-only, §3.3). + +### 2.1 Versions and runtime + +| Id | Sev | Src | Check | Fix hint | +|---|---|---|---|---| +| `plugin-latest` | error if a minor or more behind, else warning | R | the installed `@intecion/ipal-kit` equals the newest one on the team registry (`pnpm view @intecion/ipal-kit version`, through the project's `.npmrc`). Offline → info "could not check", compared with the doctor's own version instead | `pnpm add @intecion/ipal-kit@` + the `ipal-upgrade` skill | +| `plugin-installed` | error | S | the version in `node_modules` satisfies `package.json` (a stale install hides the real state) | `pnpm install` | +| `next-min` | error | S | installed `next` ≥ 16.4.1 and `eslint-config-next` on the same 16.4.x (AGENT.md §4 item 11) | `pnpm add next@16.4.x eslint-config-next@16.4.x` | +| `sharp-min` | error | S | resolved `sharp` ≥ 0.35.5 | `pnpm add sharp@^0.35.5` / override | +| `node-22` | warning | S | `engines.node` allows only 22 (`>=22 <23`); `.nvmrc` / `.node-version` / `Dockerfile FROM node:` say 22 when they exist. With `--deep`, also the running `process.version` | set `"engines": { "node": ">=22 <23" }` and `.nvmrc` = `22` | +| `pnpm-pinned` | info | S | `packageManager` is set (Coolify then uses the same pnpm) | `corepack use pnpm@10` | +| `deps-audit` | error on critical/high, info on moderate/low | R | `pnpm audit --prod --json` has no critical or high advisory | `pnpm up ` or a `pnpm.overrides` entry (AGENT.md §4 item 12); upgrade the plugin first | + +### 2.2 Project layout and naming + +| Id | Sev | Src | Check | Fix hint | +|---|---|---|---|---| +| `layout-required` | error | S | every file of AGENT.md §3 exists: `proxy.ts`, `i18n.config.ts`, `instrumentation.ts`, `lib/content.ts`, the route files (`manifest`, `robots`, `sitemap.xml`, `llms.txt`, `llms-full.txt`, `md/…`, `api/mcp`, `api/health`, `indexnow-key.txt`), `(frontend)/[locale]/{layout,actions,not-found,[[...slug]]/page}` (no `[locale]` for one language), `blocks/registry.ts`, `collections/{Pages,Media}.ts`, `components/{ui,layout}/`, `components/forms/formClasses.ts`. A feature the project switched off (`ipal-audit-skip`, §4) drops its file | the `ipal-setup` skill, stage named in the hint | +| `layout-forbidden` | error | S | no `middleware.ts`; no `lib/{pages,locales,navigation}.ts`, `fields/{link,sectionHeader,sectionSettings}.ts` (the plugin has them) | delete and import from the plugin | +| `layout-extra` | info | S | top-level entries in `src/` outside the convention (listed, nothing more) | move into the convention, or silence with a reason | +| `naming` | warning | S | block folders, collections, globals in PascalCase; `scripts/*` in kebab-case; no `index.ts` barrels in `blocks/`, `components/` | rename | +| `importmap` | error | S + D | static: `app/(payload)//importMap.js` exists, holds the entries for every feature the config turns on (2FA → `TotpRedirectProvider` + `payload-2fa/rsc#…`; R2 → `S3ClientUploadHandler`; cookie scanner → `CookieReviewTab`…; `adminMeta` → `AdminIcon`…) and names no export the installed plugin no longer has. Deep: generates the import map into a temp file and diffs it with the committed one (exact) | `pnpm payload generate:importmap` and commit | +| `tsconfig-skills` | error | S | `tsconfig.json` excludes the skills folder | `"exclude": ["node_modules", ".agents"]` | + +### 2.3 Environment and database + +| Id | Sev | Src | Check | Fix hint | +|---|---|---|---|---| +| `db-name` | error | S | `DATABASE_URI` database = `_dev` in `.env` and `.env.example`; `_prod` only in production. A local `.env` pointing at `_prod` is an **error**. The domain comes from `NEXT_PUBLIC_SERVER_URL` (not localhost), else `doctor.domain` in the config, else the folder name minus `-web`. With `--env-file prod.env` (an export of the Coolify variables) it checks the `_prod` name too | rename the database (deployment.md backup + restore) and update the env | +| `env-rules` | error | S | `instrumentation.ts` calls `assertEnv(ipalEnvRules({…}))` from `@intecion/ipal-kit/env`, and the flags match what the config uses: `storage` when `buildR2Storage`, `cookieCrawl` when `cookieScanner.crawl`, `ipHeader: true` | the line from env.md | +| `env-example` | warning | S | `.env.example` lists every variable those rules name, with placeholder values (no real host, no credentials) | add the names | +| `env-live` | error | D | with `--deep`, runs the project's own `ipalEnvRules` against the real environment (in the Coolify container) | set the variable in Coolify → redeploy | + +### 2.4 Security and admin + +| Id | Sev | Src | Check | Fix hint | +|---|---|---|---|---| +| `security-headers` | error | S + L | static: `buildSecurityHeaders` in `next.config`; live: HSTS, `nosniff`, `Referrer-Policy`, `Permissions-Policy`, `X-Frame-Options` or `frame-ancestors` on `/` | security.md | +| `powered-by` | error | S + L | static: `withSecurityConfig` wraps the config; live: no `X-Powered-By` on `/` and on the admin | `export default withPayload(withSecurityConfig(nextConfig))` | +| `csp` | warning if missing, info while `report-only` | S + L | CSP on the site and on `/admin` (`buildAdminCspHeaders`); report-only flagged until switched to `enforce` | security.md → ROLL OUT CSP | +| `2fa` | error | S + D | static: `twoFactor: { plugin: payloadTotp }` and `@clocklimited/payload-2fa` installed. Deep: number of panel users without TOTP = 0 | security.md → 2FA | +| `cookie-scanner` | error if off, warning if pending | S + D | static: `ipalKit({ cookieScanner })` is on. Deep: `countPendingCookies(payload)` = 0 (nothing waits for approval) | cookie-scanner.md; *Privacy → Cookies → Review and approve* | +| `admin-meta` | warning | S + L | static: plugin ≥ 1.14.5 and not `adminMeta: false` / `agency: false`. Live: the admin page is `noindex` and its `og:image` is `/api/ipal/admin-og` | white-label.md | +| `admin-noindex` | error | L | the admin login page carries `noindex` | `adminMeta` robots | + +### 2.5 Guide for agents, seeds, content + +| Id | Sev | Src | Check | Fix hint | +|---|---|---|---|---| +| `agents-md` | error | S | `AGENTS.md` exists and has a non-empty `## Project decisions` section; the `ipal-kit:start…end` pointer block names the installed version; `CLAUDE.md` exists (with `@AGENTS.md`) | AGENT.md §13; `pnpm exec ipal-skills` | +| `skills-current` | warning | S | the `ipal-*` folders equal the ones shipped by the installed plugin (the same content, none missing, none retired) — the diff logic of `ipal-skills --dry-run` | `pnpm exec ipal-skills` | +| `seed-named` | error | S | every `seed*` package script uses the ipal-kit seed helper, deletes nothing (`payload.delete`, `deleteMany`, `--fresh`, `seed:fresh`) and **takes a named-record list** (see decision D5). After launch (`doctor.launched: true` in the config, or `--url` answers 200) a seed without a list is an error | seeding.md; rewrite on `createSeeder` | +| `i18n-literals` | error in blocks, warning in components | S | no literal UI text where the panel or i18n is expected — runs `ipal-audit`'s `jsx-text.mjs` and its Polish-literal check | move the text to a localized field | +| `audit` | as reported | S | `ipal-audit --quick` from the **installed package** (not the project's copy, which may be stale) — every `[ERROR]` / `[WARNING]` becomes a finding `audit:` | the `ipal-audit` skill | + +### 2.6 Live checks (`--url`) + +`--url` adds the **L** rules above plus: + +| Id | Sev | Check | +|---|---|---| +| `live-reachable` | error | the URL answers | +| `live-health` | error | `/api/health` is 200 (Coolify's health check needs it) | +| `live-seo` | as reported | `ipal-seo-check <url> --max 10` from the installed package: robots (Sitemap line, not blocking `*`), sitemap (200, URLs on this host), canonical, hreflang, **noindex on production pages**, JSON-LD, llms, MCP. One finding per reported line | +| `live-noindex` | error | the home page and `X-Robots-Tag` are not `noindex` on production (`IPAL_NOINDEX` left on) — and **are** on a staging URL (`--staging`) | +| `live-deep` | as reported | with `IPAL_DOCTOR_TOKEN` set, the **D** rules through the status endpoint (§3.3) — no shell access to the server needed | + +Live checks are GET only, no login, a doctor user agent, at most ~20 requests. + +## 3. How it runs + +### 3.1 Shipping — a bin in the plugin + +`bin/ipal-doctor.mjs` next to `bin/ipal-skills.mjs`, zero dependencies, Node built-ins and `fetch`. The rules +sit in `bin/doctor/rules/*.mjs`, one module per group, each exporting +`{ id, group, severity, source, docs, check(ctx) }`. + +Why in the plugin and not a separate package: the rules change with the plugin (a new required import-map entry, +a new env rule), and every site already has it. Nothing new to install or to version. + +The catch: an old site runs the old doctor. Two ways to run it cover that: + +```bash +pnpm exec ipal-doctor # the rules of the site's own version (CI, reproducible) +pnpm dlx --package=@intecion/ipal-kit@latest ipal-doctor # the newest rules (drift sweep, before an upgrade) +``` + +The report header always prints both the **rules version** and the **site's plugin version**. + +### 3.2 Static + +Reads files only: `package.json`, `node_modules/*/package.json`, the config files, `.env*` (it **never prints +values**, only database names and variable names), the import map, `AGENTS.md`, the skills folder. It is safe to +run anywhere and does not touch the network except `plugin-latest` and `deps-audit` (`--offline` skips both). + +### 3.3 Deep (database, read-only) + +Some rules need the real data: users without TOTP, cookies waiting for approval, the exact import map, the real +environment. Two ways, decision D3: + +- **A. `ipal-doctor --deep`** runs `pnpm payload run node_modules/@intecion/ipal-kit/bin/doctor/deep.ts`: the Local + API, read-only queries (`count`), in the Coolify container's terminal or locally with the dev database. No new + route. +- **B. A status endpoint** `GET /api/ipal/doctor`, **off unless `IPAL_DOCTOR_TOKEN` is set** (≥ 32 chars, bearer, + constant-time compare, rate-limited). It returns counts and booleans only — never names, e-mails or values: + `{ plugin, node, usersWithout2fa, pendingCookies, envMissing: ['R2_BUCKET'], importMapCurrent, siteSettings: { name, logo } }`. + `--url` then gets the deep rules from every site from one machine. Turn off: unset the token, or + `ipalKit({ doctor: false })`; override: `doctor: { access: (req) => … }`. + +Recommendation: **both**, A first (no surface added), B as an opt-in in the same release for the sweep. + +### 3.4 A drift sweep across sites + +```bash +ipal-doctor --sites '../*-web' --md > drift.md # one table: rule × site +``` + +It runs the static rules in each folder (read-only) and prints the matrix of §7. With `--url-from-env` it takes +each site's URL from `NEXT_PUBLIC_SERVER_URL` and adds the live rules. + +## 4. Output, exit codes, silencing + +**Human output** (default): grouped by group, the worst first, one line per finding with the fix hint and the doc +link, then a summary `3 errors, 5 warnings, 2 info (2 silenced)`. Colour only on a TTY. + +**JSON** (`--json`), schema version 1: + +```json +{ "schema": 1, "rulesVersion": "1.15.0", "site": { "path": ".", "domain": "intecioncom", "plugin": "1.14.6" }, + "findings": [ { "rule": "db-name", "severity": "error", "source": "static", "message": "…", "file": ".env", + "fix": "…", "docs": "docs/deployment.md#…", "silenced": false } ], + "summary": { "error": 3, "warning": 5, "info": 2, "silenced": 2 } } +``` + +**Exit codes:** `0` = nothing at or above `--fail-on` (default `error`; `--fail-on warning` for strict CI) · +`1` = findings at or above it · `2` = the doctor could not run (not a project root, a broken config file) · +`3` = a rule crashed (the others still report). + +**Options:** `--only <groups|ids>`, `--skip <…>`, `--offline`, `--url`, `--staging`, `--deep`, `--env-file`, +`--json`, `--md`, `--fail-on`, `--sites`, `--config`. + +**Config file — `ipal-doctor.json` in the project root** (the main rule: the project can adapt every rule): + +```json +{ + "domain": "intecioncom", + "launched": true, + "rules": { + "csp": { "severity": "info", "reason": "report-only until the GTM sources are known", "until": "2026-12-01" }, + "layout-extra": { "off": true, "reason": "src/seed-content holds the content seeds" }, + "node-22": { "severity": "error" } + }, + "extraRules": ["./scripts/doctor-rules.mjs"] +} +``` + +- Silencing or lowering a rule **needs a `reason`**; without one the entry is ignored and reported. +- `until` makes it expire: after that date the rule is back and the report says so. +- Silenced findings still appear in JSON with `"silenced": true` and in the summary count — nothing disappears. +- The existing `ipal-audit-skip: <keys> — <reason>` lines in `AGENTS.md` are read too (one place for a client + decision); the doctor maps the audit keys to its own rules. +- `extraRules` lets a project add its own rules with the same module shape. The rule modules are exported, so a + project can also import one and wrap it. + +## 5. Reuse instead of duplication + +| Already exists | The doctor | +|---|---| +| `ipal-audit/scripts/audit.sh --quick` | runs it **from the installed package** and parses `[ERROR]` / `[WARNING]` into findings. The checks that both need (security headers, powered-by, CSP, 2FA, assertEnv, R2 import map) stay in **one** place: phase 1 keeps them in `audit.sh` and the doctor reads its result; phase 2 (optional) ports `audit.sh` into the same JS rule modules and `audit.sh` becomes a thin wrapper, so both share one implementation | +| `ipal-audit/scripts/jsx-text.mjs`, the Polish-literal grep | the `i18n-literals` rule calls them | +| `ipal-seo-check/scripts/seo-check.mjs` | `--url` runs it; robots, sitemap, noindex and canonical are not re-implemented | +| `bin/ipal-skills.mjs` | its folder diff moves into a small exported function (`planSkills({ dest })`) used by `ipal-skills --dry-run` and by the `skills-current` rule; the pointer-block version check reuses its markers | +| `countPendingCookies`, `ipalEnvRules`, `generateImportMap` | the deep rules call the plugin's own functions | +| `ipal-consent-check` | **not** run (it needs a browser); the report links it as a manual step | + +New docs in the same change (CLAUDE.md rule 2): a `docs/doctor.md` module page, a section in AGENT.md §11 ("before +done": audit; "before deploy / weekly": doctor), an `ipal-doctor` skill (run, read, fix), `ipal-upgrade` and +`ipal-setup` ending with "doctor: 0 errors", and the rule list as `docs/agent/doctor-rules.md` generated from the +modules so docs and code cannot disagree. + +## 6. Decisions for the owner + +| # | Decision | Recommendation | +|---|---|---| +| D1 | Ship as a bin in the plugin, or a separate `@intecion/ipal-doctor` package | **bin in the plugin**; newest rules via `pnpm dlx --package=@intecion/ipal-kit@latest` | +| D2 | How strict is `plugin-latest`: error when any patch behind, or only a minor behind | **error a minor behind, warning a patch behind** | +| D3 | Deep checks: `payload run` only, a token endpoint only, or both | **both**, endpoint off until `IPAL_DOCTOR_TOKEN` is set | +| D4 | The Node pin form | **`"engines": { "node": ">=22 <23" }` + `.nvmrc` = `22`** | +| D5 | "Seeds take a named-record list" needs a **new seed-helper option**: today `createSeeder` has no way to pick records. Proposal: `SEED_ONLY=pages:home,forms:Contact` (or `--only pages:home`) filtering every `seed.collection/global` call by its natural key, and refusing a run without a list on a `_prod` database unless `SEED_ALL=1` and the owner's OK. Build it in this track or a separate one? | **separate small track, before the doctor's release**; until then `seed-named` checks only helper use + no deletes | +| D6 | The domain behind the database name when `.env` has only localhost: `NEXT_PUBLIC_SERVER_URL` → `ipal-doctor.json` `domain` → folder name | as listed | +| D7 | CI: is `pnpm exec ipal-doctor --offline` added to every site's pipeline / pre-deploy step in Coolify? | **yes, `--fail-on error`**, after the sites are brought to zero errors | +| D8 | `--fix` for the mechanical ones (`ipal-skills`, `generate:importmap`, `.nvmrc`, `engines`) | **not in v1** — hints only; v2 maybe | +| D9 | CSP report-only: info, or a warning after N weeks (the audit skill says "more than a few weeks") | **warning after 4 weeks** from the first doctor run that saw it (stored in `ipal-doctor.json` `seen`), or set by the project | + +## 7. Dry run — what it would report today + +A throwaway prototype of the static rules and the live header/admin rules, run **read-only** on 2026-10-29 against +`/Users/rasm/Projects/Payload/*-web` and the public domains (GET only, no login). No site was changed. Latest = +1.14.6. Deep rules (users without TOTP, pending cookies) were **not** run: they need database access. +`.env` is the local file; Coolify's production env was not read, so `_prod` names are unverified. + +### 7.1 Summary + +| Site | ipal-kit (installed) | Errors | Warnings | Info | +|---|---|---|---|---| +| architektimprezpl | 1.14.4 (asks 1.14.6) | 4 | 3 | 6 | +| coastalclimatesupplycomau | 1.14.1 | 5 | 5 | 3 | +| ecogenicacouk | 1.14.1 | 9 | 5 | 3 | +| intecioncom | 1.14.4 (asks 1.14.6) | 6 | 6 | 6 | +| saydiamondspl | 1.11.0 | 11 | 6 | 3 | +| thecleanteampl | 1.12.2 | 8 | 9 | 2 | +| vanstevpl | 1.12.2 | 12 | 9 | 3 | + +(Counts are per rule and severity: one rule hitting three files counts once. Static + `deps-audit` + +`i18n-literals` + live. They will move a little when the real rules land. No site passes today.) + +### 7.2 Matrix + +✅ pass · ❌ error · ⚠️ warning · ℹ️ info · — not applicable / not checked + +| Rule | architektimprez | coastalclimate | ecogenica | intecion | saydiamonds | thecleanteam | vanstev | +|---|---|---|---|---|---|---|---| +| `plugin-latest` | ❌ 1.14.4 | ❌ 1.14.1 | ❌ 1.14.1 | ❌ 1.14.4 | ❌ 1.11.0 | ❌ 1.12.2 | ❌ 1.12.2 | +| `plugin-installed` | ❌ asks 1.14.6 | ✅ | ✅ | ❌ asks 1.14.6 | ✅ | ✅ | ✅ | +| `next-min` | ✅ 16.4.3 | ✅ 16.4.3 | ✅ 16.4.3 | ✅ 16.4.3 | ❌ 16.3.6 | ❌ 16.2.6 | ❌ 16.2.6 | +| `sharp-min` | ✅ | ✅ | ✅ | ✅ | ❌ 0.33.5 | ❌ 0.34.2 | ❌ 0.34.2 | +| `node-22` | ✅ | ✅ | ✅ | ⚠️ `>=20.9.0` | ⚠️ none | ⚠️ `^18 \|\| >=20` | ⚠️ none | +| `deps-audit` (crit/high) | ✅ 0/0 | ❌ 0/1 | ❌ 0/1 | ✅ 0/0 | ❌ 3/26 | ❌ 6/37 | ❌ 10/40 | +| `importmap` | ✅ | ❌ no `TotpRedirectProvider` | ❌ no `TotpRedirectProvider` | ✅ | ❌ no `S3ClientUploadHandler` | ✅ | ✅ | +| `layout-required` | ❌ `actions.ts` | ❌ `actions.ts`, `formClasses.ts`, `components/layout` | ✅ | ❌ `components/layout` | ❌ 5 files (`(frontend)` layout, page, not-found, actions, md route) | ✅ | ❌ `indexnow-key.txt`, `components/{ui,layout}` | +| `layout-extra` | ℹ️ 6 | ℹ️ 1 | ℹ️ 3 | ℹ️ 3 | ℹ️ 4 | ℹ️ 1 | ℹ️ 4 | +| `naming` | ⚠️ `allBlocks.ts`, `verify-ipal-1.14.3.ts` | ✅ | ⚠️ `configs.ts` | ✅ | ⚠️ 2 | ⚠️ 2 | ⚠️ `ctaHref.ts` | +| `db-name` | ❌ `dev` | ❌ `coastalclimatesupply_dev` (no `comau`) | ❌ **local `.env` → `ecogenicacouk_prod`** | ❌ `intecioncom-dev` (dash) | ❌ `saydiamonds` | ⚠️ none in `.env.example` | ❌ `vanstevpl`; example = SQLite | +| `env-rules` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | +| `env-example` | ✅ | ⚠️ `IPAL_IP_HEADER`, `R2_*` | ✅ | ⚠️ `IPAL_IP_HEADER`, `R2_*` | ✅ | ⚠️ `DATABASE_URI` | ⚠️ `R2_*` | +| `security-headers` (static / live) | ✅ / ✅ | ✅ / ✅ | ✅ / ❌ 4 missing | ✅ / ✅ | ✅ / — | ✅ / ✅ | ✅ / ✅ | +| `powered-by` (static / live) | ✅ / ✅ | ✅ / ✅ | ✅ / ❌ `Next.js` | ✅ / ✅ | ✅ / — | ❌ / ❌ `Next.js, Payload` | ❌ / ❌ `Next.js, Payload` | +| `csp` | ℹ️ report-only | ℹ️ report-only | ℹ️ static; ⚠️ live none | ℹ️ report-only | ℹ️ report-only | ✅ | ℹ️ report-only | +| `2fa` (static) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | +| `cookie-scanner` (static) | ℹ️ no crawl | ❌ off | ❌ off | ℹ️ no crawl | ❌ off | ❌ off | ❌ off | +| `admin-meta` (static / live) | ⚠️ < 1.14.5 / ✅ | ⚠️ / ⚠️ no preview | ⚠️ / — | ⚠️ < 1.14.5 / ✅ | ⚠️ / — | ⚠️ / ⚠️ no preview | ⚠️ / ⚠️ no preview | +| `agents-md` | ✅ | ✅ | ✅ | ❌ no "Project decisions"; pointer 1.14.6 ≠ 1.14.4 | ❌ no section, no pointer, no CLAUDE.md | ❌ same | ❌ same | +| `skills-current` | ✅ | ⚠️ 10 outdated | ⚠️ 10 outdated | ✅ | ⚠️ 14 outdated, no `ipal-reference` | ⚠️ 14 outdated, no `ipal-reference` | ⚠️ 14 outdated, no `ipal-reference` | +| `seed-named` | ℹ️ helper ok, no list | ✅ no seeds | ℹ️ helper ok, no list | ❌ `seed.ts` deletes; 3 form seeds without the helper | ❌ `seed` / `seed:fresh` delete, no helper | ⚠️ 5 seeds without the helper | ❌ `seed:forms` deletes; 3 without the helper | +| `i18n-literals` | ⚠️ 6 in components | ⚠️ 23 in components | ✅ | ✅ | ✅ | ✅ | ❌ 162 Polish literals in code | +| `live-reachable` / `live-health` | ✅ / ✅ | ✅ / ✅ | ✅ / ❌ 404 | ✅ / ✅ | ❌ DNS (no site) | ✅ / ✅ | ✅ / ✅ | +| live robots / sitemap | ✅ | ✅ | ❌ both 404 | ✅ | — | ✅ | ✅ | + +### 7.3 What stands out + +- **Every site is behind on the plugin**, and two (architektimprez, intecion) declare 1.14.6 but have 1.14.4 in + `node_modules` locally. Production for both already serves the 1.14.5+ admin preview, so Coolify built from the + lockfile; only the local checkout is stale. That is exactly why `plugin-installed` is separate. +- **No site follows the database-name rule** in its local or example env. ecogenica's local `.env` points at + `ecogenicacouk_prod` — a dev run or a seed from that laptop writes to production. Fix that one first. +- **Three sites are below the safe Next.js** (16.4.1) and sharp, with critical advisories in `pnpm audit --prod` + (saydiamonds 3, thecleanteam 6, vanstev 10). Upgrading the plugin and Next clears most of them. +- **thecleanteam and vanstev send `X-Powered-By: Next.js, Payload`** live. ecogenica's live domain sends + `X-Powered-By: Next.js` without security headers, robots, sitemap or health — the domain does not serve this + project yet (another app, or not deployed). saydiamonds.pl does not resolve. +- **The cookie scanner is off on five of seven** in the checked-out code. The *Turn on cookie scanner on four + sites* session may have changed this on branches not in these checkouts. +- **Four sites lack "Project decisions"** in AGENTS.md and three have no pointer block or CLAUDE.md — their skills + are 14 folders out of date and miss `ipal-reference`. +- **No site can run a seed for named records only**, because the helper cannot (D5). Four sites have seeds that + delete (`payload.delete`, `seed:fresh`). +- **False-positive lessons from the prototype** (fixed in it, to carry into the real rules): matching words like + "fresh" or "drop" in seed *content* is wrong — look only for code (`payload.delete(`, `deleteMany`, script name + `fresh`); import-map expectations must follow the plugin version (`TotpRedirectProvider` exists from 1.14.2). + +## 8. Plan once approved + +1. Rule modules + runner + human/JSON output + config file + exit codes (static rules, `--offline`). +2. `--url` (reusing `seo-check.mjs`) and `--sites` / `--md`. +3. `--deep` via `payload run`; the token endpoint if D3 says so. +4. `planSkills()` extracted from `ipal-skills`; `audit.sh` reuse. +5. Tests: one fixture project per rule (pass and fail), the JSON schema, the exit codes, silencing with and + without a reason, an expired `until`. +6. Docs: `docs/doctor.md`, AGENT.md §11 and §14, the `ipal-doctor` skill, `ipal-setup` / `ipal-upgrade` final + step, generated `docs/agent/doctor-rules.md`, CHANGELOG. +7. Hand the rule list to the starter; it runs the doctor in its own tests (a generated site = 0 findings).