392 lines
33 KiB
Markdown
392 lines
33 KiB
Markdown
# ipal-doctor — proposal
|
||
|
||
Status: **built** (branch `claude/ipal-doctor-build`). The user guide is [docs/doctor.md](../doctor.md); this file
|
||
keeps the design and the decisions (§6). Where the two differ, doctor.md describes what shipped.
|
||
|
||
## 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` | warning naming the newer version; error two or more minors behind | 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@<latest>` + 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 [email protected] [email protected]` |
|
||
| `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` say 22 when they exist. With `--deep`, also the running `process.version`. No Dockerfile or image check: sites are built locally and Coolify deploys the app, with MongoDB as a separate container on the same network | set `"engines": { "node": ">=22 <23" }` and `.nvmrc` = `22` |
|
||
| `pnpm-pinned` | info | S | `packageManager` is set (every build 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 <pkg>` 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/layout/`, `components/forms/formClasses.ts`, and `components/ui/` **only when the project does not take the primitives from `@intecion/ipal-kit/blocks/rsc` through `createBlockRegistry`** (then `ui/` holds only overrides and may be missing). 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). The default allow list is the AGENT.md §3 set plus the shared drafts: `seed/`, `design/`, `db.ts`, `env.rules.ts`, `content.config.ts`. The list is exported, and `ipal-doctor.json` `layout.allow` extends it | 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)/<admin>/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 = `<domain without dots>_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. The rule calls the plugin's own `databaseNamesFor` / `databaseNameFromUri` / `checkDatabaseName` (`@intecion/ipal-kit/env`), so the doctor and `ipalEnvRules({ databaseName })` cannot disagree; it also suggests `ipalEnvRules({ databaseName: true })` |
|
||
| `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 (Coolify → Environment Variables) → 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 runs a file that uses `createSeeder` from `@intecion/ipal-kit/seed` (so `only` / `SEED_ONLY` and the full-seed guard apply), deletes nothing (`payload.delete(`, `deleteMany`, `dropDatabase`, a `fresh`/`reset` script), and does not switch the guard off: no `guard: false`, no `guard.allowFull`, no `IPAL_SEED_ALLOW_FULL=1` in a package script or a committed env file. After launch (`launched` in `ipal-doctor.json`, or a launch date under "Project decisions" in AGENTS.md) a seed file that sets no `only` list is a warning — the run then needs `SEED_ONLY` | 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:<title>` | the `ipal-audit` skill |
|
||
|
||
### 2.5a Block library (from the approved block-library design, `docs/dev/block-library-proposal.md` §5.1, §7.3, §10)
|
||
|
||
| Id | Sev | Src | Check | Fix hint |
|
||
|---|---|---|---|---|
|
||
| `blocks-registry` | error | S | `blocks/registry.ts` builds the registry with `createBlockRegistry(content, { ui, components, classNames, extra })` or renders through `RenderBlocks`; no hand-written `switch (blockType)` | blocks.md → Block library |
|
||
| `blocks-ui-required` | error | S | without `createBlockRegistry`, `components/ui/` holds the five primitives (Section, SectionHeader, Media, CMSLink, Button); with it, `ui/` is optional | the `ipal-block` skill |
|
||
| `blocks-ui-override` | warning | S | every file in `components/ui/` named like a library primitive (Section, SectionHeader, Media, CMSLink, Button, Container, Card) is passed through the registry's `ui` option. Otherwise the library blocks keep the plugin's version and the two looks drift apart | `createBlockRegistry(content, { ui: { Button } })` |
|
||
| `blocks-duplicate` | warning | S | a project block whose `slug` (read from its `config.ts`, not the folder name) or `interfaceName` matches a library block or a variant of one, and is not a declared override or eject. A library block renamed through its `slug` option (`testimonials` → `reviews`) counts as the library block, so a project block with the old or the new slug is a duplicate | use the library block + variant, or record the eject in "Project decisions" |
|
||
| `blocks-helper-copy` | warning | S | no local copies of plugin helpers (`buildItemsField`, `buildActionButtonsField`, `ctaHref`, and the other exported field builders) | import from the plugin |
|
||
| `blocks-tokens` | error | S | classes use design tokens only (no hex, no arbitrary colours) — the `ipal-audit` hex rule, extended by the design-token track's names | DESIGN.md / tokens |
|
||
|
||
The doctor reads `blockLibraryManifest` from `@intecion/ipal-kit/blocks` (plain data: `blocks[{ slug, interfaceName,
|
||
variants, fields, phase }]`, `primitives`, `fieldBuilders`, `templates`), so a new library block, primitive or
|
||
field builder needs no doctor change. `blocks-helper-copy` checks the `fieldBuilders` names; `blocks-ui-override`
|
||
the `primitives`.
|
||
|
||
### 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. `localhost` is exempt from HSTS (plain http in CI).
|
||
|
||
## 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 `src/modules/doctor/rules/*.ts` (built to `dist/`, the bin imports them), 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/dist/modules/doctor/probe.js`: the Local
|
||
API, read-only queries (`count`), locally with the dev database (sites are built and checked locally), or in the Coolify app container's terminal
|
||
against the MongoDB container. 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:** `[dir]` (project folder, default the current one), `--strict` (= `--fail-on info`: any unsilenced finding fails), `--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"]
|
||
}
|
||
```
|
||
|
||
- A module the owner turned off (`twoFactor`, `cookieScanner`, `adminMeta`, `agency`, …) is a valid silenced rule: one entry per rule, each with its own `reason` (the owner's decision, the same text as the `ipal-audit-skip` line). `--strict` does not fail on silenced findings.
|
||
- 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 (owner, 2026-10-29)
|
||
|
||
The owner accepted every recommendation, with two adjustments (D5, D7) and one deployment note.
|
||
|
||
| # | Decision |
|
||
|---|---|
|
||
| D1 | **A bin in the plugin** (`bin/ipal-doctor.mjs`); newest rules through `pnpm dlx --package=@intecion/ipal-kit@latest ipal-doctor` |
|
||
| D2 | `plugin-latest`: **warning naming the newer version; error two or more minors behind** |
|
||
| D3 | Deep checks: **both** — `--deep` through `payload run`, and the status endpoint `GET /api/ipal/doctor`, off until `IPAL_DOCTOR_TOKEN` is set |
|
||
| D4 | Node: **`"engines": { "node": ">=22 <23" }` + `.nvmrc` = `22`** |
|
||
| D5 | **Already built and merged (main 0ed3898):** `createSeeder({ only })` / `SEED_ONLY="pages:kontakt,global:header"`, and a guard that refuses a full seed of production or a non-local database unless `IPAL_SEED_ALLOW_FULL=1` (or `guard.allowFull`). There is no `SEED_ALL`. `seed-named` checks for that helper and that the guard is not switched off (§2.5) |
|
||
| D6 | Domain for the database name: `NEXT_PUBLIC_SERVER_URL` → `ipal-doctor.json` `domain` → folder name; computed with the plugin's `databaseNamesFor` |
|
||
| D7 | **CI on new sites only:** sites generated by the starter and the reference site run `ipal-doctor --strict` (`--offline` where the registry is out of reach). **Existing client sites stay untouched** — no plan to bring them to zero; the dry run in §7 is information only. A read-only `--sites` sweep stays available as a report, never as a gate |
|
||
| D8 | **No `--fix` in v1** — hints only |
|
||
| D9 | CSP report-only: **info, then a warning after 4 weeks** from the first run that saw it (`ipal-doctor.json` `seen`), or as the project sets it |
|
||
|
||
**Deployment note:** sites are built and checked locally; Coolify deploys the app; MongoDB runs as a separate container
|
||
on the same network. The doctor has no Dockerfile or image rules, and `--deep` runs locally or in the app
|
||
container's terminal.
|
||
|
||
## 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 could run a seed for named records only** at the time of the dry run (the helper gained `only` / `SEED_ONLY` in main 0ed3898 afterwards). 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).
|
||
|
||
## 9. First real run (2026-10-29, built doctor, `--sites --offline`, read-only)
|
||
|
||
The client sites were not changed (git status before and after compared). `--offline`: no `plugin-latest` / `deps-audit`.
|
||
Existing client sites are a report only (D7).
|
||
|
||
| Rule | architektimprezpl-web | coastalclimatesupplycomau-web | ecogenicacouk-web | intecioncom-web | saydiamondspl-web | thecleanteampl-web | vanstevpl-web |
|
||
|---|---|---|---|---|---|---|---|
|
||
| **errors / warnings / info** | 5 / 12 / 4 | 23 / 51 / 3 | 3 / 6 / 3 | 6 / 24 / 5 | 11 / 15 / 3 | 6 / 20 / 2 | 32 / 64 / 4 |
|
||
| `2fa` | ✅ | ⚠️ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
||
| `admin-meta` | ⚠️ | ⚠️ | ⚠️ | ⚠️ | ⚠️ | ⚠️ | ⚠️ |
|
||
| `agents-md` | ✅ | ✅ | ✅ | ❌ 2 | ❌ 3 | ❌ 3 | ❌ 3 |
|
||
| `audit` | ⚠️ 3 | ❌ 36 | ✅ | ⚠️ 11 | ⚠️ | ⚠️ | ❌ 58 |
|
||
| `blocks-duplicate` | ⚠️ 3 | ⚠️ 4 | ⚠️ 3 | ⚠️ 3 | ⚠️ 6 | ⚠️ 5 | ⚠️ 3 |
|
||
| `blocks-helper-copy` | ✅ | ⚠️ 3 | ⚠️ | ✅ | ✅ | ✅ | ⚠️ |
|
||
| `blocks-tokens` | ⚠️ | ⚠️ | ✅ | ⚠️ | ✅ | ⚠️ | ❌ 5 |
|
||
| `blocks-ui-required` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ |
|
||
| `cookie-scanner` | ℹ️ | ❌ | ❌ | ℹ️ | ❌ | ❌ | ❌ |
|
||
| `csp` | ℹ️ | ℹ️ | ℹ️ | ℹ️ | ⚠️ 2 | ⚠️ | ⚠️ 2 |
|
||
| `db-name` | ❌ 2 | ❌ | ❌ | ❌ 2 | ❌ 2 | ⚠️ | ❌ 2 |
|
||
| `env-example` | ❌ | ❌ 2 | ❌ | ⚠️ | ✅ | ⚠️ | ❌ 2 |
|
||
| `env-rules` | ℹ️ | ℹ️ | ℹ️ | ℹ️ | ℹ️ | ℹ️ | ⚠️ 2 |
|
||
| `i18n-literals` | ⚠️ | ⚠️ 21 | ✅ | ✅ | ✅ | ✅ | ❌ 5 |
|
||
| `importmap` | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ |
|
||
| `layout-extra` | ℹ️ | ℹ️ | ℹ️ | ℹ️ | ℹ️ | ✅ | ℹ️ |
|
||
| `layout-required` | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ |
|
||
| `next-min` | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ |
|
||
| `node-22` | ⚠️ 2 | ⚠️ 2 | ⚠️ | ⚠️ 2 | ⚠️ 2 | ⚠️ 2 | ⚠️ 2 |
|
||
| `plugin-installed` | ❌ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ |
|
||
| `pnpm-pinned` | ✅ | ✅ | ✅ | ℹ️ | ✅ | ℹ️ | ℹ️ |
|
||
| `powered-by` | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ |
|
||
| `seed-named` | ✅ | ✅ | ✅ | ❌ 4 | ❌ 5 | ⚠️ 5 | ❌ 5 |
|
||
| `sharp-min` | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ |
|
||
| `skills-current` | ⚠️ | ✅ | ✅ | ⚠️ | ✅ | ✅ | ⚠️ |
|
||
|
||
|
||
The reference site: `node bin/ipal-doctor.mjs reference --strict --offline` → 0 errors, 0 warnings, 0 info (2 silenced with reasons).
|
||
|
||
### Deep + live run on the reference site (after merging main 977872b)
|
||
|
||
`node bin/ipal-doctor.mjs reference --strict --offline --deep --url http://localhost:3100` (MongoDB `example-studiopl_dev`,
|
||
seeded, production build): exit 0 — 0 errors, 0 warnings, 0 info, 6 silenced with reasons. The deep rules (users without
|
||
TOTP, pending cookies, env rules, exact import map) report nothing. Four `ipal-seo-check` warnings are silenced until
|
||
2026-11-30 as follow-ups: repeated meta descriptions and thin pages (reference content), and on the archive pages a skipped
|
||
heading level plus an unprioritised first image (the entryList block).
|