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
+7 -2
View File
@@ -1244,9 +1244,12 @@ Record the key project decisions (stack, decisions, page modes) in the project's
## 11. BEFORE YOU SAY "DONE"
**Run, do not guess** — `ipal-audit` (the §0b set + the rules below) and `ipal-seo-check`
(GEO and SEO on the built site) instead of manual greps:
(GEO and SEO on the built site) instead of manual greps; then `ipal-doctor` for the whole site against the team
standard (versions, Node 22, layout, database names, env, headers, 2FA, cookie scanner, AGENTS.md, skills, seeds,
block library — [doctor.md](../doctor.md)):
```bash
bash .agents/skills/ipal-audit/scripts/audit.sh
pnpm exec ipal-doctor # + --deep --url http://localhost:3000 on the built site
node .agents/skills/ipal-seo-check/scripts/seo-check.mjs http://localhost:3000
pnpm generate:types && pnpm tsc --noEmit
pnpm build # --webpack in the script; locally, not only dev
@@ -1318,6 +1321,7 @@ Anything that needs a developer → move it to the panel.
| Seeds on production: create-only, dry run, backup, update guard | [seeding.md](../seeding.md) |
| Meta Pixel / GA4 via GTM | [gtm-meta-pixel.md](../gtm-meta-pixel.md) |
| Turnstile | [turnstile.md](../turnstile.md) |
| ipal-doctor: the site against the team standard, `ipal-doctor.json`, `/api/ipal/doctor` | [doctor.md](../doctor.md) |
| Panel white-label | [white-label.md](../white-label.md) |
---
@@ -1388,9 +1392,10 @@ the task matches — manually: `/<name>`.
| `ipal-audit` | before every "done" — the §0b set + the §11 checks + panel (§6.5a) + hardcoding in JSX + tsc + build |
| `ipal-seo-check` | the running site through the eyes of Googlebot and AI agents (head, canonical, hreflang, sitemap, 404, JSON-LD, llms, Markdown, MCP) |
| `ipal-consent-check` | browser: no tracking pixels or cookies before consent; the Google tag may load before consent only in Consent Mode `advanced` (all signals `denied`) — a client who wants zero requests gets `consentMode: 'basic'` |
| `ipal-doctor` | the whole site against the team standard in one command (`pnpm exec ipal-doctor`): versions, Node 22, layout, database names, env, headers, CSP, 2FA, cookie scanner, adminMeta, AGENTS.md, skills, seeds, block library, pnpm audit; `--url` / `--deep` for the running site and the database; `--strict` in the CI of a new site |
| `ipal-plugin-gap` | ipal-kit has a bug or is missing a feature — report to the owner, wait for the decision; a marked workaround only after approval |
Run the scripts in the skills, do not read them (the output is enough): `ipal-audit/scripts/audit.sh`,
Run the scripts in the skills, do not read them (the output is enough): `ipal-audit/scripts/audit.sh`, `pnpm exec ipal-doctor`,
`ipal-seo-check/scripts/seo-check.mjs`, `ipal-consent-check/scripts/consent-check.mjs`,
`ipal-locale-add/scripts/locale-coverage.ts`; templates to copy are in `resources/`.
+22 -4
View File
@@ -63,7 +63,20 @@ legacy-peer-deps=true
```json
{
"domain": "example-studio.pl",
"launched": false
"launched": false,
"rules": {
"audit:collections-present": {
"off": true,
"reason": "Project decisions: posts and caseStudies with archive pages; entryFields.ts is their shared field helper, not a collection"
},
"i18n-literals": {
"off": true,
"files": [
"src/components/design/**"
],
"reason": "Approved exception (AGENTS.md → Project decisions): the /design styleguide has its labels in code"
}
}
}
```
@@ -242,10 +255,11 @@ export function register() {
if (process.env.NEXT_RUNTIME !== 'nodejs') {return}
// storage: R2 is required in production. ALLOW_LOCAL_MEDIA=1 lets a production build run on local disk for
// local checks and CI only — never set it in Coolify.
// cookieCrawl: IPAL_COOKIE_SCAN_URL / IPAL_COOKIE_SCAN_TOKEN in production (cookieScanner.crawl, the shared service).
// databaseName: DATABASE_URI must name example-studiopl_dev / example-studiopl_prod (databaseNamesFor).
// R2_PUBLIC_URL optional: media are served through the app by default (storage.md, env.md).
assertEnv(
ipalEnvRules({ databaseName: { domain: 'example-studio.pl' }, ipHeader: true, storage: process.env.ALLOW_LOCAL_MEDIA !== '1' }).map((rule) =>
ipalEnvRules({ cookieCrawl: true, databaseName: { domain: 'example-studio.pl' }, ipHeader: true, storage: process.env.ALLOW_LOCAL_MEDIA !== '1' }).map((rule) =>
rule.name === 'R2_PUBLIC_URL' ? { ...rule, required: false } : rule,
),
)
@@ -348,6 +362,7 @@ import {
buildRevalidateHook,
buildSlugField,
buildSummaryField,
rowLabel,
trackSlugHistoryHook,
} from '@intecion/ipal-kit'
import { revalidatePath } from 'next/cache'
@@ -367,7 +382,7 @@ export const Pages: CollectionConfig = {
{ name: 'layout', type: 'blocks', blocks: pageBlocks, minRows: 1 },
buildSummaryField(), // aiSummary — GEO (llms.txt, MCP)
buildNoindexField(),
{ name: 'slugHistory', type: 'array', admin: { readOnly: true }, fields: [{ name: 'slug', type: 'text' }] },
{ name: 'slugHistory', type: 'array', admin: { components: rowLabel('slug', 'Old address'), readOnly: true }, fields: [{ name: 'slug', type: 'text' }], labels: { plural: 'Old addresses', singular: 'Old address' } },
],
hooks: {
afterChange: [revalidate.afterChange],
@@ -434,7 +449,7 @@ export const entryFields: Field[] = [
```ts
import type { GlobalConfig } from 'payload'
import { buildGlobalRevalidateHook } from '@intecion/ipal-kit'
import { buildGlobalRevalidateHook, rowLabel } from '@intecion/ipal-kit'
import { revalidatePath } from 'next/cache'
/** Company data for a PL market site: footer, contact block details, LocalBusiness JSON-LD. */
@@ -445,6 +460,7 @@ export const Company: GlobalConfig = {
{ name: 'name', type: 'text', required: true },
{ name: 'legalName', type: 'text' },
{ name: 'taxId', type: 'text', label: 'NIP' },
{ name: 'taxIdLabel', type: 'text', admin: { description: 'Shown before the tax ID in the footer.' }, defaultValue: 'NIP', label: 'Tax ID label', localized: true },
{
name: 'address',
type: 'group',
@@ -461,6 +477,8 @@ export const Company: GlobalConfig = {
{
name: 'socials',
type: 'array',
admin: { components: rowLabel('label', 'Profile'), initCollapsed: true },
labels: { plural: 'Profiles', singular: 'Profile' },
fields: [
{ name: 'label', type: 'text', required: true },
{ name: 'url', type: 'text', required: true },
+7
View File
@@ -36,6 +36,13 @@ classes (warnings), `styles.css` without `@intecion/ipal-kit/tokens.css` (warnin
next/font in `--font-body` with the preset (warning), and with `src/design/tokens.ts`: no `DESIGN.md` (warning) and
`ipal-tokens --check` — a stale `src/design/tokens.css` or a WCAG AA contrast failure is an error.
## ipal-audit and ipal-doctor
`ipal-audit` checks the **code** inside the edit loop (and tsc + build). `pnpm exec ipal-doctor` checks the **site**
against the team standard: it runs this script (`--quick`) from the installed package, reports its findings under its
own rule ids (`i18n-literals`, `blocks-tokens`, `audit:<title>`, one per file), and adds versions, Node, layout, database
names, env, admin, AGENTS.md, skills, seeds and — with `--url` / `--deep` — the running site and the database
(the `ipal-doctor` skill, docs/doctor.md). An approved exception for the doctor goes into `ipal-doctor.json` with a reason.
## What the script does not check (do it by hand)
- **Editor test** (AGENT.md §11): every text, image, button, section,
@@ -7,6 +7,8 @@
# Exit code: 0 = no errors (warnings allowed), 1 = at least one error.
set -u
# UTF-8 for grep: in the C locale a multibyte class like [ąę…] matches single bytes (an en dash hit "Polish").
export LC_ALL="${LC_ALL:-C.UTF-8}"
QUICK=0
for arg in "$@"; do
@@ -322,8 +324,10 @@ if [ -n "$CFG" ]; then
report WARNING "robots blocks AI bots" "§0b.8 — only with the client's decision in AGENTS.md" \
"$(skipped aibots || g "aiBots: *'(disallow|block-training)'" src --include=*.ts)"
fi
if [ -n "$CFG" ] && grep -qE 'forms *:' "$CFG" 2>/dev/null && ! ls scripts/seed-form* >/dev/null 2>&1 && ! skipped forms-seed; then
report WARNING "no form seed" "ipal-form §5 — every form from scripts/seed-form-*.ts (notification + sender confirmation, all languages)" "scripts/seed-form-*.ts"
# A form seed: scripts/seed-form-*.ts, or a seed file (src/seed, scripts) that seeds the forms collection.
FORM_SEED=$(ls scripts/seed-form* 2>/dev/null; grep -rlE "collection: *['\"]forms['\"]|upsertBy\( *['\"]forms['\"]|seed\.form\(|\.forms?\(" $(dirs src/seed scripts) 2>/dev/null)
if [ -n "$CFG" ] && grep -qE 'forms *:' "$CFG" 2>/dev/null && [ -z "$FORM_SEED" ] && ! skipped forms-seed; then
report WARNING "no form seed" "ipal-form §5 — every form from a seed (scripts/seed-form-*.ts or src/seed/forms.ts: notification + sender confirmation, all languages)" "scripts/seed-form-*.ts"
fi
need WARNING r2 "R2 env in .env.example" ".env.example lists R2_BUCKET, R2_ENDPOINT, R2_ACCESS_KEY_ID, R2_SECRET_ACCESS_KEY, R2_PUBLIC_URL" 'R2_BUCKET' .env.example
need WARNING '' "IPAL_IP_HEADER in .env.example" "header the rate limit trusts, e.g. cf-connecting-ip (forms.md)" 'IPAL_IP_HEADER' .env.example
@@ -18,6 +18,31 @@ const lineOf = (src, i) => src.slice(0, i).split('\n').length
const out = (level, rule, file, src, i, detail) => console.log(`${level}|${rule}|${file}:${lineOf(src, i)}: ${detail}`)
const strip = (s) => s.replace(/\/\*[\s\S]*?\*\//g, (m) => m.replace(/[^\n]/g, ' ')).replace(/(^|[^:])\/\/.*$/gm, (m, p) => p + ' '.repeat(m.length - p.length))
// The text of the object literal around index i, without the contents of its nested `fields: [...]`.
function ownObject(src, i) {
let start = i
for (let depth = 0; start > 0; start--) {
const ch = src[start - 1]
if (ch === '}') depth++
else if (ch === '{') { if (depth === 0) { start--; break } depth-- }
}
let end = i
for (let depth = 0; end < src.length; end++) {
const ch = src[end]
if (ch === '{') depth++
else if (ch === '}') { if (depth === 0) break; depth-- }
}
const obj = src.slice(start, end + 1)
const at = obj.search(/\bfields\s*:\s*\[/)
if (at < 0) return obj
let j = obj.indexOf('[', at)
for (let depth = 0; j < obj.length; j++) {
if (obj[j] === '[') depth++
else if (obj[j] === ']' && --depth === 0) break
}
return obj.slice(0, at) + obj.slice(j + 1)
}
for (const file of files) {
const src = strip(readFileSync(file, 'utf8'))
@@ -35,15 +60,13 @@ for (const file of files) {
else if (m[1] === 'description' && text.length > 120) out('WARNING', 'description over 120 chars — one short sentence: what it does / where it shows', file, src, m.index, `${text.length} chars`)
}
// arrays: labels (→ "Add Feature" button) + rowLabel (→ readable rows)
// arrays: labels (→ "Add Feature" button) + rowLabel (→ readable rows) — anywhere in the array's own
// object (before or after its `fields`), not inside the nested fields
for (const m of src.matchAll(/type:\s*['"]array['"]/g)) {
const before = src.slice(0, m.index)
const start = Math.max(before.lastIndexOf('name:'), before.lastIndexOf('{'))
const fieldsAt = src.indexOf('fields:', m.index)
const head = src.slice(start < 0 ? m.index : start, fieldsAt < 0 ? m.index + 400 : fieldsAt)
const name = head.match(/name:\s*['"](\w+)['"]/)?.[1] ?? '?'
if (!/\blabels\s*:/.test(head)) out('WARNING', 'array without labels {singular, plural} — panel shows "Add Row"', file, src, m.index, name)
if (!/rowLabel|RowLabel/.test(head)) out('WARNING', 'array without rowLabel() — rows read "Item 01" instead of their content', file, src, m.index, name)
const own = ownObject(src, m.index)
const name = own.match(/name:\s*['"](\w+)['"]/)?.[1] ?? '?'
if (!/\blabels\s*:/.test(own)) out('WARNING', 'array without labels {singular, plural} — panel shows "Add Row"', file, src, m.index, name)
if (!/rowLabel|RowLabel/.test(own)) out('WARNING', 'array without rowLabel() — rows read "Item 01" instead of their content', file, src, m.index, name)
}
// too many fields in one block config → tabs / condition / arrays / variant
+70
View File
@@ -0,0 +1,70 @@
---
name: ipal-doctor
description: Checks the whole site against the ipal-kit team standard with one command (`pnpm exec ipal-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 ipal-* 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 ipal-kit upgrade, before a deploy, in CI of a new site, and when asked whether a site follows the team rules.
---
# ipal-doctor
Full reference: `node_modules/@intecion/ipal-kit/docs/doctor.md`.
## Steps
1. From the project root (after `pnpm install`, `pnpm payload generate:importmap`, `pnpm exec ipal-skills`):
```bash
pnpm exec ipal-doctor # static: files only, no build, no database
pnpm exec ipal-doctor --offline # without the registry (latest plugin, pnpm audit)
```
Running site and database (read-only):
```bash
pnpm build && pnpm start # or the deployed URL
pnpm exec ipal-doctor --deep --url http://localhost:3000
```
2. Show the user the **full output**. Every finding names its rule, the file, a fix and a doc.
3. Fix every `error`. A `warning` is drift — fix it or tell the user why not. `info` is a note.
4. A deliberate exception (the owner's decision) goes into `ipal-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" } } }
```
Keys: `off`, `severity`, `reason` (required), `until` (ISO date), `files` (globs). Top level: `domain`, `launched`,
`layout.allow`, `seen` (written by the doctor), `extraRules`.
5. Run again until it reports what the project expects (a new site: `--strict` → `0 error(s), 0 warning(s), 0 info`).
## Options and exit codes
`[dir]` · `--json` (schema 1) · `--md` · `--strict` (= `--fail-on info`) · `--fail-on error|warning|info` · `--offline` ·
`--url <url>` · `--staging` (must be noindex) · `--admin-route <path>` · `--deep` · `--env-file <prod export>` (checks
`<domain>_prod`) · `--only` / `--skip <ids,groups>` · `--sites '../*-web'` (a read-only rule × site table, exit 0).
Exit `0` ok · `1` findings at or above `--fail-on` · `2` could not run · `3` a rule crashed.
## CI of a new site (starter, reference site)
```bash
pnpm exec ipal-doctor --strict --offline # after install
pnpm exec ipal-doctor --strict --offline --deep --url http://localhost:3000 # after build + start
```
Existing client sites are not gated on it; run it there as a report only.
## The status endpoint
`GET /api/ipal/doctor` is added by `ipalKit` and answers 404 until the site has `IPAL_DOCTOR_TOKEN` (≥ 32 characters).
Then `Authorization: Bearer <token>`; counts only (`usersWithout2fa`, `pendingCookies`, `plugin`, `node`). With the same
`IPAL_DOCTOR_TOKEN` in the doctor's environment, `--url` reads it. Off: `ipalKit({ doctor: false })`; adapt:
`ipalKit({ doctor: { tokenVar, access } })`.
## Env the doctor reads
`IPAL_DOCTOR_TOKEN` (endpoint), `CI` (set → never writes `seen`), `NO_COLOR` (plain output), `PAYLOAD_CONFIG_PATH`
(`--deep` loads that config), `IPAL_DOCTOR_IMPORT_MAP` (internal: passed to the probe).
## Building blocks
`@intecion/ipal-kit/doctor`: `runDoctor`, `doctorRules`, `formatReport`, … (docs/doctor.md → Building blocks) — wrap,
filter or add rules (`extraRules` in `ipal-doctor.json`, each module exports `rules: DoctorRule[]`).
## Relation to the other checks
`ipal-audit` stays the check inside the edit loop (plus tsc and build); the doctor runs `ipal-audit --quick` from the
installed package, `ipal-seo-check` with `--url`, and adds versions, env, database, admin, seeds, skills and the live
headers. `ipal-consent-check` (browser) is not part of it.
+3 -1
View File
@@ -70,6 +70,7 @@ description: Complete map of everything @intecion/ipal-kit provides — every ip
| `forms.consentFieldName` | `'consent'` | name of the GDPR consent field `submitForm` requires (read from `config.custom.ipal`) | `createSubmitAction({ consentFieldName })` / `submitForm` argument wins |
| `consentLog` | off | `consent-records` collection + `POST /api/ipal/consent` (rate limit 20/min) | `true` / `{ retentionDays }` (default 1095) |
| `consentLog.collectionOverrides` | none | changes `consent-records`: an object merges `access` / `admin` / `hooks` key by key (your keys win), a function `(collection) => collection` takes over (keep the slug) | e.g. `{ access: { read: ({ req }) => req.user?.email === '[email protected]' } }` — narrows who reads records in a project without roles |
| `doctor` | on (404 until `IPAL_DOCTOR_TOKEN` is set) | `GET /api/ipal/doctor` — read-only counts for `ipal-doctor --url` (users without TOTP, cookies waiting for approval, versions); Bearer token ≥ 32 characters, rate-limited, never names or values | `false` = no endpoint; `{ tokenVar, access }` (doctor.md) |
| `cookieScanner` | off | `cookie-review` collection, "Scan cookies" box above its list (`CookieScanButton`), `GET`/`POST /api/ipal/cookie-scan`, and (unless `approval: false`) the *Approve cookies* view `/admin/cookie-approval` (`CookieApprovalView`) + `GET`/`POST /api/ipal/cookie-approval` + the dashboard reminder; a scan lists the cookies of the integrations switched on + names looked up in the bundled Open Cookie Database; one **Approve and add** puts the ticked cookies into Cookies → Cookie list (so `<CookieTable>` and the detailed window); never deletes, never overwrites edited text, never duplicates, nothing reaches the banner before approval | `true` / object; after switching on: `pnpm generate:importmap` + `migrate:create`. Check: *Privacy → Cookie review* → **Scan cookies** → "Waiting for approval: N" → **Review and approve** → **Approve and add** → the cookies are in Cookies → Cookie list (cookie-scanner.md) |
| `cookieScanner.adminLayout` | `'combined'` | one *Cookies* entry: *Review and approve* and (with `crawl`) *Site check* tabs on the `cookie-settings` global (`ui` fields, `CookieReviewTab` / `CookieSiteCheckTab`); `cookie-review` and `cookie-crawl` get `admin.group: false` (out of the nav, pages and API kept) | `'separate'`; no migration, `generate:importmap` |
| `fillEmptyLocales` | on | afterChange hooks: text saved in one language fills the empty languages of `cookie-settings` `cookies.purpose` / `cookies.duration` and `cookie-review` `purpose` / `retention`; never overwrites a language's own text | `false`; `{ 'cookie-settings': [...], 'cookie-review': [...] }` (`[]` = off); check: add a cookie in Polish, switch the locale to English → same purpose |
@@ -142,7 +143,7 @@ description: Complete map of everything @intecion/ipal-kit provides — every ip
## 3. What the project wires itself
Mandatory set: AGENT.md §0b, skill **ipal-setup**; checks: **ipal-audit**, **ipal-seo-check**.
Mandatory set: AGENT.md §0b, skill **ipal-setup**; checks: **ipal-audit**, **ipal-seo-check**, **ipal-doctor** (`pnpm exec ipal-doctor` — the whole site against the team standard; `ipal-doctor.json` silences a rule with a reason, docs/doctor.md).
`$U` = `NEXT_PUBLIC_SERVER_URL` (e.g. `http://localhost:3000`).
| element | file | minimal example | how to check | details |
@@ -236,6 +237,7 @@ and what throws without `i18n`: frontend.md. `SiteProviders` props: `shell`, `ba
| `INDEXNOW_KEY` | no | key from Site integrations → IndexNow (generated) | env or panel |
| `IPAL_IP_HEADER` | `ipHeader: true` + production | rate limit trusts any IP header (spoofing) + warning in prod | env: `cf-connecting-ip` (Cloudflare) / `x-forwarded-for` (Traefik/nginx) |
| `IPAL_COOKIE_SCAN_URL`, `IPAL_COOKIE_SCAN_TOKEN` | `cookieScanner.crawl` (`ipalEnvRules({ cookieCrawl: true })` requires both in production; token ≥ 16 chars) | **Check site** disabled, the box names the missing variable | env; the token also goes into the scanner service's `IPAL_CRAWLER_SITES` as `host=token` |
| `IPAL_DOCTOR_TOKEN` | no; ≥ 32 characters | `GET /api/ipal/doctor` answers 404; with it the endpoint answers a Bearer token, and `ipal-doctor --url` with the same variable reads the deep counts | env (Coolify) and the doctor's shell; also read by the doctor: `CI`, `NO_COLOR`, `PAYLOAD_CONFIG_PATH` (`--deep`), `IPAL_DOCTOR_IMPORT_MAP` (internal) — doctor.md |
| `IPAL_NOINDEX` | no; `1`/`true`/`yes` **staging/preview only** | — (when set: robots Disallow, meta noindex, `X-Robots-Tag`, IndexNow sends nothing) | staging env |
| `NEXT_PHASE` | set by Next | only tells `next build` from runtime: during the build an unreachable database gives an empty sitemap; at runtime the sitemap throws (route → 503) | do not set by hand |
| `NEXT_RUNTIME` | set by Next | `instrumentation.ts` checks for `nodejs`; missing (scripts, seed) → `buildRevalidateHook` does not revalidate | do not set by hand |
@@ -1,7 +1,7 @@
# ipal-kit — export index
Every public export of `@intecion/ipal-kit` (all entries: root, `/client`, `/rsc`,
`/server`, `/seed`, `/next/middleware`, `/admin`, `/env`, `/blocks`, `/blocks/rsc`, `/templates`, `/tokens`), grouped by module. Search with grep
`/server`, `/seed`, `/next/middleware`, `/admin`, `/env`, `/blocks`, `/blocks/rsc`, `/templates`, `/tokens`, `/doctor`), grouped by module. Search with grep
(`grep -n "name" .agents/skills/ipal-reference/resources/api.md`) before you write anything yourself.
"Import from" column — the first entry is preferred. Plugin options, env, routes and what the
project wires: `../SKILL.md`. Module details: `node_modules/@intecion/ipal-kit/docs/<page>.md`.
@@ -763,6 +763,30 @@ CSS: `@intecion/ipal-kit/tokens.css` (neutral `--ipal-*` defaults, light/dark, `
**Types:** `TokensInput`, `IpalTokenName` (root, `/tokens`), `ColorInput`, `ColorRole`, `ContrastRow`, `FluidRange`, `RemValue` (`/tokens`).
## ipal-doctor (`doctor`) — details: `node_modules/@intecion/ipal-kit/docs/doctor.md`
Bin: `ipal-doctor` (`pnpm exec ipal-doctor [dir] [--json] [--md] [--strict] [--fail-on] [--offline] [--url] [--staging]
[--admin-route] [--deep] [--env-file] [--only] [--skip] [--sites]`). `@intecion/ipal-kit/doctor` is Node only.
| Export | Import from | What it does / when |
|---|---|---|
| `runDoctor(options)` | `@intecion/ipal-kit/doctor` | Runs every rule on one project folder → `DoctorReport` (schema 1). Options: `root`, `packageRoot`, `offline`, `url`, `staging`, `adminRoute`, `deep`, `deepStatus`, `envFile`, `only`, `skip`, `rules`, `config`, `today`, `writeSeen`. Never throws for a failing rule. |
| `runDoctorCli(argv, { packageRoot, cwd?, log? })` | `@intecion/ipal-kit/doctor` | The command; returns the exit code (0 / 1 / 2 / 3). `parseDoctorArgs`, `expandSites` (`'../*-web'`), `DOCTOR_USAGE`. |
| `doctorRules` | `@intecion/ipal-kit/doctor` | Every built-in rule (`DoctorRule`: `id`, `group`, `source`, `docs`, `check(ctx)`) — filter, wrap or extend; own rules through `extraRules` in `ipal-doctor.json`. |
| `applySettings(findings, ctx)`, `globToRegExp(glob)`, `AUDIT_SKIP_RULES` | `@intecion/ipal-kit/doctor` | `ipal-doctor.json` `rules` (`off`, `severity`, `reason`, `until`, `files`) and `ipal-audit-skip` lines applied to findings. |
| `createDoctorContext(options)`, `loadDoctorConfig(root)`, `parseEnvFile(text)`, `readAuditSkips(agentsMd)`, `bareHost(url)` | `@intecion/ipal-kit/doctor` | What a rule reads about the project (files only, values never leave it). |
| `formatReport(report, { color })`, `formatDriftTable(reports)` | `@intecion/ipal-kit/doctor` | Human report; the rule × site Markdown table. |
| `planSkills({ dest, source })` | `@intecion/ipal-kit/doctor` | What `ipal-skills` would change: `missing`, `stale`, `retired` ipal-* folders. |
| `parseToolOutput(text)`, `AUDIT_RULE_MAP` | `@intecion/ipal-kit/doctor` | Reads `[ERROR] title (n) — rule` output of `audit.sh` / `seo-check.mjs`; audit titles that are a doctor rule. |
| `DEFAULT_SRC_ALLOW` | `@intecion/ipal-kit/doctor` | Top-level `src/` entries the convention allows (`layout.allow` extends it). |
| `createLiveFetcher(url, { adminRoute, staging })` | `@intecion/ipal-kit/doctor` | Cached GET-only fetcher for the live rules. |
| `runDeepProbe(ctx)` | `@intecion/ipal-kit/doctor` | `pnpm exec payload run …/dist/modules/doctor/probe.js` in the project → `DoctorStatus`. |
| `collectDoctorStatus(payload)` | `@intecion/ipal-kit/doctor` | Read-only counts: `usersWithout2fa`, `pendingCookies`, `plugin`, `node`. |
| `buildDoctorEndpoint({ tokenVar, access })` | `@intecion/ipal-kit/doctor` | `GET /ipal/doctor` (`/api/ipal/doctor`): 404 until the token variable (default `IPAL_DOCTOR_TOKEN`, ≥ 32 chars) is set, Bearer token or `access`, rate-limited. Added by `ipalKit` unless `doctor: false`. |
**Types:** `DoctorRule`, `DoctorFinding`, `RuleFinding`, `DoctorReport`, `DoctorConfig`, `DoctorRuleSetting`, `DoctorSeverity`,
`DoctorSource`, `DoctorStatus`, `DoctorContext`, `RunDoctorOptions`, `DoctorEndpointOptions`.
## Turnstile (`turnstile`) — details: `node_modules/@intecion/ipal-kit/docs/turnstile.md`
| Export | Import from | What it does / when |
@@ -136,7 +136,9 @@ for (const url of sample) {
if (!title) issues.title.push(url)
else {
if (title.length > 65) issues.longTitle.push(`${url} (${title.length} chars)`)
titles.set(title, [...(titles.get(title) ?? []), url])
// per language: the same word in two languages ("Blog" in pl and en) is not a duplicate
const key = `${multiLocale ? localeOf(url) : ''}\u0000${title}`
titles.set(key, [...(titles.get(key) ?? []), url])
}
const desc = tags(head, /<meta[^>]+name="description"[^>]*>/gi).map((t) => attr(t, 'content'))[0]?.trim()
if (!desc) issues.desc.push(url)
@@ -196,7 +198,7 @@ for (const url of sample) {
}
}
const dupTitles = [...titles.entries()].filter(([, us]) => us.length > 1).map(([t, us]) => `"${t}" × ${us.length}`)
const dupTitles = [...titles.entries()].filter(([, us]) => us.length > 1).map(([k, us]) => `"${k.split('\u0000')[1]}" × ${us.length}`)
const dupDescs = [...descriptions.entries()].filter(([, us]) => us.length > 1).map(([d, us]) => `"${d.slice(0, 60)}…" × ${us.length}`)
if (issues.status.length) report('ERROR', 'sitemap URLs not 200 (redirect / error)', 'sitemap must list final, live URLs', issues.status)
if (issues.noHead.length) report('ERROR', 'no </head> in HTML', 'broken document', issues.noHead)
+1
View File
@@ -537,6 +537,7 @@ bash .agents/skills/ipal-audit/scripts/audit.sh # full: §0b "missing
pnpm build && pnpm start
node .agents/skills/ipal-seo-check/scripts/seo-check.mjs http://localhost:3000 # 0 errors
node .agents/skills/ipal-consent-check/scripts/consent-check.mjs http://localhost:3000/pl
pnpm exec ipal-doctor --strict --offline --deep --url http://localhost:3000 # the team standard (skill ipal-doctor)
```
The §0b list with its checks: proxy + catch-all + 404 (stage 6) · meta, sitemap, robots, manifest (7) · JSON-LD (6, 10) ·
llms, llms-full, Markdown, MCP, AI bots, IndexNow (8) · Media/R2 (3–4) · seeded forms (9) · Turnstile (9) ·
+5 -1
View File
@@ -217,4 +217,8 @@ need a **data migration before** the old fields are removed — ask
the user whether the project already has content.
## 4. Finish
A full **ipal-audit** with no errors + a list of things to check in the admin panel.
A full **ipal-audit** with no errors, then `pnpm exec ipal-doctor` (after `pnpm exec ipal-skills` and
`pnpm payload generate:importmap`): no new errors against the report before the upgrade (skill **ipal-doctor**;
new rules come with new versions — read each finding, fix or record the owner's decision in `ipal-doctor.json` with a
reason). Before the upgrade, `pnpm dlx --package=@intecion/ipal-kit@latest ipal-doctor --offline` shows what the newest
rules will report. Then the list of things to check in the admin panel.