IAPL rename: docs, agent guide, skills, reference site and starter on the new names; changelog draft

- docs, AGENT.md, the 16 skills, PROGRAMISTA and README use the preferred names (scripted, same list of forms);
  past CHANGELOG entries and the proposals in docs/dev are not rewritten
- AGENT.md: 'Names: IAPL and ipal-kit' — old name, new name, state in 1.x; what is not renamed; storageNames
- iapl-upgrade '→ 1.17.0', PROGRAMISTA §6 item 72, CHANGELOG 1.17.0 (draft): nothing required
- env.md, doctor.md (legacy-names, storage-names), stats.md, security.md, project-starter.md, iapl-reference, iapl-setup
- skill scripts read ipal-audit-skip and IPAL_IP_HEADER too; audit rule ids stay what they were
- reference site: iapl(), iapl-doctor.json, iapl-* skills, storageNames: 'iapl'; INDEX.md regenerated

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-25 17:36:09 +01:00
co-authored by Claude Fable 5.2
parent 425fac14fb
commit b91984fbcd
149 changed files with 1930 additions and 1747 deletions
+211 -168
View File
@@ -1,7 +1,7 @@
# AGENT.md — rules for AI (Payload 3 + Next 16 + @intecion/ipal-kit)
# AGENT.md — rules for AI (Payload 3 + Next 16 + IAPL, package `@intecion/ipal-kit`)
> **Who this is for:** an AI agent (Antigravity, Claude Code, Cursor) working in a client
> project built on ipal-kit. **Read all of it before your first change.** The rules are
> project built on IAPL (called ipal-kit before 1.17.0; names: "Names: IAPL and ipal-kit" below). **Read all of it before your first change.** The rules are
> hard, with no workarounds. API details for each module: `docs/<module>.md` (map in
> §12). Installation, deployment, migration and Gitea are covered in the document for humans:
> [the developer guide (PROGRAMISTA.md)](../dev/PROGRAMISTA.md).
@@ -9,19 +9,62 @@
> **In the project:**
> - a short `AGENTS.md` in the root (template in §13) that points to this file in
> `node_modules/@intecion/ipal-kit/docs/agent/AGENT.md` — do not copy the rules, a copy goes stale;
> (`pnpm exec ipal-skills` adds/refreshes the `ipal-kit:start…end` block with this pointer);
> (`pnpm exec iapl-skills` adds/refreshes the `iapl:start…end` block with this pointer);
> - skills in `.agents/skills/` (§14) — copied from the package with one command, refreshed
> after every ipal-kit update;
> after every IAPL update;
> - **the full plugin map** — every option, env variable, route, layout component, import
> map entry, hook, collection, global and every export: the **`ipal-reference`** skill
> (`.agents/skills/ipal-reference/SKILL.md` + `resources/api.md`). Before you write
> map entry, hook, collection, global and every export: the **`iapl-reference`** skill
> (`.agents/skills/iapl-reference/SKILL.md` + `resources/api.md`). Before you write
> anything "from scratch", check there.
---
## Names: IAPL and ipal-kit
The plugin is called **IAPL** (Intecion Advanced Payload Library) since 1.17.0. Before that it was called
ipal-kit. The **package is still `@intecion/ipal-kit`**: install lines and import paths did not change.
**Rule for an existing project: do not rename anything on your own.** Every old name works through 1.x. A
project moves to the new names only when its owner asks: the `iapl-upgrade` skill, "→ 1.17.0". In new code
use the name in the middle column. `pnpm exec iapl-doctor` lists what is still old (`legacy-names`, info).
| Before 1.17.0 | Now | In 1.x |
|---|---|---|
| `ipalKit()`, `IpalOptions` | `iapl()`, `IaplOptions` | both work, same function and type |
| `ipalEnvRules`, `IpalEnvFeatures` | `iaplEnvRules`, `IaplEnvFeatures` | both work |
| `ipalT`, `ipalVar`, `IPAL_TOKENS`, `IPAL_BREAKPOINTS`, `IpalTokenName`, `IpalGlobalSlug` | `iaplT`, `iaplVar`, `IAPL_TOKENS`, `IAPL_BREAKPOINTS`, `IaplTokenName`, `IaplGlobalSlug` | both work |
| commands `ipal-kit`, `ipal-doctor`, `ipal-skills`, `ipal-tokens`, `ipal-blocks` | `iapl`, `iapl-doctor`, `iapl-skills`, `iapl-tokens`, `iapl-blocks` | both installed, same programs |
| env `IPAL_IP_HEADER`, `IPAL_NOINDEX`, `IPAL_COOKIE_SCAN_URL`, `IPAL_COOKIE_SCAN_TOKEN`, `IPAL_SEED_ALLOW_FULL`, `IPAL_SEED_ALLOW_PROD_UPDATE`, `IPAL_DOCTOR_TOKEN`, `IPAL_DOCTOR_IMPORT_MAP` (crawler service: `IPAL_CRAWLER_SITES`) | the same with `IAPL_` | `IAPL_…` is read first, `IPAL_…` when it is missing or empty; set one, not both |
| `ipal-doctor.json` | `iapl-doctor.json` | whichever exists is read and written; never keep both |
| `ipal-audit-skip:` lines in `AGENTS.md` | `iapl-audit-skip:` | both read |
| pointer block `<!-- ipal-kit:start -->` … `<!-- ipal-kit:end -->` | `<!-- iapl:start -->` … `<!-- iapl:end -->` | both recognised; `iapl-skills` rewrites the old one in place |
| skills `ipal-<name>` (16) | `iapl-<name>` | `iapl-skills` installs the new folders and removes the 16 old ones by name; a project's own `ipal-…` skill is left alone |
| log prefix `[ipal]` | `[iapl]` | changed (a log filter on `[ipal]` needs the new prefix) |
**Not renamed — write them exactly like this, in every project:**
| Name | Why |
|---|---|
| package `@intecion/ipal-kit` and every import path (`@intecion/ipal-kit/client`, `…/tokens.css`), import-map paths `@intecion/ipal-kit/admin#…`, `node_modules/@intecion/ipal-kit/docs/…` | the package name changes in 2.0 |
| routes `/api/ipal/…` | proxies, cached pages and the crawler call them |
| CSS tokens `--ipal-*`, hooks `data-ipal="…"` | projects' own CSS uses them |
| `config.custom.ipal`, `custom.ipalAccounts`, `req.context` flags (`ipalSeed`, `ipalSkipIndexNow`, `ipalSkipAutoFill`, …), `ipalTotpView` server props, translation namespace `ipal` | projects' hooks and overrides read them |
| header `X-Ipal-Cookie-Crawler` | WAF rules |
**Two stored names have a second spelling, chosen once per site** (`iapl({ storageNames })`, docs/stats.md,
docs/security.md):
| | Site made before 1.17.0 (default, `storageNames: 'ipal'`) | Site made since (`storageNames: 'iapl'`, set by `iapl create`) |
|---|---|---|
| visitor cookie of the built-in statistics | `ipal_vid` | `iapl_vid` — and the layout passes `visitorCookie={IAPL_VISITOR_COOKIE}` to `<PageStats>` / `<SiteProviders stats={{ … }}>` |
| 2FA attempt counter in `payload-kv` | `ipal:2fa-verify:<collection>:<id>` | `iapl:2fa-verify:<collection>:<id>` |
Never switch `storageNames` on a live site: visitors' histories and running 2FA counts start again, and the
cookie list must be approved again. `iapl-doctor` (`storage-names`) reports a layout and a config that disagree.
## Main rule — the plugin helps, never limits
ipal-kit is a plugin: it helps the project and never limits it. Every module can be
IAPL is a plugin: it helps the project and never limits it. Every module can be
turned off on its own; every default (access rules, fields, hooks, labels, routes,
collections, globals) can be overridden and **the project config wins**; safe
defaults have an option to loosen/extend them; the plugin exports building blocks
@@ -30,27 +73,27 @@ or data shape where an option or an exported building block is enough.
**In practice:** before you write something from scratch or start fighting the plugin — find
the option or the exported builder (module docs §12, types in `dist/**/*.d.ts`). It is missing →
**plugin gap**: report it to the owner and wait for their decision (see "ipal-kit first" below), never
**plugin gap**: report it to the owner and wait for their decision (see "IAPL first" below), never
patch `node_modules` or fork the package.
**Docs language:** all ipal-kit docs, this guide and the skills are written in English.
**Docs language:** all IAPL docs, this guide and the skills are written in English.
Write new rules, AGENTS.md entries and plugin-gap reports in English.
> **VERY IMPORTANT — seeding after launch.** Once a site is live, **never run a full seed again**: the owner's
> edits on the live site must survive. Every later change targets **named records only** — specific pages,
> globals, forms or fields — listed in the seed (`only: [...]` / `SEED_ONLY="pages:kontakt,global:header"`).
> Never re-seed everything, not even in create-only mode, without the owner's explicit OK. `createSeeder`
> refuses a run with no record list against a production or non-local database unless `IPAL_SEED_ALLOW_FULL=1`
> refuses a run with no record list against a production or non-local database unless `IAPL_SEED_ALLOW_FULL=1`
> (set it only after that OK).
**Database names** (MongoDB and Postgres): the site's domain **with the dots removed**, plus `_prod` or `_dev` —
`intecion.com` → `intecioncom_prod` / `intecioncom_dev`, `architektimprez.pl` → `architektimprezpl_prod` /
`architektimprezpl_dev`. The name is the path of `DATABASE_URI`: `mongodb://…@mongo:27017/intecioncom_prod?authSource=admin`,
`postgres://…@db:5432/intecioncom_prod`. You derive the names from the domain and confirm them with the owner (ipal-setup
stage 0). `ipalEnvRules({ databaseName: true })` warns when they do not match (deployment.md §4.2a).
`postgres://…@db:5432/intecioncom_prod`. You derive the names from the domain and confirm them with the owner (iapl-setup
stage 0). `iaplEnvRules({ databaseName: true })` warns when they do not match (deployment.md §4.2a).
**`PAYLOAD_SECRET`:** at least 32 random characters, different per environment (`ipal-kit create` writes 64). In
production `ipalEnvRules` refuses a shorter one (`secretMinLength`, default 32, `0` = off). Never change it on a live
**`PAYLOAD_SECRET`:** at least 32 random characters, different per environment (`iapl create` writes 64). In
production `iaplEnvRules` refuses a shorter one (`secretMinLength`, default 32, `0` = off). Never change it on a live
site without the owner's OK: every login session and every stored API key depends on it (deployment.md §1).
**Seeding on production** (details: `node_modules/@intecion/ipal-kit/docs/seeding.md`). Write seeds with
@@ -61,16 +104,16 @@ site without the owner's OK: every login session and every stored API key depend
- Never delete; never seed users, passwords or secrets; globals: fill only empty fields; no media uploads.
- Every locale written separately with `fallbackLocale: false`; `context: { disableRevalidate: true, ipalSkipIndexNow: true }`.
- On production: dry run first (`SEED_DRY_RUN=1`), back up the database (Coolify **Backup now**), then the real run.
- `SEED_UPDATE=1` on production / a non-local database only with `IPAL_SEED_ALLOW_PROD_UPDATE=1`, after a backup;
- `SEED_UPDATE=1` on production / a non-local database only with `IAPL_SEED_ALLOW_PROD_UPDATE=1`, after a backup;
records an editor changed are always skipped and reported (`skip (edited)`) — never use `SEED_FORCE=1` there.
- After launch: named records only (`only` / `SEED_ONLY`); a full run of a live database is refused without `IPAL_SEED_ALLOW_FULL=1`.
- Schema and one-off data fixes → Payload migrations; field renames with content → **ipal-migrate-fields**; content → seeds.
- After launch: named records only (`only` / `SEED_ONLY`); a full run of a live database is refused without `IAPL_SEED_ALLOW_FULL=1`.
- Schema and one-off data fixes → Payload migrations; field renames with content → **iapl-migrate-fields**; content → seeds.
## Ask before you build — architecture questions
Before you set up a site (or a new part of one), **ask the owner these questions and wait for the answers**.
They decide the architecture; a wrong guess means rework. Ask them as **one list**, once, at the start —
the ready-to-send list is in **ipal-setup** stage 0 (ipal-site phase 0 uses the same list).
the ready-to-send list is in **iapl-setup** stage 0 (iapl-site phase 0 uses the same list).
| Topic | What you need to know |
|---|---|
@@ -84,10 +127,10 @@ the ready-to-send list is in **ipal-setup** stage 0 (ipal-site phase 0 uses the
| Admin | 2FA, white-label (client brand in the panel), agency credit |
| Hosting | Coolify, the production domain(s), who adds the DNS records (deployment.md §6) |
- **A new site starts with `ipal-kit create`** (docs/project-starter.md): `pnpm --config.auto-install-peers=false dlx
- **A new site starts with `iapl create`** (docs/project-starter.md): `pnpm --config.auto-install-peers=false dlx
@intecion/ipal-kit@<version> create <domain>` asks exactly these questions (or reads them from `--answers file.json`),
generates the site from the reference site, writes the answers into `AGENTS.md` and makes the first commit. Ask the owner
first, then pass the answers — the command never fills a gap. The manual path (`ipal-setup` stages 1–11) is for an
first, then pass the answers — the command never fills a gap. The manual path (`iapl-setup` stages 1–11) is for an
existing project or what the command does not cover yet: **single-language sites, a default language other than `pl`**, sites
without `en`, URLs without a prefix, Postgres — the command stops with a message pointing here.
- Write every answer into the project's `AGENTS.md` → **"Project decisions"** (one line per topic).
@@ -95,28 +138,28 @@ the ready-to-send list is in **ipal-setup** stage 0 (ipal-site phase 0 uses the
(Only *content* gaps — company data, texts, IDs — may wait: use `[TO FILL: …]` in the panel, §0a.)
- An answer that conflicts with these rules → say so straight away and propose a compliant option.
## ipal-kit first — hard rule
## IAPL first — hard rule
- **Anything the plugin covers, you build with the plugin's feature.** Always. Look it up first: the
**ipal-reference** skill, the module docs (§12), the types in `dist/**/*.d.ts`.
**iapl-reference** skill, the module docs (§12), the types in `dist/**/*.d.ts`.
- The only exceptions: the plugin's feature **does not work**, or it **is not enough** for this project.
- Even then: **report the gap to the owner first** with the **ipal-plugin-gap** skill and **do nothing on
- Even then: **report the gap to the owner first** with the **iapl-plugin-gap** skill and **do nothing on
your own** for that part until the owner decides (wait for a plugin fix / an approved option / an approved,
marked workaround). Work on unrelated parts may go on.
- **No hand-built replacements and no silent workarounds.** A workaround exists only after the owner approved
it, is marked `// WORKAROUND ipal-kit <version>: docs/plugin-requests/<file>` and is recorded in
it, is marked `// WORKAROUND IAPL <version>: docs/plugin-requests/<file>` and is recorded in
"Project decisions".
## Reference site — copy the pattern, not from memory
Every convention in this file is implemented in the **reference site**: one complete client site on ipal-kit
Every convention in this file is implemented in the **reference site**: one complete client site on IAPL
("Example Studio", made up), kept current with each release and built, seeded and smoke-tested in the plugin's CI.
Before you write a file the plugin expects you to wire (payload.config, layout, catch-all page, `lib/content.ts`,
proxy, SEO/GEO routes, forms, seeds, `AGENTS.md`, `DESIGN.md`, deploy notes), open
`node_modules/@intecion/ipal-kit/docs/agent/reference-site/INDEX.md`, find the matching file and copy its pattern —
short wiring files are in the index in full, longer ones are linked at the tag of your plugin version. Change only the
project's content (names, texts, blocks the site map needs), never the pattern. The index and this file disagree →
report it with **ipal-plugin-gap**: it is a plugin bug.
report it with **iapl-plugin-gap**: it is a plugin bug.
## Code rules
@@ -126,7 +169,7 @@ Short version of §8 — every skill follows it.
- **No duplicated logic** — extract it once; reuse the plugin's exports instead of rewriting them.
- **Typed, no `any`** (no `@ts-ignore`; unknown shape → `unknown` + a type guard).
- **Texts in i18n, never literals** — every visible text comes from the panel / localized fields (§2).
- **Tests or checks for new behaviour** — a unit test, an `ipal-audit` / `ipal-seo-check` result, or a
- **Tests or checks for new behaviour** — a unit test, an `iapl-audit` / `iapl-seo-check` result, or a
documented manual check (§8a).
```tsx
@@ -141,14 +184,14 @@ export function Offer({ header, items }: OfferBlockProps) { return <Section head
## 0. COMPASS (if you remember only this)
0. **Ask first.** Architecture questions before you build ("Ask before you build" above) — never guess.
1. **ipal-kit is mandatory.** A feature the plugin has goes through the plugin.
1. **IAPL is mandatory.** A feature the plugin has goes through the plugin.
Missing or broken → report it (plugin gap, §1.3) and wait for the owner's decision — no silent patch.
2. **Nothing hardcoded.** Text, image, link, file, company data → admin panel. Domains,
keys → `.env`. Also in an `||` fallback and in `catch`.
3. **Next 16 = `proxy.ts`.** NEVER `middleware.ts`.
4. **No explicit `<head>`, with ISR and `generateStaticParams`** — otherwise metadata
lands in `<body>` and SEO breaks.
5. **Minimum collections.** ipalKit adds Users, company data/navigation are globals,
5. **Minimum collections.** iapl adds Users, company data/navigation are globals,
FAQ/hero are blocks.
6. **A section = a composition of UI primitives.** `buildLinksField()` + `<CMSLink>`, upload +
`<Media>`, `<Section>` + `<SectionHeader>`. No `ctaLabel`/`pdfUrl` fields.
@@ -163,18 +206,18 @@ export function Offer({ header, items }: OfferBlockProps) { return <Section head
9. **One source of truth** — `i18n.config.ts`, `lib/content.ts`, never copies.
10. **"Done" only after** a local `pnpm build` + the checks from §11.
11. **Every site has the MANDATORY SET from §0b** — SEO, GEO (llms.txt, Markdown,
MCP), R2, Turnstile, forms from the builder. `ipal-audit` checks that it is
wired, `ipal-seo-check` — that it works. There is no "I'll do it later".
MCP), R2, Turnstile, forms from the builder. `iapl-audit` checks that it is
wired, `iapl-seo-check` — that it works. There is no "I'll do it later".
**How to add…** (details in the skill from §14)
| What | How |
|---|---|
| a page | in the panel: Pages + blocks, no code (§5.1) |
| a section (block) | a library block first: `blockOptions` → `libraryBlocks` in `src/blocks/configs.ts`, `createBlockRegistry(content, { Image, Link, sendForm })` in `blocks/registry.ts` (docs/block-library.md). None fits → `src/blocks/<Name>/config.ts` + `Component.tsx`, `extra` in the registry, `pageBlocks` → `pnpm generate:types` (+ `pnpm payload generate:importmap` with `rowLabel`) — **ipal-block** |
| a standard page (home, about, services, contact, legal, 404…) | `pageTemplates` from `@intecion/ipal-kit/templates` in the content seed (after launch only with `SEED_ONLY`) — **ipal-site** phase 6 |
| a form | the Forms panel (builder) from the seed `scripts/seed-form-*.ts`, a block with `<RenderForm>`, sending via `sendForm` — **ipal-form** |
| a language | `i18n.config.ts` (the only place) + a Postgres migration + content in the new language — **ipal-locale-add** |
| a collection with URLs | `content: { collections: [...] }` in `ipalKit` and `createContentHelpers` (§5.4) — **ipal-collection** |
| a section (block) | a library block first: `blockOptions` → `libraryBlocks` in `src/blocks/configs.ts`, `createBlockRegistry(content, { Image, Link, sendForm })` in `blocks/registry.ts` (docs/block-library.md). None fits → `src/blocks/<Name>/config.ts` + `Component.tsx`, `extra` in the registry, `pageBlocks` → `pnpm generate:types` (+ `pnpm payload generate:importmap` with `rowLabel`) — **iapl-block** |
| a standard page (home, about, services, contact, legal, 404…) | `pageTemplates` from `@intecion/ipal-kit/templates` in the content seed (after launch only with `SEED_ONLY`) — **iapl-site** phase 6 |
| a form | the Forms panel (builder) from the seed `scripts/seed-form-*.ts`, a block with `<RenderForm>`, sending via `sendForm` — **iapl-form** |
| a language | `i18n.config.ts` (the only place) + a Postgres migration + content in the new language — **iapl-locale-add** |
| a collection with URLs | `content: { collections: [...] }` in `iapl` and `createContentHelpers` (§5.4) — **iapl-collection** |
---
@@ -183,9 +226,9 @@ export function Offer({ header, items }: OfferBlockProps) { return <Section head
These are not options. Every project has **all** the items below, wired through the
plugin. Data is missing (domain, keys, bucket)? Wire the code anyway — it works once
the values are entered in `.env` / the panel, and you list what is missing in the report. You skip an item
**only** on a client decision recorded in `AGENTS.md` (the `ipal-audit-skip:` line, below).
**only** on a client decision recorded in `AGENTS.md` (the `iapl-audit-skip:` line, below).
The "Check" column: **A** = `ipal-audit` (code), **S** = `ipal-seo-check` (running
The "Check" column: **A** = `iapl-audit` (code), **S** = `iapl-seo-check` (running
site), **P** = a test in the panel. Full code: PROGRAMISTA.md §2.
| # | Area | What must exist (file) | Plugin API | Check |
@@ -198,18 +241,18 @@ site), **P** = a test in the panel. Full code: PROGRAMISTA.md §2.
| 5 | **GEO** — llms | `src/app/llms.txt/route.ts` (`llmsRoute`) and `src/app/llms-full.txt/route.ts` (`llmsFullRoute`) from `lib/content`; the `buildSummaryField()` field in Pages, `summaryField: 'aiSummary'` in `createContentHelpers` | `llmsRoute`, `llmsFullRoute`, `buildSummaryField` | A, S |
| 6 | **GEO** — Markdown | `src/app/md/[locale]/[[...slug]]/route.ts` (single-language: `src/app/md/[[...slug]]/route.ts`) = `export { markdownRoute as GET } from '@/lib/content'`; `createContentHelpers({ markdownAlternate: true })` (link in `<head>`); `createProxy(…, { NextResponse, markdown: true })` (without it `/md/…` gets redirected to a language) | `markdownRoute`, `markdownAlternate`, `createProxy({ markdown })` | A, S |
| 7 | **GEO** — MCP | `src/app/api/mcp/route.ts` = `export { mcpGET as GET, mcpPOST as POST } from '@/lib/content'` (public — AI browses the site: `get_site_info`, `list_pages`, `search_content`, `get_page`); name: `createContentHelpers({ mcp: { serverName } })` | `mcpGET`, `mcpPOST` | A, S |
| 8 | **GEO** — AI bots + IndexNow | robots **lets in** AI bots (default `aiBots: 'allow'`; block only on a client decision); AI bot policy and per-bot exceptions — Site settings → Search engines → AI assistants (works only with `getRobots`); `ipalKit({ indexNow: true })` + `src/app/indexnow-key.txt/route.ts` (`indexNowKeyRoute`; publishing → Bing/ChatGPT Search within minutes; IndexNow sends nothing with `IPAL_NOINDEX=1`) | `buildRobots`, `getRobots`, `indexNowKeyRoute` | A, S |
| 8 | **GEO** — AI bots + IndexNow | robots **lets in** AI bots (default `aiBots: 'allow'`; block only on a client decision); AI bot policy and per-bot exceptions — Site settings → Search engines → AI assistants (works only with `getRobots`); `iapl({ indexNow: true })` + `src/app/indexnow-key.txt/route.ts` (`indexNowKeyRoute`; publishing → Bing/ChatGPT Search within minutes; IndexNow sends nothing with `IAPL_NOINDEX=1`) | `buildRobots`, `getRobots`, `indexNowKeyRoute` | A, S |
| 9 | **Media / R2 / speed** | `Media` with `focalPoint`, `normalizeFilenameHook`, `buildOptimizeUploadHook`, `buildMediaPlaceholderHook` + field; **always** `buildR2Storage(['media'], { s3Storage })` + `@payloadcms/storage-s3`; `R2_*` in `.env.example`; `<MediaPreconnect/>`; `images: buildImagesConfig()` and `buildUploadSecurityHeaders()` in `next.config.ts`; the project's `<Media>` via `mediaImageProps`/`videoProps` (§6.11b) | `buildR2Storage`, `mediaImageProps`, `videoProps`, `buildImagesConfig` | A, S |
| 10 | **Forms** | every form from a **seed** (`scripts/seed-form-*.ts`: fields, confirmation, mail to the company **and** confirmation to the customer, every language); a block with `<RenderForm>` + `formClasses.ts` (look, once); `actions.ts` = `createSubmitAction({ getCachedPayload, headers })`; `forms: {…}` in `ipalKit`; `email: mailAdapter()` | `RenderForm` (`/rsc`), `createSubmitAction`, `mailAdapter` | A, P |
| 10 | **Forms** | every form from a **seed** (`scripts/seed-form-*.ts`: fields, confirmation, mail to the company **and** confirmation to the customer, every language); a block with `<RenderForm>` + `formClasses.ts` (look, once); `actions.ts` = `createSubmitAction({ getCachedPayload, headers })`; `forms: {…}` in `iapl`; `email: mailAdapter()` | `RenderForm` (`/rsc`), `createSubmitAction`, `mailAdapter` | A, P |
| 11 | **Turnstile** | `<SiteProviders>` in `[locale]/layout.tsx` (wires `TurnstileProvider` with the key from the panel); `RenderForm` renders the widget; keys in Site integrations | `SiteProviders`, `getTurnstileConfig`, `TurnstileProvider` | A, P |
| 12 | Consent + analytics | Consent Mode: `'advanced'` (default — the Google tag loads at once with every signal `denied`) or `'basic'` (`<SiteProviders analytics={{ consentMode: 'basic' }}>` — no request to Google before consent; a client who wants zero requests), the choice goes to "Project decisions"; `ipalKit({ consentLog: true })` (without it the `/api/ipal/consent` endpoint does not exist) + `<SiteProviders logEndpoint="/api/ipal/consent" banner={<CookieBanner equalChoice settings="detailed" />}>` (ConsentProvider, banner, CookieButton, Analytics in the right order); settings window mode (`settings`: `inline` / `modal` / `detailed`) per the design, brief is silent → `detailed`, the decision goes to "Project decisions"; tool IDs in the panel; the cookie list from a scan (`cookieScanner: true` → *Cookie review* → **Scan cookies** → *Approve cookies* → **Approve and add**; or cookie-scan → import) — feeds `<CookieTable>` on the policy page **and** the lists in the `detailed` window; Cookies → Settings window → Cookie list headings in every language | consent.md, analytics.md | A, `ipal-consent-check` |
| 13 | Security | `buildSecurityHeaders` in `next.config.ts`; `withPayload(withSecurityConfig(nextConfig))` (no `X-Powered-By`); CSP: `buildSecurityHeaders({ csp: { mode: 'report-only', reportUri: '/api/csp-report', … } })` + `buildAdminCspHeaders` on `/admin/:path*` + `src/app/api/csp-report/route.ts` (`createCspReportRoute`) → read the reports → `mode: 'enforce'`; `twoFactor: { issuer, plugin: payloadTotp }` + `generate:importmap` (`TotpRedirectProvider`, `SafeTotpView`; check: a new admin lands on `/admin/setup-totp?back=%2Fadmin` with the QR, no reloading; a login with the password only gets `403` from `/api/globals/site-integrations` and `/api/form-submissions` — security.md "What the second factor covers"); own endpoints: `secondFactorPassed(req)` / `userMeetsRole(req, role)`; **an account without 2FA can only set it up** (`twoFactor.requireSetup`, default: nothing else answers, 72 h from creation or an admin's reset, then blocked until an admin chooses "Reopen setup" on the account) — so set 2FA up right after creating an account; `ipal-doctor --url` must report 0 accounts without 2FA; Postgres/SQLite: migration for `totpSetupFrom`; `IPAL_IP_HEADER` in production | security.md, forms.md | A |
| 14 | Operations | `src/app/api/health/route.ts` (`healthRoute`); `src/instrumentation.ts` with `assertEnv(ipalEnvRules({ storage: true, ipHeader: true }))`; staging with `IPAL_NOINDEX=1`; smoke tests (§8a) | `healthRoute`, `assertEnv`, `ipalEnvRules` | A |
| 12 | Consent + analytics | Consent Mode: `'advanced'` (default — the Google tag loads at once with every signal `denied`) or `'basic'` (`<SiteProviders analytics={{ consentMode: 'basic' }}>` — no request to Google before consent; a client who wants zero requests), the choice goes to "Project decisions"; `iapl({ consentLog: true })` (without it the `/api/ipal/consent` endpoint does not exist) + `<SiteProviders logEndpoint="/api/ipal/consent" banner={<CookieBanner equalChoice settings="detailed" />}>` (ConsentProvider, banner, CookieButton, Analytics in the right order); settings window mode (`settings`: `inline` / `modal` / `detailed`) per the design, brief is silent → `detailed`, the decision goes to "Project decisions"; tool IDs in the panel; the cookie list from a scan (`cookieScanner: true` → *Cookie review* → **Scan cookies** → *Approve cookies* → **Approve and add**; or cookie-scan → import) — feeds `<CookieTable>` on the policy page **and** the lists in the `detailed` window; Cookies → Settings window → Cookie list headings in every language | consent.md, analytics.md | A, `iapl-consent-check` |
| 13 | Security | `buildSecurityHeaders` in `next.config.ts`; `withPayload(withSecurityConfig(nextConfig))` (no `X-Powered-By`); CSP: `buildSecurityHeaders({ csp: { mode: 'report-only', reportUri: '/api/csp-report', … } })` + `buildAdminCspHeaders` on `/admin/:path*` + `src/app/api/csp-report/route.ts` (`createCspReportRoute`) → read the reports → `mode: 'enforce'`; `twoFactor: { issuer, plugin: payloadTotp }` + `generate:importmap` (`TotpRedirectProvider`, `SafeTotpView`; check: a new admin lands on `/admin/setup-totp?back=%2Fadmin` with the QR, no reloading; a login with the password only gets `403` from `/api/globals/site-integrations` and `/api/form-submissions` — security.md "What the second factor covers"); own endpoints: `secondFactorPassed(req)` / `userMeetsRole(req, role)`; **an account without 2FA can only set it up** (`twoFactor.requireSetup`, default: nothing else answers, 72 h from creation or an admin's reset, then blocked until an admin chooses "Reopen setup" on the account) — so set 2FA up right after creating an account; `iapl-doctor --url` must report 0 accounts without 2FA; Postgres/SQLite: migration for `totpSetupFrom`; `IAPL_IP_HEADER` in production | security.md, forms.md | A |
| 14 | Operations | `src/app/api/health/route.ts` (`healthRoute`); `src/instrumentation.ts` with `assertEnv(iaplEnvRules({ storage: true, ipHeader: true }))`; staging with `IAPL_NOINDEX=1`; smoke tests (§8a) | `healthRoute`, `assertEnv`, `iaplEnvRules` | A |
| 15 | System pages | Site settings → System pages: homepage, 404, privacy policy, cookies; legal links in the footer by role (`getSystemLinks(locale)`) | `getSystemLinks`, `getSystemPagePath`, `getNotFoundPage` | P |
| 16 | **Nothing hardcoded** | every text, link, image, file, company data from the panel; domains and keys from `.env` (§2) | — | A, P |
| 17 | **Content** | one h1, the answer at the start of each section, facts, internal links, FAQ from real questions, `aiSummary`, sameAs, consistent company data (§0c) | — | S, P |
| 18 | **Scaling** | `fluid.css` / `fluid-wide.css`, hero on `--ipal-hero-min-h`, the screen list in §6.11a (including 1366×768) | — | A, browser |
| 19 | **Design tokens** | `DESIGN.md` + `src/design/tokens.ts` → `pnpm exec ipal-tokens` → `src/design/tokens.css`; `styles.css` imports `fluid-wide.css`, `tokens.css`, `tailwind.css`, the brand file (§6.11); fonts in `--font-family-body` / `--font-family-heading` | `defineTokens`, `ipal-tokens` | A (`ipal-tokens --check`), browser (both themes) |
| 19 | **Design tokens** | `DESIGN.md` + `src/design/tokens.ts` → `pnpm exec iapl-tokens` → `src/design/tokens.css`; `styles.css` imports `fluid-wide.css`, `tokens.css`, `tailwind.css`, the brand file (§6.11); fonts in `--font-family-body` / `--font-family-heading` | `defineTokens`, `iapl-tokens` | A (`iapl-tokens --check`), browser (both themes) |
**Turnstile works by itself:** both keys in the panel (or env) → the widget shows, and
`submitForm` **requires** a token; no keys → no widget, the form works.
@@ -219,7 +262,7 @@ Do not make the provider or the widget conditional in code — always wire them.
(dev). Always wire the code, so production does not save media to the container disk
(they disappear on redeploy).
### Forbidden substitutes (ERROR in `ipal-audit`)
### Forbidden substitutes (ERROR in `iapl-audit`)
| Instead of the plugin | Why not | Use |
|---|---|---|
@@ -239,7 +282,7 @@ Do not make the provider or the widget conditional in code — always wire them.
In the project's `AGENTS.md`, under "Project decisions", one line with the item keys and the reason:
```markdown
ipal-audit-skip: mcp, llms-full — the client does not want to share content with AI agents (email 2026-03-02)
iapl-audit-skip: mcp, llms-full — the client does not want to share content with AI agents (email 2026-03-02)
```
Keys: `llms`, `llms-full`, `markdown`, `mcp`, `jsonld`, `r2`, `turnstile`,
`analytics`, `twofactor`, `aibots`, `forms-seed`, `csp` (`audit.sh` understands only these). Without this line a missing item is an error.
@@ -250,7 +293,7 @@ Keys: `llms`, `llms-full`, `markdown`, `mcp`, `jsonld`, `r2`, `turnstile`,
The technology from §0b makes the site *able* to be highly visible. Whether Google
ranks it and an AI assistant quotes it depends on the content. When you enter content from the brief into
the panel (seed, phase 6 in ipal-site), apply the rules below — without inventing facts.
the panel (seed, phase 6 in iapl-site), apply the rules below — without inventing facts.
### Structure of every page
- **One `h1`** (the hero/page heading), then section `h2`s, `h3`s inside — no skipped
@@ -289,7 +332,7 @@ one is better. Google ignores the same description on many pages.
| "Thank you" after a form, a confirmation page | **yes** |
| internal search results, filter/parameter pages | **yes** (+ `disallowParams` in robots) |
| a test page, a draft page, a landing page only for a paid campaign | **yes** |
| staging, preview, a test copy of the whole site | **`IPAL_NOINDEX=1` in that environment's env** — not the checkbox |
| staging, preview, a test copy of the whole site | **`IAPL_NOINDEX=1` in that environment's env** — not the checkbox |
| homepage, archives (blog, projects) | **never** — the panel blocks saving |
| services, offer, contact, about us, posts | **never** |
| privacy policy, cookies, terms | **no** by default (they are a credibility signal, they do no harm); `noindex` only at the client's request |
@@ -299,7 +342,7 @@ noindex does **not** replace a redirect or a deletion: old address → change th
`trackSlugHistoryHook`), a page to remove → delete it. Keep draft content as a **draft**
(unpublished content is not publicly available), not as a published page with noindex.
Checks: `ipal-seo-check` (one h1, heading order, alt, OG image, thin pages,
Checks: `iapl-seo-check` (one h1, heading order, alt, OG image, thin pages,
internal links, noindex in the sitemap).
---
@@ -309,12 +352,12 @@ internal links, noindex in the sitemap).
You build the site from brief to handover. The human provides **business decisions and
content**, they do not lead you by the hand. You think, anticipate problems, solve them
yourself and check your own work yourself. For a full build use the
**ipal-site** skill — it guides you through all the stages.
**iapl-site** skill — it guides you through all the stages.
### You decide yourself (and record the decision in `AGENTS.md` → "Project decisions")
- technical choices within these rules: splitting into blocks, variants, names,
subcomponents, order of work, refactoring your own code,
- fixing everything found by the build, `ipal-audit`, `ipal-seo-check`, `ipal-consent-check`,
- fixing everything found by the build, `iapl-audit`, `iapl-seo-check`, `iapl-consent-check`,
- plugin defaults (media limits, ISR, robots) — unless the brief says otherwise.
### You ask only about this (collect the questions in **one list**, not one at a time)
@@ -336,36 +379,36 @@ placeholder `[TO FILL: …]` in the panel and list it in the final report.
|---|---|
| Does it work in **every language**? (slug, content, 404, switcher) | `/en/...` → 404, because the EN slug is empty |
| Does the page stay **static**? | `headers()`, `searchParams`, `cookies()` in the page tree (§4) |
| Does the schema change **lose data**? | renaming a field without a migration → **ipal-migrate-fields** |
| Does the schema change **lose data**? | renaming a field without a migration → **iapl-migrate-fields** |
| Will the build pass in a container **without a database**? | a route reading the database without `force-dynamic` |
| Is a new script / pixel / iframe **behind consent**? | YouTube, a map, a chat loaded before consent (GDPR) |
| Can the editor change it **without code**? | text, link or image in JSX (§2) |
| **Performance**? | an image outside `<Media>`, a video without `preload`, queries outside the cached helpers |
| **Security**? | a secret in the client, missing `server-only`, Local API without `overrideAccess: false` |
| Does the plugin **already have it**? | your own version of an ipal-kit feature (§1.1) |
| Does the plugin **already have it**? | your own version of an IAPL feature (§1.1) |
### Check it yourself before you say "done"
A full `ipal-audit`, `ipal-seo-check` and `ipal-consent-check` on the built
A full `iapl-audit`, `iapl-seo-check` and `iapl-consent-check` on the built
app (`pnpm build && pnpm start`), the editor test (§11). Attach the results
to the report — without them the task is not finished.
### When something does not work
Diagnose (**ipal-debug**: symptom → cause → fix), fix it at the source,
Diagnose (**iapl-debug**: symptom → cause → fix), fix it at the source,
check again. Do not report problems you can solve.
### Report only when
- **ipal-kit has a bug or is missing a feature** → **plugin gap** (report to the owner and
- **IAPL has a bug or is missing a feature** → **plugin gap** (report to the owner and
wait for their decision on that part — no workaround on your own; unrelated work goes on),
- you see an **ipal-kit improvement** useful in many projects → **plugin gap**
- you see an **IAPL improvement** useful in many projects → **plugin gap**
(type: improvement),
- **the task is finished** → the final report (format in **ipal-site**).
- **the task is finished** → the final report (format in **iapl-site**).
Do not report progress step by step or things you fixed yourself — they
go as one list into the final report.
---
## 1. ipal-kit IS MANDATORY
## 1. IAPL IS MANDATORY
### 1.1 Before you write anything
Check whether the plugin has it: the module docs (§12) and the types
@@ -386,9 +429,9 @@ Rule: **identical in every project → plugin. Depends on the client → project
### 1.3 When the plugin is missing something or something does not work
**Do not patch silently** (a hook with a hardcoded value, your own helper, `as any`). It
almost always means the plugin already has it (check the docs) or the plugin is missing it.
The **ipal-plugin-gap** skill: report to the owner and **wait for their decision** on that part
("ipal-kit first" at the top). A workaround only after approval, marked
(`// WORKAROUND ipal-kit <version>: …`) and recorded in "Project decisions". The report contains:
The **iapl-plugin-gap** skill: report to the owner and **wait for their decision** on that part
("IAPL first" at the top). A workaround only after approval, marked
(`// WORKAROUND IAPL <version>: …`) and recorded in "Project decisions". The report contains:
- a description of the problem / missing feature,
- the proposed API (function / option signature),
- why it is universal (useful in other projects).
@@ -427,7 +470,7 @@ CDN preconnect: `<MediaPreconnect />` (from env). Media: `normalizeFilenameHook`
```
src/
app/
(frontend)/ # any route group name works ((site) …); ipal-doctor finds it by structure
(frontend)/ # any route group name works ((site) …); iapl-doctor finds it by structure
styles.css # Tailwind + @source on node_modules/@intecion/ipal-kit/dist
[locale]/ # single-language: no [locale] (see i18n.md)
layout.tsx # no <head>; <SiteProviders shell={await getSiteShell(locale)}> + Header/Footer
@@ -445,7 +488,7 @@ src/
api/mcp/route.ts # export { mcpGET as GET, mcpPOST as POST } — public MCP (GEO)
api/health/route.ts # export { healthRoute as GET }
indexnow-key.txt/route.ts # export { indexNowKeyRoute as GET }
instrumentation.ts # assertEnv(ipalEnvRules({...})) from '@intecion/ipal-kit/env'
instrumentation.ts # assertEnv(iaplEnvRules({...})) from '@intecion/ipal-kit/env'
components/
forms/formClasses.ts # the ONLY place for the look of forms (RenderForm classNames)
ui/ # primitives: CMSLink, Button, Media, Section, SectionHeader
@@ -505,7 +548,7 @@ No abbreviations (`HeroSection`, not `HeroSec`). Do not create `lib/pages.ts`,
7. **`export const dynamic = 'force-dynamic'`** on routes that read the database:
`manifest.ts`, `sitemap.xml/route.ts`, `llms.txt`, `api/health`. The plugin's
handlers have try/catch, but `dynamic` must be in the route file.
8. **`instrumentation.ts`** with `assertEnv(ipalEnvRules({...}))` imported from **`@intecion/ipal-kit/env`** (the root pulls in Payload → Edge/Turbopack crash), inside `if (process.env.NEXT_RUNTIME === 'nodejs')` (env.md).
8. **`instrumentation.ts`** with `assertEnv(iaplEnvRules({...}))` imported from **`@intecion/ipal-kit/env`** (the root pulls in Payload → Edge/Turbopack crash), inside `if (process.env.NEXT_RUNTIME === 'nodejs')` (env.md).
9. **RSC by default.** `'use client'` only for state/interaction, in a separate file;
the section stays a server component and passes data to it. Secrets: `import 'server-only'`.
10. **Blocks do not import `lib/*`** (cycle). Server-side data → `enhanceProps`.
@@ -516,7 +559,7 @@ No abbreviations (`HeroSection`, not `HeroSec`). Do not create `lib/pages.ts`,
patched 15.x line. Pin `next` and `eslint-config-next` to the same 16.4.x (≥ 16.4.5):
`pnpm add next@16.4.6 eslint-config-next@16.4.6`, and make sure `sharp` resolves to 0.35.5 or later
(`pnpm why sharp`). The plugin's peer range stays open (`next >=15`) — the minimum is yours to keep.
**Check:** `pnpm ls next sharp` → next ≥ 16.4.5, sharp ≥ 0.35.5; `pnpm exec ipal-doctor` → no `next-min`
**Check:** `pnpm ls next sharp` → next ≥ 16.4.5, sharp ≥ 0.35.5; `pnpm exec iapl-doctor` → no `next-min`
finding; `pnpm dev` prints no security-upgrade warning.
12. **No open production advisories.** Node.js 20 or later for the plugin itself (its `nodemailer` 10 requires it);
**Payload 3.94 needs Node.js 22.23.5 or later** on the 22 line (`engines`: `">=22.23.5 <23"`, `.nvmrc` `22`), locally,
@@ -553,7 +596,7 @@ No abbreviations (`HeroSection`, not `HeroSec`). Do not create `lib/pages.ts`,
project dependency on `nodemailer` or `@types/nodemailer`.
**Check:** `pnpm audit --prod` → no high or critical; `pnpm why dompurify happy-dom mongoose undici` → only the
fixed versions (dompurify 3.4.17 or later, happy-dom 21.0.4 or later, mongoose 8.24.7 or later, undici 7.30.1 or
later); `pnpm exec ipal-doctor` → no `transitive-min` finding; after a Payload or mongoose change run
later); `pnpm exec iapl-doctor` → no `transitive-min` finding; after a Payload or mongoose change run
`pnpm build`, open the panel and save a document.
---
@@ -576,7 +619,7 @@ By default: `pages`, `media` + the plugin's globals (`site-settings`,
`site-integrations`, Notifications, Cookie banner) + the project's globals
(navigation, footer, company). Nothing more until the client explicitly requires it.
**`users`** is added by `ipalKit` (an auth collection with `roles` and 2FA) — do not create it, unless
**`users`** is added by `iapl` (an auth collection with `roles` and 2FA) — do not create it, unless
you need extra fields (then your own `Users.ts` with the slug from `access.authCollection`;
the plugin adds roles and 2FA to it).
@@ -612,7 +655,7 @@ their own URLs → do not add them to `content`.
### 5.4 Wiring collections with URLs
```ts
// ipalKit({ content: contentConfig }) and createContentHelpers({ content: contentConfig })
// iapl({ content: contentConfig }) and createContentHelpers({ content: contentConfig })
export const contentConfig = {
collections: [{ slug: 'posts', perPage: 10 }],
} satisfies ContentOption
@@ -637,7 +680,7 @@ never by slug. pages.md.
`pricing`, `entryList` — with variants, `{ en, pl }` panels, accessibility and token-only styling, plus ten page
templates ([block-library.md](../block-library.md)). Turn them on with `libraryBlocks(blockOptions)`, render them with
`createBlockRegistry`, change them with their options (`fields`, `variants`, `classNames`, `ui`, `components`), own one
with `ipal-blocks eject`. The rules below are how those blocks are built and how you build your own when none fits.
with `iapl-blocks eject`. The rules below are how those blocks are built and how you build your own when none fits.
Three problems that must never repeat: **a zoo of CTA fields** (`ctaLabel`,
`cta2Text`, `buttonUrl`…), **files as text** (`pdfUrl: '/files/x.pdf'`),
@@ -658,7 +701,7 @@ Three problems that must never repeat: **a zoo of CTA fields** (`ctaLabel`,
7. **Empty field = the element does not render** (no "Lorem", no empty `<div>`).
8. **Server by default;** interaction in a separate, small `'use client'` file with simple props.
9. **Types from `@/payload-types`**, named export, imports from `@/…`, no barrels.
10. **Every new block:** an empty-block test in the panel (§6.5a) + `ipal-audit --quick`.
10. **Every new block:** an empty-block test in the panel (§6.5a) + `iapl-audit --quick`.
### 6.1 Three layers
```
@@ -701,7 +744,7 @@ Field labels as `{ en, pl }` objects (the panel runs in English and Polish; §6.
With the block library they come from the plugin: `Section`, `SectionHeader`, `Media`, `CMSLink`, `buttonClass`,
`Container`, `Card` from `@intecion/ipal-kit/blocks/rsc` (no project copies; `src/components/ui/` holds only a
project version you pass in with `createBlockRegistry(content, { ui: { Media } })`). A project without the library:
code 1:1 from [section-code.md](./skills/ipal-block/resources/section-code.md). Each one has one job:
code 1:1 from [section-code.md](./skills/iapl-block/resources/section-code.md). Each one has one job:
| Primitive | Does | Instead of |
|---|---|---|
@@ -719,7 +762,7 @@ Turnstile and consent are in `<SiteProviders>` in the layout, not in props.
### 6.4 Layer 3 — section = composition
The model shape of a section (the whole component; the `config.ts` schema and an example with
repeated items — `FeatureGrid` + `FeatureCard` — in [section-code.md](./skills/ipal-block/resources/section-code.md)):
repeated items — `FeatureGrid` + `FeatureCard` — in [section-code.md](./skills/iapl-block/resources/section-code.md)):
```tsx
// src/blocks/Hero/Component.tsx — the whole component
@@ -793,18 +836,18 @@ empty fields, without guessing, without numbered slots. You design the schema fo
- Texts are `{ en: '…', pl: '…' }` (one key per admin language of the project):
`label`, `admin.description`, option `label`, tab `label`, `labels.singular/plural`,
`admin.group`. Type: `AdminText` from `@intecion/ipal-kit`; shorthand `adminText('Title', 'Tytuł')` from
`@intecion/ipal-kit/blocks`. In a schema file `ipal-audit` accepts both; the same words in a component are an error.
`@intecion/ipal-kit/blocks`. In a schema file `iapl-audit` accepts both; the same words in a component are an error.
- `admin.description` only when the label is not enough — one sentence ≤ 120 characters:
what it does / where it shows, with a format example (`'Section id for #links, e.g. "pricing".'`),
never how the code works (no component, function, env-var or package names).
- Select options with a readable `label` ("Inverted (dark)"), not the raw value.
- The admin panel runs in English and Polish by default (ipal-kit sets
- The admin panel runs in English and Polish by default (IAPL sets
`i18n.supportedLanguages` when the project has not); set your own list to change it.
The plugin's own texts are overridable: field/global labels via `globalOverrides` /
`collectionOverrides`, component texts via `i18n.translations.<lang>.ipal.<key>`
(keys: `adminTexts` from `@intecion/ipal-kit`). Building blocks for your own admin
components: `ipalT`, `formatNumber`, `formatDateTime`, `defineTexts`, `ADMIN_LANGUAGES`,
`applyAdminI18n` (already applied by `ipalKit`), `adminDocumentTitle` + `<DocumentTitle>` (`/admin`;
components: `iaplT`, `formatNumber`, `formatDateTime`, `defineTexts`, `ADMIN_LANGUAGES`,
`applyAdminI18n` (already applied by `iapl`), `adminDocumentTitle` + `<DocumentTitle>` (`/admin`;
a custom view's tab title in the admin language — Payload's `meta.title` is one fixed string),
types `AdminText`, `AdminLanguage`, `AdminTextKey` — details in i18n.md "Admin panel languages and texts".
**Check:** Polish panel → the view's browser tab reads in Polish.
@@ -846,7 +889,7 @@ buildSectionSettingsField(), // sideb
**Empty-block test** (after every new block, in the panel): add the block to a page →
at the start ≤ 6 items are visible, everything is in English, buttons and items are added
with "+ Add …", collapsed rows have readable names, nothing requires knowledge of the code.
Automatic checks: `ipal-audit` (the "panel:" section). After adding `rowLabel` in
Automatic checks: `iapl-audit` (the "panel:" section). After adding `rowLabel` in
the project: `pnpm payload generate:importmap`.
### 6.6 Anti-patterns → fix
@@ -885,8 +928,8 @@ className={v === 'a' ? 'x' : v === 'b' ? 'y' : 'z'}
### 6.8 Header and Footer (navigation globals)
Code (globals, `Header`, `Footer`, `MobileNav`; `resolveNav` from the plugin): [nav-code.md](./skills/ipal-nav/resources/nav-code.md).
Skill: **ipal-nav**.
Code (globals, `Header`, `Footer`, `MobileNav`; `resolveNav` from the plugin): [nav-code.md](./skills/iapl-nav/resources/nav-code.md).
Skill: **iapl-nav**.
- Navigation, footer, company data = **project globals** (`header`, `footer`, `company`),
built with `buildLinkField` — the company data model depends on the country (NIP/ABN/EIN).
@@ -904,9 +947,9 @@ Skill: **ipal-nav**.
- A global changed on every page → `afterChange: [buildGlobalRevalidateHook({ revalidatePath })]`
(it calls `revalidatePath('/', 'layout')`). `buildRevalidateHook` is for collections. The plugin's globals
(Site settings, Site integrations, Cookie banner, Notifications) refresh ISR themselves once you pass
`ipalKit({ revalidatePath })` (from `next/cache`); without it the change shows after the `revalidate` window.
`iapl({ revalidatePath })` (from `next/cache`); without it the change shows after the `revalidate` window.
- The plugin's globals: read public (Site integrations: admin only), write editor+. Change their access, admin
or hooks with `ipalKit({ globalOverrides: { notifications: { access: { update: authenticated } } } })` —
or hooks with `iapl({ globalOverrides: { notifications: { access: { update: authenticated } } } })` —
an object merges key by key (your keys win), a function `(global) => global` takes over. Never copy a plugin global.
- Only `[locale]/layout.tsx` fetches globals and passes them as props.
@@ -934,7 +977,7 @@ Skill: **ipal-nav**.
8. **An enlarged image is never a hand-made modal** (no `useState(index)` + `div role="dialog"`,
`glightbox`, `photoswipe`, a link to the raw file in a new tab) — `<LightboxTrigger>` around the
thumbnail (a client component you render from a server block with plain `lightboxImage(…)` data),
one `<SiteProviders lightbox>`, labels from Form messages → Image viewer (lightbox.md). `ipal-audit`
one `<SiteProviders lightbox>`, labels from Form messages → Image viewer (lightbox.md). `iapl-audit`
warns about lightbox libraries and hand-made image dialogs.
### 6.10 Icons
@@ -942,14 +985,14 @@ Skill: **ipal-nav**.
Two sources, nothing in between: **graphics from the client** (also the logo, brand icons) →
upload + `<Media>`; **a fixed set of UI icons** → a `select` field with names +
a `lucide-react` map in `src/components/icons/` (names in a separate file, so the block
config does not import React). Code: [section-code.md](./skills/ipal-block/resources/section-code.md). **Never** SVG pasted into a section's JSX.
config does not import React). Code: [section-code.md](./skills/iapl-block/resources/section-code.md). **Never** SVG pasted into a section's JSX.
### 6.11 Styles — the design-token standard ([design-tokens.md](../design-tokens.md))
Every site uses the same `--ipal-*` token names and Tailwind utilities; only the values differ per brand.
- **The brand lives in two files:** `DESIGN.md` (human, template `ipal-setup/resources/DESIGN.md`) and
`src/design/tokens.ts` (`defineTokens` from `@intecion/ipal-kit/tokens`, template `ipal-setup/resources/tokens.ts`).
`pnpm exec ipal-tokens` writes `src/design/tokens.css` (commit it) and fails on a WCAG AA contrast error.
- **The brand lives in two files:** `DESIGN.md` (human, template `iapl-setup/resources/DESIGN.md`) and
`src/design/tokens.ts` (`defineTokens` from `@intecion/ipal-kit/tokens`, template `iapl-setup/resources/tokens.ts`).
`pnpm exec iapl-tokens` writes `src/design/tokens.css` (commit it) and fails on a WCAG AA contrast error.
Never edit the generated file; never put brand values in `styles.css` or in a component.
- **`styles.css` is the same on every site:** `@import "tailwindcss"`, `@intecion/ipal-kit/fluid-wide.css` (or
`fluid.css`), `@intecion/ipal-kit/tokens.css`, `@intecion/ipal-kit/tailwind.css`, `../../design/tokens.css` (last), `@source` of the plugin's dist.
@@ -964,18 +1007,18 @@ Every site uses the same `--ipal-*` token names and Tailwind utilities; only the
- Fonts via `next/font` with `variable: '--font-family-body'` / `'--font-family-heading'` on `<html>` (not
`--font-body`: a `var()` cycle with the `font-body` utility). Max 2 families.
- Values a CSS variable can't reach (`next/og`, e-mail, `theme-color`): `resolveColors(tokens)` from `@/design/tokens`.
In inline styles / charts: `IPAL_TOKENS.primary` or `ipalVar('primary')`; breakpoints in JS: `IPAL_BREAKPOINTS`.
- A missing role every site would need → **ipal-plugin-gap**; a project-only decorative colour → `styles.css` below the
In inline styles / charts: `IAPL_TOKENS.primary` or `iaplVar('primary')`; breakpoints in JS: `IAPL_BREAKPOINTS`.
- A missing role every site would need → **iapl-plugin-gap**; a project-only decorative colour → `styles.css` below the
imports + `DESIGN.md` → Deviations.
- JSON-LD only via `<JsonLdGraph>` from `/rsc` — never your own `<script dangerouslySetInnerHTML>`.
- No CSS Modules and no `style={{…}}` — exception: a dynamic value from data.
- Variants → `Record<Variant, string>`, not ternary chains.
Example `styles.css`: [section-code.md](./skills/ipal-block/resources/section-code.md).
Example `styles.css`: [section-code.md](./skills/iapl-block/resources/section-code.md).
### 6.11a Scaling (fluid / responsive) — from 360 px to 1920 px
- **Scale from the plugin:** `fluid-wide.css` (grows up to 1920 px — the default for new sites) or `fluid.css`
(stops at 1280 px). No `clamp()` in components or `styles.css`; different numbers from `DESIGN.md` → min/max
pairs in `src/design/tokens.ts` (`fs: { h1: ['2.25rem', '4rem'] }`, `space: { section: [3, 8] }`) → `ipal-tokens`.
pairs in `src/design/tokens.ts` (`fs: { h1: ['2.25rem', '4rem'] }`, `space: { section: [3, 8] }`) → `iapl-tokens`.
- **Screen height:** instead of `h-screen` / `100vh` → `min-h-[var(--ipal-hero-min-h)]` (svh, with
a limit). Hero heading `--ipal-fs-display-fit`, hero spacing `--ipal-space-section-fit` — on
1366×768 the hero CTA must be visible without scrolling.
@@ -1006,8 +1049,8 @@ Example `styles.css`: [section-code.md](./skills/ipal-block/resources/section-co
| client components | small, interaction only (§6.9) | a whole section `'use client'` |
Target on the built site (mobile, Lighthouse/PageSpeed): LCP < 2.5 s, CLS < 0.1, INP < 200 ms.
Checks: `ipal-audit` (img/video outside Media, many `priority`, `h-screen`, fixed widths,
YouTube `<iframe>`) and `ipal-seo-check` (images without dimensions, LCP image without priority).
Checks: `iapl-audit` (img/video outside Media, many `priority`, `h-screen`, fixed widths,
YouTube `<iframe>`) and `iapl-seo-check` (images without dimensions, LCP image without priority).
### 6.12 Exports and imports
@@ -1057,8 +1100,8 @@ project → **plugin gap**, not a copy.
| Slug / noindex / description for AI | `buildSlugField`, `buildNoindexField`, `buildSummaryField` | slug.md, seo.md |
| System pages and their protection | `getSystemPagePath`, `buildPreventDeleteSystemPage`, `buildValidateUniqueRole` | pages.md, hooks.md |
| ISR after save, old slug → 308, images across languages | `buildRevalidateHook`, `trackSlugHistoryHook`, `buildCrossLocaleFieldSync` | hooks.md |
| ISR after a global is saved | plugin globals: `ipalKit({ revalidatePath })`; your own globals: `buildGlobalRevalidateHook({ revalidatePath })` | hooks.md |
| Change a plugin global (access, hooks, fields) | `ipalKit({ globalOverrides })` | access.md |
| ISR after a global is saved | plugin globals: `iapl({ revalidatePath })`; your own globals: `buildGlobalRevalidateHook({ revalidatePath })` | hooks.md |
| Change a plugin global (access, hooks, fields) | `iapl({ globalOverrides })` | access.md |
| Roles and access | `adminOnly`, `adminOrEditor`, `adminOrSelf`, `adminOrSelfIn(slug)` (several auth collections), `authenticated`, `requireRole`, `hasMinimumRole` (+ `…Field`); staff checks: `userMeetsRole(req, role)`, `isAdmin(req.user, req.payload)` (roles count only for accounts of a staff collection; in a client component `isAdmin(user, config)` with `useConfig()`, imported from **`@intecion/ipal-kit/client`** (the main entry does not build there with webpack), in middleware `isAdmin(user, { staffCollections: ['users'] })` — without the last argument there it is always `false`), `staffCollectionSlugs(payload)`, `access.staffCollections`; second factor in your own code: `secondFactorPassed(req)`, `requireSecondFactor(access)`; injected `users`: `access.authAccess`, first user = admin (`access.firstUserAdmin`) | access.md, security.md |
| Data from globals | `getGlobal`, `getSiteSettings`, `getSiteIntegrations` | payload-helpers.md |
@@ -1082,7 +1125,7 @@ project → **plugin gap**, not a copy.
| Sending | `createSubmitAction({ getCachedPayload, headers })` (`/server`) | forms.md |
| A file on a form (CV, specification) | `forms: { attachments: true }` + a **File** field in the panel; the file is e-mailed to the company and **never stored** (no Media, no bucket, no download). Options `FormAttachmentsOption` (`maxSizeMB`, `maxTotalMB`, `maxFiles`, `fileTypes`: `FormFileType` / `FormFileDetect`, `allowRisky`, `scan`: `FormFileScanInput` → `FormFileScanResult`, `strictPdf`, `notice`, `maxConcurrent`, `path`, `submit`: `FormSubmitEndpointOptions`); block `buildFileBlock` / `fileBlock`; types `FORM_FILE_TYPES`, refused `RISKY_FILE_EXTENSIONS`; own markup `getFileProps` / `getFiles` / `removeFile`, `fileFieldRules`, `fileFieldError`, `formatFileSize`, `BuilderFileLimits`, `BuilderFile`; own transfer `submitForm({ files })` + `splitFormFiles`; transport ceiling `mailAttachmentLimit` | forms.md "Files", email.md "Attachments" |
| Message texts and step button texts | Form messages → `getFormTexts(locale)` | notifications.md |
| A form in the database | seed `ipal-form/resources/seed-form.template.ts` | forms.md, seeding.md |
| A form in the database | seed `iapl-form/resources/seed-form.template.ts` | forms.md, seeding.md |
| Antispam / limit / IP | honeypot in `BuilderForm` (`getHoneypotProps` on `useBuilderForm`), Turnstile from `SiteProviders` (`createSubmitAction({ turnstileHostnames })` pins the domain), `clientIp`, `setRateLimitStore`, `setUnknownIpFactor` | forms.md, turnstile.md |
| GTM event after sending | `buildFormAnalyticsFields` (panel) — `RenderForm` sends it itself | forms.md |
| A form outside the builder (e.g. filters) | `useForm` + `buildValidator`, `required`, `email`… | forms.md |
@@ -1096,7 +1139,7 @@ project → **plugin gap**, not a copy.
| JSON-LD | `getSiteShell().jsonLd`, `getPageJsonLd`, `build*JsonLd`, `formatOpeningHours`, `sameAsUrls`, `<JsonLdGraph>` | seo.md |
| Product / category JSON-LD (an entry that is not an article) | `pageJsonLd.entries` + `buildProductJsonLd` | seo.md |
| llms.txt / llms-full / Markdown / MCP | `llmsRoute`, `llmsFullRoute`, `markdownRoute`, `mcpGET`/`mcpPOST`; `markdownAlternate: true`; `createProxy({ markdown: true })` | seo.md, content.md, mcp.md |
| IndexNow | `ipalKit({ indexNow: true })` + `indexNowKeyRoute` | seo.md |
| IndexNow | `iapl({ indexNow: true })` + `indexNowKeyRoute` | seo.md |
| Search | `createSearchRoute({ …, isPathVisible })` | content.md |
**Media, look, speed**
@@ -1104,12 +1147,12 @@ project → **plugin gap**, not a copy.
|---|---|---|
| R2, file names, optimization, preview | `buildR2Storage`, `normalizeFilenameHook`, `buildOptimizeUploadHook`, `buildMediaPlaceholderHook` | storage.md |
| Image / video in `<Media>` | `mediaImageProps`, `videoProps`, `MEDIA_SIZES` | storage.md |
| Enlarge an image (card, gallery, product, rich text) | `<SiteProviders lightbox>` + `<LightboxTrigger group image={lightboxImage(media, { size })}>` (`/client`), `RenderRichText lightbox`, `useLightbox`; labels: `ipalKit({ lightbox: true })` → Form messages → Image viewer | lightbox.md |
| Enlarge an image (card, gallery, product, rich text) | `<SiteProviders lightbox>` + `<LightboxTrigger group image={lightboxImage(media, { size })}>` (`/client`), `RenderRichText lightbox`, `useLightbox`; labels: `iapl({ lightbox: true })` → Form messages → Image viewer | lightbox.md |
| YouTube without cookies before a click | `<YouTubeEmbed>` (`/client`) | storage.md |
| `next.config` | `buildImagesConfig`, `buildSecurityHeaders` (`csp`), `buildCsp`, `buildCspHeaders`, `buildAdminCsp` / `buildAdminCspHeaders`, `buildUploadSecurityHeaders`, `withSecurityConfig` (hides `X-Powered-By`) | storage.md, security.md |
| CSP reports, nonces | `createCspReportRoute` (`parseCspReports`, type `CspViolation`), `createProxy({ csp })` + `<SiteProviders nonce>` (dynamic pages only), `createCspNonce`, `CSP_NONCE_HEADER`, `buildReportingEndpoints`, `cspHeaderKey`, `DEFAULT_CSP_REPORT_GROUP`; types `BuildAdminCspArgs`, `CspDirective`, `CspSources`, `CreateCspReportRouteArgs`, `WithSecurityConfigOptions` | security.md |
| Fluid typography and spacing | `fluid.css` / `fluid-wide.css` (`--ipal-*` variables); your own sizes: `fluidClamp`, `FLUID_SCALE`, `FLUID_RANGES` | design-tokens.md |
| Brand colours, fonts, radii, motion, dark mode | `tokens.css` + `tailwind.css`, `src/design/tokens.ts` (`defineTokens`, types `TokensInput`, `ColorInput`, `ColorRole`), `pnpm exec ipal-tokens` (`--check`, `--report`, `--warn-only`); building blocks `tokensToCss`, `defaultTokensCss`, `contrastReport` (`ContrastRow`), `contrastRatio`, `parseColor`, `resolveColors`, `IPAL_TOKENS`, `ipalVar`, `IpalTokenName`, `IPAL_BREAKPOINTS`, `COLOR_DEFAULTS`, `STATIC_DEFAULTS`, `FLUID_TOKENS`, `INVERSE_SCOPE`, `LEGACY_DARK_ROLES`, `LIGHT_SELECTOR`, `DARK_SELECTOR`, `INVERSE_SELECTOR`, `RemValue`, `FluidRange` | design-tokens.md |
| Brand colours, fonts, radii, motion, dark mode | `tokens.css` + `tailwind.css`, `src/design/tokens.ts` (`defineTokens`, types `TokensInput`, `ColorInput`, `ColorRole`), `pnpm exec iapl-tokens` (`--check`, `--report`, `--warn-only`); building blocks `tokensToCss`, `defaultTokensCss`, `contrastReport` (`ContrastRow`), `contrastRatio`, `parseColor`, `resolveColors`, `IAPL_TOKENS`, `iaplVar`, `IaplTokenName`, `IAPL_BREAKPOINTS`, `COLOR_DEFAULTS`, `STATIC_DEFAULTS`, `FLUID_TOKENS`, `INVERSE_SCOPE`, `LEGACY_DARK_ROLES`, `LIGHT_SELECTOR`, `DARK_SELECTOR`, `INVERSE_SELECTOR`, `RemValue`, `FluidRange` | design-tokens.md |
| Accessibility widget CSS | `@intecion/ipal-kit/a11y.css` (works through the tokens) | accessibility.md |
**Consent, analytics, operations**
@@ -1119,22 +1162,22 @@ project → **plugin gap**, not a copy.
| Settings window: in the bar / small / large with cookie details | `<CookieBanner settings="inline" \| "modal" \| "detailed">` — do not build your own window or cookie list | consent.md → "Large window with details" |
| A consent-dependent script | `ConsentScript` | consent.md |
| Cookie table on the policy page | `<CookieTable>` (`/rsc`), `getCookieTable` | consent.md |
| Cookie list filled from the panel (scan, then one approval adds every cookie to the list, the policy table and the detailed window) | `ipalKit({ cookieScanner: true })` + `pnpm generate:importmap` + migration; the editor approves on `/admin/cookie-approval`; project cookies: `cookieScanner.declarations` / `integrations`; per-entry review: `approval: false` — do not type the list by hand or build your own scanner or approval page | cookie-scanner.md |
| Pre-consent check in a browser (button in the panel, violations, dashboard + e-mail warning) | `cookieScanner: { crawl: true }` + env `IPAL_COOKIE_SCAN_URL` / `IPAL_COOKIE_SCAN_TOKEN` (`ipalEnvRules({ cookieCrawl: true })`) + the site's `host=token` in the shared service's `IPAL_CRAWLER_SITES`; never Playwright/Chromium in the site | cookie-scanner.md → Browser crawl |
| Cookie list filled from the panel (scan, then one approval adds every cookie to the list, the policy table and the detailed window) | `iapl({ cookieScanner: true })` + `pnpm generate:importmap` + migration; the editor approves on `/admin/cookie-approval`; project cookies: `cookieScanner.declarations` / `integrations`; per-entry review: `approval: false` — do not type the list by hand or build your own scanner or approval page | cookie-scanner.md |
| Pre-consent check in a browser (button in the panel, violations, dashboard + e-mail warning) | `cookieScanner: { crawl: true }` + env `IAPL_COOKIE_SCAN_URL` / `IAPL_COOKIE_SCAN_TOKEN` (`iaplEnvRules({ cookieCrawl: true })`) + the site's `host=token` in the shared service's `IAPL_CRAWLER_SITES`; never Playwright/Chromium in the site | cookie-scanner.md → Browser crawl |
| GA4, GTM, Pixel, Clarity, LinkedIn, TikTok | IDs in the panel — `SiteProviders` loads `Analytics` (`analytics={{ defer: true }}`; `consentMode: 'basic'` = no Google request before consent) | analytics.md |
| Mail | `email: mailAdapter()`, `sendEmail` | email.md |
| Env validation, health | `assertEnv(ipalEnvRules({…}))` (`/env`), `healthRoute` | env.md |
| Env validation, health | `assertEnv(iaplEnvRules({…}))` (`/env`), `healthRoute` | env.md |
| 2FA, white-label, headers | `twoFactor: { issuer, plugin: payloadTotp }`, `whiteLabel`, `buildSecurityHeaders` | security.md, white-label.md |
| Panel link preview + noindex (site name, description, preview image, technology support credit) | on by default (`adminMeta`, `agency`) — do not hand-write `admin.meta` for it; override single keys in `admin.meta` or `adminMeta: { … }` | white-label.md |
| Rate limit (forms, MCP, search) | built in; IP from `IPAL_IP_HEADER`; several instances → `setRateLimitStore` | forms.md |
| Rate limit (forms, MCP, search) | built in; IP from `IAPL_IP_HEADER`; several instances → `setRateLimitStore` | forms.md |
**Compliance (PL/EU) — the mechanism from the plugin, the content from the client:** policy pages
as System pages, `CookieBanner` + `CookieButton`, a `consent` checkbox in
forms (enforced server-side), the controller's data in a global, the cookie
table from the panel (`<CookieTable>` and the `settings="detailed"` window, scan: ipal-consent-check). You do not write legal texts. An accessibility widget — only when the client
table from the panel (`<CookieTable>` and the `settings="detailed"` window, scan: iapl-consent-check). You do not write legal texts. An accessibility widget — only when the client
requires it (accessibility.md).
**Security:** 2FA enforced (`ipalKit({ twoFactor: { issuer, plugin:
**Security:** 2FA enforced (`iapl({ twoFactor: { issuer, plugin:
payloadTotp } })`, never `twoFactor: false` without a client decision). No `X-Powered-By`:
`withPayload(withSecurityConfig(nextConfig))`. CSP in three steps (security.md → "ROLL OUT CSP"):
(1) `buildSecurityHeaders({ csp: { mode: 'report-only', reportUri: '/api/csp-report', <flags for what the
@@ -1150,13 +1193,13 @@ add missing hosts with flags / `extra`; (3) change `mode` to `'enforce'` in both
| Feature (default) | Turn off | Override / building blocks |
|---|---|---|
| Plugin globals: write editor+ (Site integrations: admin) | — | `ipalKit({ globalOverrides: { <slug>: { access, admin, hooks } } })`; a function `(global) => global` takes over (`applyGlobalOverrides`) |
| Global saves revalidate the layout (with `ipalKit({ revalidatePath })`) | omit `revalidatePath`; once: `context: { disableRevalidate: true }` | `buildGlobalRevalidateHook` on your own globals |
| Plugin globals: write editor+ (Site integrations: admin) | — | `iapl({ globalOverrides: { <slug>: { access, admin, hooks } } })`; a function `(global) => global` takes over (`applyGlobalOverrides`) |
| Global saves revalidate the layout (with `iapl({ revalidatePath })`) | omit `revalidatePath`; once: `context: { disableRevalidate: true }` | `buildGlobalRevalidateHook` on your own globals |
| Form files (`forms.attachments`): off; when on — 10 MB, PDF/DOC/DOCX ticked, programs/macros/archives refused, no antivirus, Graph sends files of 3 MB and more through a draft it deletes | omit `attachments`; `forms.fields.file: false`; `mailAdapter({ graph: { largeAttachments: false } })` | `maxSizeMB` / `maxTotalMB` / `maxFiles` / `fileTypes` / `allowRisky` / `scan` / `strictPdf` / `notice` / `submit`; `buildFileBlock`; `formSubmissionOverrides.fields` for the file fields of a submission |
| Staff features without `access` (no roles field): every account of the panel's login collection passes (`userMeetsRole`); accounts of other auth collections never do | add `access` (roles decide) | `access.staffCollections` (more staff collections), `globalOverrides`, `forms.formSubmissionOverrides`, `consentLog.collectionOverrides`, `stats.collectionOverrides` |
| Cookie check (`crawl`): start editor+ or the token, results token-only for the running job, latest result only, dashboard warning on, e-mail off until recipients are set | omit `crawl`; `crawl.dashboard: false` | `crawl.serviceUrl` / `token` / `siteUrl` / `maxPages` / `acceptSelector` / `consentMode` / `trackerHosts` / `globalOverride`; *Cookie check → Warning e-mails to*; building blocks `ingestCrawlResult`, `findCrawlViolations`, `parseCrawlResult` |
| Cookie admin: one *Cookies* entry — review list and site check as tabs, their own entries out of the navigation (pages and API kept) | `cookieScanner.adminLayout: 'separate'` | `addCookieScannerTabs`, `CookieReviewTab`, `CookieSiteCheckTab`; `collectionOverrides` / `crawl.globalOverride` win |
| Theme choice in localStorage under `theme` (next-themes' key); old `ipal-theme` moved before paint; declared to the cookie scanner as necessary local storage | — | `ipalKit({ theme: { storageKey } })`; `<ThemeSwitcher storageKey>` / `useTheme({ storageKey })` |
| Theme choice in localStorage under `theme` (next-themes' key); old `ipal-theme` moved before paint; declared to the cookie scanner as necessary local storage | — | `iapl({ theme: { storageKey } })`; `<ThemeSwitcher storageKey>` / `useTheme({ storageKey })` |
| Cookie list entries have a **Type** (cookie / local / session storage), filled by the scanner; `<CookieTable>` shows it when needed | `<CookieTable storageColumn={false}>` | `storageColumn`, `storageTypes`, Cookies → Settings window → Cookie list headings → Type |
| Text written in one language fills the empty languages (cookie list, cookie review), never over a language's own text | `fillEmptyLocales: false` | `fillEmptyLocales: { 'cookie-settings': [...], 'cookie-review': [...] }`; `buildFillEmptyLocalesGlobalHook` / `…CollectionHook` for your own globals and collections |
| Cookie approval: one summary + **Approve and add** (editor+), unknown cookies approved as `marketing` + "Needs description", dashboard reminder while cookies wait; nothing reaches the cookie banner before approval | `cookieScanner.approval: false` (per-entry review) | `approval.unknownCategory`, `approval.dashboard: false`; building blocks `approveCookies`, `loadCookieApproval`, `countPendingCookies`, `flagGoneEntries`, `sameCookie` |
@@ -1168,15 +1211,15 @@ add missing hosts with flags / `extra`; (3) change `mode` to `'enforce'` in both
| 2FA setup required: an account without TOTP reaches only the setup screen; 72 h window from creation / admin reset, then blocked; status and "Reopen setup" on the account page, notice on the dashboard, `POST /api/ipal/two-factor/reset` | `twoFactor.requireSetup: false`; parts: `requireSetup: { dashboardNotice: false, statusField: false, setupNotice: false }` | `requireSetup: { windowHours, exempt }` (`exempt` returns exactly `true`, never `async`), `twoFactor.resetAccess` (default: an admin who entered its own code; the reset ends the account's sessions), texts `twoFactor*`; `twoFactorSetupState(req)`, `buildSetupFields`, `backfillSetupFrom`, `buildTwoFactorResetEndpoint`. **Postgres/SQLite: migration for `totp_setup_from` applied when the new container starts (`prodMigrations` or `pnpm payload migrate && pnpm start`; never a pre-deployment command — deployment.md §4.3), or every login answers 500** |
| The second factor on every collection and global, whichever plugin added it, and on the plugin's endpoints; an unrecognised 2FA package = startup error | per entity: `custom.ipal.secondFactor: false` or `{ read: false }` (or the package's `custom.totp.disableAccessWrapper`); everywhere: `twoFactor.guard: false` (not recommended) | `requireSecondFactor` / `secondFactorPassed` in your own access functions and endpoints |
| At most 5 verify attempts per account in 10 minutes (`POST /api/verify-totp` → `429`); the count is kept in memory and in the database (`payload.kv`), so a restart or a second instance does not reset it | `twoFactor.verifyLimit: false` | `verifyLimit: { max, windowMinutes, store: 'memory' }` |
| 2FA verify and setup attempts only from the site's own origin: a request a browser marks as coming from elsewhere (`Origin`, `Sec-Fetch-Site`) gets `403` and is not counted. **Set `serverURL`**: behind a proxy that rewrites `Host` and sends no `X-Forwarded-Host` the site's own page is refused without it (logged once per origin: `[ipal] 2FA: a code from origin … was refused`) | `twoFactor.sameOrigin: false` | `sameOrigin: { origins: ['https://app.example.com'] }`; `requestFromOwnOrigin`, `reportRefusedOrigin` |
| 2FA verify and setup attempts only from the site's own origin: a request a browser marks as coming from elsewhere (`Origin`, `Sec-Fetch-Site`) gets `403` and is not counted. **Set `serverURL`**: behind a proxy that rewrites `Host` and sends no `X-Forwarded-Host` the site's own page is refused without it (logged once per origin: `[iapl] 2FA: a code from origin … was refused`) | `twoFactor.sameOrigin: false` | `sameOrigin: { origins: ['https://app.example.com'] }`; `requestFromOwnOrigin`, `reportRefusedOrigin` |
| Stored secrets are write-only: `smtpPassword` and `turnstileSecretKey` come back as `'********'` over REST, GraphQL and in the panel; an empty save keeps the value, `'[[clear]]'` removes it; server code reads the real value with the Local API. **The panel is the source — never add an env variable for them** (`TURNSTILE_SECRET_KEY` is deprecated) | `secrets: { writeOnly: false }` | `writeOnlySecret(field)` / `writeOnlySecrets(fields, names)` for your own secret fields; with versions on the entity add `hooks.afterRead: [maskSecretsOnRestore]` |
| The SMTP password stays with its server: a save in the panel or over the API that changes the server, port or user name without the password is refused (`400` "Enter the password again…"), whatever the transport says — otherwise an admin session points the server at its own machine and a test e-mail hands the password over. A change of the transport alone asks for nothing. Seeds and scripts (Local API, access control off) are not asked | `secrets: { reenterOnChange: false }` | `writeOnlySecret(field, { boundTo: [...] })`, `buildKeepSecret`, `SMTP_PASSWORD_BOUND_TO` |
| The admin panel opens for `editor` and above; an account with only `user` sees "Unauthorized" (the API is not touched). First start logs how many accounts are below the role | `accounts: { panelRole: 'user' }` (or `false`) | `panelRole: 'admin'`; your own `access.admin`; `panelAccess(role)` |
| Nobody creates an account for themselves, or takes one over. A staff collection (also the project's own, also one a later plugin adds) without a `create` / `update` / `delete` / `unlock` / `read` / `readVersions` rule gets one (on a collection a later plugin adds the plugin's rule is put in front of its own and both must allow; `custom: { ipal: { accountRules: false } }` on it keeps its own): with the plugin's roles, or wherever an account of it can hold `editor` or `admin` (`user, editor, admin, boss`; `viewer, editor`; a `roles` field that is text, json or a relationship holding a list — the value in the account's `roles` array makes a plugin admin or editor; a single-valued `roles` field is not affected: its value never counts) — create, delete, unlock: an admin; update: an admin or the account itself; the `roles` field: only an admin. With roles of its own that hold neither `editor` nor `admin`, or none: an account of that same collection, or a plugin admin, and an account never changes its own roles — **the plugin cannot rank a project's own roles: write that collection's rules** (`ipal-doctor` → `staff-own-roles`). `read`: a staff account. Payload's first-user route answers only for the panel's login collection (the first account, which becomes admin), in any spelling of the URL. `access.firstUserAdmin: false` with a default role below the panel role: the default panel role is not applied (logged), an explicit one is refused at start. With a slug in `access.staffCollections` that is not an auth collection Payload does not start (`/api/health` 503) | `accounts: { adminOnlyCreate: false, adminOnlyWrite: false, staffOnlyRead: false, firstUserRoute: 'all' }` | your own rule wins; `firstUserRoute: ['users', 'partners']`; a collection with open sign-up keeps its routes; `staffCreateAccess`, `staffUpdateAccess(slug)`, `staffReadAccess`, `sameStaffCollectionAccess(slug)`, `rolesByAdminOnly`, `rolesNotOwn(slug)`, `hasPluginRoles`, `applyStaffAccountAccess`, `adoptLateAuthCollections`, `buildFirstUserEndpoint` |
| Nobody creates an account for themselves, or takes one over. A staff collection (also the project's own, also one a later plugin adds) without a `create` / `update` / `delete` / `unlock` / `read` / `readVersions` rule gets one (on a collection a later plugin adds the plugin's rule is put in front of its own and both must allow; `custom: { ipal: { accountRules: false } }` on it keeps its own): with the plugin's roles, or wherever an account of it can hold `editor` or `admin` (`user, editor, admin, boss`; `viewer, editor`; a `roles` field that is text, json or a relationship holding a list — the value in the account's `roles` array makes a plugin admin or editor; a single-valued `roles` field is not affected: its value never counts) — create, delete, unlock: an admin; update: an admin or the account itself; the `roles` field: only an admin. With roles of its own that hold neither `editor` nor `admin`, or none: an account of that same collection, or a plugin admin, and an account never changes its own roles — **the plugin cannot rank a project's own roles: write that collection's rules** (`iapl-doctor` → `staff-own-roles`). `read`: a staff account. Payload's first-user route answers only for the panel's login collection (the first account, which becomes admin), in any spelling of the URL. `access.firstUserAdmin: false` with a default role below the panel role: the default panel role is not applied (logged), an explicit one is refused at start. With a slug in `access.staffCollections` that is not an auth collection Payload does not start (`/api/health` 503) | `accounts: { adminOnlyCreate: false, adminOnlyWrite: false, staffOnlyRead: false, firstUserRoute: 'all' }` | your own rule wins; `firstUserRoute: ['users', 'partners']`; a collection with open sign-up keeps its routes; `staffCreateAccess`, `staffUpdateAccess(slug)`, `staffReadAccess`, `sameStaffCollectionAccess(slug)`, `rolesByAdminOnly`, `rolesNotOwn(slug)`, `hasPluginRoles`, `applyStaffAccountAccess`, `adoptLateAuthCollections`, `buildFirstUserEndpoint` |
| A password set on a staff account has at least 12 characters and is not the e-mail address; existing passwords are not checked | `accounts: { password: false }` | `password: { minLength }`; `checkPassword`, `buildPasswordRuleHook` |
| While Turnstile cannot check (wrong secret, Cloudflare down): a text form is accepted, a form with files is refused | `forms: { turnstileOnConfigError: 'allow' }` | `'reject'`, `{ text, files }`; `turnstileOnConfigError` at a call site wins |
| Dashboard alerts by role: integration details for admins, a neutral line for editors, nothing for others; cookie alerts for editors and above. `'all'` checks nothing — no role, no second factor | `dashboardAlerts: { integrations: 'all', cookies: 'all' }` | `integrations: 'editor'`; the components' `details` / `audience` props |
| The `back` link of the 2FA setup and verify screens is checked on the server (`SafeTotpView` in front of the package's views): only a path on the site's origin inside the admin route is kept, anything else (`javascript:`, another host) becomes the admin root. Needs `generate:importmap` in the same deploy — with a stale map the 2FA screens have no code form and nobody can sign in (`ipal-doctor`, the start log and a notice above the screen report it; the notice is a hint from the file on disk and never replaces the screen; `twoFactor.importMapCheck: false` turns it off); check: password only → `/admin/verify-totp?back=https%3A%2F%2Fexample.com%2F` → code → lands on `/admin` | `twoFactor.safeBack: false` | `safeBack: (back, { adminRoute, origin }) => string`; `safeAdminBack`, `wrapTotpViews` (`@intecion/ipal-kit`), `SafeTotpView` (`@intecion/ipal-kit/admin`) for own views |
| The `back` link of the 2FA setup and verify screens is checked on the server (`SafeTotpView` in front of the package's views): only a path on the site's origin inside the admin route is kept, anything else (`javascript:`, another host) becomes the admin root. Needs `generate:importmap` in the same deploy — with a stale map the 2FA screens have no code form and nobody can sign in (`iapl-doctor`, the start log and a notice above the screen report it; the notice is a hint from the file on disk and never replaces the screen; `twoFactor.importMapCheck: false` turns it off); check: password only → `/admin/verify-totp?back=https%3A%2F%2Fexample.com%2F` → code → lands on `/admin` | `twoFactor.safeBack: false` | `safeBack: (back, { adminRoute, origin }) => string`; `safeAdminBack`, `wrapTotpViews` (`@intecion/ipal-kit`), `SafeTotpView` (`@intecion/ipal-kit/admin`) for own views |
| The 2FA package's endpoints (`/api/setup-totp`, `verify-totp`, `remove-totp`, `admin/*`) answer accounts of the 2FA collection only; reset and remove need the second factor | — (always on with 2FA) | `adminManageAccess` through the wrapped factory (security.md "Resetting 2FA") |
| Roles count only for accounts of a staff collection, in every predicate and access function | — | `access.staffCollections` |
| `enabled: false` keeps the schema | — | — (no endpoints, `onInit` or admin components; no DROP TABLE in `migrate:create`) |
@@ -1189,14 +1232,14 @@ add missing hosts with flags / `extra`; (3) change `mode` to `'enforce'` in both
| Construction mode hides pages in Markdown, MCP | `markdown: { isPathVisible: () => true }`, `mcp: { isPathVisible: () => true }` | `isPathVisible`, `isPathVisibleIn(mode, path)`, `pathOf(url)`, type `PathVisibility` |
| Construction mode filters the sitemap and llms.txt | `underConstructionSeo: false` | `include` / `getIncludedPaths` in the low-level builders |
| `getSettings` at `depth: 1` | — | `createContentHelpers({ settingsDepth: 2 })` (every request pays) |
| Image lightbox (off) | — (opt-in: `<SiteProviders lightbox>`, `LightboxTrigger`, `RenderRichText lightbox`, `ipalKit({ lightbox: true })` for panel labels) | `texts`, `classNames`, `unstyled`, `--ipal-lightbox-*` variables, `renderImage`, `renderDialog`, `loop`, `useLightbox`, `withLightboxUploads`, `lightboxImage` |
| Image lightbox (off) | — (opt-in: `<SiteProviders lightbox>`, `LightboxTrigger`, `RenderRichText lightbox`, `iapl({ lightbox: true })` for panel labels) | `texts`, `classNames`, `unstyled`, `--ipal-lightbox-*` variables, `renderImage`, `renderDialog`, `loop`, `useLightbox`, `withLightboxUploads`, `lightboxImage` |
| `RenderRichText` renders unsafe link URLs as `#` | `safeLinks={false}` (fully trusted content only) | your own `converters` |
| Search engines tab in Site settings | `searchSettings: false` (top level, works without `seo`; `seo.searchSettings` still works) | `searchSettings: (fields) => fields`; `verificationFrom`, `robotsOptionsFrom` |
| Verification `<meta>` from the panel | empty fields = no tag | `const { verification, ...meta } = await generatePageMetadata(…)` |
| AI crawler policy from the panel | `robots` instead of `getRobots`; policy `default` | `buildRobots({ ...robotsOptionsFrom(settings), aiBotRules })`; `AI_ASSISTANT_BOTS`, `AI_TRAINING_BOTS` |
| Sitemap split / CDN cache / memo | `sitemapOptions: { maxUrls: Infinity, cacheControl: false, memoSeconds: 0 }` | `sitemapEntries`, `createSitemapRouteHandler`, `buildSitemapIndexXml`, `buildSitemapEntries` |
| Sitemap error = 503 + `Retry-After` | — (correct HTTP behaviour) | your own route with `buildSitemapXml` |
| IndexNow silent with `IPAL_NOINDEX` | `indexNow` off by default | `submitToIndexNow` by hand |
| IndexNow silent with `IAPL_NOINDEX` | `indexNow` off by default | `submitToIndexNow` by hand |
---
@@ -1208,10 +1251,10 @@ its own tests). Order from the cheapest:
| Level | What | When |
|---|---|---|
| Types | `pnpm generate:types && pnpm tsc --noEmit` | after every schema change |
| Rules | `ipal-audit --quick` (hardcoding, the §0b set, panel) | after every block / collection |
| Rules | `iapl-audit --quick` (hardcoding, the §0b set, panel) | after every block / collection |
| Build | `pnpm build` — page routes `●` (SSG), not `ƒ` | before every "done" |
| Smoke (Playwright) | `ipal-audit/resources/smoke.spec.template.ts` → `tests/smoke.spec.ts`: all URLs from the sitemap 200 + title + one h1, 404, GEO routes, banner, form end-to-end | before handover and after every ipal-kit update |
| Site in the browser | `ipal-seo-check`, `ipal-consent-check`, `cookie-scan` | before handover, after deploy |
| Smoke (Playwright) | `iapl-audit/resources/smoke.spec.template.ts` → `tests/smoke.spec.ts`: all URLs from the sitemap 200 + title + one h1, 404, GEO routes, banner, form end-to-end | before handover and after every IAPL update |
| Site in the browser | `iapl-seo-check`, `iapl-consent-check`, `cookie-scan` | before handover, after deploy |
| Project logic | vitest for your own functions (mapping company data to JSON-LD, helpers, hooks, migration scripts with `--dry-run`) | when you write logic the plugin does not have |
| Panel | the editor test (§11) and the empty-block test (§6.5a) | every new block / global |
@@ -1221,10 +1264,10 @@ Rules:
- **Every fixed bug = a test** that would have caught it (smoke or vitest), so it does not come back.
- **Test the form for real**: sending → a record in Form Submissions → mail to the company **and**
confirmation to the customer (locally: Site integrations → Send test + adapter logs).
- **Do not test the plugin in the project** (e.g. whether `submitForm` validates) — ipal-kit does that. When
- **Do not test the plugin in the project** (e.g. whether `submitForm` validates) — IAPL does that. When
the plugin's behavior is wrong: plugin gap.
- Tests in the project's CI: types + audit `--quick` + build on every push; smoke on staging
(`IPAL_NOINDEX=1`) before a production deployment.
(`IAPL_NOINDEX=1`) before a production deployment.
## 8. CODE STANDARDS
@@ -1312,14 +1355,14 @@ 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; then `ipal-doctor` for the whole site against the team
**Run, do not guess** — `iapl-audit` (the §0b set + the rules below) and `iapl-seo-check`
(GEO and SEO on the built site) instead of manual greps; then `iapl-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
bash .agents/skills/iapl-audit/scripts/audit.sh
pnpm exec iapl-doctor # + --deep --url http://localhost:3000 on the built site
node .agents/skills/iapl-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
# hardcoding and the field zoo in blocks
@@ -1375,7 +1418,7 @@ Anything that needs a developer → move it to the panel.
| Under-construction mode | [construction.md](../construction.md) |
| Visit statistics (optional) | [stats.md](../stats.md) |
| Light / dark theme | [theme.md](../theme.md) |
| Design tokens, `ipal-tokens`, DESIGN.md | [design-tokens.md](../design-tokens.md) |
| Design tokens, `iapl-tokens`, DESIGN.md | [design-tokens.md](../design-tokens.md) |
| Payload helpers (getSiteSettings…) | [payload-helpers.md](../payload-helpers.md) |
| Rich text | [richtext.md](../richtext.md) |
| Headers, CSP, 2FA, panel path | [security.md](../security.md) |
@@ -1386,12 +1429,12 @@ Anything that needs a developer → move it to the panel.
| R2, `buildImagesConfig`, YouTube | [storage.md](../storage.md) |
| Front end: `createContentHelpers` (`@/lib/content`), `createPageRoute`, `SiteProviders` | [frontend.md](../frontend.md) |
| Integrations (the `site-integrations` global, statuses, email test) | [integrations.md](../integrations.md) |
| New site from the reference site: `ipal-kit create`, `@intecion/ipal-kit/starter` | [project-starter.md](../project-starter.md) |
| New site from the reference site: `iapl create`, `@intecion/ipal-kit/starter` | [project-starter.md](../project-starter.md) |
| Deployment, production env, health check | [deployment.md](../deployment.md) |
| 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) |
| iapl-doctor: the site against the team standard, `iapl-doctor.json`, `/api/ipal/doctor` | [doctor.md](../doctor.md) |
| Panel white-label | [white-label.md](../white-label.md) |
---
@@ -1411,14 +1454,14 @@ file points to them.
Before your first change, read all of:
`node_modules/@intecion/ipal-kit/docs/agent/AGENT.md`
Module details: `node_modules/@intecion/ipal-kit/docs/<module>.md`.
Skills: `.agents/skills/ipal-*` (refresh: `pnpm exec ipal-skills`). Always run `ipal-audit` before "done".
Skills: `.agents/skills/iapl-*` (refresh: `pnpm exec iapl-skills`). Always run `iapl-audit` before "done".
The rules in AGENT.md take precedence over your general knowledge of Next/Payload.
ipal-kit first: anything the plugin covers is built with the plugin. Missing or broken → plugin gap (ipal-plugin-gap): report to the owner and wait; never a hand-built replacement or a patch in `node_modules`.
IAPL first: anything the plugin covers is built with the plugin. Missing or broken → plugin gap (iapl-plugin-gap): report to the owner and wait; never a hand-built replacement or a patch in `node_modules`.
Code rules: AGENT.md "Code rules" (single responsibility, no duplicates, typed, texts from the panel, checks).
Write everything in this file in English.
## Site map
- <pages from the brief, the sections on each — written by ipal-site>
- <pages from the brief, the sections on each — written by iapl-site>
## Project decisions
- Architecture answers (AGENT.md "Ask before you build"), one line each: languages + default + URLs ·
@@ -1429,13 +1472,13 @@ Write everything in this file in English.
- <approved workarounds: what, why, plugin-request file, owner's approval>
- Launch date: <date> — from then on seeds touch named records only (AGENT.md "seeding after launch")
- <exceptions to the rules — with the reason>
- <only on a client decision> ipal-audit-skip: <keys from AGENT.md §0b> — <reason, source of the decision>
- <only on a client decision> iapl-audit-skip: <keys from AGENT.md §0b> — <reason, source of the decision>
```
**Claude Code** reads `CLAUDE.md`, not `AGENTS.md` — add a `CLAUDE.md` in the root with one
line `@AGENTS.md` (an import), instead of copying the content. `pnpm exec ipal-skills` does this itself:
it adds the `<!-- ipal-kit:start -->…<!-- ipal-kit:end -->` block to `AGENTS.md` (a pointer to
AGENT.md, `ipal-reference`, `ipal-setup`), and creates a missing `CLAUDE.md` with `@AGENTS.md`.
line `@AGENTS.md` (an import), instead of copying the content. `pnpm exec iapl-skills` does this itself:
it adds the `<!-- iapl:start -->…<!-- iapl:end -->` block to `AGENTS.md` (a pointer to
AGENT.md, `iapl-reference`, `iapl-setup`), and creates a missing `CLAUDE.md` with `@AGENTS.md`.
On every run it replaces only the text between the markers — it does not touch your own content.
---
@@ -1448,66 +1491,66 @@ the task matches — manually: `/<name>`.
| Skill | When |
|---|---|
| `ipal-site` | **a whole site from brief to report** — guides you through the other skills (§0a) |
| `ipal-reference` | **the full plugin map**: `ipalKit` options, env, routes, proxy, layout, import map, hooks, collections, globals + `resources/api.md` (every export) — before you write something yourself |
| `ipal-setup` | a new project from scratch (foundation) — complete installation stage by stage |
| `ipal-block` | a new or revised section (block) — schema, panel (§6.5a), component |
| `ipal-collection` | "we need a blog / products / …" — before a file appears in `src/collections` |
| `ipal-nav` | header, menu, footer, company data |
| `ipal-form` | a form from the panel: renderer, `submitForm` action, Turnstile, mails, GTM |
| `ipal-locale-add` | a new language — configuration, content, the `locale-coverage` script |
| `ipal-migrate-fields` | changing fields that already contain content — 3 phases, a script with dry-run |
| `ipal-upgrade` | updating ipal-kit in an existing project |
| `ipal-debug` | anything does not work — procedure + a symptom → cause → fix table |
| `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 |
| `iapl-site` | **a whole site from brief to report** — guides you through the other skills (§0a) |
| `iapl-reference` | **the full plugin map**: `iapl` options, env, routes, proxy, layout, import map, hooks, collections, globals + `resources/api.md` (every export) — before you write something yourself |
| `iapl-setup` | a new project from scratch (foundation) — complete installation stage by stage |
| `iapl-block` | a new or revised section (block) — schema, panel (§6.5a), component |
| `iapl-collection` | "we need a blog / products / …" — before a file appears in `src/collections` |
| `iapl-nav` | header, menu, footer, company data |
| `iapl-form` | a form from the panel: renderer, `submitForm` action, Turnstile, mails, GTM |
| `iapl-locale-add` | a new language — configuration, content, the `locale-coverage` script |
| `iapl-migrate-fields` | changing fields that already contain content — 3 phases, a script with dry-run |
| `iapl-upgrade` | updating IAPL in an existing project |
| `iapl-debug` | anything does not work — procedure + a symptom → cause → fix table |
| `iapl-audit` | before every "done" — the §0b set + the §11 checks + panel (§6.5a) + hardcoding in JSX + tsc + build |
| `iapl-seo-check` | the running site through the eyes of Googlebot and AI agents (head, canonical, hreflang, sitemap, 404, JSON-LD, llms, Markdown, MCP) |
| `iapl-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'` |
| `iapl-doctor` | the whole site against the team standard in one command (`pnpm exec iapl-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 |
| `iapl-plugin-gap` | IAPL 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`, `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/`.
Run the scripts in the skills, do not read them (the output is enough): `iapl-audit/scripts/audit.sh`, `pnpm exec iapl-doctor`,
`iapl-seo-check/scripts/seo-check.mjs`, `iapl-consent-check/scripts/consent-check.mjs`,
`iapl-locale-add/scripts/locale-coverage.ts`; templates to copy are in `resources/`.
**Installation in the project** (once and after every ipal-kit update) — `ipal-skills` is
**Installation in the project** (once and after every IAPL update) — `iapl-skills` is
a command (`bin`) of the package:
```bash
pnpm exec ipal-skills # → .agents/skills/ipal-*
pnpm exec ipal-skills --dry-run # only show what will change
pnpm exec ipal-skills --dest .claude/skills # Claude Code looks for skills in .claude/skills
pnpm exec ipal-skills --no-pointer # skills only, without touching AGENTS.md / CLAUDE.md
pnpm exec iapl-skills # → .agents/skills/iapl-*
pnpm exec iapl-skills --dry-run # only show what will change
pnpm exec iapl-skills --dest .claude/skills # Claude Code looks for skills in .claude/skills
pnpm exec iapl-skills --no-pointer # skills only, without touching AGENTS.md / CLAUDE.md
```
Besides the skills, the command maintains the pointer to the guide: the `ipal-kit:start…end` block in
Besides the skills, the command maintains the pointer to the guide: the `iapl:start…end` block in
`AGENTS.md` (it creates the file when missing) and in `CLAUDE.md` (when missing — it creates `CLAUDE.md`
with `@AGENTS.md`; when `CLAUDE.md` already imports `@AGENTS.md` — it does not duplicate it). Run it
**right after `pnpm add @intecion/ipal-kit`** — the plugin has no `postinstall` script.
It copies only the `ipal-*` folders: adds new ones, replaces existing ones entirely, removes
It copies only the `iapl-*` folders: adds new ones, replaces existing ones entirely, removes
retired ones. Name the project's own skills **without** the `ipal-` prefix — they stay untouched.
`--dest` must be a subdirectory of the project. Commit the copied `ipal-*` to the project repo.
`--dest` must be a subdirectory of the project. Commit the copied `iapl-*` to the project repo.
**External skills (opt-in)** — well-known third-party skills, vendored into the package at pinned commits
(text only, licence + `SOURCE.md` in each folder). `ipal-skills` downloads nothing; it checks every file
(text only, licence + `SOURCE.md` in each folder). `iapl-skills` downloads nothing; it checks every file
against `docs/agent/external/manifest.json` before copying:
```bash
pnpm exec ipal-skills --external # all ext-* next to the ipal-* skills
pnpm exec ipal-skills --external ext-accessibility,ext-payload # only these
pnpm exec iapl-skills --external # all ext-* next to the iapl-* skills
pnpm exec iapl-skills --external ext-accessibility,ext-payload # only these
```
| Skill | Publisher · licence | What it is for | Our override |
|---|---|---|---|
| `ext-react-best-practices` | Vercel · MIT | React/Next performance rules (waterfalls, bundles, RSC, re-renders) | no `swr` / client-fetch libraries — Server Components + Payload / `@/lib/content` |
| `ext-composition-patterns` | Vercel · MIT | compound components instead of boolean props, React 19 APIs | block schema and `RenderBlocks` follow §6 |
| `ext-accessibility` | Addy Osmani · MIT | WCAG 2.2 audit and fixes | Lighthouse / axe only as pinned devDependencies; ipal-kit components fixed via props or a plugin gap |
| `ext-accessibility` | Addy Osmani · MIT | WCAG 2.2 audit and fixes | Lighthouse / axe only as pinned devDependencies; IAPL components fixed via props or a plugin gap |
| `ext-frontend-design` | Anthropic · Apache-2.0 | distinctive visual direction, design quality floor | `DESIGN.md` tokens win; use it to write/extend `DESIGN.md` + `src/design/tokens.ts`, mapping its palette onto the `--ipal-*` roles (design-tokens.md) — never new token names, never hex/fonts/text in components |
| `ext-payload` | Payload CMS · MIT | Payload 3 reference (v3.92.1) | reference only, never Payload 4 guidance; ipal-kit features first |
| `ext-payload` | Payload CMS · MIT | Payload 3 reference (v3.92.1) | reference only, never Payload 4 guidance; IAPL features first |
**Our rules win.** Every `ext-*` SKILL.md starts with an override note; when an external skill conflicts with
this file, the project's `AGENTS.md` or `DESIGN.md`, those win — ipal-kit first, Payload data fetching over `swr`,
this file, the project's `AGENTS.md` or `DESIGN.md`, those win — IAPL first, Payload data fetching over `swr`,
`DESIGN.md` tokens, Payload 3 not 4. `ext-*` folders are touched only with `--external`, and only those with
ipal-kit's `SOURCE.md`; do not name the project's own skills `ext-…`. Use them only after the owner chose them
IAPL's `SOURCE.md`; do not name the project's own skills `ext-…`. Use them only after the owner chose them
("Project decisions").
**`tsconfig.json` must exclude the skills directory** (it contains `.ts`/`.tsx` templates that
break `tsc` and `next build`): `"exclude": ["node_modules", ".agents"]` (with `--dest
.claude/skills` — `".claude"`). Without it `ipal-skills` prints a warning and exits with
.claude/skills` — `".claude"`). Without it `iapl-skills` prints a warning and exits with
code 1. The commands in this file and in the skills assume `.agents/skills/` — with a different
`--dest` replace the path.
+26 -26
View File
@@ -2,12 +2,12 @@
<!-- Generated by scripts/reference-index.mjs from reference/ — do not edit by hand (pnpm reference:index). -->
The reference site is one complete client site on ipal-kit 1.16.8 ("Example Studio", made up) that uses
The reference site is one complete client site on IAPL 1.16.8 ("Example Studio", made up) that uses
every convention in AGENT.md. It lives in the plugin repo (`reference/`, not in the npm package). Copy the
PATTERN of the file you need; change only the project's content. Files up to
40 lines are below in full; open the rest in the repo at the tag of your plugin version:
`https://git.intecion.net/IntecionSoftware/ipal-kit/src/tag/v<version>/reference/<path>`.
If this index and AGENT.md disagree, report it with ipal-plugin-gap — it is a plugin bug.
If this index and AGENT.md disagree, report it with iapl-plugin-gap — it is a plugin bug.
## Project files
@@ -24,12 +24,12 @@ Rules: AGENT.md §13, §0a.
| `DESIGN.md` | the human source of the look, matching src/design/tokens.ts |
| `README.md` | how to run the reference site and what is where |
| `docs/DEPLOY.md` | the Coolify runbook: local check, app settings, MongoDB resource, env, targeted seeds, DNS, rollback |
| `ipal-doctor.json` | the production domain and launch state for ipal-doctor (below) |
| `iapl-doctor.json` | the production domain and launch state for iapl-doctor (below) |
| `next.config.ts` | security headers, enforced CSP, admin CSP, upload headers, images, no X-Powered-By |
| `package.json` | scripts (build, start, seed, tokens, generate), pinned Payload versions and overrides |
| `playwright.config.ts` | smoke tests against the built, seeded site (below) |
| `postcss.config.mjs` | Tailwind 4 through PostCSS (below) |
| `starter.manifest.json` | what `ipal-kit create` keeps, drops and turns into placeholders |
| `starter.manifest.json` | what `iapl create` keeps, drops and turns into placeholders |
| `tsconfig.json` | paths @/ and @payload-config, .agents excluded (below) |
### `.gitignore`
@@ -58,7 +58,7 @@ legacy-peer-deps=true
22
```
### `ipal-doctor.json`
### `iapl-doctor.json`
```json
{
@@ -158,7 +158,7 @@ export default { plugins: { '@tailwindcss/postcss': {} } }
## Configuration
Rules: AGENT.md §3, ipal-setup stage 3.
Rules: AGENT.md §3, iapl-setup stage 3.
| File | What it shows |
|---|---|
@@ -166,7 +166,7 @@ Rules: AGENT.md §3, ipal-setup stage 3.
| `src/db.ts` | the database adapter, alone in one file (MongoDB) (below) |
| `src/i18n.config.ts` | the ONLY source of languages (below) |
| `src/instrumentation.ts` | env validation at startup (assertEnv, database name rule) (below) |
| `src/payload.config.ts` | ipalKit with every module the site uses, R2, mail, 2FA, white-label |
| `src/payload.config.ts` | iapl with every module the site uses, R2, mail, 2FA, white-label |
| `src/proxy.ts` | the locale proxy with Markdown negotiation (not middleware.ts) (below) |
### `src/content.config.ts`
@@ -220,21 +220,21 @@ export type Locale = (typeof i18nConfig.locales)[number]['code']
### `src/instrumentation.ts`
```ts
import { assertEnv, ipalEnvRules } from '@intecion/ipal-kit/env'
import { assertEnv, iaplEnvRules } from '@intecion/ipal-kit/env'
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.
// @starter:if crawl
// cookieCrawl: IPAL_COOKIE_SCAN_URL / IPAL_COOKIE_SCAN_TOKEN in production (cookieScanner.crawl, the shared service).
// cookieCrawl: IAPL_COOKIE_SCAN_URL / IAPL_COOKIE_SCAN_TOKEN in production (cookieScanner.crawl, the shared service).
// @starter:endif
// 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({
iaplEnvRules({
// @starter:if crawl
cookieCrawl: true, // IPAL_COOKIE_SCAN_URL / IPAL_COOKIE_SCAN_TOKEN in production — the shared cookie-crawler service
cookieCrawl: true, // IAPL_COOKIE_SCAN_URL / IAPL_COOKIE_SCAN_TOKEN in production — the shared cookie-crawler service
// @starter:endif
databaseName: { domain: 'example-studio.pl' },
// @starter:if graph
@@ -268,7 +268,7 @@ export const config = { matcher: ['/((?!api|admin|_next|.*\\..*).*)'] }
## Collections and globals
Rules: AGENT.md §5, ipal-nav, ipal-collection.
Rules: AGENT.md §5, iapl-nav, iapl-collection.
| File | What it shows |
|---|---|
@@ -295,7 +295,7 @@ import { entryFields } from './entryFields'
const revalidate = buildRevalidateHook({ config: i18nConfig, revalidatePath })
/** The project's own archive collection (skill ipal-collection) — the library has no case-study type. */
/** The project's own archive collection (skill iapl-collection) — the library has no case-study type. */
export const CaseStudies: CollectionConfig = {
slug: 'caseStudies',
admin: { defaultColumns: ['title', 'publishedAt', 'updatedAt'], useAsTitle: 'title' },
@@ -482,7 +482,7 @@ import type { GlobalConfig } from 'payload'
import { buildGlobalRevalidateHook, buildLinkField, rowLabel } from '@intecion/ipal-kit'
import { revalidatePath } from 'next/cache'
/** ipal-nav: link columns and a note. Legal links come from System pages (getSystemLinks), not from here. */
/** iapl-nav: link columns and a note. Legal links come from System pages (getSystemLinks), not from here. */
export const Footer: GlobalConfig = {
slug: 'footer',
access: { read: () => true },
@@ -518,7 +518,7 @@ import type { GlobalConfig } from 'payload'
import { buildGlobalRevalidateHook, buildLinkField, buildLinksField, rowLabel } from '@intecion/ipal-kit'
import { revalidatePath } from 'next/cache'
/** ipal-nav: menu with one submenu level, a CTA button, the mobile menu label. Logo comes from Site settings. */
/** iapl-nav: menu with one submenu level, a CTA button, the mobile menu label. Logo comes from Site settings. */
export const Header: GlobalConfig = {
slug: 'header',
access: { read: () => true },
@@ -641,7 +641,7 @@ Rules: docs/design-tokens.md.
| File | What it shows |
|---|---|
| `src/app/(frontend)/[locale]/design/page.tsx` | the design-token styleguide page (noindex) (below) |
| `src/components/design/TokenPanel.tsx` | one styleguide panel built from IPAL_TOKENS |
| `src/components/design/TokenPanel.tsx` | one styleguide panel built from IAPL_TOKENS |
| `src/design/tokens.css` | GENERATED by `pnpm tokens` from tokens.ts — never edited by hand (below) |
| `src/design/tokens.ts` | the brand: the ONLY file edited to rebrand the site (below) |
@@ -663,7 +663,7 @@ export default function DesignPage() {
return (
<Container className="grid gap-10 py-section">
<header className="grid gap-stack">
<p className="text-sm uppercase tracking-heading text-fg-muted">ipal-kit</p>
<p className="text-sm uppercase tracking-heading text-fg-muted">IAPL</p>
<h1 className="font-heading text-h1 leading-heading text-fg-strong">Design tokens</h1>
<p className="max-w-measure text-lead text-fg-muted">
src/design/tokens.ts → pnpm tokens → src/design/tokens.css. The panels set data-theme=&quot;light&quot; and data-theme=&quot;dark&quot;
@@ -686,8 +686,8 @@ export const generateStaticParams = () => i18nConfig.locales.map(({ code }) => (
```css
/*
* GENERATED by `ipal-tokens` from src/design/tokens.ts — do not edit; change src/design/tokens.ts and run
* `pnpm exec ipal-tokens`. Import it in styles.css after @intecion/ipal-kit/tokens.css (and tailwind.css).
* GENERATED by `iapl-tokens` from src/design/tokens.ts — do not edit; change src/design/tokens.ts and run
* `pnpm exec iapl-tokens`. Import it in styles.css after @intecion/ipal-kit/tokens.css (and tailwind.css).
*/
:root {
@@ -775,7 +775,7 @@ import type { Locale } from '@/i18n.config'
import { getCachedPayload } from './content'
/** Cached getters for the project's own globals — the layout passes them down as props (ipal-nav). */
/** Cached getters for the project's own globals — the layout passes them down as props (iapl-nav). */
export const getHeader = cache(async (locale: string) => (await getCachedPayload()).findGlobal({ slug: 'header', depth: 1, locale: locale as Locale }))
export const getFooter = cache(async (locale: string) => (await getCachedPayload()).findGlobal({ slug: 'footer', depth: 1, locale: locale as Locale }))
export const getCompany = cache(async (locale: string) => (await getCachedPayload()).findGlobal({ slug: 'company', locale: locale as Locale }))
@@ -783,7 +783,7 @@ export const getCompany = cache(async (locale: string) => (await getCachedPayloa
## Layout and components
Rules: AGENT.md §6.8, ipal-nav, ipal-form.
Rules: AGENT.md §6.8, iapl-nav, iapl-form.
| File | What it shows |
|---|---|
@@ -845,7 +845,7 @@ export const generateStaticParams = route.generateStaticParams
```ts
'use server'
// ONE server action for every builder form: honeypot → client IP (IPAL_IP_HEADER) → submitForm
// ONE server action for every builder form: honeypot → client IP (IAPL_IP_HEADER) → submitForm
// (rate limit, Turnstile, validation, consent, save) → the message from Notifications.
import { createSubmitAction } from '@intecion/ipal-kit/server'
import { headers } from 'next/headers'
@@ -903,7 +903,7 @@ import { buttonClass } from '@intecion/ipal-kit/blocks/rsc'
const control =
'w-full rounded-control border border-border bg-surface px-3 py-2 text-fg placeholder:text-fg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus'
/** The ONLY place panel forms are styled (ipal-form). Token utilities only — no hex, no dark:. */
/** The ONLY place panel forms are styled (iapl-form). Token utilities only — no hex, no dark:. */
export const formClasses: BuilderFormClassNames = {
actions: 'flex flex-wrap gap-3',
back: buttonClass('secondary'),
@@ -971,7 +971,7 @@ import type { NavItem } from '@intecion/ipal-kit'
import Link from 'next/link'
import { useEffect, useState } from 'react'
/** Mobile menu: open state only, data via props (ipal-nav). Esc closes it. */
/** Mobile menu: open state only, data via props (iapl-nav). Esc closes it. */
export function MobileNav({ items, menuLabel }: { items: NavItem[]; menuLabel: string }) {
const [open, setOpen] = useState(false)
useEffect(() => {
@@ -1009,7 +1009,7 @@ export function MobileNav({ items, menuLabel }: { items: NavItem[]; menuLabel: s
## SEO, GEO and ops routes
Rules: AGENT.md §0b, ipal-setup stages 7–8.
Rules: AGENT.md §0b, iapl-setup stages 7–8.
| File | What it shows |
|---|---|
@@ -1164,7 +1164,7 @@ Rules: AGENT.md §8a.
|---|---|
| `e2e/create-test-admin.ts` | two test admins with a known TOTP secret (the specs share out the five 2FA verify attempts per account), their stored verify counts cleared, and e-mail sending pointed at the tests' mail sink (local / CI database only) |
| `e2e/global-setup.ts` | Playwright global setup: resets the test admins and clears their stored 2FA attempt counts before every run, so specs do not depend on run order (below) |
| `e2e/late-staff-fixture.ts` | test fixture, on only with E2E_LATE_STAFF=1: one plugin before ipalKit (staff collections of the config: roles with one more value, the plugin's roles, roles of the project's own) and one after it (a staff collection without rules, one whose roles field is text, copies of staff collections under new slugs — plain, with rules of their own, one rule used for another operation, other role values, the opt-out, not staff — and a visitor collection with open sign-up) |
| `e2e/late-staff-fixture.ts` | test fixture, on only with E2E_LATE_STAFF=1: one plugin before iapl (staff collections of the config: roles with one more value, the plugin's roles, roles of the project's own) and one after it (a staff collection without rules, one whose roles field is text, copies of staff collections under new slugs — plain, with rules of their own, one rule used for another operation, other role values, the opt-out, not staff — and a visitor collection with open sign-up) |
| `e2e/late-staff.spec.ts` | the account rules on a BUILT site (run by `pnpm e2e:built` after a webpack and a Turbopack build): a staff collection a later plugin adds, staff collections whose accounts can hold `admin`, and copies of staff collections — a visitor account gets nothing, nobody raises its own role or makes an admin, a copy is never wider than the plugin's rule |
| `e2e/smoke.spec.ts` | the smoke tests every release must pass: pages, showcase, forms (also a file sent by e-mail), sitemap, SEO/GEO, headers, consent, 2FA |
| `e2e/smtp-sink.ts` | a local mail sink for the smoke tests: reads what the site really sent (recipients, attachments) |
+10 -10
View File
@@ -1,9 +1,9 @@
---
name: ipal-audit
description: Audits an ipal-kit (Payload 3 + Next 16) project against AGENT.md rules with a deterministic script — the mandatory feature set (SEO, JSON-LD, llms.txt, Markdown, MCP, R2, Turnstile, panel forms, consent, 2FA, health, env, security headers, X-Powered-By, CSP), forbidden replacements (own forms, nodemailer, reCAPTCHA, hand-written JSON-LD), hardcoded texts/links, forbidden field names, monolithic sections, middleware.ts, missing ISR/generateStaticParams, hex colors, server imports in client components, extra collections, then tsc and build. Use before saying a task is done, after any block/collection/layout change, after an Impeccable pass, and when asked to review or audit the project.
name: iapl-audit
description: Audits an IAPL (Payload 3 + Next 16) project against AGENT.md rules with a deterministic script — the mandatory feature set (SEO, JSON-LD, llms.txt, Markdown, MCP, R2, Turnstile, panel forms, consent, 2FA, health, env, security headers, X-Powered-By, CSP), forbidden replacements (own forms, nodemailer, reCAPTCHA, hand-written JSON-LD), hardcoded texts/links, forbidden field names, monolithic sections, middleware.ts, missing ISR/generateStaticParams, hex colors, server imports in client components, extra collections, then tsc and build. Use before saying a task is done, after any block/collection/layout change, after an Impeccable pass, and when asked to review or audit the project.
---
# ipal-audit
# iapl-audit
The checks from AGENT.md §11 as a script — always the same, no interpretation.
@@ -11,8 +11,8 @@ The checks from AGENT.md §11 as a script — always the same, no interpretation
1. From the project root, run:
```bash
bash .agents/skills/ipal-audit/scripts/audit.sh --quick # while working
bash .agents/skills/ipal-audit/scripts/audit.sh # before "done" (+ tsc + build)
bash .agents/skills/iapl-audit/scripts/audit.sh --quick # while working
bash .agents/skills/iapl-audit/scripts/audit.sh # before "done" (+ tsc + build)
```
Options: `--help`. Do not read the script source — the output is enough.
2. Show the user the **full output** (summary + list of violations).
@@ -27,7 +27,7 @@ The checks from AGENT.md §11 as a script — always the same, no interpretation
## "missing: …" — the mandatory set (AGENT.md §0b)
Every `[ERROR] missing: X` is an item of the set that the code lacks. Wire it
following the hint (PROGRAMISTA §2) — do not ask whether it is needed. The only exception:
a client decision recorded in `AGENTS.md` as `ipal-audit-skip: <keys> — <reason>` (keys
a client decision recorded in `AGENTS.md` as `iapl-audit-skip: <keys> — <reason>` (keys
in AGENT.md §0b). Never add that line yourself just to make the audit pass.
## Polish text and panel labels (AGENT.md §2, §6.5a)
@@ -40,14 +40,14 @@ in AGENT.md §0b). Never add that line yourself just to make the audit pass.
The script checks: hex in classes and inline styles (error), `dark:` on colour utilities and `var(--color-…)` in
classes (warnings), `styles.css` without `@intecion/ipal-kit/tokens.css` (warning — a site not yet migrated),
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.
`iapl-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**
## iapl-audit and iapl-doctor
`iapl-audit` checks the **code** inside the edit loop (and tsc + build). `pnpm exec iapl-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.
(the `iapl-doctor` skill, docs/doctor.md). An approved exception for the doctor goes into `iapl-doctor.json` with a reason.
## What the script does not check (do it by hand)
+24 -24
View File
@@ -1,9 +1,9 @@
#!/usr/bin/env bash
# ipal-audit — deterministic checks of an ipal-kit project against AGENT.md.
# iapl-audit — deterministic checks of an IAPL project against AGENT.md.
# Run from the project root:
# bash .agents/skills/ipal-audit/scripts/audit.sh # all checks + tsc + build
# bash .agents/skills/ipal-audit/scripts/audit.sh --quick # static checks only
# bash .agents/skills/ipal-audit/scripts/audit.sh --help
# bash .agents/skills/iapl-audit/scripts/audit.sh # all checks + tsc + build
# bash .agents/skills/iapl-audit/scripts/audit.sh --quick # static checks only
# bash .agents/skills/iapl-audit/scripts/audit.sh --help
# Exit code: 0 = no errors (warnings allowed), 1 = at least one error.
set -u
@@ -22,7 +22,7 @@ for arg in "$@"; do
done
if [ ! -d src ]; then
echo "ipal-audit: run from the project root (no ./src found)." >&2
echo "iapl-audit: run from the project root (no ./src found)." >&2
exit 2
fi
@@ -52,7 +52,7 @@ dirs() { for d in "$@"; do [ -d "$d" ] && printf '%s ' "$d"; done; }
BLOCKS=$(dirs src/blocks)
UI=$(dirs src/blocks src/components)
echo "ipal-audit — $(pwd)"
echo "iapl-audit — $(pwd)"
# --- Skill templates must not be compiled as project code ---
if [ -d .agents ] && [ -f tsconfig.json ]; then
@@ -162,7 +162,7 @@ if [ -n "$UI" ]; then
report WARNING "old colour variables in classes" "§6.11 use the preset utilities (bg-primary, text-fg) — not var(--color-…)" \
"$(g '\[var\(--color-' $UI --include=*.tsx)"
report ERROR "hex colors in inline styles" "§6.11 use design tokens — IPAL_TOKENS / ipalVar() for a dynamic style" \
report ERROR "hex colors in inline styles" "§6.11 use design tokens — IAPL_TOKENS / iaplVar() for a dynamic style" \
"$(g "style=\{\{[^}]*['\"]#[0-9a-fA-F]{3,8}['\"]" $UI --include=*.tsx)"
report ERROR "barrel index.ts" "§6.12 import files directly" \
@@ -184,14 +184,14 @@ if [ -n "$STYLES" ]; then
"$(grep -q 'ipal-kit/tailwind.css' "$STYLES" && g "variable: ['\"]--font-(body|heading|mono)['\"]" src/app --include=*.ts --include=*.tsx)"
fi
if [ -f src/design/tokens.ts ]; then
[ -f DESIGN.md ] || report WARNING "no DESIGN.md" "§6.11 the brand is described in DESIGN.md (template: ipal-setup/resources/DESIGN.md)" "DESIGN.md missing"
TOKENS_BIN=node_modules/@intecion/ipal-kit/bin/ipal-tokens.mjs
[ -f DESIGN.md ] || report WARNING "no DESIGN.md" "§6.11 the brand is described in DESIGN.md (template: iapl-setup/resources/DESIGN.md)" "DESIGN.md missing"
TOKENS_BIN=node_modules/@intecion/ipal-kit/bin/iapl-tokens.mjs
if [ -f "$TOKENS_BIN" ]; then
TOKENS_OUT=$(node "$TOKENS_BIN" --check 2>&1)
[ $? -ne 0 ] && report ERROR "ipal-tokens --check" "§6.11 run pnpm exec ipal-tokens: the CSS is stale or a contrast pair fails WCAG AA" \
"$(printf '%s\n' "$TOKENS_OUT" | grep -E '✗|out of date|ipal-tokens:' || echo 'ipal-tokens --check failed')"
[ $? -ne 0 ] && report ERROR "iapl-tokens --check" "§6.11 run pnpm exec iapl-tokens: the CSS is stale or a contrast pair fails WCAG AA" \
"$(printf '%s\n' "$TOKENS_OUT" | grep -E '✗|out of date|iapl-tokens:' || echo 'iapl-tokens --check failed')"
else
report WARNING "ipal-tokens not installed" "§6.11 @intecion/ipal-kit 1.15+ ships the ipal-tokens bin" "$TOKENS_BIN missing"
report WARNING "iapl-tokens not installed" "§6.11 @intecion/ipal-kit 1.15+ ships the iapl-tokens bin" "$TOKENS_BIN missing"
fi
fi
@@ -199,7 +199,7 @@ fi
if [ -d src/collections ]; then
report ERROR "forbidden collection" "§5.3 settings/nav/footer are globals; FAQ/hero are blocks" \
"$(ls src/collections | grep -iE '^(settings|navigation|nav|footer|header|faq|hero|company|danefirmy)\.ts$')"
report WARNING "own users collection" "§5.3 ipalKit injects the auth collection — keep your own only to add fields (roles + 2FA still attach)" \
report WARNING "own users collection" "§5.3 IAPL injects the auth collection — keep your own only to add fields (roles + 2FA still attach)" \
"$(ls src/collections | grep -iE '^(users|user)\.ts$')"
report WARNING "collections present — confirm each passed the §5.3 test" "minimum: Pages, Media" \
"$(ls src/collections | grep -viE '^(pages|media|users|user|settings|navigation|nav|footer|header|faq|hero|company|danefirmy)\.ts$')"
@@ -261,8 +261,8 @@ done <<< "$(printf '%s\n' "$HTML" | cut -d'|' -f1-2 | sort -u)"
# --- Mandatory feature set (AGENT.md §0b) ---
# Every site wires all of these through the plugin. A missing one is an ERROR
# unless AGENTS.md records the client's decision: `ipal-audit-skip: mcp, llms-full — reason`.
SKIP=$(grep -hiE '^[-* ]*ipal-audit-skip:' AGENTS.md 2>/dev/null | sed 's/^[^:]*://; s/—.*//; s/ - .*//' | tr ',' ' ')
# unless AGENTS.md records the client's decision: `iapl-audit-skip: mcp, llms-full — reason`.
SKIP=$(grep -hiE '^[-* ]*(iapl|ipal)-audit-skip:' AGENTS.md 2>/dev/null | sed 's/^[^:]*://; s/—.*//; s/ - .*//' | tr ',' ' ')
skipped() { for k in $SKIP; do [ "$k" = "$1" ] && return 0; done; return 1; }
# has <regex> <paths…> — true when any file under the paths matches
has() { local re="$1"; shift; grep -rqE "$re" "$@" 2>/dev/null; }
@@ -294,7 +294,7 @@ if [ -n "$APP" ]; then
need WARNING '' "AI summary field" "buildSummaryField() in Pages + createContentHelpers({ summaryField: 'aiSummary' })" 'buildSummaryField' src
# Ops
need ERROR '' "health route" "src/app/api/health/route.ts → export { healthRoute as GET } from '@/lib/content'" 'healthRoute|createHealthRoute' src/app
need ERROR '' "env validation" "src/instrumentation.ts → assertEnv(ipalEnvRules({...})) from @intecion/ipal-kit/env" 'assertEnv' src/instrumentation.ts instrumentation.ts
need ERROR '' "env validation" "src/instrumentation.ts → assertEnv(iaplEnvRules({...})) from @intecion/ipal-kit/env" 'assertEnv' src/instrumentation.ts instrumentation.ts
need ERROR '' "security headers" "next.config.ts → buildSecurityHeaders" 'buildSecurityHeaders' next.config.ts next.config.mjs next.config.js
need WARNING '' "X-Powered-By hidden" "next.config.ts → export default withPayload(withSecurityConfig(nextConfig)) — Next and withPayload send X-Powered-By: Next.js, Payload (security.md)" 'withSecurityConfig|poweredByHeader: *false' next.config.ts next.config.mjs next.config.js
need WARNING csp "Content-Security-Policy" "next.config.ts → buildSecurityHeaders({ csp: { mode: 'report-only', reportUri: '/api/csp-report', … } }) + buildAdminCspHeaders on /admin/:path*, then 'enforce' (security.md → ROLL OUT CSP)" "csp: *\\{|csp,|buildCsp|Content-Security-Policy" next.config.ts next.config.mjs next.config.js src/proxy.ts proxy.ts
@@ -305,21 +305,21 @@ if [ -n "$APP" ]; then
need WARNING turnstile "Turnstile site key" "getSiteShell(locale) (or getTurnstileConfig(payload)) — off unless BOTH keys are set" 'getSiteShell|getTurnstileConfig' src
need WARNING '' "MediaPreconnect" "<SiteProviders> (adds it) or <MediaPreconnect/> in the layout" 'SiteProviders|MediaPreconnect' src/app
# Forms
need ERROR '' "form submission via the plugin" "actions.ts → export const sendForm = createSubmitAction({ getCachedPayload, headers }) (ipal-form)" 'createSubmitAction|submitForm' src
need ERROR '' "form submission via the plugin" "actions.ts → export const sendForm = createSubmitAction({ getCachedPayload, headers }) (iapl-form)" 'createSubmitAction|submitForm' src
need WARNING '' "upload sandbox headers" "next.config.ts → ...buildUploadSecurityHeaders() (uploaded SVG can't run script)" 'buildUploadSecurityHeaders' next.config.ts next.config.mjs next.config.js
need WARNING '' "images preset" "next.config.ts → images: { ...buildImagesConfig() } (AVIF/WebP, R2 domain)" 'buildImagesConfig' next.config.ts next.config.mjs next.config.js
fi
if [ -n "$CFG" ]; then
need ERROR '' "forms in ipalKit" "$CFG → ipalKit({ forms: {…} }) — forms are built in the panel" 'forms *:' "$CFG"
need ERROR '' "forms in iapl" "$CFG → iapl({ forms: {…} }) — forms are built in the panel" 'forms *:' "$CFG"
need ERROR '' "mailAdapter" "$CFG → email: mailAdapter() — form e-mails go through the panel transport" 'mailAdapter\(' "$CFG"
need ERROR r2 "R2 storage" "$CFG → buildR2Storage(['media'], { s3Storage }) — always wired, local disk only without R2_* env" 'buildR2Storage' "$CFG"
# pnpm dev / generate:importmap with ipal-kit < 1.12.2 and no R2_* env dropped the storage-s3
# pnpm dev / generate:importmap with IAPL < 1.12.2 and no R2_* env dropped the storage-s3
# client handler → blank admin in production (where R2 is on)
if grep -q 'buildR2Storage' "$CFG" 2>/dev/null; then
for IM in src/app/\(payload\)/*/importMap.js; do
[ -f "$IM" ] || continue
report ERROR "import map without the R2 upload handler" "storage.md — pnpm payload generate:importmap (ipal-kit ≥ 1.12.2 writes it with or without R2_* env); without it the production admin renders blank" \
report ERROR "import map without the R2 upload handler" "storage.md — pnpm payload generate:importmap (IAPL ≥ 1.12.2 writes it with or without R2_* env); without it the production admin renders blank" \
"$(grep -q 'S3ClientUploadHandler' "$IM" || echo "$IM")"
done
fi
@@ -331,10 +331,10 @@ fi
# 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"
report WARNING "no form seed" "iapl-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
need WARNING '' "IAPL_IP_HEADER in .env.example" "header the rate limit trusts, e.g. cf-connecting-ip (forms.md)" '(IAPL|IPAL)_IP_HEADER' .env.example
# Plugin replacements (§0b "Forbidden substitutes")
report ERROR "own form / mail / captcha stack" "§0b — forms come from the panel builder, mail from mailAdapter, bot check from Turnstile" \
@@ -349,7 +349,7 @@ report WARNING "<form> outside the form renderer" "§0b — panel forms render v
"$(g '<form[ >]' src --include=*.tsx | grep -v 'components/forms/')"
# Project copies of what the plugin now ships (import instead of code)
report WARNING "own form engine" "ipal-form §3 — <RenderForm> / useBuilderForm (steps, choices, Turnstile, honeypot; Emails tab never reaches the browser)" \
report WARNING "own form engine" "iapl-form §3 — <RenderForm> / useBuilderForm (steps, choices, Turnstile, honeypot; Emails tab never reaches the browser)" \
"$(g 'buildValidator|useForm\(' src --include=*.tsx | grep -v 'useBuilderForm')"
report WARNING "own image lightbox" "lightbox.md — <LightboxTrigger> + lightboxImage, one <SiteProviders lightbox>; labels from Notifications → Lightbox" \
"$(g "['\"](glightbox|photoswipe|yet-another-react-lightbox|react-medium-image-zoom|fslightbox-react)['\"]" src --include=*.ts --include=*.tsx)"
@@ -383,5 +383,5 @@ if [ "$QUICK" -eq 0 ]; then
fi
echo
echo "ipal-audit: $ERRORS error(s), $WARNINGS warning(s)$( [ "$QUICK" -eq 1 ] && echo ' (quick: no tsc/build)')"
echo "iapl-audit: $ERRORS error(s), $WARNINGS warning(s)$( [ "$QUICK" -eq 1 ] && echo ' (quick: no tsc/build)')"
[ "$ERRORS" -eq 0 ]
@@ -28,7 +28,7 @@ const POLISH = /[ąćęłńóśźżĄĆĘŁŃÓŚŹŻ]/
const SCHEMA_KEYS = new Set(['label', 'singular', 'plural', 'description', 'placeholder', 'group'])
const SCHEMA_DIR = /(?:^|\/)(?:collections|globals|fields|blocks)\//
const SCHEMA_TYPES = /import\s+type\s*\{[^}]*\b(?:Block|CollectionConfig|Field|GlobalConfig|Tab)\b[^}]*\}\s*from\s*['"]payload['"]/
const IPAL = /^@intecion\/ipal-kit(?:\/|$)/
const IAPL = /^@intecion\/ipal-kit(?:\/|$)/
const files = []
const walk = (p) => {
@@ -50,7 +50,7 @@ for (const file of files) {
// Local names of the plugin's helpers (`import { adminText as t } …`); a lookalike of your own does not count.
const helpers = new Map()
for (const st of source.statements) {
if (!ts.isImportDeclaration(st) || !IPAL.test(st.moduleSpecifier.text)) continue
if (!ts.isImportDeclaration(st) || !IAPL.test(st.moduleSpecifier.text)) continue
const named = st.importClause?.namedBindings
if (!named || !ts.isNamedImports(named)) continue
for (const el of named.elements) {
+8 -8
View File
@@ -1,12 +1,12 @@
---
name: ipal-block
description: Builds or refactors one page section (Payload block + React component) in an ipal-kit project the correct way — first a block of the plugin's block library (libraryBlocks / createBlockRegistry, 15 ready sections) or its variant or options, and only when none fits an own block with a clean editor panel (repeatable things as "+ Add …" arrays with rowLabel, never cta1/cta2 slots, short `{ en, pl }` labels per docs/dev/admin-ux.md, no empty spare fields), shared fields from the plugin (buildSectionHeaderField, buildLinksField, buildLinkField, buildSectionSettingsField), UI primitives (Section, SectionHeader, Media, CMSLink), fixed field vocabulary, max ~80 lines of JSX, subcomponents for repeated items, registry wiring. Use when creating a new section/block (hero, features, CTA, FAQ, gallery, pricing, testimonials…), changing a block's fields, or fixing a block with ctaLabel/buttonUrl/pdfUrl fields or a monolithic component.
name: iapl-block
description: Builds or refactors one page section (Payload block + React component) in an IAPL project the correct way — first a block of the plugin's block library (libraryBlocks / createBlockRegistry, 15 ready sections) or its variant or options, and only when none fits an own block with a clean editor panel (repeatable things as "+ Add …" arrays with rowLabel, never cta1/cta2 slots, short `{ en, pl }` labels per docs/dev/admin-ux.md, no empty spare fields), shared fields from the plugin (buildSectionHeaderField, buildLinksField, buildLinkField, buildSectionSettingsField), UI primitives (Section, SectionHeader, Media, CMSLink), fixed field vocabulary, max ~80 lines of JSX, subcomponents for repeated items, registry wiring. Use when creating a new section/block (hero, features, CTA, FAQ, gallery, pricing, testimonials…), changing a block's fields, or fixing a block with ctaLabel/buttonUrl/pdfUrl fields or a monolithic component.
---
# ipal-block
# iapl-block
**ipal-kit first (hard rule, AGENT.md "ipal-kit first"):** anything the plugin covers is built with the
plugin's feature. It does not work or is not enough → report it with **ipal-plugin-gap** and wait for the owner's
**IAPL first (hard rule, AGENT.md "IAPL first"):** anything the plugin covers is built with the
plugin's feature. It does not work or is not enough → report it with **iapl-plugin-gap** and wait for the owner's
decision on that part; no hand-built replacement, no silent workaround. **Code rules:** AGENT.md "Code rules"
(one job per file/component/function, no duplicates, typed, texts from the panel, a check for new behaviour).
@@ -24,12 +24,12 @@ The plugin ships 15 blocks: `hero`, `textMedia`, `featureGrid`, `cta`, `richText
(own `{ label: { en, pl }, value }` + `components` / `classNames` in the registry), `settings: { backgrounds }`,
`links`, `maxItems`. Another look of one part → `createBlockRegistry(content, { classNames: { faq: { item: '…' } } })`;
another primitive everywhere → `ui: { Media }`.
3. The project must own it completely → `pnpm exec ipal-blocks eject <block>` (same slug and data, no migration),
3. The project must own it completely → `pnpm exec iapl-blocks eject <block>` (same slug and data, no migration),
then the ejected builder in `pageBlocks` and `components: { <slug>: <Name>Block }` in the registry.
4. Nothing fits → an own block (below), with the library's builders (`buildItemsField`, `buildMediaField`,
`buildVariantField`, `buildContentField`, `defineLibraryBlock`) and primitives (`Section`, `SectionHeader`, `Media`,
`CMSLink`, `Card` from `@intecion/ipal-kit/blocks/rsc`), added to `extra` in `createBlockRegistry`.
Record the reason in AGENTS.md → "Project decisions" (`ipal-doctor` warns about own blocks that copy a library block).
Record the reason in AGENTS.md → "Project decisions" (`iapl-doctor` warns about own blocks that copy a library block).
**Check (library block):** `pnpm generate:types` → `pnpm payload generate:importmap` → Postgres/SQLite
`pnpm payload migrate:create`; add the block to a page in the panel (en and pl labels, ≤ 6 fields), the page shows
@@ -83,6 +83,6 @@ File patterns (Hero, FeatureGrid + FeatureCard): `resources/section-code.md`.
readable in English and Polish (switch the admin language in Account),
"+ Add Button / Add Feature", collapsed rows showing their content, every field shows something.
First `rowLabel` in the project → `pnpm payload generate:importmap`.
- Run the **ipal-audit** skill (`--quick`), fix every `[ERROR]`.
- Run the **iapl-audit** skill (`--quick`), fix every `[ERROR]`.
- Refactoring an existing block with renamed fields: **migrate the data first**
(old field → new), and only then remove the old fields (AGENT.md §6.7).
@@ -1,6 +1,6 @@
# Section code — ready files for the project
> Resources of the **ipal-block** skill. The rules (why, and what not to do) are in
> Resources of the **iapl-block** skill. The rules (why, and what not to do) are in
> `node_modules/@intecion/ipal-kit/docs/agent/AGENT.md` §6 — this file is only the code
> to create in the project **1:1**. Links (`buildLinkField`, `buildLinksField`,
> `resolveLink`), section fields (`buildSectionHeaderField`, `buildSectionSettingsField`) and the menu
@@ -325,7 +325,7 @@ The design-token standard (`node_modules/@intecion/ipal-kit/docs/design-tokens.m
`text-fg-strong`, `text-fg-muted`, `text-on-primary`, `border-border`, `text-link`, `outline-focus`, `text-h1`…,
`py-section`, `px-gutter`, `gap-gap`, `rounded-control`, `rounded-card`, `shadow-sm`, `max-w-container`.
**Never** hex, `bg-[#ff6600]`, `var(--color-…)`, or `dark:` for colours (the roles switch with the theme).
- The brand is `src/design/tokens.ts` → `pnpm exec ipal-tokens` → `src/design/tokens.css`; `DESIGN.md` describes it.
- The brand is `src/design/tokens.ts` → `pnpm exec iapl-tokens` → `src/design/tokens.css`; `DESIGN.md` describes it.
- Fonts via `next/font` with `variable: '--font-family-body'` / `'--font-family-heading'` on `<html>`.
- No CSS Modules and no `style={{…}}` — exception: a dynamic value from data.
- Visual variants → `Record<Variant, string>` (§6.3), not ternary chains.
@@ -336,7 +336,7 @@ The design-token standard (`node_modules/@intecion/ipal-kit/docs/design-tokens.m
@import "@intecion/ipal-kit/fluid-wide.css";
@import "@intecion/ipal-kit/tokens.css";
@import "@intecion/ipal-kit/tailwind.css";
@import "../../design/tokens.css"; /* generated by ipal-tokens from src/design/tokens.ts */
@import "../../design/tokens.css"; /* generated by iapl-tokens from src/design/tokens.ts */
@source "../../../node_modules/@intecion/ipal-kit/dist/**/*.js";
```
+7 -7
View File
@@ -1,12 +1,12 @@
---
name: ipal-collection
description: Decides whether something should be a Payload collection, a global, or a block, and builds a content collection the ipal-kit way (title, buildSlugField, SEO tab, buildNoindexField, trackSlugHistoryHook, revalidate hook, archive page from System pages, sitemap and routing via content option). Use when the user asks for a blog, news, products, portfolio, testimonials, authors, categories, or any new collection — and whenever you are about to create a file in src/collections.
name: iapl-collection
description: Decides whether something should be a Payload collection, a global, or a block, and builds a content collection the IAPL way (title, buildSlugField, SEO tab, buildNoindexField, trackSlugHistoryHook, revalidate hook, archive page from System pages, sitemap and routing via content option). Use when the user asks for a blog, news, products, portfolio, testimonials, authors, categories, or any new collection — and whenever you are about to create a file in src/collections.
---
# ipal-collection
# iapl-collection
**ipal-kit first (hard rule, AGENT.md "ipal-kit first"):** anything the plugin covers is built with the
plugin's feature. It does not work or is not enough → report it with **ipal-plugin-gap** and wait for the owner's
**IAPL first (hard rule, AGENT.md "IAPL first"):** anything the plugin covers is built with the
plugin's feature. It does not work or is not enough → report it with **iapl-plugin-gap** and wait for the owner's
decision on that part; no hand-built replacement, no silent workaround. **Code rules:** AGENT.md "Code rules"
(one job per file/component/function, no duplicates, typed, texts from the panel, a check for new behaviour).
@@ -22,7 +22,7 @@ Answer these 4 questions for the user — all must be YES:
Any NO → it is not a collection:
- one set of data (company, menu, footer, settings) → **global**,
- part of a page (FAQ, hero, testimonials in a section) → **block** (ipal-block skill),
- part of a page (FAQ, hero, testimonials in a section) → **block** (iapl-block skill),
- `users` → the plugin injects it when the project has none; create your own collection with that slug
only to add fields (it wins over the injected one; roles and 2FA attach to it).
@@ -57,5 +57,5 @@ Ask only when the brief leaves a business question open (e.g. "do posts have aut
6. Postgres with migrations → `pnpm payload migrate:create`.
## 4. Check
The **ipal-audit** skill. By hand: an entry in the panel → visible at `/<locale>/<archive>/<slug>`,
The **iapl-audit** skill. By hand: an entry in the panel → visible at `/<locale>/<archive>/<slug>`,
in the sitemap; changing the slug → 308 from the old address.
+14 -14
View File
@@ -1,9 +1,9 @@
---
name: ipal-consent-check
description: Proves in a real browser (Playwright) that an ipal-kit site respects cookie consent — no Meta/Clarity/LinkedIn/TikTok/Ads requests and no tracking cookies before a decision or after "reject", Google only with Consent Mode "denied" signals, tags starting after "accept". Use after adding analytics, pixels, embeds (YouTube, maps, chat) or third-party scripts, before handing a site over, and whenever GDPR/RODO or cookie banner behaviour is in question.
name: iapl-consent-check
description: Proves in a real browser (Playwright) that an IAPL site respects cookie consent — no Meta/Clarity/LinkedIn/TikTok/Ads requests and no tracking cookies before a decision or after "reject", Google only with Consent Mode "denied" signals, tags starting after "accept". Use after adding analytics, pixels, embeds (YouTube, maps, chat) or third-party scripts, before handing a site over, and whenever GDPR/RODO or cookie banner behaviour is in question.
---
# ipal-consent-check
# iapl-consent-check
GDPR: non-Google tags load **only after consent**; Google (GA4/GTM) may
load earlier only with the Consent Mode "denied" signal and without cookies.
@@ -19,7 +19,7 @@ before analytics or marketing consent — check the project's choice in "Project
2. Start the app (`pnpm build && pnpm start`) and check **a page with tags**
(ideally the homepage and a page with a form/video):
```bash
node .agents/skills/ipal-consent-check/scripts/consent-check.mjs http://localhost:3000/pl
node .agents/skills/iapl-consent-check/scripts/consent-check.mjs http://localhost:3000/pl
```
`--wait 6000` when tags start slowly (`defer` mode in Analytics).
3. Output: three runs in clean profiles — no decision, "Accept",
@@ -34,16 +34,16 @@ before analytics or marketing consent — check the project's choice in "Project
4. The "after accept" section shows what starts after consent — compare it with the IDs in Site
Integrations (e.g. is Meta Pixel there, if the client has one). Nothing starts
but IDs are filled in → report it as a problem to diagnose (**ipal-debug**).
but IDs are filled in → report it as a problem to diagnose (**iapl-debug**).
5. Banner not found (`data-ipal="banner"`) → `<CookieBanner/>` is not
rendered, or an older ipal-kit version without `data-ipal` attributes on the buttons → **ipal-upgrade**.
rendered, or an older IAPL version without `data-ipal` attributes on the buttons → **iapl-upgrade**.
The script needs buttons with `data-ipal="accept"` / `"reject"` — the plugin's
`CookieBanner` has them in every `settings` mode (`inline`, `modal`, `detailed`). A custom banner in the project violates AGENT.md §7.
## Cookie list from the panel (`cookieScanner`)
When the project has `ipalKit({ cookieScanner: true })` (cookie-scanner.md), the editor fills the
When the project has `iapl({ cookieScanner: true })` (cookie-scanner.md), the editor fills the
list in the panel and you check it:
1. Not on yet → turn it on, `pnpm generate:importmap`, `pnpm payload migrate:create cookie-scanner`
@@ -51,7 +51,7 @@ list in the panel and you check it:
chat): add them as `cookieScanner.declarations` (or an `integrations` entry with `isEnabled`) —
never a hand-typed list in code.
2. *Privacy → Cookies → Review and approve* → **Scan cookies** (with `adminLayout: 'separate'`: *Privacy → Cookie review*). "Integrations in use" must match the IDs in Site
Integrations; a filled ID that is missing → **ipal-debug**.
Integrations; a filled ID that is missing → **iapl-debug**.
3. Run the browser scan below and paste every cookie it reports as unknown into **More cookie
names**, scan again. Cookies marked **Needs description** need provider, category and
purpose: ask the client, do not guess (Edit on the approval page opens the entry).
@@ -73,9 +73,9 @@ list in the panel and you check it:
When the project has `cookieScanner: { crawl: true }` (cookie-scanner.md → Browser crawl):
1. Not on yet and the client wants it → turn it on; env `IPAL_COOKIE_SCAN_URL` +
`IPAL_COOKIE_SCAN_TOKEN` (`openssl rand -hex 32`) in Coolify; ask the team to add
`<host>=<token>` to the scanner service's `IPAL_CRAWLER_SITES`; `generate:importmap`,
1. Not on yet and the client wants it → turn it on; env `IAPL_COOKIE_SCAN_URL` +
`IAPL_COOKIE_SCAN_TOKEN` (`openssl rand -hex 32`) in Coolify; ask the team to add
`<host>=<token>` to the scanner service's `IAPL_CRAWLER_SITES`; `generate:importmap`,
`migrate:create cookie-crawl`. Never add Playwright or Chromium to the site.
2. *Cookie review* → **Check site**. "Check site" disabled → the box names the missing variable.
Failed → *Privacy → Cookie check → Error* ("Could not reach the scanner service" = URL / DNS /
@@ -88,7 +88,7 @@ When the project has `cookieScanner: { crawl: true }` (cookie-scanner.md → Bro
before handover. A crawl never adds anything to the cookie banner by itself.
5. Optional: recipients in *Cookie check → Warning e-mails to* (the e-mail also says when cookies
wait for approval and links to the approval page), and a weekly Coolify scheduled task
`curl -X POST -H "Authorization: Bearer $IPAL_COOKIE_SCAN_TOKEN" $NEXT_PUBLIC_SERVER_URL/api/ipal/cookie-crawl`.
`curl -X POST -H "Authorization: Bearer $IAPL_COOKIE_SCAN_TOKEN" $NEXT_PUBLIC_SERVER_URL/api/ipal/cookie-crawl`.
Record both in `AGENTS.md` → "Project decisions".
## Cookie list for the cookie policy (cookie-scan)
@@ -99,7 +99,7 @@ unknown names to the panel scan above instead of step 2):
1. Scan the running site (without consent and after "Accept all", homepage + up to 10 pages from the sitemap):
```bash
node .agents/skills/ipal-consent-check/scripts/cookie-scan.mjs http://localhost:3000 --lang pl
node .agents/skills/iapl-consent-check/scripts/cookie-scan.mjs http://localhost:3000 --lang pl
```
Output: `cookie-scan/cookies.json` and `cookie-scan/cookies.md` (table). `[ERROR]` = a
**non-necessary cookie set before consent** — fix it as in the table above. `[WARNING] unknown` —
@@ -107,7 +107,7 @@ unknown names to the panel scan above instead of step 2):
in `cookies.json`. Do not guess — ask if you do not know.
2. Import into the panel (Cookies → Cookie list), each language separately (scan with `--lang en` for English):
```bash
LOCALE=pl pnpm payload run .agents/skills/ipal-consent-check/scripts/import-cookies.ts cookie-scan/cookies.json
LOCALE=pl pnpm payload run .agents/skills/iapl-consent-check/scripts/import-cookies.ts cookie-scan/cookies.json
```
It merges by name and does not overwrite editor changes (`OVERWRITE=1` forces it). It does not delete cookies
the scan did not see — the editor does that in the panel. The same list feeds the
@@ -1,5 +1,5 @@
#!/usr/bin/env node
// ipal-consent-check — proves in a real browser that tracking waits for consent (GDPR).
// iapl-consent-check — proves in a real browser that tracking waits for consent (GDPR).
// node consent-check.mjs <pageUrl> [--wait 4000]
// Three runs, each in a fresh browser profile:
// 1. no decision → no third-party pixels, no tracking cookies, Google only with "denied" signals
@@ -22,7 +22,7 @@ for (const mod of ['playwright', 'playwright-core', '@playwright/test']) {
try { pw = await import(mod); break } catch { /* next */ }
}
if (!pw) {
console.error('ipal-consent-check: Playwright not found. Install: pnpm add -D playwright && pnpm exec playwright install chromium')
console.error('iapl-consent-check: Playwright not found. Install: pnpm add -D playwright && pnpm exec playwright install chromium')
process.exit(2)
}
const { chromium } = pw.default ?? pw
@@ -60,7 +60,7 @@ const run = async (label, action) => {
try {
await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 30000 })
} catch (e) {
console.error(`ipal-consent-check: cannot open ${url} (${e.message.split('\n')[0]})`)
console.error(`iapl-consent-check: cannot open ${url} (${e.message.split('\n')[0]})`)
await browser.close()
process.exit(2)
}
@@ -108,7 +108,7 @@ const inspect = (r, mustBeQuiet) => {
}
const first = await run('1. no decision')
if (!first.banner) warnings.push('1. no decision: cookie banner [data-ipal="banner"] not found — is <CookieBanner/> rendered? Older ipal-kit versions lack data-ipal attributes on buttons.')
if (!first.banner) warnings.push('1. no decision: cookie banner [data-ipal="banner"] not found — is <CookieBanner/> rendered? Older IAPL versions lack data-ipal attributes on buttons.')
const s1 = inspect(first, true)
const accepted = await run('2. accept all', 'accept')
@@ -126,9 +126,9 @@ await browser.close()
info.push(`before consent: Google tag ${s1.google ? 'loaded (Consent Mode, OK if gcs denied)' : 'not loaded'}`)
info.push(`after accept: ${s2.pixelHits.length ? s2.pixelHits.join(', ') : 'no third-party pixels'}${s2.google ? ' + Google' : ''}; cookies: ${accepted.cookies.filter((c) => TRACKING_COOKIES.test(c)).join(', ') || 'none'}`)
console.log(`ipal-consent-check — ${url}`)
console.log(`iapl-consent-check — ${url}`)
for (const v of violations) console.log(`[ERROR] ${v}`)
for (const w of warnings) console.log(`[WARNING] ${w}`)
for (const i of info) console.log(` · ${i}`)
console.log(`ipal-consent-check: ${violations.length} violation(s), ${warnings.length} warning(s)`)
console.log(`iapl-consent-check: ${violations.length} violation(s), ${warnings.length} warning(s)`)
process.exit(violations.length ? 1 : 0)
@@ -1,5 +1,5 @@
#!/usr/bin/env node
// ipal cookie-scan — lists every cookie (and localStorage key) a running site sets, for the cookie policy.
// IAPL cookie-scan — lists every cookie (and localStorage key) a running site sets, for the cookie policy.
// node cookie-scan.mjs <baseUrl> [--pages 10] [--lang pl|en] [--out cookie-scan] [--wait 3000]
// Two fresh browser profiles: before any decision, and after "Accept all" (data-ipal="accept").
// Pages: the base URL + up to --pages URLs from /sitemap.xml.
@@ -174,5 +174,5 @@ if (unknown.length) {
}
if (after.storage.length) {console.log(`\nlocalStorage keys (mention in the policy if they hold personal data): ${after.storage.join(', ')}`)}
console.log(`\n${cookies.length} cookie(s) → ${path.join(OUT, 'cookies.json')}, ${path.join(OUT, 'cookies.md')}`)
console.log(`Import into the panel: LOCALE=${LANG} pnpm payload run .agents/skills/ipal-consent-check/scripts/import-cookies.ts ${path.join(OUT, 'cookies.json')}`)
console.log(`Import into the panel: LOCALE=${LANG} pnpm payload run .agents/skills/iapl-consent-check/scripts/import-cookies.ts ${path.join(OUT, 'cookies.json')}`)
process.exit(errors ? 1 : 0)
@@ -3,7 +3,7 @@
* cookie policy page (<CookieTable>) and the detailed consent window
* (<CookieBanner settings="detailed">) list what the site really sets.
*
* LOCALE=pl pnpm payload run .agents/skills/ipal-consent-check/scripts/import-cookies.ts cookie-scan/cookies.json
* LOCALE=pl pnpm payload run .agents/skills/iapl-consent-check/scripts/import-cookies.ts cookie-scan/cookies.json
* # second language: scan again with --lang en, then import with LOCALE=en
* # (rows are matched by cookie name; only purpose/duration are localized)
*
+36 -36
View File
@@ -1,9 +1,9 @@
---
name: ipal-debug
description: Systematic diagnosis for ipal-kit / Payload 3 / Next 16 projects — reproduce, classify (project code, configuration, panel data, environment, or an ipal-kit bug), fix the cause, prove it. Includes a symptom → cause → fix table of every failure seen so far (TS2307, static→dynamic, metadata in body, 404 per locale, importMap, duplicate @payloadcms/ui, emails, R2, Turnstile, hydration). Use whenever something fails — build, type check, runtime error, wrong behaviour, "it worked yesterday" — before asking the user anything.
name: iapl-debug
description: Systematic diagnosis for IAPL / Payload 3 / Next 16 projects — reproduce, classify (project code, configuration, panel data, environment, or an IAPL bug), fix the cause, prove it. Includes a symptom → cause → fix table of every failure seen so far (TS2307, static→dynamic, metadata in body, 404 per locale, importMap, duplicate @payloadcms/ui, emails, R2, Turnstile, hydration). Use whenever something fails — build, type check, runtime error, wrong behaviour, "it worked yesterday" — before asking the user anything.
---
# ipal-debug
# iapl-debug
Do not guess, do not rewrite blindly, and do not ask the user before you have gone
through this procedure. Ask only when you are missing something you cannot get yourself
@@ -19,71 +19,71 @@ through this procedure. Ask only when you are missing something you cannot get y
| configuration? | `payload.config.ts`, `next.config.ts`, `proxy.ts`, `.env` vs `docs/env.md` |
| panel data? | does the same page in another language / another document work? Was `Save` clicked? |
| environment? | `rm -rf .next`, restart dev, `pnpm install`, versions: `pnpm why @payloadcms/ui` |
| ipal-kit? | error in `node_modules/@intecion/ipal-kit/dist/…`, behaviour that contradicts `docs/<module>.md` |
| IAPL? | error in `node_modules/@intecion/ipal-kit/dist/…`, behaviour that contradicts `docs/<module>.md` |
3. **The table below** — most errors have happened before.
4. **Fix the cause**, not the symptom (`as any`, a `try/catch` that swallows the error,
`force-dynamic` "to make it work", copying plugin code into the project = **no**).
5. **Prove it**: the same command from step 1 passes + `ipal-audit --quick` +
(rendering/SEO) `ipal-seo-check` on the build.
6. Bug on the ipal-kit side → an **ipal-plugin-gap** report to the owner and **wait for the decision** — no
5. **Prove it**: the same command from step 1 passes + `iapl-audit --quick` +
(rendering/SEO) `iapl-seo-check` on the build.
6. Bug on the IAPL side → an **iapl-plugin-gap** report to the owner and **wait for the decision** — no
workaround on your own. Only an approved workaround goes in, marked
(`// WORKAROUND ipal-kit <version>: <description>`) and recorded in `AGENTS.md` → "Project decisions".
(`// WORKAROUND IAPL <version>: <description>`) and recorded in `AGENTS.md` → "Project decisions".
## Symptom → cause → fix
### Build / TypeScript
| Symptom | Cause | Fix |
|---|---|---|
| the 2FA code screen answers "Too many codes were tried…" (`429` from `/api/verify-totp`) | more than 5 verify attempts for that account in 10 minutes (`twoFactor.verifyLimit`); repeated lines `[ipal] 2FA: too many verify attempts` in the log without the owner trying = someone has the password | wait for the window, enter the current code once; unexplained attempts: change that account's password. Tests that log in often: `verifyLimit: { max: … }` for that environment |
| the 2FA code screen answers "Too many codes were tried…" (`429` from `/api/verify-totp`) | more than 5 verify attempts for that account in 10 minutes (`twoFactor.verifyLimit`); repeated lines `[iapl] 2FA: too many verify attempts` in the log without the owner trying = someone has the password | wait for the window, enter the current code once; unexplained attempts: change that account's password. Tests that log in often: `verifyLimit: { max: … }` for that environment |
| `isAdmin(req.user)` says `false` for a real administrator on the server, in a process that loads two Payload configs (tests, a multi-site script) | a call without a source counts only collections that are staff in **every** config of the process | pass the source: `isAdmin(req.user, req.payload)` — with it each config gets its own answer |
| `isAdmin(user)` / `isEditor(user)` is always `false` in a client component or in `proxy.ts` | the staff collections are not known there (no config in the browser bundle / middleware), and the predicates fail closed | `isAdmin(user, config)` with `useConfig()`, imported from `@intecion/ipal-kit/client`; in middleware `isAdmin(user, { staffCollections: ['users'] })` |
| `next build --webpack`: `'server-only' cannot be imported from a Client Component module … caused by importing '@intecion/ipal-kit/dist/index.js'` | a `'use client'` file imports the main entry (Turbopack lets it pass) | import from `@intecion/ipal-kit/client` (role predicates are there since 1.16.7; types: `import type` from the main entry is fine); data the browser needs → a prop from a server component |
| an account logs in but every page and request answers 403 / the setup screen says "The time to set up two-step verification has passed" | 2FA setup required: the account did not set TOTP up within the window (72 h from its creation, an admin's reset, or the first start after the upgrade) | an administrator opens the account in the panel → Two-step verification → "Reopen setup" (or `POST /api/ipal/two-factor/reset` `{ userId }`); every administrator is blocked: security.md "Every administrator is blocked" — a script with the Local API, `payload.update({ collection: 'users', id, data: { totpSetupFrom: new Date().toISOString() } })` (`pnpm payload run`), then log in and set TOTP up; or `requireSetup: { windowHours: false }`, redeploy, set up, put it back |
| a new account gets `403` from the API although its role allows the request | 2FA setup required: until TOTP is set up the account reaches only the setup screen | set TOTP up (log in to the panel); an integration: use an API key, or `twoFactor.requireSetup.exempt` |
| after an upgrade EVERY panel login answers `500` (also `/api/users/init`), administrators with 2FA included; log: `[ipal] 2FA: the column for "totpSetupFrom" is missing … NOBODY CAN LOG IN` or `column users.totp_setup_from does not exist` | Postgres/SQLite: the migration that adds the 2FA column has not run (needed whenever 2FA is on) | `pnpm payload migrate:create` if no migration has it, commit, and redeploy with migrations run when the new container starts — `prodMigrations` in the adapter or the start command `pnpm payload migrate && pnpm start` (deployment.md §4.3; not Coolify's Pre-deployment command, which runs in the old container); nothing is lost. `ipal-doctor` reports a project whose migrations lack `totp_setup_from` |
| the site does not start: `[ipal] twoFactor.requireSetup.exempt must not be async` / `…windowHours must be a number` | `exempt` is an `async` function, or `windowHours` is a string / negative | `exempt: ({ user }) => user.email === '…'` (returns `true` / `false` at once); `windowHours: 72` or `false` |
| log: `[ipal] twoFactor.requireSetup.exempt returned a Promise … The account is NOT exempt` (and the service account gets 403) | `exempt` does not return exactly `true` | return a boolean decided from the fields on `user` |
| after an upgrade EVERY panel login answers `500` (also `/api/users/init`), administrators with 2FA included; log: `[iapl] 2FA: the column for "totpSetupFrom" is missing … NOBODY CAN LOG IN` or `column users.totp_setup_from does not exist` | Postgres/SQLite: the migration that adds the 2FA column has not run (needed whenever 2FA is on) | `pnpm payload migrate:create` if no migration has it, commit, and redeploy with migrations run when the new container starts — `prodMigrations` in the adapter or the start command `pnpm payload migrate && pnpm start` (deployment.md §4.3; not Coolify's Pre-deployment command, which runs in the old container); nothing is lost. `iapl-doctor` reports a project whose migrations lack `totp_setup_from` |
| the site does not start: `[iapl] twoFactor.requireSetup.exempt must not be async` / `…windowHours must be a number` | `exempt` is an `async` function, or `windowHours` is a string / negative | `exempt: ({ user }) => user.email === '…'` (returns `true` / `false` at once); `windowHours: 72` or `false` |
| log: `[iapl] twoFactor.requireSetup.exempt returned a Promise … The account is NOT exempt` (and the service account gets 403) | `exempt` does not return exactly `true` | return a boolean decided from the fields on `user` |
| an administrator's "Reset two-step verification" answers 403 from a script with an API key, or for an exempt account | by default the reset needs a session that entered its own TOTP code | reset from the panel after logging in with the code; or `twoFactor.resetAccess: ({ req }) => …` |
| after "Reset two-step verification" the user is logged out everywhere | intended: the reset ends the account's sessions | the user logs in again with the password and sets 2FA up; after a suspected compromise also change the password |
| no "Two-step verification" box on the account page / no "Reopen setup" | the import map lacks `TwoFactorStatusField` (not regenerated), or `requireSetup: { statusField: false }` | `pnpm payload generate:importmap`, commit, redeploy; meanwhile `POST /api/ipal/two-factor/reset` `{ userId }` works |
| "Two-step verification" is missing on the account page / the dashboard shows a missing component | the import map is stale | `pnpm payload generate:importmap`, commit `importMap.js`, `rm -rf .next`, redeploy |
| startup: `[ipal] twoFactor: the injected 2FA plugin did not add the totpSecret field / hasTotp field / totp auth strategy` | the installed `@clocklimited/payload-2fa` is not a version ipal-kit's second-factor check recognises (tested: 3.0.0-beta.1 and beta.7), or a custom factory was injected | install a supported version; stop-gap only: `twoFactor.guard: false` (the plugin's own data is then not covered by 2FA — security.md) |
| startup: `[iapl] twoFactor: the injected 2FA plugin did not add the totpSecret field / hasTotp field / totp auth strategy` | the installed `@clocklimited/payload-2fa` is not a version IAPL's second-factor check recognises (tested: 3.0.0-beta.1 and beta.7), or a custom factory was injected | install a supported version; stop-gap only: `twoFactor.guard: false` (the plugin's own data is then not covered by 2FA — security.md) |
| own route or script gets `403` / "not allowed" on `form-submissions`, `forms`, a settings global with `overrideAccess: false`, although the user is an admin | the `user` was fetched by id and passed by hand: it does not carry how the account logged in, so the second-factor check refuses it | take the user from `payload.auth({ headers })` (it sets `collection` and how the account logged in), or (server-only code that needs no access check) leave `overrideAccess` at its default; a hand-built user needs at least `collection: 'users'` for its role to count |
| an account of a second auth collection (`customers`) gets `403` from a settings global, submissions, `/api/ipal/*`, `/api/setup-totp`, or `isAdmin` / `adminOnly` say no although it has `roles: ['admin']`, after an upgrade | by design since 1.16.4: roles and staff checks count only for accounts of a staff collection | write the one rule it needs (`formSubmissionOverrides`, `globalOverrides`, `collectionOverrides`); a second STAFF collection: `access.staffCollections` (access.md "Who is staff") |
| `TS2307 next/navigation` in the plugin's `dist` | import without `.js` in the plugin client (NodeNext) | **ipal-kit bug** → plugin gap; the plugin imports `'next/navigation.js'` |
| `TS2307 next/navigation` in the plugin's `dist` | import without `.js` in the plugin client (NodeNext) | **IAPL bug** → plugin gap; the plugin imports `'next/navigation.js'` |
| `TS2307 @payloadcms/storage-s3` | package missing when using `buildR2Storage` | `pnpm add @payloadcms/storage-s3` + `buildR2Storage(['media'], { s3Storage })` |
| `does not provide an export named X` / `X is not a function` | symbol not exported from the entry point, or wrong subpath (`/client` vs root vs `/server` vs `/rsc`) | `docs/README.md` → the right import; missing from every entry → **ipal-kit bug** (export) |
| `does not provide an export named X` / `X is not a function` | symbol not exported from the entry point, or wrong subpath (`/client` vs root vs `/server` vs `/rsc`) | `docs/README.md` → the right import; missing from every entry → **IAPL bug** (export) |
| `Cannot find module '@clocklimited/payload-2fa'` | not injected | `twoFactor: { plugin: payloadTotp }` (`serverExternalPackages` does not help — it fails on `.css`) |
| `TS2322` on `plugin: payloadTotp` (`string` vs `CollectionSlug`) | ipal-kit ≤ 1.8.13 typed `collection` as `string` | update ipal-kit; remove the adapter/cast |
| `TS2322` on `plugin: payloadTotp` (`string` vs `CollectionSlug`) | IAPL ≤ 1.8.13 typed `collection` as `string` | update IAPL; remove the adapter/cast |
| `Page changed from static to dynamic at runtime` | `headers()`, `cookies()`, `searchParams` in the page tree (often `not-found.tsx`) | locale from `params`; `not-found` → `LocaleView` (pages.md); `headers()` only in server actions / route handlers |
| `ƒ` routes despite `generateStaticParams` | the build cannot see the database | `DATABASE_URI` in the build (PROGRAMISTA §4.3) |
| build fails with `ENOTFOUND` / Mongoose | a route reads the database during a build without a database | routes that read the database (sitemap.xml, manifest, llms.txt, llms-full.txt, api/health): `export const dynamic = 'force-dynamic'` (only these, not pages) |
| `slug.join is not a function` | `[slug]` instead of `[[...slug]]` | rename the folder |
| `Missing <html> and <body>` | `[locale]` layout without `<html>` after the root layout was removed | `<html lang>` and `<body>` in `[locale]/layout.tsx` |
| `Export fileTypeFromFile doesn't exist in target module` (Turbopack, dev start) | `instrumentation.ts` imports from the package root → Payload in the Edge bundle | import from `@intecion/ipal-kit/env` + `NEXT_RUNTIME === 'nodejs'` (env.md) |
| `R2_PUBLIC_URL must be a valid URL (got "/media")` | old version of the rule / production with a relative path | dev: `/media` allowed since the new version; production: full URL of the media domain, or leave it empty (media through the app; optional since `ipalEnvRules` makes it so by default, env.md) |
| `R2_PUBLIC_URL must be a valid URL (got "/media")` | old version of the rule / production with a relative path | dev: `/media` allowed since the new version; production: full URL of the media domain, or leave it empty (media through the app; optional since `iaplEnvRules` makes it so by default, env.md) |
| `server-only` in the client | import from `@intecion/ipal-kit/server` in `'use client'` | call it through a server action |
### Admin panel (`/admin`)
| Symptom | Cause | Fix |
|---|---|---|
| `PayloadComponent not found in importMap` (e.g. `@intecion/ipal-kit/admin#RowLabel`) | importMap out of date after a plugin update / adding `rowLabel` | `pnpm payload generate:importmap`, restart |
| after an upgrade the 2FA setup / verify screen has no code form (HTTP 200), only the notice "Two-step verification may not be available" (or nothing at all with `importMapCheck: false` / an own provider); nobody can sign in; the log has `[ipal] The admin import map may be out of date` and `getFromImportMap: PayloadComponent not found in importMap … @intecion/ipal-kit/admin#SafeTotpView` | the import map was not regenerated after the upgrade that added the `back` link check (`twoFactor.safeBack`); the production build uses the committed, old `importMap.js` | `pnpm payload generate:importmap`, commit `importMap.js`, `rm -rf .next`, redeploy; `pnpm exec ipal-doctor` shows it before a deploy. The opposite case (wrapper present, package view missing) throws `[ipal] The admin import map has no "@clocklimited/payload-2fa/rsc#TOTPVerify"` — same fix |
| the notice "Two-step verification may not be available" and the log line `[ipal] The admin import map may be out of date` appear, but the code form is there and sign-in works | false alarm: the check searches the `importMap.js` on disk, which is not the map inside the build (map generated during the build and a Dockerfile runner stage that copies the repository's file; a map file that re-exports or computes its entries) | `twoFactor: { …, importMapCheck: false }`; or ship the generated `importMap.js` in the image |
| after an upgrade the 2FA setup / verify screen has no code form (HTTP 200), only the notice "Two-step verification may not be available" (or nothing at all with `importMapCheck: false` / an own provider); nobody can sign in; the log has `[iapl] The admin import map may be out of date` and `getFromImportMap: PayloadComponent not found in importMap … @intecion/ipal-kit/admin#SafeTotpView` | the import map was not regenerated after the upgrade that added the `back` link check (`twoFactor.safeBack`); the production build uses the committed, old `importMap.js` | `pnpm payload generate:importmap`, commit `importMap.js`, `rm -rf .next`, redeploy; `pnpm exec iapl-doctor` shows it before a deploy. The opposite case (wrapper present, package view missing) throws `[iapl] The admin import map has no "@clocklimited/payload-2fa/rsc#TOTPVerify"` — same fix |
| the notice "Two-step verification may not be available" and the log line `[iapl] The admin import map may be out of date` appear, but the code form is there and sign-in works | false alarm: the check searches the `importMap.js` on disk, which is not the map inside the build (map generated during the build and a Dockerfile runner stage that copies the repository's file; a map file that re-exports or computes its entries) | `twoFactor: { …, importMapCheck: false }`; or ship the generated `importMap.js` in the image |
| an own 2FA screen (set through the wrapped factory) ignores the check on `back` | a client component reading `useSearchParams()` gets the raw query value | read the `back` prop (or `searchParams.back`) the wrapper passes — both are checked (security.md "Your own 2FA screen") |
| after the 2FA code the user lands on `/admin` instead of the page in `back` | `back` pointed outside the admin route or to another origin (the check keeps only a path inside `routes.admin`; an absolute URL only on the `serverURL` origin) | expected; for another rule pass `twoFactor.safeBack: (back, { adminRoute, origin }) => string` (security.md) |
| new admin stuck on `/admin/setup-totp?back=null` (the page keeps redirecting to itself) | ipal-kit ≤ 1.14.1: the 2FA package's provider needs an `x-pathname` header nothing sets on `/admin`; or `twoFactor.provider: false` without that header | update ipal-kit, `pnpm payload generate:importmap` (`TotpRedirectProvider`), restart; check: `/admin/setup-totp?back=%2Fadmin` shows the QR (security.md) |
| new admin stuck on `/admin/setup-totp?back=null` (the page keeps redirecting to itself) | IAPL ≤ 1.14.1: the 2FA package's provider needs an `x-pathname` header nothing sets on `/admin`; or `twoFactor.provider: false` without that header | update IAPL, `pnpm payload generate:importmap` (`TotpRedirectProvider`), restart; check: `/admin/setup-totp?back=%2Fadmin` shows the QR (security.md) |
| `Cannot destructure property 'config'` / UI hooks without context | two copies of `@payloadcms/ui` | `pnpm why @payloadcms/ui`; one version + `pnpm.overrides`; `ls node_modules/@intecion/ipal-kit/node_modules/@payloadcms` = empty |
| empty SEO tab, no Forms | mismatched `@payloadcms/*` versions | all `@payloadcms/*` = the `payload` version |
| upload rejected "Image is … Tick Optimize" | `buildOptimizeUploadHook` (intended) | tick the checkbox or prepare the file; limit in the hook options |
| video upload rejected | `maxVideoBytes` limit | export as the message says (H.264, 720–1080p, fast start) |
| change in the panel not visible | no Save / ISR without revalidation | collection: `buildRevalidateHook`; your own global (Header, Footer…): `afterChange: [buildGlobalRevalidateHook({ revalidatePath })]` (ipal-nav); the plugin's globals (Site settings, Site integrations, Cookie banner, Notifications): pass `ipalKit({ revalidatePath })` (from `next/cache`) — without it the change waits until the `revalidate` window ends |
| change in the panel not visible | no Save / ISR without revalidation | collection: `buildRevalidateHook`; your own global (Header, Footer…): `afterChange: [buildGlobalRevalidateHook({ revalidatePath })]` (iapl-nav); the plugin's globals (Site settings, Site integrations, Cookie banner, Notifications): pass `iapl({ revalidatePath })` (from `next/cache`) — without it the change waits until the `revalidate` window ends |
### Front end / routing / SEO
| Symptom | Cause | Fix |
|---|---|---|
| `/pl` → 404 | Homepage not assigned in System pages | set it in the panel |
| `/en/*` → 404, `/pl/*` works | slug/title missing in EN | `ipal-locale-add` → `locale-coverage` |
| `/en/*` → 404, `/pl/*` works | slug/title missing in EN | `iapl-locale-add` → `locale-coverage` |
| language switcher → 404 | prefix swap instead of `AlternateLinksUpdater` | i18n.md → AlternateLinks |
| metadata in `<body>` (seo-check) | streaming: no `htmlLimitedBots`, explicit `<head>`, dynamic page | AGENT §4; `generatePageMetadata` |
| canonical / sitemap with localhost | `NEXT_PUBLIC_SERVER_URL` not set in the build | set it in the build env (not only at runtime) |
@@ -99,42 +99,42 @@ through this procedure. Ask only when you are missing something you cannot get y
| banner without styles | Tailwind does not scan the plugin | `@source` on `node_modules/@intecion/ipal-kit/dist/**/*.js` (path relative to the CSS file, PROGRAMISTA §2.5) |
| emails are not sent | no `email: mailAdapter()` / empty transport / empty Emails tab | email.md; Send test in the panel |
| old email sender | mail client cache | check the raw headers |
| form: `unknown_fields` | field outside the definition (honeypot not removed) | `ipal-form` → actions.ts |
| form: `unknown_fields` | field outside the definition (honeypot not removed) | `iapl-form` → actions.ts |
| an account logs in to `/admin` and sees "Unauthorized" (its API calls still work) | `accounts.panelRole`: the panel opens for `editor` and above; the account has only `user`, or no role | give it `editor` (an admin edits the account), or `accounts: { panelRole: 'user' }`; nobody can get in: a script with the Local API sets `roles: ['admin']`, or `accounts: { panelRole: false }` + redeploy |
| `POST /api/<slug>/first-register` answers `403` on an empty collection | `accounts.firstUserRoute`: only the panel's login collection may register its first account that way (the plugin's own endpoint sits in front of Payload's) | an admin creates the account; or the collection's own `create: () => true` (sign-up); or `accounts: { firstUserRoute: ['<slug>'] }` |
| an editor (or a script with its token) gets `403` creating an account in the project's own `users` | `accounts.adminOnlyCreate`: only admins create staff accounts where the roles are the plugin's | create as an admin; or write the collection's `create` rule; or `adminOnlyCreate: false` |
| log at start: `[ipal] No staff account holds the role "admin", so NOBODY can create, delete or unlock accounts in "…"` | a staff collection whose accounts can hold `editor` or `admin` runs on the admin rules, and no staff account is an admin | give one account `admin` with a script (`payload.update`, Local API); or write the collection's own `access.create` / `update` / `delete` |
| log at start: `[iapl] No staff account holds the role "admin", so NOBODY can create, delete or unlock accounts in "…"` | a staff collection whose accounts can hold `editor` or `admin` runs on the admin rules, and no staff account is an admin | give one account `admin` with a script (`payload.update`, Local API); or write the collection's own `access.create` / `update` / `delete` |
| an account with a role of the project's own (`boss`, `viewer`) gets `403` creating or editing accounts in its staff collection (it worked on 1.16.7) | the collection's `roles` can hold `editor` or `admin` (a select with `hasMany` and one of them, or a text / relationship field with `hasMany`, or json; a single-valued field is not affected): the admin rules apply | do it as an admin; or write the collection's own rules for that role |
| log at start: `[ipal] Could not check whether an account of "…" holds the role "admin"` | the accounts of that staff collection could not be read or are more than 1000, and no other staff account is an admin | make sure one account holds `admin`; nothing is wrong if one does |
| log at start: `[iapl] Could not check whether an account of "…" holds the role "admin"` | the accounts of that staff collection could not be read or are more than 1000, and no other staff account is an admin | make sure one account holds `admin`; nothing is wrong if one does |
| an account gets `403` changing or deleting ANOTHER account of a staff collection (it worked before) | `accounts.adminOnlyWrite`: an admin, or the account itself (update only); on a collection with roles of its own: accounts of that collection | do it as an admin; or write the collection's `update` / `delete` rule; or `adminOnlyWrite: false` |
| an account saves its own profile and its `roles` do not change (no error) | `accounts.adminOnlyWrite`: nobody changes its own roles; with the plugin's roles only an admin changes roles | an admin changes the role; or give the `roles` field its own `access.update` |
| a logged-in visitor (customer) gets `403` reading a staff collection — an author box went empty | `accounts.staffOnlyRead`: only staff accounts read a staff collection without a `read` rule | write that collection's `read` rule; or `staffOnlyRead: false` |
| `/api/health` answers 503, the panel and `/api/*` 500 after a deploy; log: `[ipal] access names "…" as a staff collection, but this config has no auth collection with that slug` | a slug in `access.staffCollections` / `access.authCollection` is not an auth collection (a typo, a removed collection): Payload does not start, the process stays up (with a health check Coolify keeps the old container) | fix the slug or add the collection |
| the log says `"<slug>" became a staff collection after ipalKit ran` | a plugin listed after ipalKit set `admin.user` to a collection of your config that is not named as staff: the operations without a rule of yours got the plugin's, yours are kept (named in the same line) | name the collection in `access.staffCollections` (or `access.authCollection`), or list that plugin before ipalKit |
| a collection added by a plugin listed after ipalKit refuses what its own access rule allows | it is in `access.staffCollections`: the plugin's account rules are put in front of its rules and both must allow (the log at start lists what was put) | `custom: { ipal: { accountRules: false } }` on that collection, or list that plugin before ipalKit |
| `/api/health` answers 503, the panel and `/api/*` 500 after a deploy; log: `[iapl] access names "…" as a staff collection, but this config has no auth collection with that slug` | a slug in `access.staffCollections` / `access.authCollection` is not an auth collection (a typo, a removed collection): Payload does not start, the process stays up (with a health check Coolify keeps the old container) | fix the slug or add the collection |
| the log says `"<slug>" became a staff collection after iapl ran` | a plugin listed after iapl set `admin.user` to a collection of your config that is not named as staff: the operations without a rule of yours got the plugin's, yours are kept (named in the same line) | name the collection in `access.staffCollections` (or `access.authCollection`), or list that plugin before iapl |
| a collection added by a plugin listed after iapl refuses what its own access rule allows | it is in `access.staffCollections`: the plugin's account rules are put in front of its rules and both must allow (the log at start lists what was put) | `custom: { ipal: { accountRules: false } }` on that collection, or list that plugin before iapl |
| a fresh site with `access.firstUserAdmin: false`: the first account sees "Unauthorized", or the start fails with `leaves a fresh site with nobody who can open the panel` | the first account gets the default role, below the panel role | `access.defaultRole: 'editor'`, or `accounts: { panelRole: false }`, or drop `firstUserAdmin: false` |
| saving Site integrations fails on the password field: "Enter the password again…" | the server, port or user name changed and the stored SMTP password is kept only for the settings it was saved with — also when the transport says Microsoft Graph | type the password again; or "Remove the stored value" for a server without one; a seed with the Local API is not asked; `secrets: { reenterOnChange: false }` |
| creating an account / changing a password fails with "The password must have at least 12 characters." | `accounts.password` (applies to new passwords of staff accounts, in scripts too) | a longer password; `accounts: { password: { minLength } }` or `false` |
| the API returns `"smtpPassword":"********"` / own code "lost" the SMTP password or Turnstile secret | write-only secrets: reads through access control never get the value | read on the server: `payload.findGlobal({ slug: 'site-integrations' })` (access control off); `secrets: { writeOnly: false }` restores the old behaviour |
| the SMTP password "disappears" after saving Site integrations | it does not: the field shows "A value is set"; an empty save keeps it | to change it type a new one; to remove it press "Remove the stored value" (API: `'[[clear]]'`) |
| a form with a File field answers "verification failed" while text forms work | Turnstile is degraded (wrong / missing secret, Cloudflare down) and forms with files fail closed | fix the keys (Site integrations → Spam protection; dashboard alert; `ipal-doctor --url` → `turnstile-degraded`); or `forms: { turnstileOnConfigError: { files: 'allow' } }` |
| `POST /api/verify-totp` (or `setup-totp`) answers `403` "Not allowed from this origin." — **nobody can enter a code** | the request's `Origin` is not one the server knows as its own: a panel or front end on another domain, or a proxy that rewrites `Host` and sends no `X-Forwarded-Host` while `serverURL` is not set. The log names the origin once: `[ipal] 2FA: a code from origin "…" was refused` | set `serverURL` (best); or `twoFactor: { …, sameOrigin: { origins: ['https://<that origin>'] } }`; or make the proxy send `X-Forwarded-Host`; `sameOrigin: false` turns the check off |
| log: `[ipal] Deprecated: the Turnstile secret key comes from the TURNSTILE_SECRET_KEY environment variable` | the panel field is empty and the env variable is used | with the owner: copy the key into Site integrations → Spam protection, test a form, remove the variable; it keeps working meanwhile |
| a form with a File field answers "verification failed" while text forms work | Turnstile is degraded (wrong / missing secret, Cloudflare down) and forms with files fail closed | fix the keys (Site integrations → Spam protection; dashboard alert; `iapl-doctor --url` → `turnstile-degraded`); or `forms: { turnstileOnConfigError: { files: 'allow' } }` |
| `POST /api/verify-totp` (or `setup-totp`) answers `403` "Not allowed from this origin." — **nobody can enter a code** | the request's `Origin` is not one the server knows as its own: a panel or front end on another domain, or a proxy that rewrites `Host` and sends no `X-Forwarded-Host` while `serverURL` is not set. The log names the origin once: `[iapl] 2FA: a code from origin "…" was refused` | set `serverURL` (best); or `twoFactor: { …, sameOrigin: { origins: ['https://<that origin>'] } }`; or make the proxy send `X-Forwarded-Host`; `sameOrigin: false` turns the check off |
| log: `[iapl] Deprecated: the Turnstile secret key comes from the TURNSTILE_SECRET_KEY environment variable` | the panel field is empty and the env variable is used | with the owner: copy the key into Site integrations → Spam protection, test a form, remove the variable; it keeps working meanwhile |
| an editor no longer sees why an integration fails on the dashboard | dashboard alerts by role: details are for admins | an admin looks; or `dashboardAlerts: { integrations: 'editor' }` |
| Turnstile always rejects | the `[ipal] Turnstile …` log says why: no secret, `invalid-input-secret`, `timeout-or-duplicate` | turnstile.md → table; secret in the panel or `TURNSTILE_SECRET_KEY`; **do not** write the secret in code |
| Turnstile always rejects | the `[iapl] Turnstile …` log says why: no secret, `invalid-input-secret`, `timeout-or-duplicate` | turnstile.md → table; secret in the panel or `TURNSTILE_SECRET_KEY`; **do not** write the secret in code |
### Environment
| Symptom | Cause | Fix |
|---|---|---|
| change in the plugin not visible | old version in `node_modules` / `.next` | `pnpm add @intecion/ipal-kit@<version>`, `grep -c <symbol> node_modules/@intecion/ipal-kit/dist/...`, `rm -rf .next`, restart |
| skills out of date after an update | not refreshed | `pnpm exec ipal-skills` |
| `ipal-skills: command not found` | ipal-kit ≤ 1.8.13 did not publish `bin` | update ipal-kit |
| skills out of date after an update | not refreshed | `pnpm exec iapl-skills` |
| `iapl-skills: command not found` | IAPL ≤ 1.8.13 did not publish `bin` | update IAPL |
| "Code is right, behaviour is wrong" | — | in order: restart dev → Save in the panel → duplicate dependency → importmap → cache |
## When it is an ipal-kit bug (report, not a patch in node_modules)
## When it is an IAPL bug (report, not a patch in node_modules)
- the error points to a file in the plugin's `dist` and does not come from misusing the documented API;
- behaviour contradicts `docs/<module>.md`;
- the docs tell you to import something that the entry point does not export;
- you are writing the same boilerplate in a second project in a row (a module candidate).
Then **ipal-plugin-gap**: symptom, minimal reproduction, version, proposed
Then **iapl-plugin-gap**: symptom, minimal reproduction, version, proposed
change in the plugin, the owner's decision (and the approved workaround, if any). **Never** edit `node_modules`.
+19 -19
View File
@@ -1,27 +1,27 @@
---
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.
name: iapl-doctor
description: Checks the whole site against the IAPL team standard with one command (`pnpm exec iapl-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 iapl-* 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 IAPL upgrade, before a deploy, in CI of a new site, and when asked whether a site follows the team rules.
---
# ipal-doctor
# iapl-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`):
1. From the project root (after `pnpm install`, `pnpm payload generate:importmap`, `pnpm exec iapl-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)
pnpm exec iapl-doctor # static: files only, no build, no database
pnpm exec iapl-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
pnpm exec iapl-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
4. A deliberate exception (the owner's decision) goes into `iapl-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" } } }
@@ -42,30 +42,30 @@ Exit `0` ok · `1` findings at or above `--fail-on` · `2` could not run · `3`
## 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
pnpm exec iapl-doctor --strict --offline # after install
pnpm exec iapl-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).
`GET /api/ipal/doctor` is added by `iapl` and answers 404 until the site has `IAPL_DOCTOR_TOKEN` (≥ 32 characters).
Then `Authorization: Bearer <token>`; counts and states only (`usersWithout2fa`, `usersSetupClosed` = of those, blocked because the 2FA setup window has passed, `pendingCookies`, `openSignUp` = slugs of auth collections with open sign-up, `turnstile` = the recorded state of the Turnstile check, `turnstileSecretFromEnv`, `plugin`, `node`) — never a key or a name. With the same
`IPAL_DOCTOR_TOKEN` in the doctor's environment, `--url` reads it. Off: `ipalKit({ doctor: false })`; adapt:
`ipalKit({ doctor: { tokenVar, access } })`.
`IAPL_DOCTOR_TOKEN` in the doctor's environment, `--url` reads it. Off: `iapl({ doctor: false })`; adapt:
`iapl({ 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).
`IAPL_DOCTOR_TOKEN` (endpoint), `CI` (set → never writes `seen`), `NO_COLOR` (plain output), `PAYLOAD_CONFIG_PATH`
(`--deep` loads that config), `IAPL_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[]`).
filter or add rules (`extraRules` in `iapl-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.
`iapl-audit` stays the check inside the edit loop (plus tsc and build); the doctor runs `iapl-audit --quick` from the
installed package, `iapl-seo-check` with `--url`, and adds versions, env, database, admin, seeds, skills and the live
headers. `iapl-consent-check` (browser) is not part of it.
+14 -14
View File
@@ -1,26 +1,26 @@
---
name: ipal-form
description: Wires forms the ipal-kit way — forms built by the editor in the panel (form-builder Forms collection), one generic renderer, one server action with submitForm (rate limit, Turnstile, schema validation, GDPR consent), honeypot, panel texts from Notifications, emails from Forms → Emails over mailAdapter, GTM events from the panel. Use for any contact/lead/newsletter/quote form, a form block, "the form doesn't send", "no email arrives", spam, or Turnstile problems.
name: iapl-form
description: Wires forms the IAPL way — forms built by the editor in the panel (form-builder Forms collection), one generic renderer, one server action with submitForm (rate limit, Turnstile, schema validation, GDPR consent), honeypot, panel texts from Notifications, emails from Forms → Emails over mailAdapter, GTM events from the panel. Use for any contact/lead/newsletter/quote form, a form block, "the form doesn't send", "no email arrives", spam, or Turnstile problems.
---
# ipal-form
# iapl-form
**ipal-kit first (hard rule, AGENT.md "ipal-kit first"):** anything the plugin covers is built with the
plugin's feature. It does not work or is not enough → report it with **ipal-plugin-gap** and wait for the owner's
**IAPL first (hard rule, AGENT.md "IAPL first"):** anything the plugin covers is built with the
plugin's feature. It does not work or is not enough → report it with **iapl-plugin-gap** and wait for the owner's
decision on that part; no hand-built replacement, no silent workaround. **Code rules:** AGENT.md "Code rules"
(one job per file/component/function, no duplicates, typed, texts from the panel, a check for new behaviour).
**The editor builds the form in the panel. The project has the action, a block with `<RenderForm>` and the classes.** Every
further form — including multi-step ones and ones with choice lists — is panel work only. Fields/labels typed by hand in JSX = an error
(ipal-audit catches it). API details: `docs/forms.md`, `turnstile.md`, `notifications.md`, `email.md`.
(iapl-audit catches it). API details: `docs/forms.md`, `turnstile.md`, `notifications.md`, `email.md`.
## 1. Config (once per project)
```ts
// payload.config.ts
import { ipalKit, mailAdapter, buildFormAnalyticsFields } from '@intecion/ipal-kit'
import { iapl, mailAdapter, buildFormAnalyticsFields } from '@intecion/ipal-kit'
export default buildConfig({
email: mailAdapter(), // without this, emails from Forms → Emails are not sent
plugins: [ipalKit({
plugins: [iapl({
i18n: i18nConfig,
forms: {
redirectRelationships: ['pages'],
@@ -81,7 +81,7 @@ a custom field type, a slider): do not copy the engine — in this order:
`prepareBuilderForm` (server) + `<BuilderForm values>` (client). Never a copy of `publicForm` in the project (forms.md).
Custom field type in the panel: the `FormsOption['fields']` type only accepts `boolean` for known types
(at runtime the block object passes through to form-builder, but TS rejects it), and the server treats
an unknown type as text anyway — if you need a custom type or validation → **plugin gap** (`ipal-plugin-gap`).
an unknown type as text anyway — if you need a custom type or validation → **plugin gap** (`iapl-plugin-gap`).
## 3a. A file on a form (CV, specification, photo) — `forms.attachments`
The file is **e-mailed to the company and never stored**: no Media record, no bucket, no disk, no download link.
@@ -138,18 +138,18 @@ it has every language and **both emails**, which are easy to forget:
- **confirmation to the customer**: `emailTo: {{email}}`, `replyTo` = company address, subject and body per language.
```bash
cp .agents/skills/ipal-form/resources/seed-form.template.ts scripts/seed-form-contact.ts
cp .agents/skills/iapl-form/resources/seed-form.template.ts scripts/seed-form-contact.ts
# fill FORM from the brief (fields, labels, messages, email subjects — every language), NOTIFY = global/field with the company address
pnpm payload run scripts/seed-form-contact.ts
```
The template writes the form with `createSeeder(...).upsertBy('forms', { title }, data)` from
`@intecion/ipal-kit/seed` (every language, row ids kept, edited forms skipped).
Without a notification address the script **stops** — ask the client which inbox should receive
submissions (a question from the list in ipal-site), enter it in the panel and run again. Never put the address in code.
submissions (a question from the list in iapl-site), enter it in the panel and run again. Never put the address in code.
Commit the script — in production run it after the migration: `SEED_DRY_RUN=1` first, back up the database, then
the real run (rules: `node_modules/@intecion/ipal-kit/docs/seeding.md`). Changing the form: fix FORM,
`SEED_UPDATE=1 pnpm payload run …` — it updates the form only if nobody edited it since seeding (otherwise
`skip (edited)`); on production / a non-local database it also needs `IPAL_SEED_ALLOW_PROD_UPDATE=1`.
`skip (edited)`); on production / a non-local database it also needs `IAPL_SEED_ALLOW_PROD_UPDATE=1`.
**After launch** a form seed touches only its own form (`only: ['forms:<title>']` in the template) — never re-run
every form seed or the content seed to change one form (AGENT.md "seeding after launch").
@@ -185,8 +185,8 @@ Details the seed already covers, which you check after every manual change in th
a `.exe` renamed to `.pdf` → "The file … was refused: …" at the File field, no submission, the typed answers
still there; a file over the limit → "…is too large. Choose a file of up to N MB." before sending; each
message in every language of the site; keyboard only: Tab to the field, pick a file, Tab to "Remove …", Enter removes it;
- [ ] `ipal-audit --quick` → zero hardcoding in FormBlock, no copy of the form engine;
- [ ] `ipal-consent-check` → still 0 violations (Turnstile is necessary, not tracking).
- [ ] `iapl-audit --quick` → zero hardcoding in FormBlock, no copy of the form engine;
- [ ] `iapl-consent-check` → still 0 violations (Turnstile is necessary, not tracking).
## Diagnostics
| Symptom | Cause → fix |
@@ -1,11 +1,11 @@
// src/blocks/FormBlock/Component.tsx — a panel form inside a section. Logic, steps,
// validation, Turnstile, honeypot and rich text come from ipal-kit; the look is
// validation, Turnstile, honeypot and rich text come from IAPL; the look is
// formClasses (one file for every form on the site).
// Block config (src/blocks/FormBlock/config.ts): slug 'formBlock', fields
// buildSectionHeaderField(), { name: 'form', type: 'relationship', relationTo: 'forms', required: true },
// buildSectionSettingsField()
// Page query depth ≥ 1, otherwise `form` is just an ID (RenderForm renders nothing).
// `formTexts` and `sendForm` arrive via createPageRoute blockProps (ipal-form SKILL §4).
// `formTexts` and `sendForm` arrive via createPageRoute blockProps (iapl-form SKILL §4).
import type { FormNotificationTexts } from '@intecion/ipal-kit'
import { RenderForm, type SendFormAction } from '@intecion/ipal-kit/rsc'
import type { FormBlock as FormBlockData } from '@/payload-types'
@@ -1,5 +1,5 @@
// src/app/(frontend)/[locale]/actions.ts — ONE server action for every builder form.
// honeypot → client IP (IPAL_IP_HEADER) → submitForm (rate limit, Turnstile,
// honeypot → client IP (IAPL_IP_HEADER) → submitForm (rate limit, Turnstile,
// validation, GDPR consent, storage) → visitor message from Notifications.
'use server'
import { headers } from 'next/headers'
@@ -11,7 +11,7 @@
*
* Safety (createSeeder from @intecion/ipal-kit/seed): the form is matched by its
* title; nothing is ever deleted. SEED_UPDATE=1 is refused when NODE_ENV=production
* or the database is not local, unless IPAL_SEED_ALLOW_PROD_UPDATE=1 is also set —
* or the database is not local, unless IAPL_SEED_ALLOW_PROD_UPDATE=1 is also set —
* back up the database first. A form an editor changed is skipped and reported
* ("skip (edited)"). Every language is written with `fallbackLocale: false` onto the
* same row ids (fields, options, e-mails).
+11 -11
View File
@@ -1,9 +1,9 @@
---
name: ipal-locale-add
description: Adds a new language to an ipal-kit site (or turns a single-language site into a multilingual one) end to end — i18n.config, routing, Postgres migration, slugs and titles per page, globals (Header, Footer, Site settings, Cookie banner, Notifications), forms, SEO (hreflang, sitemap), language switcher — and proves completeness with a coverage script and ipal-seo-check. Use when the user asks for a new language/locale/translation version of the site.
name: iapl-locale-add
description: Adds a new language to an IAPL site (or turns a single-language site into a multilingual one) end to end — i18n.config, routing, Postgres migration, slugs and titles per page, globals (Header, Footer, Site settings, Cookie banner, Notifications), forms, SEO (hreflang, sitemap), language switcher — and proves completeness with a coverage script and iapl-seo-check. Use when the user asks for a new language/locale/translation version of the site.
---
# ipal-locale-add
# iapl-locale-add
A new language is **configuration + content**. Front-end code barely changes —
routing, hreflang, sitemap, the switcher and consent read locales from one source.
@@ -28,7 +28,7 @@ This is a structural rebuild (i18n.md → "Moving from single- to multi-language
## 2. Configuration (multilingual project)
1. `src/i18n.config.ts` — add `{ code: 'de', label: 'Deutsch' }`. This is the only
place; `ipalKit({ i18n: i18nConfig })`, the proxy, the switcher and the sitemap take it from here.
place; `iapl({ i18n: i18nConfig })`, the proxy, the switcher and the sitemap take it from here.
**Do not** change `defaultLocale` along the way (it changes every canonical URL).
2. Postgres: `pnpm payload migrate:create add-locale-de` → review it (`_locales` enum,
`_locales` tables) → `pnpm payload migrate`. Mongo: nothing.
@@ -40,8 +40,8 @@ This is a structural rebuild (i18n.md → "Moving from single- to multi-language
## 3. Content — what MUST have a value in the new language
Run the gap report (read-only):
```bash
pnpm payload run .agents/skills/ipal-locale-add/scripts/locale-coverage.ts
LOCALE=de pnpm payload run .agents/skills/ipal-locale-add/scripts/locale-coverage.ts
pnpm payload run .agents/skills/iapl-locale-add/scripts/locale-coverage.ts
LOCALE=de pnpm payload run .agents/skills/iapl-locale-add/scripts/locale-coverage.ts
```
It prints: documents without a `slug`/title in a given language (= 404, missing from the sitemap and
hreflang) and empty localized global fields that are filled in the defaultLocale.
@@ -53,7 +53,7 @@ Fill them in this order (panel or a Local API script with `locale: 'de'`):
| Homepage/404/policy | System pages (shared relations) + their slug in `de` | `/de` → 404, empty policy link |
| Header / Footer — link labels | navigation globals | empty menu items |
| Site settings — name, description, OG | Site settings | title/OG from the fallback |
| Cookie banner — all texts + `privacyLinkLabel`, Detail labels, Cookies (`purpose`, `duration`) | Cookie banner | banner / `detailed` window in another language (GDPR: consent must be understandable); scan + import with `--lang <code>` (ipal-consent-check) |
| Cookie banner — all texts + `privacyLinkLabel`, Detail labels, Cookies (`purpose`, `duration`) | Cookie banner | banner / `detailed` window in another language (GDPR: consent must be understandable); scan + import with `--lang <code>` (iapl-consent-check) |
| Notifications — `form.*` | Notifications | form messages from the English fallback |
| Forms — field labels, confirmation, Emails | Forms (every form) | form in the wrong language |
| SEO tab — meta title/description | every page | duplicates/gaps in seo-check |
@@ -66,16 +66,16 @@ When writing through the Local API: `payload.update({ collection, id, locale: 'd
- **`fallbackLocale: false` is mandatory** — without it (with `fallback: true`) Payload
saves the Polish text as the German translation in every field you did not provide;
- **blocks/arrays: keep the row `id`s from the defaultLocale read**, otherwise new
rows are created. Ready-made mechanism: `ipal-site/resources/seed-content.template.ts`
rows are created. Ready-made mechanism: `iapl-site/resources/seed-content.template.ts`
(`{ pl, en, de }` values side by side, `SEED_UPDATE=1` for existing pages).
## 4. Check
1. `locale-coverage` → `0 gap(s)` (or a list of deliberately empty fields in the report).
2. `pnpm build && pnpm start` → `ipal-seo-check http://localhost:3000`:
2. `pnpm build && pnpm start` → `iapl-seo-check http://localhost:3000`:
hreflang `de` on PL/EN pages, x-default, `/de/...` in the sitemap, no 404.
3. `ipal-consent-check http://localhost:3000/de` — banner in German, consent works.
3. `iapl-consent-check http://localhost:3000/de` — banner in German, consent works.
4. By hand: the language switcher on a subpage (not home) lands on the counterpart, not on `/de`.
5. `ipal-audit --quick` — zero new hardcoded values.
5. `iapl-audit --quick` — zero new hardcoded values.
## Report
New language: code, number of pages translated / empty, who translated (a draft
@@ -1,8 +1,8 @@
/**
* ipal-locale-add — what is still untranslated, per locale.
* iapl-locale-add — what is still untranslated, per locale.
*
* pnpm payload run .agents/skills/ipal-locale-add/scripts/locale-coverage.ts
* LOCALE=de pnpm payload run .agents/skills/ipal-locale-add/scripts/locale-coverage.ts # one locale
* pnpm payload run .agents/skills/iapl-locale-add/scripts/locale-coverage.ts
* LOCALE=de pnpm payload run .agents/skills/iapl-locale-add/scripts/locale-coverage.ts # one locale
*
* Reports (read-only, never writes):
* - collections with a localized `slug`: documents missing slug/title in a locale
@@ -1,9 +1,9 @@
---
name: ipal-migrate-fields
description: Safely changes the shape of fields that already hold content in an ipal-kit / Payload 3 project — renaming a field, replacing old CTA fields with buildLinkField/buildLinksField, moving fields into a group, splitting or merging blocks, changing a field's type, making a field localized. Three phases (add new → copy data with a dry-run script → remove old), all locales, no content loss. Use whenever a schema change touches fields that may already have data in the database, including refactors suggested by ipal-audit.
name: iapl-migrate-fields
description: Safely changes the shape of fields that already hold content in an IAPL / Payload 3 project — renaming a field, replacing old CTA fields with buildLinkField/buildLinksField, moving fields into a group, splitting or merging blocks, changing a field's type, making a field localized. Three phases (add new → copy data with a dry-run script → remove old), all locales, no content loss. Use whenever a schema change touches fields that may already have data in the database, including refactors suggested by iapl-audit.
---
# ipal-migrate-fields
# iapl-migrate-fields
Payload **does not migrate data for you**. Renaming a field or changing its type in code
= the old data stays in the database under the old key, the admin panel shows an empty field, the front end
@@ -54,7 +54,7 @@ replacing CTA fields with `buildLinkField`, splitting a block) → this skill.
you will see the other languages in the APPLY output.
4. Write: `APPLY=1 pnpm payload run scripts/migrate-<name>.ts`.
5. Verify: another dry run → `0 block change(s)`; in the panel open the document in
every language; on the front end `pnpm build && pnpm start` + `ipal-seo-check`.
every language; on the front end `pnpm build && pnpm start` + `iapl-seo-check`.
Globals (Header, Footer): instead of `find` → `findGlobal`/`updateGlobal({ slug, data, locale })`
— the same loop over locales. Collection with `versions.drafts`: the script updates
@@ -74,7 +74,7 @@ production would ping Bing for every page), `disableRevalidate` (`buildRevalidat
**DROPS columns**; run it only after phase 2 on the same database.
- Mongo: the old keys stay in the documents (harmless). Cleanup is optional:
`$unset` in a separate script.
- `ipal-audit --quick` → 0 errors.
- `iapl-audit --quick` → 0 errors.
## Common cases → what goes in migrateBlock
@@ -1,5 +1,5 @@
/**
* Field migration — PHASE 2 of 3 (skill ipal-migrate-fields).
* Field migration — PHASE 2 of 3 (skill iapl-migrate-fields).
* Copies data from OLD fields to NEW fields inside one block type, in every locale.
*
* pnpm payload run scripts/migrate-<name>.ts # dry run — prints what would change
+6 -6
View File
@@ -1,12 +1,12 @@
---
name: ipal-nav
description: Builds the site header, footer, mobile menu and company data in an ipal-kit project — Header/Footer/Company globals with buildLinkField from the plugin, server-side link resolution (resolveNav from the plugin), a small client MobileNav, legal links from System pages, revalidation on change. Use when creating or changing navigation, menu, header, footer, contact details, social links or the company global.
name: iapl-nav
description: Builds the site header, footer, mobile menu and company data in an IAPL project — Header/Footer/Company globals with buildLinkField from the plugin, server-side link resolution (resolveNav from the plugin), a small client MobileNav, legal links from System pages, revalidation on change. Use when creating or changing navigation, menu, header, footer, contact details, social links or the company global.
---
# ipal-nav
# iapl-nav
Ready code: `resources/nav-code.md` (this skill). Rules: AGENT.md §6.8.
Requires the UI primitives from `../ipal-block/resources/section-code.md` (like the ipal-block skill, step 0).
Requires the UI primitives from `../iapl-block/resources/section-code.md` (like the iapl-block skill, step 0).
## Plan (write it down, then go straight to code — AGENT.md §0a)
- menu items (one submenu level, no deeper), CTA in the header (`links`),
@@ -21,7 +21,7 @@ Requires the UI primitives from `../ipal-block/resources/section-code.md` (like
(`revalidatePath` from `next/cache`, hooks.md) — it calls `revalidatePath('/', 'layout')` and already
skips the call outside the Next server (seed, migration) and with `context.disableRevalidate`.
`buildRevalidateHook` is for collections. The plugin's own globals refresh themselves with
`ipalKit({ revalidatePath })`.
`iapl({ revalidatePath })`.
3. Menu: `await resolveNav(header.navItems, locale)` from `lib/content` (plugin) — links
resolved on the server to `{ href, label, internal, newTab, targetProps, children }`.
Do not create `lib/navigation.ts`.
@@ -34,5 +34,5 @@ Requires the UI primitives from `../ipal-block/resources/section-code.md` (like
cached getters in `lib/`, pass them as props).
## Verification
The **ipal-audit** skill. By hand: a menu item added in the panel is visible right after
The **iapl-audit** skill. By hand: a menu item added in the panel is visible right after
saving; the mobile menu works with the keyboard (Tab, Enter, Esc).
@@ -1,7 +1,7 @@
# Navigation code — Header, Footer, mobile menu
> Resources of the **ipal-nav** skill. Rules: `node_modules/@intecion/ipal-kit/docs/agent/AGENT.md` §6.8.
> Requires the UI primitives from `../ipal-block/resources/section-code.md` (CMSLink, Media).
> Resources of the **iapl-nav** skill. Rules: `node_modules/@intecion/ipal-kit/docs/agent/AGENT.md` §6.8.
> Requires the UI primitives from `../iapl-block/resources/section-code.md` (CMSLink, Media).
## Header and Footer (navigation globals)
+12 -12
View File
@@ -1,17 +1,17 @@
---
name: ipal-plugin-gap
name: iapl-plugin-gap
description: Handles the moment when @intecion/ipal-kit seems to lack a feature or behaves wrongly — verifies against the plugin docs and type definitions first, then reports the gap to the owner with a structured plugin request and waits for their decision instead of patching the project with hooks, hardcoded values, copied plugin code or any self-made workaround. Use when tempted to work around the plugin, when a plugin function errors or is missing, or when the same need appears in several projects.
---
# ipal-plugin-gap
# iapl-plugin-gap
Rule: AGENT.md "ipal-kit first" and §1.3 — **report first, then wait**. You do nothing on your own for
Rule: AGENT.md "IAPL first" and §1.3 — **report first, then wait**. You do nothing on your own for
that part until the owner decides; work on unrelated parts may go on. No hand-built replacement, no silent
workaround.
Report type: **bug** (the plugin behaves differently from the docs) or **improvement**
(the same code written in yet another project; no option exists that would remove it).
**Plugin rule:** ipal-kit helps the project, never limits it. Every module can be
**Plugin rule:** IAPL helps the project, never limits it. Every module can be
turned off separately; every default (access, fields, hooks, labels, routes, collections,
globals) can be overridden and the project config wins; safe defaults have an option to
relax them; the plugin exports building blocks, not only ready-made functions. A missing option or
@@ -20,10 +20,10 @@ building block is a **plugin gap to report** (type: improvement) — not a reaso
## 1. Check that the plugin does not already have it
- `ls node_modules/@intecion/ipal-kit/docs/` — read the module file,
- `grep -rn "<keyword>" node_modules/@intecion/ipal-kit/dist --include=*.d.ts`,
- `ipalKit` options (`IpalOptions` in `dist/types.d.ts`: `*Fields`, `formOverrides`, `access`, `enabled`…)
- `iapl` options (`IaplOptions` in `dist/types.d.ts`: `*Fields`, `formOverrides`, `access`, `enabled`…)
and the exported building blocks (`build*`, `create*`) — often an override is enough, not a new function,
- check the version: `grep '"version"' node_modules/@intecion/ipal-kit/package.json`
(the problem may be fixed in a newer one — the **ipal-upgrade** skill).
(the problem may be fixed in a newer one — the **iapl-upgrade** skill).
The plugin has it → use it and tell the user where it was.
@@ -32,27 +32,27 @@ Save it in the project's `docs/plugin-requests/<date>-<topic>.md` and **tell the
the file, a one-paragraph summary and the options below. Then stop work on that part.
**Options you offer the owner** (they choose — you do not):
1. wait for a plugin fix / new option (the plugin request goes to the ipal-kit team);
1. wait for a plugin fix / new option (the plugin request goes to the IAPL team);
2. use an existing plugin option or building block differently (if you found one with a trade-off — say which);
3. an approved, minimal workaround in the project (only if the owner says yes).
**After the decision:** write it into `AGENTS.md` → "Project decisions" (what, why, the request file, who approved).
A workaround is then minimal, in one file, marked `// WORKAROUND ipal-kit <version>: docs/plugin-requests/<file>`,
and listed in the final report (ipal-site, "For ipal-kit" section) so it can be removed after the plugin fix.
A workaround is then minimal, in one file, marked `// WORKAROUND IAPL <version>: docs/plugin-requests/<file>`,
and listed in the final report (iapl-site, "For IAPL" section) so it can be removed after the plugin fix.
```markdown
# <topic>
**Type:** bug / improvement · **Project:** <name> · **ipal-kit:** <version>
**Type:** bug / improvement · **Project:** <name> · **IAPL:** <version>
## Problem
<what does not work / what is missing; error message; steps to reproduce>
## Why it belongs in the plugin
<whether other projects will need it — be specific>
## Proposed API
<function signature / ipalKit option / admin panel field; usage example in the project>
<function signature / iapl option / admin panel field; usage example in the project>
## Options for the owner
1. wait for the plugin · 2. <existing option, with its trade-off> · 3. <minimal workaround, in one file — only if approved>
## Decision
<filled in after the owner decides: option, date, who; a workaround is marked `// WORKAROUND ipal-kit <version>: docs/plugin-requests/<file>`>
<filled in after the owner decides: option, date, who; a workaround is marked `// WORKAROUND IAPL <version>: docs/plugin-requests/<file>`>
```
## 3. What not to do
+47 -45
View File
@@ -1,9 +1,9 @@
---
name: ipal-reference
description: Complete map of everything @intecion/ipal-kit provides — every ipalKit plugin option (with defaults, what it adds and how to turn it off or override it), every env var the code reads, every route, the proxy, the layout components, every admin import-map entry, the hooks, collections, globals and endpoints the plugin injects by itself, and every file the project wires on its own (payload.config, proxy, instrumentation, next.config, lib/content, layout, catch-all page, SEO/GEO routes, Pages/Media hooks, forms, consent, stats, storage, e-mail), each with a minimal example and a concrete check — plus an index of every export with its import path (resources/api.md). Use before writing any feature yourself, when wiring a module, or when asked "does ipal-kit have X".
name: iapl-reference
description: Complete map of everything @intecion/ipal-kit provides — every iapl plugin option (with defaults, what it adds and how to turn it off or override it), every env var the code reads, every route, the proxy, the layout components, every admin import-map entry, the hooks, collections, globals and endpoints the plugin injects by itself, and every file the project wires on its own (payload.config, proxy, instrumentation, next.config, lib/content, layout, catch-all page, SEO/GEO routes, Pages/Media hooks, forms, consent, stats, storage, e-mail), each with a minimal example and a concrete check — plus an index of every export with its import path (resources/api.md). Use before writing any feature yourself, when wiring a module, or when asked "does IAPL have X".
---
# ipal-reference
# iapl-reference
## How to use
- **A working example of every row** is in the reference site: `docs/agent/reference-site/INDEX.md` (file → what it
@@ -13,17 +13,17 @@ description: Complete map of everything @intecion/ipal-kit provides — every ip
`node_modules/@intecion/ipal-kit/docs/<page>.md` (the "details" column).
- **The plugin helps, never limits:** every module can be turned off, every default can be overridden,
the project config wins, the building blocks (`build*`, `create*`) are exported — compose your own version from them.
- Missing option / behaviour that does not match the docs → skill **ipal-plugin-gap** (report). Never patch `node_modules`.
- Described per the current code (checked against 1.16.3). "currently always" = no option to turn it off today (gap → ipal-plugin-gap).
- Missing option / behaviour that does not match the docs → skill **iapl-plugin-gap** (report). Never patch `node_modules`.
- Described per the current code (checked against 1.16.3). "currently always" = no option to turn it off today (gap → iapl-plugin-gap).
## 1. `ipalKit({...})` options (`IpalOptions`, `dist/types.d.ts`)
## 1. `iapl({...})` options (`IaplOptions`, `dist/types.d.ts`)
| option | default | what it adds / changes | how to turn off / override |
|---|---|---|---|
| `i18n` **(required)** | — | `config.localization` (always overwritten); validated right away in `ipalKit()` (throws on a bad config) | one source: `src/i18n.config.ts`; your own `localization` in the config gets overwritten anyway |
| `i18n` **(required)** | — | `config.localization` (always overwritten); validated right away in `iapl()` (throws on a bad config) | one source: `src/i18n.config.ts`; your own `localization` in the config gets overwritten anyway |
| `i18n.defaultLocale` | — | `localization.defaultLocale`, `/` redirect in the proxy | must be in `locales` |
| `i18n.fallback` | `true` | `localization.fallback` | `false` |
| `i18n.locales[]` `{ code, label, rtl? }` | — | list of languages (min. 1); `rtl: true` → `rtl` in Payload | adding a language: skill **ipal-locale-add** |
| `i18n.locales[]` `{ code, label, rtl? }` | — | list of languages (min. 1); `rtl: true` → `rtl` in Payload | adding a language: skill **iapl-locale-add** |
| admin languages (no option) | English + Polish | `i18n.supportedLanguages` set to `{ en, pl }` when the project has none; plugin component texts in `i18n.translations.<lang>.ipal` (`adminTexts`); every plugin label is `{ en, pl }` (rules: `docs/dev/admin-ux.md`) | your own `i18n.supportedLanguages` wins; override a component text with `i18n.translations.<lang>.ipal.<key>`; field/global labels via `globalOverrides` / `collectionOverrides` — see i18n.md "Admin panel languages and texts" |
| `access` | none | `roles` field (`user` < `editor` < `admin`, `saveToJWT`) in the auth collection | omit → **no roles**: every account of the panel's login collection passes the plugin's admin/editor checks (`userMeetsRole`; accounts of other auth collections never pass): Site integrations, the e-mail test, stats, consent-records, settings globals, `form-submissions`. Narrow them with `globalOverrides` / collection overrides |
| `access.authCollection` | — (required in `access`) | collection that gets `roles`; also the slug of the injected auth collection | your own collection with that slug wins |
@@ -42,15 +42,15 @@ description: Complete map of everything @intecion/ipal-kit provides — every ip
| `secrets.reenterOnChange` | on | a save through access control that changes `smtpHost`, `smtpPort` or `smtpUser` while a password is stored must send the password again or remove it (`400` on the field otherwise), whatever `emailTransport` says — so an admin session cannot send the stored password to a server of its own. A change of the transport alone, and the Local API with access control off, are not asked | `false` = the stored password follows the new server |
| `dashboardAlerts` | `{ integrations: 'admin', cookies: 'editor' }` | who sees the plugin's dashboard alerts: integration details (error text, link) for `integrations` and above, a neutral "ask an administrator" for editors below it, nothing for others; the cookie crawl / approval alert for `cookies` and above. With a role, a session that owes its second factor sees none | `integrations: 'editor' | 'all'`, `cookies: 'all'` (`'all'` = as before: no role and no second factor is checked) |
| `adminRoute` | `'/admin'` | `config.routes.admin`; stats link and views, `IntegrationAlerts` | the project moves `app/(payload)/<route>/` itself and adds the route to the proxy matcher (security.md) |
| `twoFactor` | **none = error** | `@clocklimited/payload-2fa` with `forceSetup: true` (TOTP enforced, also checked in the API) | `twoFactor: false` (discouraged); omitting the option throws `[ipal] twoFactor.issuer is required` |
| `twoFactor` | **none = error** | `@clocklimited/payload-2fa` with `forceSetup: true` (TOTP enforced, also checked in the API) | `twoFactor: false` (discouraged); omitting the option throws `[iapl] twoFactor.issuer is required` |
| `twoFactor.issuer` | — (required) | name in the authenticator app | — |
| `twoFactor.plugin` | — (required) | injected `payloadTotp` (the plugin does not import the peer) | missing function → throws |
| `twoFactor.collectionSlug` | the panel's login collection (`admin.user`, else the first auth collection) | collection with 2FA; startup fails with `[ipal] twoFactor…` when it is not an auth collection or differs from `admin.user` | point it at the login collection |
| `twoFactor.collectionSlug` | the panel's login collection (`admin.user`, else the first auth collection) | collection with 2FA; startup fails with `[iapl] twoFactor…` when it is not an auth collection or differs from `admin.user` | point it at the login collection |
| `twoFactor.provider` | `'@intecion/ipal-kit/admin#TotpRedirectProvider'` | admin provider that sends users to `setup-totp` / `verify-totp` (path read in the browser); replaces the package's header-based one | own component path / `{ path, clientProps, serverProps }` (gets clientProps `forceSetup`); `false` keeps the package's (needs `x-pathname` on `/admin`, else `setup-totp?back=null` loops) |
| `twoFactor.safeBack` | on | the `back` query value of the 2FA setup and verify screens is checked on the server before the package's view gets it (`SafeTotpView` registered in place of the package's four views): kept only as a path on the site's origin inside `routes.admin`, else the admin root — no `javascript:` / off-site redirect after the code. Needs `generate:importmap` (`@intecion/ipal-kit/admin#SafeTotpView`) | `false` = the package's views untouched; a function `(back, { adminRoute, origin }) => string` = your own rule |
| `twoFactor.importMapCheck` | on | production only: at start searches the `importMap.js` on disk (where Payload looks for it) for `@intecion/ipal-kit/admin#SafeTotpView`; when not found, logs `[ipal] The admin import map may be out of date …` and ipal-kit's `TotpRedirectProvider` puts the notice "Two-step verification may not be available" above the 2FA screens (never instead of them). A hint only — the map in the build can differ from the file on disk (Dockerfile runner stage, re-exporting map); a file that is not found is not reported | `false` = no file read, log line or notice |
| `twoFactor.texts` | ipal-kit's en/pl texts (`TOTP_TEXTS`) over the package's; 2FA screens titled "Two-step verification" / "Weryfikacja dwuetapowa" (site's language) | `false` = the package's texts; one text: `i18n.translations.<lang>.totpPlugin.<key>` (security.md) |
| `twoFactor.guard` | on | ipal-kit's own second-factor check on every collection and global (also the plugin's own and those of plugins listed after ipalKit) and in `userMeetsRole`; startup fails with `[ipal] twoFactor: the injected 2FA plugin did not add …` when the 2FA package lacks the `totp` strategy / `hasTotp` / `totpSecret` | per entity: `custom.ipal.secondFactor: false` / `{ read: false }` or the package's `custom.totp.disableAccessWrapper.<op>`; `false` = the package's wrapper only (the plugin's own data then opens to a password without the code; not recommended). The package's endpoints stay limited to accounts of the 2FA collection either way |
| `twoFactor.importMapCheck` | on | production only: at start searches the `importMap.js` on disk (where Payload looks for it) for `@intecion/ipal-kit/admin#SafeTotpView`; when not found, logs `[iapl] The admin import map may be out of date …` and IAPL's `TotpRedirectProvider` puts the notice "Two-step verification may not be available" above the 2FA screens (never instead of them). A hint only — the map in the build can differ from the file on disk (Dockerfile runner stage, re-exporting map); a file that is not found is not reported | `false` = no file read, log line or notice |
| `twoFactor.texts` | IAPL's en/pl texts (`TOTP_TEXTS`) over the package's; 2FA screens titled "Two-step verification" / "Weryfikacja dwuetapowa" (site's language) | `false` = the package's texts; one text: `i18n.translations.<lang>.totpPlugin.<key>` (security.md) |
| `twoFactor.guard` | on | IAPL's own second-factor check on every collection and global (also the plugin's own and those of plugins listed after iapl) and in `userMeetsRole`; startup fails with `[iapl] twoFactor: the injected 2FA plugin did not add …` when the 2FA package lacks the `totp` strategy / `hasTotp` / `totpSecret` | per entity: `custom.ipal.secondFactor: false` / `{ read: false }` or the package's `custom.totp.disableAccessWrapper.<op>`; `false` = the package's wrapper only (the plugin's own data then opens to a password without the code; not recommended). The package's endpoints stay limited to accounts of the 2FA collection either way |
| `twoFactor.verifyLimit` | `{ max: 5, windowMinutes: 10, store: 'database' }` | attempts per account on `POST /api/verify-totp` (the 2FA package counts none): the sixth in the window, right or wrong, gets `429` + `Retry-After`. Counted in memory and in the database (`payload.kv`, the `payload-kv` collection Payload adds), so a restart or a second instance does not reset it; a failing store never opens the gate | `{ max, windowMinutes }`; `{ store: 'memory' }` = this instance only; `false` = no limit |
| `twoFactor.sameOrigin` | on | `POST /api/verify-totp` and `/api/setup-totp` refuse (`403`, not counted) a request a browser marks as coming from another origin (`Origin`, else `Sec-Fetch-Site`). Own origins: the request's host (`Host`, `X-Forwarded-Host`, a default port written out is ignored), `serverURL`, Payload's `csrf` / `cors`. Requests without those headers pass. A refusal is logged once per origin with how to allow it — behind a proxy that hides the address set `serverURL` | `{ origins: ['https://app.example.com'] }` adds origins; `false` = off |
| `twoFactor.requireSetup` | on, `{ windowHours: 72 }` | an account without TOTP reaches nothing but the setup screen and `/api/setup-totp` (REST, GraphQL and the panel's data answer 403); it has `windowHours` from its creation or from an admin's reset, then it is blocked until an admin reopens setup. Adds the field `totpSetupStatus` (panel) to the 2FA collection, a dashboard notice and `POST /api/ipal/two-factor/reset`; the date field `totpSetupFrom` is there whenever 2FA is on (also with `requireSetup: false` / `guard: false`). Existing accounts get their window at the first start after the upgrade, written once. **Postgres/SQLite: the migration must be applied when the new container starts — `prodMigrations` or `pnpm payload migrate && pnpm start`, not a pre-deployment command (deployment.md §4.3) — or every login answers 500**; `generate:importmap`. `exempt` must return exactly `true` at once (an `async` one, or a `windowHours` that is not a number / `false`, stops the start) | `false` = the package's rule (API open until setup); `{ windowHours: 24 }`, `{ windowHours: false }` (no limit), `{ exempt: ({ user }) => … }` (a service account) |
@@ -70,7 +70,7 @@ description: Complete map of everything @intecion/ipal-kit provides — every ip
| `pages.slug` | — (required in `pages`) | the project's pages collection (System pages relations, construction, IndexNow) | — |
| `pages.roles` | all: `homepage`, `notFound`, `privacyPolicy`, `cookiePolicy`, `termsOfService` | which assignments to show | subset of the array |
| `content` | none | `<slug>Archive` field in System pages per collection (entry URL = archive page slug) | **ignored without `pages`** (no archive fields; IndexNow still works) |
| `content.collections[]` `{ slug, label?, perPage? }` | `label` = slug, `perPage` 10 | archive entry; the same value goes to `createContentHelpers({ content })` | the project creates the collection (skill **ipal-collection**) |
| `content.collections[]` `{ slug, label?, perPage? }` | `label` = slug, `perPage` 10 | archive entry; the same value goes to `createContentHelpers({ content })` | the project creates the collection (skill **iapl-collection**) |
| `seo` | none | `@payloadcms/plugin-seo` (`meta` group + `titleOverride`), Content/SEO tabs, auto-fill hook | omit |
| `seo.collections` | — (required) | collections with `meta` | — |
| `seo.autoFill` | `{ title: 'title', content: 'layout', descriptionLength: 155 }` | `beforeChange`: empty `meta.title/description` filled from document fields | `false`; object `{ title, description, content, descriptionLength }` |
@@ -93,18 +93,19 @@ 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) |
| `doctor` | on (404 until `IAPL_DOCTOR_TOKEN` is set) | `GET /api/ipal/doctor` — read-only counts for `iapl-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 |
| `cookieScanner.approval` | on | `false` = per-entry review only (no view, endpoint or reminder); `{ unknownCategory, dashboard }` — category for cookies nothing knows (default `'marketing'`, must need consent), dashboard reminder | adds `change` + `needsDescription` to `cookie-review` → `migrate:create` when upgrading |
| `cookieScanner.declarations` / `.integrations` | built-ins only | the project's own cookies (`CookieDeclaration[]`), or `(defaults) => CookieIntegration[]` to add / change / drop integrations (`key`, `label`, `declarations`, `isEnabled(ctx)`) | e.g. a chat widget on when `ctx.integrations.chatId` is filled |
| `cookieScanner.access` / `.collectionOverrides` / `.labels` | editor+ / none / `en` + `pl` | who may scan; changes `cookie-review` like `consentLog.collectionOverrides`; admin labels per language (`CookieScanLabels`) | object or function |
| `cookieScanner.crawl` | off | browser pre-consent check through the shared scanner service (`services/cookie-crawler`, Coolify): **Check site** in the review box, `cookie-crawl` global (latest result only), `GET`/`POST /api/ipal/cookie-crawl`, `POST /api/ipal/cookie-crawl/results` (token), `violation` / `violationDetail` / `seenBeforeConsent` on `cookie-review`, `CookieCrawlAlert` on the dashboard, e-mail to *Cookie check → Warning e-mails to* | `true` / `CookieCrawlOptions`; env `IPAL_COOKIE_SCAN_URL` + `IPAL_COOKIE_SCAN_TOKEN`; `generate:importmap` + `migrate:create`. Check: the review box's **Check site** is enabled → click → "Last crawl …" with counts; `curl -X POST -H "Authorization: Bearer $IPAL_COOKIE_SCAN_TOKEN" $U/api/ipal/cookie-crawl` → 202 |
| `cookieScanner.crawl` | off | browser pre-consent check through the shared scanner service (`services/cookie-crawler`, Coolify): **Check site** in the review box, `cookie-crawl` global (latest result only), `GET`/`POST /api/ipal/cookie-crawl`, `POST /api/ipal/cookie-crawl/results` (token), `violation` / `violationDetail` / `seenBeforeConsent` on `cookie-review`, `CookieCrawlAlert` on the dashboard, e-mail to *Cookie check → Warning e-mails to* | `true` / `CookieCrawlOptions`; env `IAPL_COOKIE_SCAN_URL` + `IAPL_COOKIE_SCAN_TOKEN`; `generate:importmap` + `migrate:create`. Check: the review box's **Check site** is enabled → click → "Last crawl …" with counts; `curl -X POST -H "Authorization: Bearer $IAPL_COOKIE_SCAN_TOKEN" $U/api/ipal/cookie-crawl` → 202 |
| `cookieScanner.crawl.serviceUrl` / `.token` / `.siteUrl` / `.maxPages` / `.acceptSelector` | env URL / env token / `serverURL` → `NEXT_PUBLIC_SERVER_URL` / `20` / `[data-ipal="accept"]` | where the service is, the shared secret, the public origin crawled and called back, pages from the sitemap (max 100), the banner's accept button | options win over env |
| `cookieScanner.crawl.consentMode` / `.trackerHosts` / `.dashboard` / `.globalOverride` | `'advanced'` / `DEFAULT_TRACKER_HOSTS` / `true` / none | `'basic'` also flags Google tag requests before consent; hosts counted as trackers; dashboard warning; changes the `cookie-crawl` global like `globalOverrides` | `(defaults) => [...defaults, 'chat.example']`; `dashboard: false` |
| `cookieScanner.database` / `.databaseCategories` / `.syncAccepted` | `true` / Functional+Personalization → functional, Security+Necessary → necessary / `true` | Open Cookie Database lookup on or off; category map; accepting writes to Cookie banner | `database: false`; `{ Functional: 'necessary' }`; `syncAccepted: false` |
| `theme.storageKey` | `'theme'` | localStorage key of the visitor's light / dark choice (next-themes uses the same key — set your own to keep them apart); via `config.custom.ipal.themeStorageKey` → `getSiteShell().theme.storageKey` → `ThemeScript` → `<html data-theme-storage>` → `useTheme` / `ThemeSwitcher`. An old `ipal-theme` choice moves before the first paint | `{ storageKey: 'acme-theme' }`; check: DevTools → Application → Local storage shows the key after a switch |
| `storageNames` | `'ipal'` | spelling of the two stored names: the visitor cookie the cookie scanner declares (`ipal_vid` / `iapl_vid`) and the 2FA counter key in `payload-kv` (`ipal:2fa-verify:…` / `iapl:2fa-verify:…`). `iapl create` writes `'iapl'` for a new site; an existing site leaves it out. Never changed on a live site (AGENT.md "Names: IAPL and ipal-kit", stats.md) | `'iapl'` |
| `stats` | off | `stats-visits` collection, `POST /api/ipal/hit`, `/<admin>/stats` view, nav link, dashboard chart | `true` / object |
| `stats.collectionOverrides` | none | changes `stats-visits` like `consentLog.collectionOverrides`; its `access.read` also decides who sees the stats view and dashboard chart | object or function |
| `stats.retentionDays` / `timeZone` / `dashboard` | 90 / `'Europe/Warsaw'` / `true` | retention, day boundary, `StatsWidget` | `dashboard: false` hides the chart |
@@ -121,7 +122,7 @@ description: Complete map of everything @intecion/ipal-kit provides — every ip
| element | what | controlled by | turning off today |
|---|---|---|---|
| auth collection (`users`) | `{ slug, auth: true, useAsTitle: 'email' }`, when the project has none (slug: `access.authCollection` → `twoFactor.collectionSlug` → `admin.user` → `'users'`); with `access`: create/delete/unlock admin only, read/update admin or self | `access.authAccess`; your own collection with that slug | yours wins |
| `forms`, `form-submissions` | form-builder + ipal blocks `step`, `checkboxGroup`, `time` | `forms` | omit `forms` |
| `forms`, `form-submissions` | form-builder + IAPL blocks `step`, `checkboxGroup`, `time` | `forms` | omit `forms` |
| `consent-records` | proof of consent (id, choices, policy version; `consentLog.collectionOverrides`) | `consentLog` | off by default |
| global `cookie-crawl` | latest browser crawl (status, counts, violations, third-party hosts) + e-mail recipients; read editor+, update admin | `cookieScanner.crawl` (`globalOverride`) | off by default |
| `cookie-review` | cookie scanner entries (`status` draft / accepted / rejected, `change` new / changed / gone, `needsDescription`; create/read/update editor+, delete admin) | `cookieScanner` | off by default |
@@ -143,7 +144,7 @@ description: Complete map of everything @intecion/ipal-kit provides — every ip
| `routes.admin` | from `adminRoute` | `adminRoute` | — |
| `beforeChange` meta auto-fill hook | in `seo.collections` | `seo.autoFill` | `autoFill: false` |
| `afterChange` IndexNow hook | pages + content | `indexNow` | off by default |
| `onInit` | Cookie banner button migration + log `[ipal] Plugin initialized.` (your `onInit` runs first) | — | **currently always** |
| `onInit` | Cookie banner button migration + log `[iapl] Plugin initialized.` (your `onInit` runs first) | — | **currently always** |
**Import map** (`@intecion/ipal-kit/admin#…`) — after every option change: `pnpm generate:importmap`
(`pnpm payload generate:importmap`), otherwise the panel is blank / a component is missing.
@@ -167,16 +168,16 @@ 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**, **ipal-doctor** (`pnpm exec ipal-doctor` — the whole site against the team standard; `ipal-doctor.json` silences a rule with a reason; the pages may sit in any route group — `layout.frontend` names it when two qualify; docs/doctor.md).
Mandatory set: AGENT.md §0b, skill **iapl-setup**; checks: **iapl-audit**, **iapl-seo-check**, **iapl-doctor** (`pnpm exec iapl-doctor` — the whole site against the team standard; `iapl-doctor.json` silences a rule with a reason; the pages may sit in any route group — `layout.frontend` names it when two qualify; docs/doctor.md).
`$U` = `NEXT_PUBLIC_SERVER_URL` (e.g. `http://localhost:3000`).
| element | file | minimal example | how to check | details |
|---|---|---|---|---|
| plugin | `src/payload.config.ts` | `plugins: [ipalKit({ i18n: i18nConfig, access: { authCollection: 'users' }, twoFactor: { issuer, plugin: payloadTotp }, … })]` | `pnpm dev` → log `[ipal] Plugin initialized.` | PROGRAMISTA §2.3 |
| plugin | `src/payload.config.ts` | `plugins: [iapl({ i18n: i18nConfig, access: { authCollection: 'users' }, twoFactor: { issuer, plugin: payloadTotp }, … })]` | `pnpm dev` → log `[iapl] Plugin initialized.` | PROGRAMISTA §2.3 |
| languages | `src/i18n.config.ts` | `export const i18nConfig = { defaultLocale: 'pl', locales: [{ code: 'pl', label: 'Polski' }] } as const satisfies I18nConfig` | `curl -sI $U/` → 3xx to `/pl` | i18n.md |
| proxy | `src/proxy.ts` | `export const proxy = createProxy(i18nConfig, { NextResponse, markdown: true })` + `export const config = { matcher: ['/((?!api\|admin\|_next\|.*\\..*).*)'] }` (a literal!) | `curl -sI $U/` → `/pl`; `curl -s -H 'Accept: text/markdown' $U/pl` → Markdown | i18n.md, PROGRAMISTA §2.6 |
| proxy (Next 15 / custom) | `middleware`/`proxy.ts` | `createLocaleMiddleware({ config, … })` (`/next/middleware` or the main entry) | as above | i18n.md |
| env validation | `src/instrumentation.ts` | `if (process.env.NEXT_RUNTIME === 'nodejs') assertEnv(ipalEnvRules({ storage: true, ipHeader: true, databaseName: true }))` from `@intecion/ipal-kit/env` | remove a variable → startup fails with the list of missing ones; a database not named `<domain>_prod`/`_dev` → a warning | env.md, deployment.md §4.2a |
| env validation | `src/instrumentation.ts` | `if (process.env.NEXT_RUNTIME === 'nodejs') assertEnv(iaplEnvRules({ storage: true, ipHeader: true, databaseName: true }))` from `@intecion/ipal-kit/env` | remove a variable → startup fails with the list of missing ones; a database not named `<domain>_prod`/`_dev` → a warning | env.md, deployment.md §4.2a |
| Next config | `next.config.ts` | `withPayload(withSecurityConfig({ images: buildImagesConfig(), htmlLimitedBots: /Googlebot\|Bingbot…/i, headers: async () => [{ source: '/:path*', headers: buildSecurityHeaders({ hsts, csp }) }, { source: '/admin/:path*', headers: buildAdminCspHeaders(csp) }, ...buildUploadSecurityHeaders()] }))` | `curl -sI $U/pl \| grep -iE 'x-content-type\|strict-transport\|x-powered-by'` (no `x-powered-by`) | security.md, storage.md, PROGRAMISTA §2.9 |
| CSP | `next.config.ts`, `src/app/api/csp-report/route.ts` | `csp = { mode: 'report-only', reportUri: '/api/csp-report', r2Url, <flags> }` in `buildSecurityHeaders` + `buildAdminCspHeaders`; route `export const POST = createCspReportRoute()`; after clean reports `mode: 'enforce'` | `curl -sI $U/pl \| grep -i content-security-policy-report-only`; browser console and `[csp]` log lines without violations | security.md |
| data / routes | `src/lib/content.ts` | `export const { … } = createContentHelpers({ config, content, i18n: i18nConfig, baseUrl, markdownAlternate: true, summaryField: 'aiSummary', mcp: { serverName } })` | `pnpm tsc --noEmit` | frontend.md, PROGRAMISTA §2.7 |
@@ -196,33 +197,33 @@ Mandatory set: AGENT.md §0b, skill **ipal-setup**; checks: **ipal-audit**, **ip
| Pages | `src/collections/Pages.ts` | `buildSlugField({ from: 'title' })`, `buildNoindexField()`, `buildSummaryField()`, `slugHistory` field + `trackSlugHistoryHook`, `buildRevalidateHook({ revalidatePath, config })` → `afterChange`/`afterDelete` | edit in the panel → the page refreshes without a deploy | slug.md, hooks.md, seo.md |
| Pages — protection | as above | `beforeDelete: [buildPreventDeleteSystemPage({ settingsSlug: 'site-settings' })]`; `setPublishedAtHook`, `buildCrossLocaleFieldSync(...)` as needed | delete the homepage → error | hooks.md |
| Media | `src/collections/Media.ts` | `upload: { focalPoint: true }`, `hooks.beforeOperation: [normalizeFilenameHook, buildOptimizeUploadHook(), buildMediaPlaceholderHook()]`, fields `buildOptimizeUploadField()`, `buildMediaPlaceholderField()`, `alt` | upload `Zdjęcie Ś.JPG` → `zdjecie-s.jpg`, placeholder in the document | media.md |
| image lightbox (optional) | layout + blocks | `lightbox: true` in `ipalKit`; `<SiteProviders shell lightbox>`; `<LightboxTrigger group image={lightboxImage(media, { size: 'hero' })}>` around the thumbnail (`/client`); `<RenderRichText lightbox>` | keyboard: Tab to a thumbnail, Enter → dialog with focus on Close, ←/→, Esc → focus back; Network: a resized file on a phone | lightbox.md |
| image lightbox (optional) | layout + blocks | `lightbox: true` in `iapl`; `<SiteProviders shell lightbox>`; `<LightboxTrigger group image={lightboxImage(media, { size: 'hero' })}>` around the thumbnail (`/client`); `<RenderRichText lightbox>` | keyboard: Tab to a thumbnail, Enter → dialog with focus on Close, ←/→, Esc → focus back; Network: a resized file on a phone | lightbox.md |
| image on the frontend | `Media` primitive | `<Image {...mediaImageProps(media, { sizes })} />`, video `videoProps` | blur before load | media.md |
| storage | `payload.config.ts` | `buildR2Storage(['media'], { s3Storage })` — always (without `R2_*` = local disk) | upload → URL from `R2_PUBLIC_URL` | storage.md |
| e-mail | `payload.config.ts` | `email: mailAdapter()` (SMTP from the panel / Graph from env; also `panelSmtpAdapter`, `graphAdapter`, `sendEmail` from `/server`) | Site integrations → E-mail sending → **Send test** | email.md |
| forms — action | `app/(frontend)/[locale]/actions.ts` | `'use server'`; `export const sendForm = createSubmitAction({ getCachedPayload, headers })` (`/server`) | submit → document in Form Submissions + e-mails | forms.md, skill **ipal-form** |
| forms — action | `app/(frontend)/[locale]/actions.ts` | `'use server'`; `export const sendForm = createSubmitAction({ getCachedPayload, headers })` (`/server`) | submit → document in Form Submissions + e-mails | forms.md, skill **iapl-form** |
| forms — files | config + panel | `forms: { attachments: true }`; a **File** field on the form; an e-mail with fixed recipients in Forms → E-mails; `mailAdapter({ graph: { largeAttachments } })` when Graph must stay under 3 MB; Azure: `Mail.ReadWrite` limited to the forms mailbox for files of 3 MB and more over Graph | Test e-mail with "Attach a 10 MB test file" arrives; a submission with a PDF arrives with the attachment; nothing in Media | forms.md "Files", email.md "Attachments" |
| forms — render | form block | `<RenderForm form={form} action={sendForm} locale={locale} texts={formTexts} classNames={formClasses} />` (`/rsc`) | form from the panel, Turnstile, message from Notifications | forms.md |
| Turnstile | panel / env | `SiteProviders` wires `TurnstileProvider`; keys in Site integrations → Spam protection or env; server: `verifyTurnstile` (`/server`) | widget in the form; dashboard alert on a bad key | turnstile.md |
| consent | layout + policy page | banner via `SiteProviders`; table `<CookieTable rows={…} labels={…} />` (`/rsc`) from `getCookieTable` | `ipal-consent-check`; delete the consent cookie → the banner comes back | consent.md |
| cookie crawl | config + env + service | `cookieScanner: { crawl: true }`, `IPAL_COOKIE_SCAN_URL` / `IPAL_COOKIE_SCAN_TOKEN`, site in the service's `IPAL_CRAWLER_SITES`; optional Coolify scheduled task `curl -X POST -H "Authorization: Bearer $IPAL_COOKIE_SCAN_TOKEN" $U/api/ipal/cookie-crawl` | **Check site** → "Last crawl …: N pages, N violations"; *Privacy → Cookie check* | cookie-scanner.md → Browser crawl |
| consent | layout + policy page | banner via `SiteProviders`; table `<CookieTable rows={…} labels={…} />` (`/rsc`) from `getCookieTable` | `iapl-consent-check`; delete the consent cookie → the banner comes back | consent.md |
| cookie crawl | config + env + service | `cookieScanner: { crawl: true }`, `IAPL_COOKIE_SCAN_URL` / `IAPL_COOKIE_SCAN_TOKEN`, site in the service's `IAPL_CRAWLER_SITES`; optional Coolify scheduled task `curl -X POST -H "Authorization: Bearer $IAPL_COOKIE_SCAN_TOKEN" $U/api/ipal/cookie-crawl` | **Check site** → "Last crawl …: N pages, N violations"; *Privacy → Cookie check* | cookie-scanner.md → Browser crawl |
| cookie list | config | `cookieScanner: true` (+ `declarations` for embeds/chat), `generate:importmap`, `migrate:create` | *Cookie review* → **Scan cookies** → **Review and approve** → **Approve and add** → Cookies → Cookie list; `<CookieBanner settings="detailed">` and `<CookieTable>` list it | cookie-scanner.md |
| proof of consent | config + layout | `consentLog: true` + `logEndpoint="/api/ipal/consent"` | after a click, a document in Consent Records | consent.md |
| stats | config + layout | `stats: true` + `<SiteProviders stats={{ locale }}>` (or `<PageStats locale />` inside `ConsentProvider`) | `/<admin>/stats`; `POST /api/ipal/hit` request in Network | stats.md |
| stats | config + layout | `stats: true` + `<SiteProviders stats={{ locale }}>` (or `<PageStats locale />` inside `ConsentProvider`); on a site with `storageNames: 'iapl'` also `visitorCookie: IAPL_VISITOR_COOKIE` (`<PageStats visitorCookie={IAPL_VISITOR_COOKIE} />`) — `iapl-doctor` rule `storage-names` | `/<admin>/stats`; `POST /api/ipal/hit` request in Network | stats.md |
| analytics | layout | `SiteProviders` wires `Analytics` (ID from Site integrations → Analytics); Consent Mode: `analytics={{ consentMode: 'basic' }}` = no request to Google before consent, default `'advanced'` = the Google tag loads at once with every signal `denied` | Meta/other pixels only after consent; in `basic` no `gtm.js` / `gtag/js` in Network before consent | analytics.md, gtm-meta-pixel.md |
| extra JSON-LD | layout / `lib/content` | `jsonLd={[buildNavigationJsonLd(…)]}`; `siteJsonLd` → `buildLocalBusinessJsonLd` | Rich Results Test | seo.md |
| links and navigation | components | `buildLinkField`/`buildLinksField` in fields; `resolveNav`, `resolveLink`, `getSystemLinks` | a menu link still works after a slug change | links.md, skill **ipal-nav** |
| links and navigation | components | `buildLinkField`/`buildLinksField` in fields; `resolveNav`, `resolveLink`, `getSystemLinks` | a menu link still works after a slug change | links.md, skill **iapl-nav** |
| block library (schema) | `src/blocks/configs.ts` → `Pages.layout` | `export const blockOptions = { hero: true, textMedia: true, featureGrid: true, cta: true, richText: true, faq: true, contact: true, gallery: true } satisfies LibraryBlocksOptions`; `blocks: [...libraryBlocks(blockOptions), ...ownBlocks]` (`/blocks`) | block picker in en/pl; `pnpm generate:types`, `generate:importmap`; Postgres/SQLite `migrate:create` | block-library.md |
| blocks (registry) | `src/blocks/registry.ts` | `createBlockRegistry(content, { Image, Link, sendForm, formClassNames, contactDetails?, extra: { own: Own } })` (`/blocks/rsc`; `Image`/`Link` from `next/image`/`next/link`) → `blocks` for `createPageRoute`; own blocks use `buildSectionHeaderField`, `buildSectionSettingsField`, `buildItemsField` | every section has `data-ipal-block`; one `h1` per page | block-library.md, blocks.md, skill **ipal-block** |
| blocks (registry) | `src/blocks/registry.ts` | `createBlockRegistry(content, { Image, Link, sendForm, formClassNames, contactDetails?, extra: { own: Own } })` (`/blocks/rsc`; `Image`/`Link` from `next/image`/`next/link`) → `blocks` for `createPageRoute`; own blocks use `buildSectionHeaderField`, `buildSectionSettingsField`, `buildItemsField` | every section has `data-ipal-block`; one `h1` per page | block-library.md, blocks.md, skill **iapl-block** |
| page templates | `scripts/seed-content.ts` | `pageTemplates.home({ blocks: libraryBlockSlugs(blockOptions) })`, `pageTemplates.contact({ form: { $form: 'Contact form' } })` (`/templates`); after launch only with `SEED_ONLY` | seed summary 0 errors | block-library.md, seeding.md |
| FAQ rich results | page route | `getPageJsonLd(locale, slug, { faq: faqItemsFromLayout })` | Rich Results Test → FAQPage | block-library.md, seo.md |
| languages in the header | header | `<LanguageSwitcher>` (`/client`), `<AlternateLinksUpdater>` | switches to `/en/<slug-en>` | i18n.md |
| Tailwind + design tokens | `styles.css`, `src/design/tokens.ts`, `DESIGN.md` | `@import` `fluid-wide.css` (or `fluid.css`), `tokens.css`, `tailwind.css`, `../../design/tokens.css` + `@source "…/node_modules/@intecion/ipal-kit/dist/**/*.js";`; `pnpm exec ipal-tokens`; next/font `--font-family-body` / `--font-family-heading` | `ipal-tokens --check` up to date, no ✗ contrast rows; the cookie banner in the brand colour in both themes | design-tokens.md |
| Tailwind + design tokens | `styles.css`, `src/design/tokens.ts`, `DESIGN.md` | `@import` `fluid-wide.css` (or `fluid.css`), `tokens.css`, `tailwind.css`, `../../design/tokens.css` + `@source "…/node_modules/@intecion/ipal-kit/dist/**/*.js";`; `pnpm exec iapl-tokens`; next/font `--font-family-body` / `--font-family-heading` | `iapl-tokens --check` up to date, no ✗ contrast rows; the cookie banner in the brand colour in both themes | design-tokens.md |
| a11y widget CSS | `styles.css` | `@import "@intecion/ipal-kit/a11y.css";` (only with `<AccessibilityWidget>`) | widget options change the page | accessibility.md |
| `/its` panel | `app/(payload)/its/…` | `adminRoute: '/its'` + `its` in the proxy matcher | `/its` login, `/admin` 404 | security.md |
| skills | `package.json` | `"ipal:skills": "ipal-skills"` | `.agents/skills/` up to date | PROGRAMISTA §2.1a |
| a new site | CLI (from the parent folder) | `pnpm --config.auto-install-peers=false dlx @intecion/ipal-kit@<version> create <domain> [--answers answers.json] [--dir] [--external] [--no-install] [--no-git] [--dry-run]`; in a project: `pnpm exec ipal-kit create <domain> --dir ../<name>-web`. Building blocks: `@intecion/ipal-kit/starter` (resources/api.md) | one commit, `AGENTS.md` decisions filled, `pnpm typecheck` passes | project-starter.md |
| eject a library block | CLI | `pnpm exec ipal-blocks list` / `pnpm exec ipal-blocks eject faq [--dest src/blocks] [--dry-run]` → `src/blocks/Faq/`; then the ejected builder in `blockOptions`' place and `components: { faq: FaqBlock }` | the block renders from the project file | block-library.md "Own blocks and eject" |
| skills | `package.json` | `"iapl:skills": "iapl-skills"` | `.agents/skills/` up to date | PROGRAMISTA §2.1a |
| a new site | CLI (from the parent folder) | `pnpm --config.auto-install-peers=false dlx @intecion/ipal-kit@<version> create <domain> [--answers answers.json] [--dir] [--external] [--no-install] [--no-git] [--dry-run]`; in a project: `pnpm exec iapl create <domain> --dir ../<name>-web`. Building blocks: `@intecion/ipal-kit/starter` (resources/api.md) | one commit, `AGENTS.md` decisions filled, `pnpm typecheck` passes | project-starter.md |
| eject a library block | CLI | `pnpm exec iapl-blocks list` / `pnpm exec iapl-blocks eject faq [--dest src/blocks] [--dry-run]` → `src/blocks/Faq/`; then the ejected builder in `blockOptions`' place and `components: { faq: FaqBlock }` | the block renders from the project file | block-library.md "Own blocks and eject" |
**`createContentHelpers` keys (exports of `@/lib/content`)** — all lazy and cached per request:
@@ -248,39 +249,40 @@ and what throws without `i18n`: frontend.md. `SiteProviders` props: `shell`, `ba
## 4. Environment variables
`.env` in dev, the hosting runtime (Coolify) in production, `.env.example` without values in the repo. Validation: `ipalEnvRules(features)`.
`.env` in dev, the hosting runtime (Coolify) in production, `.env.example` without values in the repo. Validation: `iaplEnvRules(features)`.
The plugin's own variables are `IAPL_<NAME>`; a deploy that sets the spelling from before 1.17.0, `IPAL_<NAME>`, keeps working (`IAPL_…` is read first, `IPAL_…` when it is missing or empty). Do not rename them in an existing deploy unless the owner asks; never set both.
| variable | required when | effect when missing | where to set |
|---|---|---|---|
| `DATABASE_URI` | always (Payload; `ipalEnvRules` always) | no database, startup fails | env (name: `databaseVar`); the database is named `<domain without dots>_prod` / `_dev` (`intecioncom_prod`), checked by `databaseName: true` |
| `PAYLOAD_SECRET` | always; ≥ 32 characters in production (`ipalEnvRules({ secretMinLength })`, default 32, `0` = off) | Payload does not start; `assertEnv` throws (also for a too-short secret in production) | env, different in prod (`secretVar`) |
| `DATABASE_URI` | always (Payload; `iaplEnvRules` always) | no database, startup fails | env (name: `databaseVar`); the database is named `<domain without dots>_prod` / `_dev` (`intecioncom_prod`), checked by `databaseName: true` |
| `PAYLOAD_SECRET` | always; ≥ 32 characters in production (`iaplEnvRules({ secretMinLength })`, default 32, `0` = off) | Payload does not start; `assertEnv` throws (also for a too-short secret in production) | env, different in prod (`secretVar`) |
| `NEXT_PUBLIC_SERVER_URL` | always (`kind: 'url'`) | sitemap/robots/canonical/JSON-LD/llms with origin `''` (relative), IndexNow does not send, R2 relative URL without a prefix | env (`serverUrlVar`) |
| `NODE_ENV` | no (`development`/`production`/`test`) | `production` is stricter: R2 and `IPAL_IP_HEADER` required, IndexNow works, IP warning, `buildImagesConfig` prod | set by Next / hosting |
| `NODE_ENV` | no (`development`/`production`/`test`) | `production` is stricter: R2 and `IAPL_IP_HEADER` required, IndexNow works, IP warning, `buildImagesConfig` prod | set by Next / hosting |
| `R2_BUCKET`, `R2_ENDPOINT`, `R2_ACCESS_KEY_ID`, `R2_SECRET_ACCESS_KEY` | `storage: true` + production, or when at least one is set (all or none) | local disk (in prod files disappear on redeploy); incomplete set → warning | env |
| `R2_PUBLIC_URL` | optional; required only with `ipalEnvRules({ storage: { requirePublicUrl: true } })` (then like the other `R2_*`); absolute URL in prod when set | empty (default) → media served by the app at `/api/media/file/…` (Media needs `access.read: () => true`); set it only for a media domain on Cloudflare (storage.md); `R2_PUBLIC_URL` alone in dev = media read-only; `/media` allowed outside prod; also used by `buildImagesConfig`, `MediaPreconnect`, CSP | env |
| `R2_PUBLIC_URL` | optional; required only with `iaplEnvRules({ storage: { requirePublicUrl: true } })` (then like the other `R2_*`); absolute URL in prod when set | empty (default) → media served by the app at `/api/media/file/…` (Media needs `access.read: () => true`); set it only for a media domain on Cloudflare (storage.md); `R2_PUBLIC_URL` alone in dev = media read-only; `/media` allowed outside prod; also used by `buildImagesConfig`, `MediaPreconnect`, CSP | env |
| `GRAPH_TENANT_ID`, `GRAPH_CLIENT_ID`, `GRAPH_CLIENT_SECRET`, `GRAPH_SENDER` | `emailGraph: true` / Graph transport in the panel | `mailAdapter` falls back to SMTP from the panel (logged) | env (agency Exchange) |
| `NEXT_PUBLIC_TURNSTILE_SITE_KEY`, `TURNSTILE_SECRET_KEY` | `turnstile: true` (names: `siteKeyVar`/`secretVar`) | fallback for keys from Site integrations → Spam protection; neither set → Turnstile off | panel (takes precedence) or env |
| `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 |
| `IAPL_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) |
| `IAPL_COOKIE_SCAN_URL`, `IAPL_COOKIE_SCAN_TOKEN` | `cookieScanner.crawl` (`iaplEnvRules({ 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 `IAPL_CRAWLER_SITES` as `host=token` |
| `IAPL_DOCTOR_TOKEN` | no; ≥ 32 characters | `GET /api/ipal/doctor` answers 404; with it the endpoint answers a Bearer token, and `iapl-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`), `IAPL_DOCTOR_IMPORT_MAP` (internal) — doctor.md |
| `IAPL_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 |
Details: env.md, deployment.md, PROGRAMISTA §3.
**DNS** (A/AAAA, www, CAA, Search Console TXT, Bing, SPF/DKIM/DMARC for the From domain, R2 domain): the plugin sets nothing — list of records to check with `dig`: `deployment.md` §6, summary in **ipal-setup** stage 11.
**DNS** (A/AAAA, www, CAA, Search Console TXT, Bing, SPF/DKIM/DMARC for the From domain, R2 domain): the plugin sets nothing — list of records to check with `dig`: `deployment.md` §6, summary in **iapl-setup** stage 11.
**Seeding** (content in pages, forms, globals) — **VERY IMPORTANT: after launch never re-seed everything; named records only** (`only` / `SEED_ONLY`; a full run of a live database needs the owner's OK and `IPAL_SEED_ALLOW_FULL=1`). Create-only, matched by a natural key, never delete, never seed users or secrets, dry run → backup → real run; updates on production only for untouched records and only with `IPAL_SEED_ALLOW_PROD_UPDATE=1`. Helper: `createSeeder` from `@intecion/ipal-kit/seed` (resources/api.md → Seeding), with `guardSeedExit()` called first (an early exit → exit 1 with the reason, never a silent 0). Templates: `ipal-site/resources/seed-content.template.ts`, `ipal-form/resources/seed-form.template.ts`. Rules and Coolify steps: `node_modules/@intecion/ipal-kit/docs/seeding.md`.
**Seeding** (content in pages, forms, globals) — **VERY IMPORTANT: after launch never re-seed everything; named records only** (`only` / `SEED_ONLY`; a full run of a live database needs the owner's OK and `IAPL_SEED_ALLOW_FULL=1`). Create-only, matched by a natural key, never delete, never seed users or secrets, dry run → backup → real run; updates on production only for untouched records and only with `IAPL_SEED_ALLOW_PROD_UPDATE=1`. Helper: `createSeeder` from `@intecion/ipal-kit/seed` (resources/api.md → Seeding), with `guardSeedExit()` called first (an early exit → exit 1 with the reason, never a silent 0). Templates: `iapl-site/resources/seed-content.template.ts`, `iapl-form/resources/seed-form.template.ts`. Rules and Coolify steps: `node_modules/@intecion/ipal-kit/docs/seeding.md`.
| Seed env var (run time) | Effect |
|---|---|
| `SEED_DRY_RUN=1` (or `--dry-run`) | no writes, print the plan |
| `SEED_UPDATE=1` | also update records nobody edited since seeding |
| `IPAL_SEED_ALLOW_PROD_UPDATE=1` | allow `SEED_UPDATE=1` on production / a non-local database (back up first) |
| `IAPL_SEED_ALLOW_PROD_UPDATE=1` | allow `SEED_UPDATE=1` on production / a non-local database (back up first) |
| `SEED_ONLY` | the records a run may touch (`pages:kontakt,global:header`) — required after launch |
| `IPAL_SEED_ALLOW_FULL=1` | allow a run without `SEED_ONLY` on production / a non-local database — owner's explicit OK only (in code: `createSeeder(payload, { guard: { allowFull: true } })`; `guard: false` turns every guard off) |
| `IAPL_SEED_ALLOW_FULL=1` | allow a run without `SEED_ONLY` on production / a non-local database — owner's explicit OK only (in code: `createSeeder(payload, { guard: { allowFull: true } })`; `guard: false` turns every guard off) |
| `SEED_FORCE=1` | with `SEED_UPDATE=1`: overwrite edited records too — local database only |
| `SEED_LOCAL_HOSTS` | extra hosts that count as a local database (comma-separated) |
| `SEED_DB_URL_ENV` | name of the env var holding the database URL (default `DATABASE_URI`) |
@@ -1,8 +1,8 @@
# ipal-kit — export index
# IAPL — export index
Every public export of `@intecion/ipal-kit` (all entries: root, `/client`, `/rsc`,
`/server`, `/seed`, `/starter`, `/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.
(`grep -n "name" .agents/skills/iapl-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`.
@@ -10,9 +10,10 @@ project wires: `../SKILL.md`. Module details: `node_modules/@intecion/ipal-kit/d
| Export | Import from | What it does / when |
|---|---|---|
| `ipalKit(options)` | `@intecion/ipal-kit` | Payload 3 plugin (`plugins: [ipalKit({...})]`) — the only wiring point: adds globals (SiteSettings, SiteIntegrations, CookieSettings, Notifications), roles, enforced 2FA, SEO, forms, i18n (localization), white-label, stats, consent log, `/api/ipal/*` endpoints; no auth collection → injects a simple `users`. Validates `i18n` right away (fail fast). `enabled: false` = schema stays, behaviour off. |
| `ipalKit`, `IpalOptions`, `ipalEnvRules`, `IpalEnvFeatures`, `ipalT`, `ipalVar`, `IPAL_TOKENS`, `IPAL_BREAKPOINTS`, `IpalTokenName`, `IpalGlobalSlug` | as their new names | The names before 1.17.0 of `iapl`, `IaplOptions`, `iaplEnvRules`, `IaplEnvFeatures`, `iaplT`, `iaplVar`, `IAPL_TOKENS`, `IAPL_BREAKPOINTS`, `IaplTokenName`, `IaplGlobalSlug`: the same values, deprecated, removed in 2.0. Existing code keeps them; new code uses the new names (AGENT.md "Names: IAPL and ipal-kit"). |
| `iapl(options)` | `@intecion/ipal-kit` | Payload 3 plugin (`plugins: [iapl({...})]`) — the only wiring point: adds globals (SiteSettings, SiteIntegrations, CookieSettings, Notifications), roles, enforced 2FA, SEO, forms, i18n (localization), white-label, stats, consent log, `/api/ipal/*` endpoints; no auth collection → injects a simple `users`. Validates `i18n` right away (fail fast). `enabled: false` = schema stays, behaviour off. |
**Types:** `IpalOptions` — `ipalKit()` options: `i18n`, `access`, `twoFactor` (`{ issuer, plugin: payloadTotp }` or `false`), `whiteLabel`, `adminRoute`, `consentLog`, `content`, `cookieScanner`, `forms`, `pages`, `seo`, `searchSettings`, `stats`, `indexNow`, `siteSettingsFields`, `integrationsFields`, `globalOverrides`, `revalidatePath`, `enabled`. `GlobalOverride`, `GlobalOverrides`, `IpalGlobalSlug` — see Payload globals below.
**Types:** `IaplOptions` — `iapl()` options: `i18n`, `access`, `twoFactor` (`{ issuer, plugin: payloadTotp }` or `false`), `whiteLabel`, `adminRoute`, `consentLog`, `content`, `cookieScanner`, `forms`, `pages`, `seo`, `searchSettings`, `stats`, `indexNow`, `siteSettingsFields`, `integrationsFields`, `globalOverrides`, `revalidatePath`, `enabled`. `GlobalOverride`, `GlobalOverrides`, `IaplGlobalSlug` — see Payload globals below.
## Admin (import map) (`admin`, `branding`, `admin-ui`, `globals/SiteIntegrations`) — details: `node_modules/@intecion/ipal-kit/docs/white-label.md`, `…/docs/integrations.md`, `…/docs/email.md`, `…/docs/links.md`
@@ -33,7 +34,7 @@ Admin panel components from `@intecion/ipal-kit/admin` — the project does NOT
| `CookieScanButton` | `@intecion/ipal-kit/admin` | "Scan cookies" box above the *Cookie review* list: integrations in use, optional extra names, runs `POST /api/ipal/cookie-scan`. Injected by the plugin with `cookieScanner`; after turning it on, `pnpm generate:importmap`. |
| `SafeTotpView` | `@intecion/ipal-kit/admin` | Server admin view in front of the 2FA package's setup and verify views: replaces the `back` query value with a checked one and renders the view named by the serverProp `ipalTotpView` (a path or `{ path, exportName }`, found in the import map) the way Payload renders a view: a server component gets all server props, a client component only Payload's client props, `ipalTotpClientProps`, `back` and `searchParams` (both checked). `ipalSafeBack` = own rule. Registered by the plugin with `twoFactor` (`twoFactor.safeBack`, on by default). After upgrading, `pnpm generate:importmap`. Check: password only → `/admin/verify-totp?back=https%3A%2F%2Fexample.com%2F` → code → `/admin`. Own registration: `Component: { path: '@intecion/ipal-kit/admin#SafeTotpView', serverProps: { ipalTotpView: '<path>' } }` + that path in `admin.dependencies`. |
| `TotpRedirectProvider` | `@intecion/ipal-kit/admin` | Client admin provider: sends a user without TOTP to `/admin/setup-totp?back=…` and a user whose session has not passed TOTP to `/admin/verify-totp?back=…` (path read in the browser; never redirects away from those screens or logout; renders nothing while redirecting). Injected by the plugin with `twoFactor` in place of the package's header-based provider; swap with `twoFactor.provider`. After upgrading, `pnpm generate:importmap`. Check: a new admin lands on `setup-totp?back=%2Fadmin` with the QR code. Props type `TotpRedirectProviderProps` (`forceSetup`) |
| `TwoFactorStatusField` | `@intecion/ipal-kit/admin` | Server component, the `totpSetupStatus` UI field ipalKit adds to the 2FA collection (sidebar of an account): "Set up", "Not set up… until <date>" or "blocked", and for an administrator on someone else's account the reset / "Reopen setup" button. Wired by the plugin with `twoFactor.requireSetup`; needs `generate:importmap`. |
| `TwoFactorStatusField` | `@intecion/ipal-kit/admin` | Server component, the `totpSetupStatus` UI field iapl adds to the 2FA collection (sidebar of an account): "Set up", "Not set up… until <date>" or "blocked", and for an administrator on someone else's account the reset / "Reopen setup" button. Wired by the plugin with `twoFactor.requireSetup`; needs `generate:importmap`. |
| `TwoFactorResetButton` | `@intecion/ipal-kit/admin` | Client button inside `TwoFactorStatusField`: `POST /api/ipal/two-factor/reset` `{ userId }`, then reloads the view. Props `{ kind: 'reset' \| 'reopen', userId }`. |
| `TwoFactorAlert` | `@intecion/ipal-kit/admin` | Server component on the dashboard (`beforeDashboard`), administrators only: accounts without two-step verification and how many are blocked. Wired by the plugin with `twoFactor.requireSetup`; renders nothing when every account has it. |
| `IntecionCredit` | `@intecion/ipal-kit/admin` | The line "Technology support: Intecion.com" (admin language; `agency` prop = the name) below the nav and below the login form (`variant: 'nav' \| 'login'`). Injected by the plugin with `whiteLabel`; turn off: `whiteLabel: { credit: false }` or `agency: false`. |
@@ -63,18 +64,18 @@ Admin panel components from `@intecion/ipal-kit/admin` — the project does NOT
| `adminOnlyField` | `@intecion/ipal-kit` | `FieldAccess` (boolean only): field for admin only. In `field.access.read/update`. |
| `adminOrEditorField` | `@intecion/ipal-kit` | `FieldAccess`: field for editor or admin. |
| `requireRoleField(minimum)` | `@intecion/ipal-kit` | `FieldAccess` factory: at least the given role. |
| `hasMinimumRole(user, minimum, source?)` | `@intecion/ipal-kit`; in client components `@intecion/ipal-kit/client` | Predicate → `boolean`: the user is an account of a **staff collection** and has a role ≥ `minimum` (reads `user.roles` and `user.collection` safely). A role on an account of another auth collection never counts. `source` says which collections are staff: `req.payload` on the server, the config from `useConfig()` in a client component (it has `admin.user` only; for `access.staffCollections` pass the list), or `{ staffCollections: ['users'] }` (middleware). Without it: the staff collections of the config ipalKit built in this process (two different configs: only what both call staff) — and **`false` where there is none** (browser bundle, middleware, edge). Does not check the second factor. |
| `hasMinimumRole(user, minimum, source?)` | `@intecion/ipal-kit`; in client components `@intecion/ipal-kit/client` | Predicate → `boolean`: the user is an account of a **staff collection** and has a role ≥ `minimum` (reads `user.roles` and `user.collection` safely). A role on an account of another auth collection never counts. `source` says which collections are staff: `req.payload` on the server, the config from `useConfig()` in a client component (it has `admin.user` only; for `access.staffCollections` pass the list), or `{ staffCollections: ['users'] }` (middleware). Without it: the staff collections of the config iapl built in this process (two different configs: only what both call staff) — and **`false` where there is none** (browser bundle, middleware, edge). Does not check the second factor. |
| `isAdmin(user, source?)` | `@intecion/ipal-kit`; in client components `@intecion/ipal-kit/client` | Predicate → `boolean`: staff account with the `admin` role (see `hasMinimumRole`). In hooks and endpoints: `isAdmin(req.user, req.payload)`; in a client component: `isAdmin(user, config)` from `/client` — the main entry does not build there with webpack (`'server-only' cannot be imported…`). |
| `isEditor(user, source?)` | `@intecion/ipal-kit`; in client components `@intecion/ipal-kit/client` | Predicate → `boolean`: staff account with `editor` or higher. |
| `panelAccess(minimum?)`, `applyPanelRole(config, slug, role)`, `resolvePanelRole(option)`, `countBelowPanelRole(payload, slug, role)`, `DEFAULT_PANEL_ROLE` | `@intecion/ipal-kit` | `accounts.panelRole`: an `access.admin` function ("holds at least `minimum`", default `'editor'`; role only, not the second factor); the applier (skips a collection that has its own `access.admin`); the option → role or `null` when off; `{ all, below }` counts for the start-up line; `'editor'`. |
| `staffCreateAccess`, `staffUpdateAccess(slug)`, `staffReadAccess`, `sameStaffCollectionAccess(slug)`, `rolesByAdminOnly`, `rolesNotOwn(slug)`, `hasPluginRoles(collection)`, `canHoldStaffRole(collection)`, `rolesAreAList(collection)`, `applyStaffAccountAccess(config, staffSlugs, { create?, write?, read?, pluginRoles? })` | `@intecion/ipal-kit` | `accounts.adminOnlyCreate` / `adminOnlyWrite` / `staffOnlyRead`: the access functions — "an admin, fully signed in" (create, delete, unlock); "an admin, or the account itself" (update; self = an account of THAT collection); "a fully signed-in account of a staff collection" (read); "an account of this staff collection, or a plugin admin of another" (a collection whose roles are not the plugin's); the two field-access functions for a `roles` field (`update`: only an admin / never the account itself); whether a collection carries the plugin's roles (a `roles` select with `hasMany` at the top level of the data with only `user` / `editor` / `admin`); whether an account of it can hold `editor` or `admin` whatever else the field offers (a select with one of them among its values, or a `roles` field whose values cannot be listed — text, json, a relationship) — then the admin rules apply too; whether the `roles` field can put an ARRAY on the account at all (select / text / relationship need `hasMany`; radio, number, date, checkbox never do) — the plugin counts roles only from an array, so a single-valued field brings no admin rules; the applier — puts the rules on the named staff collections for the operations that have none and closes the `roles` field where the plugin's `update` rule is in force, `pluginRoles` = slugs whose roles field is injected later. Run it before any plugin that wraps access (the 2FA package). |
| `buildFirstUserEndpoint(option?)`, `applyFirstUserRoute(config, option?)`, `adoptLateAuthCollections(config, staffSlugs, { access?, beforeOperation?, firstUserRoute? })`, `bothAllow(first, second)`, `unknownStaffCollections(config, staffSlugs)`, `openSignUpCollections(payload)`, `staffCollectionsOpenToOthers(payload)`, `staffCollectionsOnOwnRoles(payload)`, `staffCollectionsNobodyManages(payload, staffSlugs, except?)` | `@intecion/ipal-kit` | `accounts.firstUserRoute`: the plugin's own `POST /first-register` collection endpoint, matched before Payload's — `403` unless the collection is the panel's login collection (`'panel'`), is in the list, or its own `create` lets an anonymous request through; otherwise it calls Payload's handler (and sets `req.context.ipalFirstRegister`); the applier (every auth collection; `'all'` adds nothing; `endpoints: false` is left alone). For the doctor: slugs of auth collections with open sign-up; `'<slug>:<operation>'` for every staff collection an account of a non-staff collection may create in, read, update, delete from or unlock; slugs of staff collections with role values of their own on the default rules. `adoptLateAuthCollections` takes the LIVE config (`payload.config`) and gives auth collections that a plugin listed after ipalKit added the same rules, in place (called by the plugin at start and on every dev reload; returns `LateAdoption[]` — per collection what was put). There the rules are combined with the collection's own by `bothAllow` (an access function that allows only when both do; two query constraints are joined with `and`), because in a sanitized config Payload's default cannot be told from a written rule — never by a function's name, which a production build changes. `custom.ipal.accountRules: false` on a late collection keeps its rules as they are. A collection is "handled" when its marker `custom.ipalAccounts` (`AccountsMarker`: `{ slug, staff }`) names its own slug and its staff status; a copy under a new slug, or a collection that became staff since, is handled again (`markSeenAuthCollections(config, staffSlugs)` writes the marker at config time). On a COPY the plugin never replaces or rewrites a rule: its rule for the copy's slug goes in front of every rule on a staff copy, and in front of the rules marked as the plugin's for another collection (`staffRuleOf`) on a copy that is not staff or keeps its own rules; the `roles` field of every copy is guarded. `unknownStaffCollections` lists staff slugs that are not auth collections (Payload does not start on any). | `staffCollectionsNobodyManages` (async) → `{ stuck, unchecked }`: `stuck` — staff collections on the admin rules while no staff account is a plugin admin (nobody can create, delete or unlock accounts there; the plugin warns at start); `unchecked` — staff collections whose accounts could not be checked, in which case nothing is claimed. Each collection is asked in the way its field allows.
| `buildFirstUserEndpoint(option?)`, `applyFirstUserRoute(config, option?)`, `adoptLateAuthCollections(config, staffSlugs, { access?, beforeOperation?, firstUserRoute? })`, `bothAllow(first, second)`, `unknownStaffCollections(config, staffSlugs)`, `openSignUpCollections(payload)`, `staffCollectionsOpenToOthers(payload)`, `staffCollectionsOnOwnRoles(payload)`, `staffCollectionsNobodyManages(payload, staffSlugs, except?)` | `@intecion/ipal-kit` | `accounts.firstUserRoute`: the plugin's own `POST /first-register` collection endpoint, matched before Payload's — `403` unless the collection is the panel's login collection (`'panel'`), is in the list, or its own `create` lets an anonymous request through; otherwise it calls Payload's handler (and sets `req.context.ipalFirstRegister`); the applier (every auth collection; `'all'` adds nothing; `endpoints: false` is left alone). For the doctor: slugs of auth collections with open sign-up; `'<slug>:<operation>'` for every staff collection an account of a non-staff collection may create in, read, update, delete from or unlock; slugs of staff collections with role values of their own on the default rules. `adoptLateAuthCollections` takes the LIVE config (`payload.config`) and gives auth collections that a plugin listed after iapl added the same rules, in place (called by the plugin at start and on every dev reload; returns `LateAdoption[]` — per collection what was put). There the rules are combined with the collection's own by `bothAllow` (an access function that allows only when both do; two query constraints are joined with `and`), because in a sanitized config Payload's default cannot be told from a written rule — never by a function's name, which a production build changes. `custom.ipal.accountRules: false` on a late collection keeps its rules as they are. A collection is "handled" when its marker `custom.ipalAccounts` (`AccountsMarker`: `{ slug, staff }`) names its own slug and its staff status; a copy under a new slug, or a collection that became staff since, is handled again (`markSeenAuthCollections(config, staffSlugs)` writes the marker at config time). On a COPY the plugin never replaces or rewrites a rule: its rule for the copy's slug goes in front of every rule on a staff copy, and in front of the rules marked as the plugin's for another collection (`staffRuleOf`) on a copy that is not staff or keeps its own rules; the `roles` field of every copy is guarded. `unknownStaffCollections` lists staff slugs that are not auth collections (Payload does not start on any). | `staffCollectionsNobodyManages` (async) → `{ stuck, unchecked }`: `stuck` — staff collections on the admin rules while no staff account is a plugin admin (nobody can create, delete or unlock accounts there; the plugin warns at start); `unchecked` — staff collections whose accounts could not be checked, in which case nothing is claimed. Each collection is asked in the way its field allows.
| `staffRuleOf(rule)`, `isPasswordRuleHook(hook)` | `@intecion/ipal-kit` | The plugin's mark on its own functions, read-only (a `Symbol.for` property on the function, so it travels with a copied collection and is the same for every instance of the module): `{ slug, self }` — the collection the rule was written for and the function the mark was made for — or `undefined` for a rule the plugin did not put there. It counts only on that very function: a closure, a `Proxy` or a copied function around the plugin's rule is your own rule. `isPasswordRuleHook`: whether a `beforeOperation` hook is the plugin's password rule. The mark is used for one thing: to put the plugin's rule for a copy's own slug in front of a rule written for the original. |
| `checkPassword(password, { email?, minLength? })`, `buildPasswordRuleHook({ minLength? })`, `applyPasswordRule(config, slugs, rule)`, `resolvePasswordRule(option)`, `DEFAULT_PASSWORD_MIN_LENGTH` | `@intecion/ipal-kit` | `accounts.password`: `'short' \| 'email' \| null` for a new password (length in characters); the `beforeOperation` hook for `create` / `update` / `resetPassword` (throws Payload's `ValidationError` on `password`, text in the panel's language; the account's address is looked up by id, reset token or bulk query when the request carries none; a password that is not text is refused; login is never checked); the applier; the option → `{ minLength }` or `null`; `12`. |
| `writeOnlySecret(field, options?)`, `writeOnlySecrets(fields, names, optionsByName?)`, `maskSecretAfterRead`, `keepSecretBeforeValidate`, `buildKeepSecret(options?)`, `SECRET_MASK`, `SECRET_CLEAR`, `isSecretMask(value)`, `INTEGRATION_SECRET_FIELDS`, `SMTP_PASSWORD_BOUND_TO` | `@intecion/ipal-kit` | Write-only secret fields (`secrets.writeOnly`): the wrapper for one field and for named fields anywhere in a tree (tabs, rows, groups); the two field hooks (reads through access control get `'********'`, the Local API with access control off gets the value; a save with nothing / empty / the mask keeps the stored value, `'[[clear]]'` removes it); the hook builder with options — `{ boundTo: ['siblingField'], appliesWhen?: (siblingData) => boolean }`: a save through access control that changes a bound sibling field without sending the secret throws a `ValidationError` on the secret (`secrets.reenterOnChange`); the two constants; the plugin's own secret field names (`smtpPassword`, `turnstileSecretKey`); the fields the SMTP password is bound to (`smtpHost`, `smtpPort`, `smtpUser` — not the transport: the mail adapter may fall back to SMTP). |
| `maskSecretsOnRestore`, `maskWriteOnlySecrets(data, fields)` | `@intecion/ipal-kit` | Versions and write-only secrets: the `afterRead` hook for a global or a collection (a restore answers with the version document, fields under `version`, where field hooks do not run — it masks them there for reads through access control); the walker it uses (masks every write-only field in `data`, following tabs, rows, groups, arrays and blocks). On Site integrations by default; add the hook to your own entity that has both. |
| `requestFromOwnOrigin(req, extraOrigins?)`, `ownOrigins(req, extraOrigins?)`, `reportRefusedOrigin(req, extraOrigins?)` | `@intecion/ipal-kit` | `twoFactor.sameOrigin`: `false` when a browser marks the request as coming from another origin (`Origin` not among the request's host, `serverURL`, `csrf`, `cors`, the extras; a default port written out on the host is ignored; else `Sec-Fetch-Site` not `same-origin` / `none`); `true` without those headers. `ownOrigins` → `{ hosts, origins }`. `reportRefusedOrigin` writes one log line per refused origin and process (at most 50) with the ways to allow it, and returns whether it wrote. For your own state-changing endpoint. |
| `buildVerifyLimit(collection, { max?, windowMinutes?, store? })`, `verifyLimitKey(collection, id)`, `clearVerifyLimits()` | `@intecion/ipal-kit` | `twoFactor.verifyLimit`: `async (req) => Response \| null` — counts an attempt of `req.user` in memory and, unless `store: 'memory'`, in `payload.kv`; a `429` with `Retry-After` past `max`. The kv key of an account's count; emptying the in-memory counts (tests). |
| `buildVerifyLimit(collection, { max?, windowMinutes?, store?, keyPrefix? })`, `verifyLimitKey(collection, id, keyPrefix?)`, `clearVerifyLimits()` | `@intecion/ipal-kit` | `twoFactor.verifyLimit`: `async (req) => Response \| null` — counts an attempt of `req.user` in memory and, unless `store: 'memory'`, in `payload.kv`; a `429` with `Retry-After` past `max`. The kv key of an account's count; emptying the in-memory counts (tests). |
| `turnstileSecretFromEnv(integrations)`, `TURNSTILE_SECRET_ENV` | `@intecion/ipal-kit` | `true` when the Turnstile secret in use comes from the environment because the panel field is empty (**deprecated** path; the doctor's `turnstile-env-key`); the variable's name, `'TURNSTILE_SECRET_KEY'`. |
| `userMeetsRole(req, minimum)` | `@intecion/ipal-kit` | Predicate → `boolean` with `req` (`{ payload, user }`), in this order: the account belongs to a **staff collection** (`admin.user`, `access.authCollection`, `access.staffCollections`); with 2FA on it has passed the second factor (`secondFactorPassed`); it has a role ≥ `minimum`, **or** its collection has no `roles` field (the project omitted `access`). An account of any other auth collection never passes, whatever fields it has. The plugin's staff features (Site integrations, settings globals, form submissions, consent records, stats, cookie scanner, the e-mail test) use it; use it in your own endpoints. |
| `staffCollectionSlugs(source?)` | `@intecion/ipal-kit` | `string[]`: the staff collections — `admin.user`, `access.authCollection` and `access.staffCollections` — from `req.payload`, a config or `{ staffCollections }`; without an argument what the configs built in this process agree on (`[]` when there is none). Roles and staff checks count only for accounts of these. |
@@ -82,7 +83,7 @@ Admin panel components from `@intecion/ipal-kit/admin` — the project does NOT
| `buildRolesField(defaultRole?, { firstUserAdmin? })` | `@intecion/ipal-kit` | The `roles` select field the plugin injects (only admins set roles; `firstUserAdmin` default `true` = the account made on "Create first user" gets `admin`). The plugin wires it itself — use it only for an auth collection the plugin does not manage. |
| `injectRoles(config, accessOption)` | `@intecion/ipal-kit` | Adds `roles` to `accessOption.authCollection` in a config. The plugin calls it itself with `access` — do not call. |
**Types:** `AccountsOptions` (`accounts`: `panelRole`, `adminOnlyCreate`, `adminOnlyWrite`, `staffOnlyRead`, `firstUserRoute`, `password`), `StaffAccountAccessOptions` (`{ create?, write?, read?, pluginRoles? }`), `StaffRuleMark` (`{ slug, self }`), `AccountsMarker` (`{ slug, staff, own? }`, in `custom.ipalAccounts`; `own`: the operations that had a rule of the project's at config time, kept when the collection becomes staff later), `LateAdoption` (`{ slug, applied, kept, known, password, firstUser }`; `known`: in the config when ipalKit ran and staff only afterwards, `kept`: its operations whose own rule was left as written), `StaffAccountRules` (what the plugin put on a staff collection, in `custom.ipalAccountRules`: `{ applied, ownRoles }`), `WriteOnlySecretOptions` (`{ boundTo?, appliesWhen? }`), `PasswordRuleOptions` (`{ minLength? }`), `FirstUserRouteOption` (`'panel' \| 'all' \| string[]`), `TurnstileOnConfigError` / `TurnstileOnConfigErrorOption` / `TurnstileFormKind` (`@intecion/ipal-kit/server`), `VerifyLimitOptions` (`twoFactor.verifyLimit`: `{ max?, windowMinutes?, store? }`), `RequireSetupOptions` (`twoFactor.requireSetup`), `TwoFactorResetOptions`, `TwoFactorSetupState`, `SafeBackRule` / `SafeBackContext` (`twoFactor.safeBack` as a function: `(back, { adminRoute, origin? }) => string`), `TotpViewComponent` (a view component as registered: a path or `{ path, exportName?, clientProps?, serverProps? }`), `SafeTotpViewProps` (`@intecion/ipal-kit/admin`), `Role` (`'user' \| 'editor' \| 'admin'`), `AccessOption` (the plugin's `access` option: `authCollection`, `defaultRole`, `authAccess`, `firstUserAdmin`, `staffCollections`).
**Types:** `AccountsOptions` (`accounts`: `panelRole`, `adminOnlyCreate`, `adminOnlyWrite`, `staffOnlyRead`, `firstUserRoute`, `password`), `StaffAccountAccessOptions` (`{ create?, write?, read?, pluginRoles? }`), `StaffRuleMark` (`{ slug, self }`), `AccountsMarker` (`{ slug, staff, own? }`, in `custom.ipalAccounts`; `own`: the operations that had a rule of the project's at config time, kept when the collection becomes staff later), `LateAdoption` (`{ slug, applied, kept, known, password, firstUser }`; `known`: in the config when iapl ran and staff only afterwards, `kept`: its operations whose own rule was left as written), `StaffAccountRules` (what the plugin put on a staff collection, in `custom.ipalAccountRules`: `{ applied, ownRoles }`), `WriteOnlySecretOptions` (`{ boundTo?, appliesWhen? }`), `PasswordRuleOptions` (`{ minLength? }`), `FirstUserRouteOption` (`'panel' \| 'all' \| string[]`), `TurnstileOnConfigError` / `TurnstileOnConfigErrorOption` / `TurnstileFormKind` (`@intecion/ipal-kit/server`), `VerifyLimitOptions` (`twoFactor.verifyLimit`: `{ max?, windowMinutes?, store? }`), `RequireSetupOptions` (`twoFactor.requireSetup`), `TwoFactorResetOptions`, `TwoFactorSetupState`, `SafeBackRule` / `SafeBackContext` (`twoFactor.safeBack` as a function: `(back, { adminRoute, origin? }) => string`), `TotpViewComponent` (a view component as registered: a path or `{ path, exportName?, clientProps?, serverProps? }`), `SafeTotpViewProps` (`@intecion/ipal-kit/admin`), `Role` (`'user' \| 'editor' \| 'admin'`), `AccessOption` (the plugin's `access` option: `authCollection`, `defaultRole`, `authAccess`, `firstUserAdmin`, `staffCollections`).
## Accessibility — widget (`accessibility`) — details: `node_modules/@intecion/ipal-kit/docs/accessibility.md`
@@ -141,7 +142,7 @@ Fifteen ready blocks and ten page templates. **Use a library block (or a variant
| `applyBlockOptions(block, options)`, `isNamed(field, name)`, `replaceField(fields, name, patch)`, `removeField(fields, name)`, `stripLocalized(fields)`, `pickVariants(defaults, chosen)` | `@intecion/ipal-kit/blocks` | Option merging and field-list helpers (also for `fields: (defaults) => …`). |
| `blockThumbnail(slug)` | `@intecion/ipal-kit/blocks` | Inline SVG sketch (data URL) for the block picker — what `thumbnail: true` uses. |
| `faqItemsFromLayout(doc, { field?, slugs? })` | `@intecion/ipal-kit/blocks` | FAQ questions of the page's FAQ blocks → `getPageJsonLd(locale, slug, { faq: faqItemsFromLayout })` (FAQPage). |
| `blockLibraryManifest`, `buildBlockLibraryManifest()`, `fieldPaths(fields)` | `@intecion/ipal-kit/blocks` | Plain data: every block's slug, interface name, variants, stored field paths; primitives, field builders, templates — for `ipal-doctor` and tests. |
| `blockLibraryManifest`, `buildBlockLibraryManifest()`, `fieldPaths(fields)` | `@intecion/ipal-kit/blocks` | Plain data: every block's slug, interface name, variants, stored field paths; primitives, field builders, templates — for `iapl-doctor` and tests. |
| `createBlockRegistry(content, options?)` | `@intecion/ipal-kit/blocks/rsc` | `blockType → component` map for `createPageRoute` / `RenderBlocks`, bound to lib/content. Options: `Image`, `Link` (next/image, next/link), `sendForm`, `formClassNames`, `contactDetails`, `classNames` (per block part), `ui` (swap primitives), `components` (swap a block), `backgrounds`, `slugs`, `only`, `extra` (own blocks), `noSnippet` (e.g. `['cta']`), `itemHeadings`, `priorityImage`, `icons`, `texts`, `lightbox`, `richText`, `entryCard`, `mapTestimonial`. |
| `LIBRARY_BLOCK_COMPONENTS` | `@intecion/ipal-kit/blocks/rsc` | The plugin's component per slug. |
| `HeroBlock`, `TextMediaBlock`, `FeatureGridBlock`, `GalleryBlock`, `FaqBlock`, `CtaBlock`, `ContactBlock`, `TeamBlock`, `PricingBlock`, `LogosBlock`, `TestimonialsBlock`, `StatsBlock`, `RichTextBlock`, `StepsBlock`, `EntryListBlock` | `@intecion/ipal-kit/blocks/rsc` | The block components (server; props `LibraryBlockProps`: data + `locale`, `isFirst`, `ui`, `ctx`, `classNames`). |
@@ -193,7 +194,7 @@ Fifteen ready blocks and ten page templates. **Use a library block (or a variant
## Cookie scanner (`consent/scanner`) — details: `node_modules/@intecion/ipal-kit/docs/cookie-scanner.md`
Opt-in with `ipalKit({ cookieScanner: true })`; the plugin wires the collection, endpoints, admin box and approval view. The exports are building blocks for a CLI, a scheduled job or your own admin view.
Opt-in with `iapl({ cookieScanner: true })`; the plugin wires the collection, endpoints, admin box and approval view. The exports are building blocks for a CLI, a scheduled job or your own admin view.
**One approval** (`cookieScanner.approval`, on by default):
@@ -235,7 +236,7 @@ Opt-in with `ipalKit({ cookieScanner: true })`; the plugin wires the collection,
| Export | Import from | What it does / when |
|---|---|---|
| `buildCookieCrawlGlobal(labels)` / `buildCookieCrawlEndpoints({ labels, options, plugin })` | `@intecion/ipal-kit` | The `cookie-crawl` global (latest result only) and the three crawl endpoints — the plugin wires them with `crawl`; call only to wire by hand. |
| `resolveCrawlConfig(crawlOptions, payload)` | `@intecion/ipal-kit` | Options → env (`IPAL_COOKIE_SCAN_URL`, `IPAL_COOKIE_SCAN_TOKEN`) → `serverURL` / `NEXT_PUBLIC_SERVER_URL` → `ResolvedCrawlConfig` (null = missing). |
| `resolveCrawlConfig(crawlOptions, payload)` | `@intecion/ipal-kit` | Options → env (`IAPL_COOKIE_SCAN_URL`, `IAPL_COOKIE_SCAN_TOKEN`) → `serverURL` / `NEXT_PUBLIC_SERVER_URL` → `ResolvedCrawlConfig` (null = missing). |
| `parseCrawlResult(body)` | `@intecion/ipal-kit` | Validates the service's JSON → `CrawlResult` (`CrawlObservation`, `CrawlRequest`) or null; junk dropped. |
| `ingestCrawlResult({ payload, result, options, config, labels, plugin, req? })` | `@intecion/ipal-kit` | Applies a result: clears the previous flags, drafts for new names (same merge rules), `seenBeforeConsent` / `violation` / `violationDetail` → `CrawlIngestSummary`. |
| `finishCrawl({ payload, labels, result, summary?, siteUrl?, req? })` | `@intecion/ipal-kit` | Writes the `cookie-crawl` global (done / failed) and sends the e-mail warning when recipients are set. |
@@ -244,7 +245,7 @@ Opt-in with `ipalKit({ cookieScanner: true })`; the plugin wires the collection,
| `sendCrawlWarning({ payload, labels, siteUrl, summary, to })` | `@intecion/ipal-kit` | The warning e-mail through `payload.sendEmail` (the project's mail adapter); never throws. |
| `bearerMatches(header, token)` | `@intecion/ipal-kit` | Constant-time `Authorization: Bearer` check. |
| `COOKIE_CRAWL_SLUG` / `COOKIE_CRAWL_PATH` / `COOKIE_CRAWL_RESULTS_PATH` | `@intecion/ipal-kit` | `'cookie-crawl'` / `'/ipal/cookie-crawl'` / `'/ipal/cookie-crawl/results'`. |
| `COOKIE_SCAN_URL_ENV` / `COOKIE_SCAN_TOKEN_ENV` | `@intecion/ipal-kit` | `'IPAL_COOKIE_SCAN_URL'` / `'IPAL_COOKIE_SCAN_TOKEN'`. |
| `COOKIE_SCAN_URL_ENV` / `COOKIE_SCAN_TOKEN_ENV` | `@intecion/ipal-kit` | `'IAPL_COOKIE_SCAN_URL'` / `'IAPL_COOKIE_SCAN_TOKEN'`. |
**Types:** `CookieScannerOptions` (the option), `CookieDeclaration`, `CookieIntegration`, `CookieScanContext`, `CookieFinding`, `CookieFindingSource`, `CookieStorage`, `LocalizedText`, `CookieScanSummary`, `CookieReviewValues`, `CookieDatabaseIndex`, `CookieScanLabels`, `OpenCookieCategory`, `CookieObservation` (a name with `storage` / `domain` for `collectCookieFindings`), `CookieReviewEntryRef` (`applyCookieFindings` `entries`); crawl: `CookieCrawlOptions`, `ResolvedCrawlConfig`, `CrawlResult`, `CrawlObservation`, `CrawlRequest`, `CrawlViolation`, `CrawlIngestSummary`.
@@ -304,12 +305,12 @@ Opt-in with `ipalKit({ cookieScanner: true })`; the plugin wires the collection,
| Export | Import from | What it does / when |
|---|---|---|
| `assertEnv(rules, { env?, label? })` | `@intecion/ipal-kit/env`, `@intecion/ipal-kit` | validates `process.env` against the rules at startup; collects every missing item and throws one error |
| `ipalEnvRules({ storage?, emailGraph?, ipHeader?, turnstile?, serverUrlVar?, secretVar?, secretMinLength?, databaseVar?, databaseName? })` | `@intecion/ipal-kit/env`, `@intecion/ipal-kit` | ready rule set (`DATABASE_URI`, `PAYLOAD_SECRET`, `NEXT_PUBLIC_SERVER_URL` + `R2_*`/`GRAPH_*`/Turnstile/`IPAL_IP_HEADER` depending on the features used) for `assertEnv`; `R2_PUBLIC_URL` optional unless `storage: { requirePublicUrl: true }`; `secretMinLength` (default 32, `0` = off) is the minimum `PAYLOAD_SECRET` length in production; `databaseName: true \| { domain?, warn? }` only warns when the `DATABASE_URI` database is not `<domain without dots>_prod` / `_dev` |
| `iaplEnvRules({ storage?, emailGraph?, ipHeader?, turnstile?, serverUrlVar?, secretVar?, secretMinLength?, databaseVar?, databaseName? })` | `@intecion/ipal-kit/env`, `@intecion/ipal-kit` | ready rule set (`DATABASE_URI`, `PAYLOAD_SECRET`, `NEXT_PUBLIC_SERVER_URL` + `R2_*`/`GRAPH_*`/Turnstile/`IAPL_IP_HEADER` depending on the features used) for `assertEnv`; `R2_PUBLIC_URL` optional unless `storage: { requirePublicUrl: true }`; `secretMinLength` (default 32, `0` = off) is the minimum `PAYLOAD_SECRET` length in production; `databaseName: true \| { domain?, warn? }` only warns when the `DATABASE_URI` database is not `<domain without dots>_prod` / `_dev` |
| `databaseNamesFor(domainOrUrl)` | `@intecion/ipal-kit/env`, `@intecion/ipal-kit` | the two database names for a site: `intecion.com` → `{ prod: 'intecioncom_prod', dev: 'intecioncom_dev' }` (`www.` dropped, dots removed) |
| `databaseNameFromUri(uri)` | `@intecion/ipal-kit/env`, `@intecion/ipal-kit` | the database name (URI path) of a Mongo / Postgres `DATABASE_URI`; null for SQLite files or no name |
| `checkDatabaseName({ databaseUri, domain })` | `@intecion/ipal-kit/env`, `@intecion/ipal-kit` | warning text when the name breaks the rule, else null (skips localhost / no domain) — what `databaseName` uses |
**Types:** `EnvRule`, `EnvKind` — variable rule (`name`, `required`, `kind`, `oneOf`, `validate`); `AssertEnvOptions` — `assertEnv` options; `IpalEnvFeatures` — `ipalEnvRules` argument (all from `/env` and root).
**Types:** `EnvRule`, `EnvKind` — variable rule (`name`, `required`, `kind`, `oneOf`, `validate`); `AssertEnvOptions` — `assertEnv` options; `IaplEnvFeatures` — `iaplEnvRules` argument (all from `/env` and root).
## Frontend layer (`frontend`) — details: `node_modules/@intecion/ipal-kit/docs/frontend.md`
@@ -336,7 +337,7 @@ Full option lists of `createContentHelpers` / `createPageRoute` / `SiteProviders
| Export | Import from | What it does / when |
|---|---|---|
| `buildRevalidateHook({ revalidatePath, config, homeSlug? })` | `@intecion/ipal-kit` | → `{ afterChange, afterDelete }` that revalidate ISR for the document paths in all languages; the project injects `revalidatePath` from `next/cache` |
| `buildGlobalRevalidateHook({ revalidatePath })` | `@intecion/ipal-kit` | Global `afterChange`: `revalidatePath('/', 'layout')` — the whole site picks up the change. The plugin adds it to its own globals when you pass `ipalKit({ revalidatePath })`; wire it yourself on your own globals (Header, Footer). Skip once: `context: { disableRevalidate: true }`. |
| `buildGlobalRevalidateHook({ revalidatePath })` | `@intecion/ipal-kit` | Global `afterChange`: `revalidatePath('/', 'layout')` — the whole site picks up the change. The plugin adds it to its own globals when you pass `iapl({ revalidatePath })`; wire it yourself on your own globals (Header, Footer). Skip once: `context: { disableRevalidate: true }`. |
| `buildFillEmptyLocalesGlobalHook({ global, fields })` / `buildFillEmptyLocalesCollectionHook({ collection, fields })` | `@intecion/ipal-kit` | `afterChange`: text saved in one language fills the same field in every language where it is empty; never overwrites a language's own text. Fields `'field'` or `'array.subField'` (rows matched by id). The plugin adds them to the cookie list and the cookie review (`fillEmptyLocales`). |
| `fillEmptyLocales({ payload, target, source, sourceLocale, fields, req? })` | `@intecion/ipal-kit` | The core of those hooks (`FillEmptyLocalesTarget`: `{ global }` or `{ collection, id }`) → locales changed. |
| `withFillLocales(kind, config, fields)` | `@intecion/ipal-kit` | Adds the right hook to a global (`'global'`) or collection (`'collection'`) config; no fields = unchanged. |
@@ -433,7 +434,7 @@ The editor builds forms in the panel (Forms collection). The project does NOT wr
| Export | Import from | What it does / when |
|---|---|---|
| `createSubmitAction({ getCachedPayload, headers, … })` | `@intecion/ipal-kit/server` | Creates the server action `sendForm(formId, locale, values, token?)`: honeypot → `clientIp` → `submitForm` → text from Notifications; returns `SubmitActionResult`. Standard: `export const sendForm = createSubmitAction({ getCachedPayload, headers })` in `actions.ts` |
| `submitForm({ payload, formId, data, files?, attemptKey?, turnstileToken?, ip?, locale?, maxPerMinute?, consentFieldName?, turnstileHostnames? })` | `@intecion/ipal-kit/server` | Server core (`consentFieldName`: argument → `ipalKit({ forms: { consentFieldName } })` → `'consent'`; `turnstileHostnames` rejects a token solved on another domain): rate limit → Turnstile → validation against the panel definition (+ GDPR consent) → saves the submission; returns a `SubmitFormResult` code, not text. Usually through `createSubmitAction`; server-only |
| `submitForm({ payload, formId, data, files?, attemptKey?, turnstileToken?, ip?, locale?, maxPerMinute?, consentFieldName?, turnstileHostnames? })` | `@intecion/ipal-kit/server` | Server core (`consentFieldName`: argument → `iapl({ forms: { consentFieldName } })` → `'consent'`; `turnstileHostnames` rejects a token solved on another domain): rate limit → Turnstile → validation against the panel definition (+ GDPR consent) → saves the submission; returns a `SubmitFormResult` code, not text. Usually through `createSubmitAction`; server-only |
### Honeypot
@@ -503,7 +504,7 @@ The editor builds forms in the panel (Forms collection). The project does NOT wr
| `LIGHTBOX_FALLBACK_PL`, `lightboxFallback(locale)` | `@intecion/ipal-kit`, `@intecion/ipal-kit/client` | Polish lightbox labels; set for a page language. `resolveLightboxTexts(texts, locale)` uses it |
| `lightboxIndex(index, delta, total, loop?)`, `formatLightboxCounter(template, current, total)` | `@intecion/ipal-kit`, `@intecion/ipal-kit/client` | Wrap / clamp a gallery index; "{current} / {total}" → "2 / 5" |
| `prefersReducedMotion()` | `@intecion/ipal-kit/client` | OS reduced motion or the AccessibilityWidget switch (`data-a11y-motion="reduce"`) |
| `lightboxNotificationFields` | `@intecion/ipal-kit` | The Form messages → Image viewer field group (added by `ipalKit({ lightbox: true })`) — to place in your own global |
| `lightboxNotificationFields` | `@intecion/ipal-kit` | The Form messages → Image viewer field group (added by `iapl({ lightbox: true })`) — to place in your own global |
**Types:** `LightboxImage`, `LightboxTexts`, `LightboxClassNames`, `LightboxRenderImage`, `LightboxImageOptions` (root and `/client`); `LightboxApi`, `LightboxProviderProps`, `LightboxTriggerProps`, `LightboxDialogProps` (`/client`); `RichTextLightboxOptions` (`/rsc`). Styling: `--ipal-lightbox-*` CSS variables, `data-ipal="lightbox…"` hooks.
@@ -555,10 +556,10 @@ The editor builds forms in the panel (Forms collection). The project does NOT wr
| `getGlobal<T>(payload, slug, { locale?, depth? })` | `@intecion/ipal-kit` | Thin `payload.findGlobal` wrapper for any global (the project's too) |
| `SITE_SETTINGS_SLUG` | `@intecion/ipal-kit` | Constant: global slug `'site-settings'` |
| `SITE_INTEGRATIONS_SLUG` | `@intecion/ipal-kit` | Constant: global slug `'site-integrations'` |
| `applyGlobalOverrides(globals, overrides)` | `@intecion/ipal-kit` | Applies `ipalKit({ globalOverrides })` to the plugin's globals: an object merges `access` / `admin` / `hooks` key by key (your keys win, your hooks run after the plugin's), other keys replace; a function `(global) => global` takes over. The plugin calls it itself — pass `globalOverrides`, do not call. |
| `applyGlobalOverrides(globals, overrides)` | `@intecion/ipal-kit` | Applies `iapl({ globalOverrides })` to the plugin's globals: an object merges `access` / `admin` / `hooks` key by key (your keys win, your hooks run after the plugin's), other keys replace; a function `(global) => global` takes over. The plugin calls it itself — pass `globalOverrides`, do not call. |
| `applyCollectionOverride(collection, override)` | `@intecion/ipal-kit` | Same rules for one collection: an object merges `access` / `admin` / `hooks` key by key, other keys replace; a function takes over. The plugin applies `consentLog.collectionOverrides` and `stats.collectionOverrides` with it; use it on your own builder output (e.g. `buildConsentLogCollection()`). |
**Types:** `GlobalQueryOptions` — `{ locale?, depth? }` of the global helpers; `IpalGlobalSlug` (`'site-settings' \| 'site-integrations' \| 'cookie-settings' \| 'notifications'`), `GlobalOverride` (object or function), `GlobalOverrides` (map slug → override) — the `globalOverrides` option. `CollectionOverride` (object or function) — `consentLog.collectionOverrides` / `stats.collectionOverrides`.
**Types:** `GlobalQueryOptions` — `{ locale?, depth? }` of the global helpers; `IaplGlobalSlug` (`'site-settings' \| 'site-integrations' \| 'cookie-settings' \| 'notifications'`), `GlobalOverride` (object or function), `GlobalOverrides` (map slug → override) — the `globalOverrides` option. `CollectionOverride` (object or function) — `consentLog.collectionOverrides` / `stats.collectionOverrides`.
## Rich text (`richtext`) — details: `node_modules/@intecion/ipal-kit/docs/richtext.md`
@@ -579,7 +580,7 @@ Server only (`pnpm payload run`); never import it from client code, the Payload
| Export | Import from | What it does / when |
|---|---|---|
| `createSeeder(payload, { dryRun?, update?, force?, only?, guard?, editCheck?, context?, pagesCollection?, formsCollection?, label?, log? })` | `@intecion/ipal-kit/seed` | The seed rules in one place → `{ upsertBySlug, upsertBy, fillGlobal, summary, dryRun, update, force, local, only }`. `only` (or `SEED_ONLY`) = the records the run may touch (`pages:kontakt`, `forms:<title>`, `global:<slug>`, `pages:*`), the rest → `skip (not listed)`; a run without it against production / a non-local database throws unless `IPAL_SEED_ALLOW_FULL=1` / `guard.allowFull: true` (after launch: named records only; dry runs are never refused; `guard: false` turns every guard off). Create-only by default, natural keys, never deletes, globals: empty fields only, every locale with `fallbackLocale: false` onto the same row ids, skips records edited since seeding, writes with `context` `{ ipalSeed, disableRevalidate, ipalSkipIndexNow }`. Throws when `update` runs on production / a non-local database without `IPAL_SEED_ALLOW_PROD_UPDATE=1`. Both seed templates use it. |
| `createSeeder(payload, { dryRun?, update?, force?, only?, guard?, editCheck?, context?, pagesCollection?, formsCollection?, label?, log? })` | `@intecion/ipal-kit/seed` | The seed rules in one place → `{ upsertBySlug, upsertBy, fillGlobal, summary, dryRun, update, force, local, only }`. `only` (or `SEED_ONLY`) = the records the run may touch (`pages:kontakt`, `forms:<title>`, `global:<slug>`, `pages:*`), the rest → `skip (not listed)`; a run without it against production / a non-local database throws unless `IAPL_SEED_ALLOW_FULL=1` / `guard.allowFull: true` (after launch: named records only; dry runs are never refused; `guard: false` turns every guard off). Create-only by default, natural keys, never deletes, globals: empty fields only, every locale with `fallbackLocale: false` onto the same row ids, skips records edited since seeding, writes with `context` `{ ipalSeed, disableRevalidate, ipalSkipIndexNow }`. Throws when `update` runs on production / a non-local database without `IAPL_SEED_ALLOW_PROD_UPDATE=1`. Both seed templates use it. |
| `upsertBySlug(collection, data \| data[], { slugField? })` | (method of `createSeeder`) | Matches by the default-locale slug; an array creates missing records first, so `{ $page: 'slug' }` links work in any order; `{ $form: 'title' }` = the form's id (`formsCollection`, default `forms`). A required field (layout) with references is written complete in the first write; a link to a page later in the same call waits for it; required cycles and unknown targets are an error with nothing written; the dry run reports the same. |
| `upsertBy(collection, key, data)` | (method) | Matches by other keys, e.g. a form by `{ title }`. |
| `fillGlobal(slug, data)` | (method) | Fills only empty fields of a global — a choice (select, radio, checkbox, number, date) still at its `defaultValue` counts as empty, text never does; a field already holding the seeded value is skipped (all seeded fields with `update` when untouched). |
@@ -597,22 +598,22 @@ Server only (`pnpm payload run`); never import it from client code, the Payload
| Export | Import from | What it does / when |
|---|---|---|
| `buildSecurityHeaders({ hsts?, csp?, additional?, coop?, frameOptions?, permissionsPolicy?, referrerPolicy?, … })` | `@intecion/ipal-kit` | Returns `SecurityHeader[]` (HSTS, X-Frame-Options, nosniff, Referrer-Policy, Permissions-Policy, COOP; with `IPAL_NOINDEX` also `X-Robots-Tag`) for `headers()` in `next.config.ts`. `csp` = `buildCsp` args → the CSP header (+ `Reporting-Endpoints` with `reportUri`); off by default. `additional` overrides by key. |
| `buildSecurityHeaders({ hsts?, csp?, additional?, coop?, frameOptions?, permissionsPolicy?, referrerPolicy?, … })` | `@intecion/ipal-kit` | Returns `SecurityHeader[]` (HSTS, X-Frame-Options, nosniff, Referrer-Policy, Permissions-Policy, COOP; with `IAPL_NOINDEX` also `X-Robots-Tag`) for `headers()` in `next.config.ts`. `csp` = `buildCsp` args → the CSP header (+ `Reporting-Endpoints` with `reportUri`); off by default. `additional` overrides by key. |
| `withSecurityConfig(nextConfig, { hidePoweredBy? })` | `@intecion/ipal-kit` | Next config wrapper: `poweredByHeader: false` + drops `X-Powered-By` from `headers()` (Next's "Next.js" and withPayload's "Next.js, Payload"). `withPayload(withSecurityConfig(nextConfig))`; `hidePoweredBy: false` = no change. |
| `secondFactorPassed(req)` | `@intecion/ipal-kit` | `boolean` with `req` (`{ payload, user }`): `false` only for an account of the 2FA collection that has TOTP set up and has not entered the code in this session (password only). `true` for a full login, an API key, an account that has not set TOTP up yet, accounts of other auth collections, no user, and with `twoFactor: false`. Guard your own endpoints with it: `if (!req.user \|\| !secondFactorPassed(req)) return 403`. |
| `safeAdminBack(back, { adminRoute, origin? })` | `@intecion/ipal-kit` | The default `back` rule of the 2FA screens: returns `back` as a path when it resolves to the site's origin (the placeholder origin for relative values, `origin` for absolute ones), over HTTP(S), without credentials, inside `adminRoute`; otherwise the admin root. `safeAdminBack('javascript:alert(1)', { adminRoute: '/admin' })` → `'/admin'`; `safeAdminBack('/admin/collections/pages?page=2', { adminRoute: '/admin' })` → the same path. Use it in your own rule or view. |
| `wrapTotpViews(views, added, rule?, wrapper?)` | `@intecion/ipal-kit` | Puts `SafeTotpView` in front of the views whose route is `setup-totp` / `verify-totp` and for which `added(key)` is true (keeps `exportName`, `serverProps`; `clientProps` travel as `ipalTotpClientProps`); returns `{ views, dependencies }` (`dependencies` → `admin.dependencies`, so the wrapped views stay in the import map). What `ipalKit` runs after the 2FA factory; for a project that registers the 2FA package itself. |
| `copyViews(views)` / `changedViewKeys(before, after)` | `@intecion/ipal-kit` | The comparison `ipalKit` uses to tell which views a 2FA factory registered: put `copyViews(views)` into the config before calling the factory, then `changedViewKeys(before, viewsAfter)` gives the keys whose view object changed — the `added` argument of `wrapTotpViews` (`(key) => keys.has(key)`). By object, not by key: the 2FA package replaces a view that already stands under its keys. Example: security.md "Your own 2FA screen". |
| `wrapTotpViews(views, added, rule?, wrapper?)` | `@intecion/ipal-kit` | Puts `SafeTotpView` in front of the views whose route is `setup-totp` / `verify-totp` and for which `added(key)` is true (keeps `exportName`, `serverProps`; `clientProps` travel as `ipalTotpClientProps`); returns `{ views, dependencies }` (`dependencies` → `admin.dependencies`, so the wrapped views stay in the import map). What `iapl` runs after the 2FA factory; for a project that registers the 2FA package itself. |
| `copyViews(views)` / `changedViewKeys(before, after)` | `@intecion/ipal-kit` | The comparison `iapl` uses to tell which views a 2FA factory registered: put `copyViews(views)` into the config before calling the factory, then `changedViewKeys(before, viewsAfter)` gives the keys whose view object changed — the `added` argument of `wrapTotpViews` (`(key) => keys.has(key)`). By object, not by key: the 2FA package replaces a view that already stands under its keys. Example: security.md "Your own 2FA screen". |
| `SAFE_TOTP_VIEW` / `totpViewImportKey(component)` | `@intecion/ipal-kit` | `'@intecion/ipal-kit/admin#SafeTotpView'`, the wrapper's import-map path (the default `wrapper` of `wrapTotpViews`); and the import-map key (`path#export`) of a component given as a string or `{ path, exportName }`. |
| `findImportMapFile(config, cwd?)` / `missingImportMapEntries(config, entries, cwd?)` | `@intecion/ipal-kit` | Where the project's `importMap.js` is on disk (`admin.importMap.importMapFile`, else `app/(payload)<admin route>/` or `src/app/…` under `admin.importMap.baseDir` / the working directory; `null` when not found), and which of `entries` its text does not contain (`{ file, missing }`). A hint from the file on disk, not the map in the build: warn on it, never block on it. Behind `twoFactor.importMapCheck`. |
| `buildSetupFields({ statusField? })`, `stampSetupFrom`, `backfillSetupFrom(payload, collection)` | `@intecion/ipal-kit` | The parts of "2FA setup required" for a project that wires them itself: the fields for the 2FA collection (`totpSetupFrom`, and the panel's `totpSetupStatus` unless `statusField: false`), the `beforeChange` hook that stamps the window start (on create, and when an account loses its TOTP secret), and the start-up step that gives accounts without TOTP and without a start their window (returns how many; once per account). |
| `buildTwoFactorResetEndpoint(collection, { access? })`, `TWO_FACTOR_RESET_PATH` | `@intecion/ipal-kit` | `POST /api/ipal/two-factor/reset` `{ userId }`: clears the account's TOTP secret and sessions and starts a new window. Default: a staff admin whose session entered its own TOTP code; `access` replaces that (only `true` allows; a session that owes its code is always refused). `ipalKit` registers it only with `twoFactor.guard` on. |
| `buildTwoFactorResetEndpoint(collection, { access? })`, `TWO_FACTOR_RESET_PATH` | `@intecion/ipal-kit` | `POST /api/ipal/two-factor/reset` `{ userId }`: clears the account's TOTP secret and sessions and starts a new window. Default: a staff admin whose session entered its own TOTP code; `access` replaces that (only `true` allows; a session that owes its code is always refused). `iapl` registers it only with `twoFactor.guard` on. |
| `countAccountsWithoutTotp(payload, collection, setupWindowMs?)` | `@intecion/ipal-kit` | `{ without, blocked }` — accounts of the 2FA collection without TOTP, and how many are past their window. |
| `resolveRequireSetup(option)`, `strictExempt(fn)`, `SETUP_FROM_FIELD`, `DEFAULT_SETUP_WINDOW_HOURS` | `@intecion/ipal-kit` | `twoFactor.requireSetup` → `{ requireSetup, setupWindowMs, exempt? }` as the guard reads it (throws on a `windowHours` that is not a number ≥ 0 or `false`, and on an `async` `exempt`); the wrapper that makes an `exempt` function answer `true` only for exactly `true`; the field name `'totpSetupFrom'`; `72`. |
| `fetchPublicImage(url, base)`, `publicImageDataUri(url, base)`, `rasterImageType(bytes)`, `siteOrigin(serverURL)`, `PUBLIC_IMAGE_MAX_BYTES` | `@intecion/ipal-kit` | An image fetched the way an anonymous visitor gets it (no cookies; http(s) only; `image/*`; at most 512 KB, reading stops at the limit) as `{ bytes, type }` or a `data:` address, else `null`. Used for the logo and icon on the 2FA screens. `rasterImageType(bytes)` → the media type of a bitmap by its first bytes (PNG, JPEG, GIF, WebP, ICO, AVIF) or `null` — never trust a claimed type before answering a file's bytes from the site's origin; an SVG gives `null`. |
| `UPLOAD_SECURITY_HEADERS` | `@intecion/ipal-kit` | The two headers of `buildUploadSecurityHeaders` (`Content-Security-Policy: default-src 'none'; … sandbox`, `X-Content-Type-Options: nosniff`) for a route of your own that returns an uploaded file's bytes from the site's origin. In a Next project a site-wide `headers()` rule with the same key overrides a header the route sets itself: add a `headers()` rule for the path after the site-wide one (as `buildUploadSecurityHeaders({ collections, adminIcon })` does for the upload routes and `/api/ipal/admin-icon`), and never answer with an SVG. |
| `twoFactorSetupState(req)`, `twoFactorSetupDeadline(req)` | `@intecion/ipal-kit` | Where an account stands with TOTP setup, from `{ payload, user }`: `'set-up'`, `'open'` (may set it up now), `'closed'` (the setup window has passed: blocked until an admin reopens it), `'exempt'` (`requireSetup.exempt`, or `requireSetup: false`), `'not-applicable'` (no user, another collection, 2FA off); and the moment setup closes (`Date`, or `null` without a window). Types: `TwoFactorSetupState`, `RequireSetupOptions`. |
| `requireSecondFactor(access?)` | `@intecion/ipal-kit` | Wraps an `Access` function: refused while the second factor is owed, otherwise the function itself (Payload's default "logged in" when none). ipalKit applies it to every collection and global in the config, and to those added by plugins listed after it (in `onInit` and at the start of the first request, so also after a dev hot reload); use it for access functions that are not part of the config. Per-entity opt-out: `custom.ipal.secondFactor: false \| { read: false }` or the package's `custom.totp.disableAccessWrapper`. Wrapping twice is harmless. |
| `requireSecondFactor(access?)` | `@intecion/ipal-kit` | Wraps an `Access` function: refused while the second factor is owed, otherwise the function itself (Payload's default "logged in" when none). iapl applies it to every collection and global in the config, and to those added by plugins listed after it (in `onInit` and at the start of the first request, so also after a dev hot reload); use it for access functions that are not part of the config. Per-entity opt-out: `custom.ipal.secondFactor: false \| { read: false }` or the package's `custom.totp.disableAccessWrapper`. Wrapping twice is harmless. |
| `totpRedirectTarget({ adminRoute, forceSetup?, pathname, user, excludePaths? })`, `totpAdminPath(adminRoute, path)` | `@intecion/ipal-kit` | The 2FA redirect rules as pure functions: the setup / verify URL (with `back`) to send this user to, or `null` (no path, api key, already on a TOTP screen or logout). For an own `twoFactor.provider`. Types `TotpRedirectArgs`, `TotpUser` |
| `buildCsp({ mode?, reportUri?, reportGroup?, r2Url?, analytics?, metaPixel?, linkedIn?, tiktok?, clarity?, turnstile?, youtube?, googleMaps?, nonce?, strictDynamic?, dev?, extra?, override? })` | `@intecion/ipal-kit` | Returns `{ key, value }` with a hardened CSP (`base-uri`, `object-src`, `frame-ancestors`, `form-action`) + sources for the enabled integrations. `mode: 'report-only'` → `…-Report-Only` (start here), `'enforce'` later. `extra` adds to any directive, `override` replaces / drops one (`null`). `dev` (default `NODE_ENV === 'development'`) adds `'unsafe-eval'`. `nonce` → `'nonce-…' 'strict-dynamic'`. |
| `buildCspHeaders(args)` | `@intecion/ipal-kit` | `[csp, Reporting-Endpoints]` (the second only with `reportUri`). |
@@ -676,7 +677,7 @@ Most routes and metadata are already ready in `createContentHelpers` (`generateP
| `buildSitemapCss({ title?, credit?, accent? })` | `@intecion/ipal-kit` | CSS for how the sitemap looks in a browser (served by the handler). |
| `SITEMAP_STYLE_PARAM` | `@intecion/ipal-kit` | `'style'` — sitemap URL parameter that returns CSS instead of XML. |
| `DEFAULT_SITEMAP_CREDIT` | `@intecion/ipal-kit` | `'Technology by Intecion.com'` — default line below the sitemap heading. |
| `buildRobots({ baseUrl, aiBots?, disallowParams?, extraDisallow?, … })` | `@intecion/ipal-kit` | `app/robots.ts` rules: blocks admin/API, points to the sitemap, explicitly allows AI bots (`aiBots: 'allow' \| 'block-training' \| 'disallow'`); with `IPAL_NOINDEX` blocks everything. Usually `robots` from `createContentHelpers`. |
| `buildRobots({ baseUrl, aiBots?, disallowParams?, extraDisallow?, … })` | `@intecion/ipal-kit` | `app/robots.ts` rules: blocks admin/API, points to the sitemap, explicitly allows AI bots (`aiBots: 'allow' \| 'block-training' \| 'disallow'`); with `IAPL_NOINDEX` blocks everything. Usually `robots` from `createContentHelpers`. |
| `AI_ASSISTANT_BOTS` | `@intecion/ipal-kit` | List of user agents of AI assistant/search bots (ClaudeBot, PerplexityBot…). |
| `AI_TRAINING_BOTS` | `@intecion/ipal-kit` | List of user agents of model-training crawlers (GPTBot, Google-Extended…). |
| `robotsOptionsFrom(settings)` | `@intecion/ipal-kit` | Site settings → Search engines → AI assistants as `buildRobots` options (`aiBots` unless the policy is `default`, `aiBotRules`; invalid user agents dropped). `getRobots` from `createContentHelpers` uses it — own robots: `buildRobots({ ...robotsOptionsFrom(settings), … })`. |
@@ -688,7 +689,7 @@ Most routes and metadata are already ready in `createContentHelpers` (`generateP
| Export | Import from | What it does / when |
|---|---|---|
| `buildIndexNowHook({ config, contentCollection?, baseUrl?, settingsSlug? })` | `@intecion/ipal-kit` | `afterChange` hook: after publish, sends the URLs in all languages to IndexNow (in the background, production only). With `ipalKit({ indexNow: true })` the plugin wires it itself on pages and content collections — do not call. |
| `buildIndexNowHook({ config, contentCollection?, baseUrl?, settingsSlug? })` | `@intecion/ipal-kit` | `afterChange` hook: after publish, sends the URLs in all languages to IndexNow (in the background, production only). With `iapl({ indexNow: true })` the plugin wires it itself on pages and content collections — do not call. |
| `submitToIndexNow({ payload, urls, baseUrl? })` | `@intecion/ipal-kit` | Manual POST of a batch of URLs to IndexNow; never throws, returns `boolean`. |
| `createIndexNowKeyRoute({ getCachedPayload })` | `@intecion/ipal-kit` | `GET` handler for the key file (`/indexnow-key.txt`) for verification. Usually `indexNowKeyRoute` from `createContentHelpers`. |
| `getIndexNowKey(payload)` | `@intecion/ipal-kit` | IndexNow key: env `INDEXNOW_KEY`, then Site integrations; `''` when missing. |
@@ -705,7 +706,7 @@ Most routes and metadata are already ready in `createContentHelpers` (`generateP
| `injectAutoFillMeta(config, seo)` | `@intecion/ipal-kit` | Injects the hook above into the SEO collections. The plugin wires it itself — do not call. |
| `TITLE_SEPARATORS` | `@intecion/ipal-kit` | Site settings → Title separator: stored name → character (`{ pipe: '\|', endash: '–', hyphen: '-', middot: '·', slash: '/' }`). Type `TitleSeparatorName`. |
| `titleSeparatorChar(value)` | `@intecion/ipal-kit` | Stored separator value → the character in the title. A name maps through `TITLE_SEPARATORS`; an old stored character (≤ 1.14.4) or a project's own option is returned as is. For a custom title builder. `readSiteMetaConfig` already uses it. |
| `titleSeparatorSql({ table?, column?, direction? })` | `@intecion/ipal-kit` | SQL `UPDATE` that rewrites old separator characters to names (`'up'`) or back (`'down'`). Put it in the Postgres migration after `SET DATA TYPE text;` (ipal-upgrade, CHANGELOG). |
| `titleSeparatorSql({ table?, column?, direction? })` | `@intecion/ipal-kit` | SQL `UPDATE` that rewrites old separator characters to names (`'up'`) or back (`'down'`). Put it in the Postgres migration after `SET DATA TYPE text;` (iapl-upgrade, CHANGELOG). |
| `SKIP_AUTO_FILL` | `@intecion/ipal-kit` | `'ipalSkipAutoFill'` — `context` key (`context: { [SKIP_AUTO_FILL]: true }`) that turns off meta auto-fill and the AI summary on save (migrations, scripts). |
| `validateFaviconField` | `@intecion/ipal-kit` | `FieldHook` that logs a server warning when the favicon is < 48×48 or not square (never blocks the save). The plugin wires it itself on the favicon field in SiteSettings — call it only for your own favicon field. |
| `DocumentTitle` | `@intecion/ipal-kit/admin` | Client component `{ title }`: sets the browser-tab title of a custom admin view after load, so it follows the admin language (Payload's view `meta.title` is one fixed string). Render it in your view with a translated title; the statistics view uses it. |
@@ -720,7 +721,7 @@ Most routes and metadata are already ready in `createContentHelpers` (`generateP
| Export | Import from | What it does / when |
|---|---|---|
| `clientIp(source, { header?, trustedProxies? })` | `@intecion/ipal-kit` | Client IP from a `Request` or `Headers` (`clientIp(await headers())` in a server action): `cf-connecting-ip`, `x-real-ip`, then XFF counted from the right; `''` when missing. In production pin `header` (or env `IPAL_IP_HEADER`). |
| `clientIp(source, { header?, trustedProxies? })` | `@intecion/ipal-kit` | Client IP from a `Request` or `Headers` (`clientIp(await headers())` in a server action): `cf-connecting-ip`, `x-real-ip`, then XFF counted from the right; `''` when missing. In production pin `header` (or env `IAPL_IP_HEADER`). |
| `setRateLimitStore(store \| null)` | `@intecion/ipal-kit` | Shared store (e.g. Redis) for all plugin limiters (forms, consents, MCP…); `null` = process memory. Call once at startup when several instances run. |
| `setUnknownIpFactor(n)` | `@intecion/ipal-kit` | Requests with no client IP share one `unknown-ip` bucket with `n` × the limit (every plugin limiter). Call once at startup; `0` = unlimited (only with a limiter in front, e.g. Cloudflare). |
| `UNKNOWN_IP_FACTOR` | `@intecion/ipal-kit` | `20` — the default factor of the no-IP bucket. |
@@ -738,14 +739,15 @@ Most routes and metadata are already ready in `createContentHelpers` (`generateP
| Export | Import from | What it does / when |
|---|---|---|
| `PageStats({ locale?, endpoint? })` | `@intecion/ipal-kit/client` | Page view beacon to `/api/ipal/hit` (anonymous without consent, with analytics consent the `ipal_vid` cookie). Mount once in the layout inside `<ConsentProvider>` or via `stats` in `<SiteProviders>`. |
| `STATS_SLUG` | `@intecion/ipal-kit` | `'stats-visits'` — slug of the visits collection (added by `ipalKit({ stats })`). |
| `VISITOR_COOKIE` | `@intecion/ipal-kit/client` | `'ipal_vid'` — visitor ID cookie (only after analytics consent). |
| `PageStats({ locale?, endpoint?, visitorCookie? })` | `@intecion/ipal-kit/client` | Page view beacon to `/api/ipal/hit` (anonymous without consent, with analytics consent the visitor cookie: `ipal_vid`, or `visitorCookie` — `IAPL_VISITOR_COOKIE` on a site with `storageNames: 'iapl'`). Mount once in the layout inside `<ConsentProvider>` or via `stats` in `<SiteProviders>`. |
| `STATS_SLUG` | `@intecion/ipal-kit` | `'stats-visits'` — slug of the visits collection (added by `iapl({ stats })`). |
| `VISITOR_COOKIE`, `IAPL_VISITOR_COOKIE` | `@intecion/ipal-kit/client`, `@intecion/ipal-kit` | `'ipal_vid'` and `'iapl_vid'` — the visitor ID cookie (only after analytics consent) of a site made before 1.17.0 and of one made since. One per site. |
| `visitorCookieFor(storageNames)` | `@intecion/ipal-kit` | The cookie name for `'ipal'` / `'iapl'` / undefined (what the cookie scanner declares). Type `StorageNames`. |
| `StatsView` | `@intecion/ipal-kit/admin` | `/admin/stats` view (30 days, top pages, referrers, devices, visitor history). Injected by the plugin; after turning the option on, `pnpm generate:importmap`. |
| `StatsWidget` | `@intecion/ipal-kit/admin` | Dashboard card with a 30-day chart (`stats.dashboard`). Injected by the plugin; after turning the option on, `pnpm generate:importmap`. |
| `StatsNavLink` | `@intecion/ipal-kit/admin` | Link to `/admin/stats` in the panel nav. Injected by the plugin; after turning the option on, `pnpm generate:importmap`. |
**Types:** `StatsOptions` — the `ipalKit({ stats })` option (`dashboard`, `retentionDays`, `timeZone`); `StatsVisit`, `StatsPage` — visit document and a page view in it; `PageStatsProps` (`/client`) — `PageStats` props.
**Types:** `StatsOptions` — the `iapl({ stats })` option (`dashboard`, `retentionDays`, `timeZone`); `StatsVisit`, `StatsPage` — visit document and a page view in it; `PageStatsProps` (`/client`) — `PageStats` props.
## Media and storage (`storage`) — details: `node_modules/@intecion/ipal-kit/docs/storage.md`
@@ -774,21 +776,21 @@ Most routes and metadata are already ready in `createContentHelpers` (`generateP
| `isTheme(value)` | `@intecion/ipal-kit`, `@intecion/ipal-kit/client` | Type guard `'light' \| 'dark'`. |
| `isThemeSetting(value)` | `@intecion/ipal-kit` | Type guard `'system' \| 'light' \| 'dark'`. |
| `THEME_ATTRIBUTE` | `@intecion/ipal-kit`, `@intecion/ipal-kit/client` | `'data-theme'` — attribute on `<html>` (Tailwind `dark` variant). |
| `THEME_STORAGE_KEY` | `@intecion/ipal-kit`, `@intecion/ipal-kit/client` | `'theme'` — default localStorage key with the visitor's choice (the next-themes key; `ipalKit({ theme: { storageKey } })` changes it). |
| `THEME_STORAGE_KEY` | `@intecion/ipal-kit`, `@intecion/ipal-kit/client` | `'theme'` — default localStorage key with the visitor's choice (the next-themes key; `iapl({ theme: { storageKey } })` changes it). |
| `LEGACY_THEME_STORAGE_KEY` | `@intecion/ipal-kit`, `@intecion/ipal-kit/client` | `'ipal-theme'` — the key before; a choice under it is moved once. |
| `THEME_STORAGE_ATTRIBUTE` | `@intecion/ipal-kit`, `@intecion/ipal-kit/client` | `'data-theme-storage'` — on `<html>` when the key is not the default. |
| `THEME_SWITCHING_ATTRIBUTE` | `@intecion/ipal-kit/client` | `'data-theme-switching'` — briefly on `<html>` while switching (for the colour transition). |
**Types:** `ThemeOptions` (root, `ipalKit({ theme })`), `Theme`, `ThemeSetting`, `ThemeConfig` (root, `/client`) — theme, setting from the panel and theme options; `ThemeScriptProps` (`/rsc`), `ThemeSwitcherProps`, `ThemeSwitcherClassNames` (`/client`) — component props.
**Types:** `ThemeOptions` (root, `iapl({ theme })`), `Theme`, `ThemeSetting`, `ThemeConfig` (root, `/client`) — theme, setting from the panel and theme options; `ThemeScriptProps` (`/rsc`), `ThemeSwitcherProps`, `ThemeSwitcherClassNames` (`/client`) — component props.
## Project starter (`starter`) — details: `node_modules/@intecion/ipal-kit/docs/project-starter.md`
Bin: `ipal-kit create <domain>` (`pnpm --config.auto-install-peers=false dlx @intecion/ipal-kit@<version> create …`).
Bin: `iapl create <domain>` (`pnpm --config.auto-install-peers=false dlx @intecion/ipal-kit@<version> create …`).
`@intecion/ipal-kit/starter` uses Node built-ins only (no Payload) — the building blocks of the command.
| Export | Import from | What it does / when |
|---|---|---|
| `runCreateCli(args, log?)`, `CREATE_USAGE` | `@intecion/ipal-kit/starter` | The command (`ipal-kit create`) — returns the exit code. |
| `runCreateCli(args, log?)`, `CREATE_USAGE` | `@intecion/ipal-kit/starter` | The command (`iapl create`) — returns the exit code. |
| `parseCreateArgs(args)`, `normalizeDomain(input)`, `localEnv(example)` | `@intecion/ipal-kit/starter` | Its pieces: options, `https://www.X.pl/` → `x.pl` (punycode), `.env` with a fresh `PAYLOAD_SECRET`. |
| `validateAnswers(input)`, `STARTER_TOPICS` | `@intecion/ipal-kit/starter` | The architecture answers (`StarterAnswers`): every missing / invalid one as a line; `[]` = valid. |
| `flagsFromAnswers(answers)` | `@intecion/ipal-kit/starter` | The `@starter:if` flags the answers turn on (`twoFactor`, `posts`, `crawl`, `r2`, `enforceCsp: false`, `demo: false`…). |
@@ -798,7 +800,7 @@ Bin: `ipal-kit create <domain>` (`pnpm --config.auto-install-peers=false dlx @in
| `applyVariants(text, flags, file?)`, `variantFlags(text)` | `@intecion/ipal-kit/starter` | `@starter:if` / `else` / `endif` blocks (nesting; `//: ` / `#: ` lines uncommented inside kept blocks). |
| `applyPlaceholders(text, fakes, values)`, `leftoverFakes(text, fakes)` | `@intecion/ipal-kit/starter` | Fake values → the site's values (longest first); what is left. |
| `assertManifest(value)`, `fileRole(path, manifest)`, `matchGlob(path, glob)`, `ALWAYS_SKIPPED` | `@intecion/ipal-kit/starter` | `starter.manifest.json`: drop / generate / template / keep. |
| `renderI18nConfig`, `renderTokens`, `renderDesignMd`, `renderAgentsMd`, `renderDecisions`, `renderDoctorConfig` | `@intecion/ipal-kit/starter` | Files and sections written from the answers (languages, brand, DESIGN.md, AGENTS.md decisions, ipal-doctor.json). |
| `renderI18nConfig`, `renderTokens`, `renderDesignMd`, `renderAgentsMd`, `renderDecisions`, `renderDoctorConfig` | `@intecion/ipal-kit/starter` | Files and sections written from the answers (languages, brand, DESIGN.md, AGENTS.md decisions, iapl-doctor.json). |
| `rewriteFonts(layout, answers)`, `fontExport(name)`, `rewritePackageJson(text, rules, ctx, answers)` | `@intecion/ipal-kit/starter` | next/font calls → the answered fonts; the manifest's package.json rewrite. |
| `lockfileWithoutPlugin(lock)` | `@intecion/ipal-kit/starter` | The reference lockfile without the plugin (shipped with the bundle). |
| `secretFindings(files)` | `@intecion/ipal-kit/starter` | The pre-commit check: `.env*`, assigned secrets, private keys. |
@@ -809,48 +811,48 @@ Bin: `ipal-kit create <domain>` (`pnpm --config.auto-install-peers=false dlx @in
## Design tokens (`tokens`) — details: `node_modules/@intecion/ipal-kit/docs/design-tokens.md`
CSS: `@intecion/ipal-kit/tokens.css` (neutral `--ipal-*` defaults, light/dark, `[data-surface="inverse"]`), `@intecion/ipal-kit/tailwind.css`
(Tailwind 4 preset: `bg-surface`, `text-fg`, `py-section`…), `@intecion/ipal-kit/a11y.css` (widget CSS). Bin: `ipal-tokens`
(Tailwind 4 preset: `bg-surface`, `text-fg`, `py-section`…), `@intecion/ipal-kit/a11y.css` (widget CSS). Bin: `iapl-tokens`
(`src/design/tokens.ts` → `src/design/tokens.css`, WCAG contrast; `--check`, `--report`, `--warn-only`, `--in`, `--out`).
``@intecion/ipal-kit/tokens`` imports nothing from Payload/React — safe in `src/design/tokens.ts`, `next/og`, e-mail templates.
| Export | Import from | What it does / when |
|---|---|---|
| `defineTokens(input)` | `@intecion/ipal-kit/tokens`, `@intecion/ipal-kit` | The brand in `src/design/tokens.ts`; checks every role/size name, returns the input. |
| `tokensToCss(input, { source? })` | `@intecion/ipal-kit/tokens` | The brand CSS (`ipal-tokens` writes it): only what differs from the defaults. |
| `tokensToCss(input, { source? })` | `@intecion/ipal-kit/tokens` | The brand CSS (`iapl-tokens` writes it): only what differs from the defaults. |
| `defaultTokensCss()` | `@intecion/ipal-kit/tokens` | The content of `tokens.css`. |
| `contrastReport(input?)` | `@intecion/ipal-kit/tokens` | WCAG rows (`ContrastRow`) for every text/surface pair in both themes and the inverse scope. |
| `contrastRatio(fg, bg)`, `parseColor(css, lookup?)` | `@intecion/ipal-kit/tokens` | Colour maths for your own checks (hex, rgb, hsl, oklch, `color-mix(in oklch)`, `var()`). |
| `resolveColors(input)` | `@intecion/ipal-kit/tokens` | Final colour values per theme — for `next/og`, e-mail, `theme-color`. |
| `fluidClamp(min, max, range?)` | `@intecion/ipal-kit/tokens` | The fluid.css `clamp()` for your own sizes; `FLUID_SCALE` (the shipped pairs), `FLUID_RANGES` (`standard` 360→1280, `wide` 360→1920). |
| `IPAL_TOKENS` | `@intecion/ipal-kit/tokens`, `@intecion/ipal-kit` | Every token as `var(--ipal-…)`, keyed by name: `IPAL_TOKENS.primary`. |
| `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`. |
| `IAPL_TOKENS` | `@intecion/ipal-kit/tokens`, `@intecion/ipal-kit` | Every token as `var(--ipal-…)`, keyed by name: `IAPL_TOKENS.primary`. |
| `iaplVar(name, fallback?)` | `@intecion/ipal-kit/tokens`, `@intecion/ipal-kit` | `var(--ipal-<name>[, fallback])`. |
| `IAPL_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. |
| `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`).
**Types:** `TokensInput`, `IaplTokenName` (root, `/tokens`), `ColorInput`, `ColorRole`, `ContrastRow`, `FluidRange`, `RemValue` (`/tokens`).
## ipal-doctor (`doctor`) — details: `node_modules/@intecion/ipal-kit/docs/doctor.md`
## iapl-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]
Bin: `iapl-doctor` (`pnpm exec iapl-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. |
| `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 `iapl-doctor.json`. |
| `applySettings(findings, ctx)`, `globToRegExp(glob)`, `AUDIT_SKIP_RULES` | `@intecion/ipal-kit/doctor` | `iapl-doctor.json` `rules` (`off`, `severity`, `reason`, `until`, `files`) and `iapl-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. |
| `planSkills({ dest, source })` | `@intecion/ipal-kit/doctor` | What `iapl-skills` would change: `missing`, `stale`, `retired` iapl-* 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). |
| `findFrontend(ctx)` | `@intecion/ipal-kit/doctor` | The folder of the site's pages (`FrontendLayout`: `dir`, `multi`, `ambiguous`, `missingOverride`) — found by structure (any route group with the catch-all page, a localized one first); `layout.frontend` in `ipal-doctor.json` wins. |
| `findFrontend(ctx)` | `@intecion/ipal-kit/doctor` | The folder of the site's pages (`FrontendLayout`: `dir`, `multi`, `ambiguous`, `missingOverride`) — found by structure (any route group with the catch-all page, a localized one first); `layout.frontend` in `iapl-doctor.json` wins. |
| `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`. |
| `buildDoctorEndpoint({ tokenVar, access })` | `@intecion/ipal-kit/doctor` | `GET /ipal/doctor` (`/api/ipal/doctor`): 404 until the token variable (default `IAPL_DOCTOR_TOKEN`, ≥ 32 chars) is set, Bearer token or `access`, rate-limited. Added by `iapl` unless `doctor: false`. |
**Types:** `DoctorRule`, `DoctorFinding`, `RuleFinding`, `DoctorReport`, `DoctorConfig`, `DoctorRuleSetting`, `DoctorSeverity`,
`DoctorSource`, `DoctorStatus`, `DoctorContext`, `RunDoctorOptions`, `DoctorEndpointOptions`, `FrontendLayout`.
+5 -5
View File
@@ -1,9 +1,9 @@
---
name: ipal-seo-check
description: Checks a running ipal-kit site the way Googlebot and AI agents see it — metadata inside <head> (not streamed to body), title, description, self canonical, hreflang with x-default, noindex pages leaking into the sitemap, error pages in the sitemap, sitemap index parts, Search Console / Bing verification tags, robots.txt, soft 404s, favicon, JSON-LD, and GEO (llms.txt, llms-full.txt, Markdown version, text/markdown alternate, MCP server, AI bots in robots, health). Use after building pages, before handing over, after deploys, after an ipal-kit upgrade, and whenever SEO, indexing, Search Console or "Google doesn't see" problems come up.
name: iapl-seo-check
description: Checks a running IAPL site the way Googlebot and AI agents see it — metadata inside <head> (not streamed to body), title, description, self canonical, hreflang with x-default, noindex pages leaking into the sitemap, error pages in the sitemap, sitemap index parts, Search Console / Bing verification tags, robots.txt, soft 404s, favicon, JSON-LD, and GEO (llms.txt, llms-full.txt, Markdown version, text/markdown alternate, MCP server, AI bots in robots, health). Use after building pages, before handing over, after deploys, after an IAPL upgrade, and whenever SEO, indexing, Search Console or "Google doesn't see" problems come up.
---
# ipal-seo-check
# iapl-seo-check
Checks the **running** app, not the code — exactly what Googlebot gets.
@@ -11,7 +11,7 @@ Checks the **running** app, not the code — exactly what Googlebot gets.
1. Run the production build (dev streams differently than a build):
```bash
pnpm build && pnpm start # in a second terminal / in the background
node .agents/skills/ipal-seo-check/scripts/seo-check.mjs http://localhost:3000
node .agents/skills/iapl-seo-check/scripts/seo-check.mjs http://localhost:3000
```
Production: `node …/seo-check.mjs https://domain.com --max 40`.
`--max N` = how many pages from the sitemap to check (evenly from each language). Do not read
@@ -47,4 +47,4 @@ Checks the **running** app, not the code — exactly what Googlebot gets.
## What the script does not check
Search Console (indexing, manual actions), Core Web Vitals, JSON-LD
correctness (it checks presence; check content in the Rich Results Test), the substance of the content.
Items skipped by client decision are read from `ipal-audit-skip:` in `AGENTS.md`.
Items skipped by client decision are read from `iapl-audit-skip:` in `AGENTS.md`.
@@ -1,7 +1,7 @@
#!/usr/bin/env node
import { readFileSync } from 'node:fs'
// ipal-seo-check — what Googlebot and AI agents actually see on a running site (Node 18+, no dependencies).
// iapl-seo-check — what Googlebot and AI agents actually see on a running site (Node 18+, no dependencies).
// node seo-check.mjs <baseUrl> [--max 20]
// node seo-check.mjs http://localhost:3000 # after `pnpm build && pnpm start`
// node seo-check.mjs https://klient.pl --max 40 # production
@@ -16,10 +16,10 @@ const origin = args[0].replace(/\/$/, '')
const maxIdx = args.indexOf('--max')
const MAX = maxIdx >= 0 ? Number(args[maxIdx + 1]) || 20 : 20
const UA = 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)'
// Client decisions recorded in AGENTS.md (AGENT.md §0b): `ipal-audit-skip: mcp, llms-full — reason`
// Client decisions recorded in AGENTS.md (AGENT.md §0b): `iapl-audit-skip: mcp, llms-full — reason`
let SKIP = []
try {
const line = readFileSync('AGENTS.md', 'utf8').split('\n').find((l) => /^[-* ]*ipal-audit-skip:/i.test(l))
const line = readFileSync('AGENTS.md', 'utf8').split('\n').find((l) => /^[-* ]*(?:iapl|ipal)-audit-skip:/i.test(l))
if (line) SKIP = line.replace(/^[^:]*:/, '').split(/—| - /)[0].split(',').map((k) => k.trim()).filter(Boolean)
} catch {}
const skipped = (key) => SKIP.includes(key)
@@ -47,10 +47,10 @@ let home
try {
home = await get('/', { redirect: 'manual', body: false })
} catch (e) {
console.error(`ipal-seo-check: ${origin} unreachable (${e.cause?.code ?? e.message}). Start the app first.`)
console.error(`iapl-seo-check: ${origin} unreachable (${e.cause?.code ?? e.message}). Start the app first.`)
process.exit(2)
}
console.log(`ipal-seo-check — ${origin} (Googlebot UA)`)
console.log(`iapl-seo-check — ${origin} (Googlebot UA)`)
// --- 1. root ----------------------------------------------------------------
const rootStatus = home.res.status
@@ -216,7 +216,7 @@ if (dupDescs.length) report('WARNING', 'duplicate meta descriptions (Google igno
if (issues.footerSnippet.length) report('WARNING', 'footer without data-nosnippet (Google quotes the address as the snippet)', 'wrap footer contents in <NoSnippet> (seo.md → Descriptions in Google)', issues.footerSnippet.slice(0, 3))
if (issues.longTitle.length) report('WARNING', 'titles over 65 chars (truncated in results)', 'shorten in the SEO tab', issues.longTitle)
if (issues.favicon.length) report('WARNING', 'no favicon link in head', 'buildIconsMetadata(settings.favicon) in root generateMetadata', issues.favicon.slice(0, 3))
if (issues.xRobots.length) report('ERROR', 'X-Robots-Tag: noindex on pages', 'IPAL_NOINDEX is set in this environment — remove it in production', issues.xRobots.slice(0, 3))
if (issues.xRobots.length) report('ERROR', 'X-Robots-Tag: noindex on pages', 'IAPL_NOINDEX is set in this environment — remove it in production', issues.xRobots.slice(0, 3))
if (issues.h1.length) report('ERROR', 'not exactly one h1', 'one h1 per page — SectionHeader as="h1" only in the first section (AGENT.md §0c)', issues.h1)
if (issues.alt.length) report('ERROR', 'images without alt', 'alt from the Media document; decorative: alt=""', issues.alt)
if (issues.headingSkip.length) report('WARNING', 'heading levels skipped', 'h1 → h2 → h3, no jumps (AGENT.md §0c)', issues.headingSkip)
@@ -241,7 +241,7 @@ if (!skipped('verification') && sample.length) {
// --- 5. 404 ---------------------------------------------------------------
const firstLocale = [...byLocale.keys()].find((l) => l && l.length <= 5) ?? ''
for (const path of [`/${firstLocale ? firstLocale + '/' : ''}ipal-seo-check-${Date.now()}`]) {
for (const path of [`/${firstLocale ? firstLocale + '/' : ''}iapl-seo-check-${Date.now()}`]) {
const r = await get(path.replace('//', '/'), { redirect: 'manual' })
if (r.res.status === 200) report('ERROR', `unknown URL returns 200 (soft 404): ${path}`, 'notFound() in the catch-all, not-found.tsx (pages.md)')
else if (r.res.status !== 404 && !(r.res.status >= 300 && r.res.status < 400)) report('WARNING', `unknown URL returns ${r.res.status}`, 'expected 404')
@@ -293,5 +293,5 @@ for (const f of findings) {
if (f.items.length > 10) console.log(` … and ${f.items.length - 10} more`)
}
console.log(`\nroot: ${rootStatus}${rootLocation ? ' → ' + rootLocation : ''} · sitemap: ${urls.length} URL(s), ${byLocale.size} locale group(s) · checked: ${sample.length} page(s)`)
console.log(`ipal-seo-check: ${errors} error(s), ${warnings} warning(s)`)
console.log(`iapl-seo-check: ${errors} error(s), ${warnings} warning(s)`)
process.exit(errors ? 1 : 0)
+68 -67
View File
@@ -1,31 +1,31 @@
---
name: ipal-setup
description: Complete start-to-finish install of @intecion/ipal-kit in a Payload 3 + Next 16 project (empty folder or a project missing its ipal-kit foundation) with the full mandatory feature set (AGENT.md §0b). Every stage gives exact steps, the minimal code per file, a concrete check (command, curl, panel) and how to switch the module off or override it — registry and dependencies, ipal-skills (skills + AGENTS.md/CLAUDE.md pointer) and required reading (AGENT.md, ipal-reference), i18n, payload.config with ipalKit (injected 2FA, white-label, forms, mailAdapter, R2, consent log, IndexNow, global revalidation), Pages/Media, design tokens, UI primitives, proxy with Markdown negotiation, layout with SiteProviders, catch-all and 404, SEO routes, GEO routes (llms.txt, llms-full.txt, Markdown, MCP, IndexNow), security headers, CSP, env validation, forms, cookies, navigation, final completeness check and panel steps for the client. Use when starting a new website or when ipal-kit wiring is missing or partial.
name: iapl-setup
description: Complete start-to-finish install of @intecion/ipal-kit in a Payload 3 + Next 16 project (empty folder or a project missing its IAPL foundation) with the full mandatory feature set (AGENT.md §0b). Every stage gives exact steps, the minimal code per file, a concrete check (command, curl, panel) and how to switch the module off or override it — registry and dependencies, iapl-skills (skills + AGENTS.md/CLAUDE.md pointer) and required reading (AGENT.md, iapl-reference), i18n, payload.config with iapl (injected 2FA, white-label, forms, mailAdapter, R2, consent log, IndexNow, global revalidation), Pages/Media, design tokens, UI primitives, proxy with Markdown negotiation, layout with SiteProviders, catch-all and 404, SEO routes, GEO routes (llms.txt, llms-full.txt, Markdown, MCP, IndexNow), security headers, CSP, env validation, forms, cookies, navigation, final completeness check and panel steps for the client. Use when starting a new website or when IAPL wiring is missing or partial.
---
# ipal-setup
# iapl-setup
**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).
checks everything; you do not finish with gaps (exception: an `iapl-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
commit** (`git commit -m "iapl-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
later, anything missing goes into the report. Step-by-step mode only on request. Full site build: **ipal-site**.
later, anything missing goes into the report. Step-by-step mode only on request. Full site build: **iapl-site**.
**ipal-kit first (hard rule, AGENT.md "ipal-kit first"):** anything the plugin covers is built with the
plugin's feature. It does not work or is not enough → report it with **ipal-plugin-gap** and wait for the owner's
**IAPL first (hard rule, AGENT.md "IAPL first"):** anything the plugin covers is built with the
plugin's feature. It does not work or is not enough → report it with **iapl-plugin-gap** and wait for the owner's
decision on that part; no hand-built replacement, no silent workaround. **Code rules:** AGENT.md "Code rules"
(one job per file/component/function, no duplicates, typed, texts from the panel, a check for new behaviour).
**ipal-kit helps, never limits:** you can turn off every module separately and override every default —
**IAPL helps, never limits:** you can turn off every module separately and override every default —
**the project config wins**. Every stage has a **Turn off / override** line; "currently always" = the plugin code
has no option for it yet. No option = **plugin gap** (`ipal-plugin-gap`), never a patch in `node_modules`.
has no option for it yet. No option = **plugin gap** (`iapl-plugin-gap`), never a patch in `node_modules`.
Every stage: **Steps** → **Code** (minimum, imports verified against `exports`) → **Check** → **Turn off / override**.
Entry points: `@intecion/ipal-kit` (config, builders, helpers), `/rsc` (server components), `/client`
@@ -66,14 +66,14 @@ propose a concrete choice and get a yes before you build it.
## 1. Installation
**New site: `ipal-kit create` does stages 1–10 in one command** (`node_modules/@intecion/ipal-kit/docs/project-starter.md`).
**New site: `iapl create` does stages 1–10 in one command** (`node_modules/@intecion/ipal-kit/docs/project-starter.md`).
After stage 0, write the answers as JSON (shape `StarterAnswers` from `@intecion/ipal-kit/starter`) and run, from the
folder that will hold the project (needs the `@intecion` registry line in `~/.npmrc`):
```bash
pnpm --config.auto-install-peers=false dlx @intecion/ipal-kit@<version> create <domain> --answers answers.json
```
It generates the site from the reference site, writes `.env` (fresh `PAYLOAD_SECRET`), installs from the shipped
lockfile, runs `ipal-skills`, `ipal-tokens`, `generate:types`, `generate:importmap`, `typecheck` (and `ipal-doctor
lockfile, runs `iapl-skills`, `iapl-tokens`, `generate:types`, `generate:importmap`, `typecheck` (and `iapl-doctor
--strict --offline` when shipped), checks for secrets and makes the first commit. **Check:** `git log --oneline` = 1 commit,
`git status` clean, `AGENTS.md` → "Project decisions" holds every answer, `pnpm typecheck` passes. Then go to stage 11.
**Turn off / override:** it stops (nothing written) for **single-language sites** and **a default language other than
@@ -101,7 +101,7 @@ create-payload-app gave you an older one.
**Node.js 22.23.5 or later** on the 22 line (`"engines": { "node": ">=22.23.5 <23" }`, `.nvmrc` `22`) — Payload 3.94's
minimum, also in Coolify (Nixpacks picks the patch: check `node -v` in the app's Terminal after the first deploy). After the install, `pnpm audit --prod` → no high or critical; add the `dompurify` and `happy-dom` overrides
from AGENT.md §4 item 12 (`"happy-dom@<21.0.4": "^21.0.4"` fixes two high advisories Lexical still brings in). On an
older Payload also the `mongoose` (MongoDB) and `undici` ones listed there. `pnpm exec ipal-doctor` → no
older Payload also the `mongoose` (MongoDB) and `undici` ones listed there. `pnpm exec iapl-doctor` → no
`transitive-min` finding.
`nodemailer`, `lucide-react`, `slugify`, `server-only` come with the plugin — do not add them (your own
`lucide-react` only `~0.400.0`). In `package.json`: pin every `@payloadcms/*` (ui, next, db-*, richtext-lexical,
@@ -120,27 +120,27 @@ with `twoFactor: false` / without `buildR2Storage` (both mandatory in §0b). Nev
## 2. Skills, pointer and reading — before you write code
**Steps.**
1. `pnpm exec ipal-skills` — copies the `ipal-*` skills to `.agents/skills/` **and** appends the ipal-kit pointer
block to the project's `AGENTS.md` / `CLAUDE.md`. Add the script `"ipal:skills": "ipal-skills"`; run it after
1. `pnpm exec iapl-skills` — copies the `iapl-*` skills to `.agents/skills/` **and** appends the IAPL pointer
block to the project's `AGENTS.md` / `CLAUDE.md`. Add the script `"iapl:skills": "iapl-skills"`; run it after
every package update. Commit `.agents/skills/`.
2. `tsconfig.json`: `"exclude": ["node_modules", ".agents"]` (skills contain `.ts`/`.tsx` templates; without this
`tsc`/`next build` fail and `ipal-skills` exits with code 1).
3. **Read in full:** `node_modules/@intecion/ipal-kit/docs/agent/AGENT.md` and the **ipal-reference** skill
(`.agents/skills/ipal-reference/SKILL.md` — wiring map; `resources/api.md` — index of every export).
`tsc`/`next build` fail and `iapl-skills` exits with code 1).
3. **Read in full:** `node_modules/@intecion/ipal-kit/docs/agent/AGENT.md` and the **iapl-reference** skill
(`.agents/skills/iapl-reference/SKILL.md` — wiring map; `resources/api.md` — index of every export).
Check every name not in this skill there, not from memory.
4. `AGENTS.md` per AGENT.md §13: project line (client, domain, market, languages, media, mail) and "Project decisions"
(cookie dialog mode, decisions from the question list) — **outside** the `<!-- ipal-kit:start -->…<!-- ipal-kit:end -->` block
(overwritten on every `ipal-skills` run). No `CLAUDE.md` → `ipal-skills` creates it with an `@AGENTS.md` line.
(cookie dialog mode, decisions from the question list) — **outside** the `<!-- iapl:start -->…<!-- iapl:end -->` block
(overwritten on every `iapl-skills` run). No `CLAUDE.md` → `iapl-skills` creates it with an `@AGENTS.md` line.
**Check.** `ls .agents/skills | grep -c '^ipal-'` > 0 (including `ipal-reference`); `grep -c 'ipal-kit:start' AGENTS.md` = 1;
`CLAUDE.md` has `@AGENTS.md` or its own block; `pnpm exec ipal-skills --dry-run` without a `tsconfig` warning.
**Check.** `ls .agents/skills | grep -c '^ipal-'` > 0 (including `iapl-reference`); `grep -c 'iapl:start' AGENTS.md` = 1;
`CLAUDE.md` has `@AGENTS.md` or its own block; `pnpm exec iapl-skills --dry-run` without a `tsconfig` warning.
**Turn off / override.** `--no-pointer` — no block in AGENTS.md/CLAUDE.md (then write the "Rules" section from §13
yourself); `--dest .claude/skills` — another directory (then exclude `.claude` and replace the `.agents/skills` paths in
commands); `--dry-run` — preview. Name your own skills without the `ipal-` prefix — they are left untouched.
**Optional — external skills** (after the architecture answers; only if the owner wants them, record it in
"Project decisions"): `pnpm exec ipal-skills --external` (all) or `--external ext-react-best-practices,ext-accessibility`
"Project decisions"): `pnpm exec iapl-skills --external` (all) or `--external ext-react-best-practices,ext-accessibility`
— Vercel React best practices and composition patterns, Addy Osmani accessibility, Anthropic frontend design,
the official Payload 3 skill (reference). Pinned, text only, nothing downloaded; our rules win over them (AGENT.md §14).
**Check:** `ls .agents/skills | grep '^ext-'`; each folder has `SOURCE.md` with the pinned commit.
@@ -156,7 +156,7 @@ export const i18nConfig = {
locales: [{ code: 'pl', label: 'Polski' }, { code: 'en', label: 'English' }],
} as const satisfies I18nConfig
// src/content.config.ts — collections with an archive (blog…) are added by the ipal-collection skill
// src/content.config.ts — collections with an archive (blog…) are added by the iapl-collection skill
import type { ContentOption } from '@intecion/ipal-kit'
export const contentConfig: ContentOption = { collections: [] }
@@ -165,7 +165,7 @@ export const contentConfig: ContentOption = { collections: [] }
// src/payload.config.ts — keep from create-payload-app: db, editor, secret, sharp, typescript, admin.importMap
import { buildConfig } from 'payload'
import { revalidatePath } from 'next/cache'
import { buildR2Storage, ipalKit, mailAdapter } from '@intecion/ipal-kit'
import { buildR2Storage, iapl, mailAdapter } from '@intecion/ipal-kit'
import { payloadTotp } from '@clocklimited/payload-2fa'
import { s3Storage } from '@payloadcms/storage-s3'
import { i18nConfig } from '@/i18n.config'
@@ -175,11 +175,12 @@ import { Media } from '@/collections/Media'
export default buildConfig({
// …db, editor, secret, sharp, typescript from create-payload-app…
collections: [Pages, Media], // ipalKit injects users
collections: [Pages, Media], // iapl injects users
email: mailAdapter(), // without this form-builder emails are not sent
plugins: [
ipalKit({
iapl({
i18n: i18nConfig,
storageNames: 'iapl', // a NEW site only (cookie iapl_vid, 2FA counter key); a site that is already live: leave it out
access: { authCollection: 'users' },
pages: { slug: 'pages' },
content: contentConfig,
@@ -196,10 +197,10 @@ export default buildConfig({
})
```
`.env.example` (no values, in the repo): `DATABASE_URI`, `PAYLOAD_SECRET`, `NEXT_PUBLIC_SERVER_URL`, `R2_BUCKET`,
`R2_ENDPOINT`, `R2_ACCESS_KEY_ID`, `R2_SECRET_ACCESS_KEY`, `R2_PUBLIC_URL` (empty = media through the app — the default), `IPAL_IP_HEADER` (`cf-connecting-ip`
behind Cloudflare, `x-forwarded-for` behind a plain proxy), `IPAL_NOINDEX` (empty; `1` on staging only), `INDEXNOW_KEY`,
`R2_ENDPOINT`, `R2_ACCESS_KEY_ID`, `R2_SECRET_ACCESS_KEY`, `R2_PUBLIC_URL` (empty = media through the app — the default), `IAPL_IP_HEADER` (`cf-connecting-ip`
behind Cloudflare, `x-forwarded-for` behind a plain proxy), `IAPL_NOINDEX` (empty; `1` on staging only), `INDEXNOW_KEY`,
`NEXT_PUBLIC_TURNSTILE_SITE_KEY`, `TURNSTILE_SECRET_KEY` (deprecated fallback — production keys go into the panel), with Graph `GRAPH_TENANT_ID`,
`GRAPH_CLIENT_ID`, `GRAPH_CLIENT_SECRET`, `GRAPH_SENDER`. Local `.env` with `PAYLOAD_SECRET` ≥ 32 characters (in production `ipalEnvRules` refuses a shorter one; `secretMinLength` changes it).
`GRAPH_CLIENT_ID`, `GRAPH_CLIENT_SECRET`, `GRAPH_SENDER`. Local `.env` with `PAYLOAD_SECRET` ≥ 32 characters (in production `iaplEnvRules` refuses a shorter one; `secretMinLength` changes it).
One language: one entry in `locales`, no `[locale]` folder (i18n.md).
**Check.** `pnpm payload generate:importmap` (whiteLabel adds admin components) and `pnpm generate:types` without
@@ -221,15 +222,15 @@ the panel shows Site settings, Site integrations, Cookies, Form messages, the Fo
(Create first user) gets `admin` — `access.firstUserAdmin: false` turns that off. `localization` currently always
overridden from `i18n`.
- 2FA wraps the panel's login collection (`admin.user`); a different `twoFactor.collectionSlug` stops startup with
`[ipal] twoFactor…` unless `allowCollectionMismatch: true`. The second factor covers every collection and global
(the plugin's own, and those of plugins listed after `ipalKit`) and the plugin's endpoints; guard your own
`[iapl] twoFactor…` unless `allowCollectionMismatch: true`. The second factor covers every collection and global
(the plugin's own, and those of plugins listed after `iapl`) and the plugin's endpoints; guard your own
endpoints with `secondFactorPassed(req)` or `userMeetsRole(req, role)` (security.md "What the second factor covers").
Verify attempts: 5 per account in 10 minutes (`twoFactor.verifyLimit`).
The `back` link of the setup and verify screens is checked on the server (`twoFactor.safeBack`, on by default:
only a path inside the admin route is kept; `false` turns it off, a function replaces the rule). It needs the
import map entry `@intecion/ipal-kit/admin#SafeTotpView` — run `pnpm payload generate:importmap` and commit
(a production build with a map that lacks it shows 2FA screens without a code form: nobody can sign in;
`ipal-doctor`, the start log and a notice above the screen report it; `twoFactor.importMapCheck: false` turns the
`iapl-doctor`, the start log and a notice above the screen report it; `twoFactor.importMapCheck: false` turns the
log line and the notice off — needed when the `importMap.js` on disk is not the one the build used).
Check: password only → `/admin/verify-totp?back=https%3A%2F%2Fexample.com%2F` → code → you land on `/admin`.
**Set 2FA up right after creating an account** (log in as it, scan the code): until then its password alone
@@ -255,10 +256,10 @@ the panel shows Site settings, Site integrations, Cookies, Form messages, the Fo
staff collection with role values of its own that hold neither `editor` nor `admin`** gets only "an account of that
collection, or a plugin admin": the plugin cannot rank your roles, so inside it every account may create an
account with any role — **write its `create` / `update` / `delete` rules and the field access of its `roles`
field yourself** (`ipal-doctor --url` → `staff-own-roles`). Give every staff collection a `roles` field: without
field yourself** (`iapl-doctor --url` → `staff-own-roles`). Give every staff collection a `roles` field: without
one each of its accounts is an admin to the plugin. Every slug in `access.staffCollections` must be an auth
collection of the config, or Payload does not start (`/api/health` 503, the slug in the log); a staff collection
from a plugin listed after ipalKit gets the rules in front of its own (`custom: { ipal: { accountRules: false } }`
from a plugin listed after iapl gets the rules in front of its own (`custom: { ipal: { accountRules: false } }`
on it keeps its own as they are); a collection of the config that a later plugin makes the panel's (`admin.user`)
keeps the rules you wrote and gets the plugin's for the rest — name the login collection in
`access.staffCollections` so it is handled at config time; Payload's first-user route answers only for the
@@ -268,7 +269,7 @@ the panel shows Site settings, Site integrations, Cookies, Form messages, the Fo
`access.firstUserAdmin: false` with a default role below the panel role (the start refuses or drops the panel
role). access.md "Account rules".
- **`serverURL`**: set it in the Payload config. Without it, behind a proxy that rewrites `Host` and sends no
`X-Forwarded-Host`, the 2FA code page is refused as "another origin" (logged once: `[ipal] 2FA: a code from
`X-Forwarded-Host`, the 2FA code page is refused as "another origin" (logged once: `[iapl] 2FA: a code from
origin … was refused`). Coolify / Traefik keep `Host`, so it works there either way.
- **Stored secrets:** the SMTP password and the Turnstile secret key are entered **in the panel** (Site
integrations) and are write-only — the panel and the API show "a value is set". Do not add env variables for
@@ -340,8 +341,8 @@ served through the app (`/api/media/file/…`, storage.md), whose file route che
Blocks: `src/blocks/configs.ts` (`export const pageBlocks: Block[] = [HeroBlock]`) and `src/blocks/registry.ts`
(`export const blockRegistry = { hero: Hero }` — a `BlockComponentMap` map from `/rsc`). Create the first block (Hero) and the
`src/components/ui/` primitives (CMSLink on `resolveLink`, Button, Media via `mediaImageProps`/`videoProps`, Section,
SectionHeader) **1:1** from `.agents/skills/ipal-block/resources/section-code.md` — before any other block.
No other collections (content with URLs → **ipal-collection**).
SectionHeader) **1:1** from `.agents/skills/iapl-block/resources/section-code.md` — before any other block.
No other collections (content with URLs → **iapl-collection**).
**Check.** `pnpm generate:types` → `payload-types.ts` has `Page`, `Media`, `CmsLink`; panel → Media: the file
`Zdjęcie Test.JPG` is saved as `zdjecie-test.jpg`; Pages: a page with a Hero block saves, the slug is generated
@@ -355,24 +356,24 @@ refreshes collections only (globals — stage 3; archive entries — your own ho
## 5. Styles — the design-token standard
**Code.** `postcss.config.mjs`: `export default { plugins: { '@tailwindcss/postcss': {} } }`. Copy the two templates:
`.agents/skills/ipal-setup/resources/DESIGN.md` → `DESIGN.md` (project root; fill it from the stage 0 answers) and
`.agents/skills/ipal-setup/resources/tokens.ts` → `src/design/tokens.ts` (brand values from `DESIGN.md`: primary,
secondary/accent, theme, radius, fonts). Then `pnpm exec ipal-tokens` → `src/design/tokens.css` (commit both).
`.agents/skills/iapl-setup/resources/DESIGN.md` → `DESIGN.md` (project root; fill it from the stage 0 answers) and
`.agents/skills/iapl-setup/resources/tokens.ts` → `src/design/tokens.ts` (brand values from `DESIGN.md`: primary,
secondary/accent, theme, radius, fonts). Then `pnpm exec iapl-tokens` → `src/design/tokens.css` (commit both).
```css
/* src/app/(frontend)/styles.css — the same on every site, no brand values here */
@import "tailwindcss";
@import "@intecion/ipal-kit/fluid-wide.css"; /* default; fluid.css = stops at 1280 px */
@import "@intecion/ipal-kit/tokens.css"; /* neutral defaults for every --ipal-* token */
@import "@intecion/ipal-kit/tailwind.css"; /* utilities (bg-surface, text-fg, py-section…), dark: on data-theme */
@import "../../design/tokens.css"; /* the brand, generated by ipal-tokens — always last */
@import "../../design/tokens.css"; /* the brand, generated by iapl-tokens — always last */
@source "../../../node_modules/@intecion/ipal-kit/dist/**/*.js"; /* without this the banner/Turnstile have no styles */
```
Fonts via `next/font` with `subsets: ['latin', 'latin-ext']` and `variable: '--font-family-body'` /
`'--font-family-heading'`, both classes on `<html>` (design-tokens.md → Wiring). Hero on `--ipal-hero-min-h` (§6.11a).
Optional (only when the site shows the a11y widget): `@import "@intecion/ipal-kit/a11y.css";`.
**Check.** `pnpm exec ipal-tokens` exits 0 (no ✗ contrast rows) and `pnpm exec ipal-tokens --check` says up to date;
paste `pnpm exec ipal-tokens --report` into `DESIGN.md` → Colour. After stage 6: on `/pl` the `text-h1`/`py-section`/
**Check.** `pnpm exec iapl-tokens` exits 0 (no ✗ contrast rows) and `pnpm exec iapl-tokens --check` says up to date;
paste `pnpm exec iapl-tokens --report` into `DESIGN.md` → Colour. After stage 6: on `/pl` the `text-h1`/`py-section`/
`bg-surface` classes work, `getComputedStyle(document.documentElement).getPropertyValue('--ipal-primary')` is the brand
colour, switching the theme changes `--ipal-bg`, the cookie banner uses the brand colour in both themes, Polish characters
render in the font; screens 360, 768, 1366×768, 1920 without horizontal scroll.
@@ -397,7 +398,7 @@ export const config = { matcher: ['/((?!api|admin|_next|.*\\..*).*)'] }
`src/lib/content.ts` = PROGRAMISTA §2.7 1:1: `createContentHelpers({ config, content: contentConfig, i18n: i18nConfig,
baseUrl: process.env.NEXT_PUBLIC_SERVER_URL, markdownAlternate: true, summaryField: 'aiSummary', mcp: { serverName:
'<client>-site' } })` destructuring all keys (data, layout, links, routes). Local business:
`siteJsonLd` with `buildLocalBusinessJsonLd` + `formatOpeningHours` (seo.md). Full key list: ipal-reference.
`siteJsonLd` with `buildLocalBusinessJsonLd` + `formatOpeningHours` (seo.md). Full key list: iapl-reference.
```tsx
// src/app/(frontend)/[locale]/layout.tsx — NO <head>, no headers()
import { notFound } from 'next/navigation'
@@ -422,7 +423,7 @@ export default async function LocaleLayout({ children, params }: Props) {
)
}
```
`src/app/(frontend)/[locale]/actions.ts` = `.agents/skills/ipal-form/resources/actions.ts` 1:1
`src/app/(frontend)/[locale]/actions.ts` = `.agents/skills/iapl-form/resources/actions.ts` 1:1
(`createSubmitAction({ getCachedPayload, headers })` from `@intecion/ipal-kit/server`, exports `sendForm`).
`src/app/(frontend)/[locale]/[[...slug]]/page.tsx` (**double** brackets) = PROGRAMISTA §2.8 1:1:
`export const revalidate = 3600` (literal), `createPageRoute(content, { blocks: blockRegistry, notFound,
@@ -495,12 +496,12 @@ export default withPayload(withSecurityConfig({
```
```ts
// src/instrumentation.ts — import from /env (the root pulls in Payload → Edge/Turbopack crash)
import { assertEnv, ipalEnvRules } from '@intecion/ipal-kit/env'
import { assertEnv, iaplEnvRules } from '@intecion/ipal-kit/env'
export function register() {
if (process.env.NEXT_RUNTIME !== 'nodejs') return
// R2_PUBLIC_URL optional: media served through the app by default (storage.md, env.md)
assertEnv(
ipalEnvRules({ storage: true, ipHeader: true, databaseName: true /* , emailGraph: true with Graph */ }).map((r) =>
iaplEnvRules({ storage: true, ipHeader: true, databaseName: true /* , emailGraph: true with Graph */ }).map((r) =>
r.name === 'R2_PUBLIC_URL' ? { ...r, required: false } : r,
),
)
@@ -517,14 +518,14 @@ ClaudeBot…) with `Allow` (a policy picked in Site settings → Search engines
an empty `PAYLOAD_SECRET` in `.env` → `pnpm dev` exits with a list of missing variables (restore it).
**Turn off / override.** `robots`: `aiBots: 'block-training' | 'disallow' | false` (only on a client decision →
`ipal-audit-skip: aibots`), `adminRoute: false` (hidden panel), `extraDisallow`; `sitemapStyle: false` (raw XML)
`iapl-audit-skip: aibots`), `adminRoute: false` (hidden panel), `extraDisallow`; `sitemapStyle: false` (raw XML)
or your own text; `buildSecurityHeaders({ frameOptions, coop, hsts, additional })` — an `additional` entry with the same key
overrides the default; CSP: `buildCsp` flags (`youtube`, `googleMaps`, `metaPixel`, `linkedIn`, …), `extra`, `override`, no `csp`
= no policy; after clean reports `mode: 'enforce'` (site and admin); nonces only for pages that already render per request
(`createProxy({ csp })` + `<SiteProviders nonce>`); `withSecurityConfig(config, { hidePoweredBy: false })` keeps `X-Powered-By`;
`buildImagesConfig({ extraHosts })`; env validation is fully opt-in — filter/add rules
(`ipalEnvRules(…).filter(…)`). Staging: `IPAL_NOINDEX=1` (also stops IndexNow). Search engines: `robots` instead of
`getRobots` ignores the panel; `ipalKit({ searchSettings: false })` removes the tab; per-bot exceptions in code:
(`iaplEnvRules(…).filter(…)`). Staging: `IAPL_NOINDEX=1` (also stops IndexNow). Search engines: `robots` instead of
`getRobots` ignores the panel; `iapl({ searchSettings: false })` removes the tab; per-bot exceptions in code:
`createContentHelpers({ robots: { aiBotRules: [{ userAgent, access }] } })`. Sitemap: `sitemapOptions: { maxUrls,
cacheControl, memoSeconds }`, `sitemapEntries: (entries) => entries` (add/remove URLs), `underConstructionSeo: false`.
@@ -557,7 +558,7 @@ text/markdown' localhost:3000/pl` → the same Markdown; `curl -s -X POST localh
application/json' -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'` → `get_site_info`, `list_pages`,
`search_content`, `get_page`; `/indexnow-key.txt` → `404` until the key is generated in the panel, then the key.
**Turn off / override.** No route file = no feature (allowed only with `ipal-audit-skip: llms | llms-full |
**Turn off / override.** No route file = no feature (allowed only with `iapl-audit-skip: llms | llms-full |
markdown | mcp`); Markdown prefix: `createProxy({ markdown: '/ai' })` + your own folder; MCP: `mcp: { rateLimit:
false | { max, windowMs }, serverVersion, maxBatch, clientIp }`, more options → `createMcpRoute` (mcp.md), the tool
list is currently fixed; block Markdown: `markdown: { overrides }` in `createContentHelpers`; IndexNow: without
@@ -565,15 +566,15 @@ list is currently fixed; block Markdown: `markdown: { overrides }` in `createCon
## 9. Forms and cookies
**Steps.** Skill **ipal-form**: a block with `<RenderForm>` (`/rsc`), `src/components/forms/formClasses.ts`, the action from stage 6
**Steps.** Skill **iapl-form**: a block with `<RenderForm>` (`/rsc`), `src/components/forms/formClasses.ts`, the action from stage 6
(one per project), every form from a **seed** `scripts/seed-form-*.ts` (email to the company + confirmation to the customer,
every language, consent checkbox). Cookies: skill **ipal-consent-check** — `cookie-scan.mjs` → `import-cookies.ts` into
every language, consent checkbox). Cookies: skill **iapl-consent-check** — `cookie-scan.mjs` → `import-cookies.ts` into
Cookies → Cookie list; on the cookie policy page a block with `<CookieTable>` (`/rsc`, data from `getCookieTable`);
the same list appears in the `settings="detailed"` dialog (labels: Cookies → Settings window → Cookie list headings, every language).
**Check.** Panel → Forms: the seeded form; a submission on `/pl` → an entry in Form Submissions + 2 emails (SMTP:
Site integrations → E-mail sending → Send test); with Turnstile test keys the widget is visible, without a token the submission is rejected;
`node .agents/skills/ipal-consent-check/scripts/consent-check.mjs http://localhost:3000/pl` = 0 errors;
`node .agents/skills/iapl-consent-check/scripts/consent-check.mjs http://localhost:3000/pl` = 0 errors;
after a choice in the banner a new record in Consent records.
**Turn off / override.** Turnstile: both keys empty (panel and env) → no widget and no verification; fail-closed
@@ -590,9 +591,9 @@ after an editor bumps Cookies → Policy version nothing to change (`createProxy
## 10. Navigation
**Steps.** Skill **ipal-nav**: Header/Footer/Company globals (`buildLinkField`/`buildLinksField`, `resolveNav`,
**Steps.** Skill **iapl-nav**: Header/Footer/Company globals (`buildLinkField`/`buildLinksField`, `resolveNav`,
legal links via `getSystemLinks(locale)`), `afterChange: [buildGlobalRevalidateHook({ revalidatePath })]` on **your own**
globals (the plugin's globals already refresh with `ipalKit({ revalidatePath })` from stage 3), Header/Footer in the layout, optionally
globals (the plugin's globals already refresh with `iapl({ revalidatePath })` from stage 3), Header/Footer in the layout, optionally
`<SiteProviders jsonLd={[buildNavigationJsonLd(…)]}>`.
**Check.** A menu item change in the panel is visible on `/pl` right after saving; a link to a page in EN leads to
@@ -614,17 +615,17 @@ relationTo, appearances: false, disableLabel })`, `LanguageSwitcher` (`className
**Commands (all must pass):**
```bash
pnpm generate:types && pnpm payload generate:importmap
pnpm payload migrate:create # Postgres with migrations only — also after every ipal-kit upgrade (new plugin fields)
bash .agents/skills/ipal-audit/scripts/audit.sh # full: §0b "missing: …" = 0, tsc, build
pnpm payload migrate:create # Postgres with migrations only — also after every IAPL upgrade (new plugin fields)
bash .agents/skills/iapl-audit/scripts/audit.sh # full: §0b "missing: …" = 0, tsc, build
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)
node .agents/skills/iapl-seo-check/scripts/seo-check.mjs http://localhost:3000 # 0 errors
node .agents/skills/iapl-consent-check/scripts/consent-check.mjs http://localhost:3000/pl
pnpm exec iapl-doctor --strict --offline --deep --url http://localhost:3000 # the team standard (skill iapl-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) ·
consent + register + analytics (6, 9) · headers, 2FA, CSP report-only, `IPAL_IP_HEADER` (3, 7) · health, env,
`IPAL_NOINDEX` on staging (7) · system pages (panel below) · zero hardcoding (audit) · content (AGENT.md §0c) ·
consent + register + analytics (6, 9) · headers, 2FA, CSP report-only, `IAPL_IP_HEADER` (3, 7) · health, env,
`IAPL_NOINDEX` on staging (7) · system pages (panel below) · zero hardcoding (audit) · content (AGENT.md §0c) ·
scaling (5). `●` routes for pages need the database at build time (PROGRAMISTA §4.3).
**Panel steps for the user** (`/admin`, paste them this list with the gaps from the report):
@@ -644,7 +645,7 @@ scaling (5). `●` routes for pages need the database at build time (PROGRAMISTA
**Deployment (Coolify — the only path; the user/team does it, you prepare the inputs).** Full procedure:
`node_modules/@intecion/ipal-kit/docs/deployment.md` §4. Hand over:
- the env list for the Coolify app, each marked **build time** and/or **runtime** — `NEXT_PUBLIC_*` both; secrets
(`PAYLOAD_SECRET`, `R2_*`, `GRAPH_*`, `TURNSTILE_SECRET_KEY`, `IPAL_IP_HEADER`) runtime; `DATABASE_URI` /
(`PAYLOAD_SECRET`, `R2_*`, `GRAPH_*`, `TURNSTILE_SECRET_KEY`, `IAPL_IP_HEADER`) runtime; `DATABASE_URI` /
`PAYLOAD_SECRET` also build time when pages are prerendered from the database (§3a3);
- domains `https://client.pl,https://www.client.pl` with the www ↔ apex redirect matching `NEXT_PUBLIC_SERVER_URL`;
port 3000; health check `/api/health`;
@@ -677,5 +678,5 @@ email `Authentication-Results: spf=pass dkim=pass dmarc=pass`. We verify Search
the verification fields in Site settings → Search engines stay **empty** (only URL-prefix verification uses them; the plugin then adds the `<meta>` itself); submit the sitemap `https://client.pl/sitemap.xml`
once by hand in GSC and Bing (no API). Turnstile, IndexNow, llms, MCP — no DNS.
Final report: what is wired, what is missing (data, keys, decisions), the DNS record list with values (`dig` status), every `ipal-audit-skip`, any
**plugin gap** (`ipal-plugin-gap`). Next: blocks (**ipal-block**), content collections (**ipal-collection**).
Final report: what is wired, what is missing (data, keys, decisions), the DNS record list with values (`dig` status), every `iapl-audit-skip`, any
**plugin gap** (`iapl-plugin-gap`). Next: blocks (**iapl-block**), content collections (**iapl-collection**).
@@ -1,7 +1,7 @@
# DESIGN.md — <client name>
The human source of the look. Its machine form is `src/design/tokens.ts`; the two must agree
(`ipal-doctor` compares them). Values go into `tokens.ts`, never into components.
(`iapl-doctor` compares them). Values go into `tokens.ts`, never into components.
Sections are fixed: fill every one, write "default" where the brand keeps the standard.
## 1. Brand in one sentence
@@ -16,7 +16,7 @@ The one memorable element (where the boldness goes): <…>. Everything else stay
| accent | default (= primary) | | badges, highlights |
| bg / surface / surface-muted | default | default | page, cards, alternate sections |
Contrast (paste `pnpm exec ipal-tokens --report`; every ✗ fixed before launch):
Contrast (paste `pnpm exec iapl-tokens --report`; every ✗ fixed before launch):
```
<report>
```
@@ -1,5 +1,5 @@
// src/design/tokens.ts — the ONLY file you edit to rebrand the site (docs/design-tokens.md).
// After every change: `pnpm exec ipal-tokens` → writes src/design/tokens.css (commit it) and prints
// After every change: `pnpm exec iapl-tokens` → writes src/design/tokens.css (commit it) and prints
// the WCAG contrast check (`--report` prints every pair for DESIGN.md → Colour).
// Leave out anything the brand does not change: the neutral defaults in @intecion/ipal-kit/tokens.css apply.
import { defineTokens } from '@intecion/ipal-kit/tokens'
+40 -40
View File
@@ -1,9 +1,9 @@
---
name: ipal-site
description: Builds a complete client website on ipal-kit from a brief to handover with minimal human involvement — intake and one consolidated question list, foundation, content model, navigation, sections, forms, content seeding in every language, integrations, system pages, design, full self-verification (build, ipal-audit, ipal-seo-check, ipal-consent-check, locale coverage, editor test) and a final report. Orchestrates the other ipal-* skills. Use when asked to build/create/make a website, landing page or new site for a client, or to "finish the site".
name: iapl-site
description: Builds a complete client website on IAPL from a brief to handover with minimal human involvement — intake and one consolidated question list, foundation, content model, navigation, sections, forms, content seeding in every language, integrations, system pages, design, full self-verification (build, iapl-audit, iapl-seo-check, iapl-consent-check, locale coverage, editor test) and a final report. Orchestrates the other iapl-* skills. Use when asked to build/create/make a website, landing page or new site for a client, or to "finish the site".
---
# ipal-site
# iapl-site
You run the project as an independent contractor (AGENT.md §0a): you make technical
decisions yourself, ask once for missing data, anticipate problems, check
@@ -14,18 +14,18 @@ guide or correct you.
(`feat(site): phase N — <what>`), no waiting for an OK between phases. Before each phase, go through the
"Anticipate" table in AGENT.md §0a.
**ipal-kit first (hard rule, AGENT.md "ipal-kit first"):** anything the plugin covers is built with the
plugin's feature. It does not work or is not enough → report it with **ipal-plugin-gap** and wait for the owner's
**IAPL first (hard rule, AGENT.md "IAPL first"):** anything the plugin covers is built with the
plugin's feature. It does not work or is not enough → report it with **iapl-plugin-gap** and wait for the owner's
decision on that part; no hand-built replacement, no silent workaround. **Code rules:** AGENT.md "Code rules"
(one job per file/component/function, no duplicates, typed, texts from the panel, a check for new behaviour).
## Phase 0 — Discovery, architecture questions and one question list
1. Read: the brief (all attachments), `AGENTS.md`, `DESIGN.md`/`PRODUCT.md`,
`package.json` (ipal-kit version), existing code. New project or finishing one?
`package.json` (IAPL version), existing code. New project or finishing one?
2. Write into `AGENTS.md` → "Site map": pages (from the brief), sections on each,
forms, languages, collections (only if there are lists with URLs — ipal-collection).
3. **Architecture questions — mandatory, you wait for the answers.** Send the list from **ipal-setup**
forms, languages, collections (only if there are lists with URLs — iapl-collection).
3. **Architecture questions — mandatory, you wait for the answers.** Send the list from **iapl-setup**
stage 0 (languages + default locale + URLs, styling, pages/collections, forms + e-mail, analytics/consent/
cookie scan, SEO/GEO, database + media, 2FA/white-label/credit, hosting + domains + DNS) for every topic
the brief does not answer. Write the answers into `AGENTS.md` → "Project decisions". **Never guess an
@@ -42,25 +42,25 @@ decision on that part; no hand-built replacement, no silent workaround. **Code r
```
Send this list with the architecture questions. After the architecture answers arrive, **keep working**
on the content defaults and fill in the content answers when they arrive. Stop before an irreversible
decision (AGENT §0a) and on a plugin gap (ipal-plugin-gap — report, wait for the owner).
decision (AGENT §0a) and on a plugin gap (iapl-plugin-gap — report, wait for the owner).
## Phase 1 — Foundation
- **New site → `ipal-kit create`** with the phase-0 answers as JSON (`docs/project-starter.md`):
- **New site → `iapl create`** with the phase-0 answers as JSON (`docs/project-starter.md`):
`pnpm --config.auto-install-peers=false dlx @intecion/ipal-kit@<version> create <domain> --answers answers.json`.
It generates the site from the reference site (every §0b item wired), installs the skills, writes the answers into
`AGENTS.md`, and makes the first commit. Check: `git log --oneline` = 1 commit, `pnpm typecheck` passes. Then continue
with phase 2. What it refuses (a single-language site, a default language other than `pl`, no URL prefix, Postgres) → the manual path below.
- New project without the command → **ipal-setup** (all of it, with `ipal-skills`, `AGENTS.md`). Every file you wire has its canonical
- New project without the command → **iapl-setup** (all of it, with `iapl-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 —
- Existing project on an older IAPL → **iapl-upgrade** before anything else.
- Exit: `pnpm build` passes, `/admin` works, `iapl-audit --quick` = 0 errors —
**including zero "missing: …"**, i.e. the full AGENT.md §0b set (SEO, GEO, R2, Turnstile,
forms, consent, security) wired from the first phase, not at the end.
## Phase 2 — Content model
- Pages = `Pages` + blocks. Collections only for lists with URLs (**ipal-collection**).
- Globals: Header, Footer, Company (**ipal-nav**), Site settings, System pages.
- Pages = `Pages` + blocks. Collections only for lists with URLs (**iapl-collection**).
- Globals: Header, Footer, Company (**iapl-nav**), Site settings, System pages.
- Every section from the site map → **a block of the block library first** (`libraryBlocks` from
`@intecion/ipal-kit/blocks`: hero, textMedia, featureGrid, cta, richText, faq, contact, gallery, testimonials,
stats, steps, logos, team, pricing, entryList — docs/block-library.md), or one of its variants (`variant`),
@@ -68,31 +68,31 @@ decision on that part; no hand-built replacement, no silent workaround. **Code r
"Project decisions". Goal: as few own blocks as possible.
- Write the map down: page → sections → library block + variant (or own block + why). The starter turns on
hero, textMedia, featureGrid, cta, richText, faq, contact, gallery; turn on the rest only when the map needs them.
- Schema change with content in the database → **ipal-migrate-fields**, never "live".
- Schema change with content in the database → **iapl-migrate-fields**, never "live".
## Phase 3 — Navigation and company data → **ipal-nav**
## Phase 3 — Navigation and company data → **iapl-nav**
Language switcher in the header: `LanguageSwitcher` (`/client`). With `renderLabel` (e.g. `PL` / `EN`) wrap it in
your own `'use client'` file (`src/components/layout/LocaleSwitcher.tsx`) and render that from the server header —
a function can't cross from a server to a client component, and `next build` fails. Example: i18n.md
"Language switcher without 404".
## Phase 4 — Sections → **ipal-block** for every block
## Phase 4 — Sections → **iapl-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>`.
`classNames` / `ui`, never by copying a block; own it completely only with `iapl-blocks eject <block>`.
Own blocks (no library block fits): order Hero → recurring sections → specific ones.
Every block: schema from the field dictionary, composition of primitives, zero text in JSX
(`ipal-audit --quick` after every block — fix errors right away).
(`iapl-audit --quick` after every block — fix errors right away).
**Enlarged images** (gallery, cards, product photos, certificates, rich text): the shared lightbox,
never a hand-made modal or a lightbox library — `ipalKit({ lightbox: true })` + migration,
never a hand-made modal or a lightbox library — `iapl({ lightbox: true })` + migration,
`<SiteProviders lightbox>` once, `<LightboxTrigger group={`gallery-${id}`} image={lightboxImage(media, { size })}>`
around the thumbnail, `RenderRichText lightbox` for article images, Form messages → Image viewer labels
in every language (lightbox.md). Check with the keyboard: Enter opens, ←/→ browse, Esc returns focus.
## Phase 5 — Forms → **ipal-form**
Every form = a seed from `ipal-form/resources/seed-form.template.ts` (fields, confirmation, email to the
## Phase 5 — Forms → **iapl-form**
Every form = a seed from `iapl-form/resources/seed-form.template.ts` (fields, confirmation, email to the
company **and** confirmation to the customer, every language) — the renderer and action code you write once. **Never** a custom
form with fields in JSX, an `api/contact` route, `nodemailer`, reCAPTCHA (AGENT.md §0b).
@@ -106,17 +106,17 @@ form with fields in JSX, an `api/contact` route, `nodemailer`, reCAPTCHA (AGENT.
Never invent company data, prices, reviews, numbers, certificates, names.
**VERY IMPORTANT — after launch never run the whole seed again** (the owner's edits must survive): a later
change lists exactly the records it touches in `ONLY` / `SEED_ONLY` (e.g. `pages:kontakt,global:header`),
checked with a dry run; a full re-seed only with the owner's explicit OK (`IPAL_SEED_ALLOW_FULL=1`).
checked with a dry run; a full re-seed only with the owner's explicit OK (`IAPL_SEED_ALLOW_FULL=1`).
The template is a thin script over `createSeeder` (`@intecion/ipal-kit/seed`): keep the calls
(`upsertBySlug`, `fillGlobal`, `summary`), change only CONTENT; options in docs/seeding.md.
2. `pnpm payload run scripts/seed-content.ts` → the placeholder list goes into the report.
On production (rules: `node_modules/@intecion/ipal-kit/docs/seeding.md`): `SEED_DRY_RUN=1` first, back up the
database, then the real run. It only creates what is missing; `SEED_UPDATE=1` there is refused without
`IPAL_SEED_ALLOW_PROD_UPDATE=1` and still skips pages an editor changed (`skip (edited)`).
`IAPL_SEED_ALLOW_PROD_UPDATE=1` and still skips pages an editor changed (`skip (edited)`).
3. System pages: Homepage, 404, privacy policy (the page exists; the policy
text comes from the client → placeholder). Cookie banner (with Detail labels and the Cookies list
from the scan), Notifications — texts in every language.
4. **ipal-locale-add → `locale-coverage`** = 0 gaps (or deliberate ones listed in the report).
4. **iapl-locale-add → `locale-coverage`** = 0 gaps (or deliberate ones listed in the report).
5. Images: leave upload fields empty (the editor adds them) or upload files from
the brief via the panel — prepared (WebP/JPG ≤ 1.5 MB, ≤ 2560 px).
@@ -130,9 +130,9 @@ 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.
every token from `IAPL_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 ✗
`src/design/tokens.ts` (template `.agents/skills/iapl-setup/resources/tokens.ts`) → `pnpm exec iapl-tokens` (no ✗
contrast rows). None → copy the `DESIGN.md` template, keep the neutral defaults + the brand primary, and recommend
Impeccable in the report. Components use only the preset's utilities. Do not polish styles ad hoc in components. Library blocks follow the
tokens by themselves (token utilities only); a part that needs another look → `createBlockRegistry({ classNames })`.
@@ -141,18 +141,18 @@ Responsiveness: 360 px, 768 px, 1280 px — no horizontal scroll.
## Phase 9 — Verification (all by yourself, results go into the report)
```bash
pnpm generate:types && pnpm tsc --noEmit
bash .agents/skills/ipal-audit/scripts/audit.sh # full: + tsc + build
bash .agents/skills/iapl-audit/scripts/audit.sh # full: + tsc + build
pnpm build && pnpm start & # page routes ● (SSG), not ƒ
node .agents/skills/ipal-seo-check/scripts/seo-check.mjs http://localhost:3000
node .agents/skills/ipal-consent-check/scripts/consent-check.mjs http://localhost:3000/<locale>
pnpm payload run .agents/skills/ipal-locale-add/scripts/locale-coverage.ts
node .agents/skills/iapl-seo-check/scripts/seo-check.mjs http://localhost:3000
node .agents/skills/iapl-consent-check/scripts/consent-check.mjs http://localhost:3000/<locale>
pnpm payload run .agents/skills/iapl-locale-add/scripts/locale-coverage.ts
```
`ipal-seo-check` also checks GEO: `/llms.txt`, `/llms-full.txt`, `/md/…`, `/api/mcp`,
`iapl-seo-check` also checks GEO: `/llms.txt`, `/llms-full.txt`, `/md/…`, `/api/mcp`,
JSON-LD, AI bots in robots — every gap is an `[ERROR]` to fix.
Plus by hand: the editor test (AGENT §11) in every language, the form (list in
ipal-form §6), keyboard (Tab through the menu, banner, form; visible focus),
404 in every language. Fix every `[ERROR]` (**ipal-debug**) and run the
check again. Never hand over with errors — exception: an ipal-kit bug reported with `ipal-plugin-gap`
iapl-form §6), keyboard (Tab through the menu, banner, form; visible focus),
404 in every language. Fix every `[ERROR]` (**iapl-debug**) and run the
check again. Never hand over with errors — exception: an IAPL bug reported with `iapl-plugin-gap`
and waiting for the owner's decision (or handled by an approved, marked workaround).
## Phase 10 — Final report (the only big message to the user)
@@ -162,11 +162,11 @@ and waiting for the owner's decision (or handled by an approved, marked workarou
- pages: <list with URLs per language> · blocks: <list> · forms: <list>
- languages: <…> · integrations: <email ✓ Send test, Turnstile ✓, analytics: waiting for IDs>
## Checks
build ✓ (n routes ●) · ipal-audit 0/0 · seo-check <e>/<w> · consent-check 0 violations · locale-coverage 0
build ✓ (n routes ●) · iapl-audit 0/0 · seo-check <e>/<w> · consent-check 0 violations · locale-coverage 0
## Mandatory set (AGENT.md §0b)
SEO ✓ · JSON-LD ✓ · llms.txt + llms-full ✓ · Markdown ✓ · MCP ✓ · R2 <✓ / waiting for keys> ·
Turnstile <✓ / waiting for keys> · forms from the panel ✓ · consent ✓ · 2FA ✓ · health ✓
(skipped by client decision: <ipal-audit-skip or "none">)
(skipped by client decision: <iapl-audit-skip or "none">)
## To fill in by you / the client (in the panel)
- [TO FILL: tax ID (NIP)] → Company · … (full list from the seed)
- draft translations for approval: <pages>
@@ -174,10 +174,10 @@ Turnstile <✓ / waiting for keys> · forms from the panel ✓ · consent ✓ ·
- <decision> — <why> (full list in AGENTS.md)
## Fixed along the way
- <problem → cause → fix> (briefly, only what matters)
## For ipal-kit
## For IAPL
- [bug|improvement] <topic> → docs/plugin-requests/<file> · owner's decision: <wait / option / approved workaround at file:line>
## Next step
- <one thing, e.g. "give me the domain → deployment per PROGRAMISTA §4">
```
Do not report progress along the way. Exceptions: the question lists from phase 0, a plugin gap
(reported at once, ipal-plugin-gap), an irreversible decision.
(reported at once, iapl-plugin-gap), an irreversible decision.
@@ -1,5 +1,5 @@
/**
* Content seed from the brief — skill ipal-site, phase 6. Rules: docs/seeding.md.
* Content seed from the brief — skill iapl-site, phase 6. Rules: docs/seeding.md.
*
* SEED_DRY_RUN=1 pnpm payload run scripts/seed-content.ts # no writes: prints create / skip / update per record
* pnpm payload run scripts/seed-content.ts # creates what's missing, never overwrites
@@ -12,7 +12,7 @@
* - Create-only and idempotent. Pages match by their DEFAULT-locale slug; globals
* get only the fields that are still empty. Nothing is ever deleted.
* - SEED_UPDATE=1 is refused when NODE_ENV=production or the database is not local,
* unless IPAL_SEED_ALLOW_PROD_UPDATE=1 is also set. Back up the database first.
* unless IAPL_SEED_ALLOW_PROD_UPDATE=1 is also set. Back up the database first.
* - An update skips every record an editor changed since seeding ("skip (edited)").
* - Every locale is written with `fallbackLocale: false` onto the same row ids.
* - Writes carry ipalSkipIndexNow, disableRevalidate and ipalSeed in `context`.
@@ -20,7 +20,7 @@
* - VERY IMPORTANT — after launch: never run the whole seed again. The owner's edits on the live
* site must survive. List exactly the records this run may touch in ONLY (or SEED_ONLY); the rest
* is reported as "skip (not listed)". A run without a list against a production / non-local
* database is refused unless IPAL_SEED_ALLOW_FULL=1 — only with the owner's explicit OK.
* database is refused unless IAPL_SEED_ALLOW_FULL=1 — only with the owner's explicit OK.
*
* Write content ONCE, all languages side by side:
* heading: { pl: 'Nasze usługi', en: 'Our services' } → localized value
@@ -53,7 +53,7 @@ const PAGES: Record<string, unknown>[] = [
},
},
}),
pageTemplates.contact({ blocks, form: { $form: 'Contact form' } }), // seed the form first (ipal-form)
pageTemplates.contact({ blocks, form: { $form: 'Contact form' } }), // seed the form first (iapl-form)
pageTemplates.legal('privacyPolicy', { blocks }),
pageTemplates.notFound({ blocks }),
// A page of your own: { title: { pl, en }, slug: { pl, en }, layout: [{ blockType: 'faq', items: [...] }] }
+111 -89
View File
@@ -1,9 +1,9 @@
---
name: ipal-upgrade
description: Upgrades an existing project to the latest @intecion/ipal-kit and replaces hand-written code that the plugin now provides — proxy, route handlers, consent wrapper, language switcher, rich text parser, form logic, noindex, redirects, env validation, privacy link label, 404 page, CTA field zoo. Use when the user asks to update ipal-kit, migrate an older project, or clean up duplicated logic in a project.
name: iapl-upgrade
description: Upgrades an existing project to the latest @intecion/ipal-kit and replaces hand-written code that the plugin now provides — proxy, route handlers, consent wrapper, language switcher, rich text parser, form logic, noindex, redirects, env validation, privacy link label, 404 page, CTA field zoo. Use when the user asks to update IAPL, migrate an older project, or clean up duplicated logic in a project.
---
# ipal-upgrade
# iapl-upgrade
What changed in the version: `node_modules/@intecion/ipal-kit/docs/CHANGELOG.md` (the
"Requires project changes" sections — do all of them). List of changes: `…/docs/dev/PROGRAMISTA.md` §6.
@@ -20,15 +20,15 @@ Postgres with migrations: new plugin fields (e.g. `privacyLinkLabel`) →
`pnpm payload migrate:create`.
## 1a. AGENT.md §0b set
After the update, a full **ipal-audit** shows a "missing: …" section — the missing items of
After the update, a full **iapl-audit** shows a "missing: …" section — the missing items of
the MANDATORY SET (GEO: llms-full, Markdown, MCP; R2; Turnstile through
`getTurnstileConfig`…). Wire each one according to PROGRAMISTA §2 — it is part of the update,
not an extra. Skip one only with a client decision in `AGENTS.md` (`ipal-audit-skip:`).
not an extra. Skip one only with a client decision in `AGENTS.md` (`iapl-audit-skip:`).
**1.8.x → 1.9.0 (PROGRAMISTA §6, items 17–21):** `twoFactor.plugin` required;
`getTurnstileConfig` instead of `turnstileSiteKey` (with both keys set the token is
required — check that every form has the widget); `clientIp(await headers())` in
the form action + `IPAL_IP_HEADER` in the production env; `buildR2Storage` wired.
the form action + `IAPL_IP_HEADER` in the production env; `buildR2Storage` wired.
**→ 1.9.2 (PROGRAMISTA §6, items 28–33) — import instead of code, start with item 28 (security):**
a custom `FormRenderer` passed the Emails tab (company addresses) to the HTML → a block with `<RenderForm>` +
@@ -40,11 +40,11 @@ the browser (form: submission + email; page: 200, 404, metadata). Postgres: `mig
**→ 1.11.0 (PROGRAMISTA §6, items 34–37):** remove the workarounds — a copy of `publicForm` (→ `RenderForm values` /
`prepareBuilderForm`), manual `remotePatterns`/`dangerouslyAllowLocalIP` (→ `buildImagesConfig()`), conditional
`storage` in `ipalEnvRules`, a custom product JSON-LD graph (→ `pageJsonLd.entries` + `buildProductJsonLd`),
`storage` in `iaplEnvRules`, a custom product JSON-LD graph (→ `pageJsonLd.entries` + `buildProductJsonLd`),
a custom RenderBlocks for `h1` (→ `isFirst`). Links to posts: `buildLinkField({ relationTo: [...] })` with a data migration.
**→ 1.11.1 (PROGRAMISTA §6, items 38–45):** remove the workarounds (`WORKAROUND ipal-kit` comments) — the
`NEXT_RUNTIME` condition around the `revalidatePath` injected into `buildRevalidateHook` (a global's own `afterChange` hook keeps it — ipal-nav), the form focus guard, a custom theme (→ `ThemeScript`/`ThemeSwitcher`),
**→ 1.11.1 (PROGRAMISTA §6, items 38–45):** remove the workarounds (`WORKAROUND IAPL` comments) — the
`NEXT_RUNTIME` condition around the `revalidatePath` injected into `buildRevalidateHook` (a global's own `afterChange` hook keeps it — iapl-nav), the form focus guard, a custom theme (→ `ThemeScript`/`ThemeSwitcher`),
a custom table of contents (→ `extractHeadings` + `TableOfContents` + `headingIds`), catching `notFound` for a redirect
(→ `onMissing: 'redirectHome'`), background colour only for JPEG in `<Media>`, a custom type instead of `CmsLink['appearance']`
(→ per-shape types from `generate:types`: `CmsLink`, `CmsLinkPlain`, `CmsLinkNoLabel`, `CmsLinkPlainNoLabel`; style: `LinkAppearance`). Cookie banner: `buttons.save` →
@@ -53,7 +53,7 @@ a custom table of contents (→ `extractHeadings` + `TableOfContents` + `heading
**→ 1.12.3 (PROGRAMISTA §6, item 46):** Postgres/SQLite: `migrate:create` (new Cookie banner group →
`detailLabels`, only new columns — no rename). A custom cookie settings window or a cookie list added to
the banner → `<CookieBanner settings="detailed">` and remove the copy. With `detailed`: Cookies → Cookie list filled in
(scan, **ipal-consent-check**) and Detail labels in every language.
(scan, **iapl-consent-check**) and Detail labels in every language.
**→ 1.13.0 (PROGRAMISTA §6, item 47; CHANGELOG "What projects must update" — do all 7, in order):**
1. **Project without `access`** (no `roles` field): every logged-in account can now use the plugin's admin and editor
@@ -68,23 +68,23 @@ the banner → `<CookieBanner settings="detailed">` and remove the copy. With `d
3. **Postgres/SQLite:** `pnpm payload migrate:create` → `migrate` (Site settings → Search engines:
`search_verification_*`, `ai_crawlers_policy`, the `ai_crawlers_rules` table, localized `llms_intro`). With
`enabled: false` the migration now keeps (or restores) the plugin's tables — check it has no DROP TABLE. MongoDB: nothing.
4. `pnpm payload generate:importmap`, `pnpm ipal:skills`, `rm -rf .next`.
4. `pnpm payload generate:importmap`, `pnpm iapl:skills`, `rm -rf .next`.
5. **Behaviour to check** (grep the project, fix what applies): `getSettings` / `getSiteShell` read at `depth: 1` (code
that reads a relation of a relation → `createContentHelpers({ settingsDepth: 2 })`); `sitemap()` throws at runtime
instead of returning `[]` (`sitemapRoute` answers 503); a `twoFactor.collectionSlug` other than `admin.user` stops
startup (`allowCollectionMismatch: true`); requests without a client IP share one limited bucket (proxy hides the IP
→ `IPAL_IP_HEADER`, or `setUnknownIpFactor`); `RenderRichText` turns unsafe link URLs into `#` (`safeLinks`).
→ `IAPL_IP_HEADER`, or `setUnknownIpFactor`); `RenderRichText` turns unsafe link URLs into `#` (`safeLinks`).
6. **Review the new options with the user** (AGENT.md §7.1): `consentMode: 'basic'`, `revalidatePath`,
`turnstileHostnames`, Site settings → Search engines (verification codes, or keep DNS verification), `app/robots.ts` →
`export { getRobots as default }` + `force-dynamic`, `createSearchRoute({ …, isPathVisible })`, `access.firstUserAdmin`.
7. **Remove the workarounds:** a plugin after `ipalKit` that adds `afterChange` or access to the plugin globals →
`ipalKit({ revalidatePath })` / `globalOverrides`; a hand-written global revalidation hook →
7. **Remove the workarounds:** a plugin after `iapl` that adds `afterChange` or access to the plugin globals →
`iapl({ revalidatePath })` / `globalOverrides`; a hand-written global revalidation hook →
`buildGlobalRevalidateHook({ revalidatePath })`; `consentFieldName` passed only because the option was ignored →
`forms.consentFieldName` works now; your own seed guard / upsert code → `@intecion/ipal-kit/seed` (`createSeeder`).
**Every upgrade — Next.js 16.4.5 or later** (AGENT.md §4 item 11): `pnpm ls next sharp`; below 16.4.5 →
`pnpm add [email protected] [email protected] sharp@^0.35.5`, `rm -rf .next`, build, redeploy on Coolify
(a new image ships the fixed next and sharp). **Check:** `pnpm exec ipal-doctor` → no `next-min` finding; `pnpm dev`
(a new image ships the fixed next and sharp). **Check:** `pnpm exec iapl-doctor` → no `next-min` finding; `pnpm dev`
prints no security-upgrade warning.
**Every upgrade — Payload** (AGENT.md §4 items 11–12): the reference site and the starter run Payload **3.94.1**; the
@@ -97,7 +97,7 @@ Coolify first if it is below 22.23.5 (until then, stay on 3.90.x). Then `pnpm in
build, redeploy. Payload 3.91–3.94 change no schema the plugin defines: no migration from the plugin; on
Postgres/SQLite run `pnpm payload migrate:create` anyway and commit it if it is not empty.
**Check:** `pnpm ls payload @payloadcms/ui @payloadcms/db-mongodb` → one version, 3.94.1; the panel opens and a document
saves; `pnpm exec ipal-doctor` → no `versions` finding; Coolify app → Terminal → `node -v` → 22.23.5 or later.
saves; `pnpm exec iapl-doctor` → no `versions` finding; Coolify app → Terminal → `node -v` → 22.23.5 or later.
**Every upgrade — dependency advisories** (AGENT.md §4 item 12): `pnpm audit --prod`; on Payload 3.94.x add the
`dompurify` and `happy-dom` overrides to `pnpm.overrides`; on an older Payload also `mongoose` (MongoDB sites; 3.90–3.93
@@ -112,12 +112,12 @@ The selectors match only vulnerable versions, so on 3.94.x the last two do nothi
`"graphql-scalars@<2.0.1": "^2.0.1"` line is no longer needed (the advisory no longer covers Payload's 1.22.2); remove
it or keep it. Then `pnpm install`, `pnpm build`, commit `package.json` and the lockfile, redeploy on Coolify (no data or
schema change, no migration). **Check:** `pnpm audit --prod` → no high or critical; `pnpm why dompurify happy-dom
mongoose undici` → 3.4.17, 21.0.4, 8.24.7, 7.30.1 or later; `pnpm exec ipal-doctor` → no `transitive-min` finding; the
mongoose undici` → 3.4.17, 21.0.4, 8.24.7, 7.30.1 or later; `pnpm exec iapl-doctor` → no `transitive-min` finding; the
panel opens and a document saves.
**→ 1.14.0 (PROGRAMISTA §6, items 48–49; CHANGELOG "What projects must update" — do all 8, in order):**
1. `pnpm payload generate:importmap` — `@intecion/ipal-kit/admin#FaviconCheck` (hint under Site settings → Site icon)
and the `RowLabel` entries are injected into every project; then `pnpm ipal:skills`, `rm -rf .next`. **Check:** pick
and the `RowLabel` entries are injected into every project; then `pnpm iapl:skills`, `rm -rf .next`. **Check:** pick
a 32×32 PNG as the site icon → a warning appears under the field; saving still works.
2. **Node.js 20.9 or later** (the plugin's `nodemailer` 10 needs it) — check the Coolify build image and `.nvmrc` /
`engines`. Remove `nodemailer` and `@types/nodemailer` from the project's own `package.json` if someone added them
@@ -126,8 +126,8 @@ panel opens and a document saves.
3. **Next.js** — the "Every upgrade — Next.js" step above (today 16.4.5 or later, `sharp@^0.35.5`).
4. **Dependency advisories** — the "Every upgrade — dependency advisories" step above (`dompurify` / `graphql-scalars` /
`undici` overrides on payload 3.90.x). **Check:** `pnpm audit --prod` → no high or critical.
5. **Cookie list kept by hand** → offer `cookieScanner: true` (+ `crawl: true` with `IPAL_COOKIE_SCAN_URL`,
`IPAL_COOKIE_SCAN_TOKEN` and the site in the service's `IPAL_CRAWLER_SITES`, cookie-scanner.md); an own image modal →
5. **Cookie list kept by hand** → offer `cookieScanner: true` (+ `crawl: true` with `IAPL_COOKIE_SCAN_URL`,
`IAPL_COOKIE_SCAN_TOKEN` and the site in the service's `IAPL_CRAWLER_SITES`, cookie-scanner.md); an own image modal →
`lightbox: true` + `<SiteProviders lightbox>` (PROGRAMISTA item 48). Turning either on → Postgres/SQLite
`migrate:create` → `migrate`. Without them: no schema change.
6. **Admin languages:** English and Polish by default when the project sets no `i18n.supportedLanguages`. Ask the
@@ -178,7 +178,7 @@ Cookies in every language; the dashboard shows the reminder while cookies wait.
1. `pnpm payload generate:importmap` — with `cookieScanner`: `@intecion/ipal-kit/admin#CookieReviewTab` and (with
`crawl`) `@intecion/ipal-kit/admin#CookieSiteCheckTab`; commit `importMap.js`. No migration.
2. **Ask the client** about the two new defaults (both overridable): empty languages of the cookie texts fill
themselves from the language an editor writes in (`ipalKit({ fillEmptyLocales: false })` to turn it off); with
themselves from the language an editor writes in (`iapl({ fillEmptyLocales: false })` to turn it off); with
`cookieScanner` the cookie screens become one **Cookies** entry with **Review and approve** and **Site check** tabs
(`cookieScanner: { adminLayout: 'separate' }` for the old entries).
3. Editor instructions and screenshots: **Cookie banner** is now **Cookies**.
@@ -191,7 +191,7 @@ type a cookie purpose in one language and save → the other languages show it,
rows become *Cookie*: set the type of local/session-storage rows by hand. MongoDB: nothing.
2. **Theme key:** code that reads `localStorage.getItem('ipal-theme')` → `THEME_STORAGE_KEY` /
`documentThemeStorageKey()`; a project that also runs next-themes and wants separate keys →
`ipalKit({ theme: { storageKey } })`. Visitors keep their choice (moved before first paint).
`iapl({ theme: { storageKey } })`. Visitors keep their choice (moved before first paint).
3. **Cookie list:** after the next **Scan cookies**, approve the new *theme* entry; remove an old *ipal-theme* row.
4. **Panel link preview (`adminMeta`, `agency`):** nothing required. Remove a hand-written `admin.meta` that only set
the panel title, description, `openGraph` or `robots: noindex` (your `admin.meta` keys still win). The credit reads
@@ -212,53 +212,53 @@ Check: `curl -s -X POST $URL/api/graphql -H 'content-type: application/json' -d
and the browser tab shows the same separator.
Project code that reads `settings.titleSeparator` itself now gets a name: use `titleSeparatorChar()`.
**→ 1.15.0 design tokens (opt-in, design-tokens.md → "Migrating an existing site"):** nothing breaks without it. To adopt:
add the four `@import`s (§6.11) and `src/design/tokens.ts` (template `.agents/skills/ipal-setup/resources/tokens.ts`),
add the four `@import`s (§6.11) and `src/design/tokens.ts` (template `.agents/skills/iapl-setup/resources/tokens.ts`),
map the current `@theme` colours/fonts/radius onto the roles, keep the old names as aliases in a marked legacy
block, delete the `--ipal-*-dark` block kept only for the cookie banner, `pnpm exec ipal-tokens`, then replace old
utilities and `dark:` colour classes file by file (`ipal-audit` lists them) and remove the legacy block. next/font
variables become `--font-family-body` / `--font-family-heading`. Check: `ipal-tokens --check`, the site in both themes.
block, delete the `--ipal-*-dark` block kept only for the cookie banner, `pnpm exec iapl-tokens`, then replace old
utilities and `dark:` colour classes file by file (`iapl-audit` lists them) and remove the legacy block. next/font
variables become `--font-family-body` / `--font-family-heading`. Check: `iapl-tokens --check`, the site in both themes.
Only with the owner's decision ("Project decisions": which sites migrate when).
7. `pnpm ipal:skills` (new agent rules: architecture questions first, ipal-kit first). Optional with the owner's
consent: `pnpm exec ipal-skills --external`.
7. `pnpm iapl:skills` (new agent rules: architecture questions first, IAPL first). Optional with the owner's
consent: `pnpm exec iapl-skills --external`.
**→ 1.15.0 (PROGRAMISTA §6, item 55; CHANGELOG 1.15.0 "What projects must update" — do all 10, in order):**
1. **Seeding after launch:** production seed scripts and Coolify jobs need `SEED_ONLY="pages:kontakt,…"` (dry run
first, back up); a run without it on production now stops. A full re-seed only with the owner's OK:
`IPAL_SEED_ALLOW_FULL=1`. Update seed scripts copied from older templates (`ipal-site`, `ipal-form`).
2. Optional: database names `<domain without dots>_prod` / `_dev` + `ipalEnvRules({ databaseName: true })` (warns only).
`IAPL_SEED_ALLOW_FULL=1`. Update seed scripts copied from older templates (`iapl-site`, `iapl-form`).
2. Optional: database names `<domain without dots>_prod` / `_dev` + `iaplEnvRules({ databaseName: true })` (warns only).
3. Optional: the design-token standard (design-tokens.md → "Migrating an existing site"). A site that styles the
cookie banner only through `--ipal-*-dark`: check the banner in the dark theme.
4. Optional: the block library, block by block (block-library.md); after turning blocks on: `pnpm generate:types`,
`pnpm payload generate:importmap`, Postgres/SQLite `migrate:create`.
5. **CookieButton** lifts above the footer — check a site with its own fixed footer bar; `avoid={false}` keeps it fixed.
6. `pnpm ipal:skills` (new **ipal-doctor**; updated ipal-reference, ipal-setup, ipal-site, ipal-audit).
7. Run `pnpm exec ipal-doctor` (and `--url https://<site>`), fix or silence each finding with a reason in
`ipal-doctor.json`. `IPAL_DOCTOR_TOKEN` (≥ 32 characters) only if the deep check runs against production.
6. `pnpm iapl:skills` (new **iapl-doctor**; updated iapl-reference, iapl-setup, iapl-site, iapl-audit).
7. Run `pnpm exec iapl-doctor` (and `--url https://<site>`), fix or silence each finding with a reason in
`iapl-doctor.json`. `IAPL_DOCTOR_TOKEN` (≥ 32 characters) only if the deep check runs against production.
8. Nothing for the exact dependency pins (`nodemailer` 10.3.1 and three more) beyond `pnpm install`.
9. Pages saved before 1.15.0 keep their stored meta description: re-save a page whose description was empty (the
section header now fills it).
10. New sites: `ipal-kit create` (project-starter.md); single-language / non-`pl` default sites still go through
**ipal-setup**.
**Check:** `pnpm exec ipal-doctor --strict` → 0 errors, 0 warnings; `pnpm build`; a production seed without
10. New sites: `iapl create` (project-starter.md); single-language / non-`pl` default sites still go through
**iapl-setup**.
**Check:** `pnpm exec iapl-doctor --strict` → 0 errors, 0 warnings; `pnpm build`; a production seed without
`SEED_ONLY` stops with "full seed refused".
**→ 1.15.1 (PROGRAMISTA §6, item 56; seed exit guard; seeding.md) — nothing required, recommended:**
1. Every seed script: `import { createSeeder, guardSeedExit } from '@intecion/ipal-kit/seed'` and `guardSeedExit()` as
the first statement, before `getPayload()`; the script ends with `seed.summary()` (the `ipal-site` / `ipal-form`
templates show it). `pnpm ipal:skills` for the updated templates.
the first statement, before `getPayload()`; the script ends with `seed.summary()` (the `iapl-site` / `iapl-form`
templates show it). `pnpm iapl:skills` for the updated templates.
2. **Check:** run the seed with `SEED_DRY_RUN=1` locally → exit 0; in Coolify's Terminal after a seed, `echo $?` → `0`
(a `1` with `[seed] ended …` means the run stopped early — run it again).
**→ 1.15.2 (PROGRAMISTA §6, item 57; ipal-doctor route groups; doctor.md) — nothing required:**
1. `pnpm ipal:skills`; remove a temporary `layout-required` silence in `ipal-doctor.json` added for a route group with
**→ 1.15.2 (PROGRAMISTA §6, item 57; iapl-doctor route groups; doctor.md) — nothing required:**
1. `pnpm iapl:skills`; remove a temporary `layout-required` silence in `iapl-doctor.json` added for a route group with
another name or a `notFoundView.tsx`.
2. Two frontend candidates reported → `"layout": { "frontend": "src/app/(<group>)" }` in `ipal-doctor.json`.
**Check:** `pnpm exec ipal-doctor --strict` → no `layout-required` finding for the site's own route group.
2. Two frontend candidates reported → `"layout": { "frontend": "src/app/(<group>)" }` in `iapl-doctor.json`.
**Check:** `pnpm exec iapl-doctor --strict` → no `layout-required` finding for the site's own route group.
**→ 1.15.3 (PROGRAMISTA §6, item 58; ipal-audit, bilingual panel labels; ipal-audit skill) — nothing required:**
1. `pnpm ipal:skills`, so the updated `audit.sh` and `polish-literals.mjs` reach the project.
2. Remove a temporary `i18n-literals` silence or `ipal-audit-skip` added because of `adminText()` / `{ en, pl }` labels.
**Check:** `pnpm exec ipal-doctor --strict` → no `i18n-literals` finding for a schema file's bilingual labels; Polish
**→ 1.15.3 (PROGRAMISTA §6, item 58; iapl-audit, bilingual panel labels; iapl-audit skill) — nothing required:**
1. `pnpm iapl:skills`, so the updated `audit.sh` and `polish-literals.mjs` reach the project.
2. Remove a temporary `i18n-literals` silence or `iapl-audit-skip` added because of `adminText()` / `{ en, pl }` labels.
**Check:** `pnpm exec iapl-doctor --strict` → no `i18n-literals` finding for a schema file's bilingual labels; Polish
text in a `.tsx` component is still reported.
**→ 1.15.4 (PROGRAMISTA §6, item 59; seeding whole localized arrays; seeding.md) — nothing required:**
@@ -266,7 +266,7 @@ text in a `.tsx` component is still reported.
array) and the panel shows only the last language? A plain re-run skips existing records (create-only): rewrite
them locally with `SEED_UPDATE=1 pnpm seed` and check every language in the panel.
2. Live site, only the affected records: `SEED_ONLY="forms:<title>,pages:<slug>" SEED_UPDATE=1
IPAL_SEED_ALLOW_PROD_UPDATE=1 SEED_DRY_RUN=1 pnpm seed`, back up the database (Coolify), then the same without
IAPL_SEED_ALLOW_PROD_UPDATE=1 SEED_DRY_RUN=1 pnpm seed`, back up the database (Coolify), then the same without
`SEED_DRY_RUN`. Records an editor changed since seeding are skipped (`skip (edited)`) — fix them in the panel.
3. A global array: `fillGlobal` fills empty fields only — clear the field in the panel before the run, or fix it by hand.
**Check:** the panel shows the seeded rows in every language; a second run reports `skip`, not new rows.
@@ -280,9 +280,9 @@ text in a `.tsx` component is still reported.
**Check:** `SEED_DRY_RUN=1 pnpm seed` reports 0 errors; the real run creates the same records.
**→ 1.16.0 (PROGRAMISTA §6, item 61; files on forms, e-mailed and never stored; forms.md "Files") — nothing required:**
1. `pnpm ipal:skills`. Existing forms need nothing; without `forms.attachments` nothing changes. No import map change.
2. Only if the site wants files on a form (ask the owner): `ipalKit({ forms: { attachments: true } })`, a **File** field on
the form (panel or seed — `ipal-form` skill), one e-mail of that form with a fixed recipient (no `{{field}}`),
1. `pnpm iapl:skills`. Existing forms need nothing; without `forms.attachments` nothing changes. No import map change.
2. Only if the site wants files on a form (ask the owner): `iapl({ forms: { attachments: true } })`, a **File** field on
the form (panel or seed — `iapl-form` skill), one e-mail of that form with a fixed recipient (no `{{field}}`),
`pnpm generate:types`; Postgres/SQLite: `pnpm payload migrate:create` (additive). Add the `formClasses` keys `file`,
`help`, `fileList`, `fileItem`, `fileRemove`; fill Form messages → Files for languages other than en/pl.
3. A hand-built upload path for a form (own collection, bucket, route): replace it with the File field and remove it
@@ -298,17 +298,17 @@ sender mailbox a minute later.
every site below Next.js 16.4.5:**
1. `pnpm add [email protected] [email protected]`, `rm -rf .next`, `pnpm build`; commit `package.json` and the lockfile,
redeploy on Coolify (the new image ships the fixed Next.js).
2. `pnpm ipal:skills` (updated `ipal-setup` / `ipal-upgrade`).
**Check:** `pnpm ls next` → 16.4.6; `pnpm exec ipal-doctor` → no `next-min` finding; `pnpm dev` prints no security warning.
2. `pnpm iapl:skills` (updated `iapl-setup` / `iapl-upgrade`).
**Check:** `pnpm ls next` → 16.4.6; `pnpm exec iapl-doctor` → no `next-min` finding; `pnpm dev` prints no security warning.
**→ 1.16.2 (PROGRAMISTA §6, item 63; Payload's mongoose and happy-dom advisories; AGENT.md §4 item 12) — required for
every site:**
1. Add to `pnpm.overrides` in `package.json`: `"mongoose@>=8 <8.24.7": "~8.24.10"` (MongoDB sites only) and
`"happy-dom@<21.0.4": "^21.0.4"` (every site). Then `pnpm install`, `pnpm build`; commit `package.json` and the
lockfile, redeploy on Coolify. No data change, no migration.
2. `pnpm ipal:skills` (updated `ipal-setup` / `ipal-upgrade`).
2. `pnpm iapl:skills` (updated `iapl-setup` / `iapl-upgrade`).
**Check:** `pnpm why mongoose happy-dom` → mongoose 8.24.10, happy-dom 21.0.4; `pnpm audit --prod` → no high or critical;
`pnpm exec ipal-doctor` → no `transitive-min` finding; open the panel and save a document.
`pnpm exec iapl-doctor` → no `transitive-min` finding; open the panel and save a document.
**→ 1.16.3 (PROGRAMISTA §6, item 64; Payload 3.94.1 in the reference site and the starter; AGENT.md §4 items 11–12) —
recommended, not required (the plugin's peer range stays `^3.90.2`):**
@@ -323,9 +323,9 @@ recommended, not required (the plugin's peer range stays `^3.90.2`):**
`pnpm build`; commit `package.json` and the lockfile, redeploy on Coolify.
3. Postgres/SQLite: `pnpm payload migrate:create`, commit it if it is not empty (3.94.1 changes long index and foreign
key names). MongoDB: no migration.
4. `pnpm ipal:skills` (updated `ipal-setup` / `ipal-upgrade`).
4. `pnpm iapl:skills` (updated `iapl-setup` / `iapl-upgrade`).
**Check:** `pnpm ls payload @payloadcms/ui @payloadcms/db-mongodb` → 3.94.1; `pnpm why dompurify happy-dom` → 3.4.17,
21.0.4; `pnpm audit --prod` → no high or critical; `pnpm exec ipal-doctor` → no `versions` finding; Coolify Terminal
21.0.4; `pnpm audit --prod` → no high or critical; `pnpm exec iapl-doctor` → no `versions` finding; Coolify Terminal
`node -v` → 22.23.5 or later; the panel opens, a document saves, a form submission arrives.
**→ 1.16.4 (PROGRAMISTA §6, items 65–66; security fixes: 2FA coverage and staff checks) — required
@@ -333,11 +333,11 @@ for every site:**
0. **Before deploying:** check the production `PAYLOAD_SECRET` length (Coolify app → Terminal →
`node -e 'console.log(process.env.PAYLOAD_SECRET.length)'`). Shorter than 32: set a new random secret (with the
owner's OK: logs everyone out, 2FA code again, API keys regenerate; deployment.md "`PAYLOAD_SECRET` — length and
changing it"), or add `secretMinLength: 0` to `ipalEnvRules({ … })` for now and note it under "Project
changing it"), or add `secretMinLength: 0` to `iaplEnvRules({ … })` for now and note it under "Project
decisions" in AGENTS.md.
1. Update the package, `pnpm install`, `pnpm ipal:skills`, build, redeploy on Coolify. No migration, no config
1. Update the package, `pnpm install`, `pnpm iapl:skills`, build, redeploy on Coolify. No migration, no config
change for a site with one auth collection. `pnpm ls @clocklimited/payload-2fa` should show 3.0.0-beta.7 (tested: beta.1 and beta.7);
another version may stop startup with `[ipal] twoFactor: the injected 2FA plugin did not add …`.
another version may stop startup with `[iapl] twoFactor: the injected 2FA plugin did not add …`.
2. `grep -rn "auth:" src/collections` — more than one auth collection? Then: `admin: { user: '<staff slug>' }` in
`buildConfig`; `adminOrSelfIn('<slug>')` instead of `adminOrSelf` in each; `access.staffCollections` only when
the second collection is staff (access.md "Who is staff"). Never list a visitor collection there. Roles now
@@ -353,7 +353,7 @@ for every site:**
`isAdmin(user, { staffCollections: ['users'] })`. A **client component imports them from
`@intecion/ipal-kit/client`** (not in 1.16.4–1.16.6: go to 1.16.7); the main entry there fails with
`next build --webpack` (`'server-only' cannot be imported from a Client Component module`).
4. `pnpm exec ipal-doctor --url <site>` (with the doctor token) → accounts without 2FA must be 0. An account that
4. `pnpm exec iapl-doctor --url <site>` (with the doctor token) → accounts without 2FA must be 0. An account that
has not set TOTP up opens everything with its password alone: have its owner set it up now, or remove it.
5. Tell the owner what the CHANGELOG entry says under "Requires project changes" and agree on it: new SMTP
password and Turnstile secret, a look through Site settings, Site integrations and each form's Emails tab.
@@ -362,16 +362,16 @@ for every site:**
Check) → `403` from `/api/globals/site-integrations`, `/api/form-submissions`, `/api/users`; log in fully in the
panel → Site integrations and a form submission open, a setting saves. With a second auth collection: its token
gets `403` from the same addresses and from `POST /api/setup-totp`. The Coolify log has no
`PAYLOAD_SECRET must be at least`; `pnpm exec ipal-doctor` has no `env` finding.
`PAYLOAD_SECRET must be at least`; `pnpm exec iapl-doctor` has no `env` finding.
**→ 1.16.5 (PROGRAMISTA §6, item 67; CHANGELOG 1.16.5; security.md "The `back` link of the 2FA screens") — required with 2FA on:**
1. **Do this in ONE deploy with the upgrade, or the panel is locked for everyone.** Run `pnpm exec ipal-doctor`
1. **Do this in ONE deploy with the upgrade, or the panel is locked for everyone.** Run `pnpm exec iapl-doctor`
before deploying.
`pnpm payload generate:importmap` — the plugin puts `@intecion/ipal-kit/admin#SafeTotpView` in front of the
2FA package's setup and verify views; commit `importMap.js`, `rm -rf .next`, redeploy on Coolify. With the old
import map the build passes and the site starts, but the 2FA screens have no code form (HTTP 200) — nobody can
sign in. Signs: `pnpm exec ipal-doctor` → `import map lacks …SafeTotpView` (run it before deploying); the log
line `[ipal] The admin import map may be out of date` at start; the notice "Two-step verification may not be
sign in. Signs: `pnpm exec iapl-doctor` → `import map lacks …SafeTotpView` (run it before deploying); the log
line `[iapl] The admin import map may be out of date` at start; the notice "Two-step verification may not be
available" where the form should be. Fix: the same command, commit, redeploy.
The log line and the notice with a **working** code form mean a false alarm (the `importMap.js` on disk is not
the one the build used — a Dockerfile runner stage, a re-exporting map): sign-in works; set
@@ -380,33 +380,33 @@ gets `403` from the same addresses and from `POST /api/setup-totp`. The Coolify
the code → you land on `/admin` (not on example.com); a normal login still returns to the page you came from.
No option, env, schema or migration. A project that registered its own 2FA views, or wrote a proxy rule that
strips `back`, can keep them (`twoFactor.safeBack: false` turns the plugin's check off).
2. `pnpm ipal:skills`.
2. `pnpm iapl:skills`.
**→ 1.16.6 — 2FA setup required (CHANGELOG 1.16.6; PROGRAMISTA §6, item 68; security.md "Setup required") — required with 2FA on:**
**Not a routine patch, although the number is one.** From this version an account without 2FA can only set it up and is
blocked after 72 hours; on Postgres / SQLite a missing migration locks everyone out of the panel. Do not upgrade a live
site without steps 1–3 and a deploy day agreed with the owner. Steps 2, 3 and 5 go in ONE deploy.
1. **Before upgrading a live site:** `pnpm exec ipal-doctor --url <site>` (doctor token) → accounts without 2FA.
1. **Before upgrading a live site:** `pnpm exec iapl-doctor --url <site>` (doctor token) → accounts without 2FA.
Tell the owner: from the upgrade on, such an account can only set 2FA up, and has 72 hours for it; after that
an administrator must reopen setup on the account's page. Have them set it up now, or remove unused accounts.
Make sure at least one administrator (better two) has 2FA set up — otherwise nobody can reopen setup from the panel.
The 72 hours of existing accounts start at the first start after the deploy and are counted once (restarts
and redeploys do not extend them): agree the deploy day with the owner.
2. Update the package, `pnpm install`, `pnpm ipal:skills`, `pnpm payload generate:types`,
2. Update the package, `pnpm install`, `pnpm iapl:skills`, `pnpm payload generate:types`,
**`pnpm payload generate:importmap`** (new: `TwoFactorStatusField`, `TwoFactorAlert`; commit `importMap.js`),
then `pnpm exec ipal-doctor` before deploying.
then `pnpm exec iapl-doctor` before deploying.
3. **Postgres/SQLite — required, same deploy, or nobody can log in:** `pnpm payload migrate:create` (adds the
column `totp_setup_from` to the 2FA collection; needed whenever 2FA is on, also with `requireSetup: false`),
commit, and have it applied **when the new container starts**: `prodMigrations` in the database adapter, or the
start command `pnpm payload migrate && pnpm start` (deployment.md §4.3). **Never Coolify's Pre-deployment
command** — it runs in the old container, without the new migration, and the new version then starts without
the column. Without the column every login answers 500, administrators included; the log says
`[ipal] 2FA: the column for "totpSetupFrom" is missing … NOBODY CAN LOG IN`. `pnpm exec ipal-doctor` reports
`[iapl] 2FA: the column for "totpSetupFrom" is missing … NOBODY CAN LOG IN`. `pnpm exec iapl-doctor` reports
it before the deploy. MongoDB: nothing.
4. An integration that logs in with a password and has no TOTP: give it an API key, or
`twoFactor.requireSetup: { exempt: ({ user }) => user.email === '…' }`. `grep -rn "overrideAccess: false" src`:
a `user` fetched by id is refused for every account now — take it from `payload.auth({ headers })`.
5. `rm -rf .next`, build, redeploy on Coolify. Read the first lines of the log: `[ipal] 2FA: N existing account(s)
5. `rm -rf .next`, build, redeploy on Coolify. Read the first lines of the log: `[iapl] 2FA: N existing account(s)
without two-step verification…` — pass that number to the owner. The line appears on that first start only.
Postgres/SQLite: if logins answer 500 after the deploy, the migration from step 3 did not run — check that it
is committed and that the container runs migrations at start (deployment.md §4.3), then redeploy.
@@ -424,12 +424,12 @@ setup screen with "Set up two-step verification by …"; after the code it is in
account → "Two-step verification: Set up." and the reset button; delete the account.
**→ 1.16.7 (hardening; CHANGELOG 1.16.7; PROGRAMISTA §6, item 69) — not a routine patch: agree the deploy with the owner, read every point, most sites change nothing:**
1. Update the package, `pnpm install`, `pnpm ipal:skills`, `pnpm payload generate:types`. No import-map change, **no
1. Update the package, `pnpm install`, `pnpm iapl:skills`, `pnpm payload generate:types`. No import-map change, **no
schema change and no migration** on any database (the verify count uses Payload's own `payload-kv`
collection). `grep -n "staffCollections\|authCollection" src/payload.config.ts`: every slug there must be an
auth collection of the config — with a wrong one Payload does not start (the slug is in the log; `/api/health`
answers 503, so with a health check Coolify keeps the old container).
2. **Panel access by role.** After the first start read the log: `[ipal] N account(s) of "users" are below the
2. **Panel access by role.** After the first start read the log: `[iapl] N account(s) of "users" are below the
role "editor" and cannot open the admin panel`. Those accounts (role `user`, or no role) now see
"Unauthorized" in the panel. Give the people who work in the panel `editor`, or set
`accounts: { panelRole: 'user' }`. The line `NOBODY can open the admin panel` (an error) means no account has
@@ -444,13 +444,13 @@ account → "Two-step verification: Set up." and the reset button; delete the ac
is set to Microsoft Graph; a script that does that over REST / GraphQL sends the password with it, a seed
with the Local API is not asked. `secrets: { reenterOnChange: false }` turns it off. During a rolling update a page opened under the new version and saved against the OLD one stores
`********` as the password: after the deploy, check that a test e-mail goes out.
4. **`TURNSTILE_SECRET_KEY` is deprecated** (it still works). If the log says `[ipal] Deprecated: the Turnstile
secret key comes from the TURNSTILE_SECRET_KEY environment variable` or `ipal-doctor --url` reports
4. **`TURNSTILE_SECRET_KEY` is deprecated** (it still works). If the log says `[iapl] Deprecated: the Turnstile
secret key comes from the TURNSTILE_SECRET_KEY environment variable` or `iapl-doctor --url` reports
`turnstile-env-key`: with the owner, copy the key into Site integrations → Spam protection → Secret key, send a
test form, then remove the variable in Coolify. Do not do it on a client site without the owner. Nothing
breaks if you wait; the removal will be announced in the changelog.
5. **Forms with files and Turnstile.** While Turnstile cannot check (wrong keys, Cloudflare down), a form with a
File field is now refused (text forms are accepted as before). Check `ipal-doctor --url` → no
File field is now refused (text forms are accepted as before). Check `iapl-doctor --url` → no
`turnstile-degraded`; to keep the old behaviour: `forms: { turnstileOnConfigError: { files: 'allow' } }`.
6. **Account creation and changes.** A project whose **own** staff collection has no `create` / `update` /
`delete` / `unlock` / `read` rule gets one (before: any signed-in account of any auth collection — a customer
@@ -469,12 +469,12 @@ account → "Two-step verification: Set up." and the reset button; delete the ac
- the collection has **role values of its own that hold neither** (`superadmin`, …) or no roles: accounts of that collection
keep working as before, except that an account no longer changes its **own** roles; accounts of other
collections are refused. **Write your own rules** — the plugin does not know your roles, and inside the
collection every account can still create an account with any role (`ipal-doctor --url` →
collection every account can still create an account with any role (`iapl-doctor --url` →
`staff-own-roles`);
- `read`: only staff accounts read a staff collection. **Check:** does the front end show staff accounts
(an author box) to logged-in visitors with the visitor's session? Then write that collection's `read` rule,
or `accounts: { staffOnlyRead: false }`. Anonymous visitors never could.
A staff collection added by a plugin listed after ipalKit gets the same rules at start, put in FRONT of the
A staff collection added by a plugin listed after iapl gets the same rules at start, put in FRONT of the
rules it has (both must allow). If that plugin's collection needs a rule wider than the plugin's default,
set `custom: { ipal: { accountRules: false } }` on it.
From 1.16.8: a **copy** of a staff collection made by such a plugin (`{ ...staff, slug: 'copy' }`)
@@ -497,7 +497,7 @@ account → "Two-step verification: Set up." and the reset button; delete the ac
address**: `serverURL` is set, or the proxy passes `Host` (Coolify / Traefik do) or `X-Forwarded-Host`.
**Check before the deploy:** is `serverURL` set? If not and the proxy rewrites `Host` (nginx's plain
`proxy_pass`), nobody can enter a 2FA code after the upgrade — set `serverURL`. After the deploy log in with
a code; if it answers "Not allowed from this origin.", the log has `[ipal] 2FA: a code from origin "…" was
a code; if it answers "Not allowed from this origin.", the log has `[iapl] 2FA: a code from origin "…" was
refused` with the fix.
9. **Dashboard alerts.** Editors now see "An integration needs attention. Ask an administrator." instead of the
error text; accounts with only `user` see no alerts. `dashboardAlerts: { integrations: 'all' }` restores it
@@ -505,12 +505,12 @@ account → "Two-step verification: Set up." and the reset button; delete the ac
10. **Role checks in client components.** `grep -rlE "^['\"]use client" src | xargs grep -nE "from '@intecion/ipal-kit'"`
— a file that imports `isAdmin`, `isEditor` or `hasMinimumRole` there: change the import to
`@intecion/ipal-kit/client` and keep the second argument (`isAdmin(user, config)`). `import type` may stay.
**Check:** `pnpm exec ipal-doctor --url <site>` (new rules: `access-missing`, `csrf-empty`, `open-signup`,
**Check:** `pnpm exec iapl-doctor --url <site>` (new rules: `access-missing`, `csrf-empty`, `open-signup`,
`staff-accounts-open`, `staff-own-roles`, `turnstile-degraded`, `turnstile-env-key`); as an admin `GET /api/globals/site-integrations` shows
`"smtpPassword":"********"`; a test e-mail and a test form still work; an editor and an admin still log in.
**→ 1.16.8 (security follow-ups; CHANGELOG 1.16.8; PROGRAMISTA §6, item 71) — most sites: update, rebuild, read the start log:**
1. Update the package, `pnpm install`, `pnpm ipal:skills`. No option, schema, migration or import-map change.
1. Update the package, `pnpm install`, `pnpm iapl:skills`. No option, schema, migration or import-map change.
2. **Built with Turbopack?** `grep -n '"build"' package.json` — `next build` without `--webpack`: the old build serves
the plugin's `package.json` under `/_next/static/media/` (registry and repository addresses, no secret).
`rm -rf .next`, build, `find .next/static -name 'package*.json'` prints nothing; redeploy; purge a CDN or cache.
@@ -524,20 +524,42 @@ account → "Two-step verification: Set up." and the reset button; delete the ac
- anything else: nothing.
4. **Start log:** `No staff account holds the role "admin", so NOBODY can …` → give one account `admin` with a script
(`pnpm payload run`, Local API) or write the rules. `Could not check …` → make sure one account holds `admin`.
5. **A plugin listed after ipalKit that copies a staff collection or sets `admin.user`**
5. **A plugin listed after iapl that copies a staff collection or sets `admin.user`**
(`grep -rn "\.\.\.staff\|collections: \[\.\.\." src` in the project's own plugins): CHANGELOG 1.16.8 "Requires project
changes" — the copy's `access.update`, `accountRules: false`, or naming the collection in `access.staffCollections`.
**Check:** a customer and the lowest staff account get `403` on `POST /api/<staff collection>`; an admin still manages
accounts; `pnpm exec ipal-doctor --url <site>` (`staff-own-roles`).
accounts; `pnpm exec iapl-doctor --url <site>` (`staff-own-roles`).
**→ 1.17.0 (the plugin is called IAPL; CHANGELOG 1.17.0; PROGRAMISTA §6, item 72) — nothing is required:**
Every name from before keeps working: `ipalKit()` and the other old exports, the `ipal-*` commands, `IPAL_*` env,
`ipal-doctor.json`, `ipal-audit-skip`, the old pointer block. The package is still `@intecion/ipal-kit`; routes
`/api/ipal/*`, `--ipal-*` tokens, `data-ipal` hooks and the cookie `ipal_vid` are unchanged (AGENT.md "Names: IAPL and
ipal-kit"). **Do not rename anything in the project unless the owner asks.**
1. Update the package, `pnpm install`. No option, schema, migration or import-map change (`pnpm payload generate:importmap`
gives no diff).
2. Refresh the skills: `pnpm exec iapl-skills` (or the project's `pnpm ipal:skills` script — the same program). It
installs `iapl-*`, removes the 16 old `ipal-*` folders by name (a skill of the project's own named `ipal-…` stays),
and rewrites the pointer block in `AGENTS.md` in place. Commit the result. Old skill names written by hand in
`AGENTS.md` ("Project decisions") are not touched: update them when you edit that file anyway.
3. Log filters or alerts on the text `[ipal]`: the prefix is `[iapl]` now.
4. **Only when the owner asks to move to the new names** (each step is optional and independent):
`ipalKit` → `iapl` and the other exports in `payload.config.ts` / `instrumentation.ts`; scripts in `package.json`
(`ipal-tokens` → `iapl-tokens`, …); `git mv ipal-doctor.json iapl-doctor.json`; `ipal-audit-skip:` → `iapl-audit-skip:`;
in Coolify `IPAL_<NAME>` → `IAPL_<NAME>` (add the new one, redeploy, then remove the old one — never both with
different values). `pnpm exec iapl-doctor` rule `legacy-names` (info) lists what is left.
5. **Never on an existing site:** `storageNames: 'iapl'` or `visitorCookie`. They are for sites made with 1.17.0 or
later; on a live site they reset visitors' statistics history and the 2FA attempt counts, and change the cookie list.
**Check:** `pnpm exec iapl-doctor` shows no new error or warning (new rules: `legacy-names`, `storage-names`); the site
builds; the panel opens; the old commands (`pnpm exec ipal-doctor`) still run.
## 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):
`git diff v<old> v<new> -- reference/` in the IAPL 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.
it applies to the project. Run the **iapl-audit** skill (`--quick`) and attach the result.
Result: a prioritised to-do list — carry it out right away. Stop
only before an irreversible change (data migration with content → **ipal-migrate-fields**,
only before an irreversible change (data migration with content → **iapl-migrate-fields**,
changing published slugs).
## 3. Item by item
@@ -551,8 +573,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, 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
A full **iapl-audit** with no errors, then `pnpm exec iapl-doctor` (after `pnpm exec iapl-skills` and
`pnpm payload generate:importmap`): no new errors against the report before the upgrade (skill **iapl-doctor**;
new rules come with new versions — read each finding, fix or record the owner's decision in `iapl-doctor.json` with a
reason). Before the upgrade, `pnpm dlx --package=@intecion/ipal-kit@latest iapl-doctor --offline` shows what the newest
rules will report. Then the list of things to check in the admin panel.