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:
co-authored by
Claude Opus 5.5
parent
0ab133fbd7
commit
a4e8cfeae8
@@ -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
|
||||
|
||||
@@ -14,6 +14,8 @@ One section per use of this skill. Details and ready code:
|
||||
`node_modules/@intecion/ipal-kit/docs/agent/AGENT.md` §6.
|
||||
|
||||
## 0. Library block first (docs/block-library.md)
|
||||
See every block and variant rendered (also on `muted` and `inverted`) on the reference site's Blocks page — seed
|
||||
`src/seed/showcase.ts` in `docs/agent/reference-site/INDEX.md`; wiring: `src/blocks/configs.ts`, `src/blocks/registry.ts` there.
|
||||
The plugin ships 15 blocks: `hero`, `textMedia`, `featureGrid`, `cta`, `richText`, `faq`, `contact`, `gallery`,
|
||||
`testimonials`, `stats`, `steps`, `logos`, `team`, `pricing`, `entryList` (variants: `blockLibraryManifest`).
|
||||
1. Does a library block or one of its variants fit the section? → turn it on in `src/blocks/configs.ts`
|
||||
|
||||
@@ -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.
|
||||
@@ -1,29 +1,36 @@
|
||||
// src/components/forms/formClasses.ts — the ONLY place forms are styled. Every
|
||||
// panel form (RenderForm / BuilderForm) uses it. Values = the project's design
|
||||
// tokens (DESIGN.md); the plugin ships no styles. Delete keys you don't need.
|
||||
// panel form (RenderForm / BuilderForm) uses it. Design-token utilities only
|
||||
// (node_modules/@intecion/ipal-kit/docs/design-tokens.md): a brand changes
|
||||
// src/design/tokens.ts, never this file. Delete keys you don't need.
|
||||
import type { BuilderFormClassNames } from '@intecion/ipal-kit/client'
|
||||
import { buttonClass } from '@intecion/ipal-kit/blocks/rsc'
|
||||
|
||||
const control =
|
||||
'w-full rounded-control border border-border-strong bg-surface px-3 py-2 text-fg placeholder:text-fg-muted ' +
|
||||
'transition-colors duration-fast ease-out focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus ' +
|
||||
'aria-invalid:border-danger'
|
||||
|
||||
export const formClasses: BuilderFormClassNames = {
|
||||
form: 'grid gap-6',
|
||||
progress: 'text-sm text-muted', // "Step 1 of 3"
|
||||
progress: 'text-sm text-fg-muted', // "Step 1 of 3"
|
||||
step: 'grid gap-4',
|
||||
stepTitle: 'text-h3 font-semibold',
|
||||
stepDescription: 'text-muted',
|
||||
stepTitle: 'text-h4',
|
||||
stepDescription: 'text-fg-muted',
|
||||
fields: 'grid grid-cols-12 gap-4',
|
||||
field: 'col-span-12',
|
||||
fieldHalf: 'md:col-span-6', // width ≤ 50 in the panel
|
||||
label: 'mb-1 block font-medium',
|
||||
input: 'w-full rounded-md border border-border px-3 py-2',
|
||||
textarea: 'w-full rounded-md border border-border px-3 py-2',
|
||||
select: 'w-full rounded-md border border-border px-3 py-2',
|
||||
label: 'mb-1 block font-medium text-fg-strong',
|
||||
input: control,
|
||||
textarea: control,
|
||||
select: control,
|
||||
checkboxLabel: 'flex items-start gap-2',
|
||||
choices: 'grid gap-2', // radio / checkbox group <fieldset>
|
||||
legend: 'mb-1 font-medium',
|
||||
legend: 'mb-1 font-medium text-fg-strong',
|
||||
choice: 'flex items-center gap-2',
|
||||
error: 'mt-1 text-sm text-danger',
|
||||
formError: 'text-danger',
|
||||
actions: 'flex gap-3',
|
||||
back: 'btn btn-secondary', // same classes as Button.tsx variants
|
||||
submit: 'btn btn-primary',
|
||||
success: 'rounded-md bg-surface p-6',
|
||||
formError: 'rounded-control bg-danger-surface p-4 text-danger',
|
||||
actions: 'flex flex-wrap gap-3',
|
||||
back: buttonClass('secondary'), // the same looks as the section buttons
|
||||
submit: buttonClass('primary'),
|
||||
success: 'rounded-card bg-success-surface p-6 text-success',
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ description: Complete map of everything @intecion/ipal-kit provides — every ip
|
||||
# ipal-reference
|
||||
|
||||
## How to use
|
||||
- **A working example of every row** is in the reference site: `docs/agent/reference-site/INDEX.md` (file → what it
|
||||
shows; wiring files in full).
|
||||
- **Look here first**, then at the code. Looking for a function → `grep -n "<word>" resources/api.md`
|
||||
(`resources/api.md` — every export: import, what it does). Module description:
|
||||
`node_modules/@intecion/ipal-kit/docs/<page>.md` (the "details" column).
|
||||
@@ -68,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 |
|
||||
@@ -140,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 |
|
||||
@@ -234,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`.
|
||||
@@ -759,10 +759,34 @@ CSS: `@intecion/ipal-kit/tokens.css` (neutral `--ipal-*` defaults, light/dark, `
|
||||
| `ipalVar(name, fallback?)` | `@intecion/ipal-kit/tokens`, `@intecion/ipal-kit` | `var(--ipal-<name>[, fallback])`. |
|
||||
| `IPAL_BREAKPOINTS` | `@intecion/ipal-kit/tokens`, `@intecion/ipal-kit` | `{ sm: 40, md: 48, lg: 64, xl: 80, '2xl': 96 }` (rem) — for `sizes=` / `matchMedia`. |
|
||||
| `COLOR_DEFAULTS`, `STATIC_DEFAULTS`, `FLUID_TOKENS`, `INVERSE_SCOPE`, `LEGACY_DARK_ROLES` | `@intecion/ipal-kit/tokens` | The catalogue: colour defaults per theme, theme-independent defaults, fluid names, inverse re-map, the old `-dark` twins. |
|
||||
| `DARK_SELECTOR`, `INVERSE_SELECTOR` | `@intecion/ipal-kit/tokens` | `:root[data-theme="dark"]`, `[data-surface="inverse"]`. |
|
||||
| `LIGHT_SELECTOR`, `DARK_SELECTOR`, `INVERSE_SELECTOR` | `@intecion/ipal-kit/tokens` | `:root, [data-theme="light"]`, `:root[data-theme="dark"], [data-theme="dark"]` (a theme on any element), `[data-surface="inverse"]`. |
|
||||
|
||||
**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)
|
||||
|
||||
@@ -8,6 +8,10 @@ description: Complete start-to-finish install of @intecion/ipal-kit in a Payload
|
||||
**Goal: the MANDATORY SET from AGENT.md §0b (18 items), with nothing left "to discover".** Stage 11
|
||||
checks everything; you do not finish with gaps (exception: an `ipal-audit-skip:` line from a client decision, AGENT.md §0b).
|
||||
|
||||
**Canonical code:** every stage's files exist, wired and tested, in the reference site —
|
||||
`node_modules/@intecion/ipal-kit/docs/agent/reference-site/INDEX.md` (AGENT.md "Reference site"). When a snippet here
|
||||
and the reference site differ, the reference site is the current one (and the difference is a plugin bug to report).
|
||||
|
||||
**Stage 0 first: ask the architecture questions and wait for the answers** (below). After that: **one stage = one
|
||||
commit** (`git commit -m "ipal-setup <N>: <stage>"`), no waiting for an OK between stages (AGENT.md §0a). Missing
|
||||
*content data* (keys, IDs, company data) does not block you: wire the code, the value goes into `.env`/the panel
|
||||
@@ -533,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) ·
|
||||
|
||||
@@ -45,7 +45,9 @@ decision on that part; no hand-built replacement, no silent workaround. **Code r
|
||||
decision (AGENT §0a) and on a plugin gap (ipal-plugin-gap — report, wait for the owner).
|
||||
|
||||
## Phase 1 — Foundation
|
||||
- New project → **ipal-setup** (all of it, with `ipal-skills`, `AGENTS.md`).
|
||||
- New project → **ipal-setup** (all of it, with `ipal-skills`, `AGENTS.md`). Every file you wire has its canonical
|
||||
version in the reference site: `node_modules/@intecion/ipal-kit/docs/agent/reference-site/INDEX.md` (AGENT.md
|
||||
"Reference site") — copy the pattern, change only the content.
|
||||
- Existing project on an older ipal-kit → **ipal-upgrade** before anything else.
|
||||
- Exit: `pnpm build` passes, `/admin` works, `ipal-audit --quick` = 0 errors —
|
||||
**including zero "missing: …"**, i.e. the full AGENT.md §0b set (SEO, GEO, R2, Turnstile,
|
||||
@@ -66,6 +68,8 @@ decision on that part; no hand-built replacement, no silent workaround. **Code r
|
||||
## Phase 3 — Navigation and company data → **ipal-nav**
|
||||
|
||||
## Phase 4 — Sections → **ipal-block** for every block
|
||||
The reference site's Blocks page (`/pl/bloki` on the reference site, seed `src/seed/showcase.ts` in the index) shows
|
||||
every library block in every variant, also on the inverted background — pick the closest block × variant there.
|
||||
Library blocks need no code: `libraryBlocks(blockOptions)` in the Pages layout and `createBlockRegistry(content,
|
||||
{ Image, Link, sendForm })` in `src/blocks/registry.ts` (docs/block-library.md "Setup"). Change looks through
|
||||
`classNames` / `ui`, never by copying a block; own it completely only with `ipal-blocks eject <block>`.
|
||||
@@ -116,6 +120,8 @@ title/description of every page (≤ 60 / ≤ 155 characters, unique); `aiSummar
|
||||
keep the auto-fill or fix it when the summary is weak.
|
||||
|
||||
## Phase 8 — Design
|
||||
The reference site's `/design` page (`src/components/design/TokenPanel.tsx` in the index) is the styleguide to reproduce:
|
||||
every token from `IPAL_TOKENS`, light and dark, the inverse scope.
|
||||
The design-token standard (AGENT.md §6.11, `design-tokens.md`): `DESIGN.md` exists → its values go into
|
||||
`src/design/tokens.ts` (template `.agents/skills/ipal-setup/resources/tokens.ts`) → `pnpm exec ipal-tokens` (no ✗
|
||||
contrast rows). None → copy the `DESIGN.md` template, keep the neutral defaults + the brand primary, and recommend
|
||||
|
||||
@@ -197,6 +197,9 @@ and the browser tab shows the same separator.
|
||||
consent: `pnpm exec ipal-skills --external`.
|
||||
|
||||
## 2. Inventory (no code changes)
|
||||
**What changed for projects** between your old and new plugin version is exactly the reference site's diff —
|
||||
`git diff v<old> v<new> -- reference/` in the ipal-kit repo (or the two `docs/agent/reference-site/INDEX.md` files):
|
||||
every file a project must touch, already done once and tested in the plugin's CI.
|
||||
For **every** item in the PROGRAMISTA §6 table show evidence (grep / file) of whether
|
||||
it applies to the project. Run the **ipal-audit** skill (`--quick`) and attach the result.
|
||||
Result: a prioritised to-do list — carry it out right away. Stop
|
||||
@@ -214,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.
|
||||
|
||||
@@ -1,4 +1,17 @@
|
||||
{
|
||||
"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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
"engines": {
|
||||
"node": ">=22 <23"
|
||||
},
|
||||
"packageManager": "[email protected]",
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"build": "cross-env NODE_OPTIONS=\"--max-old-space-size=3072\" next build --webpack",
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
buildRevalidateHook,
|
||||
buildSlugField,
|
||||
buildSummaryField,
|
||||
rowLabel,
|
||||
trackSlugHistoryHook,
|
||||
} from '@intecion/ipal-kit'
|
||||
import { revalidatePath } from 'next/cache'
|
||||
@@ -25,7 +26,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],
|
||||
|
||||
@@ -24,7 +24,7 @@ export async function Footer({ company, footer, locale }: Props) {
|
||||
{address ? <p className="text-fg-muted">{address}</p> : null}
|
||||
{company.phone ? <a className="text-link hover:text-link-hover" href={`tel:${company.phone.replace(/[^\d+]/g, '')}`}>{company.phone}</a> : null}
|
||||
{company.email ? <a className="text-link hover:text-link-hover" href={`mailto:${company.email}`}>{company.email}</a> : null}
|
||||
{company.taxId ? <p className="text-sm text-fg-muted">NIP {company.taxId}</p> : null}
|
||||
{company.taxId ? <p className="text-sm text-fg-muted">{[company.taxIdLabel, company.taxId].filter(Boolean).join(' ')}</p> : null}
|
||||
</div>
|
||||
{columns.map((column) => (
|
||||
<nav aria-label={column.heading ?? undefined} className="grid content-start gap-2" key={column.id}>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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. */
|
||||
@@ -11,6 +11,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',
|
||||
@@ -27,6 +28,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 },
|
||||
|
||||
@@ -4,10 +4,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,
|
||||
),
|
||||
)
|
||||
|
||||
@@ -2486,6 +2486,10 @@ export interface Company {
|
||||
name: string;
|
||||
legalName?: string | null;
|
||||
taxId?: string | null;
|
||||
/**
|
||||
* Shown before the tax ID in the footer.
|
||||
*/
|
||||
taxIdLabel?: string | null;
|
||||
address?: {
|
||||
street?: string | null;
|
||||
postalCode?: string | null;
|
||||
@@ -2986,6 +2990,7 @@ export interface CompanySelect<T extends boolean = true> {
|
||||
name?: T;
|
||||
legalName?: T;
|
||||
taxId?: T;
|
||||
taxIdLabel?: T;
|
||||
address?:
|
||||
| T
|
||||
| {
|
||||
|
||||
Reference in New Issue
Block a user